X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_pipeline%2Frte_table_action.h;h=44041b5c91bfc1ed4e373a2ac544ea9b39fbf9ac;hb=15a74163b12ed9b8b980b1576bdd8de16d60612b;hp=73b564c144f480a818f42422d80782f4f140b2ad;hpb=b594cf43c36e76050f3fcc7e9be42cbb8c52358b;p=dpdk.git diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index 73b564c144..44041b5c91 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -93,6 +93,15 @@ enum rte_table_action_type { /** Timestamp. */ RTE_TABLE_ACTION_TIME, + + /** Crypto. */ + RTE_TABLE_ACTION_SYM_CRYPTO, + + /** Tag. */ + RTE_TABLE_ACTION_TAG, + + /** Packet decapsulations. */ + RTE_TABLE_ACTION_DECAP, }; /** Common action configuration (per table action profile). */ @@ -193,7 +202,7 @@ struct rte_table_action_dscp_table_entry { /** Packet color. Used by the meter action as the packet input color * for the color aware mode of the traffic metering algorithm. */ - enum rte_meter_color color; + enum rte_color color; }; /** DSCP translation table. */ @@ -250,7 +259,7 @@ struct rte_table_action_mtr_tc_params { uint32_t meter_profile_id; /** Policer actions. */ - enum rte_table_action_policer policer[e_RTE_METER_COLORS]; + enum rte_table_action_policer policer[RTE_COLORS]; }; /** Meter action statistics counters per traffic class. */ @@ -259,13 +268,13 @@ struct rte_table_action_mtr_counters_tc { * and before the policer actions are executed. Only valid when * *n_packets_valid* is non-zero. */ - uint64_t n_packets[e_RTE_METER_COLORS]; + uint64_t n_packets[RTE_COLORS]; /** Number of packet bytes per color at the output of the traffic * metering and before the policer actions are executed. Only valid when * *n_bytes_valid* is non-zero. */ - uint64_t n_bytes[e_RTE_METER_COLORS]; + uint64_t n_bytes[RTE_COLORS]; /** When non-zero, the *n_packets* field is valid. */ int n_packets_valid; @@ -371,12 +380,15 @@ enum rte_table_action_encap_type { * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether } */ RTE_TABLE_ACTION_ENCAP_VXLAN, + + /** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */ + RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE, }; /** Pre-computed Ethernet header fields for encapsulation action. */ struct rte_table_action_ether_hdr { - struct ether_addr da; /**< Destination address. */ - struct ether_addr sa; /**< Source address. */ + struct rte_ether_addr da; /**< Destination address. */ + struct rte_ether_addr sa; /**< Source address. */ }; /** Pre-computed VLAN header fields for encapsulation action. */ @@ -520,6 +532,16 @@ struct rte_table_action_encap_config { }; }; +/** QinQ_PPPoE encap parameters. */ +struct rte_table_encap_ether_qinq_pppoe { + + /** Only valid when *type* is set to QinQ. */ + struct rte_table_action_ether_hdr ether; + struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */ + struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */ + struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */ +}; + /** Encap action parameters (per table rule). */ struct rte_table_action_encap_params { /** Encapsulation type. */ @@ -544,6 +566,9 @@ struct rte_table_action_encap_params { /** Only valid when *type* is set to VXLAN. */ struct rte_table_action_encap_vxlan_params vxlan; + + /** Only valid when *type* is set to QinQ_PPPoE. */ + struct rte_table_encap_ether_qinq_pppoe qinq_pppoe; }; }; @@ -680,6 +705,111 @@ struct rte_table_action_time_params { uint64_t time; }; +/** + * RTE_TABLE_ACTION_CRYPTO + */ +#ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX +#define RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX (16) +#endif + +#ifndef RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX +#define RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX (16) +#endif + +#ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET +#define RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET \ + (sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op)) +#endif + +/** Common action structure to store the data's value, length, and offset */ +struct rte_table_action_vlo { + uint8_t *val; + uint32_t length; + uint32_t offset; +}; + +/** Symmetric crypto action configuration (per table action profile). */ +struct rte_table_action_sym_crypto_config { + /** Target Cryptodev ID. */ + uint8_t cryptodev_id; + + /** + * Offset to rte_crypto_op structure within the input packet buffer. + * Offset 0 points to the first byte of the MBUF structure. + */ + uint32_t op_offset; + + /** The mempool for creating cryptodev sessions. */ + struct rte_mempool *mp_create; + + /** The mempool for initializing cryptodev sessions. */ + struct rte_mempool *mp_init; +}; + +/** Symmetric Crypto action parameters (per table rule). */ +struct rte_table_action_sym_crypto_params { + + /** Xform pointer contains all relevant information */ + struct rte_crypto_sym_xform *xform; + + /** + * Offset within the input packet buffer to the first byte of data + * to be processed by the crypto unit. Offset 0 points to the first + * byte of the MBUF structure. + */ + uint32_t data_offset; + + union { + struct { + /** Cipher iv data. */ + struct rte_table_action_vlo cipher_iv; + + /** Cipher iv data. */ + struct rte_table_action_vlo cipher_iv_update; + + /** Auth iv data. */ + struct rte_table_action_vlo auth_iv; + + /** Auth iv data. */ + struct rte_table_action_vlo auth_iv_update; + + } cipher_auth; + + struct { + /** AEAD AAD data. */ + struct rte_table_action_vlo aad; + + /** AEAD iv data. */ + struct rte_table_action_vlo iv; + + /** AEAD AAD data. */ + struct rte_table_action_vlo aad_update; + + /** AEAD iv data. */ + struct rte_table_action_vlo iv_update; + + } aead; + }; +}; + +/** + * RTE_TABLE_ACTION_TAG + */ +/** Tag action parameters (per table rule). */ +struct rte_table_action_tag_params { + /** Tag to be attached to the input packet. */ + uint32_t tag; +}; + +/** + * RTE_TABLE_ACTION_DECAP + */ +/** Decap action parameters (per table rule). */ +struct rte_table_action_decap_params { + /** Number of bytes to be removed from the start of the packet. */ + uint16_t n; +}; + /** * Table action profile. */ @@ -693,7 +823,8 @@ struct rte_table_action_profile; * @return * Table action profile handle on success, NULL otherwise. */ -struct rte_table_action_profile * __rte_experimental +__rte_experimental +struct rte_table_action_profile * rte_table_action_profile_create(struct rte_table_action_common_config *common); /** @@ -704,7 +835,8 @@ rte_table_action_profile_create(struct rte_table_action_common_config *common); * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_profile_free(struct rte_table_action_profile *profile); /** @@ -722,7 +854,8 @@ rte_table_action_profile_free(struct rte_table_action_profile *profile); * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_profile_action_register(struct rte_table_action_profile *profile, enum rte_table_action_type type, void *action_config); @@ -742,7 +875,8 @@ rte_table_action_profile_action_register(struct rte_table_action_profile *profil * * @see rte_table_action_create() */ -int __rte_experimental +__rte_experimental +int rte_table_action_profile_freeze(struct rte_table_action_profile *profile); /** @@ -765,7 +899,8 @@ struct rte_table_action; * * @see rte_table_action_create() */ -struct rte_table_action * __rte_experimental +__rte_experimental +struct rte_table_action * rte_table_action_create(struct rte_table_action_profile *profile, uint32_t socket_id); @@ -777,7 +912,8 @@ rte_table_action_create(struct rte_table_action_profile *profile, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_free(struct rte_table_action *action); /** @@ -790,7 +926,8 @@ rte_table_action_free(struct rte_table_action *action); * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_table_params_get(struct rte_table_action *action, struct rte_pipeline_table_params *params); @@ -812,7 +949,8 @@ rte_table_action_table_params_get(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_apply(struct rte_table_action *action, void *data, enum rte_table_action_type type, @@ -831,7 +969,8 @@ rte_table_action_apply(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_dscp_table_update(struct rte_table_action *action, uint64_t dscp_mask, struct rte_table_action_dscp_table *table); @@ -850,7 +989,8 @@ rte_table_action_dscp_table_update(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_meter_profile_add(struct rte_table_action *action, uint32_t meter_profile_id, struct rte_table_action_meter_profile *profile); @@ -866,7 +1006,8 @@ rte_table_action_meter_profile_add(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_meter_profile_delete(struct rte_table_action *action, uint32_t meter_profile_id); @@ -897,7 +1038,8 @@ rte_table_action_meter_profile_delete(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_meter_read(struct rte_table_action *action, void *data, uint32_t tc_mask, @@ -923,7 +1065,8 @@ rte_table_action_meter_read(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_ttl_read(struct rte_table_action *action, void *data, struct rte_table_action_ttl_counters *stats, @@ -948,7 +1091,8 @@ rte_table_action_ttl_read(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_stats_read(struct rte_table_action *action, void *data, struct rte_table_action_stats_counters *stats, @@ -968,11 +1112,27 @@ rte_table_action_stats_read(struct rte_table_action *action, * @return * Zero on success, non-zero error code otherwise. */ -int __rte_experimental +__rte_experimental +int rte_table_action_time_read(struct rte_table_action *action, void *data, uint64_t *timestamp); +/** + * Table action cryptodev symmetric session get. + * + * @param[in] action + * Handle to table action object (needs to be valid). + * @param[in] data + * Data byte array (typically table rule data) with sym crypto action. + * @return + * The pointer to the session on success, NULL otherwise. + */ +__rte_experimental +struct rte_cryptodev_sym_session * +rte_table_action_crypto_sym_session_get(struct rte_table_action *action, + void *data); + #ifdef __cplusplus } #endif