add OCTEONTX2 inline IPsec support
Subsystems (3)
PATCH v4 3/15 crypto/octeontx2: configure for inline IPsec
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
For enabling outbound inline IPsec, a CPT queue needs to be tied to a NIX PF_FUNC. Distribute CPT queues fairly among all available otx2 eth ports.
For inbound, one CPT LF will be assigned and initialized by kernel.
--- drivers/crypto/octeontx2/Makefile | 3 +- drivers/crypto/octeontx2/meson.build | 2 + drivers/crypto/octeontx2/otx2_cryptodev_mbox.c | 54 ++++++++++++++++++++++++++ drivers/crypto/octeontx2/otx2_cryptodev_mbox.h | 7 ++++ drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 39 +++++++++++++++++++ 5 files changed, 104 insertions(+), 1 deletion(-)
drivers/crypto/octeontx2/Makefile +2 -1
@@ -10,7 +10,7 @@ LIB = librte_pmd_octeontx2_crypto.a # build flags CFLAGS += $(WERROR_FLAGS) -LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_eal -lrte_ethdev -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_cryptodev LDLIBS += -lrte_pci -lrte_bus_pci LDLIBS += -lrte_common_cpt -lrte_common_octeontx2
@@ -21,6 +21,7 @@ CFLAGS += -O3 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 CFLAGS += -DALLOW_EXPERIMENTAL_API ifneq ($(CONFIG_RTE_ARCH_64),y)
drivers/crypto/octeontx2/meson.build +2 -0
@@ -8,6 +8,7 @@ endif deps += ['bus_pci'] deps += ['common_cpt'] deps += ['common_octeontx2'] +deps += ['ethdev'] name = 'octeontx2_crypto' allow_experimental_apis = true
@@ -32,3 +33,4 @@ endforeach includes += include_directories('../../common/cpt') includes += include_directories('../../common/octeontx2') includes += include_directories('../../mempool/octeontx2') +includes += include_directories('../../net/octeontx2')
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c +54 -0
67 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +7 -0
@@ -7,6 +7,8 @@#include <rte_cryptodev.h> +#include "otx2_cryptodev_hw_access.h" +int otx2_cpt_available_queues_get (const struct rte_cryptodev *dev,uint16_t *nb_queues);
@@ -22,4 +24,9 @@ int otx2_cpt_af_reg_read(const struct rte_cryptodev *dev, uint64_t reg,int otx2_cpt_af_reg_write (const struct rte_cryptodev *dev,uint64_t reg,uint64_t val); +int otx2_cpt_qp_ethdev_bind (const struct rte_cryptodev *dev, +struct otx2_cpt_qp *qp,uint16_t port_id); + +int otx2_cpt_inline_init (const struct rte_cryptodev *dev); +#endif /* _OTX2_CRYPTODEV_MBOX_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +39 -0
@@ -6,6 +6,7 @@#include <rte_cryptodev_pmd.h> #include <rte_errno.h> +#include <rte_ethdev.h> #include "otx2_cryptodev.h" #include "otx2_cryptodev_capabilities.h"
@@ -13,6 +14,7 @@#include "otx2_cryptodev_mbox.h" #include "otx2_cryptodev_ops.h" #include "otx2_mbox.h" +#include "otx2_sec_idev.h" #include "cpt_hw_types.h" #include "cpt_pmd_logs.h"
@@ -127,6 +129,29 @@ otx2_cpt_metabuf_mempool_destroy(struct otx2_cpt_qp *qp) meta_info->sg_mlen =0 ; } +static int +otx2_cpt_qp_inline_cfg (const struct rte_cryptodev *dev,struct otx2_cpt_qp *qp) +{ +static rte_atomic16_t port_offset =RTE_ATOMIC16_INIT (-1 ); +uint16_t port_id, nb_ethport =rte_eth_dev_count_avail (); +int i, ret; + +for (i =0 ; i < nb_ethport; i++) { + port_id =rte_atomic16_add_return (&port_offset,1 ) % nb_ethport; +if (otx2_eth_dev_is_sec_capable (&rte_eth_devices[port_id])) +break ; + } + +if (i >= nb_ethport) +return 0 ; + + ret =otx2_cpt_qp_ethdev_bind (dev, qp, port_id); +if (ret) +return ret; + +return 0 ; +} +static struct otx2_cpt_qp *otx2_cpt_qp_create (const struct rte_cryptodev *dev,uint16_t qp_id,uint8_t group)
@@ -220,6 +245,12 @@ otx2_cpt_qp_create(const struct rte_cryptodev *dev, uint16_t qp_id,otx2_cpt_iq_disable (qp); + ret =otx2_cpt_qp_inline_cfg (dev, qp); +if (ret) { +CPT_LOG_ERR ("Could not configure queue for inline IPsec" ); + goto mempool_destroy; + } + ret =otx2_cpt_iq_enable (dev, qp, group,OTX2_CPT_QUEUE_HI_PRIO , size_div40);if (ret) {
@@ -913,12 +944,20 @@ otx2_cpt_dev_config(struct rte_cryptodev *dev, goto queues_detach; } + ret =otx2_cpt_inline_init (dev); +if (ret) { +CPT_LOG_ERR ("Could not enable inline IPsec" ); + goto intr_unregister; + } + dev->enqueue_burst = otx2_cpt_enqueue_burst; dev->dequeue_burst = otx2_cpt_dequeue_burst;rte_mb ();return 0 ; +intr_unregister: +otx2_cpt_err_intr_unregister (dev); queues_detach:otx2_cpt_queues_detach (dev);return ret;
Signature · 1 line
2.7.4
PATCH v4 4/15 net/octeontx2: create eth security ctx
In reply to Anoob JosephAdding security ctx to the eth device.
--- MAINTAINERS | 1 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 4 +++- drivers/net/octeontx2/otx2_ethdev.c | 15 +++++++++++++- drivers/net/octeontx2/otx2_ethdev_sec.c | 35 +++++++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.h | 14 +++++++++++++ 6 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_ethdev_sec.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_sec.h
MAINTAINERS +1 -0
@@ -728,6 +728,7 @@ Marvell OCTEON TX2 - security M: Anoob Joseph <[email protected]> T: git://dpdk.org/next/dpdk-next-crypto F: drivers/common/octeontx2/otx2_sec* +F: drivers/net/octeontx2/otx2_ethdev_sec* Mellanox mlx4 M: Matan Azrad <[email protected]>
drivers/net/octeontx2/Makefile +1 -0
@@ -50,6 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_flow_utils.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \ + otx2_ethdev_sec.c \ otx2_ethdev_debug.c \ otx2_ethdev_devargs.c
drivers/net/octeontx2/meson.build +3 -1
@@ -20,11 +20,13 @@ sources = files('otx2_rx.c', 'otx2_flow_utils.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c', + 'otx2_ethdev_sec.c', 'otx2_ethdev_debug.c', 'otx2_ethdev_devargs.c' ) -deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] +deps += ['bus_pci', 'cryptodev', 'security'] +deps += ['common_octeontx2', 'mempool_octeontx2'] cflags += ['-flax-vector-conversions']
drivers/net/octeontx2/otx2_ethdev.c +14 -1
@@ -12,6 +12,7 @@#include <rte_mempool.h> #include "otx2_ethdev.h" +#include "otx2_ethdev_sec.h" static inline uint64_t nix_get_rx_offload_capa (struct otx2_eth_dev *dev)
@@ -2243,10 +2244,17 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) dev->hwcap |=OTX2_FIXUP_F_LIMIT_CQ_FULL ; } +/* Create security ctx */ + rc =otx2_eth_sec_ctx_create (eth_dev); +if (rc) + goto free_mac_addrs; + dev->tx_offload_capa |=DEV_TX_OFFLOAD_SECURITY ; + dev->rx_offload_capa |=DEV_RX_OFFLOAD_SECURITY ; +/* Initialize rte-flow */ rc =otx2_flow_init (dev);if (rc) - goto free_mac_addrs; + goto sec_ctx_destroy;otx2_nix_mc_filter_init (dev);
@@ -2257,6 +2265,8 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) dev->rx_offload_capa, dev->tx_offload_capa);return 0 ; +sec_ctx_destroy: +otx2_eth_sec_ctx_destroy (eth_dev); free_mac_addrs:rte_free (eth_dev->data->mac_addrs); unregister_irq:
@@ -2340,6 +2350,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (rc)otx2_err ("Failed to cleanup npa lf, rc=%d" , rc); +/* Destroy security ctx */ +otx2_eth_sec_ctx_destroy (eth_dev); +rte_free (eth_dev->data->mac_addrs); eth_dev->data->mac_addrs =NULL ; dev->drv_inited = false;
drivers/net/octeontx2/otx2_ethdev_sec.c new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#include <rte_ethdev.h> +#include <rte_malloc.h> +#include <rte_security.h> + +#include "otx2_ethdev_sec.h" + +int +otx2_eth_sec_ctx_create (struct rte_eth_dev *eth_dev) +{ +struct rte_security_ctx *ctx; + + ctx =rte_malloc ("otx2_eth_sec_ctx" , +sizeof (struct rte_security_ctx ),0 ); +if (ctx ==NULL ) +return -ENOMEM ; + +/* Populate ctx */ + + ctx->device = eth_dev; + ctx->sess_cnt =0 ; + + eth_dev->security_ctx = ctx; + +return 0 ; +} + +void +otx2_eth_sec_ctx_destroy (struct rte_eth_dev *eth_dev) +{ +rte_free (eth_dev->security_ctx); +}
drivers/net/octeontx2/otx2_ethdev_sec.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#ifndef __OTX2_ETHDEV_SEC_H__ +#define __OTX2_ETHDEV_SEC_H__ + +#include <rte_ethdev.h> + +int otx2_eth_sec_ctx_create (struct rte_eth_dev *eth_dev); + +void otx2_eth_sec_ctx_destroy (struct rte_eth_dev *eth_dev); + +#endif /* __OTX2_ETHDEV_SEC_H__ */
Signature · 1 line
2.7.4
PATCH v4 5/15 net/octeontx2: add security in eth dev configure
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Adding security in eth device configure.
--- doc/guides/nics/octeontx2.rst | 20 +++++ doc/guides/rel_notes/release_20_02.rst | 9 ++ drivers/crypto/octeontx2/otx2_ipsec_fp.h | 55 +++++++++++++ drivers/net/octeontx2/Makefile | 3 + drivers/net/octeontx2/meson.build | 5 +- drivers/net/octeontx2/otx2_ethdev.c | 17 +++- drivers/net/octeontx2/otx2_ethdev.h | 2 + drivers/net/octeontx2/otx2_ethdev_devargs.c | 19 +++++ drivers/net/octeontx2/otx2_ethdev_sec.c | 122 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.h | 4 + 10 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_fp.h
doc/guides/nics/octeontx2.rst +20 -0
@@ -38,6 +38,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - IEEE1588 timestamping - HW offloaded `ethdev Rx queue` to `eventdev event queue` packet injection - Support Rx interrupt +- Inline IPsec processing support Prerequisites -------------
@@ -178,6 +179,17 @@ Runtime Config Options traffic on this port should be higig2 traffic only. Supported switch header types are "higig2" and "dsa". +- ``Max SPI for inbound inline IPsec`` (default ``1``) + + Max SPI supported for inbound inline IPsec processing can be specified by + ``ipsec_in_max_spi`` ``devargs`` parameter. + + For example:: + -w 0002:02:00.0,ipsec_in_max_spi=128 + + With the above configuration, application can enable inline IPsec processing + on 128 SAs (SPI 0-127). + .. note:: Above devarg parameters are configurable per device, user needs to pass the
@@ -211,6 +223,14 @@ SDP interface support ~~~~~~~~~~~~~~~~~~~~~ OCTEON TX2 SDP interface support is limited to PF device, No VF support. +Inline Protocol Processing +~~~~~~~~~~~~~~~~~~~~~~~~~~ +``net_octeontx2`` pmd doesn't support the following features for packets to be +inline protocol processed. +- TSO offload +- VLAN/QinQ offload +- Fragmentation + Debugging Options -----------------
doc/guides/rel_notes/release_20_02.rst +9 -0
@@ -166,6 +166,15 @@ New Features armv8 crypto library is not used anymore. Library name is changed from armv8_crypto to AArch64crypto. +* **Added inline IPsec support to Marvell OCTEON TX2 PMD.** + + Added inline IPsec support to Marvell OCTEON TX2 PMD. With the feature, + applications would be able to offload entire IPsec offload to the hardware. + For the configured sessions, hardware will do the lookup and perform + decryption and IPsec transformation. For the outbound path, application + can submit a plain packet to the PMD, and it would be sent out on wire + after doing encryption and IPsec transformation of the packet. + Removed Items -------------
drivers/crypto/octeontx2/otx2_ipsec_fp.h new file +55 -0
55 lines not on this page · raw message
drivers/net/octeontx2/Makefile +3 -0
@@ -10,7 +10,9 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_pmd_octeontx2.a CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/cpt CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/crypto/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 CFLAGS += -O3
@@ -56,5 +58,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal -lrte_net LDLIBS += -lrte_ethdev -lrte_bus_pci -lrte_kvargs -lrte_mbuf -lrte_mempool -lm +LDLIBS += -lrte_cryptodev -lrte_eventdev -lrte_security include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build +4 -1
@@ -25,7 +25,7 @@ sources = files('otx2_rx.c', 'otx2_ethdev_devargs.c' ) -deps += ['bus_pci', 'cryptodev', 'security'] +deps += ['bus_pci', 'cryptodev', 'eventdev', 'security'] deps += ['common_octeontx2', 'mempool_octeontx2'] cflags += ['-flax-vector-conversions']
@@ -41,3 +41,6 @@ foreach flag: extra_flags cflags += flag endif endforeach + +includes += include_directories('../../common/cpt') +includes += include_directories('../../crypto/octeontx2')
drivers/net/octeontx2/otx2_ethdev.c +16 -1
@@ -339,6 +339,10 @@ nix_cq_rq_init(struct rte_eth_dev *eth_dev, struct otx2_eth_dev *dev, aq->op =NIX_AQ_INSTOP_INIT ; aq->rq.sso_ena =0 ; + +if (rxq->offloads &DEV_RX_OFFLOAD_SECURITY ) + aq->rq.ipsech_ena =1 ; + aq->rq.cq = qid;/* RQ to CQ 1:1 mapped */ aq->rq.spb_ena =0 ; aq->rq.lpb_aura =npa_lf_aura_handle_to_aura (mp->pool_id);
@@ -1612,6 +1616,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)/* Free the resources allocated from the previous configure */ if (dev->configured ==1 ) { +otx2_eth_sec_fini (eth_dev);otx2_nix_rxchan_bpid_cfg (eth_dev, false);otx2_nix_vlan_fini (eth_dev);otx2_nix_mc_addr_list_uninstall (eth_dev);
@@ -1722,10 +1727,15 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto cq_fini; } +/* Enable security */ + rc =otx2_eth_sec_init (eth_dev); +if (rc) + goto cq_fini; + rc =otx2_nix_mc_addr_list_install (eth_dev);if (rc <0 ) {otx2_err ("Failed to install mc address list rc=%d" , rc); - goto cq_fini; + goto sec_fini; }/*
@@ -1761,6 +1771,8 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) uninstall_mc_list:otx2_nix_mc_addr_list_uninstall (eth_dev); +sec_fini: +otx2_eth_sec_fini (eth_dev); cq_fini:oxt2_nix_unregister_cq_irqs (eth_dev); q_irq_fini:
@@ -2350,6 +2362,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (rc)otx2_err ("Failed to cleanup npa lf, rc=%d" , rc); +/* Disable security */ +otx2_eth_sec_fini (eth_dev); +/* Destroy security ctx */ otx2_eth_sec_ctx_destroy (eth_dev);
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -324,6 +324,8 @@ struct otx2_eth_dev {bool mc_tbl_set;struct otx2_nix_mc_filter_tbl mc_fltr_tbl;bool sdp_link;/* SDP flag */ +/* Inline IPsec params */ +uint16_t ipsec_in_max_spi; } __rte_cache_aligned;struct otx2_eth_txq {
drivers/net/octeontx2/otx2_ethdev_devargs.c +19 -0
@@ -64,6 +64,19 @@ parse_reta_size(const char *key, const char *value, void *extra_args) }static int +parse_ipsec_in_max_spi (const char *key,const char *value,void *extra_args) +{ +RTE_SET_USED (key); +uint32_t val; + + val =atoi (value); + + *(uint16_t *)extra_args = val; + +return 0 ; +} + +static int parse_flag (const char *key,const char *value,void *extra_args) {RTE_SET_USED (key);
@@ -104,6 +117,7 @@ parse_switch_header_type(const char *key, const char *value, void *extra_args) }#define OTX2_RSS_RETA_SIZE "reta_size" +#define OTX2_IPSEC_IN_MAX_SPI "ipsec_in_max_spi"#define OTX2_SCL_ENABLE "scalar_enable"#define OTX2_MAX_SQB_COUNT "max_sqb_count"#define OTX2_FLOW_PREALLOC_SIZE "flow_prealloc_size"
@@ -118,6 +132,7 @@ otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev)uint16_t flow_prealloc_size =8 ;uint16_t switch_header_type =0 ;uint16_t flow_max_priority =3 ; +uint16_t ipsec_in_max_spi =1 ;uint16_t scalar_enable =0 ;struct rte_kvargs *kvlist;
@@ -130,6 +145,8 @@ otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev)rte_kvargs_process (kvlist,OTX2_RSS_RETA_SIZE , &parse_reta_size, &rss_size); +rte_kvargs_process (kvlist,OTX2_IPSEC_IN_MAX_SPI , + &parse_ipsec_in_max_spi, &ipsec_in_max_spi);rte_kvargs_process (kvlist,OTX2_SCL_ENABLE , &parse_flag, &scalar_enable); rte_kvargs_process(kvlist, OTX2_MAX_SQB_COUNT,
@@ -143,6 +160,7 @@ otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev)rte_kvargs_free (kvlist); null_devargs: + dev->ipsec_in_max_spi = ipsec_in_max_spi; dev->scalar_ena = scalar_enable; dev->max_sqb_count = sqb_count; dev->rss_info.rss_size = rss_size;
@@ -157,6 +175,7 @@ otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev)RTE_PMD_REGISTER_PARAM_STRING (net_octeontx2,OTX2_RSS_RETA_SIZE "=<64|128|256>" +OTX2_IPSEC_IN_MAX_SPI "=<1-65535>" OTX2_SCL_ENABLE "=1" OTX2_MAX_SQB_COUNT "=<8-512>" OTX2_FLOW_PREALLOC_SIZE "=<1-32>"
drivers/net/octeontx2/otx2_ethdev_sec.c +122 -0
135 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_sec.h +4 -0
@@ -11,4 +11,8 @@ int otx2_eth_sec_ctx_create(struct rte_eth_dev *eth_dev);void otx2_eth_sec_ctx_destroy (struct rte_eth_dev *eth_dev); +int otx2_eth_sec_init (struct rte_eth_dev *eth_dev); + +void otx2_eth_sec_fini (struct rte_eth_dev *eth_dev); +#endif /* __OTX2_ETHDEV_SEC_H__ */
Signature · 1 line
2.7.4
PATCH v4 6/15 net/octeontx2: add eth security capabilities
In reply to Anoob JosephFrom: Ankur Dwivedi <[email protected]>
Adding security capabilities supported by the eth PMD.
--- drivers/net/octeontx2/otx2_ethdev_sec.c | 124 ++++++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.h | 18 +++++ 2 files changed, 142 insertions(+)
drivers/net/octeontx2/otx2_ethdev_sec.c +124 -0
@@ -2,11 +2,13 @@* Copyright (C) 2020 Marvell International Ltd. */ +#include <rte_cryptodev.h> #include <rte_ethdev.h> #include <rte_eventdev.h> #include <rte_malloc.h> #include <rte_memzone.h> #include <rte_security.h> +#include <rte_security_driver.h> #include "otx2_ethdev.h" #include "otx2_ethdev_sec.h"
@@ -27,12 +29,133 @@ struct eth_sec_tag_const { }; }; +static struct rte_cryptodev_capabilities otx2_eth_sec_crypto_caps[] = { + {/* AES GCM */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AEAD , + {.aead = { + .algo =RTE_CRYPTO_AEAD_AES_GCM , + .block_size =16 , + .key_size = { + .min =16 , + .max =32 , + .increment =8 + }, + .digest_size = { + .min =16 , + .max =16 , + .increment =0 + }, + .aad_size = { + .min =8 , + .max =12 , + .increment =4 + }, + .iv_size = { + .min =12 , + .max =12 , + .increment =0 + } + }, } + }, } + }, + {/* AES CBC */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_CIPHER , + {.cipher = { + .algo =RTE_CRYPTO_CIPHER_AES_CBC , + .block_size =16 , + .key_size = { + .min =16 , + .max =32 , + .increment =8 + }, + .iv_size = { + .min =16 , + .max =16 , + .increment =0 + } + }, } + }, } + }, + {/* SHA1 HMAC */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AUTH , + {.auth = { + .algo =RTE_CRYPTO_AUTH_SHA1_HMAC , + .block_size =64 , + .key_size = { + .min =20 , + .max =64 , + .increment =1 + }, + .digest_size = { + .min =12 , + .max =12 , + .increment =0 + }, + }, } + }, } + }, +RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST () +}; + +static const struct rte_security_capability otx2_eth_sec_capabilities[] = { + {/* IPsec Inline Protocol ESP Tunnel Ingress */ + .action =RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_IPSEC , + .ipsec = { + .proto =RTE_SECURITY_IPSEC_SA_PROTO_ESP , + .mode =RTE_SECURITY_IPSEC_SA_MODE_TUNNEL , + .direction =RTE_SECURITY_IPSEC_SA_DIR_INGRESS , + .options = {0 } + }, + .crypto_capabilities = otx2_eth_sec_crypto_caps, + .ol_flags =RTE_SECURITY_TX_OLOAD_NEED_MDATA + }, + {/* IPsec Inline Protocol ESP Tunnel Egress */ + .action =RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_IPSEC , + .ipsec = { + .proto =RTE_SECURITY_IPSEC_SA_PROTO_ESP , + .mode =RTE_SECURITY_IPSEC_SA_MODE_TUNNEL , + .direction =RTE_SECURITY_IPSEC_SA_DIR_EGRESS , + .options = {0 } + }, + .crypto_capabilities = otx2_eth_sec_crypto_caps, + .ol_flags =RTE_SECURITY_TX_OLOAD_NEED_MDATA + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE + } +}; +static inline void in_sa_mz_name_get (char *name,int size,uint16_t port) {snprintf (name, size,"otx2_ipsec_in_sadb_%u" , port); } +static unsigned int +otx2_eth_sec_session_get_size(void *device __rte_unused) +{ +return sizeof (struct otx2_sec_session ); +} + +static const struct rte_security_capability * +otx2_eth_sec_capabilities_get(void *device __rte_unused) +{ +return otx2_eth_sec_capabilities; +} + +static struct rte_security_ops otx2_eth_sec_ops = { + .session_get_size = otx2_eth_sec_session_get_size, + .capabilities_get = otx2_eth_sec_capabilities_get +}; +int otx2_eth_sec_ctx_create (struct rte_eth_dev *eth_dev) {
@@ -46,6 +169,7 @@ otx2_eth_sec_ctx_create(struct rte_eth_dev *eth_dev)/* Populate ctx */ ctx->device = eth_dev; + ctx->ops = &otx2_eth_sec_ops; ctx->sess_cnt =0 ; eth_dev->security_ctx = ctx;
drivers/net/octeontx2/otx2_ethdev_sec.h +18 -0
@@ -7,6 +7,24 @@#include <rte_ethdev.h> +#include "otx2_ipsec_fp.h" + +/* +* Security session for inline IPsec protocol offload. This is private data of +* inline capable PMD. +*/ +struct otx2_sec_session_ipsec_ip { +int dummy; +}; + +struct otx2_sec_session_ipsec { +struct otx2_sec_session_ipsec_ip ip; +}; + +struct otx2_sec_session { +struct otx2_sec_session_ipsec ipsec; +} __rte_cache_aligned; +int otx2_eth_sec_ctx_create (struct rte_eth_dev *eth_dev);void otx2_eth_sec_ctx_destroy (struct rte_eth_dev *eth_dev);
Signature · 1 line
2.7.4
PATCH v4 7/15 crypto/octeontx2: enable CPT to share QP with ethdev
In reply to Anoob JosephAdding the infrastructure to save one opaque pointer in idev and implement the consumer-producer in the PMDs which uses it accordingly.
--- drivers/common/octeontx2/otx2_sec_idev.c | 92 ++++++++++++++++++++++ drivers/common/octeontx2/otx2_sec_idev.h | 21 +++++ .../octeontx2/rte_common_octeontx2_version.map | 3 + .../crypto/octeontx2/otx2_cryptodev_hw_access.h | 22 +----- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 17 ++++ drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 35 ++++++++ drivers/net/octeontx2/otx2_ethdev_sec.c | 9 +++ 7 files changed, 178 insertions(+), 21 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_qp.h
drivers/common/octeontx2/otx2_sec_idev.c +92 -0
@@ -2,12 +2,16 @@* Copyright(C) 2020 Marvell International Ltd. */ +#include <rte_atomic.h> #include <rte_bus_pci.h> #include <rte_ethdev.h> +#include <rte_spinlock.h> #include "otx2_common.h" #include "otx2_sec_idev.h" +static struct otx2_sec_idev_cfg sec_cfg[OTX2_MAX_INLINE_PORTS ]; +/** * @internal * Check if rte_eth_dev is security offload capable otx2_eth_dev
@@ -26,3 +30,91 @@ otx2_eth_dev_is_sec_capable(struct rte_eth_dev *eth_dev)return 0 ; } + +int +otx2_sec_idev_cfg_init (int port_id) +{ +struct otx2_sec_idev_cfg *cfg; +int i; + + cfg = &sec_cfg[port_id]; + cfg->tx_cpt_idx =0 ; +rte_spinlock_init (&cfg->tx_cpt_lock); + +for (i =0 ; i <OTX2_MAX_CPT_QP_PER_PORT ; i++) { + cfg->tx_cpt[i].qp =NULL ; +rte_atomic16_set (&cfg->tx_cpt[i].ref_cnt,0 ); + } + +return 0 ; +} + +int +otx2_sec_idev_tx_cpt_qp_add (uint16_t port_id,struct otx2_cpt_qp *qp) +{ +struct otx2_sec_idev_cfg *cfg; +int i, ret; + +if (qp ==NULL || port_id >OTX2_MAX_INLINE_PORTS ) +return -EINVAL ; + + cfg = &sec_cfg[port_id]; + +/* Find a free slot to save CPT LF */ + +rte_spinlock_lock (&cfg->tx_cpt_lock); + +for (i =0 ; i <OTX2_MAX_CPT_QP_PER_PORT ; i++) { +if (cfg->tx_cpt[i].qp ==NULL ) { + cfg->tx_cpt[i].qp = qp; + ret =0 ; + goto unlock; + } + } + + ret = -EINVAL ; + +unlock: +rte_spinlock_unlock (&cfg->tx_cpt_lock); +return ret; +} + +int +otx2_sec_idev_tx_cpt_qp_remove (struct otx2_cpt_qp *qp) +{ +struct otx2_sec_idev_cfg *cfg; +uint16_t port_id; +int i, ret; + +if (qp ==NULL ) +return -EINVAL ; + +for (port_id =0 ; port_id <OTX2_MAX_INLINE_PORTS ; port_id++) { + cfg = &sec_cfg[port_id]; + +rte_spinlock_lock (&cfg->tx_cpt_lock); + +for (i =0 ; i <OTX2_MAX_CPT_QP_PER_PORT ; i++) { +if (cfg->tx_cpt[i].qp != qp) +continue ; + +/* Don't free if the QP is in use by any sec session */ +if (rte_atomic16_read (&cfg->tx_cpt[i].ref_cnt)) { + ret = -EBUSY ; + }else { + cfg->tx_cpt[i].qp =NULL ; + ret =0 ; + } + + goto unlock; + } + +rte_spinlock_unlock (&cfg->tx_cpt_lock); + } + +return -ENOENT ; + +unlock: +rte_spinlock_unlock (&cfg->tx_cpt_lock); +return ret; +}
drivers/common/octeontx2/otx2_sec_idev.h +21 -0
@@ -7,6 +7,27 @@#include <rte_ethdev.h> +#define OTX2_MAX_CPT_QP_PER_PORT 64 +#define OTX2_MAX_INLINE_PORTS 64 + +struct otx2_cpt_qp ; + +struct otx2_sec_idev_cfg { +struct { +struct otx2_cpt_qp *qp; +rte_atomic16_t ref_cnt; + } tx_cpt[OTX2_MAX_CPT_QP_PER_PORT ]; + +uint16_t tx_cpt_idx; +rte_spinlock_t tx_cpt_lock; +}; +uint8_t otx2_eth_dev_is_sec_capable (struct rte_eth_dev *eth_dev); +int otx2_sec_idev_cfg_init (int port_id); + +int otx2_sec_idev_tx_cpt_qp_add (uint16_t port_id,struct otx2_cpt_qp *qp); + +int otx2_sec_idev_tx_cpt_qp_remove (struct otx2_cpt_qp *qp); +#endif /* _OTX2_SEC_IDEV_H_ */
drivers/common/octeontx2/rte_common_octeontx2_version.map +3 -0
@@ -28,6 +28,9 @@ DPDK_20.0 { otx2_npa_pf_func_get; otx2_npa_set_defaults; otx2_register_irq; + otx2_sec_idev_cfg_init; + otx2_sec_idev_tx_cpt_qp_add; + otx2_sec_idev_tx_cpt_qp_remove; otx2_sso_pf_func_get; otx2_sso_pf_func_set; otx2_unregister_irq;
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +1 -21
@@ -15,6 +15,7 @@#include "cpt_mcode_defines.h" #include "otx2_dev.h" +#include "otx2_cryptodev_qp.h" /* CPT instruction queue length */ #define OTX2_CPT_IQ_LEN 8200
@@ -135,27 +136,6 @@ enum cpt_9x_comp_e { CPT_9X_COMP_E_LAST_ENTRY = 0x06 }; -struct otx2_cpt_qp { -uint32_t id; -/**< Queue pair id */ -uintptr_t base; -/**< Base address where BAR is mapped */ -void *lmtline; -/**< Address of LMTLINE */ -rte_iova_t lf_nq_reg; -/**< LF enqueue register address */ -struct pending_queue pend_q; -/**< Pending queue */ -struct rte_mempool *sess_mp; -/**< Session mempool */ -struct rte_mempool *sess_mp_priv; -/**< Session private data mempool */ -struct cpt_qp_meta_info meta_info; -/**< Metabuf info required to support operations on the queue pair */ -rte_iova_t iq_dma_addr; -/**< Instruction queue address */ -}; -void otx2_cpt_err_intr_unregister (const struct rte_cryptodev *dev);int otx2_cpt_err_intr_register (const struct rte_cryptodev *dev);
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +17 -0
@@ -149,6 +149,11 @@ otx2_cpt_qp_inline_cfg(const struct rte_cryptodev *dev, struct otx2_cpt_qp *qp)if (ret)return ret; +/* Publish inline Tx QP to eth dev security */ + ret =otx2_sec_idev_tx_cpt_qp_add (port_id, qp); +if (ret) +return ret; +return 0 ; }
@@ -243,6 +248,12 @@ otx2_cpt_qp_create(const struct rte_cryptodev *dev, uint16_t qp_id, qp->lf_nq_reg = qp->base +OTX2_CPT_LF_NQ (0 ); + ret =otx2_sec_idev_tx_cpt_qp_remove (qp); +if (ret && (ret != -ENOENT )) { +CPT_LOG_ERR ("Could not delete inline configuration" ); + goto mempool_destroy; + } +otx2_cpt_iq_disable (qp); ret =otx2_cpt_qp_inline_cfg (dev, qp);
@@ -276,6 +287,12 @@ otx2_cpt_qp_destroy(const struct rte_cryptodev *dev, struct otx2_cpt_qp *qp)char name[RTE_MEMZONE_NAMESIZE ];int ret; + ret =otx2_sec_idev_tx_cpt_qp_remove (qp); +if (ret && (ret != -ENOENT )) { +CPT_LOG_ERR ("Could not delete inline configuration" ); +return ret; + } +otx2_cpt_iq_disable (qp);otx2_cpt_metabuf_mempool_destroy (qp);
drivers/crypto/octeontx2/otx2_cryptodev_qp.h new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#ifndef _OTX2_CRYPTODEV_QP_H_ +#define _OTX2_CRYPTODEV_QP_H_ + +#include <rte_common.h> +#include <rte_mempool.h> +#include <rte_spinlock.h> + +#include "cpt_common.h" + +struct otx2_cpt_qp { +uint32_t id; +/**< Queue pair id */ +uintptr_t base; +/**< Base address where BAR is mapped */ +void *lmtline; +/**< Address of LMTLINE */ +rte_iova_t lf_nq_reg; +/**< LF enqueue register address */ +struct pending_queue pend_q; +/**< Pending queue */ +struct rte_mempool *sess_mp; +/**< Session mempool */ +struct rte_mempool *sess_mp_priv; +/**< Session private data mempool */ +struct cpt_qp_meta_info meta_info; +/**< Metabuf info required to support operations on the queue pair */ +rte_iova_t iq_dma_addr; +/**< Instruction queue address */ +}; + +#endif /* _OTX2_CRYPTODEV_QP_H_ */
drivers/net/octeontx2/otx2_ethdev_sec.c +9 -0
@@ -10,9 +10,11 @@#include <rte_security.h> #include <rte_security_driver.h> +#include "otx2_cryptodev_qp.h" #include "otx2_ethdev.h" #include "otx2_ethdev_sec.h" #include "otx2_ipsec_fp.h" +#include "otx2_sec_idev.h" #define ETH_SEC_MAX_PKT_LEN 1450
@@ -160,12 +162,19 @@ int otx2_eth_sec_ctx_create(struct rte_eth_dev *eth_dev) {struct rte_security_ctx *ctx; +int ret; ctx =rte_malloc ("otx2_eth_sec_ctx" ,sizeof (struct rte_security_ctx ),0 );if (ctx ==NULL )return -ENOMEM ; + ret =otx2_sec_idev_cfg_init (eth_dev->data->port_id); +if (ret) { +rte_free (ctx); +return ret; + } +/* Populate ctx */ ctx->device = eth_dev;
Signature · 1 line
2.7.4
PATCH v4 8/15 net/octeontx2: add eth security session operations
In reply to Anoob JosephAdding security session operations in eth security ctx.
--- drivers/common/octeontx2/otx2_sec_idev.c | 63 ++++ drivers/common/octeontx2/otx2_sec_idev.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 2 + drivers/crypto/octeontx2/otx2_ipsec_fp.h | 295 +++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.c | 362 +++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.h | 84 ++++- 6 files changed, 809 insertions(+), 1 deletion(-)
drivers/common/octeontx2/otx2_sec_idev.c +63 -0
@@ -118,3 +118,66 @@ otx2_sec_idev_tx_cpt_qp_remove(struct otx2_cpt_qp *qp)rte_spinlock_unlock (&cfg->tx_cpt_lock);return ret; } + +int +otx2_sec_idev_tx_cpt_qp_get (uint16_t port_id,struct otx2_cpt_qp **qp) +{ +struct otx2_sec_idev_cfg *cfg; +uint16_t index; +int i, ret; + +if (port_id >OTX2_MAX_INLINE_PORTS || qp ==NULL ) +return -EINVAL ; + + cfg = &sec_cfg[port_id]; + +rte_spinlock_lock (&cfg->tx_cpt_lock); + + index = cfg->tx_cpt_idx; + +/* Get the next index with valid data */ +for (i =0 ; i <OTX2_MAX_CPT_QP_PER_PORT ; i++) { +if (cfg->tx_cpt[index].qp !=NULL ) +break ; + index = (index +1 ) %OTX2_MAX_CPT_QP_PER_PORT ; + } + +if (i >=OTX2_MAX_CPT_QP_PER_PORT ) { + ret = -EINVAL ; + goto unlock; + } + + *qp = cfg->tx_cpt[index].qp; +rte_atomic16_inc (&cfg->tx_cpt[index].ref_cnt); + + cfg->tx_cpt_idx = (index +1 ) %OTX2_MAX_CPT_QP_PER_PORT ; + + ret =0 ; + +unlock: +rte_spinlock_unlock (&cfg->tx_cpt_lock); +return ret; +} + +int +otx2_sec_idev_tx_cpt_qp_put (struct otx2_cpt_qp *qp) +{ +struct otx2_sec_idev_cfg *cfg; +uint16_t port_id; +int i; + +if (qp ==NULL ) +return -EINVAL ; + +for (port_id =0 ; port_id <OTX2_MAX_INLINE_PORTS ; port_id++) { + cfg = &sec_cfg[port_id]; +for (i =0 ; i <OTX2_MAX_CPT_QP_PER_PORT ; i++) { +if (cfg->tx_cpt[i].qp == qp) { +rte_atomic16_dec (&cfg->tx_cpt[i].ref_cnt); +return 0 ; + } + } + } + +return -EINVAL ; +}
drivers/common/octeontx2/otx2_sec_idev.h +4 -0
@@ -30,4 +30,8 @@ int otx2_sec_idev_tx_cpt_qp_add(uint16_t port_id, struct otx2_cpt_qp *qp);int otx2_sec_idev_tx_cpt_qp_remove (struct otx2_cpt_qp *qp); +int otx2_sec_idev_tx_cpt_qp_put (struct otx2_cpt_qp *qp); + +int otx2_sec_idev_tx_cpt_qp_get (uint16_t port_id,struct otx2_cpt_qp **qp); +#endif /* _OTX2_SEC_IDEV_H_ */
drivers/common/octeontx2/rte_common_octeontx2_version.map +2 -0
@@ -31,6 +31,8 @@ DPDK_20.0 { otx2_sec_idev_cfg_init; otx2_sec_idev_tx_cpt_qp_add; otx2_sec_idev_tx_cpt_qp_remove; + otx2_sec_idev_tx_cpt_qp_get; + otx2_sec_idev_tx_cpt_qp_put; otx2_sso_pf_func_get; otx2_sso_pf_func_set; otx2_unregister_irq;
drivers/crypto/octeontx2/otx2_ipsec_fp.h +295 -0
311 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_sec.c +362 -0
374 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_sec.h +83 -1
101 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 9/15 net/octeontx2: add datapath ops in eth security ctx
In reply to Anoob JosephFrom: Ankur Dwivedi <[email protected]>
Adding data path ops in eth security ctx.
--- drivers/net/octeontx2/otx2_ethdev_sec.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/net/octeontx2/otx2_ethdev_sec.c +23 -0
@@ -507,6 +507,27 @@ otx2_eth_sec_session_get_size(void *device __rte_unused)return sizeof (struct otx2_sec_session ); } +static int +otx2_eth_sec_set_pkt_mdata(void *device __rte_unused, +struct rte_security_session *session, + struct rte_mbuf *m, void *params __rte_unused) +{ +/* Set security session as the pkt metadata */ + m->udata64 = (uint64_t )session; + +return 0 ; +} + +static int +otx2_eth_sec_get_userdata(void *device __rte_unused, uint64_t md, +void **userdata) +{ +/* Retrieve userdata */ + *userdata = (void *)md; + +return 0 ; +} +static const struct rte_security_capability * otx2_eth_sec_capabilities_get(void *device __rte_unused) {
@@ -517,6 +538,8 @@ static struct rte_security_ops otx2_eth_sec_ops = { .session_create = otx2_eth_sec_session_create, .session_destroy = otx2_eth_sec_session_destroy, .session_get_size = otx2_eth_sec_session_get_size, + .set_pkt_metadata = otx2_eth_sec_set_pkt_mdata, + .get_userdata = otx2_eth_sec_get_userdata, .capabilities_get = otx2_eth_sec_capabilities_get };
Signature · 1 line
2.7.4
PATCH v4 10/15 net/octeontx2: add lookup mem changes to hold sa indices
In reply to Anoob JosephFrom: Archana Muniganti <[email protected]>
lookup_mem provides fast accessing of data path fields. Storing sa indices in lookup_mem which are required in inline rx data path.
--- drivers/common/octeontx2/otx2_common.h | 4 +++ drivers/net/octeontx2/otx2_ethdev_sec.c | 59 +++++++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_lookup.c | 11 ++++-- 3 files changed, 72 insertions(+), 2 deletions(-)
drivers/common/octeontx2/otx2_common.h +4 -0
@@ -155,4 +155,8 @@ extern int otx2_logtype_ep;#include "otx2_io_generic.h" #endif +/* Fastpath lookup */ +#define OTX2_NIX_FASTPATH_LOOKUP_MEM "otx2_nix_fastpath_lookup_mem" +#define OTX2_NIX_SA_TBL_START (4096*4 + 69632*2) +#endif /* _OTX2_COMMON_H_ */
drivers/net/octeontx2/otx2_ethdev_sec.c +59 -0
83 lines not on this page · raw message
drivers/net/octeontx2/otx2_lookup.c +9 -2
@@ -5,6 +5,7 @@#include <rte_common.h> #include <rte_memzone.h> +#include "otx2_common.h" #include "otx2_ethdev.h" /* NIX_RX_PARSE_S's ERRCODE + ERRLEV (12 bits) */
@@ -12,7 +13,9 @@#define ERR_ARRAY_SZ ((BIT(ERRCODE_ERRLEN_WIDTH)) *\ sizeof(uint32_t)) -#define LOOKUP_ARRAY_SZ (PTYPE_ARRAY_SZ + ERR_ARRAY_SZ) +#define SA_TBL_SZ (RTE_MAX_ETHPORTS * sizeof(uint64_t)) +#define LOOKUP_ARRAY_SZ (PTYPE_ARRAY_SZ + ERR_ARRAY_SZ +\ + SA_TBL_SZ)const uint32_t *otx2_nix_supported_ptypes_get (struct rte_eth_dev *eth_dev)
@@ -311,10 +314,14 @@ nix_create_rx_ol_flags_array(void *mem)void *otx2_nix_fastpath_lookup_mem_get (void ) { -const char name[] ="otx2_nix_fastpath_lookup_mem" ; +const char name[] =OTX2_NIX_FASTPATH_LOOKUP_MEM ;const struct rte_memzone *mz;void *mem; +/* SA_TBL starts after PTYPE_ARRAY & ERR_ARRAY */ +RTE_BUILD_BUG_ON (OTX2_NIX_SA_TBL_START != (PTYPE_ARRAY_SZ + +ERR_ARRAY_SZ )); + mz =rte_memzone_lookup (name);if (mz !=NULL )return mz->addr;
Signature · 1 line
2.7.4
PATCH v4 11/15 net/octeontx2: add inline ipsec Rx path changes
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Adding post-processing required for inline IPsec inbound packets.
--- drivers/crypto/octeontx2/Makefile | 3 +- drivers/crypto/octeontx2/meson.build | 2 + drivers/event/octeontx2/Makefile | 1 + drivers/event/octeontx2/meson.build | 2 + drivers/net/octeontx2/otx2_rx.h | 73 ++++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 1 deletion(-)
drivers/crypto/octeontx2/Makefile +2 -1
@@ -11,7 +11,7 @@ LIB = librte_pmd_octeontx2_crypto.a CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal -lrte_ethdev -lrte_mbuf -lrte_mempool -lrte_ring -LDLIBS += -lrte_cryptodev +LDLIBS += -lrte_cryptodev -lrte_security LDLIBS += -lrte_pci -lrte_bus_pci LDLIBS += -lrte_common_cpt -lrte_common_octeontx2
@@ -20,6 +20,7 @@ VPATH += $(RTE_SDK)/drivers/crypto/octeontx2 CFLAGS += -O3 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/crypto/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 CFLAGS += -DALLOW_EXPERIMENTAL_API
drivers/crypto/octeontx2/meson.build +2 -0
@@ -9,6 +9,7 @@ deps += ['bus_pci'] deps += ['common_cpt'] deps += ['common_octeontx2'] deps += ['ethdev'] +deps += ['security'] name = 'octeontx2_crypto' allow_experimental_apis = true
@@ -32,5 +33,6 @@ endforeach includes += include_directories('../../common/cpt') includes += include_directories('../../common/octeontx2') +includes += include_directories('../../crypto/octeontx2') includes += include_directories('../../mempool/octeontx2') includes += include_directories('../../net/octeontx2')
drivers/event/octeontx2/Makefile +1 -0
@@ -11,6 +11,7 @@ LIB = librte_pmd_octeontx2_event.a CFLAGS += $(WERROR_FLAGS) CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/crypto/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/event/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2
drivers/event/octeontx2/meson.build +2 -0
@@ -32,3 +32,5 @@ foreach flag: extra_flags endforeach deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2'] + +includes += include_directories('../../crypto/octeontx2')
drivers/net/octeontx2/otx2_rx.h +73 -0
97 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 12/15 drivers/octeontx2: add sec in Rx fastpath framework
In reply to Anoob JosephFrom: Archana Muniganti <[email protected]>
Added new flag for SECURITY in Rx compiler optimized fastpath framework. With this, compiler autogenerates functions which have security enabled.
--- drivers/event/octeontx2/otx2_evdev.c | 134 ++++++++----- drivers/event/octeontx2/otx2_evdev.h | 2 +- drivers/event/octeontx2/otx2_worker.c | 2 +- drivers/event/octeontx2/otx2_worker_dual.c | 2 +- drivers/net/octeontx2/otx2_ethdev.c | 3 + drivers/net/octeontx2/otx2_rx.c | 27 +-- drivers/net/octeontx2/otx2_rx.h | 306 ++++++++++++++++++++--------- 7 files changed, 320 insertions(+), 156 deletions(-)
drivers/event/octeontx2/otx2_evdev.c +83 -51
@@ -44,61 +44,64 @@ sso_fastpath_fns_set(struct rte_eventdev *event_dev) {struct otx2_sso_evdev *dev =sso_pmd_priv (event_dev);/* Single WS modes */ -const event_dequeue_t ssogws_deq[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_ ##name, +const event_dequeue_t ssogws_deq[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_burst_t ssogws_deq_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_burst_ ##name, +const event_dequeue_burst_t ssogws_deq_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_t ssogws_deq_timeout[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_timeout_ ##name, +const event_dequeue_t ssogws_deq_timeout[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_timeout_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R };const event_dequeue_burst_t - ssogws_deq_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = \ + ssogws_deq_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ otx2_ssogws_deq_timeout_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_t ssogws_deq_seg[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_seg_ ##name, +const event_dequeue_t ssogws_deq_seg[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_seg_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_burst_t ssogws_deq_seg_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_seg_burst_ ##name, +const event_dequeue_burst_t + ssogws_deq_seg_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_deq_seg_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_t ssogws_deq_seg_timeout[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_deq_seg_timeout_ ##name, +const event_dequeue_t ssogws_deq_seg_timeout[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_deq_seg_timeout_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R };const event_dequeue_burst_t - ssogws_deq_seg_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = \ + ssogws_deq_seg_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ otx2_ssogws_deq_seg_timeout_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R
@@ -106,64 +109,69 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC/* Dual WS modes */ -const event_dequeue_t ssogws_dual_deq[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_dual_deq_ ##name, +const event_dequeue_t ssogws_dual_deq[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_ssogws_dual_deq_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_burst_t ssogws_dual_deq_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_dual_deq_burst_ ##name, +const event_dequeue_burst_t + ssogws_dual_deq_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_dual_deq_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_t ssogws_dual_deq_timeout[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_dual_deq_timeout_ ##name, +const event_dequeue_t ssogws_dual_deq_timeout[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_dual_deq_timeout_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R };const event_dequeue_burst_t - ssogws_dual_deq_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_dual_deq_timeout_burst_ ##name, + ssogws_dual_deq_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_dual_deq_timeout_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_t ssogws_dual_deq_seg[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_dual_deq_seg_ ##name, +const event_dequeue_t ssogws_dual_deq_seg[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_ssogws_dual_deq_seg_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R };const event_dequeue_burst_t - ssogws_dual_deq_seg_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = \ - otx2_ssogws_dual_deq_seg_burst_ ##name, + ssogws_dual_deq_seg_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_dual_deq_seg_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R }; -const event_dequeue_t ssogws_dual_deq_seg_timeout[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = \ - otx2_ssogws_dual_deq_seg_timeout_ ##name, +const event_dequeue_t + ssogws_dual_deq_seg_timeout[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_dual_deq_seg_timeout_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R };const event_dequeue_burst_t - ssogws_dual_deq_seg_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = \ - otx2_ssogws_dual_deq_seg_timeout_burst_ ##name, + ssogws_dual_deq_seg_timeout_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_dual_deq_seg_timeout_burst_ ##name,SSO_RX_ADPTR_ENQ_FASTPATH_FUNC #undef R };
@@ -209,6 +217,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC event_dev->enqueue_forward_burst = otx2_ssogws_enq_fwd_burst;if (dev->rx_offloads &NIX_RX_MULTI_SEG_F ) { event_dev->dequeue = ssogws_deq_seg + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -216,6 +225,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_PTYPE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )]; event_dev->dequeue_burst = ssogws_deq_seg_burst + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -224,6 +234,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )];if (dev->is_timeout_deq) { event_dev->dequeue = ssogws_deq_seg_timeout + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -232,6 +243,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )]; event_dev->dequeue_burst = ssogws_deq_seg_timeout_burst + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -241,6 +253,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC } }else { event_dev->dequeue = ssogws_deq + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -248,6 +261,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_PTYPE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )]; event_dev->dequeue_burst = ssogws_deq_burst + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -256,6 +270,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )];if (dev->is_timeout_deq) { event_dev->dequeue = ssogws_deq_timeout + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -264,6 +279,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )]; event_dev->dequeue_burst = ssogws_deq_timeout_burst + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -303,6 +319,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNCif (dev->rx_offloads &NIX_RX_MULTI_SEG_F ) { event_dev->dequeue = ssogws_dual_deq_seg [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
@@ -313,6 +331,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_PTYPE_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )]; event_dev->dequeue_burst = ssogws_dual_deq_seg_burst + [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
@@ -326,6 +346,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC event_dev->dequeue = ssogws_dual_deq_seg_timeout [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
@@ -340,6 +362,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC event_dev->dequeue_burst = ssogws_dual_deq_seg_timeout_burst [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
@@ -355,6 +379,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC }else { event_dev->dequeue = ssogws_dual_deq [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
@@ -366,6 +392,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->rx_offloads &NIX_RX_OFFLOAD_RSS_F )]; event_dev->dequeue_burst = ssogws_dual_deq_burst [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
@@ -379,6 +407,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC event_dev->dequeue = ssogws_dual_deq_timeout [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
@@ -393,6 +423,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC event_dev->dequeue_burst = ssogws_dual_deq_timeout_burst [!!(dev->rx_offloads & +NIX_RX_OFFLOAD_SECURITY_F )] + [!!(dev->rx_offloads &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offloads &NIX_RX_OFFLOAD_MARK_UPDATE_F )]
drivers/event/octeontx2/otx2_evdev.h +1 -1
@@ -278,7 +278,7 @@ uint16_t otx2_ssogws_dual_enq_fwd_burst(void *port, const struct rte_event ev[], uint16_t nb_events);/* Auto generated API's */ -#define R (name, f5, f4, f3, f2, f1, f0, flags) \ +#define R (name, f6, f5, f4, f3, f2, f1, f0, flags) \ uint16_t otx2_ssogws_deq_ ##name(void *port, struct rte_event *ev, \ uint64_t timeout_ticks); \ uint16_t otx2_ssogws_deq_burst_ ##name(void *port, struct rte_event ev[], \
drivers/event/octeontx2/otx2_worker.c +1 -1
@@ -81,7 +81,7 @@ otx2_ssogws_release_event(struct otx2_ssogws *ws)otx2_ssogws_swtag_flush (ws); } -#define R (name, f5, f4, f3, f2, f1, f0, flags) \ +#define R (name, f6, f5, f4, f3, f2, f1, f0, flags) \ uint16_t __hot \ otx2_ssogws_deq_ ##name(void *port, struct rte_event *ev, \ uint64_t timeout_ticks) \
drivers/event/octeontx2/otx2_worker_dual.c +1 -1
@@ -140,7 +140,7 @@ otx2_ssogws_dual_enq_fwd_burst(void *port, const struct rte_event ev[],return 1 ; } -#define R (name, f5, f4, f3, f2, f1, f0, flags) \ +#define R (name, f6, f5, f4, f3, f2, f1, f0, flags) \ uint16_t __hot \ otx2_ssogws_dual_deq_ ##name(void *port, struct rte_event *ev, \ uint64_t timeout_ticks) \
drivers/net/octeontx2/otx2_ethdev.c +3 -0
@@ -628,6 +628,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)if ((dev->rx_offloads &DEV_RX_OFFLOAD_TIMESTAMP )) flags |=NIX_RX_OFFLOAD_TSTAMP_F ; +if (dev->rx_offloads &DEV_RX_OFFLOAD_SECURITY ) + flags |=NIX_RX_OFFLOAD_SECURITY_F ; +if (!dev->ptype_disable) flags |=NIX_RX_OFFLOAD_PTYPE_F ;
drivers/net/octeontx2/otx2_rx.c +14 -13
@@ -330,7 +330,7 @@ nix_recv_pkts_vector(void *rx_queue, struct rte_mbuf **rx_pkts,#endif -#define R (name, f5, f4, f3, f2, f1, f0, flags) \ +#define R (name, f6, f5, f4, f3, f2, f1, f0, flags) \ static uint16_t __rte_noinline __hot \ otx2_nix_recv_pkts_ ## name(void *rx_queue, \ struct rte_mbuf **rx_pkts, uint16_t pkts) \
@@ -361,12 +361,13 @@ NIX_RX_FASTPATH_MODESstatic inline void pick_rx_func (struct rte_eth_dev *eth_dev, -const eth_rx_burst_t rx_burst[2 ][2 ][2 ][2 ][2 ][2 ]) +const eth_rx_burst_t rx_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ]) {struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); -/* [TSTMP] [MARK] [VLAN] [CKSUM] [PTYPE] [RSS] */ +/* [SEC] [TSTMP] [MARK] [VLAN] [CKSUM] [PTYPE] [RSS] */ eth_dev->rx_pkt_burst = rx_burst + [!!(dev->rx_offload_flags &NIX_RX_OFFLOAD_SECURITY_F )] [!!(dev->rx_offload_flags &NIX_RX_OFFLOAD_TSTAMP_F )] [!!(dev->rx_offload_flags &NIX_RX_OFFLOAD_MARK_UPDATE_F )] [!!(dev->rx_offload_flags &NIX_RX_OFFLOAD_VLAN_STRIP_F )]
@@ -380,25 +381,25 @@ otx2_eth_set_rx_function(struct rte_eth_dev *eth_dev) {struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); -const eth_rx_burst_t nix_eth_rx_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_ ## name, +const eth_rx_burst_t nix_eth_rx_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_ ## name,NIX_RX_FASTPATH_MODES #undef R }; -const eth_rx_burst_t nix_eth_rx_burst_mseg[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_mseg_ ## name, +const eth_rx_burst_t nix_eth_rx_burst_mseg[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_mseg_ ## name,NIX_RX_FASTPATH_MODES #undef R }; -const eth_rx_burst_t nix_eth_rx_vec_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define R(name, f5, f4, f3, f2, f1, f0, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_vec_ ## name, +const eth_rx_burst_t nix_eth_rx_vec_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f6, f5, f4, f3, f2, f1, f0, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_vec_ ## name,NIX_RX_FASTPATH_MODES #undef R
@@ -418,6 +419,6 @@ NIX_RX_FASTPATH_MODES/* Copy multi seg version with no offload for tear down sequence */ if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) dev->rx_pkt_burst_no_offload = - nix_eth_rx_burst_mseg[0 ][0 ][0 ][0 ][0 ][0 ]; + nix_eth_rx_burst_mseg[0 ][0 ][0 ][0 ][0 ][0 ][0 ];rte_mb (); }
drivers/net/octeontx2/otx2_rx.h +217 -89
324 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 13/15 drivers/octeontx2: add sec in Tx fastpath framework
In reply to Anoob JosephFrom: Archana Muniganti <[email protected]>
Added new flag for SECURITY in compiler optimized Tx fastpath framework. With this, compiler autogenerates functions which have security enabled.
--- drivers/event/octeontx2/otx2_evdev.c | 36 ++-- drivers/event/octeontx2/otx2_evdev.h | 2 +- drivers/event/octeontx2/otx2_worker.c | 4 +- drivers/event/octeontx2/otx2_worker_dual.c | 4 +- drivers/net/octeontx2/otx2_ethdev.c | 3 + drivers/net/octeontx2/otx2_tx.c | 29 +-- drivers/net/octeontx2/otx2_tx.h | 271 ++++++++++++++++++++++------- 7 files changed, 250 insertions(+), 99 deletions(-)
drivers/event/octeontx2/otx2_evdev.c +22 -14
@@ -177,35 +177,37 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC };/* Tx modes */ -const event_tx_adapter_enqueue ssogws_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_ssogws_tx_adptr_enq_ ## name, +const event_tx_adapter_enqueue + ssogws_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_tx_adptr_enq_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T };const event_tx_adapter_enqueue - ssogws_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ - [f5][f4][f3][f2][f1][f0] = \ + ssogws_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ otx2_ssogws_tx_adptr_enq_seg_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T };const event_tx_adapter_enqueue - ssogws_dual_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ - [f5][f4][f3][f2][f1][f0] = \ + ssogws_dual_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ otx2_ssogws_dual_tx_adptr_enq_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T };const event_tx_adapter_enqueue - ssogws_dual_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ - [f5][f4][f3][f2][f1][f0] = \ + ssogws_dual_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = \ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T
@@ -290,8 +292,9 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC }if (dev->tx_offloads &NIX_TX_MULTI_SEG_F ) { -/* [TSMP] [MBUF_NOFF] [VLAN] [OL3_L4_CSUM] [L3_L4_CSUM] */ +/* [SEC] [TSMP] [MBUF_NOFF] [VLAN] [OL3_L4_CSUM] [L3_L4_CSUM] */ event_dev->txa_enqueue = ssogws_tx_adptr_enq_seg + [!!(dev->tx_offloads &NIX_TX_OFFLOAD_SECURITY_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_MBUF_NOFF_F )]
@@ -300,6 +303,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->tx_offloads &NIX_TX_OFFLOAD_L3_L4_CSUM_F )]; }else { event_dev->txa_enqueue = ssogws_tx_adptr_enq + [!!(dev->tx_offloads &NIX_TX_OFFLOAD_SECURITY_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_MBUF_NOFF_F )]
@@ -440,8 +444,10 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC }if (dev->tx_offloads &NIX_TX_MULTI_SEG_F ) { -/* [TSMP] [MBUF_NOFF] [VLAN] [OL3_L4_CSUM] [L3_L4_CSUM] */ +/* [SEC] [TSMP] [MBUF_NOFF] [VLAN] [OL3_L4_CSUM] [L3_L4_CSUM] */ event_dev->txa_enqueue = ssogws_dual_tx_adptr_enq_seg + [!!(dev->tx_offloads & +NIX_TX_OFFLOAD_SECURITY_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &
@@ -454,6 +460,8 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC NIX_TX_OFFLOAD_L3_L4_CSUM_F)]; }else { event_dev->txa_enqueue = ssogws_dual_tx_adptr_enq + [!!(dev->tx_offloads & +NIX_TX_OFFLOAD_SECURITY_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &
drivers/event/octeontx2/otx2_evdev.h +1 -1
@@ -335,7 +335,7 @@ uint16_t otx2_ssogws_dual_deq_seg_timeout_burst_ ##name(void *port, \ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC#undef R -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],\ uint16_t nb_events); \ uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, \
drivers/event/octeontx2/otx2_worker.c +2 -2
@@ -267,7 +267,7 @@ otx2_ssogws_enq_fwd_burst(void *port, const struct rte_event ev[],return 1 ; } -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[], \ uint16_t nb_events) \
@@ -281,7 +281,7 @@ otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[], \ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC#undef T -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event ev[],\ uint16_t nb_events) \
drivers/event/octeontx2/otx2_worker_dual.c +2 -2
@@ -307,7 +307,7 @@ otx2_ssogws_dual_deq_seg_timeout_burst_ ##name(void *port, \ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC#undef R -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port, \ struct rte_event ev[], \
@@ -324,7 +324,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port, \ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC#undef T -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port, \ struct rte_event ev[], \
drivers/net/octeontx2/otx2_ethdev.c +3 -0
@@ -700,6 +700,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)NIX_TX_OFFLOAD_OL3_OL4_CSUM_F | NIX_TX_OFFLOAD_L3_L4_CSUM_F); +if (conf &DEV_TX_OFFLOAD_SECURITY ) + flags |=NIX_TX_OFFLOAD_SECURITY_F ; +if ((dev->rx_offloads &DEV_RX_OFFLOAD_TIMESTAMP )) flags |=NIX_TX_OFFLOAD_TSTAMP_F ;
drivers/net/octeontx2/otx2_tx.c +15 -14
@@ -946,7 +946,7 @@ nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, }#endif -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ static uint16_t __rte_noinline __hot \ otx2_nix_xmit_pkts_ ## name(void *tx_queue, \ struct rte_mbuf **tx_pkts, uint16_t pkts) \
@@ -963,7 +963,7 @@ otx2_nix_xmit_pkts_ ## name(void *tx_queue, \ NIX_TX_FASTPATH_MODES#undef T -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ static uint16_t __rte_noinline __hot \ otx2_nix_xmit_pkts_mseg_ ## name(void *tx_queue, \ struct rte_mbuf **tx_pkts, uint16_t pkts) \
@@ -981,7 +981,7 @@ otx2_nix_xmit_pkts_mseg_ ## name(void *tx_queue, \ NIX_TX_FASTPATH_MODES#undef T -#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ static uint16_t __rte_noinline __hot \ otx2_nix_xmit_pkts_vec_ ## name(void *tx_queue, \ struct rte_mbuf **tx_pkts, uint16_t pkts) \
@@ -1001,12 +1001,13 @@ NIX_TX_FASTPATH_MODESstatic inline void pick_tx_func (struct rte_eth_dev *eth_dev, -const eth_tx_burst_t tx_burst[2 ][2 ][2 ][2 ][2 ][2 ]) +const eth_tx_burst_t tx_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ]) {struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); -/* [TSTMP] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */ +/* [SEC] [TSTMP] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */ eth_dev->tx_pkt_burst = tx_burst + [!!(dev->tx_offload_flags &NIX_TX_OFFLOAD_SECURITY_F )] [!!(dev->tx_offload_flags &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offload_flags &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offload_flags &NIX_TX_OFFLOAD_MBUF_NOFF_F )]
@@ -1020,25 +1021,25 @@ otx2_eth_set_tx_function(struct rte_eth_dev *eth_dev) {struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); -const eth_tx_burst_t nix_eth_tx_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_ ## name, +const eth_tx_burst_t nix_eth_tx_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_ ## name,NIX_TX_FASTPATH_MODES #undef T }; -const eth_tx_burst_t nix_eth_tx_burst_mseg[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_mseg_ ## name, +const eth_tx_burst_t nix_eth_tx_burst_mseg[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_mseg_ ## name,NIX_TX_FASTPATH_MODES #undef T }; -const eth_tx_burst_t nix_eth_tx_vec_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ - [f5][f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_vec_ ## name, +const eth_tx_burst_t nix_eth_tx_vec_burst[2 ][2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f6][f5][f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_vec_ ## name,NIX_TX_FASTPATH_MODES #undef T
drivers/net/octeontx2/otx2_tx.h +205 -66
347 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 14/15 net/octeontx2: add inline Tx path changes
In reply to Anoob JosephFrom: Ankur Dwivedi <[email protected]>
Adding pre-processing required for inline IPsec outbound packets.
--- drivers/event/octeontx2/otx2_worker.h | 6 + drivers/net/octeontx2/otx2_ethdev_sec.c | 82 +++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.h | 19 +++ drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 181 +++++++++++++++++++++++++++++ 4 files changed, 288 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_ethdev_sec_tx.h
drivers/event/octeontx2/otx2_worker.h +6 -0
@@ -10,6 +10,7 @@#include <otx2_common.h> #include "otx2_evdev.h" +#include "otx2_ethdev_sec_tx.h" /* SSO Operations */
@@ -281,6 +282,11 @@ otx2_ssogws_event_tx(struct otx2_ssogws *ws, struct rte_event ev[],const struct otx2_eth_txq *txq =otx2_ssogws_xtract_meta (m);rte_prefetch_non_temporal (txq); + +if ((flags &NIX_TX_OFFLOAD_SECURITY_F ) && + (m->ol_flags &PKT_TX_SEC_OFFLOAD )) +return otx2_sec_event_tx (ws, ev, m, txq, flags); +/* Perform header writes before barrier for TSO */ otx2_nix_xmit_prepare_tso (m, flags);otx2_ssogws_order (ws, !ev->sched_type);
drivers/net/octeontx2/otx2_ethdev_sec.c +82 -0
130 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_sec.h +19 -0
@@ -10,9 +10,13 @@#include "otx2_ipsec_fp.h" #define OTX2_CPT_RES_ALIGN 16 +#define OTX2_NIX_SEND_DESC_ALIGN 16 +#define OTX2_CPT_INST_SIZE 64#define OTX2_CPT_EGRP_INLINE_IPSEC 1 +#define OTX2_CPT_OP_INLINE_IPSEC_OUTB (0x40 | 0x25) +#define OTX2_CPT_OP_INLINE_IPSEC_INB (0x40 | 0x26)#define OTX2_CPT_OP_WRITE_HMAC_IPAD_OPAD (0x40 | 0x27)#define OTX2_SEC_CPT_COMP_GOOD 0x1
@@ -93,6 +97,21 @@ struct otx2_sec_session_ipsec_ip {/* CPT LF enqueue register address */ rte_iova_t cpt_nq_reg; +/* Pre calculated lengths and data for a session */ +uint8_t partial_len; +uint8_t roundup_len; +uint8_t roundup_byte; +uint16_t ip_id; +union { +uint64_t esn; +struct { +uint32_t seq; +uint32_t esn_hi; + }; + }; + +uint64_t inst_w7; +/* CPT QP used by SA */ struct otx2_cpt_qp *qp; };
drivers/net/octeontx2/otx2_ethdev_sec_tx.h new file +181 -0
181 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH v4 14/15] net/octeontx2: add inline Tx path changes
04/02/2020 12:17, Anoob Joseph:
drivers/net/octeontx2/otx2_ethdev_sec_tx.h line 63
Quoted 12 lines
From: Ankur Dwivedi <[email protected]>
Adding pre-processing required for inline IPsec outbound packets.
Signed-off-by Ankur Dwivedi <[email protected]>Signed-off-by Anoob Joseph <[email protected]>Signed-off-by Archana Muniganti <[email protected]>Signed-off-by Tejasree Kondoj <[email protected]>Signed-off-by Vamsi Attunuru <[email protected]>---
drivers/net/octeontx2/otx2_ethdev_sec_tx.h new file +2
-0+RTE_ASSERT (!(offload_flags & (NIX_TX_OFFLOAD_MBUF_NOFF_F | +NIX_TX_OFFLOAD_VLAN_QINQ )));
This line does not compile if assert is enabled:drivers/net/octeontx2/otx2_ethdev_sec_tx.h:63:11:
fatal error: use of undeclared identifier 'NIX_TX_OFFLOAD_VLAN_QINQ'
Will replace with NIX_TX_OFFLOAD_VLAN_QINQ_F while pulling in mainline.
PATCH v4 15/15 net/octeontx2: sync inline tag type
In reply to Anoob JosephFrom: Vamsi Attunuru <[email protected]>
Tag type configuration for the inline processed packets is set during ethdev configuration, it might conflict with tag type configuration done during Rx adapter configuration which would be setup later.
This conflict is fixed as part of flow rule creation by updating tag type config of inline same as Rx adapter configured tag type.
--- drivers/net/octeontx2/otx2_ethdev_sec.c | 28 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.h | 2 ++ drivers/net/octeontx2/otx2_flow.c | 26 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+)
drivers/net/octeontx2/otx2_ethdev_sec.c +28 -0
@@ -754,6 +754,34 @@ eth_sec_ipsec_cfg(struct rte_eth_dev *eth_dev, uint8_t tt) }int +otx2_eth_sec_update_tag_type (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct otx2_mbox *mbox = dev->mbox; +struct nix_aq_enq_rsp *rsp; +struct nix_aq_enq_req *aq; +int ret; + + aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + aq->qidx =0 ;/* Read RQ:0 context */ + aq->ctype =NIX_AQ_CTYPE_RQ ; + aq->op =NIX_AQ_INSTOP_READ ; + + ret =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (ret <0 ) { +otx2_err ("Could not read RQ context" ); +return ret; + } + +/* Update tag type */ + ret =eth_sec_ipsec_cfg (eth_dev, rsp->rq.sso_tt); +if (ret <0 ) +otx2_err ("Could not update sec eth tag type" ); + +return ret; +} + +int otx2_eth_sec_init (struct rte_eth_dev *eth_dev) {const size_t sa_width =sizeof (struct otx2_ipsec_fp_in_sa );
drivers/net/octeontx2/otx2_ethdev_sec.h +2 -0
@@ -130,6 +130,8 @@ int otx2_eth_sec_ctx_create(struct rte_eth_dev *eth_dev);void otx2_eth_sec_ctx_destroy (struct rte_eth_dev *eth_dev); +int otx2_eth_sec_update_tag_type (struct rte_eth_dev *eth_dev); +int otx2_eth_sec_init (struct rte_eth_dev *eth_dev);void otx2_eth_sec_fini (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_flow.c +26 -0
@@ -3,6 +3,7 @@*/ #include "otx2_ethdev.h" +#include "otx2_ethdev_sec.h" #include "otx2_flow.h" int
@@ -299,6 +300,21 @@ flow_free_rss_action(struct rte_eth_dev *eth_dev,return 0 ; } +static int +flow_update_sec_tt (struct rte_eth_dev *eth_dev, +const struct rte_flow_action actions[]) +{ +int rc =0 ; + +for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) { +if (actions->type ==RTE_FLOW_ACTION_TYPE_SECURITY ) { + rc =otx2_eth_sec_update_tag_type (eth_dev); +break ; + } + } + +return rc; +}static int flow_parse_meta_items(__rte_unused struct otx2_parse_state *pst)
@@ -491,6 +507,16 @@ otx2_flow_create(struct rte_eth_dev *dev, goto err_exit; } +if (hw->rx_offloads &DEV_RX_OFFLOAD_SECURITY ) { + rc =flow_update_sec_tt (dev, actions); +if (rc !=0 ) { +rte_flow_error_set (error,EIO , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Failed to update tt with sec act" ); + goto err_exit; + } + } list = &hw->npc_flow.flow_list[flow->priority];/* List in ascending order of mcam entries */
Signature · 1 line
2.7.4
Akhil Goyal
AppliedRe: [dpdk-dev] [PATCH v4 00/15] add OCTEON TX2 inline IPsec support
In reply to Anoob JosephQuoted 95 lines
This series adds inline IPsec support in OCTEON TX2 PMD.
In the inbound path,
rte_flowframework need to be used to configure the NPC block, which does the h/w lookup. The packets would get processed by the crypto block and would submit to the scheduling block, SSO. So inline IPsec mode can be enabled only when traffic is received via event device using Rx adapter.In the outbound path, the core would submit to the crypto block and the crypto block would submit the packet for Tx internally.
v4:
* Reverted meson.build file edit in patch 14/15v3:
* Moved ethdev security ops to net/octeontx2
* Segregated all security related code in common to common/octeontx2/otx2_sec* files
* Segregated all security related control code in net tonet/octeontx2/otx2_ethdev_sec*files
* Claimed maintainership for all files added above
* Added support for AES-CBCv2:
* Minimized additions to common/octeontx2
* Updated release notes
* Renamedotx2_is_ethdevtootx2_ethdev_is_sec_capableAnkur Dwivedi (3):
net/octeontx2: add eth security capabilities net/octeontx2: add datapath ops in eth security ctx net/octeontx2: add inline Tx path changesAnoob Joseph (4):
common/octeontx2: add CPT LF mbox for inline inbound net/octeontx2: create eth security ctxcrypto/octeontx2: enable CPT to share QP with ethdev net/octeontx2: add eth security session operationsArchana Muniganti (3):
net/octeontx2: add lookup mem changes to hold sa indicesdrivers/octeontx2: add sec in Rx fastpath frameworkdrivers/octeontx2: add sec in Tx fastpath frameworkTejasree Kondoj (3):
crypto/octeontx2: configure for inline IPsec net/octeontx2: add security in eth dev configure net/octeontx2: add inline ipsec Rx path changesVamsi Attunuru (2):
common/octeontx2: add routine to check if sec capable otx2 net/octeontx2: sync inline tag typeMAINTAINERS | 6 + doc/guides/nics/octeontx2.rst | 20 + doc/guides/rel_notes/release_20_02.rst | 9 + drivers/common/octeontx2/Makefile | 1 + drivers/common/octeontx2/meson.build | 1 + drivers/common/octeontx2/otx2_common.h | 4 + drivers/common/octeontx2/otx2_mbox.h | 7 + drivers/common/octeontx2/otx2_sec_idev.c | 183 +++++ drivers/common/octeontx2/otx2_sec_idev.h | 37 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/crypto/octeontx2/Makefile | 6 +- drivers/crypto/octeontx2/meson.build | 4 + .../crypto/octeontx2/otx2_cryptodev_hw_access.h | 22 +- drivers/crypto/octeontx2/otx2_cryptodev_mbox.c | 54 ++ drivers/crypto/octeontx2/otx2_cryptodev_mbox.h | 7 + drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 56 ++ drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 35 + drivers/crypto/octeontx2/otx2_ipsec_fp.h | 350 +++++++++ drivers/event/octeontx2/Makefile | 1 + drivers/event/octeontx2/meson.build | 2 + drivers/event/octeontx2/otx2_evdev.c | 170 +++-- drivers/event/octeontx2/otx2_evdev.h | 4 +- drivers/event/octeontx2/otx2_worker.c | 6 +- drivers/event/octeontx2/otx2_worker.h | 6 + drivers/event/octeontx2/otx2_worker_dual.c | 6 +- drivers/net/octeontx2/Makefile | 4 + drivers/net/octeontx2/meson.build | 7 +- drivers/net/octeontx2/otx2_ethdev.c | 38 +- drivers/net/octeontx2/otx2_ethdev.h | 2 + drivers/net/octeontx2/otx2_ethdev_devargs.c | 19 + drivers/net/octeontx2/otx2_ethdev_sec.c | 844 +++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.h | 139 ++++ drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 181 +++++ drivers/net/octeontx2/otx2_flow.c | 26 + drivers/net/octeontx2/otx2_lookup.c | 11 +- drivers/net/octeontx2/otx2_rx.c | 27 +- drivers/net/octeontx2/otx2_rx.h | 377 ++++++--- drivers/net/octeontx2/otx2_tx.c | 29 +- drivers/net/octeontx2/otx2_tx.h | 271 +++++--
Quoted 9 lines
39 files changed, 2696 insertions(+), 282 deletions(-) create mode 100644 drivers/common/octeontx2/otx2_sec_idev.c create mode 100644 drivers/common/octeontx2/otx2_sec_idev.h create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_qp.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_fp.h create mode 100644 drivers/net/octeontx2/otx2_ethdev_sec.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_sec.h create mode 100644 drivers/net/octeontx2/otx2_ethdev_sec_tx.h
Applied to dpdk-next-crypto
Thanks.