OCTEON TX2 Ethdev driver
Subsystems (2)
PATCH v3 30/58 net/octeontx2: add PTP base support
In reply to [email protected]From: Harman Kalra <[email protected]>
Add PTP enable and disable operations.
--- doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 22 ++++- drivers/net/octeontx2/otx2_ethdev.h | 17 ++++ drivers/net/octeontx2/otx2_ptp.c | 135 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 11 +++ 7 files changed, 185 insertions(+), 3 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_ptp.c
doc/guides/nics/octeontx2.rst +1 -0
@@ -27,6 +27,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Link state information - Link flow control - Debug utilities - Context dump and error interrupt support +- IEEE1588 timestamping Prerequisites -------------
drivers/net/octeontx2/Makefile +1 -0
@@ -34,6 +34,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_tm.c \ otx2_rss.c \ otx2_mac.c \ + otx2_ptp.c \ otx2_link.c \ otx2_stats.c \ otx2_lookup.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -6,6 +6,7 @@ sources = files( 'otx2_tm.c', 'otx2_rss.c', 'otx2_mac.c', + 'otx2_ptp.c', 'otx2_link.c', 'otx2_stats.c', 'otx2_lookup.c',
drivers/net/octeontx2/otx2_ethdev.c +19 -3
@@ -336,9 +336,7 @@ nix_cq_rq_uninit(struct rte_eth_dev *eth_dev, struct otx2_eth_rxq *rxq)static inline int nix_get_data_off (struct otx2_eth_dev *dev) { -RTE_SET_USED (dev); - -return 0 ; +return otx2_ethdev_is_ptp_en (dev) ?NIX_TIMESYNC_RX_OFFSET :0 ; }uint64_t
@@ -450,6 +448,7 @@ otx2_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t rq, rxq->qlen =nix_qsize_to_val (qsize); rxq->qsize = qsize; rxq->lookup_mem =otx2_nix_fastpath_lookup_mem_get (); + rxq->tstamp = &dev->tstamp;/* Alloc completion queue */ rc =nix_cq_rq_init (eth_dev, dev, rq, rxq, mp);
@@ -736,6 +735,7 @@ otx2_nix_form_default_desc(struct otx2_eth_txq *txq) send_mem->dsz =0x0 ; send_mem->wmem =0x1 ; send_mem->alg =NIX_SENDMEMALG_SETTSTMP ; + send_mem->addr = txq->dev->tstamp.tx_tstamp_iova; } sg = (union nix_send_sg_s *)&txq->cmd[4 ]; }else {
@@ -1160,6 +1160,16 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } +/* Enable PTP if it was requested by the app or if it is already +* enabled in PF owning this VF +*/ +memset (&dev->tstamp,0 ,sizeof (struct otx2_timesync_info )); +if ((dev->rx_offloads &DEV_RX_OFFLOAD_TIMESTAMP ) || +otx2_ethdev_is_ptp_en (dev)) +otx2_nix_timesync_enable (eth_dev); +else +otx2_nix_timesync_disable (eth_dev); +/* * Restore queue config when reconfigure followed by * reconfigure and no queue configure invoked from application case.
@@ -1338,6 +1348,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .get_module_eeprom = otx2_nix_get_module_eeprom, .flow_ctrl_get = otx2_nix_flow_ctrl_get, .flow_ctrl_set = otx2_nix_flow_ctrl_set, + .timesync_enable = otx2_nix_timesync_enable, + .timesync_disable = otx2_nix_timesync_disable, }; static inline int
@@ -1542,6 +1554,10 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +/* Disable PTP if already enabled */ +if (otx2_ethdev_is_ptp_en (dev)) +otx2_nix_timesync_disable (eth_dev); +/* Free up SQs */ for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {otx2_nix_tx_queue_release (eth_dev->data->tx_queues[i]);
drivers/net/octeontx2/otx2_ethdev.h +17 -0
@@ -13,6 +13,7 @@#include <rte_mbuf.h> #include <rte_mempool.h> #include <rte_string_fns.h> +#include <rte_time.h> #include "otx2_common.h" #include "otx2_dev.h"
@@ -128,6 +129,12 @@#define NIX_DEFAULT_RSS_CTX_GROUP 0#define NIX_DEFAULT_RSS_MCAM_IDX -1 +#define otx2_ethdev_is_ptp_en (dev) ((dev)->ptp_en) + +#define NIX_TIMESYNC_TX_CMD_LEN 8 +/* Additional timesync values. */ +#define OTX2_CYCLECOUNTER_MASK 0xffffffffffffffffULL +enum nix_q_size_e { nix_q_size_16,/* 16 entries */ nix_q_size_64,/* 64 entries */
@@ -234,6 +241,12 @@ struct otx2_eth_dev {struct otx2_eth_qconf *tx_qconf;struct otx2_eth_qconf *rx_qconf;struct rte_eth_dev *eth_dev; +/* PTP counters */ +bool ptp_en; +struct otx2_timesync_info tstamp; +struct rte_timecounter systime_tc; +struct rte_timecounter rx_tstamp_tc; +struct rte_timecounter tx_tstamp_tc; } __rte_cache_aligned;struct otx2_eth_txq {
@@ -414,4 +427,8 @@ int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,/* Rx and Tx routines */ void otx2_nix_form_default_desc (struct otx2_eth_txq *txq); +/* Timesync - PTP routines */ +int otx2_nix_timesync_enable (struct rte_eth_dev *eth_dev); +int otx2_nix_timesync_disable (struct rte_eth_dev *eth_dev); +#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ptp.c new file +135 -0
135 lines not on this page · raw message
drivers/net/octeontx2/otx2_rx.h +11 -0
@@ -13,5 +13,16 @@ sizeof(uint16_t))#define NIX_RX_OFFLOAD_PTYPE_F BIT(1) +#define NIX_RX_OFFLOAD_TSTAMP_F BIT(5) + +#define NIX_TIMESYNC_RX_OFFSET 8 + +struct otx2_timesync_info { +uint64_t rx_tstamp; +rte_iova_t tx_tstamp_iova; +uint64_t *tx_tstamp; +uint8_t tx_ready; +uint8_t rx_ready; +} __rte_cache_aligned;#endif /* __OTX2_RX_H__ */
Signature · 1 line
2.21.0
PATCH v3 31/58 net/octeontx2: add remaining PTP operations
In reply to [email protected]From: Harman Kalra <[email protected]>
Add remaining PTP configuration/slowpath operations. Timesync feature is available only for PF devices.
--- doc/guides/nics/features/octeontx2.ini | 2 + drivers/net/octeontx2/otx2_ethdev.c | 6 ++ drivers/net/octeontx2/otx2_ethdev.h | 11 +++ drivers/net/octeontx2/otx2_ptp.c | 130 +++++++++++++++++++++++++ 4 files changed, 149 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -23,6 +23,8 @@ RSS reta update = Y Inner RSS = Y Flow control = Y Packet type parsing = Y +Timesync = Y +Timestamp offload = Y Rx descriptor status = Y Basic stats = Y Stats per queue = Y
drivers/net/octeontx2/otx2_ethdev.c +6 -0
@@ -47,6 +47,7 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)static const struct otx2_dev_ops otx2_dev_ops = { .link_status_update = otx2_eth_dev_link_status_update, + .ptp_info_update = otx2_eth_dev_ptp_info_update }; static int
@@ -1350,6 +1351,11 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .flow_ctrl_set = otx2_nix_flow_ctrl_set, .timesync_enable = otx2_nix_timesync_enable, .timesync_disable = otx2_nix_timesync_disable, + .timesync_read_rx_timestamp = otx2_nix_timesync_read_rx_timestamp, + .timesync_read_tx_timestamp = otx2_nix_timesync_read_tx_timestamp, + .timesync_adjust_time = otx2_nix_timesync_adjust_time, + .timesync_read_time = otx2_nix_timesync_read_time, + .timesync_write_time = otx2_nix_timesync_write_time, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +11 -0
@@ -430,5 +430,16 @@ void otx2_nix_form_default_desc(struct otx2_eth_txq *txq);/* Timesync - PTP routines */ int otx2_nix_timesync_enable (struct rte_eth_dev *eth_dev);int otx2_nix_timesync_disable (struct rte_eth_dev *eth_dev); +int otx2_nix_timesync_read_rx_timestamp (struct rte_eth_dev *eth_dev, +struct timespec *timestamp, +uint32_t flags); +int otx2_nix_timesync_read_tx_timestamp (struct rte_eth_dev *eth_dev, +struct timespec *timestamp); +int otx2_nix_timesync_adjust_time (struct rte_eth_dev *eth_dev,int64_t delta); +int otx2_nix_timesync_write_time (struct rte_eth_dev *eth_dev, +const struct timespec *ts); +int otx2_nix_timesync_read_time (struct rte_eth_dev *eth_dev, +struct timespec *ts); +int otx2_eth_dev_ptp_info_update (struct otx2_dev *dev,bool ptp_en);#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ptp.c +130 -0
139 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 32/58 net/octeontx2: introducing flow driver
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Introducing flow infra for octeontx2.
This will be used to maintain rte_flow rules.
Create, destroy, validate, query, flush, isolate flow operations will be supported.
--- drivers/net/octeontx2/otx2_flow.h | 388 ++++++++++++++++++++++++++++++ 1 file changed, 388 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_flow.h
drivers/net/octeontx2/otx2_flow.h new file +388 -0
@@ -0,0 +1,388 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ + +#ifndef __OTX2_FLOW_H__ +#define __OTX2_FLOW_H__ + +#include <stdint.h> + +#include <rte_flow_driver.h> +#include <rte_malloc.h> +#include <rte_tailq.h> + +#include "otx2_common.h" +#include "otx2_ethdev.h" +#include "otx2_mbox.h" + +int otx2_flow_init (struct otx2_eth_dev *hw); +int otx2_flow_fini (struct otx2_eth_dev *hw); +extern const struct rte_flow_ops otx2_flow_ops; + +enum { +OTX2_INTF_RX =0 , +OTX2_INTF_TX =1 , +OTX2_INTF_MAX =2 , +}; + +#define NPC_IH_LENGTH 8 +#define NPC_TPID_LENGTH 2 +#define NPC_COUNTER_NONE (-1) +/* 32 bytes from LDATA_CFG & 32 bytes from FLAGS_CFG */ +#define NPC_MAX_EXTRACT_DATA_LEN (64) +#define NPC_LDATA_LFLAG_LEN (16) +#define NPC_MCAM_TOT_ENTRIES (4096) +#define NPC_MAX_KEY_NIBBLES (31) +/* Nibble offsets */ +#define NPC_LAYER_KEYX_SZ (3) +#define NPC_PARSE_KEX_S_LA_OFFSET (7) +#define NPC_PARSE_KEX_S_LID_OFFSET (lid) \ + ((((lid) - NPC_LID_LA) * NPC_LAYER_KEYX_SZ) \ + + NPC_PARSE_KEX_S_LA_OFFSET) + + +/* supported flow actions flags */ +#define OTX2_FLOW_ACT_MARK (1 << 0) +#define OTX2_FLOW_ACT_FLAG (1 << 1) +#define OTX2_FLOW_ACT_DROP (1 << 2) +#define OTX2_FLOW_ACT_QUEUE (1 << 3) +#define OTX2_FLOW_ACT_RSS (1 << 4) +#define OTX2_FLOW_ACT_DUP (1 << 5) +#define OTX2_FLOW_ACT_SEC (1 << 6) +#define OTX2_FLOW_ACT_COUNT (1 << 7) + +/* terminating actions */ +#define OTX2_FLOW_ACT_TERM (OTX2_FLOW_ACT_DROP | \ + OTX2_FLOW_ACT_QUEUE | \ + OTX2_FLOW_ACT_RSS | \ + OTX2_FLOW_ACT_DUP | \ + OTX2_FLOW_ACT_SEC) + +/* This mark value indicates flag action */ +#define OTX2_FLOW_FLAG_VAL (0xffff) + +#define NIX_RX_ACT_MATCH_OFFSET (40) +#define NIX_RX_ACT_MATCH_MASK (0xFFFF) + +#define NIX_RSS_ACT_GRP_OFFSET (20) +#define NIX_RSS_ACT_ALG_OFFSET (56) +#define NIX_RSS_ACT_GRP_MASK (0xFFFFF) +#define NIX_RSS_ACT_ALG_MASK (0x1F) + +/* PMD-specific definition of the opaque struct rte_flow */ +#define OTX2_MAX_MCAM_WIDTH_DWORDS 7 + +enum npc_mcam_intf { +NPC_MCAM_RX , +NPC_MCAM_TX +}; + +struct npc_xtract_info { +/* Length in bytes of pkt data extracted. len = 0 +* indicates that extraction is disabled. +*/ +uint8_t len; +uint8_t hdr_off;/* Byte offset of proto hdr: extract_src */ +uint8_t key_off;/* Byte offset in MCAM key where data is placed */ +uint8_t enable;/* Extraction enabled or disabled */ +}; + +/* Information for a given {LAYER, LTYPE} */ +struct npc_lid_lt_xtract_info { +/* Info derived from parser configuration */ +uint16_t npc_proto;/* Network protocol identified */ +uint8_t valid_flags_mask;/* Flags applicable */ +uint8_t is_terminating:1 ;/* No more parsing */ +struct npc_xtract_info xtract[NPC_MAX_LD ]; +}; + +union npc_kex_ldata_flags_cfg { +struct { +#if defined(__BIG_ENDIAN_BITFIELD) +uint64_t rvsd_62_1 :61 ; +uint64_t lid :3 ; +#else +uint64_t lid :3 ; +uint64_t rvsd_62_1 :61 ; +#endif + } s; + +uint64_t i; +}; + +typedef struct npc_lid_lt_xtract_info +otx2_dxcfg_t [NPC_MAX_INTF ][NPC_MAX_LID ][NPC_MAX_LT ]; +typedef struct npc_lid_lt_xtract_info +otx2_fxcfg_t [NPC_MAX_INTF ][NPC_MAX_LD ][NPC_MAX_LFL ]; +typedef union npc_kex_ldata_flags_cfg otx2_ld_flags_t [NPC_MAX_LD ]; + + +/* MBOX_MSG_NPC_GET_DATAX_CFG Response */ +struct npc_get_datax_cfg { +/* NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG */ +union npc_kex_ldata_flags_cfg ld_flags[NPC_MAX_LD ]; +/* Extract information indexed with [LID][LTYPE] */ +struct npc_lid_lt_xtract_info lid_lt_xtract[NPC_MAX_LID ][NPC_MAX_LT ]; +/* Flags based extract indexed with [LDATA][FLAGS_LOWER_NIBBLE] +* Fields flags_ena_ld0, flags_ena_ld1 in +* struct npc_lid_lt_xtract_info indicate if this is applicable +* for a given {LAYER, LTYPE} +*/ +struct npc_xtract_info flag_xtract[NPC_MAX_LD ][NPC_MAX_LT ]; +}; + +struct otx2_mcam_ents_info { +/* Current max & min values of mcam index */ +uint32_t max_id; +uint32_t min_id; +uint32_t free_ent; +uint32_t live_ent; +}; + +struct rte_flow { +uint8_t nix_intf; +uint32_t mcam_id; +int32_t ctr_id; +uint32_t priority; +/* Contiguous match string */ +uint64_t mcam_data[OTX2_MAX_MCAM_WIDTH_DWORDS ]; +uint64_t mcam_mask[OTX2_MAX_MCAM_WIDTH_DWORDS ]; +uint64_t npc_action; +TAILQ_ENTRY (rte_flow) next; +}; + +TAILQ_HEAD (otx2_flow_list, rte_flow); + +/* Accessed from ethdev private - otx2_eth_dev */ +struct otx2_npc_flow_info { +rte_atomic32_t mark_actions; +uint32_t keyx_supp_nmask[NPC_MAX_INTF ];/* nibble mask */ +uint32_t keyx_len[NPC_MAX_INTF ];/* per intf key len in bits */ +uint32_t datax_len[NPC_MAX_INTF ];/* per intf data len in bits */ +uint32_t keyw[NPC_MAX_INTF ];/* max key + data len bits */ +uint32_t mcam_entries;/* mcam entries supported */ +otx2_dxcfg_t prx_dxcfg;/* intf, lid, lt, extract */ +otx2_fxcfg_t prx_fxcfg;/* Flag extract */ +otx2_ld_flags_t prx_lfcfg;/* KEX LD_Flags CFG */ +/* mcam entry info per priority level: both free & in-use */ +struct otx2_mcam_ents_info *flow_entry_info; +/* Bitmap of free preallocated entries in ascending index & +* descending priority +*/ +struct rte_bitmap **free_entries; +/* Bitmap of free preallocated entries in descending index & +* ascending priority +*/ +struct rte_bitmap **free_entries_rev; +/* Bitmap of live entries in ascending index & descending priority */ +struct rte_bitmap **live_entries; +/* Bitmap of live entries in descending index & ascending priority */ +struct rte_bitmap **live_entries_rev; +/* Priority bucket wise tail queue of all rte_flow resources */ +struct otx2_flow_list *flow_list; +uint32_t rss_grps;/* rss groups supported */ +struct rte_bitmap *rss_grp_entries; +uint16_t channel;/*rx channel */ +uint16_t flow_prealloc_size; +uint16_t flow_max_priority; +}; + +struct otx2_parse_state { +struct otx2_npc_flow_info *npc; +const struct rte_flow_item *pattern; +const struct rte_flow_item *last_pattern;/* Temp usage */ +struct rte_flow_error *error; +struct rte_flow *flow; +uint8_t tunnel; +uint8_t terminate; +uint8_t layer_mask; +uint8_t lt[NPC_MAX_LID ]; +uint8_t flags[NPC_MAX_LID ]; +uint8_t *mcam_data;/* point to flow->mcam_data + key_len */ +uint8_t *mcam_mask;/* point to flow->mcam_mask + key_len */ +}; + +struct otx2_flow_item_info { +const void *def_mask;/* rte_flow default mask */ +void *hw_mask;/* hardware supported mask */ +int len;/* length of item */ +const void *spec;/* spec to use, NULL implies match any */ +const void *mask;/* mask to use */ +uint8_t hw_hdr_len;/* Extra data len at each layer*/ +}; + +struct otx2_idev_kex_cfg { +struct npc_get_kex_cfg_rsp kex_cfg; +rte_atomic16_t kex_refcnt; +}; + +enum npc_kpu_parser_flag { +NPC_F_NA =0 , +NPC_F_PKI , +NPC_F_PKI_VLAN , +NPC_F_PKI_ETAG , +NPC_F_PKI_ITAG , +NPC_F_PKI_MPLS , +NPC_F_PKI_NSH , +NPC_F_ETYPE_UNK , +NPC_F_ETHER_VLAN , +NPC_F_ETHER_ETAG , +NPC_F_ETHER_ITAG , +NPC_F_ETHER_MPLS , +NPC_F_ETHER_NSH , +NPC_F_STAG_CTAG , +NPC_F_STAG_CTAG_UNK , +NPC_F_STAG_STAG_CTAG , +NPC_F_STAG_STAG_STAG , +NPC_F_QINQ_CTAG , +NPC_F_QINQ_CTAG_UNK , +NPC_F_QINQ_QINQ_CTAG , +NPC_F_QINQ_QINQ_QINQ , +NPC_F_BTAG_ITAG , +NPC_F_BTAG_ITAG_STAG , +NPC_F_BTAG_ITAG_CTAG , +NPC_F_BTAG_ITAG_UNK , +NPC_F_ETAG_CTAG , +NPC_F_ETAG_BTAG_ITAG , +NPC_F_ETAG_STAG , +NPC_F_ETAG_QINQ , +NPC_F_ETAG_ITAG , +NPC_F_ETAG_ITAG_STAG , +NPC_F_ETAG_ITAG_CTAG , +NPC_F_ETAG_ITAG_UNK , +NPC_F_ITAG_STAG_CTAG , +NPC_F_ITAG_STAG , +NPC_F_ITAG_CTAG , +NPC_F_MPLS_4_LABELS , +NPC_F_MPLS_3_LABELS , +NPC_F_MPLS_2_LABELS , +NPC_F_IP_HAS_OPTIONS , +NPC_F_IP_IP_IN_IP , +NPC_F_IP_6TO4 , +NPC_F_IP_MPLS_IN_IP , +NPC_F_IP_UNK_PROTO , +NPC_F_IP_IP_IN_IP_HAS_OPTIONS , +NPC_F_IP_6TO4_HAS_OPTIONS , +NPC_F_IP_MPLS_IN_IP_HAS_OPTIONS , +NPC_F_IP_UNK_PROTO_HAS_OPTIONS , +NPC_F_IP6_HAS_EXT , +NPC_F_IP6_TUN_IP6 , +NPC_F_IP6_MPLS_IN_IP , +NPC_F_TCP_HAS_OPTIONS , +NPC_F_TCP_HTTP , +NPC_F_TCP_HTTPS , +NPC_F_TCP_PPTP , +NPC_F_TCP_UNK_PORT , +NPC_F_TCP_HTTP_HAS_OPTIONS , +NPC_F_TCP_HTTPS_HAS_OPTIONS , +NPC_F_TCP_PPTP_HAS_OPTIONS , +NPC_F_TCP_UNK_PORT_HAS_OPTIONS , +NPC_F_UDP_VXLAN , +NPC_F_UDP_VXLAN_NOVNI , +NPC_F_UDP_VXLAN_NOVNI_NSH , +NPC_F_UDP_VXLANGPE , +NPC_F_UDP_VXLANGPE_NSH , +NPC_F_UDP_VXLANGPE_MPLS , +NPC_F_UDP_VXLANGPE_NOVNI , +NPC_F_UDP_VXLANGPE_NOVNI_NSH , +NPC_F_UDP_VXLANGPE_NOVNI_MPLS , +NPC_F_UDP_VXLANGPE_UNK , +NPC_F_UDP_VXLANGPE_NONP , +NPC_F_UDP_GTP_GTPC , +NPC_F_UDP_GTP_GTPU_G_PDU , +NPC_F_UDP_GTP_GTPU_UNK , +NPC_F_UDP_UNK_PORT , +NPC_F_UDP_GENEVE , +NPC_F_UDP_GENEVE_OAM , +NPC_F_UDP_GENEVE_CRI_OPT , +NPC_F_UDP_GENEVE_OAM_CRI_OPT , +NPC_F_GRE_NVGRE , +NPC_F_GRE_HAS_SRE , +NPC_F_GRE_HAS_CSUM , +NPC_F_GRE_HAS_KEY , +NPC_F_GRE_HAS_SEQ , +NPC_F_GRE_HAS_CSUM_KEY , +NPC_F_GRE_HAS_CSUM_SEQ , +NPC_F_GRE_HAS_KEY_SEQ , +NPC_F_GRE_HAS_CSUM_KEY_SEQ , +NPC_F_GRE_HAS_ROUTE , +NPC_F_GRE_UNK_PROTO , +NPC_F_GRE_VER1 , +NPC_F_GRE_VER1_HAS_SEQ , +NPC_F_GRE_VER1_HAS_ACK , +NPC_F_GRE_VER1_HAS_SEQ_ACK , +NPC_F_GRE_VER1_UNK_PROTO , +NPC_F_TU_ETHER_UNK , +NPC_F_TU_ETHER_CTAG , +NPC_F_TU_ETHER_CTAG_UNK , +NPC_F_TU_ETHER_STAG_CTAG , +NPC_F_TU_ETHER_STAG_CTAG_UNK , +NPC_F_TU_ETHER_STAG , +NPC_F_TU_ETHER_STAG_UNK , +NPC_F_TU_ETHER_QINQ_CTAG , +NPC_F_TU_ETHER_QINQ_CTAG_UNK , +NPC_F_TU_ETHER_QINQ , +NPC_F_TU_ETHER_QINQ_UNK , +NPC_F_LAST /* has to be the last item */ +}; + + +int otx2_flow_mcam_free_counter (struct otx2_mbox *mbox,uint16_t ctr_id); + +int otx2_flow_mcam_read_counter (struct otx2_mbox *mbox,uint32_t ctr_id, +uint64_t *count); + +int otx2_flow_mcam_clear_counter (struct otx2_mbox *mbox,uint32_t ctr_id); + +int otx2_flow_mcam_free_entry (struct otx2_mbox *mbox,uint32_t entry); + +int otx2_flow_mcam_free_all_entries (struct otx2_mbox *mbox); + +int otx2_flow_update_parse_state (struct otx2_parse_state *pst, +struct otx2_flow_item_info *info, +int lid,int lt,uint8_t flags); + +int otx2_flow_parse_item_basic (const struct rte_flow_item *item, +struct otx2_flow_item_info *info, +struct rte_flow_error *error); + +void otx2_flow_keyx_compress (uint64_t *data,uint32_t nibble_mask); + +int otx2_flow_mcam_alloc_and_write (struct rte_flow *flow, +struct otx2_mbox *mbox, +struct otx2_parse_state *pst, +struct otx2_npc_flow_info *flow_info); + +void otx2_flow_get_hw_supp_mask (struct otx2_parse_state *pst, +struct otx2_flow_item_info *info, +int lid,int lt); + +const struct rte_flow_item * +otx2_flow_skip_void_and_any_items (const struct rte_flow_item *pattern); + +int otx2_flow_parse_lh (struct otx2_parse_state *pst); + +int otx2_flow_parse_lg (struct otx2_parse_state *pst); + +int otx2_flow_parse_lf (struct otx2_parse_state *pst); + +int otx2_flow_parse_le (struct otx2_parse_state *pst); + +int otx2_flow_parse_ld (struct otx2_parse_state *pst); + +int otx2_flow_parse_lc (struct otx2_parse_state *pst); + +int otx2_flow_parse_lb (struct otx2_parse_state *pst); + +int otx2_flow_parse_la (struct otx2_parse_state *pst); + +int otx2_flow_parse_actions (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_action actions[], +struct rte_flow_error *error, +struct rte_flow *flow); + +int otx2_flow_free_all_resources (struct otx2_eth_dev *hw); + +int otx2_flow_parse_mpls (struct otx2_parse_state *pst,int lid); +#endif /* __OTX2_FLOW_H__ */
Signature · 1 line
2.21.0
PATCH v3 33/58 net/octeontx2: add flow utility functions
In reply to [email protected]From: Kiran Kumar K <[email protected]>
First pass rte_flow utility functions for octeontx2. These will be used to communicate with AF driver.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.h | 7 +- drivers/net/octeontx2/otx2_flow.h | 2 + drivers/net/octeontx2/otx2_flow_utils.c | 387 ++++++++++++++++++++++++ 5 files changed, 392 insertions(+), 6 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_flow_utils.c
drivers/net/octeontx2/Makefile +1 -0
@@ -40,6 +40,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_lookup.c \ otx2_ethdev.c \ otx2_flow_ctrl.c \ + otx2_flow_utils.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \ otx2_ethdev_debug.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -12,6 +12,7 @@ sources = files( 'otx2_lookup.c', 'otx2_ethdev.c', 'otx2_flow_ctrl.c', + 'otx2_flow_utils.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c', 'otx2_ethdev_debug.c',
drivers/net/octeontx2/otx2_ethdev.h +1 -6
@@ -17,6 +17,7 @@#include "otx2_common.h" #include "otx2_dev.h" +#include "otx2_flow.h" #include "otx2_irq.h" #include "otx2_mempool.h" #include "otx2_rx.h"
@@ -173,12 +174,6 @@ struct otx2_eth_qconf {uint16_t nb_desc; }; -struct otx2_npc_flow_info { -uint16_t channel;/*rx channel */ -uint16_t flow_prealloc_size; -uint16_t flow_max_priority; -}; -struct otx2_fc_info {enum rte_eth_fc_mode mode;/**< Link flow control mode */ uint8_t rx_pause;
drivers/net/octeontx2/otx2_flow.h +2 -0
@@ -15,6 +15,8 @@#include "otx2_ethdev.h" #include "otx2_mbox.h" +struct otx2_eth_dev ; +int otx2_flow_init (struct otx2_eth_dev *hw);int otx2_flow_fini (struct otx2_eth_dev *hw);extern const struct rte_flow_ops otx2_flow_ops;
drivers/net/octeontx2/otx2_flow_utils.c new file +387 -0
387 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 34/58 net/octeontx2: add flow mbox utility functions
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding mailbox utility functions for rte_flow. These will be used to alloc, reserve and write the entries to the device on request.
--- drivers/net/octeontx2/otx2_flow.h | 6 + drivers/net/octeontx2/otx2_flow_utils.c | 259 ++++++++++++++++++++++++ 2 files changed, 265 insertions(+)
drivers/net/octeontx2/otx2_flow.h +6 -0
@@ -387,4 +387,10 @@ int otx2_flow_parse_actions(struct rte_eth_dev *dev,int otx2_flow_free_all_resources (struct otx2_eth_dev *hw);int otx2_flow_parse_mpls (struct otx2_parse_state *pst,int lid); + +int +flow_validate_and_shift_prio_ent (struct otx2_mbox *mbox,struct rte_flow *flow, +struct otx2_npc_flow_info *flow_info, +struct npc_mcam_alloc_entry_rsp *rsp, +int req_prio);#endif /* __OTX2_FLOW_H__ */
drivers/net/octeontx2/otx2_flow_utils.c +259 -0
262 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 35/58 net/octeontx2: add flow MCAM utility functions
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding MCAM utility functions to alloc and write the entries. These will be used to arrange the flow rules based on priority.
--- drivers/net/octeontx2/otx2_flow.h | 6 - drivers/net/octeontx2/otx2_flow_utils.c | 266 +++++++++++++++++++++++- 2 files changed, 265 insertions(+), 7 deletions(-)
drivers/net/octeontx2/otx2_flow.h +0 -6
@@ -387,10 +387,4 @@ int otx2_flow_parse_actions(struct rte_eth_dev *dev,int otx2_flow_free_all_resources (struct otx2_eth_dev *hw);int otx2_flow_parse_mpls (struct otx2_parse_state *pst,int lid); - -int -flow_validate_and_shift_prio_ent (struct otx2_mbox *mbox,struct rte_flow *flow, -struct otx2_npc_flow_info *flow_info, -struct npc_mcam_alloc_entry_rsp *rsp, -int req_prio);#endif /* __OTX2_FLOW_H__ */
drivers/net/octeontx2/otx2_flow_utils.c +265 -1
281 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 36/58 net/octeontx2: add flow parsing for outer layers
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding functionality to parse outer layers from ld to lh. These will be used parse outer layers L2, L3, L4 and tunnel types.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_flow_parse.c | 471 ++++++++++++++++++++++++ 3 files changed, 473 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_flow_parse.c
drivers/net/octeontx2/Makefile +1 -0
@@ -40,6 +40,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_lookup.c \ otx2_ethdev.c \ otx2_flow_ctrl.c \ + otx2_flow_parse.c \ otx2_flow_utils.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -12,6 +12,7 @@ sources = files( 'otx2_lookup.c', 'otx2_ethdev.c', 'otx2_flow_ctrl.c', + 'otx2_flow_parse.c', 'otx2_flow_utils.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_flow_parse.c new file +471 -0
471 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 37/58 net/octeontx2: add flow actions support
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding support to parse flow actions like drop, count, mark, rss, queue. On egress side, only drop and count actions were supported.
--- drivers/net/octeontx2/otx2_flow_parse.c | 210 ++++++++++++++++++++++++ 1 file changed, 210 insertions(+)
drivers/net/octeontx2/otx2_flow_parse.c +210 -0
@@ -469,3 +469,213 @@ otx2_flow_parse_ld(struct otx2_parse_state *pst)return otx2_flow_update_parse_state (pst, &info, lid, lt, lflags); } + +static inline void +flow_check_lc_ip_tunnel (struct otx2_parse_state *pst) +{ +const struct rte_flow_item *pattern = pst->pattern +1 ; + + pattern =otx2_flow_skip_void_and_any_items (pattern); +if (pattern->type ==RTE_FLOW_ITEM_TYPE_MPLS || + pattern->type ==RTE_FLOW_ITEM_TYPE_IPV4 || + pattern->type ==RTE_FLOW_ITEM_TYPE_IPV6 ) + pst->tunnel =1 ; +} + +/* Outer IPv4, Outer IPv6, MPLS, ARP */ +int +otx2_flow_parse_lc (struct otx2_parse_state *pst) +{ +uint8_t hw_mask[NPC_MAX_EXTRACT_DATA_LEN ]; +struct otx2_flow_item_info info; +int lid, lt; +int rc; + +if (pst->pattern->type ==RTE_FLOW_ITEM_TYPE_MPLS ) +return otx2_flow_parse_mpls (pst,NPC_LID_LC ); + + info.hw_mask = &hw_mask; + info.spec =NULL ; + info.mask =NULL ; + info.hw_hdr_len =0 ; + lid =NPC_LID_LC ; + +switch (pst->pattern->type) { +case RTE_FLOW_ITEM_TYPE_IPV4 : + lt =NPC_LT_LC_IP ; + info.def_mask = &rte_flow_item_ipv4_mask; + info.len =sizeof (struct rte_flow_item_ipv4 ); +break ; +case RTE_FLOW_ITEM_TYPE_IPV6 : + lid =NPC_LID_LC ; + lt =NPC_LT_LC_IP6 ; + info.def_mask = &rte_flow_item_ipv6_mask; + info.len =sizeof (struct rte_flow_item_ipv6 ); +break ; +case RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4 : + lt =NPC_LT_LC_ARP ; + info.def_mask = &rte_flow_item_arp_eth_ipv4_mask; + info.len =sizeof (struct rte_flow_item_arp_eth_ipv4 ); +break ; +default : +/* No match at this layer */ +return 0 ; + } + +/* Identify if IP tunnels MPLS or IPv4/v6 */ +flow_check_lc_ip_tunnel (pst); + +otx2_flow_get_hw_supp_mask (pst, &info, lid, lt); + rc =otx2_flow_parse_item_basic (pst->pattern, &info, pst->error); +if (rc !=0 ) +return rc; + +return otx2_flow_update_parse_state (pst, &info, lid, lt,0 ); +} + +/* VLAN, ETAG */ +int +otx2_flow_parse_lb (struct otx2_parse_state *pst) +{ +const struct rte_flow_item *pattern = pst->pattern; +const struct rte_flow_item *last_pattern; +char hw_mask[NPC_MAX_EXTRACT_DATA_LEN ]; +struct otx2_flow_item_info info; +int lid, lt, lflags; +int nr_vlans =0 ; +int rc; + + info.spec =NULL ; + info.mask =NULL ; + info.hw_hdr_len =NPC_TPID_LENGTH ; + + lid =NPC_LID_LB ; + lflags =0 ; + last_pattern = pattern; + +if (pst->pattern->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { +/* RTE vlan is either 802.1q or 802.1ad, +* this maps to either CTAG/STAG. We need to decide +* based on number of VLANS present. Matching is +* supported on first tag only. +*/ + info.def_mask = &rte_flow_item_vlan_mask; + info.hw_mask =NULL ; + info.len =sizeof (struct rte_flow_item_vlan ); + + pattern = pst->pattern; +while (pattern->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + nr_vlans++; + +/* Basic validation of 2nd/3rd vlan item */ +if (nr_vlans >1 ) { +otx2_npc_dbg ("Vlans = %d" , nr_vlans); + rc =otx2_flow_parse_item_basic (pattern, &info, + pst->error); +if (rc !=0 ) +return rc; + } + last_pattern = pattern; + pattern++; + pattern =otx2_flow_skip_void_and_any_items (pattern); + } + +switch (nr_vlans) { +case 1 : + lt =NPC_LT_LB_CTAG ; +break ; +case 2 : + lt =NPC_LT_LB_STAG ; + lflags =NPC_F_STAG_CTAG ; +break ; +case 3 : + lt =NPC_LT_LB_STAG ; + lflags =NPC_F_STAG_STAG_CTAG ; +break ; +default : +rte_flow_error_set (pst->error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , + last_pattern, +"more than 3 vlans not supported" ); +return -rte_errno; + } + }else if (pst->pattern->type ==RTE_FLOW_ITEM_TYPE_E_TAG ) { +/* we can support ETAG and match a subsequent CTAG +* without any matching support. +*/ + lt =NPC_LT_LB_ETAG ; + lflags =0 ; + + last_pattern = pst->pattern; + pattern =otx2_flow_skip_void_and_any_items (pst->pattern +1 ); +if (pattern->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + info.def_mask = &rte_flow_item_vlan_mask; +/* set supported mask to NULL for vlan tag */ + info.hw_mask =NULL ; + info.len =sizeof (struct rte_flow_item_vlan ); + rc =otx2_flow_parse_item_basic (pattern, &info, + pst->error); +if (rc !=0 ) +return rc; + + lflags =NPC_F_ETAG_CTAG ; + last_pattern = pattern; + } + + info.def_mask = &rte_flow_item_e_tag_mask; + info.len =sizeof (struct rte_flow_item_e_tag ); + }else { +return 0 ; + } + + info.hw_mask = &hw_mask; + info.spec =NULL ; + info.mask =NULL ; +otx2_flow_get_hw_supp_mask (pst, &info, lid, lt); + + rc =otx2_flow_parse_item_basic (pst->pattern, &info, pst->error); +if (rc !=0 ) +return rc; + +/* Point pattern to last item consumed */ + pst->pattern = last_pattern; +return otx2_flow_update_parse_state (pst, &info, lid, lt, lflags); +} + +int +otx2_flow_parse_la (struct otx2_parse_state *pst) +{ +struct rte_flow_item_eth hw_mask; +struct otx2_flow_item_info info; +int lid, lt; +int rc; + +/* Identify the pattern type into lid, lt */ +if (pst->pattern->type !=RTE_FLOW_ITEM_TYPE_ETH ) +return 0 ; + + lid =NPC_LID_LA ; + lt =NPC_LT_LA_ETHER ; + info.hw_hdr_len =0 ; + +if (pst->flow->nix_intf ==NIX_INTF_TX ) { + lt =NPC_LT_LA_IH_NIX_ETHER ; + info.hw_hdr_len =NPC_IH_LENGTH ; + } + +/* Prepare for parsing the item */ + info.def_mask = &rte_flow_item_eth_mask; + info.hw_mask = &hw_mask; + info.len =sizeof (struct rte_flow_item_eth ); +otx2_flow_get_hw_supp_mask (pst, &info, lid, lt); + info.spec =NULL ; + info.mask =NULL ; + +/* Basic validation of item parameters */ + rc =otx2_flow_parse_item_basic (pst->pattern, &info, pst->error); +if (rc) +return rc; + +/* Update pst if not validate only? clash check? */ +return otx2_flow_update_parse_state (pst, &info, lid, lt,0 ); +}
Signature · 1 line
2.21.0
PATCH v3 38/58 net/octeontx2: add flow parse actions support
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding support to parse flow actions like drop, count, mark, rss, queue. On egress side, only drop and count actions were supported.
--- drivers/net/octeontx2/otx2_flow_parse.c | 276 ++++++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 1 + 2 files changed, 277 insertions(+)
drivers/net/octeontx2/otx2_flow_parse.c +276 -0
@@ -679,3 +679,279 @@ otx2_flow_parse_la(struct otx2_parse_state *pst)/* Update pst if not validate only? clash check? */ return otx2_flow_update_parse_state (pst, &info, lid, lt,0 ); } + +static int +parse_rss_action (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_action *act, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct otx2_rss_info *rss_info = &hw->rss_info; +const struct rte_flow_action_rss *rss; +uint32_t i; + + rss = (const struct rte_flow_action_rss *)act->conf; + +/* Not supported */ +if (attr->egress) { +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ATTR_EGRESS , + attr,"No support of RSS in egress" ); + } + +if (dev->data->dev_conf.rxmode.mq_mode !=ETH_MQ_RX_RSS ) +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ACTION , + act,"multi-queue mode is disabled" ); + +/* Parse RSS related parameters from configuration */ +if (!rss || !rss->queue_num) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , + act,"no valid queues" ); + +if (rss->func !=RTE_ETH_HASH_FUNCTION_DEFAULT ) +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"non-default RSS hash functions" +" are not supported" ); + +if (rss->key_len && rss->key_len >RTE_DIM (rss_info->key)) +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"RSS hash key too large" ); + +if (rss->queue_num > rss_info->rss_size) +return rte_flow_error_set + (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION , act, +"too many queues for RSS context" ); + +for (i =0 ; i < rss->queue_num; i++) { +if (rss->queue[i] >= dev->data->nb_rx_queues) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , + act, +"queue id > max number" +" of queues" ); + } + +return 0 ; +} + +int +otx2_flow_parse_actions (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_action actions[], +struct rte_flow_error *error, +struct rte_flow *flow) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct otx2_npc_flow_info *npc = &hw->npc_flow; +const struct rte_flow_action_count *act_count; +const struct rte_flow_action_mark *act_mark; +const struct rte_flow_action_queue *act_q; +const char *errmsg =NULL ; +int sel_act, req_act =0 ; +uint16_t pf_func; +int errcode =0 ; +int mark =0 ; +int rq =0 ; + +/* Initialize actions */ + flow->ctr_id =NPC_COUNTER_NONE ; + +for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) { +otx2_npc_dbg ("Action type = %d" , actions->type); + +switch (actions->type) { +case RTE_FLOW_ACTION_TYPE_VOID : +break ; +case RTE_FLOW_ACTION_TYPE_MARK : + act_mark = + (const struct rte_flow_action_mark *)actions->conf; + +/* We have only 16 bits. Use highest val for flag */ +if (act_mark->id > (OTX2_FLOW_FLAG_VAL -2 )) { + errmsg ="mark value must be < 0xfffe" ; + errcode =ENOTSUP ; + goto err_exit; + } + mark = act_mark->id +1 ; + req_act |=OTX2_FLOW_ACT_MARK ; +rte_atomic32_inc (&npc->mark_actions); +break ; + +case RTE_FLOW_ACTION_TYPE_FLAG : + mark =OTX2_FLOW_FLAG_VAL ; + req_act |=OTX2_FLOW_ACT_FLAG ; +rte_atomic32_inc (&npc->mark_actions); +break ; + +case RTE_FLOW_ACTION_TYPE_COUNT : + act_count = + (const struct rte_flow_action_count *) + actions->conf; + +if (act_count->shared ==1 ) { + errmsg ="Shared Counters not supported" ; + errcode =ENOTSUP ; + goto err_exit; + } +/* Indicates, need a counter */ + flow->ctr_id =1 ; + req_act |=OTX2_FLOW_ACT_COUNT ; +break ; + +case RTE_FLOW_ACTION_TYPE_DROP : + req_act |=OTX2_FLOW_ACT_DROP ; +break ; + +case RTE_FLOW_ACTION_TYPE_QUEUE : +/* Applicable only to ingress flow */ + act_q = (const struct rte_flow_action_queue *) + actions->conf; + rq = act_q->index; +if (rq >= dev->data->nb_rx_queues) { + errmsg ="invalid queue index" ; + errcode =EINVAL ; + goto err_exit; + } + req_act |=OTX2_FLOW_ACT_QUEUE ; +break ; + +case RTE_FLOW_ACTION_TYPE_RSS : + errcode =parse_rss_action (dev, attr, actions, error); +if (errcode) +return -rte_errno; + + req_act |=OTX2_FLOW_ACT_RSS ; +break ; + +case RTE_FLOW_ACTION_TYPE_SECURITY : +/* Assumes user has already configured security +* session for this flow. Associated conf is +* opaque. When RTE security is implemented for otx2, +* we need to verify that for specified security +* session: +* action_type == +* RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL && +* session_protocol == +* RTE_SECURITY_PROTOCOL_IPSEC +* +* RSS is not supported with inline ipsec. Get the +* rq from associated conf, or make +* RTE_FLOW_ACTION_TYPE_QUEUE compulsory with this +* action. +* Currently, rq = 0 is assumed. +*/ + req_act |=OTX2_FLOW_ACT_SEC ; + rq =0 ; +break ; +default : + errmsg ="Unsupported action specified" ; + errcode =ENOTSUP ; + goto err_exit; + } + } + +/* Check if actions specified are compatible */ +if (attr->egress) { +/* Only DROP/COUNT is supported */ +if (!(req_act &OTX2_FLOW_ACT_DROP )) { + errmsg ="DROP is required action for egress" ; + errcode =EINVAL ; + goto err_exit; + }else if (req_act & ~(OTX2_FLOW_ACT_DROP | +OTX2_FLOW_ACT_COUNT )) { + errmsg ="Unsupported action specified" ; + errcode =ENOTSUP ; + goto err_exit; + } + flow->npc_action =NIX_TX_ACTIONOP_DROP ; + goto set_pf_func; + } + +/* We have already verified the attr, this is ingress. +* - Exactly one terminating action is supported +* - Exactly one of MARK or FLAG is supported +* - If terminating action is DROP, only count is valid. +*/ + sel_act = req_act &OTX2_FLOW_ACT_TERM ; +if ((sel_act & (sel_act -1 )) !=0 ) { + errmsg ="Only one terminating action supported" ; + errcode =EINVAL ; + goto err_exit; + } + +if (req_act &OTX2_FLOW_ACT_DROP ) { + sel_act = req_act & ~OTX2_FLOW_ACT_COUNT ; +if ((sel_act & (sel_act -1 )) !=0 ) { + errmsg ="Only COUNT action is supported " +"with DROP ingress action" ; + errcode =ENOTSUP ; + goto err_exit; + } + } + +if ((req_act & (OTX2_FLOW_ACT_FLAG |OTX2_FLOW_ACT_MARK )) + == (OTX2_FLOW_ACT_FLAG |OTX2_FLOW_ACT_MARK )) { + errmsg ="Only one of FLAG or MARK action is supported" ; + errcode =ENOTSUP ; + goto err_exit; + } + +/* Set NIX_RX_ACTIONOP */ +if (req_act &OTX2_FLOW_ACT_DROP ) { + flow->npc_action =NIX_RX_ACTIONOP_DROP ; + }else if (req_act &OTX2_FLOW_ACT_QUEUE ) { + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + flow->npc_action |= (uint64_t )rq <<20 ; + }else if (req_act &OTX2_FLOW_ACT_RSS ) { +/* When user added a rule for rss, first we will add the +*rule in MCAM and then update the action, once if we have +*FLOW_KEY_ALG index. So, till we update the action with +*flow_key_alg index, set the action to drop. +*/ +if (dev->data->dev_conf.rxmode.mq_mode ==ETH_MQ_RX_RSS ) + flow->npc_action =NIX_RX_ACTIONOP_DROP ; +else + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + }else if (req_act &OTX2_FLOW_ACT_SEC ) { + flow->npc_action =NIX_RX_ACTIONOP_UCAST_IPSEC ; + flow->npc_action |= (uint64_t )rq <<20 ; + }else if (req_act & (OTX2_FLOW_ACT_FLAG |OTX2_FLOW_ACT_MARK )) { + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + }else if (req_act &OTX2_FLOW_ACT_COUNT ) { +/* Keep OTX2_FLOW_ACT_COUNT always at the end +* This is default action, when user specify only +* COUNT ACTION +*/ + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + }else { +/* Should never reach here */ + errmsg ="Invalid action specified" ; + errcode =EINVAL ; + goto err_exit; + } + +if (mark) + flow->npc_action |= (uint64_t )mark <<40 ; + +if (rte_atomic32_read (&npc->mark_actions) ==1 ) + hw->rx_offload_flags |= +NIX_RX_OFFLOAD_MARK_UPDATE_F ; + +set_pf_func: +/* Ideally AF must ensure that correct pf_func is set */ + pf_func =otx2_pfvf_func (hw->pf, hw->vf); + flow->npc_action |= (uint64_t )pf_func <<4 ; + +return 0 ; + +err_exit: +rte_flow_error_set (error, errcode, +RTE_FLOW_ERROR_TYPE_ACTION_NUM ,NULL , + errmsg); +return -rte_errno; +}
drivers/net/octeontx2/otx2_rx.h +1 -0
@@ -13,6 +13,7 @@ sizeof(uint16_t))#define NIX_RX_OFFLOAD_PTYPE_F BIT(1) +#define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(4)#define NIX_RX_OFFLOAD_TSTAMP_F BIT(5)#define NIX_TIMESYNC_RX_OFFSET 8
Signature · 1 line
2.21.0
PATCH v3 39/58 net/octeontx2: add flow operations
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding the initial flow ops like flow_create and flow_validate. These will be used to alloc and write flow rule to device and validate the flow rule.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_flow.c | 451 ++++++++++++++++++++++++++++++ 3 files changed, 453 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_flow.c
drivers/net/octeontx2/Makefile +1 -0
@@ -35,6 +35,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_rss.c \ otx2_mac.c \ otx2_ptp.c \ + otx2_flow.c \ otx2_link.c \ otx2_stats.c \ otx2_lookup.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -7,6 +7,7 @@ sources = files( 'otx2_rss.c', 'otx2_mac.c', 'otx2_ptp.c', + 'otx2_flow.c', 'otx2_link.c', 'otx2_stats.c', 'otx2_lookup.c',
drivers/net/octeontx2/otx2_flow.c new file +451 -0
451 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 40/58 net/octeontx2: add flow destroy ops support
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding few more flow operations like flow_destroy, flow_isolate and flow_flush.
--- drivers/net/octeontx2/otx2_flow.c | 206 ++++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 3 + 2 files changed, 209 insertions(+)
drivers/net/octeontx2/otx2_flow.c +206 -0
@@ -5,6 +5,48 @@#include "otx2_ethdev.h" #include "otx2_flow.h" +int +otx2_flow_free_all_resources (struct otx2_eth_dev *hw) +{ +struct otx2_npc_flow_info *npc = &hw->npc_flow; +struct otx2_mbox *mbox = hw->mbox; +struct otx2_mcam_ents_info *info; +struct rte_bitmap *bmap; +struct rte_flow *flow; +int entry_count =0 ; +int rc, idx; + +for (idx =0 ; idx < npc->flow_max_priority; idx++) { + info = &npc->flow_entry_info[idx]; + entry_count += info->live_ent; + } + +if (entry_count ==0 ) +return 0 ; + +/* Free all MCAM entries allocated */ + rc =otx2_flow_mcam_free_all_entries (mbox); + +/* Free any MCAM counters and delete flow list */ +for (idx =0 ; idx < npc->flow_max_priority; idx++) { +while ((flow =TAILQ_FIRST (&npc->flow_list[idx])) !=NULL ) { +if (flow->ctr_id !=NPC_COUNTER_NONE ) + rc |=otx2_flow_mcam_free_counter (mbox, + flow->ctr_id); + +TAILQ_REMOVE (&npc->flow_list[idx], flow, next); +rte_free (flow); + bmap = npc->live_entries[flow->priority]; +rte_bitmap_clear (bmap, flow->mcam_id); + } + info = &npc->flow_entry_info[idx]; + info->free_ent =0 ; + info->live_ent =0 ; + } +return rc; +} + +static int flow_program_npc (struct otx2_parse_state *pst,struct otx2_mbox *mbox,struct otx2_npc_flow_info *flow_info)
@@ -237,6 +279,27 @@ flow_program_rss_action(struct rte_eth_dev *eth_dev,return 0 ; } +static int +flow_free_rss_action (struct rte_eth_dev *eth_dev, +struct rte_flow *flow) +{ +struct otx2_eth_dev *dev = eth_dev->data->dev_private; +struct otx2_npc_flow_info *npc = &dev->npc_flow; +uint32_t rss_grp; + +if (flow->npc_action &NIX_RX_ACTIONOP_RSS ) { + rss_grp = (flow->npc_action >>NIX_RSS_ACT_GRP_OFFSET ) & +NIX_RSS_ACT_GRP_MASK ; +if (rss_grp ==0 || rss_grp >= npc->rss_grps) +return -EINVAL ; + +rte_bitmap_clear (npc->rss_grp_entries, rss_grp); + } + +return 0 ; +} + +static int flow_parse_meta_items(__rte_unused struct otx2_parse_state *pst) {
@@ -445,7 +508,150 @@ otx2_flow_create(struct rte_eth_dev *dev,return NULL ; } +static int +otx2_flow_destroy (struct rte_eth_dev *dev, +struct rte_flow *flow, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct otx2_npc_flow_info *npc = &hw->npc_flow; +struct otx2_mbox *mbox = hw->mbox; +struct rte_bitmap *bmap; +uint16_t match_id; +int rc; + + match_id = (flow->npc_action >>NIX_RX_ACT_MATCH_OFFSET ) & +NIX_RX_ACT_MATCH_MASK ; + +if (match_id && match_id <OTX2_FLOW_ACTION_FLAG_DEFAULT ) { +if (rte_atomic32_read (&npc->mark_actions) ==0 ) +return -EINVAL ; + +/* Clear mark offload flag if there are no more mark actions */ +if (rte_atomic32_sub_return (&npc->mark_actions,1 ) ==0 ) + hw->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F ; + } + + rc =flow_free_rss_action (dev, flow); +if (rc !=0 ) { +rte_flow_error_set (error,EIO , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Failed to free rss action" ); + } + + rc =otx2_flow_mcam_free_entry (mbox, flow->mcam_id); +if (rc !=0 ) { +rte_flow_error_set (error,EIO , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Failed to destroy filter" ); + } + +TAILQ_REMOVE (&npc->flow_list[flow->priority], flow, next); + + bmap = npc->live_entries[flow->priority]; +rte_bitmap_clear (bmap, flow->mcam_id); + +rte_free (flow); +return 0 ; +} + +static int +otx2_flow_flush (struct rte_eth_dev *dev, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +int rc; + + rc =otx2_flow_free_all_resources (hw); +if (rc) { +otx2_err ("Error when deleting NPC MCAM entries " +", counters" ); +rte_flow_error_set (error,EIO , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Failed to flush filter" ); +return -rte_errno; + } + +return 0 ; +} + +static int +otx2_flow_isolate(struct rte_eth_dev *dev __rte_unused, + int enable __rte_unused, +struct rte_flow_error *error) +{ +/* +* If we support, we need to un-install the default mcam +* entry for this port. +*/ + +rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Flow isolation not supported" ); + +return -rte_errno; +} + +static int +otx2_flow_query (struct rte_eth_dev *dev, +struct rte_flow *flow, +const struct rte_flow_action *action, +void *data, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct rte_flow_query_count *query = data; +struct otx2_mbox *mbox = hw->mbox; +const char *errmsg =NULL ; +int errcode =ENOTSUP ; +int rc; + +if (action->type !=RTE_FLOW_ACTION_TYPE_COUNT ) { + errmsg ="Only COUNT is supported in query" ; + goto err_exit; + } + +if (flow->ctr_id ==NPC_COUNTER_NONE ) { + errmsg ="Counter is not available" ; + goto err_exit; + } + + rc =otx2_flow_mcam_read_counter (mbox, flow->ctr_id, &query->hits); +if (rc !=0 ) { + errcode =EIO ; + errmsg ="Error reading flow counter" ; + goto err_exit; + } + query->hits_set =1 ; + query->bytes_set =0 ; + +if (query->reset) + rc =otx2_flow_mcam_clear_counter (mbox, flow->ctr_id); +if (rc !=0 ) { + errcode =EIO ; + errmsg ="Error clearing flow counter" ; + goto err_exit; + } + +return 0 ; + +err_exit: +rte_flow_error_set (error, errcode, +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , + errmsg); +return -rte_errno; +} +const struct rte_flow_ops otx2_flow_ops = { .validate = otx2_flow_validate, .create = otx2_flow_create, + .destroy = otx2_flow_destroy, + .flush = otx2_flow_flush, + .query = otx2_flow_query, + .isolate = otx2_flow_isolate, };
drivers/net/octeontx2/otx2_rx.h +3 -0
@@ -5,6 +5,9 @@#ifndef __OTX2_RX_H__#define __OTX2_RX_H__ +/* Default mark value used when none is provided. */ +#define OTX2_FLOW_ACTION_FLAG_DEFAULT 0xffff +#define PTYPE_WIDTH 12#define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH)#define PTYPE_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH)
Signature · 1 line
2.21.0
PATCH v3 41/58 net/octeontx2: add flow init and fini
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding the flow init and fini functionality. These will be called from dev init and will initialize and de-initialize the flow related memory.
--- drivers/net/octeontx2/otx2_flow.c | 315 ++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+)
drivers/net/octeontx2/otx2_flow.c +315 -0
@@ -655,3 +655,318 @@ const struct rte_flow_ops otx2_flow_ops = { .query = otx2_flow_query, .isolate = otx2_flow_isolate, }; + +static int +flow_supp_key_len (uint32_t supp_mask) +{ +int nib_count =0 ; +while (supp_mask) { + nib_count++; + supp_mask &= (supp_mask -1 ); + } +return nib_count *4 ; +} + +/* Refer HRM register: +* NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG +* and +* NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG +**/ +#define BYTESM1_SHIFT 16 +#define HDR_OFF_SHIFT 8 +static void +flow_update_kex_info (struct npc_xtract_info *xtract_info, +uint64_t val) +{ + xtract_info->len = ((val >>BYTESM1_SHIFT ) &0xf ) +1 ; + xtract_info->hdr_off = (val >>HDR_OFF_SHIFT ) &0xff ; + xtract_info->key_off = val &0x3f ; + xtract_info->enable = ((val >>7 ) &0x1 ); +} + +static void +flow_process_mkex_cfg (struct otx2_npc_flow_info *npc, +struct npc_get_kex_cfg_rsp *kex_rsp) +{ +volatile uint64_t (*q)[NPC_MAX_INTF ][NPC_MAX_LID ][NPC_MAX_LT ] + [NPC_MAX_LD ]; +struct npc_xtract_info *x_info =NULL ; +int lid, lt, ld, fl, ix; +otx2_dxcfg_t *p; +uint64_t keyw; +uint64_t val; + + npc->keyx_supp_nmask[NPC_MCAM_RX ] = + kex_rsp->rx_keyx_cfg &0x7fffffffULL ; + npc->keyx_supp_nmask[NPC_MCAM_TX ] = + kex_rsp->tx_keyx_cfg &0x7fffffffULL ; + npc->keyx_len[NPC_MCAM_RX ] = +flow_supp_key_len (npc->keyx_supp_nmask[NPC_MCAM_RX ]); + npc->keyx_len[NPC_MCAM_TX ] = +flow_supp_key_len (npc->keyx_supp_nmask[NPC_MCAM_TX ]); + + keyw = (kex_rsp->rx_keyx_cfg >>32 ) &0x7ULL ; + npc->keyw[NPC_MCAM_RX ] = keyw; + keyw = (kex_rsp->tx_keyx_cfg >>32 ) &0x7ULL ; + npc->keyw[NPC_MCAM_TX ] = keyw; + +/* Update KEX_LD_FLAG */ +for (ix =0 ; ix <NPC_MAX_INTF ; ix++) { +for (ld =0 ; ld <NPC_MAX_LD ; ld++) { +for (fl =0 ; fl <NPC_MAX_LFL ; fl++) { + x_info = + &npc->prx_fxcfg[ix][ld][fl].xtract[0 ]; + val = kex_rsp->intf_ld_flags[ix][ld][fl]; +flow_update_kex_info (x_info, val); + } + } + } + +/* Update LID, LT and LDATA cfg */ + p = &npc->prx_dxcfg; + q = (volatile uint64_t (*)[][NPC_MAX_LID ][NPC_MAX_LT ][NPC_MAX_LD ]) + (&kex_rsp->intf_lid_lt_ld); +for (ix =0 ; ix <NPC_MAX_INTF ; ix++) { +for (lid =0 ; lid <NPC_MAX_LID ; lid++) { +for (lt =0 ; lt <NPC_MAX_LT ; lt++) { +for (ld =0 ; ld <NPC_MAX_LD ; ld++) { + x_info = &(*p)[ix][lid][lt].xtract[ld]; + val = (*q)[ix][lid][lt][ld]; +flow_update_kex_info (x_info, val); + } + } + } + } +/* Update LDATA Flags cfg */ + npc->prx_lfcfg[0 ].i = kex_rsp->kex_ld_flags[0 ]; + npc->prx_lfcfg[1 ].i = kex_rsp->kex_ld_flags[1 ]; +} + +static struct otx2_idev_kex_cfg * +flow_intra_dev_kex_cfg (void ) +{ +static const char name[] ="octeontx2_intra_device_kex_conf" ; +struct otx2_idev_kex_cfg *idev; +const struct rte_memzone *mz; + + mz =rte_memzone_lookup (name); +if (mz) +return mz->addr; + +/* Request for the first time */ + mz =rte_memzone_reserve_aligned (name,sizeof (struct otx2_idev_kex_cfg ), +SOCKET_ID_ANY ,0 ,OTX2_ALIGN ); +if (mz) { + idev = mz->addr; +rte_atomic16_set (&idev->kex_refcnt,0 ); +return idev; + } +return NULL ; +} + +static int +flow_fetch_kex_cfg (struct otx2_eth_dev *dev) +{ +struct otx2_npc_flow_info *npc = &dev->npc_flow; +struct npc_get_kex_cfg_rsp *kex_rsp; +struct otx2_mbox *mbox = dev->mbox; +struct otx2_idev_kex_cfg *idev; +int rc =0 ; + + idev =flow_intra_dev_kex_cfg (); +if (!idev) +return -ENOMEM ; + +/* Is kex_cfg read by any another driver? */ +if (rte_atomic16_add_return (&idev->kex_refcnt,1 ) ==1 ) { +/* Call mailbox to get key & data size */ + (void )otx2_mbox_alloc_msg_npc_get_kex_cfg (mbox); +otx2_mbox_msg_send (mbox,0 ); + rc =otx2_mbox_get_rsp (mbox,0 , (void *)&kex_rsp); +if (rc) { +otx2_err ("Failed to fetch NPC keyx config" ); + goto done; + } +memcpy (&idev->kex_cfg, kex_rsp, +sizeof (struct npc_get_kex_cfg_rsp )); + } + +flow_process_mkex_cfg (npc, &idev->kex_cfg); + +done: +return rc; +} + +int +otx2_flow_init (struct otx2_eth_dev *hw) +{ +uint8_t *mem =NULL , *nix_mem =NULL , *npc_mem =NULL ; +struct otx2_npc_flow_info *npc = &hw->npc_flow; +uint32_t bmap_sz; +int rc =0 , idx; + + rc =flow_fetch_kex_cfg (hw); +if (rc) { +otx2_err ("Failed to fetch NPC keyx config from idev" ); +return rc; + } + +rte_atomic32_init (&npc->mark_actions); + + npc->mcam_entries =NPC_MCAM_TOT_ENTRIES >> npc->keyw[NPC_MCAM_RX ]; +/* Free, free_rev, live and live_rev entries */ + bmap_sz =rte_bitmap_get_memory_footprint (npc->mcam_entries); + mem =rte_zmalloc (NULL ,4 * bmap_sz * npc->flow_max_priority, +RTE_CACHE_LINE_SIZE ); +if (mem ==NULL ) { +otx2_err ("Bmap alloc failed" ); + rc = -ENOMEM ; +return rc; + } + + npc->flow_entry_info =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct otx2_mcam_ents_info ), +0 ); +if (npc->flow_entry_info ==NULL ) { +otx2_err ("flow_entry_info alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->free_entries =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->free_entries ==NULL ) { +otx2_err ("free_entries alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->free_entries_rev =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->free_entries_rev ==NULL ) { +otx2_err ("free_entries_rev alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->live_entries =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->live_entries ==NULL ) { +otx2_err ("live_entries alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->live_entries_rev =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->live_entries_rev ==NULL ) { +otx2_err ("live_entries_rev alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->flow_list =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct otx2_flow_list ), +0 ); +if (npc->flow_list ==NULL ) { +otx2_err ("flow_list alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc_mem = mem; +for (idx =0 ; idx < npc->flow_max_priority; idx++) { +TAILQ_INIT (&npc->flow_list[idx]); + + npc->free_entries[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->free_entries_rev[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->live_entries[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->live_entries_rev[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->flow_entry_info[idx].free_ent =0 ; + npc->flow_entry_info[idx].live_ent =0 ; + npc->flow_entry_info[idx].max_id =0 ; + npc->flow_entry_info[idx].min_id = ~(0 ); + } + + npc->rss_grps =NIX_RSS_GRPS ; + + bmap_sz =rte_bitmap_get_memory_footprint (npc->rss_grps); + nix_mem =rte_zmalloc (NULL , bmap_sz,RTE_CACHE_LINE_SIZE ); +if (nix_mem ==NULL ) { +otx2_err ("Bmap alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->rss_grp_entries =rte_bitmap_init (npc->rss_grps, nix_mem, bmap_sz); + +/* Group 0 will be used for RSS, +* 1 -7 will be used for rte_flow RSS action +*/ +rte_bitmap_set (npc->rss_grp_entries,0 ); + +return 0 ; + +err: +if (npc->flow_list) +rte_free (npc->flow_list); +if (npc->live_entries_rev) +rte_free (npc->live_entries_rev); +if (npc->live_entries) +rte_free (npc->live_entries); +if (npc->free_entries_rev) +rte_free (npc->free_entries_rev); +if (npc->free_entries) +rte_free (npc->free_entries); +if (npc->flow_entry_info) +rte_free (npc->flow_entry_info); +if (npc_mem) +rte_free (npc_mem); +if (nix_mem) +rte_free (nix_mem); +return rc; +} + +int +otx2_flow_fini (struct otx2_eth_dev *hw) +{ +struct otx2_npc_flow_info *npc = &hw->npc_flow; +int rc; + + rc =otx2_flow_free_all_resources (hw); +if (rc) { +otx2_err ("Error when deleting NPC MCAM entries, counters" ); +return rc; + } + +if (npc->flow_list) +rte_free (npc->flow_list); +if (npc->live_entries_rev) +rte_free (npc->live_entries_rev); +if (npc->live_entries) +rte_free (npc->live_entries); +if (npc->free_entries_rev) +rte_free (npc->free_entries_rev); +if (npc->free_entries) +rte_free (npc->free_entries); +if (npc->flow_entry_info) +rte_free (npc->flow_entry_info); + +return 0 ; +}
Signature · 1 line
2.21.0
PATCH v3 42/58 net/octeontx2: connect flow API to ethdev ops
In reply to [email protected]From: Vivek Sharma <[email protected]>
Connect rte_flow driver ops to ethdev via .filter_ctrl op.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + doc/guides/nics/octeontx2.rst | 97 ++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.c | 9 ++ drivers/net/octeontx2/otx2_ethdev.h | 3 + drivers/net/octeontx2/otx2_ethdev_ops.c | 21 +++++ 7 files changed, 133 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -22,6 +22,7 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Flow control = Y +Flow API = Y Packet type parsing = Y Timesync = Y Timestamp offload = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -22,6 +22,7 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Flow control = Y +Flow API = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -17,6 +17,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Flow API = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/octeontx2.rst +97 -0
106 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev.c +9 -0
@@ -1345,6 +1345,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .rx_descriptor_status = otx2_nix_rx_descriptor_status, .tx_done_cleanup = otx2_nix_tx_done_cleanup, .pool_ops_supported = otx2_nix_pool_ops_supported, + .filter_ctrl = otx2_nix_dev_filter_ctrl, .get_module_info = otx2_nix_get_module_info, .get_module_eeprom = otx2_nix_get_module_eeprom, .flow_ctrl_get = otx2_nix_flow_ctrl_get,
@@ -1524,6 +1525,11 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) dev->hwcap |=OTX2_FIXUP_F_LIMIT_CQ_FULL ; } +/* Initialize rte-flow */ + rc =otx2_flow_init (dev); +if (rc) + goto free_mac_addrs; + otx2_nix_dbg("Port=%d pf=%d vf=%d ver=%s msix_off=%d hwcap=0x%" PRIx64 " rxoffload_capa=0x%" PRIx64 " txoffload_capa=0x%" PRIx64, eth_dev->data->port_id, dev->pf, dev->vf,
@@ -1560,6 +1566,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +/* Disable other rte_flow entries */ +otx2_flow_fini (dev); +/* Disable PTP if already enabled */ if (otx2_ethdev_is_ptp_en (dev))otx2_nix_timesync_disable (eth_dev);
drivers/net/octeontx2/otx2_ethdev.h +3 -0
@@ -294,6 +294,9 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)/* Ops */ void otx2_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *dev_info); +int otx2_nix_dev_filter_ctrl (struct rte_eth_dev *eth_dev, +enum rte_filter_type filter_type, +enum rte_filter_op filter_op,void *arg);int otx2_nix_get_module_info (struct rte_eth_dev *eth_dev,struct rte_eth_dev_module_info *modinfo); int otx2_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
drivers/net/octeontx2/otx2_ethdev_ops.c +21 -0
@@ -220,6 +220,27 @@ otx2_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)return -ENOTSUP ; } +int +otx2_nix_dev_filter_ctrl (struct rte_eth_dev *eth_dev, +enum rte_filter_type filter_type, +enum rte_filter_op filter_op,void *arg) +{ +RTE_SET_USED (eth_dev); + +if (filter_type !=RTE_ETH_FILTER_GENERIC ) { +otx2_err ("Unsupported filter type %d" , filter_type); +return -ENOTSUP ; + } + +if (filter_op ==RTE_ETH_FILTER_GET ) { + *(const void **)arg = &otx2_flow_ops; +return 0 ; + } + +otx2_err ("Invalid filter_op %d" , filter_op); +return -EINVAL ; +} +static struct cgx_fw_data *nix_get_fwdata (struct otx2_eth_dev *dev) {
Signature · 1 line
2.21.0
PATCH v3 43/58 net/octeontx2: implement VLAN utility functions
In reply to [email protected]From: Vivek Sharma <[email protected]>
Implement accessory functions needed for VLAN functionality. Introduce VLAN related structures as well.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 10 ++ drivers/net/octeontx2/otx2_ethdev.h | 46 +++++++ drivers/net/octeontx2/otx2_vlan.c | 190 ++++++++++++++++++++++++++++ 5 files changed, 248 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_vlan.c
drivers/net/octeontx2/Makefile +1 -0
@@ -37,6 +37,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_ptp.c \ otx2_flow.c \ otx2_link.c \ + otx2_vlan.c \ otx2_stats.c \ otx2_lookup.c \ otx2_ethdev.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -9,6 +9,7 @@ sources = files( 'otx2_ptp.c', 'otx2_flow.c', 'otx2_link.c', + 'otx2_vlan.c', 'otx2_stats.c', 'otx2_lookup.c', 'otx2_ethdev.c',
drivers/net/octeontx2/otx2_ethdev.c +10 -0
@@ -1102,6 +1102,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)/* Free the resources allocated from the previous configure */ if (dev->configured ==1 ) {otx2_nix_rxchan_bpid_cfg (eth_dev, false); +otx2_nix_vlan_fini (eth_dev);oxt2_nix_unregister_queue_irqs (eth_dev);nix_set_nop_rxtx_function (eth_dev); rc =nix_store_queue_cfg_and_then_release (eth_dev);
@@ -1148,6 +1149,12 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } + rc =otx2_nix_vlan_offload_init (eth_dev); +if (rc) { +otx2_err ("Failed to init vlan offload rc=%d" , rc); + goto free_nix_lf; + } +/* Register queue IRQs */ rc =oxt2_nix_register_queue_irqs (eth_dev);if (rc) {
@@ -1566,6 +1573,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +/* Disable vlan offloads */ +otx2_nix_vlan_fini (eth_dev); +/* Disable other rte_flow entries */ otx2_flow_fini (dev);
drivers/net/octeontx2/otx2_ethdev.h +46 -0
64 lines not on this page · raw message
drivers/net/octeontx2/otx2_vlan.c new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 44/58 net/octeontx2: support VLAN offloads
In reply to [email protected]From: Vivek Sharma <[email protected]>
Support configuring VLAN offloads for an ethernet device and dynamic promiscuous mode configuration for VLAN filters where filters are updated according to promiscuous mode of the device.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + doc/guides/nics/features/octeontx2_vf.ini | 2 + doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/otx2_ethdev.c | 1 + drivers/net/octeontx2/otx2_ethdev.h | 3 + drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/octeontx2/otx2_rx.h | 1 + drivers/net/octeontx2/otx2_vlan.c | 523 ++++++++++++++++++++- 9 files changed, 527 insertions(+), 9 deletions(-)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -23,6 +23,8 @@ RSS reta update = Y Inner RSS = Y Flow control = Y Flow API = Y +VLAN offload = Y +QinQ offload = Y Packet type parsing = Y Timesync = Y Timestamp offload = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
@@ -23,6 +23,8 @@ RSS reta update = Y Inner RSS = Y Flow control = Y Flow API = Y +VLAN offload = Y +QinQ offload = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -18,6 +18,8 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Flow API = Y +VLAN offload = Y +QinQ offload = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/octeontx2.rst +1 -0
@@ -24,6 +24,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Receiver Side Scaling (RSS) - MAC filtering - Generic flow API +- VLAN/QinQ stripping and insertion - Port hardware statistics - Link state information - Link flow control
drivers/net/octeontx2/otx2_ethdev.c +1 -0
@@ -1364,6 +1364,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .timesync_adjust_time = otx2_nix_timesync_adjust_time, .timesync_read_time = otx2_nix_timesync_read_time, .timesync_write_time = otx2_nix_timesync_write_time, + .vlan_offload_set = otx2_nix_vlan_offload_set, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +3 -0
@@ -221,6 +221,7 @@ struct otx2_vlan_info {uint8_t filter_on;uint8_t strip_on;uint8_t qinq_on; +uint8_t promisc_on; };struct otx2_eth_dev {
@@ -447,6 +448,8 @@ int otx2_nix_update_flow_ctrl_mode(struct rte_eth_dev *eth_dev);/* VLAN */ int otx2_nix_vlan_offload_init (struct rte_eth_dev *eth_dev);int otx2_nix_vlan_fini (struct rte_eth_dev *eth_dev); +int otx2_nix_vlan_offload_set (struct rte_eth_dev *eth_dev,int mask); +void otx2_nix_vlan_update_promisc (struct rte_eth_dev *eth_dev,int enable);/* Lookup configuration */ void *otx2_nix_fastpath_lookup_mem_get (void );
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -0
@@ -40,6 +40,7 @@ otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en)otx2_mbox_process (mbox); eth_dev->data->promiscuous = en; +otx2_nix_vlan_update_promisc (eth_dev, en); }void
drivers/net/octeontx2/otx2_rx.h +1 -0
@@ -16,6 +16,7 @@ sizeof(uint16_t))#define NIX_RX_OFFLOAD_PTYPE_F BIT(1) +#define NIX_RX_OFFLOAD_VLAN_STRIP_F BIT(3)#define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(4)#define NIX_RX_OFFLOAD_TSTAMP_F BIT(5)
drivers/net/octeontx2/otx2_vlan.c +514 -9
577 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 45/58 net/octeontx2: support VLAN filters
In reply to [email protected]From: Vivek Sharma <[email protected]>
Support setting up VLAN filters so as to allow tagged packet's reception after VLAN HW Filter offload is enabled.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + doc/guides/nics/octeontx2.rst | 2 +- drivers/net/octeontx2/otx2_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev.h | 4 + drivers/net/octeontx2/otx2_vlan.c | 149 ++++++++++++++++++++- 7 files changed, 157 insertions(+), 3 deletions(-)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -21,6 +21,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +VLAN filter = Y Flow control = Y Flow API = Y VLAN offload = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -21,6 +21,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +VLAN filter = Y Flow control = Y Flow API = Y VLAN offload = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -17,6 +17,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +VLAN filter = Y Flow API = Y VLAN offload = Y QinQ offload = Y
doc/guides/nics/octeontx2.rst +1 -1
@@ -22,7 +22,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Lock-free Tx queue - Multiple queues for TX and RX - Receiver Side Scaling (RSS) -- MAC filtering +- MAC/VLAN filtering - Generic flow API - VLAN/QinQ stripping and insertion - Port hardware statistics
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -1365,6 +1365,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .timesync_read_time = otx2_nix_timesync_read_time, .timesync_write_time = otx2_nix_timesync_write_time, .vlan_offload_set = otx2_nix_vlan_offload_set, + .vlan_filter_set = otx2_nix_vlan_filter_set, + .vlan_strip_queue_set = otx2_nix_vlan_strip_queue_set, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -450,6 +450,10 @@ int otx2_nix_vlan_offload_init(struct rte_eth_dev *eth_dev);int otx2_nix_vlan_fini (struct rte_eth_dev *eth_dev);int otx2_nix_vlan_offload_set (struct rte_eth_dev *eth_dev,int mask);void otx2_nix_vlan_update_promisc (struct rte_eth_dev *eth_dev,int enable); +int otx2_nix_vlan_filter_set (struct rte_eth_dev *eth_dev,uint16_t vlan_id, +int on); +void otx2_nix_vlan_strip_queue_set (struct rte_eth_dev *dev, +uint16_t queue,int on);/* Lookup configuration */ void *otx2_nix_fastpath_lookup_mem_get (void );
drivers/net/octeontx2/otx2_vlan.c +147 -2
199 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 46/58 net/octeontx2: support VLAN TPID and PVID for Tx
In reply to [email protected]From: Vivek Sharma <[email protected]>
Implement support for setting VLAN TPID and PVID for Tx packets.
--- drivers/net/octeontx2/otx2_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev.h | 5 +- drivers/net/octeontx2/otx2_vlan.c | 193 ++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -1367,6 +1367,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .vlan_offload_set = otx2_nix_vlan_offload_set, .vlan_filter_set = otx2_nix_vlan_filter_set, .vlan_strip_queue_set = otx2_nix_vlan_strip_queue_set, + .vlan_tpid_set = otx2_nix_vlan_tpid_set, + .vlan_pvid_set = otx2_nix_vlan_pvid_set, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +4 -1
@@ -453,7 +453,10 @@ void otx2_nix_vlan_update_promisc(struct rte_eth_dev *eth_dev, int enable);int otx2_nix_vlan_filter_set (struct rte_eth_dev *eth_dev,uint16_t vlan_id,int on);void otx2_nix_vlan_strip_queue_set (struct rte_eth_dev *dev, -uint16_t queue,int on); +uint16_t queue,int on); +int otx2_nix_vlan_tpid_set (struct rte_eth_dev *eth_dev, +enum rte_vlan_type type,uint16_t tpid); +int otx2_nix_vlan_pvid_set (struct rte_eth_dev *dev,uint16_t vlan_id,int on);/* Lookup configuration */ void *otx2_nix_fastpath_lookup_mem_get (void );
drivers/net/octeontx2/otx2_vlan.c +193 -0
211 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 47/58 net/octeontx2: add FW version get operation
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add firmware version get operation.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 1 + drivers/net/octeontx2/otx2_ethdev.h | 3 +++ drivers/net/octeontx2/otx2_ethdev_ops.c | 19 +++++++++++++++++++ drivers/net/octeontx2/otx2_flow.c | 7 +++++++ 7 files changed, 33 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -33,6 +33,7 @@ Rx descriptor status = Y Basic stats = Y Stats per queue = Y Extended stats = Y +FW version = Y Module EEPROM dump = Y Registers dump = Y Linux VFIO = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -31,6 +31,7 @@ Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y Module EEPROM dump = Y Registers dump = Y Linux VFIO = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -26,6 +26,7 @@ Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y Module EEPROM dump = Y Registers dump = Y Linux VFIO = Y
drivers/net/octeontx2/otx2_ethdev.c +1 -0
@@ -1355,6 +1355,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .filter_ctrl = otx2_nix_dev_filter_ctrl, .get_module_info = otx2_nix_get_module_info, .get_module_eeprom = otx2_nix_get_module_eeprom, + .fw_version_get = otx2_nix_fw_version_get, .flow_ctrl_get = otx2_nix_flow_ctrl_get, .flow_ctrl_set = otx2_nix_flow_ctrl_set, .timesync_enable = otx2_nix_timesync_enable,
drivers/net/octeontx2/otx2_ethdev.h +3 -0
@@ -235,6 +235,7 @@ struct otx2_eth_dev {uint8_t lso_tsov4_idx;uint8_t lso_tsov6_idx;uint8_t mac_addr[RTE_ETHER_ADDR_LEN ]; +uint8_t mkex_pfl_name[MKEX_NAME_LEN ];uint8_t max_mac_entries;uint8_t lf_tx_stats;uint8_t lf_rx_stats;
@@ -340,6 +341,8 @@ void otx2_nix_info_get(struct rte_eth_dev *eth_dev,int otx2_nix_dev_filter_ctrl (struct rte_eth_dev *eth_dev,enum rte_filter_type filter_type,enum rte_filter_op filter_op,void *arg); +int otx2_nix_fw_version_get (struct rte_eth_dev *eth_dev,char *fw_version, +size_t fw_size);int otx2_nix_get_module_info (struct rte_eth_dev *eth_dev,struct rte_eth_dev_module_info *modinfo); int otx2_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
drivers/net/octeontx2/otx2_ethdev_ops.c +19 -0
@@ -210,6 +210,25 @@ otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)return 0 ; } +int +otx2_nix_fw_version_get (struct rte_eth_dev *eth_dev,char *fw_version, +size_t fw_size) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +int rc = (int )fw_size; + +if (fw_size >sizeof (dev->mkex_pfl_name)) + rc =sizeof (dev->mkex_pfl_name); + + rc =strlcpy (fw_version, (char *)dev->mkex_pfl_name, rc); + + rc +=1 ;/* Add the size of '\0' */ +if (fw_size < (uint32_t )rc) +return rc; + +return 0 ; +} +int otx2_nix_pool_ops_supported (struct rte_eth_dev *eth_dev,const char *pool) {
drivers/net/octeontx2/otx2_flow.c +7 -0
@@ -770,6 +770,7 @@ flow_fetch_kex_cfg(struct otx2_eth_dev *dev)struct otx2_npc_flow_info *npc = &dev->npc_flow;struct npc_get_kex_cfg_rsp *kex_rsp;struct otx2_mbox *mbox = dev->mbox; +char mkex_pfl_name[MKEX_NAME_LEN ];struct otx2_idev_kex_cfg *idev;int rc =0 ;
@@ -791,6 +792,12 @@ flow_fetch_kex_cfg(struct otx2_eth_dev *dev) sizeof(struct npc_get_kex_cfg_rsp)); } +otx2_mbox_memcpy (mkex_pfl_name, + idev->kex_cfg.mkex_pfl_name,MKEX_NAME_LEN ); + +strlcpy ((char *)dev->mkex_pfl_name, + mkex_pfl_name,sizeof (dev->mkex_pfl_name)); +flow_process_mkex_cfg (npc, &idev->kex_cfg); done:
Signature · 1 line
2.21.0
PATCH v3 48/58 net/octeontx2: add Rx burst support
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Rx burst support.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 2 +- drivers/net/octeontx2/otx2_ethdev.c | 6 - drivers/net/octeontx2/otx2_ethdev.h | 2 + drivers/net/octeontx2/otx2_rx.c | 129 +++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 247 ++++++++++++++++++++++++++++ 6 files changed, 380 insertions(+), 7 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_rx.c
drivers/net/octeontx2/Makefile +1 -0
@@ -31,6 +31,7 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_rx.c \ otx2_tm.c \ otx2_rss.c \ otx2_mac.c \
drivers/net/octeontx2/meson.build +1 -1
@@ -2,7 +2,7 @@ # Copyright(C) 2019 Marvell International Ltd. # -sources = files( +sources = files('otx2_rx.c', 'otx2_tm.c', 'otx2_rss.c', 'otx2_mac.c',
drivers/net/octeontx2/otx2_ethdev.c +0 -6
@@ -14,12 +14,6 @@#include "otx2_ethdev.h" -static inline void -otx2_eth_set_rx_function (struct rte_eth_dev *eth_dev) -{ -RTE_SET_USED (eth_dev); -} -static inline void otx2_eth_set_tx_function (struct rte_eth_dev *eth_dev) {
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -280,6 +280,7 @@ struct otx2_eth_dev {struct otx2_eth_qconf *tx_qconf;struct otx2_eth_qconf *rx_qconf;struct rte_eth_dev *eth_dev; +eth_rx_burst_t rx_pkt_burst_no_offload;/* PTP counters */ bool ptp_en;struct otx2_timesync_info tstamp;
@@ -482,6 +483,7 @@ int otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev);/* Rx and Tx routines */ +void otx2_eth_set_rx_function (struct rte_eth_dev *eth_dev);void otx2_nix_form_default_desc (struct otx2_eth_txq *txq);/* Timesync - PTP routines */
drivers/net/octeontx2/otx2_rx.c new file +129 -0
129 lines not on this page · raw message
drivers/net/octeontx2/otx2_rx.h +247 -0
258 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 49/58 net/octeontx2: add Rx multi segment version
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add multi segment version of packet Receive function.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 2 + doc/guides/nics/octeontx2.rst | 2 + drivers/net/octeontx2/otx2_rx.c | 25 ++++++++++ drivers/net/octeontx2/otx2_rx.h | 55 +++++++++++++++++++++- 6 files changed, 86 insertions(+), 1 deletion(-)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -24,6 +24,8 @@ Inner RSS = Y VLAN filter = Y Flow control = Y Flow API = Y +Jumbo frame = Y +Scattered Rx = Y VLAN offload = Y QinQ offload = Y Packet type parsing = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -24,6 +24,7 @@ Inner RSS = Y VLAN filter = Y Flow control = Y Flow API = Y +Jumbo frame = Y VLAN offload = Y QinQ offload = Y Packet type parsing = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -19,6 +19,8 @@ RSS reta update = Y Inner RSS = Y VLAN filter = Y Flow API = Y +Jumbo frame = Y +Scattered Rx = Y VLAN offload = Y QinQ offload = Y Packet type parsing = Y
doc/guides/nics/octeontx2.rst +2 -0
@@ -18,6 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Packet type information - Promiscuous mode +- Jumbo frames - SR-IOV VF - Lock-free Tx queue - Multiple queues for TX and RX
@@ -28,6 +29,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Port hardware statistics - Link state information - Link flow control +- Scatter-Gather IO support - Debug utilities - Context dump and error interrupt support - IEEE1588 timestamping
drivers/net/octeontx2/otx2_rx.c +25 -0
@@ -92,6 +92,14 @@ otx2_nix_recv_pkts_ ## name(void *rx_queue, \ { \return nix_recv_pkts (rx_queue, rx_pkts, pkts, (flags)); \ } \ + \ +static uint16_t __rte_noinline __hot \ +otx2_nix_recv_pkts_mseg_ ## name(void *rx_queue, \ + struct rte_mbuf **rx_pkts, uint16_t pkts) \ +{ \ + return nix_recv_pkts(rx_queue, rx_pkts, pkts, \ + (flags) | NIX_RX_MULTI_SEG_F); \ +} \NIX_RX_FASTPATH_MODES #undef R
@@ -115,15 +123,32 @@ pick_rx_func(struct rte_eth_dev *eth_dev,void 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, +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, +NIX_RX_FASTPATH_MODES #undef R };pick_rx_func (eth_dev, nix_eth_rx_burst); +if (dev->rx_offloads &DEV_RX_OFFLOAD_SCATTER ) +pick_rx_func (eth_dev, nix_eth_rx_burst_mseg); + +/* 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 ];rte_mb (); }
drivers/net/octeontx2/otx2_rx.h +54 -1
73 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 50/58 net/octeontx2: add Rx vector version
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add vector version of packet Receive function.
--- doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 2 + drivers/net/octeontx2/otx2_rx.c | 259 +++++++++++++++++++++++++++++- 4 files changed, 262 insertions(+), 1 deletion(-)
doc/guides/nics/octeontx2.rst +1 -0
@@ -30,6 +30,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Link state information - Link flow control - Scatter-Gather IO support +- Vector Poll mode driver - Debug utilities - Context dump and error interrupt support - IEEE1588 timestamping
drivers/net/octeontx2/Makefile +1 -0
@@ -14,6 +14,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 CFLAGS += -O3 +CFLAGS += -flax-vector-conversions ifneq ($(CONFIG_RTE_ARCH_64),y) CFLAGS += -Wno-int-to-pointer-cast
drivers/net/octeontx2/meson.build +2 -0
@@ -24,6 +24,8 @@ sources = files('otx2_rx.c', deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] +cflags += ['-flax-vector-conversions'] + extra_flags = [] # This integrated controller runs only on a arm64 machine, remove 32bit warnings if not dpdk_conf.get('RTE_ARCH_64')
drivers/net/octeontx2/otx2_rx.c +258 -1
277 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 51/58 net/octeontx2: add Tx burst support
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Tx burst support.
--- doc/guides/nics/features/octeontx2.ini | 5 + doc/guides/nics/features/octeontx2_vec.ini | 5 + doc/guides/nics/features/octeontx2_vf.ini | 5 + doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 6 - drivers/net/octeontx2/otx2_ethdev.h | 1 + drivers/net/octeontx2/otx2_tx.c | 94 ++++++++ drivers/net/octeontx2/otx2_tx.h | 261 +++++++++++++++++++++ 10 files changed, 374 insertions(+), 6 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_tx.c
doc/guides/nics/features/octeontx2.ini +5 -0
@@ -12,6 +12,7 @@ Link status = Y Link status event = Y Runtime Rx queue setup = Y Runtime Tx queue setup = Y +Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y Promiscuous mode = Y
@@ -28,6 +29,10 @@ Jumbo frame = Y Scattered Rx = Y VLAN offload = Y QinQ offload = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Packet type parsing = Y Timesync = Y Timestamp offload = Y
doc/guides/nics/features/octeontx2_vec.ini +5 -0
@@ -12,6 +12,7 @@ Link status = Y Link status event = Y Runtime Rx queue setup = Y Runtime Tx queue setup = Y +Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y Promiscuous mode = Y
@@ -27,6 +28,10 @@ Flow API = Y Jumbo frame = Y VLAN offload = Y QinQ offload = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/features/octeontx2_vf.ini +5 -0
@@ -11,6 +11,7 @@ Link status = Y Link status event = Y Runtime Rx queue setup = Y Runtime Tx queue setup = Y +Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y RSS hash = Y
@@ -23,6 +24,10 @@ Jumbo frame = Y Scattered Rx = Y VLAN offload = Y QinQ offload = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/octeontx2.rst +1 -0
@@ -25,6 +25,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Receiver Side Scaling (RSS) - MAC/VLAN filtering - Generic flow API +- Inner and Outer Checksum offload - VLAN/QinQ stripping and insertion - Port hardware statistics - Link state information
drivers/net/octeontx2/Makefile +1 -0
@@ -33,6 +33,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_rx.c \ + otx2_tx.c \ otx2_tm.c \ otx2_rss.c \ otx2_mac.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -3,6 +3,7 @@ # sources = files('otx2_rx.c', + 'otx2_tx.c', 'otx2_tm.c', 'otx2_rss.c', 'otx2_mac.c',
drivers/net/octeontx2/otx2_ethdev.c +0 -6
@@ -14,12 +14,6 @@#include "otx2_ethdev.h" -static inline void -otx2_eth_set_tx_function (struct rte_eth_dev *eth_dev) -{ -RTE_SET_USED (eth_dev); -} -static inline uint64_t nix_get_rx_offload_capa (struct otx2_eth_dev *dev) {
drivers/net/octeontx2/otx2_ethdev.h +1 -0
@@ -484,6 +484,7 @@ int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,/* Rx and Tx routines */ void otx2_eth_set_rx_function (struct rte_eth_dev *eth_dev); +void otx2_eth_set_tx_function (struct rte_eth_dev *eth_dev);void otx2_nix_form_default_desc (struct otx2_eth_txq *txq);/* Timesync - PTP routines */
drivers/net/octeontx2/otx2_tx.c new file +94 -0
94 lines not on this page · raw message
drivers/net/octeontx2/otx2_tx.h +261 -0
265 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 52/58 net/octeontx2: add Tx multi segment version
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add multi segment version of packet Transmit function.
--- drivers/net/octeontx2/otx2_ethdev.h | 4 ++ drivers/net/octeontx2/otx2_tx.c | 58 +++++++++++++++++++++ drivers/net/octeontx2/otx2_tx.h | 81 +++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+)
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -89,6 +89,10 @@#define NIX_TX_NB_SEG_MAX 9#endif +#define NIX_TX_MSEG_SG_DWORDS \ + ((RTE_ALIGN_MUL_CEIL(NIX_TX_NB_SEG_MAX, 3) / 3) \ + + NIX_TX_NB_SEG_MAX) +/* Apply BP when CQ is 75% full */ #define NIX_CQ_BP_LEVEL (25 * 256 / 100)
drivers/net/octeontx2/otx2_tx.c +58 -0
85 lines not on this page · raw message
drivers/net/octeontx2/otx2_tx.h +81 -0
87 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 53/58 net/octeontx2: add Tx vector version
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add vector version of packet transmit function.
--- drivers/net/octeontx2/otx2_tx.c | 883 +++++++++++++++++++++++++++++++- 1 file changed, 882 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_tx.c +882 -1
@@ -80,6 +80,859 @@ nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts,return pkts; } +#if defined(RTE_ARCH_ARM64 ) + +#define NIX_DESCS_PER_LOOP 4 +static __rte_always_inline uint16_t +nix_xmit_pkts_vector (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t pkts,const uint16_t flags) +{ +uint64x2_t dataoff_iova0, dataoff_iova1, dataoff_iova2, dataoff_iova3; +uint64x2_t len_olflags0, len_olflags1, len_olflags2, len_olflags3; +uint64_t *mbuf0, *mbuf1, *mbuf2, *mbuf3; +uint64x2_t senddesc01_w0, senddesc23_w0; +uint64x2_t senddesc01_w1, senddesc23_w1; +uint64x2_t sgdesc01_w0, sgdesc23_w0; +uint64x2_t sgdesc01_w1, sgdesc23_w1; +struct otx2_eth_txq *txq = tx_queue; +uint64_t *lmt_addr = txq->lmt_addr; +rte_iova_t io_addr = txq->io_addr; +uint64x2_t ltypes01, ltypes23; +uint64x2_t xtmp128, ytmp128; +uint64x2_t xmask01, xmask23; +uint64x2_t mbuf01, mbuf23; +uint64x2_t cmd00, cmd01; +uint64x2_t cmd10, cmd11; +uint64x2_t cmd20, cmd21; +uint64x2_t cmd30, cmd31; +uint64_t lmt_status, i; + + pkts =RTE_ALIGN_FLOOR (pkts,NIX_DESCS_PER_LOOP ); + +NIX_XMIT_FC_OR_RETURN (txq, pkts); + +/* Reduce the cached count */ + txq->fc_cache_pkts -= pkts; + +/* Lets commit any changes in the packet */ +rte_cio_wmb (); + + senddesc01_w0 =vld1q_dup_u64 (&txq->cmd[0 ]); + senddesc23_w0 = senddesc01_w0; + senddesc01_w1 =vdupq_n_u64 (0 ); + senddesc23_w1 = senddesc01_w1; + sgdesc01_w0 =vld1q_dup_u64 (&txq->cmd[2 ]); + sgdesc23_w0 = sgdesc01_w0; + +for (i =0 ; i < pkts; i +=NIX_DESCS_PER_LOOP ) { + mbuf01 =vld1q_u64 ((uint64_t *)tx_pkts); + mbuf23 =vld1q_u64 ((uint64_t *)(tx_pkts +2 )); + +/* Clear lower 32bit of SEND_HDR_W0 and SEND_SG_W0 */ + senddesc01_w0 =vbicq_u64 (senddesc01_w0, +vdupq_n_u64 (0xFFFFFFFF )); + sgdesc01_w0 =vbicq_u64 (sgdesc01_w0, +vdupq_n_u64 (0xFFFFFFFF )); + + senddesc23_w0 = senddesc01_w0; + sgdesc23_w0 = sgdesc01_w0; + + tx_pkts = tx_pkts +NIX_DESCS_PER_LOOP ; + +/* Move mbufs to iova */ + mbuf0 = (uint64_t *)vgetq_lane_u64 (mbuf01,0 ); + mbuf1 = (uint64_t *)vgetq_lane_u64 (mbuf01,1 ); + mbuf2 = (uint64_t *)vgetq_lane_u64 (mbuf23,0 ); + mbuf3 = (uint64_t *)vgetq_lane_u64 (mbuf23,1 ); + + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mbuf , buf_iova)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mbuf , buf_iova)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mbuf , buf_iova)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mbuf , buf_iova)); +/* +* Get mbuf's, olflags, iova, pktlen, dataoff +* dataoff_iovaX.D[0] = iova, +* dataoff_iovaX.D[1](15:0) = mbuf->dataoff +* len_olflagsX.D[0] = ol_flags, +* len_olflagsX.D[1](63:32) = mbuf->pkt_len +*/ + dataoff_iova0 =vld1q_u64 (mbuf0); + len_olflags0 =vld1q_u64 (mbuf0 +2 ); + dataoff_iova1 =vld1q_u64 (mbuf1); + len_olflags1 =vld1q_u64 (mbuf1 +2 ); + dataoff_iova2 =vld1q_u64 (mbuf2); + len_olflags2 =vld1q_u64 (mbuf2 +2 ); + dataoff_iova3 =vld1q_u64 (mbuf3); + len_olflags3 =vld1q_u64 (mbuf3 +2 ); + +if (flags &NIX_TX_OFFLOAD_MBUF_NOFF_F ) { +struct rte_mbuf *mbuf; +/* Set don't free bit if reference count > 1 */ + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf0 - + offsetof(struct rte_mbuf , buf_iova)); + +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask01,0 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf1 - + offsetof(struct rte_mbuf , buf_iova)); +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask01,1 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf2 - + offsetof(struct rte_mbuf , buf_iova)); +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask23,0 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf3 - + offsetof(struct rte_mbuf , buf_iova)); +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask23,1 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); + }else { +struct rte_mbuf *mbuf; +/* Mark mempool object as "put" since +* it is freed by NIX +*/ + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf0 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf1 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf2 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf3 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); +RTE_SET_USED (mbuf); + } + +/* Move mbufs to point pool */ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + +if (flags & + (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F | +NIX_TX_OFFLOAD_L3_L4_CSUM_F )) { +/* Get tx_offload for ol2, ol3, l2, l3 lengths */ +/* +* E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7) +* E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7) +*/ + + asmvolatile ("LD1 {%[a].D}[0],[%[in]]\n\t" : + [a]"+w" (senddesc01_w1) : + [in]"r" (mbuf0 +2 ) :"memory" ); + + asmvolatile ("LD1 {%[a].D}[1],[%[in]]\n\t" : + [a]"+w" (senddesc01_w1) : + [in]"r" (mbuf1 +2 ) :"memory" ); + + asmvolatile ("LD1 {%[b].D}[0],[%[in]]\n\t" : + [b]"+w" (senddesc23_w1) : + [in]"r" (mbuf2 +2 ) :"memory" ); + + asmvolatile ("LD1 {%[b].D}[1],[%[in]]\n\t" : + [b]"+w" (senddesc23_w1) : + [in]"r" (mbuf3 +2 ) :"memory" ); + +/* Get pool pointer alone */ + mbuf0 = (uint64_t *)*mbuf0; + mbuf1 = (uint64_t *)*mbuf1; + mbuf2 = (uint64_t *)*mbuf2; + mbuf3 = (uint64_t *)*mbuf3; + }else { +/* Get pool pointer alone */ + mbuf0 = (uint64_t *)*mbuf0; + mbuf1 = (uint64_t *)*mbuf1; + mbuf2 = (uint64_t *)*mbuf2; + mbuf3 = (uint64_t *)*mbuf3; + } + +const uint8x16_t shuf_mask2 = { +0x4 ,0x5 ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , +0xc ,0xd ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , + }; + xtmp128 =vzip2q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip2q_u64 (len_olflags2, len_olflags3); + +/* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */ +const uint64x2_t and_mask0 = { +0xFFFFFFFFFFFFFFFF , +0x000000000000FFFF , + }; + + dataoff_iova0 =vandq_u64 (dataoff_iova0, and_mask0); + dataoff_iova1 =vandq_u64 (dataoff_iova1, and_mask0); + dataoff_iova2 =vandq_u64 (dataoff_iova2, and_mask0); + dataoff_iova3 =vandq_u64 (dataoff_iova3, and_mask0); + +/* +* Pick only 16 bits of pktlen preset at bits 63:32 +* and place them at bits 15:0. +*/ + xtmp128 =vqtbl1q_u8 (xtmp128, shuf_mask2); + ytmp128 =vqtbl1q_u8 (ytmp128, shuf_mask2); + +/* Add pairwise to get dataoff + iova in sgdesc_w1 */ + sgdesc01_w1 =vpaddq_u64 (dataoff_iova0, dataoff_iova1); + sgdesc23_w1 =vpaddq_u64 (dataoff_iova2, dataoff_iova3); + +/* Orr both sgdesc_w0 and senddesc_w0 with 16 bits of +* pktlen at 15:0 position. +*/ + sgdesc01_w0 =vorrq_u64 (sgdesc01_w0, xtmp128); + sgdesc23_w0 =vorrq_u64 (sgdesc23_w0, ytmp128); + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xtmp128); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, ytmp128); + +if ((flags &NIX_TX_OFFLOAD_L3_L4_CSUM_F ) && + !(flags &NIX_TX_OFFLOAD_OL3_OL4_CSUM_F )) { +/* +* Lookup table to translate ol_flags to +* il3/il4 types. But we still use ol3/ol4 types in +* senddesc_w1 as only one header processing is enabled. +*/ +const uint8x16_t tbl = { +/* [0-15] = il4type:il3type */ +0x04 ,/* none (IPv6 assumed) */ +0x14 ,/* PKT_TX_TCP_CKSUM (IPv6 assumed) */ +0x24 ,/* PKT_TX_SCTP_CKSUM (IPv6 assumed) */ +0x34 ,/* PKT_TX_UDP_CKSUM (IPv6 assumed) */ +0x03 ,/* PKT_TX_IP_CKSUM */ +0x13 ,/* PKT_TX_IP_CKSUM | PKT_TX_TCP_CKSUM */ +0x23 ,/* PKT_TX_IP_CKSUM | PKT_TX_SCTP_CKSUM */ +0x33 ,/* PKT_TX_IP_CKSUM | PKT_TX_UDP_CKSUM */ +0x02 ,/* PKT_TX_IPV4 */ +0x12 ,/* PKT_TX_IPV4 | PKT_TX_TCP_CKSUM */ +0x22 ,/* PKT_TX_IPV4 | PKT_TX_SCTP_CKSUM */ +0x32 ,/* PKT_TX_IPV4 | PKT_TX_UDP_CKSUM */ +0x03 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM */ +0x13 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_TCP_CKSUM +*/ +0x23 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_SCTP_CKSUM +*/ +0x33 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_UDP_CKSUM +*/ + }; + +/* Extract olflags to translate to iltypes */ + xtmp128 =vzip1q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip1q_u64 (len_olflags2, len_olflags3); + +/* +* E(47):L3_LEN(9):L2_LEN(7+z) +* E(47):L3_LEN(9):L2_LEN(7+z) +*/ + senddesc01_w1 =vshlq_n_u64 (senddesc01_w1,1 ); + senddesc23_w1 =vshlq_n_u64 (senddesc23_w1,1 ); + +/* Move OLFLAGS bits 55:52 to 51:48 +* with zeros preprended on the byte and rest +* don't care +*/ + xtmp128 =vshrq_n_u8 (xtmp128,4 ); + ytmp128 =vshrq_n_u8 (ytmp128,4 ); +/* +* E(48):L3_LEN(8):L2_LEN(z+7) +* E(48):L3_LEN(8):L2_LEN(z+7) +*/ +const int8x16_t tshft3 = { +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , + }; + + senddesc01_w1 =vshlq_u8 (senddesc01_w1, tshft3); + senddesc23_w1 =vshlq_u8 (senddesc23_w1, tshft3); + +/* Do the lookup */ + ltypes01 =vqtbl1q_u8 (tbl, xtmp128); + ltypes23 =vqtbl1q_u8 (tbl, ytmp128); + +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + +/* Pick only relevant fields i.e Bit 48:55 of iltype +* and place it in ol3/ol4type of senddesc_w1 +*/ +const uint8x16_t shuf_mask0 = { +0xFF ,0xFF ,0xFF ,0xFF ,0x6 ,0xFF ,0xFF ,0xFF , +0xFF ,0xFF ,0xFF ,0xFF ,0xE ,0xFF ,0xFF ,0xFF , + }; + + ltypes01 =vqtbl1q_u8 (ltypes01, shuf_mask0); + ltypes23 =vqtbl1q_u8 (ltypes23, shuf_mask0); + +/* Prepare ol4ptr, ol3ptr from ol3len, ol2len. +* a [E(32):E(16):OL3(8):OL2(8)] +* a = a + (a << 8) +* a [E(32):E(16):(OL3+OL2):OL2] +* => E(32):E(16)::OL4PTR(8):OL3PTR(8) +*/ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u16 (senddesc01_w1,8 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u16 (senddesc23_w1,8 )); + +/* Create first half of 4W cmd for 4 mbufs (sgdesc) */ + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); +/* Move ltypes to senddesc*_w1 */ + senddesc01_w1 =vorrq_u64 (senddesc01_w1, ltypes01); + senddesc23_w1 =vorrq_u64 (senddesc23_w1, ltypes23); + +/* Create first half of 4W cmd for 4 mbufs (sendhdr) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + + }else if (!(flags &NIX_TX_OFFLOAD_L3_L4_CSUM_F ) && + (flags &NIX_TX_OFFLOAD_OL3_OL4_CSUM_F )) { +/* +* Lookup table to translate ol_flags to +* ol3/ol4 types. +*/ + +const uint8x16_t tbl = { +/* [0-15] = ol4type:ol3type */ +0x00 ,/* none */ +0x03 ,/* OUTER_IP_CKSUM */ +0x02 ,/* OUTER_IPV4 */ +0x03 ,/* OUTER_IPV4 | OUTER_IP_CKSUM */ +0x04 ,/* OUTER_IPV6 */ +0x00 ,/* OUTER_IPV6 | OUTER_IP_CKSUM */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM */ +0x33 ,/* OUTER_UDP_CKSUM | OUTER_IP_CKSUM */ +0x32 ,/* OUTER_UDP_CKSUM | OUTER_IPV4 */ +0x33 ,/* OUTER_UDP_CKSUM | OUTER_IPV4 | +* OUTER_IP_CKSUM +*/ +0x34 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 */ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 | OUTER_IP_CKSUM +*/ + }; + +/* Extract olflags to translate to iltypes */ + xtmp128 =vzip1q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip1q_u64 (len_olflags2, len_olflags3); + +/* +* E(47):OL3_LEN(9):OL2_LEN(7+z) +* E(47):OL3_LEN(9):OL2_LEN(7+z) +*/ +const uint8x16_t shuf_mask5 = { +0x6 ,0x5 ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , +0xE ,0xD ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , + }; + senddesc01_w1 =vqtbl1q_u8 (senddesc01_w1, shuf_mask5); + senddesc23_w1 =vqtbl1q_u8 (senddesc23_w1, shuf_mask5); + +/* Extract outer ol flags only */ +const uint64x2_t o_cksum_mask = { +0x1C00020000000000 , +0x1C00020000000000 , + }; + + xtmp128 =vandq_u64 (xtmp128, o_cksum_mask); + ytmp128 =vandq_u64 (ytmp128, o_cksum_mask); + +/* Extract OUTER_UDP_CKSUM bit 41 and +* move it to bit 61 +*/ + + xtmp128 = xtmp128 |vshlq_n_u64 (xtmp128,20 ); + ytmp128 = ytmp128 |vshlq_n_u64 (ytmp128,20 ); + +/* Shift oltype by 2 to start nibble from BIT(56) +* instead of BIT(58) +*/ + xtmp128 =vshrq_n_u8 (xtmp128,2 ); + ytmp128 =vshrq_n_u8 (ytmp128,2 ); +/* +* E(48):L3_LEN(8):L2_LEN(z+7) +* E(48):L3_LEN(8):L2_LEN(z+7) +*/ +const int8x16_t tshft3 = { +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , + }; + + senddesc01_w1 =vshlq_u8 (senddesc01_w1, tshft3); + senddesc23_w1 =vshlq_u8 (senddesc23_w1, tshft3); + +/* Do the lookup */ + ltypes01 =vqtbl1q_u8 (tbl, xtmp128); + ltypes23 =vqtbl1q_u8 (tbl, ytmp128); + +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + +/* Pick only relevant fields i.e Bit 56:63 of oltype +* and place it in ol3/ol4type of senddesc_w1 +*/ +const uint8x16_t shuf_mask0 = { +0xFF ,0xFF ,0xFF ,0xFF ,0x7 ,0xFF ,0xFF ,0xFF , +0xFF ,0xFF ,0xFF ,0xFF ,0xF ,0xFF ,0xFF ,0xFF , + }; + + ltypes01 =vqtbl1q_u8 (ltypes01, shuf_mask0); + ltypes23 =vqtbl1q_u8 (ltypes23, shuf_mask0); + +/* Prepare ol4ptr, ol3ptr from ol3len, ol2len. +* a [E(32):E(16):OL3(8):OL2(8)] +* a = a + (a << 8) +* a [E(32):E(16):(OL3+OL2):OL2] +* => E(32):E(16)::OL4PTR(8):OL3PTR(8) +*/ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u16 (senddesc01_w1,8 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u16 (senddesc23_w1,8 )); + +/* Create second half of 4W cmd for 4 mbufs (sgdesc) */ + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); +/* Move ltypes to senddesc*_w1 */ + senddesc01_w1 =vorrq_u64 (senddesc01_w1, ltypes01); + senddesc23_w1 =vorrq_u64 (senddesc23_w1, ltypes23); + +/* Create first half of 4W cmd for 4 mbufs (sendhdr) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + + }else if ((flags &NIX_TX_OFFLOAD_L3_L4_CSUM_F ) && + (flags &NIX_TX_OFFLOAD_OL3_OL4_CSUM_F )) { +/* Lookup table to translate ol_flags to +* ol4type, ol3type, il4type, il3type of senddesc_w1 +*/ +const uint8x16x2_t tbl = { + { + { +/* [0-15] = il4type:il3type */ +0x04 ,/* none (IPv6) */ +0x14 ,/* PKT_TX_TCP_CKSUM (IPv6) */ +0x24 ,/* PKT_TX_SCTP_CKSUM (IPv6) */ +0x34 ,/* PKT_TX_UDP_CKSUM (IPv6) */ +0x03 ,/* PKT_TX_IP_CKSUM */ +0x13 ,/* PKT_TX_IP_CKSUM | +* PKT_TX_TCP_CKSUM +*/ +0x23 ,/* PKT_TX_IP_CKSUM | +* PKT_TX_SCTP_CKSUM +*/ +0x33 ,/* PKT_TX_IP_CKSUM | +* PKT_TX_UDP_CKSUM +*/ +0x02 ,/* PKT_TX_IPV4 */ +0x12 ,/* PKT_TX_IPV4 | +* PKT_TX_TCP_CKSUM +*/ +0x22 ,/* PKT_TX_IPV4 | +* PKT_TX_SCTP_CKSUM +*/ +0x32 ,/* PKT_TX_IPV4 | +* PKT_TX_UDP_CKSUM +*/ +0x03 ,/* PKT_TX_IPV4 | +* PKT_TX_IP_CKSUM +*/ +0x13 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_TCP_CKSUM +*/ +0x23 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_SCTP_CKSUM +*/ +0x33 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_UDP_CKSUM +*/ + }, + + { +/* [16-31] = ol4type:ol3type */ +0x00 ,/* none */ +0x03 ,/* OUTER_IP_CKSUM */ +0x02 ,/* OUTER_IPV4 */ +0x03 ,/* OUTER_IPV4 | OUTER_IP_CKSUM */ +0x04 ,/* OUTER_IPV6 */ +0x00 ,/* OUTER_IPV6 | OUTER_IP_CKSUM */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM */ +0x33 ,/* OUTER_UDP_CKSUM | +* OUTER_IP_CKSUM +*/ +0x32 ,/* OUTER_UDP_CKSUM | +* OUTER_IPV4 +*/ +0x33 ,/* OUTER_UDP_CKSUM | +* OUTER_IPV4 | OUTER_IP_CKSUM +*/ +0x34 ,/* OUTER_UDP_CKSUM | +* OUTER_IPV6 +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 | OUTER_IP_CKSUM +*/ + }, + } + }; + +/* Extract olflags to translate to oltype & iltype */ + xtmp128 =vzip1q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip1q_u64 (len_olflags2, len_olflags3); + +/* +* E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z) +* E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z) +*/ +const uint32x4_t tshft_4 = { +1 ,0 , +1 ,0 , + }; + senddesc01_w1 =vshlq_u32 (senddesc01_w1, tshft_4); + senddesc23_w1 =vshlq_u32 (senddesc23_w1, tshft_4); + +/* +* E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z) +* E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z) +*/ +const uint8x16_t shuf_mask5 = { +0x6 ,0x5 ,0x0 ,0x1 ,0xFF ,0xFF ,0xFF ,0xFF , +0xE ,0xD ,0x8 ,0x9 ,0xFF ,0xFF ,0xFF ,0xFF , + }; + senddesc01_w1 =vqtbl1q_u8 (senddesc01_w1, shuf_mask5); + senddesc23_w1 =vqtbl1q_u8 (senddesc23_w1, shuf_mask5); + +/* Extract outer and inner header ol_flags */ +const uint64x2_t oi_cksum_mask = { +0x1CF0020000000000 , +0x1CF0020000000000 , + }; + + xtmp128 =vandq_u64 (xtmp128, oi_cksum_mask); + ytmp128 =vandq_u64 (ytmp128, oi_cksum_mask); + +/* Extract OUTER_UDP_CKSUM bit 41 and +* move it to bit 61 +*/ + + xtmp128 = xtmp128 |vshlq_n_u64 (xtmp128,20 ); + ytmp128 = ytmp128 |vshlq_n_u64 (ytmp128,20 ); + +/* Shift right oltype by 2 and iltype by 4 +* to start oltype nibble from BIT(58) +* instead of BIT(56) and iltype nibble from BIT(48) +* instead of BIT(52). +*/ +const int8x16_t tshft5 = { +8 ,8 ,8 ,8 ,8 ,8 ,-4 ,-2 , +8 ,8 ,8 ,8 ,8 ,8 ,-4 ,-2 , + }; + + xtmp128 =vshlq_u8 (xtmp128, tshft5); + ytmp128 =vshlq_u8 (ytmp128, tshft5); +/* +* E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8) +* E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8) +*/ +const int8x16_t tshft3 = { +-1 ,0 ,-1 ,0 ,0 ,0 ,0 ,0 , +-1 ,0 ,-1 ,0 ,0 ,0 ,0 ,0 , + }; + + senddesc01_w1 =vshlq_u8 (senddesc01_w1, tshft3); + senddesc23_w1 =vshlq_u8 (senddesc23_w1, tshft3); + +/* Mark Bit(4) of oltype */ +const uint64x2_t oi_cksum_mask2 = { +0x1000000000000000 , +0x1000000000000000 , + }; + + xtmp128 =vorrq_u64 (xtmp128, oi_cksum_mask2); + ytmp128 =vorrq_u64 (ytmp128, oi_cksum_mask2); + +/* Do the lookup */ + ltypes01 =vqtbl2q_u8 (tbl, xtmp128); + ltypes23 =vqtbl2q_u8 (tbl, ytmp128); + +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + +/* Pick only relevant fields i.e Bit 48:55 of iltype and +* Bit 56:63 of oltype and place it in corresponding +* place in senddesc_w1. +*/ +const uint8x16_t shuf_mask0 = { +0xFF ,0xFF ,0xFF ,0xFF ,0x7 ,0x6 ,0xFF ,0xFF , +0xFF ,0xFF ,0xFF ,0xFF ,0xF ,0xE ,0xFF ,0xFF , + }; + + ltypes01 =vqtbl1q_u8 (ltypes01, shuf_mask0); + ltypes23 =vqtbl1q_u8 (ltypes23, shuf_mask0); + +/* Prepare l4ptr, l3ptr, ol4ptr, ol3ptr from +* l3len, l2len, ol3len, ol2len. +* a [E(32):L3(8):L2(8):OL3(8):OL2(8)] +* a = a + (a << 8) +* a [E:(L3+L2):(L2+OL3):(OL3+OL2):OL2] +* a = a + (a << 16) +* a [E:(L3+L2+OL3+OL2):(L2+OL3+OL2):(OL3+OL2):OL2] +* => E(32):IL4PTR(8):IL3PTR(8):OL4PTR(8):OL3PTR(8) +*/ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u32 (senddesc01_w1,8 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u32 (senddesc23_w1,8 )); + +/* Create second half of 4W cmd for 4 mbufs (sgdesc) */ + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + +/* Continue preparing l4ptr, l3ptr, ol4ptr, ol3ptr */ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u32 (senddesc01_w1,16 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u32 (senddesc23_w1,16 )); + + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); +/* Move ltypes to senddesc*_w1 */ + senddesc01_w1 =vorrq_u64 (senddesc01_w1, ltypes01); + senddesc23_w1 =vorrq_u64 (senddesc23_w1, ltypes23); + +/* Create first half of 4W cmd for 4 mbufs (sendhdr) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + }else { +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); + +/* Create 4W cmd for 4 mbufs (sendhdr, sgdesc) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + } + +do { +vst1q_u64 (lmt_addr, cmd00); +vst1q_u64 (lmt_addr +2 , cmd01); +vst1q_u64 (lmt_addr +4 , cmd10); +vst1q_u64 (lmt_addr +6 , cmd11); +vst1q_u64 (lmt_addr +8 , cmd20); +vst1q_u64 (lmt_addr +10 , cmd21); +vst1q_u64 (lmt_addr +12 , cmd30); +vst1q_u64 (lmt_addr +14 , cmd31); + lmt_status =otx2_lmt_submit (io_addr); + + }while (lmt_status ==0 ); + } + +return pkts; +} + +#else +static __rte_always_inline uint16_t +nix_xmit_pkts_vector (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t pkts,const uint16_t flags) +{ +RTE_SET_USED (tx_queue); +RTE_SET_USED (tx_pkts); +RTE_SET_USED (pkts); +RTE_SET_USED (flags); +return 0 ; +} +#endif +#define T (name, f4, f3, f2, f1, f0, sz, flags) \ static uint16_t __rte_noinline __hot \ otx2_nix_xmit_pkts_ ## name(void *tx_queue, \
@@ -107,6 +960,21 @@ otx2_nix_xmit_pkts_mseg_ ## name(void *tx_queue, \ NIX_TX_FASTPATH_MODES#undef T +#define T (name, 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) \ +{ \ +/* VLAN and TSTMP is not supported by vec */ \ +if ((flags) &NIX_TX_OFFLOAD_VLAN_QINQ_F || \ + (flags) &NIX_TX_OFFLOAD_TSTAMP_F ) \ +return 0 ; \ +return nix_xmit_pkts_vector (tx_queue, tx_pkts, pkts, (flags)); \ +} + +NIX_TX_FASTPATH_MODES +#undef T +static inline void pick_tx_func (struct rte_eth_dev *eth_dev,const eth_tx_burst_t tx_burst[2 ][2 ][2 ][2 ][2 ])
@@ -143,7 +1011,20 @@ NIX_TX_FASTPATH_MODES#undef T }; -pick_tx_func (eth_dev, nix_eth_tx_burst); +const eth_tx_burst_t nix_eth_tx_vec_burst[2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f4, f3, f2, f1, f0, sz, flags) \ + [f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_vec_ ## name, + +NIX_TX_FASTPATH_MODES +#undef T + }; + +if (dev->scalar_ena || + (dev->tx_offload_flags & + (NIX_TX_OFFLOAD_VLAN_QINQ_F |NIX_TX_OFFLOAD_TSTAMP_F ))) +pick_tx_func (eth_dev, nix_eth_tx_burst); +else +pick_tx_func (eth_dev, nix_eth_tx_vec_burst);if (dev->tx_offloads &DEV_TX_OFFLOAD_MULTI_SEGS )pick_tx_func (eth_dev, nix_eth_tx_burst_mseg);
Signature · 1 line
2.21.0
PATCH v3 54/58 net/octeontx2: add device start operation
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add device start operation and update the correct function pointers for Rx and Tx burst functions.
This patch also update the octeontx2 NIC specific documentation.
--- doc/guides/nics/octeontx2.rst | 91 ++++++++++++ drivers/net/octeontx2/otx2_ethdev.c | 180 ++++++++++++++++++++++++ drivers/net/octeontx2/otx2_flow.c | 4 +- drivers/net/octeontx2/otx2_flow_parse.c | 4 +- drivers/net/octeontx2/otx2_ptp.c | 8 ++ drivers/net/octeontx2/otx2_vlan.c | 1 + 6 files changed, 286 insertions(+), 2 deletions(-)
doc/guides/nics/octeontx2.rst +91 -0
@@ -34,6 +34,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Vector Poll mode driver - Debug utilities - Context dump and error interrupt support - IEEE1588 timestamping +- HW offloaded `ethdev Rx queue` to `eventdev event queue` packet injection Prerequisites -------------
@@ -49,6 +50,63 @@ The following options may be modified in the ``config`` file. Toggle compilation of the ``librte_pmd_octeontx2`` driver. +Driver compilation and testing +------------------------------ + +Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` +for details. + +To compile the OCTEON TX2 PMD for Linux arm64 gcc, +use arm64-octeontx2-linux-gcc as target. + +#. Running testpmd: + + Follow instructions available in the document + :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` + to run testpmd. + + Example output: + + .. code-block:: console + + ./build/app/testpmd -c 0x300 -w 0002:02:00.0 -- --portmask=0x1 --nb-cores=1 --port-topology=loop --rxq=1 --txq=1 + EAL: Detected 24 lcore(s) + EAL: Detected 1 NUMA nodes + EAL: Multi-process socket /var/run/dpdk/rte/mp_socket + EAL: No available hugepages reported in hugepages-2048kB + EAL: Probing VFIO support... + EAL: VFIO support initialized + EAL: PCI device 0002:02:00.0 on NUMA socket 0 + EAL: probe driver: 177d:a063 net_octeontx2 + EAL: using IOMMU type 1 (Type 1) + testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=267456, size=2176, socket=0 + testpmd: preferred mempool ops selected: octeontx2_npa + Configuring Port 0 (socket 0) + PMD: Port 0: Link Up - speed 40000 Mbps - full-duplex + + Port 0: link state change event + Port 0: 36:10:66:88:7A:57 + Checking link statuses... + Done + No commandline core given, start packet forwarding + io packet forwarding - ports=1 - cores=1 - streams=1 - NUMA support enabled, MP allocation mode: native + Logical Core 9 (socket 0) forwards packets on 1 streams: + RX P=0/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00 + + io packet forwarding packets/burst=32 + nb forwarding cores=1 - nb forwarding ports=1 + port 0: RX queue number: 1 Tx queue number: 1 + Rx offloads=0x0 Tx offloads=0x10000 + RX queue: 0 + RX desc=512 - RX free threshold=0 + RX threshold registers: pthresh=0 hthresh=0 wthresh=0 + RX Offloads=0x0 + TX queue: 0 + TX desc=512 - TX free threshold=0 + TX threshold registers: pthresh=0 hthresh=0 wthresh=0 + TX offloads=0x10000 - TX RS bit threshold=0 + Press enter to exit + Runtime Config Options ----------------------
@@ -116,6 +174,39 @@ Runtime Config Options parameters to all the PCIe devices if application requires to configure on all the ethdev ports. +Limitations +----------- + +``mempool_octeontx2`` external mempool handler dependency +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The OCTEON TX2 SoC family NIC has inbuilt HW assisted external mempool manager. +``net_octeontx2`` pmd only works with ``mempool_octeontx2`` mempool handler +as it is performance wise most effective way for packet allocation and Tx buffer +recycling on OCTEON TX2 SoC platform. + +CRC striping +~~~~~~~~~~~~ + +The OCTEON TX2 SoC family NICs strip the CRC for every packet being received by +the host interface irrespective of the offload configuration. + + +Debugging Options +----------------- + +.. _table_octeontx2_ethdev_debug_options: + +.. table:: OCTEON TX2 ethdev debug options + + +---+------------+-------------------------------------------------------+ + | # | Component | EAL log command | + +===+============+=======================================================+ + | 1 | NIX | --log-level='pmd\.net.octeontx2,8' | + +---+------------+-------------------------------------------------------+ + | 2 | NPC | --log-level='pmd\.net.octeontx2\.flow,8' | + +---+------------+-------------------------------------------------------+ + RTE Flow Support ----------------
drivers/net/octeontx2/otx2_ethdev.c +180 -0
216 lines not on this page · raw message
drivers/net/octeontx2/otx2_flow.c +3 -1
@@ -528,8 +528,10 @@ otx2_flow_destroy(struct rte_eth_dev *dev,return -EINVAL ;/* Clear mark offload flag if there are no more mark actions */ -if (rte_atomic32_sub_return (&npc->mark_actions,1 ) ==0 ) +if (rte_atomic32_sub_return (&npc->mark_actions,1 ) ==0 ) { hw->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F ; +otx2_eth_set_rx_function (dev); + } } rc =flow_free_rss_action (dev, flow);
drivers/net/octeontx2/otx2_flow_parse.c +3 -1
@@ -938,9 +938,11 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev,if (mark) flow->npc_action |= (uint64_t )mark <<40 ; -if (rte_atomic32_read (&npc->mark_actions) ==1 ) +if (rte_atomic32_read (&npc->mark_actions) ==1 ) { hw->rx_offload_flags |=NIX_RX_OFFLOAD_MARK_UPDATE_F ; +otx2_eth_set_rx_function (dev); + } set_pf_func:/* Ideally AF must ensure that correct pf_func is set */
drivers/net/octeontx2/otx2_ptp.c +8 -0
@@ -118,6 +118,10 @@ otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev)struct otx2_eth_txq *txq = eth_dev->data->tx_queues[i];otx2_nix_form_default_desc (txq); } + +/* Setting up the function pointers as per new offload flags */ +otx2_eth_set_rx_function (eth_dev); +otx2_eth_set_tx_function (eth_dev); }return rc; }
@@ -147,6 +151,10 @@ otx2_nix_timesync_disable(struct rte_eth_dev *eth_dev)struct otx2_eth_txq *txq = eth_dev->data->tx_queues[i];otx2_nix_form_default_desc (txq); } + +/* Setting up the function pointers as per new offload flags */ +otx2_eth_set_rx_function (eth_dev); +otx2_eth_set_tx_function (eth_dev); }return rc; }
drivers/net/octeontx2/otx2_vlan.c +1 -0
@@ -760,6 +760,7 @@ otx2_nix_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) DEV_RX_OFFLOAD_QINQ_STRIP)) { dev->rx_offloads |= offloads; dev->rx_offload_flags |=NIX_RX_OFFLOAD_VLAN_STRIP_F ; +otx2_eth_set_rx_function (eth_dev); } done:
Signature · 1 line
2.21.0
PATCH v3 55/58 net/octeontx2: add device stop and close operations
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add device stop, close and reset operations.
--- drivers/net/octeontx2/otx2_ethdev.c | 75 +++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +75 -0
@@ -184,6 +184,19 @@ cgx_intlbk_enable(struct otx2_eth_dev *dev, bool en)return otx2_mbox_process (mbox); } +static int +nix_cgx_stop_link_event (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; + +if (otx2_dev_is_vf (dev)) +return 0 ; + +otx2_mbox_alloc_msg_cgx_stop_linkevents (mbox); + +return otx2_mbox_process (mbox); +} +static inline void nix_rx_queue_reset (struct otx2_eth_rxq *rxq) {
@@ -1208,6 +1221,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)if (dev->configured ==1 ) {otx2_nix_rxchan_bpid_cfg (eth_dev, false);otx2_nix_vlan_fini (eth_dev); +otx2_flow_free_all_resources (dev);oxt2_nix_unregister_queue_irqs (eth_dev);nix_set_nop_rxtx_function (eth_dev); rc =nix_store_queue_cfg_and_then_release (eth_dev);
@@ -1425,6 +1439,37 @@ otx2_nix_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)return rc; } +static void +otx2_nix_dev_stop (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct rte_mbuf *rx_pkts[32 ]; +struct otx2_eth_rxq *rxq; +int count, i, j, rc; + +nix_cgx_stop_link_event (dev); +npc_rx_disable (dev); + +/* Stop rx queues and free up pkts pending */ +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { + rc =otx2_nix_rx_queue_stop (eth_dev, i); +if (rc) +continue ; + + rxq = eth_dev->data->rx_queues[i]; + count = dev->rx_pkt_burst_no_offload (rxq, rx_pkts,32 ); +while (count) { +for (j =0 ; j < count; j++) +rte_pktmbuf_free (rx_pkts[j]); + count = dev->rx_pkt_burst_no_offload (rxq, rx_pkts,32 ); + } + } + +/* Stop tx queues */ +for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) +otx2_nix_tx_queue_stop (eth_dev, i); +} +static int otx2_nix_dev_start (struct rte_eth_dev *eth_dev) {
@@ -1477,6 +1522,8 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)return rc; } +static int otx2_nix_dev_reset (struct rte_eth_dev *eth_dev); +static void otx2_nix_dev_close (struct rte_eth_dev *eth_dev);/* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops otx2_eth_dev_ops = {
@@ -1488,11 +1535,14 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .rx_queue_setup = otx2_nix_rx_queue_setup, .rx_queue_release = otx2_nix_rx_queue_release, .dev_start = otx2_nix_dev_start, + .dev_stop = otx2_nix_dev_stop, + .dev_close = otx2_nix_dev_close, .tx_queue_start = otx2_nix_tx_queue_start, .tx_queue_stop = otx2_nix_tx_queue_stop, .rx_queue_start = otx2_nix_rx_queue_start, .rx_queue_stop = otx2_nix_rx_queue_stop, .dev_supported_ptypes_get = otx2_nix_supported_ptypes_get, + .dev_reset = otx2_nix_dev_reset, .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg,
@@ -1744,9 +1794,14 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +/* Clear the flag since we are closing down */ + dev->configured =0 ; +/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +npc_rx_disable (dev); +/* Disable vlan offloads */ otx2_nix_vlan_fini (eth_dev);
@@ -1757,6 +1812,8 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (otx2_ethdev_is_ptp_en (dev))otx2_nix_timesync_disable (eth_dev); +nix_cgx_stop_link_event (dev); +/* Free up SQs */ for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {otx2_nix_tx_queue_release (eth_dev->data->tx_queues[i]);
@@ -1812,6 +1869,24 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)return 0 ; } +static void +otx2_nix_dev_close (struct rte_eth_dev *eth_dev) +{ +otx2_eth_dev_uninit (eth_dev, true); +} + +static int +otx2_nix_dev_reset (struct rte_eth_dev *eth_dev) +{ +int rc; + + rc =otx2_eth_dev_uninit (eth_dev, false); +if (rc) +return rc; + +return otx2_eth_dev_init (eth_dev); +} +static int nix_remove (struct rte_pci_device *pci_dev) {
Signature · 1 line
2.21.0
PATCH v3 56/58 net/octeontx2: add MTU set operation
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add MTU set operation and MTU update feature.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/otx2_ethdev.c | 7 ++ drivers/net/octeontx2/otx2_ethdev.h | 4 + drivers/net/octeontx2/otx2_ethdev_ops.c | 86 ++++++++++++++++++++++ 6 files changed, 100 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -15,6 +15,7 @@ Runtime Tx queue setup = Y Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y +MTU update = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -15,6 +15,7 @@ Runtime Tx queue setup = Y Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y +MTU update = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
doc/guides/nics/octeontx2.rst +1 -0
@@ -30,6 +30,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Port hardware statistics - Link state information - Link flow control +- MTU update - Scatter-Gather IO support - Vector Poll mode driver - Debug utilities - Context dump and error interrupt support
drivers/net/octeontx2/otx2_ethdev.c +7 -0
@@ -1476,6 +1476,12 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev);int rc, i; +if (eth_dev->data->nb_rx_queues !=0 ) { + rc =otx2_nix_recalc_mtu (eth_dev); +if (rc) +return rc; + } +/* Start rx queues */ for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { rc =otx2_nix_rx_queue_start (eth_dev, i);
@@ -1546,6 +1552,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg, + .mtu_set = otx2_nix_mtu_set, .mac_addr_add = otx2_nix_mac_addr_add, .mac_addr_remove = otx2_nix_mac_addr_del, .mac_addr_set = otx2_nix_mac_addr_set,
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -371,6 +371,10 @@ int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);int otx2_nix_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t qidx);uint64_t otx2_nix_rxq_mbuf_setup (struct otx2_eth_dev *dev,uint16_t port_id); +/* MTU */ +int otx2_nix_mtu_set (struct rte_eth_dev *eth_dev,uint16_t mtu); +int otx2_nix_recalc_mtu (struct rte_eth_dev *eth_dev); +/* Link */ void otx2_nix_toggle_flag_link_cfg (struct otx2_eth_dev *dev,bool set);int otx2_nix_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete);
drivers/net/octeontx2/otx2_ethdev_ops.c +86 -0
92 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 57/58 net/octeontx2: add Rx interrupts support
In reply to [email protected]From: Harman Kalra <[email protected]>
This patch implements rx interrupts feature required for power saving. These interrupts can be enabled/disabled on demand.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/otx2_ethdev.c | 31 ++++++ drivers/net/octeontx2/otx2_ethdev.h | 16 +++ drivers/net/octeontx2/otx2_ethdev_irq.c | 125 ++++++++++++++++++++++ 6 files changed, 175 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -5,6 +5,7 @@ ; [Features] Speed capabilities = Y +Rx interrupt = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -7,6 +7,7 @@ Speed capabilities = Y Lock-free Tx queue = Y Multiprocess aware = Y +Rx interrupt = Y Link status = Y Link status event = Y Runtime Rx queue setup = Y
doc/guides/nics/octeontx2.rst +1 -0
@@ -36,6 +36,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - Debug utilities - Context dump and error interrupt support - IEEE1588 timestamping - HW offloaded `ethdev Rx queue` to `eventdev event queue` packet injection +- Support Rx interrupt Prerequisites -------------
drivers/net/octeontx2/otx2_ethdev.c +31 -0
@@ -277,6 +277,8 @@ nix_cq_rq_init(struct rte_eth_dev *eth_dev, struct otx2_eth_dev *dev,/* Many to one reduction */ aq->cq.qint_idx = qid % dev->qints; +/* Map CQ0 [RQ0] to CINT0 and so on till max 64 irqs */ + aq->cq.cint_idx = qid;if (otx2_ethdev_fixup_is_limit_cq_full (dev)) {uint16_t min_rx_drop;
@@ -1223,6 +1225,8 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)otx2_nix_vlan_fini (eth_dev);otx2_flow_free_all_resources (dev);oxt2_nix_unregister_queue_irqs (eth_dev); +if (eth_dev->data->dev_conf.intr_conf.rxq) +oxt2_nix_unregister_cq_irqs (eth_dev);nix_set_nop_rxtx_function (eth_dev); rc =nix_store_queue_cfg_and_then_release (eth_dev);if (rc)
@@ -1283,6 +1287,27 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } +/* Register cq IRQs */ +if (eth_dev->data->dev_conf.intr_conf.rxq) { +if (eth_dev->data->nb_rx_queues > dev->cints) { +otx2_err ("Rx interrupt cannot be enabled, rxq > %d" , + dev->cints); + goto free_nix_lf; + } +/* Rx interrupt feature cannot work with vector mode because, +* vector mode doesn't process packets unless min 4 pkts are +* received, while cq interrupts are generated even for 1 pkt +* in the CQ. +*/ + dev->scalar_ena = true; + + rc =oxt2_nix_register_cq_irqs (eth_dev); +if (rc) { +otx2_err ("Failed to register CQ interrupts rc=%d" , rc); + goto free_nix_lf; + } + } +/* Configure loop back mode */ rc =cgx_intlbk_enable (dev, eth_dev->data->dev_conf.lpbk_mode);if (rc) {
@@ -1595,6 +1620,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .vlan_strip_queue_set = otx2_nix_vlan_strip_queue_set, .vlan_tpid_set = otx2_nix_vlan_tpid_set, .vlan_pvid_set = otx2_nix_vlan_pvid_set, + .rx_queue_intr_enable = otx2_nix_rx_queue_intr_enable, + .rx_queue_intr_disable = otx2_nix_rx_queue_intr_disable, }; static inline int
@@ -1843,6 +1870,10 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Unregister queue irqs */ oxt2_nix_unregister_queue_irqs (eth_dev); +/* Unregister cq irqs */ +if (eth_dev->data->dev_conf.intr_conf.rxq) +oxt2_nix_unregister_cq_irqs (eth_dev); + rc =nix_lf_free (dev);if (rc)otx2_err ("Failed to free nix lf, rc=%d" , rc);
drivers/net/octeontx2/otx2_ethdev.h +16 -0
@@ -102,6 +102,13 @@#define OP_ERR BIT_ULL(CQ_OP_STAT_OP_ERR)#define CQ_ERR BIT_ULL(CQ_OP_STAT_CQ_ERR) +#define CQ_CQE_THRESH_DEFAULT 0x1ULL/* IRQ triggered when +* NIX_LF_CINTX_CNT[QCOUNT] +* crosses this value +*/ +#define CQ_TIMER_THRESH_DEFAULT 0xAULL/* ~1usec i.e (0xA * 100nsec) */ +#define CQ_TIMER_THRESH_MAX 255 +#define NIX_RSS_OFFLOAD (ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP |\ ETH_RSS_TCP | ETH_RSS_SCTP | \ ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD)
@@ -248,6 +255,7 @@ struct otx2_eth_dev {uint16_t qints;uint8_t configured;uint8_t configured_qints; +uint8_t configured_cints;uint8_t configured_nb_rx_qs;uint8_t configured_nb_tx_qs;uint16_t nix_msixoff;
@@ -262,6 +270,7 @@ struct otx2_eth_dev {uint64_t rx_offload_capa;uint64_t tx_offload_capa;struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT ]; +struct otx2_qint cints_mem[RTE_MAX_QUEUES_PER_PORT ];uint16_t txschq[NIX_TXSCH_LVL_CNT ];uint16_t txschq_contig[NIX_TXSCH_LVL_CNT ];uint16_t txschq_index[NIX_TXSCH_LVL_CNT ];
@@ -384,8 +393,15 @@ void otx2_eth_dev_link_status_update(struct otx2_dev *dev,/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev);int oxt2_nix_register_queue_irqs (struct rte_eth_dev *eth_dev); +int oxt2_nix_register_cq_irqs (struct rte_eth_dev *eth_dev);void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev);void oxt2_nix_unregister_queue_irqs (struct rte_eth_dev *eth_dev); +void oxt2_nix_unregister_cq_irqs (struct rte_eth_dev *eth_dev); + +int otx2_nix_rx_queue_intr_enable (struct rte_eth_dev *eth_dev, +uint16_t rx_queue_id); +int otx2_nix_rx_queue_intr_disable (struct rte_eth_dev *eth_dev, +uint16_t rx_queue_id);/* Debug */ int otx2_nix_reg_dump (struct otx2_eth_dev *dev,uint64_t *data);
drivers/net/octeontx2/otx2_ethdev_irq.c +125 -0
146 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 58/58 net/octeontx2: add link status set operations
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add support for setting the link up and down.
--- drivers/net/octeontx2/otx2_ethdev.c | 2 ++ drivers/net/octeontx2/otx2_ethdev.h | 2 ++ drivers/net/octeontx2/otx2_link.c | 49 +++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -1572,6 +1572,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .tx_queue_stop = otx2_nix_tx_queue_stop, .rx_queue_start = otx2_nix_rx_queue_start, .rx_queue_stop = otx2_nix_rx_queue_stop, + .dev_set_link_up = otx2_nix_dev_set_link_up, + .dev_set_link_down = otx2_nix_dev_set_link_down, .dev_supported_ptypes_get = otx2_nix_supported_ptypes_get, .dev_reset = otx2_nix_dev_reset, .stats_get = otx2_nix_dev_stats_get,
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -389,6 +389,8 @@ void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set);int otx2_nix_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete);void otx2_eth_dev_link_status_update (struct otx2_dev *dev,struct cgx_link_user_info *link); +int otx2_nix_dev_set_link_up (struct rte_eth_dev *eth_dev); +int otx2_nix_dev_set_link_down (struct rte_eth_dev *eth_dev);/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_link.c +49 -0
52 lines not on this page · raw message
Signature · 1 line
2.21.0
Quoted 10 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, July 3, 2019 2:12 PM
To: [email protected]
Cc: Jerin Jacob Kollanukkaran <[email protected]>
Subject: [dpdk-dev] [PATCH v3 00/58] OCTEON TX2 Ethdev driverFrom: Jerin Jacob <[email protected]>
This patchset adds support for OCTEON TX2 ethdev driver.
Series applied to dpdk-next-net-mrvl/master. Thanks.
Quoted 7 lines · Jerin Jacob Kollanukkaran
Quoted 7 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, July 3, 2019 2:12 PM
To: [email protected]
Cc: Jerin Jacob Kollanukkaran <[email protected]>
Subject: [dpdk-dev] [PATCH v3 00/58] OCTEON TX2 Ethdev driver
Quoted 6 lines
Quoted 3 lines
From: Jerin Jacob <[email protected]>
This patchset adds support for OCTEON TX2 ethdev driver.
Series applied to dpdk-next-net-mrvl/master. Thanks.
Jerin's ack added for the patches that are not by maintainers.
Added following patch in next-net because of icc warnings:
drivers/net/octeontx2/Makefile +3 -1
@@ -14,13 +14,15 @@ CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 CFLAGS += -O3 +ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) CFLAGS += -flax-vector-conversions +endif ifneq ($(CONFIG_RTE_ARCH_64),y) CFLAGS += -Wno-int-to-pointer-cast CFLAGS += -Wno-pointer-to-int-cast ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) -CFLAGS += -diag-disable 2259 -flax-vector-conversions +CFLAGS += -diag-disable 2259 endif