Skip to contentSkip to conversation

OCTEON TX2 Ethdev driver

PATCH Superseded [email protected] 4 participants 196 messages Jun 2, 2019 – Jul 4, 2019 Page 2 of 3

Subsystems (2)
lore
Share & tools
lore
#89 lore raw

PATCH v2 12/57 net/octeontx2: add basic stats operation

In reply to [email protected]

From: Kiran Kumar K <[email protected]>

Add basic stat operation and updated the feature list.

---
 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/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |   3 +
 drivers/net/octeontx2/otx2_ethdev.h        |  17 +++
 drivers/net/octeontx2/otx2_stats.c         | 117 +++++++++++++++++++++
 9 files changed, 146 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_stats.c
doc/guides/nics/features/octeontx2.ini +2 -0
index 828351409..557107016 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Basic stats          = Y
+Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
index 719692dc6..3a2b78e06 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Basic stats          = Y
+Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
index 4d5667583..499f66c5c 100644
@@ -9,6 +9,8 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Basic stats          = Y
+Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/octeontx2.rst +1 -0
index a163f9128..2944bbb99 100644
@@ -18,6 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 
 - SR-IOV VF
 - Lock-free Tx queue
+- Port hardware statistics
 - Link state information
 - Debug utilities - Context dump and error interrupt support
 
drivers/net/octeontx2/Makefile +1 -0
index 2dfb5043d..fbe5e9f44 100644
@@ -30,6 +30,7 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
 	otx2_link.c	\
+	otx2_stats.c	\
 	otx2_ethdev.c	\
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
index d693386b9..1c57b1bb4 100644
@@ -5,6 +5,7 @@
 sources = files(
 		'otx2_mac.c',
 		'otx2_link.c',
+		'otx2_stats.c',
 		'otx2_ethdev.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +3 -0
index cb4f6ebb9..5787029d9 100644
@@ -234,7 +234,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.dev_infos_get            = otx2_nix_info_get,
 	.dev_configure            = otx2_nix_configure,
 	.link_update              = otx2_nix_link_update,
+	.stats_get                = otx2_nix_dev_stats_get,
+	.stats_reset              = otx2_nix_dev_stats_reset,
 	.get_reg                  = otx2_nix_dev_get_reg,
+	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +17 -0
index d8490337d..1cd9893a6 100644
@@ -77,6 +77,12 @@
 #define NIX_TX_NB_SEG_MAX		9
 #endif
 
+#define CQ_OP_STAT_OP_ERR	63
+#define CQ_OP_STAT_CQ_ERR	46
+
+#define OP_ERR			BIT_ULL(CQ_OP_STAT_OP_ERR)
+#define CQ_ERR			BIT_ULL(CQ_OP_STAT_CQ_ERR)
+
 #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)
@@ -156,6 +162,8 @@ struct otx2_eth_dev {
 	uint64_t tx_offload_capa;
 	struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT];
 	struct otx2_rss_info rss_info;
+	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
+	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	struct otx2_npc_flow_info npc_flow;
 	struct rte_eth_dev *eth_dev;
 } __rte_cache_aligned;
@@ -189,6 +197,15 @@ int otx2_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
 int otx2_nix_queues_ctx_dump(struct rte_eth_dev *eth_dev);
 void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
 
+/* Stats */
+int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_stats *stats);
+void otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
+
+int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
+				 uint16_t queue_id, uint8_t stat_idx,
+				 uint8_t is_rx);
+
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_stats.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.21.0
#90 lore raw

PATCH v2 13/57 net/octeontx2: add extended stats operations

In reply to [email protected]

From: Kiran Kumar K <[email protected]>

Add extended operations and updated the feature list.

---
 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        |   5 +
 drivers/net/octeontx2/otx2_ethdev.h        |  13 +
 drivers/net/octeontx2/otx2_stats.c         | 270 +++++++++++++++++++++
 6 files changed, 291 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index 557107016..8d7c3588c 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Basic stats          = Y
 Stats per queue      = Y
+Extended stats       = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 3a2b78e06..a6e6876fa 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Basic stats          = Y
+Extended stats       = Y
 Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 499f66c5c..6ec83e823 100644
@@ -10,6 +10,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Basic stats          = Y
+Extended stats       = Y
 Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
drivers/net/octeontx2/otx2_ethdev.c +5 -0
index 5787029d9..937ba6399 100644
@@ -238,6 +238,11 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.stats_reset              = otx2_nix_dev_stats_reset,
 	.get_reg                  = otx2_nix_dev_get_reg,
 	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
+	.xstats_get               = otx2_nix_xstats_get,
+	.xstats_get_names         = otx2_nix_xstats_get_names,
+	.xstats_reset             = otx2_nix_xstats_reset,
+	.xstats_get_by_id         = otx2_nix_xstats_get_by_id,
+	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +13 -0
index 1cd9893a6..7d53a6643 100644
@@ -205,6 +205,19 @@ void otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
 				 uint16_t queue_id, uint8_t stat_idx,
 				 uint8_t is_rx);
+int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
+			struct rte_eth_xstat *xstats, unsigned int n);
+int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+			      struct rte_eth_xstat_name *xstats_names,
+			      unsigned int limit);
+void otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+
+int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev,
+			      const uint64_t *ids,
+			      uint64_t *values, unsigned int n);
+int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
+				    struct rte_eth_xstat_name *xstats_names,
+				    const uint64_t *ids, unsigned int limit);
 
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_stats.c +270 -0

279 lines not on this page · raw message

Signature · 1 line
2.21.0
#91 lore raw

PATCH v2 14/57 net/octeontx2: add promiscuous and allmulticast mode

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

Add promiscuous and allmulticast mode for PF devices and update the respective feature list.

---
 doc/guides/nics/features/octeontx2.ini     |  2 +
 doc/guides/nics/features/octeontx2_vec.ini |  2 +
 doc/guides/nics/octeontx2.rst              |  1 +
 drivers/net/octeontx2/otx2_ethdev.c        |  4 ++
 drivers/net/octeontx2/otx2_ethdev.h        |  6 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    | 82 ++++++++++++++++++++++
 6 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
index 8d7c3588c..9f682609d 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
index a6e6876fa..764e95ce6 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 2944bbb99..9ef7be08f 100644
@@ -16,6 +16,7 @@ Features
 
 Features of the OCTEON TX2 Ethdev PMD are:
 
+- Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
 - Port hardware statistics
drivers/net/octeontx2/otx2_ethdev.c +4 -0
index 937ba6399..826ce7f4e 100644
@@ -237,6 +237,10 @@ 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,
+	.promiscuous_enable       = otx2_nix_promisc_enable,
+	.promiscuous_disable      = otx2_nix_promisc_disable,
+	.allmulticast_enable      = otx2_nix_allmulticast_enable,
+	.allmulticast_disable     = otx2_nix_allmulticast_disable,
 	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
 	.xstats_get               = otx2_nix_xstats_get,
 	.xstats_get_names         = otx2_nix_xstats_get_names,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
index 7d53a6643..814fd6ec3 100644
@@ -178,6 +178,12 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)
 void otx2_nix_info_get(struct rte_eth_dev *eth_dev,
 		       struct rte_eth_dev_info *dev_info);
 
+void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
+void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
+void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
+void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
+void otx2_nix_allmulticast_disable(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 +82 -0

88 lines not on this page · raw message

Signature · 1 line
2.21.0
#92 lore raw

PATCH v2 15/57 net/octeontx2: add unicast MAC filter

In reply to [email protected]

From: Sunil Kumar Kori <[email protected]>

Add unicast MAC filter for PF device and
update the respective feature list.

---
 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        |  3 +
 drivers/net/octeontx2/otx2_ethdev.h        |  6 ++
 drivers/net/octeontx2/otx2_mac.c           | 77 ++++++++++++++++++++++
 6 files changed, 89 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index 9f682609d..566496113 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
+Unicast MAC filter   = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 764e95ce6..195a48940 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
+Unicast MAC filter   = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 9ef7be08f..8385c9c18 100644
@@ -19,6 +19,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
+- MAC filtering
 - Port hardware statistics
 - Link state information
 - Debug utilities - Context dump and error interrupt support
drivers/net/octeontx2/otx2_ethdev.c +3 -0
index 826ce7f4e..a72c901f4 100644
@@ -237,6 +237,9 @@ 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,
+	.mac_addr_add             = otx2_nix_mac_addr_add,
+	.mac_addr_remove          = otx2_nix_mac_addr_del,
+	.mac_addr_set             = otx2_nix_mac_addr_set,
 	.promiscuous_enable       = otx2_nix_promisc_enable,
 	.promiscuous_disable      = otx2_nix_promisc_disable,
 	.allmulticast_enable      = otx2_nix_allmulticast_enable,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
index 814fd6ec3..56517845b 100644
@@ -232,7 +232,13 @@ int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 
 /* Mac address handling */
+int otx2_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
+			  struct rte_ether_addr *addr);
 int otx2_nix_mac_addr_get(struct rte_eth_dev *eth_dev, uint8_t *addr);
+int otx2_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
+			  struct rte_ether_addr *addr,
+			  uint32_t index, uint32_t pool);
+void otx2_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index);
 int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);
 
 /* Devargs */
drivers/net/octeontx2/otx2_mac.c +77 -0

83 lines not on this page · raw message

Signature · 1 line
2.21.0
#93 lore raw

PATCH v2 16/57 net/octeontx2: add RSS support

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

Add RSS support and expose RSS related functions
to implement RSS action for rte_flow driver.

---
 doc/guides/nics/features/octeontx2.ini     |   4 +
 doc/guides/nics/features/octeontx2_vec.ini |   4 +
 doc/guides/nics/features/octeontx2_vf.ini  |   4 +
 doc/guides/nics/octeontx2.rst              |   1 +
 drivers/net/octeontx2/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |  11 +
 drivers/net/octeontx2/otx2_ethdev.h        |  33 ++
 drivers/net/octeontx2/otx2_rss.c           | 372 +++++++++++++++++++++
 9 files changed, 431 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_rss.c
doc/guides/nics/features/octeontx2.ini +4 -0
index 566496113..f2d47d57b 100644
@@ -13,6 +13,10 @@ Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+Inner RSS            = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +4 -0
index 195a48940..a67353d2a 100644
@@ -13,6 +13,10 @@ Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+Inner RSS            = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/features/octeontx2_vf.ini +4 -0
index 6ec83e823..97d66ddde 100644
@@ -9,6 +9,10 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+Inner RSS            = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 8385c9c18..3bee3f3ca 100644
@@ -19,6 +19,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
+- Receiver Side Scaling (RSS)
 - MAC filtering
 - Port hardware statistics
 - Link state information
drivers/net/octeontx2/Makefile +1 -0
index fbe5e9f44..f9f9ae6e6 100644
@@ -28,6 +28,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
+	otx2_rss.c	\
 	otx2_mac.c	\
 	otx2_link.c	\
 	otx2_stats.c	\
drivers/net/octeontx2/meson.build +1 -0
index 1c57b1bb4..8681a2642 100644
@@ -3,6 +3,7 @@
 #
 
 sources = files(
+		'otx2_rss.c',
 		'otx2_mac.c',
 		'otx2_link.c',
 		'otx2_stats.c',
drivers/net/octeontx2/otx2_ethdev.c +11 -0
index a72c901f4..5289c79e8 100644
@@ -195,6 +195,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto fail;
 	}
 
+	/* Configure RSS */
+	rc = otx2_nix_rss_config(eth_dev);
+	if (rc) {
+		otx2_err("Failed to configure rss rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	/* Register queue IRQs */
 	rc = oxt2_nix_register_queue_irqs(eth_dev);
 	if (rc) {
@@ -245,6 +252,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.allmulticast_enable      = otx2_nix_allmulticast_enable,
 	.allmulticast_disable     = otx2_nix_allmulticast_disable,
 	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
+	.reta_update              = otx2_nix_dev_reta_update,
+	.reta_query               = otx2_nix_dev_reta_query,
+	.rss_hash_update          = otx2_nix_rss_hash_update,
+	.rss_hash_conf_get        = otx2_nix_rss_hash_conf_get,
 	.xstats_get               = otx2_nix_xstats_get,
 	.xstats_get_names         = otx2_nix_xstats_get_names,
 	.xstats_reset             = otx2_nix_xstats_reset,
drivers/net/octeontx2/otx2_ethdev.h +33 -0
index 56517845b..19a4e45b0 100644
@@ -59,6 +59,7 @@
 
 #define NIX_MAX_SQB			512
 #define NIX_MIN_SQB			32
+#define NIX_RSS_RETA_SIZE_MAX		256
 /* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/
 #define NIX_RSS_GRPS			8
 #define NIX_HASH_KEY_SIZE		48 /* 352 Bits */
@@ -112,14 +113,22 @@
 	DEV_RX_OFFLOAD_QINQ_STRIP | \
 	DEV_RX_OFFLOAD_TIMESTAMP)
 
+#define NIX_DEFAULT_RSS_CTX_GROUP  0
+#define NIX_DEFAULT_RSS_MCAM_IDX  -1
+
 struct otx2_qint {
 	struct rte_eth_dev *eth_dev;
 	uint8_t qintx;
 };
 
 struct otx2_rss_info {
+	uint64_t nix_rss;
+	uint32_t flowkey_cfg;
 	uint16_t rss_size;
 	uint8_t rss_grps;
+	uint8_t alg_idx; /* Selected algo index */
+	uint16_t ind_tbl[NIX_RSS_RETA_SIZE_MAX];
+	uint8_t key[NIX_HASH_KEY_SIZE];
 };
 
 struct otx2_npc_flow_info {
@@ -225,6 +234,30 @@ int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
 				    struct rte_eth_xstat_name *xstats_names,
 				    const uint64_t *ids, unsigned int limit);
 
+/* RSS */
+void otx2_nix_rss_set_key(struct otx2_eth_dev *dev,
+			  uint8_t *key, uint32_t key_len);
+uint32_t otx2_rss_ethdev_to_nix(struct otx2_eth_dev *dev,
+				uint64_t ethdev_rss, uint8_t rss_level);
+int otx2_rss_set_hf(struct otx2_eth_dev *dev,
+		    uint32_t flowkey_cfg, uint8_t *alg_idx,
+		    uint8_t group, int mcam_index);
+int otx2_nix_rss_tbl_init(struct otx2_eth_dev *dev, uint8_t group,
+			  uint16_t *ind_tbl);
+int otx2_nix_rss_config(struct rte_eth_dev *eth_dev);
+
+int otx2_nix_dev_reta_update(struct rte_eth_dev *eth_dev,
+			     struct rte_eth_rss_reta_entry64 *reta_conf,
+			     uint16_t reta_size);
+int otx2_nix_dev_reta_query(struct rte_eth_dev *eth_dev,
+			    struct rte_eth_rss_reta_entry64 *reta_conf,
+			    uint16_t reta_size);
+int otx2_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
+			     struct rte_eth_rss_conf *rss_conf);
+
+int otx2_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_rss_conf *rss_conf);
+
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_rss.c new file +372 -0

372 lines not on this page · raw message

Signature · 1 line
2.21.0
#94 lore raw

PATCH v2 17/57 net/octeontx2: add Rx queue setup and release

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add Rx queue setup and release.

---
 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/Makefile             |   2 +-
 drivers/net/octeontx2/otx2_ethdev.c        | 310 +++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h        |  51 ++++
 drivers/net/octeontx2/otx2_ethdev_ops.c    |   2 +
 mk/rte.app.mk                              |   2 +-
 8 files changed, 368 insertions(+), 2 deletions(-)
doc/guides/nics/features/octeontx2.ini +1 -0
index f2d47d57b..d0a2204d2 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index a67353d2a..64125a73f 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 97d66ddde..acda5e680 100644
@@ -9,6 +9,7 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
drivers/net/octeontx2/Makefile +1 -1
index f9f9ae6e6..f40561afb 100644
@@ -39,6 +39,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_ethdev_devargs.c
 
 LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
-LDLIBS += -lrte_ethdev -lrte_bus_pci -lrte_kvargs
+LDLIBS += -lrte_ethdev -lrte_bus_pci -lrte_kvargs -lrte_mbuf  -lrte_mempool -lm
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/otx2_ethdev.c +310 -0

331 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h +51 -0

87 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev_ops.c +2 -0
index 301a597f8..71d36b44a 100644
@@ -143,4 +143,6 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
 	devinfo->speed_capa |= ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |
 				ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G |
 				ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G;
+
+	devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP;
 }
mk/rte.app.mk +1 -1
index fab72ff6a..a852e5157 100644
@@ -196,7 +196,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD)      += -lrte_pmd_mvpp2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD)     += -lrte_pmd_mvneta
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)        += -lrte_pmd_nfp
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)       += -lrte_pmd_null
-_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)  += -lrte_pmd_octeontx2
+_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)  += -lrte_pmd_octeontx2 -lm
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lrte_pmd_pcap -lpcap
 _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)       += -lrte_pmd_qede
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)       += -lrte_pmd_ring
Signature · 1 line
2.21.0
#95 lore raw

PATCH v2 18/57 net/octeontx2: add Tx queue setup and release

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add Tx queue setup and release.

---
 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              |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        | 385 ++++++++++++++++++++-
 drivers/net/octeontx2/otx2_ethdev.h        |  25 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    |   3 +-
 drivers/net/octeontx2/otx2_tx.h            |  28 ++
 8 files changed, 443 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/octeontx2/otx2_tx.h
doc/guides/nics/features/octeontx2.ini +1 -0
index d0a2204d2..c8f07fa1d 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 64125a73f..a98b7d523 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index acda5e680..9746357ce 100644
@@ -10,6 +10,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 3bee3f3ca..d7e8f3d56 100644
@@ -19,6 +19,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
+- Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
 - MAC filtering
 - Port hardware statistics
drivers/net/octeontx2/otx2_ethdev.c +384 -1

408 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h +25 -0
index a09393336..0ce67f634 100644
@@ -19,6 +19,7 @@
 #include "otx2_irq.h"
 #include "otx2_mempool.h"
 #include "otx2_rx.h"
+#include "otx2_tx.h"
 
 #define OTX2_ETH_DEV_PMD_VERSION	"1.0"
 
@@ -62,6 +63,7 @@
 
 #define NIX_MAX_SQB			512
 #define NIX_MIN_SQB			32
+#define NIX_SQB_LIST_SPACE		2
 #define NIX_RSS_RETA_SIZE_MAX		256
 /* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/
 #define NIX_RSS_GRPS			8
@@ -72,6 +74,8 @@
 #define NIX_RX_NB_SEG_MAX		6
 #define NIX_CQ_ENTRY_SZ			128
 #define NIX_CQ_ALIGN			512
+#define NIX_SQB_LOWER_THRESH		90
+#define LMT_SLOT_MASK			0x7f
 
 /* If PTP is enabled additional SEND MEM DESC is required which
  * takes 2 words, hence max 7 iova address are possible
@@ -204,6 +208,24 @@ struct otx2_eth_dev {
 	struct rte_eth_dev *eth_dev;
 } __rte_cache_aligned;
 
+struct otx2_eth_txq {
+	uint64_t cmd[8];
+	int64_t fc_cache_pkts;
+	uint64_t *fc_mem;
+	void *lmt_addr;
+	rte_iova_t io_addr;
+	rte_iova_t fc_iova;
+	uint16_t sqes_per_sqb_log2;
+	int16_t nb_sqb_bufs_adj;
+	MARKER slow_path_start;
+	uint16_t nb_sqb_bufs;
+	uint16_t sq;
+	uint64_t offloads;
+	struct otx2_eth_dev *dev;
+	struct rte_mempool *sqb_pool;
+	struct otx2_eth_qconf qconf;
+} __rte_cache_aligned;
+
 struct otx2_eth_rxq {
 	uint64_t mbuf_initializer;
 	uint64_t data_off;
@@ -329,4 +351,7 @@ int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);
 int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct otx2_eth_dev *dev);
 
+/* Rx and Tx routines */
+void otx2_nix_form_default_desc(struct otx2_eth_txq *txq);
+
 #endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ethdev_ops.c +2 -1
index 71d36b44a..1c935b627 100644
@@ -144,5 +144,6 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
 				ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G |
 				ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G;
 
-	devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP;
+	devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
+				RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
 }
drivers/net/octeontx2/otx2_tx.h new file +28 -0
new file mode 100644
index 000000000..4d0993f87
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_TX_H__
+#define __OTX2_TX_H__
+
+#define NIX_TX_OFFLOAD_NONE		(0)
+#define NIX_TX_OFFLOAD_L3_L4_CSUM_F	BIT(0)
+#define NIX_TX_OFFLOAD_OL3_OL4_CSUM_F	BIT(1)
+#define NIX_TX_OFFLOAD_VLAN_QINQ_F	BIT(2)
+#define NIX_TX_OFFLOAD_MBUF_NOFF_F	BIT(3)
+#define NIX_TX_OFFLOAD_TSTAMP_F		BIT(4)
+
+/* Flags to control xmit_prepare function.
+ * Defining it from backwards to denote its been
+ * not used as offload flags to pick function
+ */
+#define NIX_TX_MULTI_SEG_F		BIT(15)
+
+#define NIX_TX_NEED_SEND_HDR_W1	\
+	(NIX_TX_OFFLOAD_L3_L4_CSUM_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |	\
+	 NIX_TX_OFFLOAD_VLAN_QINQ_F)
+
+#define NIX_TX_NEED_EXT_HDR \
+	(NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F)
+
+#endif /* __OTX2_TX_H__ */
Signature · 1 line
2.21.0
#96 lore raw

PATCH v2 19/57 net/octeontx2: handle port reconfigure

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

setup tx & rx queues with the previous configuration during port reconfig, it handles cases like port reconfigure without reconfiguring tx & rx queues.

---
 drivers/net/octeontx2/otx2_ethdev.c | 180 ++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h |   2 +
 2 files changed, 182 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +180 -0
index 62943cc31..bc6e8fb8a 100644
@@ -788,6 +788,172 @@ otx2_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t sq,
 	return rc;
 }
 
+static int
+nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct otx2_eth_qconf *tx_qconf = NULL;
+	struct otx2_eth_qconf *rx_qconf = NULL;
+	struct otx2_eth_txq **txq;
+	struct otx2_eth_rxq **rxq;
+	int i, nb_rxq, nb_txq;
+
+	nb_rxq = RTE_MIN(dev->configured_nb_rx_qs, eth_dev->data->nb_rx_queues);
+	nb_txq = RTE_MIN(dev->configured_nb_tx_qs, eth_dev->data->nb_tx_queues);
+
+	tx_qconf = malloc(nb_txq * sizeof(*tx_qconf));
+	if (tx_qconf == NULL) {
+		otx2_err("Failed to allocate memory for tx_qconf");
+		goto fail;
+	}
+
+	rx_qconf = malloc(nb_rxq * sizeof(*rx_qconf));
+	if (rx_qconf == NULL) {
+		otx2_err("Failed to allocate memory for rx_qconf");
+		goto fail;
+	}
+
+	txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
+	for (i = 0; i < nb_txq; i++) {
+		if (txq[i] == NULL) {
+			otx2_err("txq[%d] is already released", i);
+			goto fail;
+		}
+		memcpy(&tx_qconf[i], &txq[i]->qconf, sizeof(*tx_qconf));
+		otx2_nix_tx_queue_release(txq[i]);
+		eth_dev->data->tx_queues[i] = NULL;
+	}
+
+	rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues;
+	for (i = 0; i < nb_rxq; i++) {
+		if (rxq[i] == NULL) {
+			otx2_err("rxq[%d] is already released", i);
+			goto fail;
+		}
+		memcpy(&rx_qconf[i], &rxq[i]->qconf, sizeof(*rx_qconf));
+		otx2_nix_rx_queue_release(rxq[i]);
+		eth_dev->data->rx_queues[i] = NULL;
+	}
+
+	dev->tx_qconf = tx_qconf;
+	dev->rx_qconf = rx_qconf;
+	return 0;
+
+fail:
+	if (tx_qconf)
+		free(tx_qconf);
+	if (rx_qconf)
+		free(rx_qconf);
+
+	return -ENOMEM;
+}
+
+static int
+nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct otx2_eth_qconf *tx_qconf = dev->tx_qconf;
+	struct otx2_eth_qconf *rx_qconf = dev->rx_qconf;
+	struct otx2_eth_txq **txq;
+	struct otx2_eth_rxq **rxq;
+	int rc, i, nb_rxq, nb_txq;
+
+	nb_rxq = RTE_MIN(dev->configured_nb_rx_qs, eth_dev->data->nb_rx_queues);
+	nb_txq = RTE_MIN(dev->configured_nb_tx_qs, eth_dev->data->nb_tx_queues);
+
+	rc = -ENOMEM;
+	/* Setup tx & rx queues with previous configuration so
+	 * that the queues can be functional in cases like ports
+	 * are started without re configuring queues.
+	 *
+	 * Usual re config sequence is like below:
+	 * port_configure() {
+	 *      if(reconfigure) {
+	 *              queue_release()
+	 *              queue_setup()
+	 *      }
+	 *      queue_configure() {
+	 *              queue_release()
+	 *              queue_setup()
+	 *      }
+	 * }
+	 * port_start()
+	 *
+	 * In some application's control path, queue_configure() would
+	 * NOT be invoked for TXQs/RXQs in port_configure().
+	 * In such cases, queues can be functional after start as the
+	 * queues are already setup in port_configure().
+	 */
+	for (i = 0; i < nb_txq; i++) {
+		rc = otx2_nix_tx_queue_setup(eth_dev, i, tx_qconf[i].nb_desc,
+					     tx_qconf[i].socket_id,
+					     &tx_qconf[i].conf.tx);
+		if (rc) {
+			otx2_err("Failed to setup tx queue rc=%d", rc);
+			txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
+			for (i -= 1; i >= 0; i--)
+				otx2_nix_tx_queue_release(txq[i]);
+			goto fail;
+		}
+	}
+
+	free(tx_qconf); tx_qconf = NULL;
+
+	for (i = 0; i < nb_rxq; i++) {
+		rc = otx2_nix_rx_queue_setup(eth_dev, i, rx_qconf[i].nb_desc,
+					     rx_qconf[i].socket_id,
+					     &rx_qconf[i].conf.rx,
+					     rx_qconf[i].mempool);
+		if (rc) {
+			otx2_err("Failed to setup rx queue rc=%d", rc);
+			rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues;
+			for (i -= 1; i >= 0; i--)
+				otx2_nix_rx_queue_release(rxq[i]);
+			goto release_tx_queues;
+		}
+	}
+
+	free(rx_qconf); rx_qconf = NULL;
+
+	return 0;
+
+release_tx_queues:
+	txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+		otx2_nix_tx_queue_release(txq[i]);
+fail:
+	if (tx_qconf)
+		free(tx_qconf);
+	if (rx_qconf)
+		free(rx_qconf);
+
+	return rc;
+}
+
+static uint16_t
+nix_eth_nop_burst(void *queue, struct rte_mbuf **mbufs, uint16_t pkts)
+{
+	RTE_SET_USED(queue);
+	RTE_SET_USED(mbufs);
+	RTE_SET_USED(pkts);
+
+	return 0;
+}
+
+static void
+nix_set_nop_rxtx_function(struct rte_eth_dev *eth_dev)
+{
+	/* These dummy functions are required for supporting
+	 * some applications which reconfigure queues without
+	 * stopping tx burst and rx burst threads(eg kni app)
+	 * When the queues context is saved, txq/rxqs are released
+	 * which caused app crash since rx/tx burst is still
+	 * on different lcores
+	 */
+	eth_dev->tx_pkt_burst = nix_eth_nop_burst;
+	eth_dev->rx_pkt_burst = nix_eth_nop_burst;
+	rte_mb();
+}
 
 static int
 otx2_nix_configure(struct rte_eth_dev *eth_dev)
@@ -844,6 +1010,10 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 	/* Free the resources allocated from the previous configure */
 	if (dev->configured == 1) {
 		oxt2_nix_unregister_queue_irqs(eth_dev);
+		nix_set_nop_rxtx_function(eth_dev);
+		rc = nix_store_queue_cfg_and_then_release(eth_dev);
+		if (rc)
+			goto fail;
 		nix_lf_free(dev);
 	}
 
@@ -884,6 +1054,16 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto free_nix_lf;
 	}
 
+	/*
+	 * Restore queue config when reconfigure followed by
+	 * reconfigure and no queue configure invoked from application case.
+	 */
+	if (dev->configured == 1) {
+		rc = nix_restore_queue_cfg(eth_dev);
+		if (rc)
+			goto free_nix_lf;
+	}
+
 	/* Update the mac address */
 	ea = eth_dev->data->mac_addrs;
 	memcpy(ea, dev->mac_addr, RTE_ETHER_ADDR_LEN);
drivers/net/octeontx2/otx2_ethdev.h +2 -0
index 0ce67f634..ffc350e0d 100644
@@ -205,6 +205,8 @@ struct otx2_eth_dev {
 	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	struct otx2_npc_flow_info npc_flow;
+	struct otx2_eth_qconf *tx_qconf;
+	struct otx2_eth_qconf *rx_qconf;
 	struct rte_eth_dev *eth_dev;
 } __rte_cache_aligned;
 
Signature · 1 line
2.21.0
#97 lore raw

PATCH v2 20/57 net/octeontx2: add queue start and stop operations

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Add queue start and stop operations. Tx queue needs to update the flow control value, Which will be added in sub subsequent patch.

---
 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        | 92 ++++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h        |  2 +
 5 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index c8f07fa1d..ca40358da 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index a98b7d523..b720c116f 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 9746357ce..5a287493f 100644
@@ -11,6 +11,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
drivers/net/octeontx2/otx2_ethdev.c +92 -0

110 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h +2 -0
index ffc350e0d..4e06b7111 100644
@@ -266,6 +266,8 @@ void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
+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);
 
 /* Link */
Signature · 1 line
2.21.0
#98 lore raw

PATCH v2 21/57 net/octeontx2: introduce traffic manager

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Introduce traffic manager infra and default hierarchy creation.

Upon ethdev configure, a default hierarchy is created with one-to-one mapped tm nodes. This topology will be overridden when user explicitly creates and commits a new hierarchy using rte_tm interface.

---
 drivers/net/octeontx2/Makefile      |   1 +
 drivers/net/octeontx2/meson.build   |   1 +
 drivers/net/octeontx2/otx2_ethdev.c |  16 ++
 drivers/net/octeontx2/otx2_ethdev.h |  14 ++
 drivers/net/octeontx2/otx2_tm.c     | 252 ++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_tm.h     |  67 ++++++++
 6 files changed, 351 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_tm.c
 create mode 100644 drivers/net/octeontx2/otx2_tm.h
drivers/net/octeontx2/Makefile +1 -0
index f40561afb..164621087 100644
@@ -28,6 +28,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
+	otx2_tm.c	\
 	otx2_rss.c	\
 	otx2_mac.c	\
 	otx2_link.c	\
drivers/net/octeontx2/meson.build +1 -0
index 8681a2642..e344d877f 100644
@@ -3,6 +3,7 @@
 #
 
 sources = files(
+		'otx2_tm.c',
 		'otx2_rss.c',
 		'otx2_mac.c',
 		'otx2_link.c',
drivers/net/octeontx2/otx2_ethdev.c +16 -0
index c8271b1ab..899865749 100644
@@ -1034,6 +1034,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		rc = nix_store_queue_cfg_and_then_release(eth_dev);
 		if (rc)
 			goto fail;
+		otx2_nix_tm_fini(eth_dev);
 		nix_lf_free(dev);
 	}
 
@@ -1067,6 +1068,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto free_nix_lf;
 	}
 
+	/* Init the default TM scheduler hierarchy */
+	rc = otx2_nix_tm_init_default(eth_dev);
+	if (rc) {
+		otx2_err("Failed to init traffic manager rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	/* Register queue IRQs */
 	rc = oxt2_nix_register_queue_irqs(eth_dev);
 	if (rc) {
@@ -1369,6 +1377,9 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 	/* Also sync same MAC address to CGX table */
 	otx2_cgx_mac_addr_set(eth_dev, &eth_dev->data->mac_addrs[0]);
 
+	/* Initialize the tm data structures */
+	otx2_nix_tm_conf_init(eth_dev);
+
 	dev->tx_offload_capa = nix_get_tx_offload_capa(dev);
 	dev->rx_offload_capa = nix_get_rx_offload_capa(dev);
 
@@ -1424,6 +1435,11 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	}
 	eth_dev->data->nb_rx_queues = 0;
 
+	/* Free tm resources */
+	rc = otx2_nix_tm_fini(eth_dev);
+	if (rc)
+		otx2_err("Failed to cleanup tm, rc=%d", rc);
+
 	/* Unregister queue irqs */
 	oxt2_nix_unregister_queue_irqs(eth_dev);
 
drivers/net/octeontx2/otx2_ethdev.h +14 -0
index 4e06b7111..9f73bf89b 100644
@@ -19,6 +19,7 @@
 #include "otx2_irq.h"
 #include "otx2_mempool.h"
 #include "otx2_rx.h"
+#include "otx2_tm.h"
 #include "otx2_tx.h"
 
 #define OTX2_ETH_DEV_PMD_VERSION	"1.0"
@@ -201,6 +202,19 @@ struct otx2_eth_dev {
 	uint64_t rx_offload_capa;
 	uint64_t tx_offload_capa;
 	struct otx2_qint qints_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];
+	uint16_t txschq_contig_index[NIX_TXSCH_LVL_CNT];
+	/* Dis-contiguous queues */
+	uint16_t txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	/* Contiguous queues */
+	uint16_t txschq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	uint16_t otx2_tm_root_lvl;
+	uint16_t tm_flags;
+	uint16_t tm_leaf_cnt;
+	struct otx2_nix_tm_node_list node_list;
+	struct otx2_nix_tm_shaper_profile_list shaper_profile_list;
 	struct otx2_rss_info rss_info;
 	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
drivers/net/octeontx2/otx2_tm.c new file +252 -0

252 lines not on this page · raw message

drivers/net/octeontx2/otx2_tm.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.21.0
#99 lore raw

PATCH v2 22/57 net/octeontx2: alloc and free TM HW resources

In reply to [email protected]

From: Krzysztof Kanas <[email protected]>

Allocate and free shaper/scheduler hardware resources for nodes of hirearchy levels in sw.

---
 drivers/net/octeontx2/otx2_tm.c | 350 ++++++++++++++++++++++++++++++++
 1 file changed, 350 insertions(+)
drivers/net/octeontx2/otx2_tm.c +350 -0
index bc0474242..91f31df05 100644
@@ -54,6 +54,69 @@ nix_tm_node_search(struct otx2_eth_dev *dev,
 	return NULL;
 }
 
+static uint32_t
+check_rr(struct otx2_eth_dev *dev, uint32_t priority, uint32_t parent_id)
+{
+	struct otx2_nix_tm_node *tm_node;
+	uint32_t rr_num = 0;
+
+	TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+		if (!tm_node->parent)
+			continue;
+
+		if (!(tm_node->parent->id == parent_id))
+			continue;
+
+		if (tm_node->priority == priority)
+			rr_num++;
+	}
+	return rr_num;
+}
+
+static int
+nix_tm_update_parent_info(struct otx2_eth_dev *dev)
+{
+	struct otx2_nix_tm_node *tm_node_child;
+	struct otx2_nix_tm_node *tm_node;
+	struct otx2_nix_tm_node *parent;
+	uint32_t rr_num = 0;
+	uint32_t priority;
+
+	TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+		if (!tm_node->parent)
+			continue;
+		/* Count group of children of same priority i.e are RR */
+		parent = tm_node->parent;
+		priority = tm_node->priority;
+		rr_num = check_rr(dev, priority, parent->id);
+
+		/* Assuming that multiple RR groups are
+		 * not configured based on capability.
+		 */
+		if (rr_num > 1) {
+			parent->rr_prio = priority;
+			parent->rr_num = rr_num;
+		}
+
+		/* Find out static priority children that are not in RR */
+		TAILQ_FOREACH(tm_node_child, &dev->node_list, node) {
+			if (!tm_node_child->parent)
+				continue;
+			if (parent->id != tm_node_child->parent->id)
+				continue;
+			if (parent->max_prio == UINT32_MAX &&
+			    tm_node_child->priority != parent->rr_prio)
+				parent->max_prio = 0;
+
+			if (parent->max_prio < tm_node_child->priority &&
+			    parent->rr_prio != tm_node_child->priority)
+				parent->max_prio = tm_node_child->priority;
+		}
+	}
+
+	return 0;
+}
+
 static int
 nix_tm_node_add_to_list(struct otx2_eth_dev *dev, uint32_t node_id,
 			uint32_t parent_node_id, uint32_t priority,
@@ -115,6 +178,274 @@ nix_tm_clear_shaper_profiles(struct otx2_eth_dev *dev)
 	return 0;
 }
 
+static int
+nix_tm_free_resources(struct otx2_eth_dev *dev, uint32_t flags_mask,
+		      uint32_t flags, bool hw_only)
+{
+	struct otx2_nix_tm_shaper_profile *shaper_profile;
+	struct otx2_nix_tm_node *tm_node, *next_node;
+	struct otx2_mbox *mbox = dev->mbox;
+	struct nix_txsch_free_req *req;
+	uint32_t shaper_profile_id;
+	bool skip_node = false;
+	int rc = 0;
+
+	next_node = TAILQ_FIRST(&dev->node_list);
+	while (next_node) {
+		tm_node = next_node;
+		next_node = TAILQ_NEXT(tm_node, node);
+
+		/* Check for only requested nodes */
+		if ((tm_node->flags & flags_mask) != flags)
+			continue;
+
+		if (nix_tm_have_tl1_access(dev) &&
+		    tm_node->hw_lvl_id ==  NIX_TXSCH_LVL_TL1)
+			skip_node = true;
+
+		otx2_tm_dbg("Free hwres for node %u, hwlvl %u, hw_id %u (%p)",
+			    tm_node->id,  tm_node->hw_lvl_id,
+			    tm_node->hw_id, tm_node);
+		/* Free specific HW resource if requested */
+		if (!skip_node && flags_mask &&
+		    tm_node->flags & NIX_TM_NODE_HWRES) {
+			req = otx2_mbox_alloc_msg_nix_txsch_free(mbox);
+			req->flags = 0;
+			req->schq_lvl = tm_node->hw_lvl_id;
+			req->schq = tm_node->hw_id;
+			rc = otx2_mbox_process(mbox);
+			if (rc)
+				break;
+		} else {
+			skip_node = false;
+		}
+		tm_node->flags &= ~NIX_TM_NODE_HWRES;
+
+		/* Leave software elements if needed */
+		if (hw_only)
+			continue;
+
+		shaper_profile_id = tm_node->params.shaper_profile_id;
+		shaper_profile =
+			nix_tm_shaper_profile_search(dev, shaper_profile_id);
+		if (shaper_profile)
+			shaper_profile->reference_count--;
+
+		TAILQ_REMOVE(&dev->node_list, tm_node, node);
+		rte_free(tm_node);
+	}
+
+	if (!flags_mask) {
+		/* Free all hw resources */
+		req = otx2_mbox_alloc_msg_nix_txsch_free(mbox);
+		req->flags = TXSCHQ_FREE_ALL;
+
+		return otx2_mbox_process(mbox);
+	}
+
+	return rc;
+}
+
+static uint8_t
+nix_tm_copy_rsp_to_dev(struct otx2_eth_dev *dev,
+		       struct nix_txsch_alloc_rsp *rsp)
+{
+	uint16_t schq;
+	uint8_t lvl;
+
+	for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++) {
+		for (schq = 0; schq < MAX_TXSCHQ_PER_FUNC; schq++) {
+			dev->txschq_list[lvl][schq] = rsp->schq_list[lvl][schq];
+			dev->txschq_contig_list[lvl][schq] =
+				rsp->schq_contig_list[lvl][schq];
+		}
+
+		dev->txschq[lvl] = rsp->schq[lvl];
+		dev->txschq_contig[lvl] = rsp->schq_contig[lvl];
+	}
+	return 0;
+}
+
+static int
+nix_tm_assign_id_to_node(struct otx2_eth_dev *dev,
+			 struct otx2_nix_tm_node *child,
+			 struct otx2_nix_tm_node *parent)
+{
+	uint32_t hw_id, schq_con_index, prio_offset;
+	uint32_t l_id, schq_index;
+
+	otx2_tm_dbg("Assign hw id for child node %u, lvl %u, hw_lvl %u (%p)",
+		    child->id, child->level_id, child->hw_lvl_id, child);
+
+	child->flags |= NIX_TM_NODE_HWRES;
+
+	/* Process root nodes */
+	if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL2 &&
+	    child->hw_lvl_id == dev->otx2_tm_root_lvl && !parent) {
+		int idx = 0;
+		uint32_t tschq_con_index;
+
+		l_id = child->hw_lvl_id;
+		tschq_con_index = dev->txschq_contig_index[l_id];
+		hw_id = dev->txschq_contig_list[l_id][tschq_con_index];
+		child->hw_id = hw_id;
+		dev->txschq_contig_index[l_id]++;
+		/* Update TL1 hw_id for its parent for config purpose */
+		idx = dev->txschq_index[NIX_TXSCH_LVL_TL1]++;
+		hw_id = dev->txschq_list[NIX_TXSCH_LVL_TL1][idx];
+		child->parent_hw_id = hw_id;
+		return 0;
+	}
+	if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL1 &&
+	    child->hw_lvl_id == dev->otx2_tm_root_lvl && !parent) {
+		uint32_t tschq_con_index;
+
+		l_id = child->hw_lvl_id;
+		tschq_con_index = dev->txschq_index[l_id];
+		hw_id = dev->txschq_list[l_id][tschq_con_index];
+		child->hw_id = hw_id;
+		dev->txschq_index[l_id]++;
+		return 0;
+	}
+
+	/* Process children with parents */
+	l_id = child->hw_lvl_id;
+	schq_index = dev->txschq_index[l_id];
+	schq_con_index = dev->txschq_contig_index[l_id];
+
+	if (child->priority == parent->rr_prio) {
+		hw_id = dev->txschq_list[l_id][schq_index];
+		child->hw_id = hw_id;
+		child->parent_hw_id = parent->hw_id;
+		dev->txschq_index[l_id]++;
+	} else {
+		prio_offset = schq_con_index + child->priority;
+		hw_id = dev->txschq_contig_list[l_id][prio_offset];
+		child->hw_id = hw_id;
+	}
+	return 0;
+}
+
+static int
+nix_tm_assign_hw_id(struct otx2_eth_dev *dev)
+{
+	struct otx2_nix_tm_node *parent, *child;
+	uint32_t child_hw_lvl, con_index_inc, i;
+
+	for (i = NIX_TXSCH_LVL_TL1; i > 0; i--) {
+		TAILQ_FOREACH(parent, &dev->node_list, node) {
+			child_hw_lvl = parent->hw_lvl_id - 1;
+			if (parent->hw_lvl_id != i)
+				continue;
+			TAILQ_FOREACH(child, &dev->node_list, node) {
+				if (!child->parent)
+					continue;
+				if (child->parent->id != parent->id)
+					continue;
+				nix_tm_assign_id_to_node(dev, child, parent);
+			}
+
+			con_index_inc = parent->max_prio + 1;
+			dev->txschq_contig_index[child_hw_lvl] += con_index_inc;
+
+			/*
+			 * Explicitly assign id to parent node if it
+			 * doesn't have a parent
+			 */
+			if (parent->hw_lvl_id == dev->otx2_tm_root_lvl)
+				nix_tm_assign_id_to_node(dev, parent, NULL);
+		}
+	}
+	return 0;
+}
+
+static uint8_t
+nix_tm_count_req_schq(struct otx2_eth_dev *dev,
+		      struct nix_txsch_alloc_req *req, uint8_t lvl)
+{
+	struct otx2_nix_tm_node *tm_node;
+	uint8_t contig_count;
+
+	TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+		if (lvl == tm_node->hw_lvl_id) {
+			req->schq[lvl - 1] += tm_node->rr_num;
+			if (tm_node->max_prio != UINT32_MAX) {
+				contig_count = tm_node->max_prio + 1;
+				req->schq_contig[lvl - 1] += contig_count;
+			}
+		}
+		if (lvl == dev->otx2_tm_root_lvl &&
+		    dev->otx2_tm_root_lvl && lvl == NIX_TXSCH_LVL_TL2 &&
+		    tm_node->hw_lvl_id == dev->otx2_tm_root_lvl) {
+			req->schq_contig[dev->otx2_tm_root_lvl]++;
+		}
+	}
+
+	req->schq[NIX_TXSCH_LVL_TL1] = 1;
+	req->schq_contig[NIX_TXSCH_LVL_TL1] = 0;
+
+	return 0;
+}
+
+static int
+nix_tm_prepare_txschq_req(struct otx2_eth_dev *dev,
+			  struct nix_txsch_alloc_req *req)
+{
+	uint8_t i;
+
+	for (i = NIX_TXSCH_LVL_TL1; i > 0; i--)
+		nix_tm_count_req_schq(dev, req, i);
+
+	for (i = 0; i < NIX_TXSCH_LVL_CNT; i++) {
+		dev->txschq_index[i] = 0;
+		dev->txschq_contig_index[i] = 0;
+	}
+	return 0;
+}
+
+static int
+nix_tm_send_txsch_alloc_msg(struct otx2_eth_dev *dev)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+	struct nix_txsch_alloc_req *req;
+	struct nix_txsch_alloc_rsp *rsp;
+	int rc;
+
+	req = otx2_mbox_alloc_msg_nix_txsch_alloc(mbox);
+
+	rc = nix_tm_prepare_txschq_req(dev, req);
+	if (rc)
+		return rc;
+
+	rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
+	if (rc)
+		return rc;
+
+	nix_tm_copy_rsp_to_dev(dev, rsp);
+
+	nix_tm_assign_hw_id(dev);
+	return 0;
+}
+
+static int
+nix_tm_alloc_resources(struct rte_eth_dev *eth_dev, bool xmit_enable)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	int rc;
+
+	RTE_SET_USED(xmit_enable);
+
+	nix_tm_update_parent_info(dev);
+
+	rc = nix_tm_send_txsch_alloc_msg(dev);
+	if (rc) {
+		otx2_err("TM failed to alloc tm resources=%d", rc);
+		return rc;
+	}
+
+	return 0;
+}
+
 static int
 nix_tm_prepare_default_tree(struct rte_eth_dev *eth_dev)
 {
@@ -226,6 +557,13 @@ int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev)
 	uint16_t sq_cnt = eth_dev->data->nb_tx_queues;
 	int rc;
 
+	/* Free up all resources already held */
+	rc = nix_tm_free_resources(dev, 0, 0, false);
+	if (rc) {
+		otx2_err("Failed to freeup existing resources,rc=%d", rc);
+		return rc;
+	}
+
 	/* Clear shaper profiles */
 	nix_tm_clear_shaper_profiles(dev);
 	dev->tm_flags = NIX_TM_DEFAULT_TREE;
@@ -234,6 +572,9 @@ int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev)
 	if (rc != 0)
 		return rc;
 
+	rc = nix_tm_alloc_resources(eth_dev, false);
+	if (rc != 0)
+		return rc;
 	dev->tm_leaf_cnt = sq_cnt;
 
 	return 0;
@@ -243,6 +584,15 @@ int
 otx2_nix_tm_fini(struct rte_eth_dev *eth_dev)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	int rc;
+
+	/* Xmit is assumed to be disabled */
+	/* Free up resources already held */
+	rc = nix_tm_free_resources(dev, 0, 0, false);
+	if (rc) {
+		otx2_err("Failed to freeup existing resources,rc=%d", rc);
+		return rc;
+	}
 
 	/* Clear shaper profiles */
 	nix_tm_clear_shaper_profiles(dev);
Signature · 1 line
2.21.0
#100 lore raw

PATCH v2 23/57 net/octeontx2: configure TM HW resources

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

This patch sets up and configure hierarchy in hw nodes. Since all the registers are with RVU AF, register configuration is also done using mbox communication.

---
 drivers/net/octeontx2/otx2_tm.c | 504 ++++++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_tm.h |  82 ++++++
 2 files changed, 586 insertions(+)
drivers/net/octeontx2/otx2_tm.c +504 -0
index 91f31df05..c6154e4d4 100644
@@ -20,6 +20,41 @@ enum otx2_tm_node_level {
 	OTX2_TM_LVL_MAX,
 };
 
+static inline
+uint64_t shaper2regval(struct shaper_params *shaper)
+{
+	return (shaper->burst_exponent << 37) | (shaper->burst_mantissa << 29) |
+		(shaper->div_exp << 13) | (shaper->exponent << 9) |
+		(shaper->mantissa << 1);
+}
+
+static int
+nix_get_link(struct otx2_eth_dev *dev)
+{
+	int link = 13 /* SDP */;
+	uint16_t lmac_chan;
+	uint16_t map;
+
+	lmac_chan = dev->tx_chan_base;
+
+	/* CGX lmac link */
+	if (lmac_chan >= 0x800) {
+		map = lmac_chan & 0x7FF;
+		link = 4 * ((map >> 8) & 0xF) + ((map >> 4) & 0xF);
+	} else if (lmac_chan < 0x700) {
+		/* LBK channel */
+		link = 12;
+	}
+
+	return link;
+}
+
+static uint8_t
+nix_get_relchan(struct otx2_eth_dev *dev)
+{
+	return dev->tx_chan_base & 0xff;
+}
+
 static bool
 nix_tm_have_tl1_access(struct otx2_eth_dev *dev)
 {
@@ -28,6 +63,24 @@ nix_tm_have_tl1_access(struct otx2_eth_dev *dev)
 		!is_lbk && !dev->maxvf;
 }
 
+static int
+find_prio_anchor(struct otx2_eth_dev *dev, uint32_t node_id)
+{
+	struct otx2_nix_tm_node *child_node;
+
+	TAILQ_FOREACH(child_node, &dev->node_list, node) {
+		if (!child_node->parent)
+			continue;
+		if (!(child_node->parent->id == node_id))
+			continue;
+		if (child_node->priority == child_node->parent->rr_prio)
+			continue;
+		return child_node->hw_id - child_node->priority;
+	}
+	return 0;
+}
+
+
 static struct otx2_nix_tm_shaper_profile *
 nix_tm_shaper_profile_search(struct otx2_eth_dev *dev, uint32_t shaper_id)
 {
@@ -40,6 +93,451 @@ nix_tm_shaper_profile_search(struct otx2_eth_dev *dev, uint32_t shaper_id)
 	return NULL;
 }
 
+static inline uint64_t
+shaper_rate_to_nix(uint64_t cclk_hz, uint64_t cclk_ticks,
+		   uint64_t value, uint64_t *exponent_p,
+		   uint64_t *mantissa_p, uint64_t *div_exp_p)
+{
+	uint64_t div_exp, exponent, mantissa;
+
+	/* Boundary checks */
+	if (value < MIN_SHAPER_RATE(cclk_hz, cclk_ticks) ||
+	    value > MAX_SHAPER_RATE(cclk_hz, cclk_ticks))
+		return 0;
+
+	if (value <= SHAPER_RATE(cclk_hz, cclk_ticks, 0, 0, 0)) {
+		/* Calculate rate div_exp and mantissa using
+		 * the following formula:
+		 *
+		 * value = (cclk_hz * (256 + mantissa)
+		 *              / ((cclk_ticks << div_exp) * 256)
+		 */
+		div_exp = 0;
+		exponent = 0;
+		mantissa = MAX_RATE_MANTISSA;
+
+		while (value < (cclk_hz / (cclk_ticks << div_exp)))
+			div_exp += 1;
+
+		while (value <
+		       ((cclk_hz * (256 + mantissa)) /
+			((cclk_ticks << div_exp) * 256)))
+			mantissa -= 1;
+	} else {
+		/* Calculate rate exponent and mantissa using
+		 * the following formula:
+		 *
+		 * value = (cclk_hz * ((256 + mantissa) << exponent)
+		 *              / (cclk_ticks * 256)
+		 *
+		 */
+		div_exp = 0;
+		exponent = MAX_RATE_EXPONENT;
+		mantissa = MAX_RATE_MANTISSA;
+
+		while (value < (cclk_hz * (1 << exponent)) / cclk_ticks)
+			exponent -= 1;
+
+		while (value < (cclk_hz * ((256 + mantissa) << exponent)) /
+		       (cclk_ticks * 256))
+			mantissa -= 1;
+	}
+
+	if (div_exp > MAX_RATE_DIV_EXP ||
+	    exponent > MAX_RATE_EXPONENT || mantissa > MAX_RATE_MANTISSA)
+		return 0;
+
+	if (div_exp_p)
+		*div_exp_p = div_exp;
+	if (exponent_p)
+		*exponent_p = exponent;
+	if (mantissa_p)
+		*mantissa_p = mantissa;
+
+	/* Calculate real rate value */
+	return SHAPER_RATE(cclk_hz, cclk_ticks, exponent, mantissa, div_exp);
+}
+
+static inline uint64_t
+lx_shaper_rate_to_nix(uint64_t cclk_hz, uint32_t hw_lvl,
+		      uint64_t value, uint64_t *exponent,
+		      uint64_t *mantissa, uint64_t *div_exp)
+{
+	if (hw_lvl == NIX_TXSCH_LVL_TL1)
+		return shaper_rate_to_nix(cclk_hz, L1_TIME_WHEEL_CCLK_TICKS,
+					  value, exponent, mantissa, div_exp);
+	else
+		return shaper_rate_to_nix(cclk_hz, LX_TIME_WHEEL_CCLK_TICKS,
+					  value, exponent, mantissa, div_exp);
+}
+
+static inline uint64_t
+shaper_burst_to_nix(uint64_t value, uint64_t *exponent_p,
+		    uint64_t *mantissa_p)
+{
+	uint64_t exponent, mantissa;
+
+	if (value < MIN_SHAPER_BURST || value > MAX_SHAPER_BURST)
+		return 0;
+
+	/* Calculate burst exponent and mantissa using
+	 * the following formula:
+	 *
+	 * value = (((256 + mantissa) << (exponent + 1)
+	 / 256)
+	 *
+	 */
+	exponent = MAX_BURST_EXPONENT;
+	mantissa = MAX_BURST_MANTISSA;
+
+	while (value < (1ull << (exponent + 1)))
+		exponent -= 1;
+
+	while (value < ((256 + mantissa) << (exponent + 1)) / 256)
+		mantissa -= 1;
+
+	if (exponent > MAX_BURST_EXPONENT || mantissa > MAX_BURST_MANTISSA)
+		return 0;
+
+	if (exponent_p)
+		*exponent_p = exponent;
+	if (mantissa_p)
+		*mantissa_p = mantissa;
+
+	return SHAPER_BURST(exponent, mantissa);
+}
+
+static int
+configure_shaper_cir_pir_reg(struct otx2_eth_dev *dev,
+			     struct otx2_nix_tm_node *tm_node,
+			     struct shaper_params *cir,
+			     struct shaper_params *pir)
+{
+	uint32_t shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;
+	struct otx2_nix_tm_shaper_profile *shaper_profile = NULL;
+	struct rte_tm_shaper_params *param;
+
+	shaper_profile_id = tm_node->params.shaper_profile_id;
+
+	shaper_profile = nix_tm_shaper_profile_search(dev, shaper_profile_id);
+	if (shaper_profile) {
+		param = &shaper_profile->profile;
+		/* Calculate CIR exponent and mantissa */
+		if (param->committed.rate)
+			cir->rate = lx_shaper_rate_to_nix(CCLK_HZ,
+							  tm_node->hw_lvl_id,
+							  param->committed.rate,
+							  &cir->exponent,
+							  &cir->mantissa,
+							  &cir->div_exp);
+
+		/* Calculate PIR exponent and mantissa */
+		if (param->peak.rate)
+			pir->rate = lx_shaper_rate_to_nix(CCLK_HZ,
+							  tm_node->hw_lvl_id,
+							  param->peak.rate,
+							  &pir->exponent,
+							  &pir->mantissa,
+							  &pir->div_exp);
+
+		/* Calculate CIR burst exponent and mantissa */
+		if (param->committed.size)
+			cir->burst = shaper_burst_to_nix(param->committed.size,
+							 &cir->burst_exponent,
+							 &cir->burst_mantissa);
+
+		/* Calculate PIR burst exponent and mantissa */
+		if (param->peak.size)
+			pir->burst = shaper_burst_to_nix(param->peak.size,
+							 &pir->burst_exponent,
+							 &pir->burst_mantissa);
+	}
+
+	return 0;
+}
+
+static int
+send_tm_reqval(struct otx2_mbox *mbox, struct nix_txschq_config *req)
+{
+	int rc;
+
+	if (req->num_regs > MAX_REGS_PER_MBOX_MSG)
+		return -ERANGE;
+
+	rc = otx2_mbox_process(mbox);
+	if (rc)
+		return rc;
+
+	req->num_regs = 0;
+	return 0;
+}
+
+static int
+populate_tm_registers(struct otx2_eth_dev *dev,
+		      struct otx2_nix_tm_node *tm_node)
+{
+	uint64_t strict_schedul_prio, rr_prio;
+	struct otx2_mbox *mbox = dev->mbox;
+	volatile uint64_t *reg, *regval;
+	uint64_t parent = 0, child = 0;
+	struct shaper_params cir, pir;
+	struct nix_txschq_config *req;
+	uint64_t rr_quantum;
+	uint32_t hw_lvl;
+	uint32_t schq;
+	int rc;
+
+	memset(&cir, 0, sizeof(cir));
+	memset(&pir, 0, sizeof(pir));
+
+	/* Skip leaf nodes */
+	if (tm_node->hw_lvl_id == NIX_TXSCH_LVL_CNT)
+		return 0;
+
+	/* Root node will not have a parent node */
+	if (tm_node->hw_lvl_id == dev->otx2_tm_root_lvl)
+		parent = tm_node->parent_hw_id;
+	else
+		parent = tm_node->parent->hw_id;
+
+	/* Do we need this trigger to configure TL1 */
+	if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL2 &&
+	    tm_node->hw_lvl_id == dev->otx2_tm_root_lvl) {
+		schq = parent;
+		/*
+		 * Default config for TL1.
+		 * For VF this is always ignored.
+		 */
+
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = NIX_TXSCH_LVL_TL1;
+
+		/* Set DWRR quantum */
+		req->reg[0] = NIX_AF_TL1X_SCHEDULE(schq);
+		req->regval[0] = TXSCH_TL1_DFLT_RR_QTM;
+		req->num_regs++;
+
+		req->reg[1] = NIX_AF_TL1X_TOPOLOGY(schq);
+		req->regval[1] = (TXSCH_TL1_DFLT_RR_PRIO << 1);
+		req->num_regs++;
+
+		req->reg[2] = NIX_AF_TL1X_CIR(schq);
+		req->regval[2] = 0;
+		req->num_regs++;
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+	}
+
+	if (tm_node->hw_lvl_id != NIX_TXSCH_LVL_SMQ)
+		child = find_prio_anchor(dev, tm_node->id);
+
+	rr_prio = tm_node->rr_prio;
+	hw_lvl = tm_node->hw_lvl_id;
+	strict_schedul_prio = tm_node->priority;
+	schq = tm_node->hw_id;
+	rr_quantum = (tm_node->weight * NIX_TM_RR_QUANTUM_MAX) /
+		MAX_SCHED_WEIGHT;
+
+	configure_shaper_cir_pir_reg(dev, tm_node, &cir, &pir);
+
+	otx2_tm_dbg("Configure node %p, lvl %u hw_lvl %u, id %u, hw_id %u,"
+		     "parent_hw_id %" PRIx64 ", pir %" PRIx64 ", cir %" PRIx64,
+		     tm_node, tm_node->level_id, hw_lvl,
+		     tm_node->id, schq, parent, pir.rate, cir.rate);
+
+	rc = -EFAULT;
+
+	switch (hw_lvl) {
+	case NIX_TXSCH_LVL_SMQ:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		reg = req->reg;
+		regval = req->regval;
+		req->num_regs = 0;
+
+		/* Set xoff which will be cleared later */
+		*reg++ = NIX_AF_SMQX_CFG(schq);
+		*regval++ = BIT_ULL(50) | ((uint64_t)NIX_MAX_VTAG_INS << 36) |
+				(NIX_MAX_HW_FRS << 8) | NIX_MIN_HW_FRS;
+		req->num_regs++;
+		*reg++ = NIX_AF_MDQX_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_MDQX_SCHEDULE(schq);
+		*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_MDQX_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_MDQX_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL4:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL4X_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL4X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1);
+		req->num_regs++;
+		*reg++ = NIX_AF_TL4X_SCHEDULE(schq);
+		*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_TL4X_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL4X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL3:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL3X_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL3X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1);
+		req->num_regs++;
+		*reg++ = NIX_AF_TL3X_SCHEDULE(schq);
+		*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_TL3X_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL3X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL2:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL2X_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL2X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1);
+		req->num_regs++;
+		*reg++ = NIX_AF_TL2X_SCHEDULE(schq);
+		if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL2)
+			*regval++ = (1 << 24) | rr_quantum;
+		else
+			*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL3_TL2X_LINKX_CFG(schq, nix_get_link(dev));
+		*regval++ = BIT_ULL(12) | nix_get_relchan(dev);
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_TL2X_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL2X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL1:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL1X_SCHEDULE(schq);
+		*regval++ = rr_quantum;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL1X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1 /*RR_PRIO*/);
+		req->num_regs++;
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL1X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	}
+
+	return 0;
+error:
+	otx2_err("Txschq cfg request failed for node %p, rc=%d", tm_node, rc);
+	return rc;
+}
+
+
+static int
+nix_tm_txsch_reg_config(struct otx2_eth_dev *dev)
+{
+	struct otx2_nix_tm_node *tm_node;
+	uint32_t lvl;
+	int rc = 0;
+
+	if (nix_get_link(dev) == 13)
+		return -EPERM;
+
+	for (lvl = 0; lvl < (uint32_t)dev->otx2_tm_root_lvl + 1; lvl++) {
+		TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+			if (tm_node->hw_lvl_id == lvl) {
+				rc = populate_tm_registers(dev, tm_node);
+				if (rc)
+					goto exit;
+			}
+		}
+	}
+exit:
+	return rc;
+}
+
 static struct otx2_nix_tm_node *
 nix_tm_node_search(struct otx2_eth_dev *dev,
 		   uint32_t node_id, bool user)
@@ -443,6 +941,12 @@ nix_tm_alloc_resources(struct rte_eth_dev *eth_dev, bool xmit_enable)
 		return rc;
 	}
 
+	rc = nix_tm_txsch_reg_config(dev);
+	if (rc) {
+		otx2_err("TM failed to configure sched registers=%d", rc);
+		return rc;
+	}
+
 	return 0;
 }
 
drivers/net/octeontx2/otx2_tm.h +82 -0

86 lines not on this page · raw message

Signature · 1 line
2.21.0
#101 lore raw

PATCH v2 24/57 net/octeontx2: enable Tx through traffic manager

In reply to [email protected]

From: Krzysztof Kanas <[email protected]>

This patch enables pkt transmit through traffic manager hierarchy by clearing software XOFF on the nodes and linking tx queues to corresponding leaf nodes.
It also adds support to start and stop tx queue using traffic manager.

---
 drivers/net/octeontx2/otx2_ethdev.c |  75 ++++++-
 drivers/net/octeontx2/otx2_tm.c     | 296 +++++++++++++++++++++++++++-
 drivers/net/octeontx2/otx2_tm.h     |   4 +
 3 files changed, 370 insertions(+), 5 deletions(-)
drivers/net/octeontx2/otx2_ethdev.c +73 -2
index 899865749..62b1e3d14 100644
@@ -120,6 +120,32 @@ nix_lf_free(struct otx2_eth_dev *dev)
 	return otx2_mbox_process(mbox);
 }
 
+int
+otx2_cgx_rxtx_start(struct otx2_eth_dev *dev)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+
+	if (otx2_dev_is_vf(dev))
+		return 0;
+
+	otx2_mbox_alloc_msg_cgx_start_rxtx(mbox);
+
+	return otx2_mbox_process(mbox);
+}
+
+int
+otx2_cgx_rxtx_stop(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_rxtx(mbox);
+
+	return otx2_mbox_process(mbox);
+}
+
 static inline void
 nix_rx_queue_reset(struct otx2_eth_rxq *rxq)
 {
@@ -461,16 +487,27 @@ nix_sq_init(struct otx2_eth_txq *txq)
 	struct otx2_eth_dev *dev = txq->dev;
 	struct otx2_mbox *mbox = dev->mbox;
 	struct nix_aq_enq_req *sq;
+	uint32_t rr_quantum;
+	uint16_t smq;
+	int rc;
 
 	if (txq->sqb_pool->pool_id == 0)
 		return -EINVAL;
 
+	rc = otx2_nix_tm_get_leaf_data(dev, txq->sq, &rr_quantum, &smq);
+	if (rc) {
+		otx2_err("Failed to get sq->smq(leaf node), rc=%d", rc);
+		return rc;
+	}
+
 	sq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
 	sq->qidx = txq->sq;
 	sq->ctype = NIX_AQ_CTYPE_SQ;
 	sq->op = NIX_AQ_INSTOP_INIT;
 	sq->sq.max_sqe_size = nix_sq_max_sqe_sz(txq);
 
+	sq->sq.smq = smq;
+	sq->sq.smq_rr_quantum = rr_quantum;
 	sq->sq.default_chan = dev->tx_chan_base;
 	sq->sq.sqe_stype = NIX_STYPE_STF;
 	sq->sq.ena = 1;
@@ -692,12 +729,18 @@ static void
 otx2_nix_tx_queue_release(void *_txq)
 {
 	struct otx2_eth_txq *txq = _txq;
+	struct rte_eth_dev *eth_dev;
 
 	if (!txq)
 		return;
 
+	eth_dev = txq->dev->eth_dev;
+
 	otx2_nix_dbg("Releasing txq %u", txq->sq);
 
+	/* Flush and disable tm */
+	otx2_nix_tm_sw_xoff(txq, eth_dev->data->dev_started);
+
 	/* Free sqb's and disable sq */
 	nix_sq_uninit(txq);
 
@@ -1123,24 +1166,52 @@ int
 otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx)
 {
 	struct rte_eth_dev_data *data = eth_dev->data;
+	struct otx2_eth_txq *txq;
+	int rc = -EINVAL;
+
+	txq = eth_dev->data->tx_queues[qidx];
 
 	if (data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED)
 		return 0;
 
+	rc = otx2_nix_sq_sqb_aura_fc(txq, true);
+	if (rc) {
+		otx2_err("Failed to enable sqb aura fc, txq=%u, rc=%d",
+			 qidx, rc);
+		goto done;
+	}
+
 	data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
-	return 0;
+
+done:
+	return rc;
 }
 
 int
 otx2_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
 {
 	struct rte_eth_dev_data *data = eth_dev->data;
+	struct otx2_eth_txq *txq;
+	int rc;
+
+	txq = eth_dev->data->tx_queues[qidx];
 
 	if (data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED)
 		return 0;
 
+	txq->fc_cache_pkts = 0;
+
+	rc = otx2_nix_sq_sqb_aura_fc(txq, false);
+	if (rc) {
+		otx2_err("Failed to disable sqb aura fc, txq=%u, rc=%d",
+			 qidx, rc);
+		goto done;
+	}
+
 	data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
-	return 0;
+
+done:
+	return rc;
 }
 
 static int
drivers/net/octeontx2/otx2_tm.c +293 -3

319 lines not on this page · raw message

drivers/net/octeontx2/otx2_tm.h +4 -0
index af1bb1862..2a009eece 100644
@@ -16,6 +16,10 @@ struct otx2_eth_dev;
 void otx2_nix_tm_conf_init(struct rte_eth_dev *eth_dev);
 int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev);
 int otx2_nix_tm_fini(struct rte_eth_dev *eth_dev);
+int otx2_nix_tm_get_leaf_data(struct otx2_eth_dev *dev, uint16_t sq,
+			      uint32_t *rr_quantum, uint16_t *smq);
+int otx2_nix_tm_sw_xoff(void *_txq, bool dev_started);
+int otx2_nix_sq_sqb_aura_fc(void *_txq, bool enable);
 
 struct otx2_nix_tm_node {
 	TAILQ_ENTRY(otx2_nix_tm_node) node;
Signature · 1 line
2.21.0
#102 lore raw

PATCH v2 25/57 net/octeontx2: add ptype support

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The fields from CQE needs to be converted to
ptype and rx ol flags in mbuf. This patch adds
create lookup memory for those items to be
used in Fastpath.

---
 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              |   1 +
 drivers/net/octeontx2/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |   2 +
 drivers/net/octeontx2/otx2_ethdev.h        |   6 +
 drivers/net/octeontx2/otx2_lookup.c        | 315 +++++++++++++++++++++
 drivers/net/octeontx2/otx2_rx.h            |   7 +
 10 files changed, 336 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_lookup.c
doc/guides/nics/features/octeontx2.ini +1 -0
index ca40358da..0de07776f 100644
@@ -20,6 +20,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index b720c116f..b4b253aa4 100644
@@ -20,6 +20,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 5a287493f..21cc4861e 100644
@@ -16,6 +16,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index d7e8f3d56..07e44b031 100644
@@ -16,6 +16,7 @@ Features
 
 Features of the OCTEON TX2 Ethdev PMD are:
 
+- Packet type information
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
drivers/net/octeontx2/Makefile +1 -0
index 164621087..d434b0b9d 100644
@@ -33,6 +33,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
 	otx2_link.c	\
 	otx2_stats.c	\
+	otx2_lookup.c	\
 	otx2_ethdev.c	\
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
index e344d877f..3dff3e53d 100644
@@ -8,6 +8,7 @@ sources = files(
 		'otx2_mac.c',
 		'otx2_link.c',
 		'otx2_stats.c',
+		'otx2_lookup.c',
 		'otx2_ethdev.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +2 -0
index 62b1e3d14..a9cdafc33 100644
@@ -441,6 +441,7 @@ otx2_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t rq,
 	rxq->pool = mp;
 	rxq->qlen = nix_qsize_to_val(qsize);
 	rxq->qsize = qsize;
+	rxq->lookup_mem = otx2_nix_fastpath_lookup_mem_get();
 
 	/* Alloc completion queue */
 	rc = nix_cq_rq_init(eth_dev, dev, rq, rxq, mp);
@@ -1271,6 +1272,7 @@ 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_supported_ptypes_get = otx2_nix_supported_ptypes_get,
 	.stats_get                = otx2_nix_dev_stats_get,
 	.stats_reset              = otx2_nix_dev_stats_reset,
 	.get_reg                  = otx2_nix_dev_get_reg,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
index 9f73bf89b..cfc4dfe14 100644
@@ -355,6 +355,12 @@ int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
 int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 
+/* Lookup configuration */
+void *otx2_nix_fastpath_lookup_mem_get(void);
+
+/* PTYPES */
+const uint32_t *otx2_nix_supported_ptypes_get(struct rte_eth_dev *dev);
+
 /* Mac address handling */
 int otx2_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
drivers/net/octeontx2/otx2_lookup.c new file +315 -0

315 lines not on this page · raw message

drivers/net/octeontx2/otx2_rx.h +7 -0
index 1749c43ff..1283fdf37 100644
@@ -5,6 +5,13 @@
 #ifndef __OTX2_RX_H__
 #define __OTX2_RX_H__
 
+#define PTYPE_WIDTH 12
+#define PTYPE_NON_TUNNEL_ARRAY_SZ	BIT(PTYPE_WIDTH)
+#define PTYPE_TUNNEL_ARRAY_SZ		BIT(PTYPE_WIDTH)
+#define PTYPE_ARRAY_SZ			((PTYPE_NON_TUNNEL_ARRAY_SZ +\
+					 PTYPE_TUNNEL_ARRAY_SZ) *\
+					 sizeof(uint16_t))
+
 #define NIX_RX_OFFLOAD_PTYPE_F         BIT(1)
 
 #endif /* __OTX2_RX_H__ */
Signature · 1 line
2.21.0
#103 lore raw

PATCH v2 26/57 net/octeontx2: add queue info and pool supported operations

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Add Rx and Tx queue info get and pool ops supported operations.

---
 drivers/net/octeontx2/otx2_ethdev.c     |  3 ++
 drivers/net/octeontx2/otx2_ethdev.h     |  5 +++
 drivers/net/octeontx2/otx2_ethdev_ops.c | 51 +++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +3 -0
index a9cdafc33..a504870f6 100644
@@ -1293,6 +1293,9 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_reset             = otx2_nix_xstats_reset,
 	.xstats_get_by_id         = otx2_nix_xstats_get_by_id,
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
+	.rxq_info_get             = otx2_nix_rxq_info_get,
+	.txq_info_get             = otx2_nix_txq_info_get,
+	.pool_ops_supported       = otx2_nix_pool_ops_supported,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +5 -0
index cfc4dfe14..199d5f242 100644
@@ -274,6 +274,11 @@ 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_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
+void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			   struct rte_eth_rxq_info *qinfo);
+void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			   struct rte_eth_txq_info *qinfo);
 
 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
 void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_ops.c +51 -0

63 lines not on this page · raw message

Signature · 1 line
2.21.0
#104 lore raw

PATCH v2 27/57 net/octeontx2: add Rx and Tx descriptor operations

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add Rx and Tx queue descriptor related operations.

---
 doc/guides/nics/features/octeontx2.ini     |  2 +
 doc/guides/nics/features/octeontx2_vec.ini |  2 +
 doc/guides/nics/features/octeontx2_vf.ini  |  2 +
 drivers/net/octeontx2/otx2_ethdev.c        |  4 ++
 drivers/net/octeontx2/otx2_ethdev.h        |  4 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    | 83 ++++++++++++++++++++++
 6 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
index 0de07776f..f07b64f24 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
@@ -21,6 +22,7 @@ RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
index b4b253aa4..911c926e4 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
@@ -21,6 +22,7 @@ RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
index 21cc4861e..e275e6469 100644
@@ -11,12 +11,14 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
drivers/net/octeontx2/otx2_ethdev.c +4 -0
index a504870f6..feeba5c96 100644
@@ -1295,6 +1295,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 	.rxq_info_get             = otx2_nix_rxq_info_get,
 	.txq_info_get             = otx2_nix_txq_info_get,
+	.rx_queue_count           = otx2_nix_rx_queue_count,
+	.rx_descriptor_done       = otx2_nix_rx_descriptor_done,
+	.rx_descriptor_status     = otx2_nix_rx_descriptor_status,
+	.tx_done_cleanup          = otx2_nix_tx_done_cleanup,
 	.pool_ops_supported       = otx2_nix_pool_ops_supported,
 };
 
drivers/net/octeontx2/otx2_ethdev.h +4 -0
index 199d5f242..8f2691c80 100644
@@ -279,6 +279,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_txq_info *qinfo);
+uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
+int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
+int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
+int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
 
 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
 void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_ops.c +83 -0

89 lines not on this page · raw message

Signature · 1 line
2.21.0
#105 lore raw

PATCH v2 28/57 net/octeontx2: add module EEPROM dump

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

add module EEPROM dump 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        |  2 +
 drivers/net/octeontx2/otx2_ethdev.h        |  4 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    | 51 ++++++++++++++++++++++
 6 files changed, 60 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index f07b64f24..87141244a 100644
@@ -26,6 +26,7 @@ Rx descriptor status = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+Module EEPROM dump   = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 911c926e4..dafbe003c 100644
@@ -26,6 +26,7 @@ Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+Module EEPROM dump   = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index e275e6469..7fba7e1d9 100644
@@ -22,6 +22,7 @@ Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+Module EEPROM dump   = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
drivers/net/octeontx2/otx2_ethdev.c +2 -0
index feeba5c96..58c2f97b5 100644
@@ -1300,6 +1300,8 @@ 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,
+	.get_module_info          = otx2_nix_get_module_info,
+	.get_module_eeprom        = otx2_nix_get_module_eeprom,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +4 -0
index 8f2691c80..5dd5d8c8b 100644
@@ -274,6 +274,10 @@ 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_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,
+			       struct rte_dev_eeprom_info *info);
 int otx2_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
 void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
drivers/net/octeontx2/otx2_ethdev_ops.c +51 -0

57 lines not on this page · raw message

Signature · 1 line
2.21.0
#106 lore raw

PATCH v2 29/57 net/octeontx2: add flow control support

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

Add flow control operations and exposed
otx2_nix_update_flow_ctrl_mode() to enable on the
configured mode in dev_start().

---
 doc/guides/nics/features/octeontx2.ini     |   1 +
 doc/guides/nics/features/octeontx2_vec.ini |   1 +
 doc/guides/nics/octeontx2.rst              |   1 +
 drivers/net/octeontx2/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |  20 ++
 drivers/net/octeontx2/otx2_ethdev.h        |  23 +++
 drivers/net/octeontx2/otx2_flow_ctrl.c     | 220 +++++++++++++++++++++
 8 files changed, 268 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_flow_ctrl.c
doc/guides/nics/features/octeontx2.ini +1 -0
index 87141244a..00feb0cf2 100644
@@ -21,6 +21,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Flow control         = Y
 Packet type parsing  = Y
 Rx descriptor status = Y
 Basic stats          = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index dafbe003c..f3f812804 100644
@@ -21,6 +21,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Flow control         = Y
 Packet type parsing  = Y
 Rx descriptor status = Y
 Basic stats          = Y
doc/guides/nics/octeontx2.rst +1 -0
index 07e44b031..20281b030 100644
@@ -25,6 +25,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - MAC filtering
 - Port hardware statistics
 - Link state information
+- Link flow control
 - Debug utilities - Context dump and error interrupt support
 
 Prerequisites
drivers/net/octeontx2/Makefile +1 -0
index d434b0b9d..4a361846f 100644
@@ -35,6 +35,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_stats.c	\
 	otx2_lookup.c	\
 	otx2_ethdev.c	\
+	otx2_flow_ctrl.c \
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
 	otx2_ethdev_debug.c \
drivers/net/octeontx2/meson.build +1 -0
index 3dff3e53d..4b56f4461 100644
@@ -10,6 +10,7 @@ sources = files(
 		'otx2_stats.c',
 		'otx2_lookup.c',
 		'otx2_ethdev.c',
+		'otx2_flow_ctrl.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
 		'otx2_ethdev_debug.c',
drivers/net/octeontx2/otx2_ethdev.c +20 -0
index 58c2f97b5..19b502903 100644
@@ -216,6 +216,14 @@ nix_cq_rq_init(struct rte_eth_dev *eth_dev, struct otx2_eth_dev *dev,
 	aq->cq.cq_err_int_ena = BIT(NIX_CQERRINT_CQE_FAULT);
 	aq->cq.cq_err_int_ena |= BIT(NIX_CQERRINT_DOOR_ERR);
 
+	/* TX pause frames enable flowctrl on RX side */
+	if (dev->fc_info.tx_pause) {
+		/* Single bpid is allocated for all rx channels for now */
+		aq->cq.bpid = dev->fc_info.bpid[0];
+		aq->cq.bp = NIX_CQ_BP_LEVEL;
+		aq->cq.bp_ena = 1;
+	}
+
 	/* Many to one reduction */
 	aq->cq.qint_idx = qid % dev->qints;
 
@@ -1073,6 +1081,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);
 		oxt2_nix_unregister_queue_irqs(eth_dev);
 		nix_set_nop_rxtx_function(eth_dev);
 		rc = nix_store_queue_cfg_and_then_release(eth_dev);
@@ -1126,6 +1135,12 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto free_nix_lf;
 	}
 
+	rc = otx2_nix_rxchan_bpid_cfg(eth_dev, true);
+	if (rc) {
+		otx2_err("Failed to configure nix rx chan bpid cfg rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	/*
 	 * Restore queue config when reconfigure followed by
 	 * reconfigure and no queue configure invoked from application case.
@@ -1302,6 +1317,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.pool_ops_supported       = otx2_nix_pool_ops_supported,
 	.get_module_info          = otx2_nix_get_module_info,
 	.get_module_eeprom        = otx2_nix_get_module_eeprom,
+	.flow_ctrl_get            = otx2_nix_flow_ctrl_get,
+	.flow_ctrl_set            = otx2_nix_flow_ctrl_set,
 };
 
 static inline int
@@ -1503,6 +1520,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	/* Disable nix bpid config */
+	otx2_nix_rxchan_bpid_cfg(eth_dev, false);
+
 	/* 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 +23 -0
index 5dd5d8c8b..03ecd32ec 100644
@@ -87,6 +87,9 @@
 #define NIX_TX_NB_SEG_MAX		9
 #endif
 
+/* Apply BP when CQ is 75% full */
+#define NIX_CQ_BP_LEVEL (25 * 256 / 100)
+
 #define CQ_OP_STAT_OP_ERR	63
 #define CQ_OP_STAT_CQ_ERR	46
 
@@ -169,6 +172,14 @@ struct otx2_npc_flow_info {
 	uint16_t flow_max_priority;
 };
 
+struct otx2_fc_info {
+	enum rte_eth_fc_mode mode;  /**< Link flow control mode */
+	uint8_t rx_pause;
+	uint8_t tx_pause;
+	uint8_t chan_cnt;
+	uint16_t bpid[NIX_MAX_CHAN];
+};
+
 struct otx2_eth_dev {
 	OTX2_DEV; /* Base class */
 	MARKER otx2_eth_dev_data_start;
@@ -216,6 +227,7 @@ struct otx2_eth_dev {
 	struct otx2_nix_tm_node_list node_list;
 	struct otx2_nix_tm_shaper_profile_list shaper_profile_list;
 	struct otx2_rss_info rss_info;
+	struct otx2_fc_info fc_info;
 	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	struct otx2_npc_flow_info npc_flow;
@@ -368,6 +380,17 @@ int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
 int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 
+/* Flow Control */
+int otx2_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_fc_conf *fc_conf);
+
+int otx2_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_fc_conf *fc_conf);
+
+int otx2_nix_rxchan_bpid_cfg(struct rte_eth_dev *eth_dev, bool enb);
+
+int otx2_nix_update_flow_ctrl_mode(struct rte_eth_dev *eth_dev);
+
 /* Lookup configuration */
 void *otx2_nix_fastpath_lookup_mem_get(void);
 
drivers/net/octeontx2/otx2_flow_ctrl.c new file +220 -0

220 lines not on this page · raw message

Signature · 1 line
2.21.0
#107 lore raw

PATCH v2 30/57 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
index 20281b030..41eb3c7b9 100644
@@ -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
index 4a361846f..a0155e727 100644
@@ -31,6 +31,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
index 4b56f4461..2cac57d2b 100644
@@ -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
index 19b502903..29e8130f4 100644
@@ -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);
@@ -717,6 +716,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 {
@@ -1141,6 +1141,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.
@@ -1319,6 +1329,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
@@ -1523,6 +1535,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
index 03ecd32ec..1ca28add4 100644
@@ -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
index 1283fdf37..0c3627c12 100644
@@ -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
#108 lore raw

PATCH v2 31/57 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
index 00feb0cf2..46fb00be6 100644
@@ -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
index 29e8130f4..7512aacb3 100644
@@ -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
@@ -1331,6 +1332,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
index 1ca28add4..8f8d93a39 100644
@@ -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
#109 lore raw

PATCH v2 32/57 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
new file mode 100644
index 000000000..95bb6c2bf
@@ -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
#110 lore raw

PATCH v2 33/57 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
index a0155e727..8d1aeae3f 100644
@@ -37,6 +37,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
index 2cac57d2b..75156ddbe 100644
@@ -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
index 8f8d93a39..e8a22b6ec 100644
@@ -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
index 95bb6c2bf..f5cc3b983 100644
@@ -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
#111 lore raw

PATCH v2 34/57 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
index f5cc3b983..a37d86512 100644
@@ -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
#112 lore raw

PATCH v2 35/57 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
index a37d86512..f5cc3b983 100644
@@ -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
#113 lore raw

PATCH v2 36/57 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 | 459 ++++++++++++++++++++++++
 3 files changed, 461 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_flow_parse.c
drivers/net/octeontx2/Makefile +1 -0
index 8d1aeae3f..3eb4dba53 100644
@@ -37,6 +37,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
index 75156ddbe..f608c4947 100644
@@ -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 +459 -0

459 lines not on this page · raw message

Signature · 1 line
2.21.0
#114 lore raw

PATCH v2 37/57 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
index d27a24833..79c60a9ea 100644
@@ -457,3 +457,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
#115 lore raw

PATCH v2 38/57 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
index 79c60a9ea..4cf5ce17e 100644
@@ -667,3 +667,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
index 0c3627c12..db79451b9 100644
@@ -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
#116 lore raw

PATCH v2 39/57 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
index 3eb4dba53..21559f631 100644
@@ -32,6 +32,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
index f608c4947..f0e03bffe 100644
@@ -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
#117 lore raw

PATCH v2 40/57 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
index 896aef00a..24bde623d 100644
@@ -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
index db79451b9..e18e04658 100644
@@ -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
#118 lore raw

PATCH v2 41/57 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
index 24bde623d..94bd85161 100644
@@ -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
#119 lore raw

PATCH v2 42/57 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              | 93 ++++++++++++++++++++++
 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, 129 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index 46fb00be6..33d2f2785 100644
@@ -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
index f3f812804..980a4daf9 100644
@@ -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
index 7fba7e1d9..330534a90 100644
@@ -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 +93 -0

102 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.c +9 -0
index 7512aacb3..09201fd23 100644
@@ -1326,6 +1326,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,
@@ -1505,6 +1506,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,
@@ -1541,6 +1547,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
index e8a22b6ec..ad12f2553 100644
@@ -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
index 2a949439a..e55acd4e0 100644
@@ -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
#120 lore raw

PATCH v2 43/57 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
index 21559f631..d22ddae33 100644
@@ -34,6 +34,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
index f0e03bffe..6281ee21b 100644
@@ -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
index 09201fd23..48c2e8f57 100644
@@ -1083,6 +1083,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);
@@ -1129,6 +1130,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) {
@@ -1547,6 +1554,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
#121 lore raw

PATCH v2 44/57 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
index 33d2f2785..ac4712b0c 100644
@@ -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
index 980a4daf9..e54c1babe 100644
@@ -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
index 330534a90..769ab16ee 100644
@@ -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
index 0f1756932..a53b71a6d 100644
@@ -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
index 48c2e8f57..55a5cdc48 100644
@@ -1345,6 +1345,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
index 8577272b4..50fd18b6e 100644
@@ -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
index e55acd4e0..690d8ac0c 100644
@@ -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
index e18e04658..7dc34d705 100644
@@ -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
#122 lore raw

PATCH v2 45/57 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
index ac4712b0c..37b802999 100644
@@ -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
index e54c1babe..ccedd1359 100644
@@ -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
index 769ab16ee..24df14717 100644
@@ -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
index a53b71a6d..d6082e508 100644
@@ -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
index 55a5cdc48..78cbd8811 100644
@@ -1346,6 +1346,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
index 50fd18b6e..996ddec47 100644
@@ -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
#123 lore raw

PATCH v2 46/57 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
index 78cbd8811..ad305dcd8 100644
@@ -1348,6 +1348,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
index 996ddec47..12db92257 100644
@@ -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
#124 lore raw

PATCH v2 47/57 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
index 37b802999..211ff93e7 100644
@@ -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
index ccedd1359..967a3757d 100644
@@ -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
index 24df14717..884167c88 100644
@@ -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
index ad305dcd8..15f46a9bf 100644
@@ -1336,6 +1336,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
index 12db92257..e18483969 100644
@@ -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
index 690d8ac0c..6a3048336 100644
@@ -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
index 94bd85161..3ddecfb23 100644
@@ -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
#125 lore raw

PATCH v2 48/57 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
index d22ddae33..3e25d2ad4 100644
@@ -28,6 +28,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
index 6281ee21b..975b2e715 100644
@@ -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
index 15f46a9bf..1f8a22300 100644
@@ -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
index e18483969..22cf86981 100644
@@ -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
#126 lore raw

PATCH v2 49/57 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
index 211ff93e7..3280cba78 100644
@@ -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
index 967a3757d..315722e60 100644
@@ -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
index 884167c88..17b223221 100644
@@ -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
index d6082e508..3d9fc5f1d 100644
@@ -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
index 4d5223e10..fca182785 100644
@@ -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
#127 lore raw

PATCH v2 50/57 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
index 3d9fc5f1d..9d6596ad8 100644
@@ -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
index 3e25d2ad4..a5f125655 100644
@@ -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
index 975b2e715..9d151f88d 100644
@@ -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
#128 lore raw

PATCH v2 51/57 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
index 3280cba78..1856d9924 100644
@@ -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
index 315722e60..053fca288 100644
@@ -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
index 17b223221..bef451d01 100644
@@ -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
index 9d6596ad8..90ca4e2d2 100644
@@ -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
index a5f125655..c187d2555 100644
@@ -30,6 +30,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
index 9d151f88d..94bf09a78 100644
@@ -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
index 1f8a22300..44753cbf5 100644
@@ -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
index 22cf86981..1f9323fe3 100644
@@ -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
#129 lore raw

PATCH v2 52/57 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
index 1f9323fe3..f39fdfa1f 100644
@@ -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
#130 lore raw

PATCH v2 53/57 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
index 0ac5ea652..6bce55112 100644
@@ -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)
+			 */
+
+			asm volatile ("LD1 {%[a].D}[0],[%[in]]\n\t" :
+				      [a]"+w"(senddesc01_w1) :
+				      [in]"r"(mbuf0 + 2) : "memory");
+
+			asm volatile ("LD1 {%[a].D}[1],[%[in]]\n\t" :
+				      [a]"+w"(senddesc01_w1) :
+				      [in]"r"(mbuf1 + 2) : "memory");
+
+			asm volatile ("LD1 {%[b].D}[0],[%[in]]\n\t" :
+				      [b]"+w"(senddesc23_w1) :
+				      [in]"r"(mbuf2 + 2) : "memory");
+
+			asm volatile ("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;
+			asm volatile ("LD1 {%[a].H}[0],[%[in]]\n\t" :
+				[a]"+w"(xmask01) : [in]"r"(mbuf0) : "memory");
+
+			asm volatile ("LD1 {%[a].H}[4],[%[in]]\n\t" :
+				 [a]"+w"(xmask01) : [in]"r"(mbuf1) : "memory");
+
+			asm volatile ("LD1 {%[b].H}[0],[%[in]]\n\t" :
+				 [b]"+w"(xmask23) : [in]"r"(mbuf2) : "memory");
+
+			asm volatile ("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;
+			asm volatile ("LD1 {%[a].H}[0],[%[in]]\n\t" :
+				 [a]"+w"(xmask01) : [in]"r"(mbuf0) : "memory");
+
+			asm volatile ("LD1 {%[a].H}[4],[%[in]]\n\t" :
+				 [a]"+w"(xmask01) : [in]"r"(mbuf1) : "memory");
+
+			asm volatile ("LD1 {%[b].H}[0],[%[in]]\n\t" :
+				 [b]"+w"(xmask23) : [in]"r"(mbuf2) : "memory");
+
+			asm volatile ("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;
+			asm volatile ("LD1 {%[a].H}[0],[%[in]]\n\t" :
+				 [a]"+w"(xmask01) : [in]"r"(mbuf0) : "memory");
+
+			asm volatile ("LD1 {%[a].H}[4],[%[in]]\n\t" :
+				 [a]"+w"(xmask01) : [in]"r"(mbuf1) : "memory");
+
+			asm volatile ("LD1 {%[b].H}[0],[%[in]]\n\t" :
+				 [b]"+w"(xmask23) : [in]"r"(mbuf2) : "memory");
+
+			asm volatile ("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;
+			asm volatile ("LD1 {%[a].H}[0],[%[in]]\n\t" :
+				 [a]"+w"(xmask01) : [in]"r"(mbuf0) : "memory");
+
+			asm volatile ("LD1 {%[a].H}[4],[%[in]]\n\t" :
+				 [a]"+w"(xmask01) : [in]"r"(mbuf1) : "memory");
+
+			asm volatile ("LD1 {%[b].H}[0],[%[in]]\n\t" :
+				 [b]"+w"(xmask23) : [in]"r"(mbuf2) : "memory");
+
+			asm volatile ("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
#131 lore raw

PATCH v2 54/57 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
index 90ca4e2d2..d4a458262 100644
@@ -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
index 3ddecfb23..982100df4 100644
@@ -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
index 4cf5ce17e..375d00620 100644
@@ -926,9 +926,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
index 5291da241..0186c629a 100644
@@ -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
index dc0f4e032..189c45174 100644
@@ -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
#132 lore raw

PATCH v2 55/57 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
index 7f33f8808..e23bed603 100644
@@ -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)
 {
@@ -1189,6 +1202,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);
@@ -1406,6 +1420,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)
 {
@@ -1458,6 +1503,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 = {
@@ -1469,11 +1516,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,
@@ -1725,9 +1775,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);
 
@@ -1738,6 +1793,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]);
@@ -1793,6 +1850,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
#133 lore raw

PATCH v2 56/57 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
index 1856d9924..be10dc0c8 100644
@@ -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
index 053fca288..df8180f83 100644
@@ -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
index d4a458262..517e9e641 100644
@@ -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
index e23bed603..170593e95 100644
@@ -1457,6 +1457,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);
@@ -1527,6 +1533,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
index f39fdfa1f..3703acc69 100644
@@ -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
#134 lore raw

PATCH v2 57/57 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
index be10dc0c8..66952328b 100644
@@ -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
index bef451d01..16799309b 100644
@@ -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
index 517e9e641..dbd376665 100644
@@ -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
index 170593e95..7f50a4c0e 100644
@@ -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;
@@ -1204,6 +1206,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)
@@ -1264,6 +1268,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) {
@@ -1576,6 +1601,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
@@ -1824,6 +1851,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
index 3703acc69..f6905db83 100644
@@ -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
#135 lore raw

v3 cover OCTEON TX2 Ethdev driver

In reply to [email protected]

From: Jerin Jacob <[email protected]>

This patchset adds support for OCTEON TX2 ethdev driver.

v3:

# Fix build issue with ICC 32bit build
# Add missing "net/octeontx2: add link status set operations" patch from v1

v2:
# Moved maintainers file to the first patch(Ferruh)

# removed reference to to v19.05(Ferruh) 
# Makefile/Meson CFLAGS moved to specific patches(Ferruh)
# Move Documentation updates to specific patches(Ferruh)
# reworked the code to remove the need for exposing
otx2_nix_fastpath_lookup_mem_get function(Ferruh)
# Updated goto logic in net/octeontx2: add FW version get operation(Ferruh)
# Added "add Rx interrupts support" patch

Harman Kalra (3):
net/octeontx2: add PTP base support
net/octeontx2: add remaining PTP operations
net/octeontx2: add Rx interrupts support

Jerin Jacob (16):
net/octeontx2: add build and doc infrastructure net/octeontx2: add ethdev probe and remove net/octeontx2: add device init and uninit net/octeontx2: add devargs parsing functions net/octeontx2: handle device error interrupts net/octeontx2: add info get operation net/octeontx2: add device configure operation net/octeontx2: handle queue specific error interrupts net/octeontx2: add context debug utils net/octeontx2: add Rx queue setup and release net/octeontx2: add Tx queue setup and release net/octeontx2: add ptype support net/octeontx2: add Rx and Tx descriptor operations net/octeontx2: add Rx burst support net/octeontx2: add Rx vector version net/octeontx2: add Tx burst support

Kiran Kumar K (13):
net/octeontx2: add register dump support net/octeontx2: add basic stats operation net/octeontx2: add extended stats operations net/octeontx2: introducing flow driver net/octeontx2: add flow utility functions net/octeontx2: add flow mbox utility functions net/octeontx2: add flow MCAM utility functions net/octeontx2: add flow parsing for outer layers net/octeontx2: add flow actions support net/octeontx2: add flow parse actions support net/octeontx2: add flow operations net/octeontx2: add flow destroy ops support net/octeontx2: add flow init and fini

Krzysztof Kanas (2):
net/octeontx2: alloc and free TM HW resources net/octeontx2: enable Tx through traffic manager

Nithin Dabilpuram (9):
net/octeontx2: add queue start and stop operations net/octeontx2: introduce traffic manager net/octeontx2: configure TM HW resources net/octeontx2: add queue info and pool supported operations net/octeontx2: add Rx multi segment version net/octeontx2: add Tx multi segment version net/octeontx2: add Tx vector version net/octeontx2: add device start operation net/octeontx2: add device stop and close operations

Sunil Kumar Kori (1):
net/octeontx2: add unicast MAC filter

Vamsi Attunuru (9):
net/octeontx2: add link stats operations net/octeontx2: add promiscuous and allmulticast mode net/octeontx2: add RSS support net/octeontx2: handle port reconfigure net/octeontx2: add module EEPROM dump net/octeontx2: add flow control support net/octeontx2: add FW version get operation net/octeontx2: add MTU set operation net/octeontx2: add link status set operations

Vivek Sharma (5):
net/octeontx2: connect flow API to ethdev ops net/octeontx2: implement VLAN utility functions net/octeontx2: support VLAN offloads net/octeontx2: support VLAN filters net/octeontx2: support VLAN TPID and PVID for Tx

 MAINTAINERS                                   |    9 +
 config/common_base                            |    5 +
 doc/guides/nics/features/octeontx2.ini        |   50 +
 doc/guides/nics/features/octeontx2_vec.ini    |   46 +
 doc/guides/nics/features/octeontx2_vf.ini     |   42 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/nics/octeontx2.rst                 |  306 +++
 doc/guides/platform/octeontx2.rst             |    3 +
 drivers/net/Makefile                          |    1 +
 drivers/net/meson.build                       |    6 +-
 drivers/net/octeontx2/Makefile                |   58 +
 drivers/net/octeontx2/meson.build             |   40 +
 drivers/net/octeontx2/otx2_ethdev.c           | 2017 +++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h           |  531 +++++
 drivers/net/octeontx2/otx2_ethdev_debug.c     |  500 ++++
 drivers/net/octeontx2/otx2_ethdev_devargs.c   |  165 ++
 drivers/net/octeontx2/otx2_ethdev_irq.c       |  468 ++++
 drivers/net/octeontx2/otx2_ethdev_ops.c       |  461 ++++
 drivers/net/octeontx2/otx2_flow.c             |  981 ++++++++
 drivers/net/octeontx2/otx2_flow.h             |  390 ++++
 drivers/net/octeontx2/otx2_flow_ctrl.c        |  220 ++
 drivers/net/octeontx2/otx2_flow_parse.c       |  959 ++++++++
 drivers/net/octeontx2/otx2_flow_utils.c       |  910 ++++++++
 drivers/net/octeontx2/otx2_link.c             |  157 ++
 drivers/net/octeontx2/otx2_lookup.c           |  315 +++
 drivers/net/octeontx2/otx2_mac.c              |  149 ++
 drivers/net/octeontx2/otx2_ptp.c              |  273 +++
 drivers/net/octeontx2/otx2_rss.c              |  372 +++
 drivers/net/octeontx2/otx2_rx.c               |  411 ++++
 drivers/net/octeontx2/otx2_rx.h               |  333 +++
 drivers/net/octeontx2/otx2_stats.c            |  387 ++++
 drivers/net/octeontx2/otx2_tm.c               | 1396 ++++++++++++
 drivers/net/octeontx2/otx2_tm.h               |  153 ++
 drivers/net/octeontx2/otx2_tx.c               | 1033 +++++++++
 drivers/net/octeontx2/otx2_tx.h               |  370 +++
 drivers/net/octeontx2/otx2_vlan.c             | 1034 +++++++++
 .../octeontx2/rte_pmd_octeontx2_version.map   |    4 +
 mk/rte.app.mk                                 |    2 +
 38 files changed, 14557 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/nics/features/octeontx2.ini
 create mode 100644 doc/guides/nics/features/octeontx2_vec.ini
 create mode 100644 doc/guides/nics/features/octeontx2_vf.ini
 create mode 100644 doc/guides/nics/octeontx2.rst
 create mode 100644 drivers/net/octeontx2/Makefile
 create mode 100644 drivers/net/octeontx2/meson.build
 create mode 100644 drivers/net/octeontx2/otx2_ethdev.c
 create mode 100644 drivers/net/octeontx2/otx2_ethdev.h
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_debug.c
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_devargs.c
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_irq.c
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_ops.c
 create mode 100644 drivers/net/octeontx2/otx2_flow.c
 create mode 100644 drivers/net/octeontx2/otx2_flow.h
 create mode 100644 drivers/net/octeontx2/otx2_flow_ctrl.c
 create mode 100644 drivers/net/octeontx2/otx2_flow_parse.c
 create mode 100644 drivers/net/octeontx2/otx2_flow_utils.c
 create mode 100644 drivers/net/octeontx2/otx2_link.c
 create mode 100644 drivers/net/octeontx2/otx2_lookup.c
 create mode 100644 drivers/net/octeontx2/otx2_mac.c
 create mode 100644 drivers/net/octeontx2/otx2_ptp.c
 create mode 100644 drivers/net/octeontx2/otx2_rss.c
 create mode 100644 drivers/net/octeontx2/otx2_rx.c
 create mode 100644 drivers/net/octeontx2/otx2_rx.h
 create mode 100644 drivers/net/octeontx2/otx2_stats.c
 create mode 100644 drivers/net/octeontx2/otx2_tm.c
 create mode 100644 drivers/net/octeontx2/otx2_tm.h
 create mode 100644 drivers/net/octeontx2/otx2_tx.c
 create mode 100644 drivers/net/octeontx2/otx2_tx.h
 create mode 100644 drivers/net/octeontx2/otx2_vlan.c
 create mode 100644 drivers/net/octeontx2/rte_pmd_octeontx2_version.map
Signature · 1 line
2.21.0
#136 lore raw

PATCH v3 1/58 net/octeontx2: add build and doc infrastructure

From: Jerin Jacob <[email protected]>

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx2 PMD.

---
 MAINTAINERS                                   |  9 ++++++
 config/common_base                            |  5 +++
 doc/guides/nics/features/octeontx2.ini        |  9 ++++++
 doc/guides/nics/features/octeontx2_vec.ini    |  9 ++++++
 doc/guides/nics/features/octeontx2_vf.ini     |  9 ++++++
 doc/guides/nics/index.rst                     |  1 +
 doc/guides/nics/octeontx2.rst                 | 32 +++++++++++++++++++
 doc/guides/platform/octeontx2.rst             |  3 ++
 drivers/net/Makefile                          |  1 +
 drivers/net/meson.build                       |  6 +++-
 drivers/net/octeontx2/Makefile                | 30 +++++++++++++++++
 drivers/net/octeontx2/meson.build             |  9 ++++++
 drivers/net/octeontx2/otx2_ethdev.c           |  3 ++
 .../octeontx2/rte_pmd_octeontx2_version.map   |  4 +++
 mk/rte.app.mk                                 |  2 ++
 15 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/nics/features/octeontx2.ini
 create mode 100644 doc/guides/nics/features/octeontx2_vec.ini
 create mode 100644 doc/guides/nics/features/octeontx2_vf.ini
 create mode 100644 doc/guides/nics/octeontx2.rst
 create mode 100644 drivers/net/octeontx2/Makefile
 create mode 100644 drivers/net/octeontx2/meson.build
 create mode 100644 drivers/net/octeontx2/otx2_ethdev.c
 create mode 100644 drivers/net/octeontx2/rte_pmd_octeontx2_version.map
MAINTAINERS +9 -0
index 97a009e43..073bf76a4 100644
@@ -691,6 +691,15 @@ F: drivers/net/mvneta/
 F: doc/guides/nics/mvneta.rst
 F: doc/guides/nics/features/mvneta.ini
 
+Marvell OCTEON TX2
+M: Jerin Jacob <[email protected]>
+M: Nithin Dabilpuram <[email protected]>
+M: Kiran Kumar K <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-mrvl
+F: drivers/net/octeontx2/
+F: doc/guides/nics/features/octeontx2*.rst
+F: doc/guides/nics/octeontx2.rst
+
 Mellanox mlx4
 M: Matan Azrad <[email protected]>
 M: Shahaf Shuler <[email protected]>
config/common_base +5 -0
index e700bf1e7..6cc44b65a 100644
@@ -411,6 +411,11 @@ CONFIG_RTE_LIBRTE_LIO_DEBUG_REGS=n
 #
 CONFIG_RTE_LIBRTE_OCTEONTX_PMD=y
 
+#
+# Compile burst-oriented Marvell OCTEON TX2 network PMD driver
+#
+CONFIG_RTE_LIBRTE_OCTEONTX2_PMD=y
+
 #
 # Compile WRS accelerated virtual port (AVP) guest PMD driver
 #
doc/guides/nics/features/octeontx2.ini new file +9 -0
new file mode 100644
index 000000000..84d5ad779
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'octeontx2' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux VFIO           = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/octeontx2_vec.ini new file +9 -0
new file mode 100644
index 000000000..5fd7e4c5c
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'octeontx2_vec' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux VFIO           = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/octeontx2_vf.ini new file +9 -0
new file mode 100644
index 000000000..3128cc120
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'octeontx2_vf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux VFIO           = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index d664c4592..9fec02f3e 100644
@@ -46,6 +46,7 @@ Network Interface Controller Drivers
     nfb
     nfp
     octeontx
+    octeontx2
     qede
     sfc_efx
     softnic
doc/guides/nics/octeontx2.rst new file +32 -0
new file mode 100644
index 000000000..f0bd36be3
@@ -0,0 +1,32 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2019 Marvell International Ltd.
+
+OCTEON TX2 Poll Mode driver
+===========================
+
+The OCTEON TX2 ETHDEV PMD (**librte_pmd_octeontx2**) provides poll mode ethdev
+driver support for the inbuilt network device found in **Marvell OCTEON TX2**
+SoC family as well as for their virtual functions (VF) in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/embedded-processors/infrastructure-processors>`_.
+
+Features
+--------
+
+Features of the OCTEON TX2 Ethdev PMD are:
+
+
+Prerequisites
+-------------
+
+See :doc:`../platform/octeontx2` for setup information.
+
+Compile time Config Options
+---------------------------
+
+The following options may be modified in the ``config`` file.
+
+- ``CONFIG_RTE_LIBRTE_OCTEONTX2_PMD`` (default ``y``)
+
+  Toggle compilation of the ``librte_pmd_octeontx2`` driver.
doc/guides/platform/octeontx2.rst +3 -0
index c9ea45647..d2592f119 100644
@@ -98,6 +98,9 @@ HW Offload Drivers
 
 This section lists dataplane H/W block(s) available in OCTEON TX2 SoC.
 
+#. **Ethdev Driver**
+   See :doc:`../nics/octeontx2` for NIX Ethdev driver information.
+
 #. **Mempool Driver**
    See :doc:`../mempool/octeontx2` for NPA mempool driver information.
 
drivers/net/Makefile +1 -0
index a1d45d9cb..5767fdf65 100644
@@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
 DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
 DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx
+DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += octeontx2
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
 DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
drivers/net/meson.build +5 -1
index 86e704e13..513f19b33 100644
@@ -33,7 +33,11 @@ drivers = ['af_packet',
 	'netvsc',
 	'nfb',
 	'nfp',
-	'null', 'octeontx', 'pcap', 'qede', 'ring',
+	'null',
+	'octeontx',
+	'octeontx2',
+	'pcap',
+	'ring',
 	'sfc',
 	'softnic',
 	'szedata2',
drivers/net/octeontx2/Makefile new file +30 -0
new file mode 100644
index 000000000..9c467352f
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_octeontx2.a
+
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2
+CFLAGS += -O3
+
+EXPORT_MAP := rte_pmd_octeontx2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
+	otx2_ethdev.c
+
+LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build new file +9 -0
new file mode 100644
index 000000000..0d0ca32da
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+sources = files(
+		'otx2_ethdev.c',
+		)
+
+deps += ['common_octeontx2', 'mempool_octeontx2']
drivers/net/octeontx2/otx2_ethdev.c new file +3 -0
new file mode 100644
index 000000000..d26535dee
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
drivers/net/octeontx2/rte_pmd_octeontx2_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
mk/rte.app.mk +2 -0
index 2b5696a27..fab72ff6a 100644
@@ -109,6 +109,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 _LDLIBS-y += -lrte_common_octeontx
 endif
 OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)
 ifeq ($(findstring y,$(OCTEONTX2-y)),y)
 _LDLIBS-y += -lrte_common_octeontx2
 endif
@@ -195,6 +196,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD)      += -lrte_pmd_mvpp2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD)     += -lrte_pmd_mvneta
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)        += -lrte_pmd_nfp
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)       += -lrte_pmd_null
+_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)  += -lrte_pmd_octeontx2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lrte_pmd_pcap -lpcap
 _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)       += -lrte_pmd_qede
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)       += -lrte_pmd_ring
Signature · 1 line
2.21.0
#137 lore raw

PATCH v3 2/58 net/octeontx2: add ethdev probe and remove

In reply to [email protected]

From: Jerin Jacob <[email protected]>

add basic PCIe ethdev probe and remove.

---
 drivers/net/octeontx2/Makefile      | 11 +++-
 drivers/net/octeontx2/meson.build   | 14 ++++-
 drivers/net/octeontx2/otx2_ethdev.c | 93 +++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h | 27 +++++++++
 4 files changed, 143 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/octeontx2/otx2_ethdev.h
drivers/net/octeontx2/Makefile +10 -1
index 9c467352f..8999c38d1 100644
@@ -15,6 +15,14 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2
 CFLAGS += -O3
 
+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
+endif
+endif
+
 EXPORT_MAP := rte_pmd_octeontx2_version.map
 
 LIBABIVER := 1
@@ -25,6 +33,7 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_ethdev.c
 
-LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2
+LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
+LDLIBS += -lrte_ethdev -lrte_bus_pci
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build +13 -1
index 0d0ca32da..db375f33b 100644
@@ -6,4 +6,16 @@ sources = files(
 		'otx2_ethdev.c',
 		)
 
-deps += ['common_octeontx2', 'mempool_octeontx2']
+deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2']
+
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif
+
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
drivers/net/octeontx2/otx2_ethdev.c +93 -0

96 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h new file +27 -0
new file mode 100644
index 000000000..fd01a3254
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_ETHDEV_H__
+#define __OTX2_ETHDEV_H__
+
+#include <stdint.h>
+
+#include <rte_common.h>
+
+#include "otx2_common.h"
+#include "otx2_dev.h"
+#include "otx2_irq.h"
+#include "otx2_mempool.h"
+
+struct otx2_eth_dev {
+	OTX2_DEV; /* Base class */
+} __rte_cache_aligned;
+
+static inline struct otx2_eth_dev *
+otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)
+{
+	return eth_dev->data->dev_private;
+}
+
+#endif /* __OTX2_ETHDEV_H__ */
Signature · 1 line
2.21.0
#138 lore raw

PATCH v3 3/58 net/octeontx2: add device init and uninit

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add basic init and uninit function which includes
attaching LF device to probed PCIe device.

---
 drivers/net/octeontx2/Makefile      |   1 +
 drivers/net/octeontx2/meson.build   |   1 +
 drivers/net/octeontx2/otx2_ethdev.c | 277 +++++++++++++++++++++++++++-
 drivers/net/octeontx2/otx2_ethdev.h |  72 ++++++++
 drivers/net/octeontx2/otx2_mac.c    |  72 ++++++++
 5 files changed, 418 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/octeontx2/otx2_mac.c
drivers/net/octeontx2/Makefile +1 -0
index 8999c38d1..fff95ab02 100644
@@ -31,6 +31,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
+	otx2_mac.c	\
 	otx2_ethdev.c
 
 LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
index db375f33b..b153f166d 100644
@@ -3,6 +3,7 @@
 #
 
 sources = files(
+		'otx2_mac.c',
 		'otx2_ethdev.c',
 		)
 
drivers/net/octeontx2/otx2_ethdev.c +272 -5

306 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h +72 -0

90 lines not on this page · raw message

drivers/net/octeontx2/otx2_mac.c new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.21.0
#139 lore raw

PATCH v3 4/58 net/octeontx2: add devargs parsing functions

In reply to [email protected]

From: Jerin Jacob <[email protected]>

add various devargs command line options supported by this driver.

---
 doc/guides/nics/octeontx2.rst               |  67 ++++++++
 drivers/net/octeontx2/Makefile              |   5 +-
 drivers/net/octeontx2/meson.build           |   1 +
 drivers/net/octeontx2/otx2_ethdev.c         |   7 +
 drivers/net/octeontx2/otx2_ethdev.h         |  23 +++
 drivers/net/octeontx2/otx2_ethdev_devargs.c | 165 ++++++++++++++++++++
 drivers/net/octeontx2/otx2_rx.h             |  10 ++
 7 files changed, 276 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_devargs.c
 create mode 100644 drivers/net/octeontx2/otx2_rx.h
doc/guides/nics/octeontx2.rst +67 -0
index f0bd36be3..92a7ebc42 100644
@@ -30,3 +30,70 @@ The following options may be modified in the ``config`` file.
 - ``CONFIG_RTE_LIBRTE_OCTEONTX2_PMD`` (default ``y``)
 
   Toggle compilation of the ``librte_pmd_octeontx2`` driver.
+
+Runtime Config Options
+----------------------
+
+- ``HW offload ptype parsing disable`` (default ``0``)
+
+   Packet type parsing is HW offloaded by default and this feature may be toggled
+   using ``ptype_disable`` ``devargs`` parameter.
+
+- ``Rx&Tx scalar mode enable`` (default ``0``)
+
+   Ethdev supports both scalar and vector mode, it may be selected at runtime
+   using ``scalar_enable`` ``devargs`` parameter.
+
+- ``RSS reta size`` (default ``64``)
+
+   RSS redirection table size may be configured during runtime using ``reta_size``
+   ``devargs`` parameter.
+
+   For example::
+
+      -w 0002:02:00.0,reta_size=256
+
+   With the above configuration, reta table of size 256 is populated.
+
+- ``Flow priority levels`` (default ``3``)
+
+   RTE Flow priority levels can be configured during runtime using
+   ``flow_max_priority`` ``devargs`` parameter.
+
+   For example::
+
+      -w 0002:02:00.0,flow_max_priority=10
+
+   With the above configuration, priority level was set to 10 (0-9). Max
+   priority level supported is 32.
+
+- ``Reserve Flow entries`` (default ``8``)
+
+   RTE flow entries can be pre allocated and the size of pre allocation can be
+   selected runtime using ``flow_prealloc_size`` ``devargs`` parameter.
+
+   For example::
+
+      -w 0002:02:00.0,flow_prealloc_size=4
+
+   With the above configuration, pre alloc size was set to 4. Max pre alloc
+   size supported is 32.
+
+- ``Max SQB buffer count`` (default ``512``)
+
+   Send queue descriptor buffer count may be limited during runtime using
+   ``max_sqb_count`` ``devargs`` parameter.
+
+   For example::
+
+      -w 0002:02:00.0,max_sqb_count=64
+
+   With the above configuration, each send queue's decscriptor buffer count is
+   limited to a maximum of 64 buffers.
+
+
+.. note::
+
+   Above devarg parameters are configurable per device, user needs to pass the
+   parameters to all the PCIe devices if application requires to configure on
+   all the ethdev ports.
drivers/net/octeontx2/Makefile +3 -2
index fff95ab02..2705ccd9d 100644
@@ -32,9 +32,10 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
-	otx2_ethdev.c
+	otx2_ethdev.c	\
+	otx2_ethdev_devargs.c
 
 LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
-LDLIBS += -lrte_ethdev -lrte_bus_pci
+LDLIBS += -lrte_ethdev -lrte_bus_pci -lrte_kvargs
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build +1 -0
index b153f166d..b5c6fb978 100644
@@ -5,6 +5,7 @@
 sources = files(
 		'otx2_mac.c',
 		'otx2_ethdev.c',
+		'otx2_ethdev_devargs.c'
 		)
 
 deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2']
drivers/net/octeontx2/otx2_ethdev.c +7 -0
index 08f03b4c3..eeba0c2c6 100644
@@ -137,6 +137,13 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 	memset(&dev->otx2_eth_dev_data_start, 0, sizeof(*dev) -
 		offsetof(struct otx2_eth_dev, otx2_eth_dev_data_start));
 
+	/* Parse devargs string */
+	rc = otx2_ethdev_parse_devargs(eth_dev->device->devargs, dev);
+	if (rc) {
+		otx2_err("Failed to parse devargs rc=%d", rc);
+		goto error;
+	}
+
 	if (!dev->mbox_active) {
 		/* Initialize the base otx2_dev object
 		 * only if already present
drivers/net/octeontx2/otx2_ethdev.h +23 -0
index d9f72686a..a83688392 100644
@@ -9,11 +9,13 @@
 
 #include <rte_common.h>
 #include <rte_ethdev.h>
+#include <rte_kvargs.h>
 
 #include "otx2_common.h"
 #include "otx2_dev.h"
 #include "otx2_irq.h"
 #include "otx2_mempool.h"
+#include "otx2_rx.h"
 
 #define OTX2_ETH_DEV_PMD_VERSION	"1.0"
 
@@ -31,6 +33,10 @@
 /* Used for struct otx2_eth_dev::flags */
 #define OTX2_LINK_CFG_IN_PROGRESS_F	BIT_ULL(0)
 
+#define NIX_MAX_SQB			512
+#define NIX_MIN_SQB			32
+#define NIX_RSS_RETA_SIZE		64
+
 #define NIX_TX_OFFLOAD_CAPA ( \
 	DEV_TX_OFFLOAD_MBUF_FAST_FREE	| \
 	DEV_TX_OFFLOAD_MT_LOCKFREE	| \
@@ -56,6 +62,15 @@
 	DEV_RX_OFFLOAD_QINQ_STRIP | \
 	DEV_RX_OFFLOAD_TIMESTAMP)
 
+struct otx2_rss_info {
+	uint16_t rss_size;
+};
+
+struct otx2_npc_flow_info {
+	uint16_t flow_prealloc_size;
+	uint16_t flow_max_priority;
+};
+
 struct otx2_eth_dev {
 	OTX2_DEV; /* Base class */
 	MARKER otx2_eth_dev_data_start;
@@ -72,12 +87,16 @@ struct otx2_eth_dev {
 	uint16_t nix_msixoff;
 	uintptr_t base;
 	uintptr_t lmt_addr;
+	uint16_t scalar_ena;
+	uint16_t max_sqb_count;
 	uint16_t rx_offload_flags; /* Selected Rx offload flags(NIX_RX_*_F) */
 	uint64_t rx_offloads;
 	uint16_t tx_offload_flags; /* Selected Tx offload flags(NIX_TX_*_F) */
 	uint64_t tx_offloads;
 	uint64_t rx_offload_capa;
 	uint64_t tx_offload_capa;
+	struct otx2_rss_info rss_info;
+	struct otx2_npc_flow_info npc_flow;
 } __rte_cache_aligned;
 
 static inline struct otx2_eth_dev *
@@ -96,4 +115,8 @@ int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
 int otx2_nix_mac_addr_get(struct rte_eth_dev *eth_dev, uint8_t *addr);
 int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);
 
+/* Devargs */
+int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,
+			      struct otx2_eth_dev *dev);
+
 #endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ethdev_devargs.c new file +165 -0

165 lines not on this page · raw message

drivers/net/octeontx2/otx2_rx.h new file +10 -0
new file mode 100644
index 000000000..1749c43ff
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_RX_H__
+#define __OTX2_RX_H__
+
+#define NIX_RX_OFFLOAD_PTYPE_F         BIT(1)
+
+#endif /* __OTX2_RX_H__ */
Signature · 1 line
2.21.0
#140 lore raw

PATCH v3 5/58 net/octeontx2: handle device error interrupts

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Handle device specific error and ras interrupts.

---
 drivers/net/octeontx2/Makefile          |   1 +
 drivers/net/octeontx2/meson.build       |   1 +
 drivers/net/octeontx2/otx2_ethdev.c     |  12 +-
 drivers/net/octeontx2/otx2_ethdev.h     |   4 +
 drivers/net/octeontx2/otx2_ethdev_irq.c | 140 ++++++++++++++++++++++++
 5 files changed, 156 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_irq.c
drivers/net/octeontx2/Makefile +1 -0
index 2705ccd9d..77ba9b0da 100644
@@ -33,6 +33,7 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
 	otx2_ethdev.c	\
+	otx2_ethdev_irq.c \
 	otx2_ethdev_devargs.c
 
 LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
index b5c6fb978..148f7d339 100644
@@ -5,6 +5,7 @@
 sources = files(
 		'otx2_mac.c',
 		'otx2_ethdev.c',
+		'otx2_ethdev_irq.c',
 		'otx2_ethdev_devargs.c'
 		)
 
drivers/net/octeontx2/otx2_ethdev.c +10 -2
index eeba0c2c6..67a7ebb36 100644
@@ -175,12 +175,17 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 	if (rc)
 		goto otx2_npa_uninit;
 
+	/* Register LF irq handlers */
+	rc = otx2_nix_register_irqs(eth_dev);
+	if (rc)
+		goto mbox_detach;
+
 	/* Get maximum number of supported MAC entries */
 	max_entries = otx2_cgx_mac_max_entries_get(dev);
 	if (max_entries < 0) {
 		otx2_err("Failed to get max entries for mac addr");
 		rc = -ENOTSUP;
-		goto mbox_detach;
+		goto unregister_irq;
 	}
 
 	/* For VFs, returned max_entries will be 0. But to keep default MAC
@@ -194,7 +199,7 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 	if (eth_dev->data->mac_addrs == NULL) {
 		otx2_err("Failed to allocate memory for mac addr");
 		rc = -ENOMEM;
-		goto mbox_detach;
+		goto unregister_irq;
 	}
 
 	dev->max_mac_entries = max_entries;
@@ -226,6 +231,8 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 
 free_mac_addrs:
 	rte_free(eth_dev->data->mac_addrs);
+unregister_irq:
+	otx2_nix_unregister_irqs(eth_dev);
 mbox_detach:
 	otx2_eth_dev_lf_detach(dev->mbox);
 otx2_npa_uninit:
@@ -261,6 +268,7 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	dev->drv_inited = false;
 
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+	otx2_nix_unregister_irqs(eth_dev);
 
 	rc = otx2_eth_dev_lf_detach(dev->mbox);
 	if (rc)
drivers/net/octeontx2/otx2_ethdev.h +4 -0
index a83688392..f7d8838df 100644
@@ -105,6 +105,10 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)
 	return eth_dev->data->dev_private;
 }
 
+/* IRQ */
+int otx2_nix_register_irqs(struct rte_eth_dev *eth_dev);
+void otx2_nix_unregister_irqs(struct rte_eth_dev *eth_dev);
+
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_irq.c new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
2.21.0
#141 lore raw

PATCH v3 6/58 net/octeontx2: add info get operation

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add device information get operation.

---
 doc/guides/nics/features/octeontx2.ini     |  4 ++
 doc/guides/nics/features/octeontx2_vec.ini |  4 ++
 doc/guides/nics/features/octeontx2_vf.ini  |  3 +
 doc/guides/nics/octeontx2.rst              |  2 +
 drivers/net/octeontx2/Makefile             |  1 +
 drivers/net/octeontx2/meson.build          |  1 +
 drivers/net/octeontx2/otx2_ethdev.c        |  7 +++
 drivers/net/octeontx2/otx2_ethdev.h        | 45 +++++++++++++++
 drivers/net/octeontx2/otx2_ethdev_ops.c    | 64 ++++++++++++++++++++++
 9 files changed, 131 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_ops.c
doc/guides/nics/features/octeontx2.ini +4 -0
index 84d5ad779..356b88de7 100644
@@ -4,6 +4,10 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+SR-IOV               = Y
+Multiprocess aware   = Y
 Linux VFIO           = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/octeontx2_vec.ini +4 -0
index 5fd7e4c5c..5f4eaa3f4 100644
@@ -4,6 +4,10 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+SR-IOV               = Y
+Multiprocess aware   = Y
 Linux VFIO           = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/octeontx2_vf.ini +3 -0
index 3128cc120..024b032d4 100644
@@ -4,6 +4,9 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+Multiprocess aware   = Y
 Linux VFIO           = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/octeontx2.rst +2 -0
index 92a7ebc42..e3f4c2c43 100644
@@ -16,6 +16,8 @@ Features
 
 Features of the OCTEON TX2 Ethdev PMD are:
 
+- SR-IOV VF
+- Lock-free Tx queue
 
 Prerequisites
 -------------
drivers/net/octeontx2/Makefile +1 -0
index 77ba9b0da..3360fbd10 100644
@@ -34,6 +34,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
 	otx2_ethdev.c	\
 	otx2_ethdev_irq.c \
+	otx2_ethdev_ops.c \
 	otx2_ethdev_devargs.c
 
 LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
index 148f7d339..aa8417e3f 100644
@@ -6,6 +6,7 @@ sources = files(
 		'otx2_mac.c',
 		'otx2_ethdev.c',
 		'otx2_ethdev_irq.c',
+		'otx2_ethdev_ops.c',
 		'otx2_ethdev_devargs.c'
 		)
 
drivers/net/octeontx2/otx2_ethdev.c +7 -0
index 67a7ebb36..6e3c70559 100644
@@ -64,6 +64,11 @@ nix_lf_free(struct otx2_eth_dev *dev)
 	return otx2_mbox_process(mbox);
 }
 
+/* Initialize and register driver with DPDK Application */
+static const struct eth_dev_ops otx2_eth_dev_ops = {
+	.dev_infos_get            = otx2_nix_info_get,
+};
+
 static inline int
 nix_lf_attach(struct otx2_eth_dev *dev)
 {
@@ -120,6 +125,8 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 	struct rte_pci_device *pci_dev;
 	int rc, max_entries;
 
+	eth_dev->dev_ops = &otx2_eth_dev_ops;
+
 	/* For secondary processes, the primary has done all the work */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
 		/* Setup callbacks for secondary process */
drivers/net/octeontx2/otx2_ethdev.h +45 -0

60 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev_ops.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.21.0
#142 lore raw

PATCH v3 7/58 net/octeontx2: add device configure operation

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add device configure operation. This would call lf_alloc mailbox to allocate a NIX LF and upon return, AF will return the attributes for the select LF.

---
 drivers/net/octeontx2/otx2_ethdev.c | 151 ++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h |  11 ++
 2 files changed, 162 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +151 -0
index 6e3c70559..65d72a47f 100644
@@ -39,6 +39,52 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)
 	return NIX_TX_OFFLOAD_CAPA;
 }
 
+static int
+nix_lf_alloc(struct otx2_eth_dev *dev, uint32_t nb_rxq, uint32_t nb_txq)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+	struct nix_lf_alloc_req *req;
+	struct nix_lf_alloc_rsp *rsp;
+	int rc;
+
+	req = otx2_mbox_alloc_msg_nix_lf_alloc(mbox);
+	req->rq_cnt = nb_rxq;
+	req->sq_cnt = nb_txq;
+	req->cq_cnt = nb_rxq;
+	/* XQE_SZ should be in Sync with NIX_CQ_ENTRY_SZ */
+	RTE_BUILD_BUG_ON(NIX_CQ_ENTRY_SZ != 128);
+	req->xqe_sz = NIX_XQESZ_W16;
+	req->rss_sz = dev->rss_info.rss_size;
+	req->rss_grps = NIX_RSS_GRPS;
+	req->npa_func = otx2_npa_pf_func_get();
+	req->sso_func = otx2_sso_pf_func_get();
+	req->rx_cfg = BIT_ULL(35 /* DIS_APAD */);
+	if (dev->rx_offloads & (DEV_RX_OFFLOAD_TCP_CKSUM |
+			 DEV_RX_OFFLOAD_UDP_CKSUM)) {
+		req->rx_cfg |= BIT_ULL(37 /* CSUM_OL4 */);
+		req->rx_cfg |= BIT_ULL(36 /* CSUM_IL4 */);
+	}
+
+	rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
+	if (rc)
+		return rc;
+
+	dev->sqb_size = rsp->sqb_size;
+	dev->tx_chan_base = rsp->tx_chan_base;
+	dev->rx_chan_base = rsp->rx_chan_base;
+	dev->rx_chan_cnt = rsp->rx_chan_cnt;
+	dev->tx_chan_cnt = rsp->tx_chan_cnt;
+	dev->lso_tsov4_idx = rsp->lso_tsov4_idx;
+	dev->lso_tsov6_idx = rsp->lso_tsov6_idx;
+	dev->lf_tx_stats = rsp->lf_tx_stats;
+	dev->lf_rx_stats = rsp->lf_rx_stats;
+	dev->cints = rsp->cints;
+	dev->qints = rsp->qints;
+	dev->npc_flow.channel = dev->rx_chan_base;
+
+	return 0;
+}
+
 static int
 nix_lf_free(struct otx2_eth_dev *dev)
 {
@@ -64,9 +110,114 @@ nix_lf_free(struct otx2_eth_dev *dev)
 	return otx2_mbox_process(mbox);
 }
 
+static int
+otx2_nix_configure(struct rte_eth_dev *eth_dev)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct rte_eth_dev_data *data = eth_dev->data;
+	struct rte_eth_conf *conf = &data->dev_conf;
+	struct rte_eth_rxmode *rxmode = &conf->rxmode;
+	struct rte_eth_txmode *txmode = &conf->txmode;
+	char ea_fmt[RTE_ETHER_ADDR_FMT_SIZE];
+	struct rte_ether_addr *ea;
+	uint8_t nb_rxq, nb_txq;
+	int rc;
+
+	rc = -EINVAL;
+
+	/* Sanity checks */
+	if (rte_eal_has_hugepages() == 0) {
+		otx2_err("Huge page is not configured");
+		goto fail;
+	}
+
+	if (rte_eal_iova_mode() != RTE_IOVA_VA) {
+		otx2_err("iova mode should be va");
+		goto fail;
+	}
+
+	if (conf->link_speeds & ETH_LINK_SPEED_FIXED) {
+		otx2_err("Setting link speed/duplex not supported");
+		goto fail;
+	}
+
+	if (conf->dcb_capability_en == 1) {
+		otx2_err("dcb enable is not supported");
+		goto fail;
+	}
+
+	if (conf->fdir_conf.mode != RTE_FDIR_MODE_NONE) {
+		otx2_err("Flow director is not supported");
+		goto fail;
+	}
+
+	if (rxmode->mq_mode != ETH_MQ_RX_NONE &&
+	    rxmode->mq_mode != ETH_MQ_RX_RSS) {
+		otx2_err("Unsupported mq rx mode %d", rxmode->mq_mode);
+		goto fail;
+	}
+
+	if (txmode->mq_mode != ETH_MQ_TX_NONE) {
+		otx2_err("Unsupported mq tx mode %d", txmode->mq_mode);
+		goto fail;
+	}
+
+	/* Free the resources allocated from the previous configure */
+	if (dev->configured == 1)
+		nix_lf_free(dev);
+
+	if (otx2_dev_is_A0(dev) &&
+	    (txmode->offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
+	    ((txmode->offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
+	    (txmode->offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM))) {
+		otx2_err("Outer IP and SCTP checksum unsupported");
+		rc = -EINVAL;
+		goto fail;
+	}
+
+	dev->rx_offloads = rxmode->offloads;
+	dev->tx_offloads = txmode->offloads;
+	dev->rss_info.rss_grps = NIX_RSS_GRPS;
+
+	nb_rxq = RTE_MAX(data->nb_rx_queues, 1);
+	nb_txq = RTE_MAX(data->nb_tx_queues, 1);
+
+	/* Alloc a nix lf */
+	rc = nix_lf_alloc(dev, nb_rxq, nb_txq);
+	if (rc) {
+		otx2_err("Failed to init nix_lf rc=%d", rc);
+		goto fail;
+	}
+
+	/* Update the mac address */
+	ea = eth_dev->data->mac_addrs;
+	memcpy(ea, dev->mac_addr, RTE_ETHER_ADDR_LEN);
+	if (rte_is_zero_ether_addr(ea))
+		rte_eth_random_addr((uint8_t *)ea);
+
+	rte_ether_format_addr(ea_fmt, RTE_ETHER_ADDR_FMT_SIZE, ea);
+
+	otx2_nix_dbg("Configured port%d mac=%s nb_rxq=%d nb_txq=%d"
+		" rx_offloads=0x%" PRIx64 " tx_offloads=0x%" PRIx64 ""
+		" rx_flags=0x%x tx_flags=0x%x",
+		eth_dev->data->port_id, ea_fmt, nb_rxq,
+		nb_txq, dev->rx_offloads, dev->tx_offloads,
+		dev->rx_offload_flags, dev->tx_offload_flags);
+
+	/* All good */
+	dev->configured = 1;
+	dev->configured_nb_rx_qs = data->nb_rx_queues;
+	dev->configured_nb_tx_qs = data->nb_tx_queues;
+	return 0;
+
+fail:
+	return rc;
+}
+
 /* Initialize and register driver with DPDK Application */
 static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.dev_infos_get            = otx2_nix_info_get,
+	.dev_configure            = otx2_nix_configure,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +11 -0
index 666ceba91..c1528e2ac 100644
@@ -59,11 +59,14 @@
 
 #define NIX_MAX_SQB			512
 #define NIX_MIN_SQB			32
+/* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/
+#define NIX_RSS_GRPS			8
 #define NIX_HASH_KEY_SIZE		48 /* 352 Bits */
 #define NIX_RSS_RETA_SIZE		64
 #define	NIX_RX_MIN_DESC			16
 #define NIX_RX_MIN_DESC_ALIGN		16
 #define NIX_RX_NB_SEG_MAX		6
+#define NIX_CQ_ENTRY_SZ			128
 
 /* If PTP is enabled additional SEND MEM DESC is required which
  * takes 2 words, hence max 7 iova address are possible
@@ -105,9 +108,11 @@
 
 struct otx2_rss_info {
 	uint16_t rss_size;
+	uint8_t rss_grps;
 };
 
 struct otx2_npc_flow_info {
+	uint16_t channel; /*rx channel */
 	uint16_t flow_prealloc_size;
 	uint16_t flow_max_priority;
 };
@@ -124,7 +129,13 @@ struct otx2_eth_dev {
 	uint8_t lso_tsov6_idx;
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
 	uint8_t max_mac_entries;
+	uint8_t lf_tx_stats;
+	uint8_t lf_rx_stats;
+	uint16_t cints;
+	uint16_t qints;
 	uint8_t configured;
+	uint8_t configured_nb_rx_qs;
+	uint8_t configured_nb_tx_qs;
 	uint16_t nix_msixoff;
 	uintptr_t base;
 	uintptr_t lmt_addr;
Signature · 1 line
2.21.0
#143 lore raw

PATCH v3 8/58 net/octeontx2: handle queue specific error interrupts

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Handle queue specific error interrupts.

---
 doc/guides/nics/octeontx2.rst           |   1 +
 drivers/net/octeontx2/otx2_ethdev.c     |  16 +-
 drivers/net/octeontx2/otx2_ethdev.h     |   9 ++
 drivers/net/octeontx2/otx2_ethdev_irq.c | 191 ++++++++++++++++++++++++
 4 files changed, 216 insertions(+), 1 deletion(-)
doc/guides/nics/octeontx2.rst +1 -0
index e3f4c2c43..50e825968 100644
@@ -18,6 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 
 - SR-IOV VF
 - Lock-free Tx queue
+- Debug utilities - error interrupt support
 
 Prerequisites
 -------------
drivers/net/octeontx2/otx2_ethdev.c +15 -1
index 65d72a47f..045855c2e 100644
@@ -163,8 +163,10 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 	}
 
 	/* Free the resources allocated from the previous configure */
-	if (dev->configured == 1)
+	if (dev->configured == 1) {
+		oxt2_nix_unregister_queue_irqs(eth_dev);
 		nix_lf_free(dev);
+	}
 
 	if (otx2_dev_is_A0(dev) &&
 	    (txmode->offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
@@ -189,6 +191,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto fail;
 	}
 
+	/* Register queue IRQs */
+	rc = oxt2_nix_register_queue_irqs(eth_dev);
+	if (rc) {
+		otx2_err("Failed to register queue interrupts rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	/* Update the mac address */
 	ea = eth_dev->data->mac_addrs;
 	memcpy(ea, dev->mac_addr, RTE_ETHER_ADDR_LEN);
@@ -210,6 +219,8 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 	dev->configured_nb_tx_qs = data->nb_tx_queues;
 	return 0;
 
+free_nix_lf:
+	rc = nix_lf_free(dev);
 fail:
 	return rc;
 }
@@ -413,6 +424,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	/* Unregister queue irqs */
+	oxt2_nix_unregister_queue_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 +9 -0
index c1528e2ac..d9cdd33b5 100644
@@ -106,6 +106,11 @@
 	DEV_RX_OFFLOAD_QINQ_STRIP | \
 	DEV_RX_OFFLOAD_TIMESTAMP)
 
+struct otx2_qint {
+	struct rte_eth_dev *eth_dev;
+	uint8_t qintx;
+};
+
 struct otx2_rss_info {
 	uint16_t rss_size;
 	uint8_t rss_grps;
@@ -134,6 +139,7 @@ struct otx2_eth_dev {
 	uint16_t cints;
 	uint16_t qints;
 	uint8_t configured;
+	uint8_t configured_qints;
 	uint8_t configured_nb_rx_qs;
 	uint8_t configured_nb_tx_qs;
 	uint16_t nix_msixoff;
@@ -147,6 +153,7 @@ struct otx2_eth_dev {
 	uint64_t tx_offloads;
 	uint64_t rx_offload_capa;
 	uint64_t tx_offload_capa;
+	struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT];
 	struct otx2_rss_info rss_info;
 	struct otx2_npc_flow_info npc_flow;
 } __rte_cache_aligned;
@@ -163,7 +170,9 @@ void otx2_nix_info_get(struct rte_eth_dev *eth_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);
 void otx2_nix_unregister_irqs(struct rte_eth_dev *eth_dev);
+void oxt2_nix_unregister_queue_irqs(struct rte_eth_dev *eth_dev);
 
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_irq.c +191 -0

197 lines not on this page · raw message

Signature · 1 line
2.21.0
#144 lore raw

PATCH v3 9/58 net/octeontx2: add context debug utils

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add RQ,SQ,CQ context and CQE structure dump utils.

---
 doc/guides/nics/octeontx2.rst             |   2 +-
 drivers/net/octeontx2/Makefile            |   1 +
 drivers/net/octeontx2/meson.build         |   1 +
 drivers/net/octeontx2/otx2_ethdev.h       |   4 +
 drivers/net/octeontx2/otx2_ethdev_debug.c | 272 ++++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev_irq.c   |   6 +
 6 files changed, 285 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/octeontx2/otx2_ethdev_debug.c
doc/guides/nics/octeontx2.rst +1 -1
index 50e825968..75d5746e8 100644
@@ -18,7 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 
 - SR-IOV VF
 - Lock-free Tx queue
-- Debug utilities - error interrupt support
+- Debug utilities - Context dump and error interrupt support
 
 Prerequisites
 -------------
drivers/net/octeontx2/Makefile +1 -0
index 3360fbd10..840339aab 100644
@@ -35,6 +35,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_ethdev.c	\
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
+	otx2_ethdev_debug.c \
 	otx2_ethdev_devargs.c
 
 LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
index aa8417e3f..a06e1192c 100644
@@ -7,6 +7,7 @@ sources = files(
 		'otx2_ethdev.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
+		'otx2_ethdev_debug.c',
 		'otx2_ethdev_devargs.c'
 		)
 
drivers/net/octeontx2/otx2_ethdev.h +4 -0
index d9cdd33b5..7c0bef28e 100644
@@ -174,6 +174,10 @@ int oxt2_nix_register_queue_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);
 
+/* Debug */
+int otx2_nix_queues_ctx_dump(struct rte_eth_dev *eth_dev);
+void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
+
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_debug.c new file +272 -0

272 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev_irq.c +6 -0
index 476c7ea78..fdebdef38 100644
@@ -23,6 +23,8 @@ nix_lf_err_irq(void *param)
 
 	/* Clear interrupt */
 	otx2_write64(intr, dev->base + NIX_LF_ERR_INT);
+
+	otx2_nix_queues_ctx_dump(eth_dev);
 }
 
 static int
@@ -75,6 +77,8 @@ nix_lf_ras_irq(void *param)
 
 	/* Clear interrupt */
 	otx2_write64(intr, dev->base + NIX_LF_RAS);
+
+	otx2_nix_queues_ctx_dump(eth_dev);
 }
 
 static int
@@ -232,6 +236,8 @@ nix_lf_q_irq(void *param)
 
 	/* Clear interrupt */
 	otx2_write64(intr, dev->base + NIX_LF_QINTX_INT(qintx));
+
+	otx2_nix_queues_ctx_dump(eth_dev);
 }
 
 int
Signature · 1 line
2.21.0
#145 lore raw

PATCH v3 10/58 net/octeontx2: add register dump support

In reply to [email protected]

From: Kiran Kumar K <[email protected]>

Add register dump support and mark Registers dump in features.

---
 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_debug.c  | 228 +++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev_irq.c    |   6 +
 7 files changed, 241 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index 356b88de7..7d53bf0e7 100644
@@ -8,6 +8,7 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 5f4eaa3f4..e0cc7b22d 100644
@@ -8,6 +8,7 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 024b032d4..6dfdf88c6 100644
@@ -7,6 +7,7 @@
 Speed capabilities   = Y
 Lock-free Tx queue   = Y
 Multiprocess aware   = Y
+Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/octeontx2/otx2_ethdev.c +1 -0
index 045855c2e..48d5a15d6 100644
@@ -229,6 +229,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.dev_infos_get            = otx2_nix_info_get,
 	.dev_configure            = otx2_nix_configure,
+	.get_reg                  = otx2_nix_dev_get_reg,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +3 -0
index 7c0bef28e..7313689b0 100644
@@ -175,6 +175,9 @@ void otx2_nix_unregister_irqs(struct rte_eth_dev *eth_dev);
 void oxt2_nix_unregister_queue_irqs(struct rte_eth_dev *eth_dev);
 
 /* Debug */
+int otx2_nix_reg_dump(struct otx2_eth_dev *dev, uint64_t *data);
+int otx2_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
+			 struct rte_dev_reg_info *regs);
 int otx2_nix_queues_ctx_dump(struct rte_eth_dev *eth_dev);
 void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
 
drivers/net/octeontx2/otx2_ethdev_debug.c +228 -0

234 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev_irq.c +6 -0
index fdebdef38..066aca7a5 100644
@@ -24,6 +24,8 @@ nix_lf_err_irq(void *param)
 	/* Clear interrupt */
 	otx2_write64(intr, dev->base + NIX_LF_ERR_INT);
 
+	/* Dump registers to std out */
+	otx2_nix_reg_dump(dev, NULL);
 	otx2_nix_queues_ctx_dump(eth_dev);
 }
 
@@ -78,6 +80,8 @@ nix_lf_ras_irq(void *param)
 	/* Clear interrupt */
 	otx2_write64(intr, dev->base + NIX_LF_RAS);
 
+	/* Dump registers to std out */
+	otx2_nix_reg_dump(dev, NULL);
 	otx2_nix_queues_ctx_dump(eth_dev);
 }
 
@@ -237,6 +241,8 @@ nix_lf_q_irq(void *param)
 	/* Clear interrupt */
 	otx2_write64(intr, dev->base + NIX_LF_QINTX_INT(qintx));
 
+	/* Dump registers to std out */
+	otx2_nix_reg_dump(dev, NULL);
 	otx2_nix_queues_ctx_dump(eth_dev);
 }
 
Signature · 1 line
2.21.0
#146 lore raw

PATCH v3 11/58 net/octeontx2: add link stats operations

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

Add link stats related operations and mark respective items in the documentation.

---
 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/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |   8 ++
 drivers/net/octeontx2/otx2_ethdev.h        |   8 ++
 drivers/net/octeontx2/otx2_link.c          | 108 +++++++++++++++++++++
 9 files changed, 133 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_link.c
doc/guides/nics/features/octeontx2.ini +2 -0
index 7d53bf0e7..828351409 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
index e0cc7b22d..719692dc6 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
index 6dfdf88c6..4d5667583 100644
@@ -7,6 +7,8 @@
 Speed capabilities   = Y
 Lock-free Tx queue   = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/octeontx2.rst +1 -0
index 75d5746e8..a163f9128 100644
@@ -18,6 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 
 - SR-IOV VF
 - Lock-free Tx queue
+- Link state information
 - Debug utilities - Context dump and error interrupt support
 
 Prerequisites
drivers/net/octeontx2/Makefile +1 -0
index 840339aab..f6db918af 100644
@@ -32,6 +32,7 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
+	otx2_link.c	\
 	otx2_ethdev.c	\
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
index a06e1192c..d693386b9 100644
@@ -4,6 +4,7 @@
 
 sources = files(
 		'otx2_mac.c',
+		'otx2_link.c',
 		'otx2_ethdev.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +8 -0
index 48d5a15d6..cb4f6ebb9 100644
@@ -39,6 +39,10 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)
 	return NIX_TX_OFFLOAD_CAPA;
 }
 
+static const struct otx2_dev_ops otx2_dev_ops = {
+	.link_status_update = otx2_eth_dev_link_status_update,
+};
+
 static int
 nix_lf_alloc(struct otx2_eth_dev *dev, uint32_t nb_rxq, uint32_t nb_txq)
 {
@@ -229,6 +233,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.dev_infos_get            = otx2_nix_info_get,
 	.dev_configure            = otx2_nix_configure,
+	.link_update              = otx2_nix_link_update,
 	.get_reg                  = otx2_nix_dev_get_reg,
 };
 
@@ -324,6 +329,9 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 			goto error;
 		}
 	}
+	/* Device generic callbacks */
+	dev->ops = &otx2_dev_ops;
+	dev->eth_dev = eth_dev;
 
 	/* Grab the NPA LF if required */
 	rc = otx2_npa_lf_init(pci_dev, dev);
drivers/net/octeontx2/otx2_ethdev.h +8 -0
index 7313689b0..d8490337d 100644
@@ -136,6 +136,7 @@ struct otx2_eth_dev {
 	uint8_t max_mac_entries;
 	uint8_t lf_tx_stats;
 	uint8_t lf_rx_stats;
+	uint16_t flags;
 	uint16_t cints;
 	uint16_t qints;
 	uint8_t configured;
@@ -156,6 +157,7 @@ struct otx2_eth_dev {
 	struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT];
 	struct otx2_rss_info rss_info;
 	struct otx2_npc_flow_info npc_flow;
+	struct rte_eth_dev *eth_dev;
 } __rte_cache_aligned;
 
 static inline struct otx2_eth_dev *
@@ -168,6 +170,12 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)
 void otx2_nix_info_get(struct rte_eth_dev *eth_dev,
 		       struct rte_eth_dev_info *dev_info);
 
+/* 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);
+void otx2_eth_dev_link_status_update(struct otx2_dev *dev,
+				     struct cgx_link_user_info *link);
+
 /* IRQ */
 int otx2_nix_register_irqs(struct rte_eth_dev *eth_dev);
 int oxt2_nix_register_queue_irqs(struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_link.c new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
2.21.0
#147 lore raw

PATCH v3 12/58 net/octeontx2: add basic stats operation

In reply to [email protected]

From: Kiran Kumar K <[email protected]>

Add basic stat operation and updated the feature list.

---
 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/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |   3 +
 drivers/net/octeontx2/otx2_ethdev.h        |  17 +++
 drivers/net/octeontx2/otx2_stats.c         | 117 +++++++++++++++++++++
 9 files changed, 146 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_stats.c
doc/guides/nics/features/octeontx2.ini +2 -0
index 828351409..557107016 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Basic stats          = Y
+Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
index 719692dc6..3a2b78e06 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Basic stats          = Y
+Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
index 4d5667583..499f66c5c 100644
@@ -9,6 +9,8 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Basic stats          = Y
+Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/octeontx2.rst +1 -0
index a163f9128..2944bbb99 100644
@@ -18,6 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 
 - SR-IOV VF
 - Lock-free Tx queue
+- Port hardware statistics
 - Link state information
 - Debug utilities - Context dump and error interrupt support
 
drivers/net/octeontx2/Makefile +1 -0
index f6db918af..5cb722482 100644
@@ -33,6 +33,7 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
 	otx2_link.c	\
+	otx2_stats.c	\
 	otx2_ethdev.c	\
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
index d693386b9..1c57b1bb4 100644
@@ -5,6 +5,7 @@
 sources = files(
 		'otx2_mac.c',
 		'otx2_link.c',
+		'otx2_stats.c',
 		'otx2_ethdev.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +3 -0
index cb4f6ebb9..5787029d9 100644
@@ -234,7 +234,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.dev_infos_get            = otx2_nix_info_get,
 	.dev_configure            = otx2_nix_configure,
 	.link_update              = otx2_nix_link_update,
+	.stats_get                = otx2_nix_dev_stats_get,
+	.stats_reset              = otx2_nix_dev_stats_reset,
 	.get_reg                  = otx2_nix_dev_get_reg,
+	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +17 -0
index d8490337d..1cd9893a6 100644
@@ -77,6 +77,12 @@
 #define NIX_TX_NB_SEG_MAX		9
 #endif
 
+#define CQ_OP_STAT_OP_ERR	63
+#define CQ_OP_STAT_CQ_ERR	46
+
+#define OP_ERR			BIT_ULL(CQ_OP_STAT_OP_ERR)
+#define CQ_ERR			BIT_ULL(CQ_OP_STAT_CQ_ERR)
+
 #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)
@@ -156,6 +162,8 @@ struct otx2_eth_dev {
 	uint64_t tx_offload_capa;
 	struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT];
 	struct otx2_rss_info rss_info;
+	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
+	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	struct otx2_npc_flow_info npc_flow;
 	struct rte_eth_dev *eth_dev;
 } __rte_cache_aligned;
@@ -189,6 +197,15 @@ int otx2_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
 int otx2_nix_queues_ctx_dump(struct rte_eth_dev *eth_dev);
 void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
 
+/* Stats */
+int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_stats *stats);
+void otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
+
+int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
+				 uint16_t queue_id, uint8_t stat_idx,
+				 uint8_t is_rx);
+
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_stats.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.21.0
#148 lore raw

PATCH v3 13/58 net/octeontx2: add extended stats operations

In reply to [email protected]

From: Kiran Kumar K <[email protected]>

Add extended operations and updated the feature list.

---
 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        |   5 +
 drivers/net/octeontx2/otx2_ethdev.h        |  13 +
 drivers/net/octeontx2/otx2_stats.c         | 270 +++++++++++++++++++++
 6 files changed, 291 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index 557107016..8d7c3588c 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Basic stats          = Y
 Stats per queue      = Y
+Extended stats       = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 3a2b78e06..a6e6876fa 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Basic stats          = Y
+Extended stats       = Y
 Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 499f66c5c..6ec83e823 100644
@@ -10,6 +10,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Basic stats          = Y
+Extended stats       = Y
 Stats per queue      = Y
 Registers dump       = Y
 Linux VFIO           = Y
drivers/net/octeontx2/otx2_ethdev.c +5 -0
index 5787029d9..937ba6399 100644
@@ -238,6 +238,11 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.stats_reset              = otx2_nix_dev_stats_reset,
 	.get_reg                  = otx2_nix_dev_get_reg,
 	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
+	.xstats_get               = otx2_nix_xstats_get,
+	.xstats_get_names         = otx2_nix_xstats_get_names,
+	.xstats_reset             = otx2_nix_xstats_reset,
+	.xstats_get_by_id         = otx2_nix_xstats_get_by_id,
+	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +13 -0
index 1cd9893a6..7d53a6643 100644
@@ -205,6 +205,19 @@ void otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
 				 uint16_t queue_id, uint8_t stat_idx,
 				 uint8_t is_rx);
+int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
+			struct rte_eth_xstat *xstats, unsigned int n);
+int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+			      struct rte_eth_xstat_name *xstats_names,
+			      unsigned int limit);
+void otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+
+int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev,
+			      const uint64_t *ids,
+			      uint64_t *values, unsigned int n);
+int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
+				    struct rte_eth_xstat_name *xstats_names,
+				    const uint64_t *ids, unsigned int limit);
 
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_stats.c +270 -0

279 lines not on this page · raw message

Signature · 1 line
2.21.0
#149 lore raw

PATCH v3 14/58 net/octeontx2: add promiscuous and allmulticast mode

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

Add promiscuous and allmulticast mode for PF devices and update the respective feature list.

---
 doc/guides/nics/features/octeontx2.ini     |  2 +
 doc/guides/nics/features/octeontx2_vec.ini |  2 +
 doc/guides/nics/octeontx2.rst              |  1 +
 drivers/net/octeontx2/otx2_ethdev.c        |  4 ++
 drivers/net/octeontx2/otx2_ethdev.h        |  6 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    | 82 ++++++++++++++++++++++
 6 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
index 8d7c3588c..9f682609d 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
index a6e6876fa..764e95ce6 100644
@@ -10,6 +10,8 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 2944bbb99..9ef7be08f 100644
@@ -16,6 +16,7 @@ Features
 
 Features of the OCTEON TX2 Ethdev PMD are:
 
+- Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
 - Port hardware statistics
drivers/net/octeontx2/otx2_ethdev.c +4 -0
index 937ba6399..826ce7f4e 100644
@@ -237,6 +237,10 @@ 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,
+	.promiscuous_enable       = otx2_nix_promisc_enable,
+	.promiscuous_disable      = otx2_nix_promisc_disable,
+	.allmulticast_enable      = otx2_nix_allmulticast_enable,
+	.allmulticast_disable     = otx2_nix_allmulticast_disable,
 	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
 	.xstats_get               = otx2_nix_xstats_get,
 	.xstats_get_names         = otx2_nix_xstats_get_names,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
index 7d53a6643..814fd6ec3 100644
@@ -178,6 +178,12 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)
 void otx2_nix_info_get(struct rte_eth_dev *eth_dev,
 		       struct rte_eth_dev_info *dev_info);
 
+void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
+void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
+void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
+void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
+void otx2_nix_allmulticast_disable(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 +82 -0

88 lines not on this page · raw message

Signature · 1 line
2.21.0
#150 lore raw

PATCH v3 15/58 net/octeontx2: add unicast MAC filter

In reply to [email protected]

From: Sunil Kumar Kori <[email protected]>

Add unicast MAC filter for PF device and
update the respective feature list.

---
 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        |  3 +
 drivers/net/octeontx2/otx2_ethdev.h        |  6 ++
 drivers/net/octeontx2/otx2_mac.c           | 77 ++++++++++++++++++++++
 6 files changed, 89 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index 9f682609d..566496113 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
+Unicast MAC filter   = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 764e95ce6..195a48940 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
+Unicast MAC filter   = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 9ef7be08f..8385c9c18 100644
@@ -19,6 +19,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
+- MAC filtering
 - Port hardware statistics
 - Link state information
 - Debug utilities - Context dump and error interrupt support
drivers/net/octeontx2/otx2_ethdev.c +3 -0
index 826ce7f4e..a72c901f4 100644
@@ -237,6 +237,9 @@ 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,
+	.mac_addr_add             = otx2_nix_mac_addr_add,
+	.mac_addr_remove          = otx2_nix_mac_addr_del,
+	.mac_addr_set             = otx2_nix_mac_addr_set,
 	.promiscuous_enable       = otx2_nix_promisc_enable,
 	.promiscuous_disable      = otx2_nix_promisc_disable,
 	.allmulticast_enable      = otx2_nix_allmulticast_enable,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
index 814fd6ec3..56517845b 100644
@@ -232,7 +232,13 @@ int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 
 /* Mac address handling */
+int otx2_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
+			  struct rte_ether_addr *addr);
 int otx2_nix_mac_addr_get(struct rte_eth_dev *eth_dev, uint8_t *addr);
+int otx2_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
+			  struct rte_ether_addr *addr,
+			  uint32_t index, uint32_t pool);
+void otx2_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index);
 int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);
 
 /* Devargs */
drivers/net/octeontx2/otx2_mac.c +77 -0

83 lines not on this page · raw message

Signature · 1 line
2.21.0
#151 lore raw

PATCH v3 16/58 net/octeontx2: add RSS support

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

Add RSS support and expose RSS related functions
to implement RSS action for rte_flow driver.

---
 doc/guides/nics/features/octeontx2.ini     |   4 +
 doc/guides/nics/features/octeontx2_vec.ini |   4 +
 doc/guides/nics/features/octeontx2_vf.ini  |   4 +
 doc/guides/nics/octeontx2.rst              |   1 +
 drivers/net/octeontx2/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |  11 +
 drivers/net/octeontx2/otx2_ethdev.h        |  33 ++
 drivers/net/octeontx2/otx2_rss.c           | 372 +++++++++++++++++++++
 9 files changed, 431 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_rss.c
doc/guides/nics/features/octeontx2.ini +4 -0
index 566496113..f2d47d57b 100644
@@ -13,6 +13,10 @@ Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+Inner RSS            = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +4 -0
index 195a48940..a67353d2a 100644
@@ -13,6 +13,10 @@ Link status event    = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+Inner RSS            = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/features/octeontx2_vf.ini +4 -0
index 6ec83e823..97d66ddde 100644
@@ -9,6 +9,10 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+Inner RSS            = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 8385c9c18..3bee3f3ca 100644
@@ -19,6 +19,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
+- Receiver Side Scaling (RSS)
 - MAC filtering
 - Port hardware statistics
 - Link state information
drivers/net/octeontx2/Makefile +1 -0
index 5cb722482..24931865d 100644
@@ -31,6 +31,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
+	otx2_rss.c	\
 	otx2_mac.c	\
 	otx2_link.c	\
 	otx2_stats.c	\
drivers/net/octeontx2/meson.build +1 -0
index 1c57b1bb4..8681a2642 100644
@@ -3,6 +3,7 @@
 #
 
 sources = files(
+		'otx2_rss.c',
 		'otx2_mac.c',
 		'otx2_link.c',
 		'otx2_stats.c',
drivers/net/octeontx2/otx2_ethdev.c +11 -0
index a72c901f4..5289c79e8 100644
@@ -195,6 +195,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto fail;
 	}
 
+	/* Configure RSS */
+	rc = otx2_nix_rss_config(eth_dev);
+	if (rc) {
+		otx2_err("Failed to configure rss rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	/* Register queue IRQs */
 	rc = oxt2_nix_register_queue_irqs(eth_dev);
 	if (rc) {
@@ -245,6 +252,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.allmulticast_enable      = otx2_nix_allmulticast_enable,
 	.allmulticast_disable     = otx2_nix_allmulticast_disable,
 	.queue_stats_mapping_set  = otx2_nix_queue_stats_mapping,
+	.reta_update              = otx2_nix_dev_reta_update,
+	.reta_query               = otx2_nix_dev_reta_query,
+	.rss_hash_update          = otx2_nix_rss_hash_update,
+	.rss_hash_conf_get        = otx2_nix_rss_hash_conf_get,
 	.xstats_get               = otx2_nix_xstats_get,
 	.xstats_get_names         = otx2_nix_xstats_get_names,
 	.xstats_reset             = otx2_nix_xstats_reset,
drivers/net/octeontx2/otx2_ethdev.h +33 -0
index 56517845b..19a4e45b0 100644
@@ -59,6 +59,7 @@
 
 #define NIX_MAX_SQB			512
 #define NIX_MIN_SQB			32
+#define NIX_RSS_RETA_SIZE_MAX		256
 /* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/
 #define NIX_RSS_GRPS			8
 #define NIX_HASH_KEY_SIZE		48 /* 352 Bits */
@@ -112,14 +113,22 @@
 	DEV_RX_OFFLOAD_QINQ_STRIP | \
 	DEV_RX_OFFLOAD_TIMESTAMP)
 
+#define NIX_DEFAULT_RSS_CTX_GROUP  0
+#define NIX_DEFAULT_RSS_MCAM_IDX  -1
+
 struct otx2_qint {
 	struct rte_eth_dev *eth_dev;
 	uint8_t qintx;
 };
 
 struct otx2_rss_info {
+	uint64_t nix_rss;
+	uint32_t flowkey_cfg;
 	uint16_t rss_size;
 	uint8_t rss_grps;
+	uint8_t alg_idx; /* Selected algo index */
+	uint16_t ind_tbl[NIX_RSS_RETA_SIZE_MAX];
+	uint8_t key[NIX_HASH_KEY_SIZE];
 };
 
 struct otx2_npc_flow_info {
@@ -225,6 +234,30 @@ int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
 				    struct rte_eth_xstat_name *xstats_names,
 				    const uint64_t *ids, unsigned int limit);
 
+/* RSS */
+void otx2_nix_rss_set_key(struct otx2_eth_dev *dev,
+			  uint8_t *key, uint32_t key_len);
+uint32_t otx2_rss_ethdev_to_nix(struct otx2_eth_dev *dev,
+				uint64_t ethdev_rss, uint8_t rss_level);
+int otx2_rss_set_hf(struct otx2_eth_dev *dev,
+		    uint32_t flowkey_cfg, uint8_t *alg_idx,
+		    uint8_t group, int mcam_index);
+int otx2_nix_rss_tbl_init(struct otx2_eth_dev *dev, uint8_t group,
+			  uint16_t *ind_tbl);
+int otx2_nix_rss_config(struct rte_eth_dev *eth_dev);
+
+int otx2_nix_dev_reta_update(struct rte_eth_dev *eth_dev,
+			     struct rte_eth_rss_reta_entry64 *reta_conf,
+			     uint16_t reta_size);
+int otx2_nix_dev_reta_query(struct rte_eth_dev *eth_dev,
+			    struct rte_eth_rss_reta_entry64 *reta_conf,
+			    uint16_t reta_size);
+int otx2_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
+			     struct rte_eth_rss_conf *rss_conf);
+
+int otx2_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_rss_conf *rss_conf);
+
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_rss.c new file +372 -0

372 lines not on this page · raw message

Signature · 1 line
2.21.0
#152 lore raw

PATCH v3 17/58 net/octeontx2: add Rx queue setup and release

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add Rx queue setup and release.

---
 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/Makefile             |   2 +-
 drivers/net/octeontx2/otx2_ethdev.c        | 310 +++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h        |  51 ++++
 drivers/net/octeontx2/otx2_ethdev_ops.c    |   2 +
 mk/rte.app.mk                              |   2 +-
 8 files changed, 368 insertions(+), 2 deletions(-)
doc/guides/nics/features/octeontx2.ini +1 -0
index f2d47d57b..d0a2204d2 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index a67353d2a..64125a73f 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 97d66ddde..acda5e680 100644
@@ -9,6 +9,7 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
drivers/net/octeontx2/Makefile +1 -1
index 24931865d..f938d9742 100644
@@ -42,6 +42,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_ethdev_devargs.c
 
 LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
-LDLIBS += -lrte_ethdev -lrte_bus_pci -lrte_kvargs
+LDLIBS += -lrte_ethdev -lrte_bus_pci -lrte_kvargs -lrte_mbuf  -lrte_mempool -lm
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/otx2_ethdev.c +310 -0

331 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h +51 -0

87 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev_ops.c +2 -0
index 301a597f8..71d36b44a 100644
@@ -143,4 +143,6 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
 	devinfo->speed_capa |= ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |
 				ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G |
 				ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G;
+
+	devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP;
 }
mk/rte.app.mk +1 -1
index fab72ff6a..a852e5157 100644
@@ -196,7 +196,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD)      += -lrte_pmd_mvpp2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD)     += -lrte_pmd_mvneta
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)        += -lrte_pmd_nfp
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)       += -lrte_pmd_null
-_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)  += -lrte_pmd_octeontx2
+_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)  += -lrte_pmd_octeontx2 -lm
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lrte_pmd_pcap -lpcap
 _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)       += -lrte_pmd_qede
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)       += -lrte_pmd_ring
Signature · 1 line
2.21.0
#153 lore raw

PATCH v3 18/58 net/octeontx2: add Tx queue setup and release

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add Tx queue setup and release.

---
 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              |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        | 404 ++++++++++++++++++++-
 drivers/net/octeontx2/otx2_ethdev.h        |  25 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    |   3 +-
 drivers/net/octeontx2/otx2_tx.h            |  28 ++
 8 files changed, 462 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/octeontx2/otx2_tx.h
doc/guides/nics/features/octeontx2.ini +1 -0
index d0a2204d2..c8f07fa1d 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 64125a73f..a98b7d523 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index acda5e680..9746357ce 100644
@@ -10,6 +10,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
doc/guides/nics/octeontx2.rst +1 -0
index 3bee3f3ca..d7e8f3d56 100644
@@ -19,6 +19,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
+- Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
 - MAC filtering
 - Port hardware statistics
drivers/net/octeontx2/otx2_ethdev.c +403 -1

427 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h +25 -0
index a09393336..0ce67f634 100644
@@ -19,6 +19,7 @@
 #include "otx2_irq.h"
 #include "otx2_mempool.h"
 #include "otx2_rx.h"
+#include "otx2_tx.h"
 
 #define OTX2_ETH_DEV_PMD_VERSION	"1.0"
 
@@ -62,6 +63,7 @@
 
 #define NIX_MAX_SQB			512
 #define NIX_MIN_SQB			32
+#define NIX_SQB_LIST_SPACE		2
 #define NIX_RSS_RETA_SIZE_MAX		256
 /* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/
 #define NIX_RSS_GRPS			8
@@ -72,6 +74,8 @@
 #define NIX_RX_NB_SEG_MAX		6
 #define NIX_CQ_ENTRY_SZ			128
 #define NIX_CQ_ALIGN			512
+#define NIX_SQB_LOWER_THRESH		90
+#define LMT_SLOT_MASK			0x7f
 
 /* If PTP is enabled additional SEND MEM DESC is required which
  * takes 2 words, hence max 7 iova address are possible
@@ -204,6 +208,24 @@ struct otx2_eth_dev {
 	struct rte_eth_dev *eth_dev;
 } __rte_cache_aligned;
 
+struct otx2_eth_txq {
+	uint64_t cmd[8];
+	int64_t fc_cache_pkts;
+	uint64_t *fc_mem;
+	void *lmt_addr;
+	rte_iova_t io_addr;
+	rte_iova_t fc_iova;
+	uint16_t sqes_per_sqb_log2;
+	int16_t nb_sqb_bufs_adj;
+	MARKER slow_path_start;
+	uint16_t nb_sqb_bufs;
+	uint16_t sq;
+	uint64_t offloads;
+	struct otx2_eth_dev *dev;
+	struct rte_mempool *sqb_pool;
+	struct otx2_eth_qconf qconf;
+} __rte_cache_aligned;
+
 struct otx2_eth_rxq {
 	uint64_t mbuf_initializer;
 	uint64_t data_off;
@@ -329,4 +351,7 @@ int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);
 int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct otx2_eth_dev *dev);
 
+/* Rx and Tx routines */
+void otx2_nix_form_default_desc(struct otx2_eth_txq *txq);
+
 #endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ethdev_ops.c +2 -1
index 71d36b44a..1c935b627 100644
@@ -144,5 +144,6 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
 				ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G |
 				ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G;
 
-	devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP;
+	devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
+				RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
 }
drivers/net/octeontx2/otx2_tx.h new file +28 -0
new file mode 100644
index 000000000..4d0993f87
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_TX_H__
+#define __OTX2_TX_H__
+
+#define NIX_TX_OFFLOAD_NONE		(0)
+#define NIX_TX_OFFLOAD_L3_L4_CSUM_F	BIT(0)
+#define NIX_TX_OFFLOAD_OL3_OL4_CSUM_F	BIT(1)
+#define NIX_TX_OFFLOAD_VLAN_QINQ_F	BIT(2)
+#define NIX_TX_OFFLOAD_MBUF_NOFF_F	BIT(3)
+#define NIX_TX_OFFLOAD_TSTAMP_F		BIT(4)
+
+/* Flags to control xmit_prepare function.
+ * Defining it from backwards to denote its been
+ * not used as offload flags to pick function
+ */
+#define NIX_TX_MULTI_SEG_F		BIT(15)
+
+#define NIX_TX_NEED_SEND_HDR_W1	\
+	(NIX_TX_OFFLOAD_L3_L4_CSUM_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |	\
+	 NIX_TX_OFFLOAD_VLAN_QINQ_F)
+
+#define NIX_TX_NEED_EXT_HDR \
+	(NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F)
+
+#endif /* __OTX2_TX_H__ */
Signature · 1 line
2.21.0
#154 lore raw

PATCH v3 19/58 net/octeontx2: handle port reconfigure

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

setup tx & rx queues with the previous configuration during port reconfig, it handles cases like port reconfigure without reconfiguring tx & rx queues.

---
 drivers/net/octeontx2/otx2_ethdev.c | 180 ++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h |   2 +
 2 files changed, 182 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +180 -0
index 92f008b69..86ecdc14c 100644
@@ -807,6 +807,172 @@ otx2_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t sq,
 	return rc;
 }
 
+static int
+nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct otx2_eth_qconf *tx_qconf = NULL;
+	struct otx2_eth_qconf *rx_qconf = NULL;
+	struct otx2_eth_txq **txq;
+	struct otx2_eth_rxq **rxq;
+	int i, nb_rxq, nb_txq;
+
+	nb_rxq = RTE_MIN(dev->configured_nb_rx_qs, eth_dev->data->nb_rx_queues);
+	nb_txq = RTE_MIN(dev->configured_nb_tx_qs, eth_dev->data->nb_tx_queues);
+
+	tx_qconf = malloc(nb_txq * sizeof(*tx_qconf));
+	if (tx_qconf == NULL) {
+		otx2_err("Failed to allocate memory for tx_qconf");
+		goto fail;
+	}
+
+	rx_qconf = malloc(nb_rxq * sizeof(*rx_qconf));
+	if (rx_qconf == NULL) {
+		otx2_err("Failed to allocate memory for rx_qconf");
+		goto fail;
+	}
+
+	txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
+	for (i = 0; i < nb_txq; i++) {
+		if (txq[i] == NULL) {
+			otx2_err("txq[%d] is already released", i);
+			goto fail;
+		}
+		memcpy(&tx_qconf[i], &txq[i]->qconf, sizeof(*tx_qconf));
+		otx2_nix_tx_queue_release(txq[i]);
+		eth_dev->data->tx_queues[i] = NULL;
+	}
+
+	rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues;
+	for (i = 0; i < nb_rxq; i++) {
+		if (rxq[i] == NULL) {
+			otx2_err("rxq[%d] is already released", i);
+			goto fail;
+		}
+		memcpy(&rx_qconf[i], &rxq[i]->qconf, sizeof(*rx_qconf));
+		otx2_nix_rx_queue_release(rxq[i]);
+		eth_dev->data->rx_queues[i] = NULL;
+	}
+
+	dev->tx_qconf = tx_qconf;
+	dev->rx_qconf = rx_qconf;
+	return 0;
+
+fail:
+	if (tx_qconf)
+		free(tx_qconf);
+	if (rx_qconf)
+		free(rx_qconf);
+
+	return -ENOMEM;
+}
+
+static int
+nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct otx2_eth_qconf *tx_qconf = dev->tx_qconf;
+	struct otx2_eth_qconf *rx_qconf = dev->rx_qconf;
+	struct otx2_eth_txq **txq;
+	struct otx2_eth_rxq **rxq;
+	int rc, i, nb_rxq, nb_txq;
+
+	nb_rxq = RTE_MIN(dev->configured_nb_rx_qs, eth_dev->data->nb_rx_queues);
+	nb_txq = RTE_MIN(dev->configured_nb_tx_qs, eth_dev->data->nb_tx_queues);
+
+	rc = -ENOMEM;
+	/* Setup tx & rx queues with previous configuration so
+	 * that the queues can be functional in cases like ports
+	 * are started without re configuring queues.
+	 *
+	 * Usual re config sequence is like below:
+	 * port_configure() {
+	 *      if(reconfigure) {
+	 *              queue_release()
+	 *              queue_setup()
+	 *      }
+	 *      queue_configure() {
+	 *              queue_release()
+	 *              queue_setup()
+	 *      }
+	 * }
+	 * port_start()
+	 *
+	 * In some application's control path, queue_configure() would
+	 * NOT be invoked for TXQs/RXQs in port_configure().
+	 * In such cases, queues can be functional after start as the
+	 * queues are already setup in port_configure().
+	 */
+	for (i = 0; i < nb_txq; i++) {
+		rc = otx2_nix_tx_queue_setup(eth_dev, i, tx_qconf[i].nb_desc,
+					     tx_qconf[i].socket_id,
+					     &tx_qconf[i].conf.tx);
+		if (rc) {
+			otx2_err("Failed to setup tx queue rc=%d", rc);
+			txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
+			for (i -= 1; i >= 0; i--)
+				otx2_nix_tx_queue_release(txq[i]);
+			goto fail;
+		}
+	}
+
+	free(tx_qconf); tx_qconf = NULL;
+
+	for (i = 0; i < nb_rxq; i++) {
+		rc = otx2_nix_rx_queue_setup(eth_dev, i, rx_qconf[i].nb_desc,
+					     rx_qconf[i].socket_id,
+					     &rx_qconf[i].conf.rx,
+					     rx_qconf[i].mempool);
+		if (rc) {
+			otx2_err("Failed to setup rx queue rc=%d", rc);
+			rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues;
+			for (i -= 1; i >= 0; i--)
+				otx2_nix_rx_queue_release(rxq[i]);
+			goto release_tx_queues;
+		}
+	}
+
+	free(rx_qconf); rx_qconf = NULL;
+
+	return 0;
+
+release_tx_queues:
+	txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+		otx2_nix_tx_queue_release(txq[i]);
+fail:
+	if (tx_qconf)
+		free(tx_qconf);
+	if (rx_qconf)
+		free(rx_qconf);
+
+	return rc;
+}
+
+static uint16_t
+nix_eth_nop_burst(void *queue, struct rte_mbuf **mbufs, uint16_t pkts)
+{
+	RTE_SET_USED(queue);
+	RTE_SET_USED(mbufs);
+	RTE_SET_USED(pkts);
+
+	return 0;
+}
+
+static void
+nix_set_nop_rxtx_function(struct rte_eth_dev *eth_dev)
+{
+	/* These dummy functions are required for supporting
+	 * some applications which reconfigure queues without
+	 * stopping tx burst and rx burst threads(eg kni app)
+	 * When the queues context is saved, txq/rxqs are released
+	 * which caused app crash since rx/tx burst is still
+	 * on different lcores
+	 */
+	eth_dev->tx_pkt_burst = nix_eth_nop_burst;
+	eth_dev->rx_pkt_burst = nix_eth_nop_burst;
+	rte_mb();
+}
 
 static int
 otx2_nix_configure(struct rte_eth_dev *eth_dev)
@@ -863,6 +1029,10 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 	/* Free the resources allocated from the previous configure */
 	if (dev->configured == 1) {
 		oxt2_nix_unregister_queue_irqs(eth_dev);
+		nix_set_nop_rxtx_function(eth_dev);
+		rc = nix_store_queue_cfg_and_then_release(eth_dev);
+		if (rc)
+			goto fail;
 		nix_lf_free(dev);
 	}
 
@@ -903,6 +1073,16 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto free_nix_lf;
 	}
 
+	/*
+	 * Restore queue config when reconfigure followed by
+	 * reconfigure and no queue configure invoked from application case.
+	 */
+	if (dev->configured == 1) {
+		rc = nix_restore_queue_cfg(eth_dev);
+		if (rc)
+			goto free_nix_lf;
+	}
+
 	/* Update the mac address */
 	ea = eth_dev->data->mac_addrs;
 	memcpy(ea, dev->mac_addr, RTE_ETHER_ADDR_LEN);
drivers/net/octeontx2/otx2_ethdev.h +2 -0
index 0ce67f634..ffc350e0d 100644
@@ -205,6 +205,8 @@ struct otx2_eth_dev {
 	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	struct otx2_npc_flow_info npc_flow;
+	struct otx2_eth_qconf *tx_qconf;
+	struct otx2_eth_qconf *rx_qconf;
 	struct rte_eth_dev *eth_dev;
 } __rte_cache_aligned;
 
Signature · 1 line
2.21.0
#155 lore raw

PATCH v3 20/58 net/octeontx2: add queue start and stop operations

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Add queue start and stop operations. Tx queue needs to update the flow control value, Which will be added in sub subsequent patch.

---
 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        | 92 ++++++++++++++++++++++
 drivers/net/octeontx2/otx2_ethdev.h        |  2 +
 5 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index c8f07fa1d..ca40358da 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index a98b7d523..b720c116f 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 9746357ce..5a287493f 100644
@@ -11,6 +11,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
drivers/net/octeontx2/otx2_ethdev.c +92 -0

110 lines not on this page · raw message

drivers/net/octeontx2/otx2_ethdev.h +2 -0
index ffc350e0d..4e06b7111 100644
@@ -266,6 +266,8 @@ void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
+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);
 
 /* Link */
Signature · 1 line
2.21.0
#156 lore raw

PATCH v3 21/58 net/octeontx2: introduce traffic manager

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Introduce traffic manager infra and default hierarchy creation.

Upon ethdev configure, a default hierarchy is created with one-to-one mapped tm nodes. This topology will be overridden when user explicitly creates and commits a new hierarchy using rte_tm interface.

---
 drivers/net/octeontx2/Makefile      |   1 +
 drivers/net/octeontx2/meson.build   |   1 +
 drivers/net/octeontx2/otx2_ethdev.c |  16 ++
 drivers/net/octeontx2/otx2_ethdev.h |  14 ++
 drivers/net/octeontx2/otx2_tm.c     | 252 ++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_tm.h     |  67 ++++++++
 6 files changed, 351 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_tm.c
 create mode 100644 drivers/net/octeontx2/otx2_tm.h
drivers/net/octeontx2/Makefile +1 -0
index f938d9742..dd64ba6da 100644
@@ -31,6 +31,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
+	otx2_tm.c	\
 	otx2_rss.c	\
 	otx2_mac.c	\
 	otx2_link.c	\
drivers/net/octeontx2/meson.build +1 -0
index 8681a2642..e344d877f 100644
@@ -3,6 +3,7 @@
 #
 
 sources = files(
+		'otx2_tm.c',
 		'otx2_rss.c',
 		'otx2_mac.c',
 		'otx2_link.c',
drivers/net/octeontx2/otx2_ethdev.c +16 -0
index 9a011de58..e64159c21 100644
@@ -1053,6 +1053,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		rc = nix_store_queue_cfg_and_then_release(eth_dev);
 		if (rc)
 			goto fail;
+		otx2_nix_tm_fini(eth_dev);
 		nix_lf_free(dev);
 	}
 
@@ -1086,6 +1087,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto free_nix_lf;
 	}
 
+	/* Init the default TM scheduler hierarchy */
+	rc = otx2_nix_tm_init_default(eth_dev);
+	if (rc) {
+		otx2_err("Failed to init traffic manager rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	/* Register queue IRQs */
 	rc = oxt2_nix_register_queue_irqs(eth_dev);
 	if (rc) {
@@ -1388,6 +1396,9 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)
 	/* Also sync same MAC address to CGX table */
 	otx2_cgx_mac_addr_set(eth_dev, &eth_dev->data->mac_addrs[0]);
 
+	/* Initialize the tm data structures */
+	otx2_nix_tm_conf_init(eth_dev);
+
 	dev->tx_offload_capa = nix_get_tx_offload_capa(dev);
 	dev->rx_offload_capa = nix_get_rx_offload_capa(dev);
 
@@ -1443,6 +1454,11 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	}
 	eth_dev->data->nb_rx_queues = 0;
 
+	/* Free tm resources */
+	rc = otx2_nix_tm_fini(eth_dev);
+	if (rc)
+		otx2_err("Failed to cleanup tm, rc=%d", rc);
+
 	/* Unregister queue irqs */
 	oxt2_nix_unregister_queue_irqs(eth_dev);
 
drivers/net/octeontx2/otx2_ethdev.h +14 -0
index 4e06b7111..9f73bf89b 100644
@@ -19,6 +19,7 @@
 #include "otx2_irq.h"
 #include "otx2_mempool.h"
 #include "otx2_rx.h"
+#include "otx2_tm.h"
 #include "otx2_tx.h"
 
 #define OTX2_ETH_DEV_PMD_VERSION	"1.0"
@@ -201,6 +202,19 @@ struct otx2_eth_dev {
 	uint64_t rx_offload_capa;
 	uint64_t tx_offload_capa;
 	struct otx2_qint qints_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];
+	uint16_t txschq_contig_index[NIX_TXSCH_LVL_CNT];
+	/* Dis-contiguous queues */
+	uint16_t txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	/* Contiguous queues */
+	uint16_t txschq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	uint16_t otx2_tm_root_lvl;
+	uint16_t tm_flags;
+	uint16_t tm_leaf_cnt;
+	struct otx2_nix_tm_node_list node_list;
+	struct otx2_nix_tm_shaper_profile_list shaper_profile_list;
 	struct otx2_rss_info rss_info;
 	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
drivers/net/octeontx2/otx2_tm.c new file +252 -0

252 lines not on this page · raw message

drivers/net/octeontx2/otx2_tm.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.21.0
#157 lore raw

PATCH v3 22/58 net/octeontx2: alloc and free TM HW resources

In reply to [email protected]

From: Krzysztof Kanas <[email protected]>

Allocate and free shaper/scheduler hardware resources for nodes of hirearchy levels in sw.

---
 drivers/net/octeontx2/otx2_tm.c | 350 ++++++++++++++++++++++++++++++++
 1 file changed, 350 insertions(+)
drivers/net/octeontx2/otx2_tm.c +350 -0
index bc0474242..91f31df05 100644
@@ -54,6 +54,69 @@ nix_tm_node_search(struct otx2_eth_dev *dev,
 	return NULL;
 }
 
+static uint32_t
+check_rr(struct otx2_eth_dev *dev, uint32_t priority, uint32_t parent_id)
+{
+	struct otx2_nix_tm_node *tm_node;
+	uint32_t rr_num = 0;
+
+	TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+		if (!tm_node->parent)
+			continue;
+
+		if (!(tm_node->parent->id == parent_id))
+			continue;
+
+		if (tm_node->priority == priority)
+			rr_num++;
+	}
+	return rr_num;
+}
+
+static int
+nix_tm_update_parent_info(struct otx2_eth_dev *dev)
+{
+	struct otx2_nix_tm_node *tm_node_child;
+	struct otx2_nix_tm_node *tm_node;
+	struct otx2_nix_tm_node *parent;
+	uint32_t rr_num = 0;
+	uint32_t priority;
+
+	TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+		if (!tm_node->parent)
+			continue;
+		/* Count group of children of same priority i.e are RR */
+		parent = tm_node->parent;
+		priority = tm_node->priority;
+		rr_num = check_rr(dev, priority, parent->id);
+
+		/* Assuming that multiple RR groups are
+		 * not configured based on capability.
+		 */
+		if (rr_num > 1) {
+			parent->rr_prio = priority;
+			parent->rr_num = rr_num;
+		}
+
+		/* Find out static priority children that are not in RR */
+		TAILQ_FOREACH(tm_node_child, &dev->node_list, node) {
+			if (!tm_node_child->parent)
+				continue;
+			if (parent->id != tm_node_child->parent->id)
+				continue;
+			if (parent->max_prio == UINT32_MAX &&
+			    tm_node_child->priority != parent->rr_prio)
+				parent->max_prio = 0;
+
+			if (parent->max_prio < tm_node_child->priority &&
+			    parent->rr_prio != tm_node_child->priority)
+				parent->max_prio = tm_node_child->priority;
+		}
+	}
+
+	return 0;
+}
+
 static int
 nix_tm_node_add_to_list(struct otx2_eth_dev *dev, uint32_t node_id,
 			uint32_t parent_node_id, uint32_t priority,
@@ -115,6 +178,274 @@ nix_tm_clear_shaper_profiles(struct otx2_eth_dev *dev)
 	return 0;
 }
 
+static int
+nix_tm_free_resources(struct otx2_eth_dev *dev, uint32_t flags_mask,
+		      uint32_t flags, bool hw_only)
+{
+	struct otx2_nix_tm_shaper_profile *shaper_profile;
+	struct otx2_nix_tm_node *tm_node, *next_node;
+	struct otx2_mbox *mbox = dev->mbox;
+	struct nix_txsch_free_req *req;
+	uint32_t shaper_profile_id;
+	bool skip_node = false;
+	int rc = 0;
+
+	next_node = TAILQ_FIRST(&dev->node_list);
+	while (next_node) {
+		tm_node = next_node;
+		next_node = TAILQ_NEXT(tm_node, node);
+
+		/* Check for only requested nodes */
+		if ((tm_node->flags & flags_mask) != flags)
+			continue;
+
+		if (nix_tm_have_tl1_access(dev) &&
+		    tm_node->hw_lvl_id ==  NIX_TXSCH_LVL_TL1)
+			skip_node = true;
+
+		otx2_tm_dbg("Free hwres for node %u, hwlvl %u, hw_id %u (%p)",
+			    tm_node->id,  tm_node->hw_lvl_id,
+			    tm_node->hw_id, tm_node);
+		/* Free specific HW resource if requested */
+		if (!skip_node && flags_mask &&
+		    tm_node->flags & NIX_TM_NODE_HWRES) {
+			req = otx2_mbox_alloc_msg_nix_txsch_free(mbox);
+			req->flags = 0;
+			req->schq_lvl = tm_node->hw_lvl_id;
+			req->schq = tm_node->hw_id;
+			rc = otx2_mbox_process(mbox);
+			if (rc)
+				break;
+		} else {
+			skip_node = false;
+		}
+		tm_node->flags &= ~NIX_TM_NODE_HWRES;
+
+		/* Leave software elements if needed */
+		if (hw_only)
+			continue;
+
+		shaper_profile_id = tm_node->params.shaper_profile_id;
+		shaper_profile =
+			nix_tm_shaper_profile_search(dev, shaper_profile_id);
+		if (shaper_profile)
+			shaper_profile->reference_count--;
+
+		TAILQ_REMOVE(&dev->node_list, tm_node, node);
+		rte_free(tm_node);
+	}
+
+	if (!flags_mask) {
+		/* Free all hw resources */
+		req = otx2_mbox_alloc_msg_nix_txsch_free(mbox);
+		req->flags = TXSCHQ_FREE_ALL;
+
+		return otx2_mbox_process(mbox);
+	}
+
+	return rc;
+}
+
+static uint8_t
+nix_tm_copy_rsp_to_dev(struct otx2_eth_dev *dev,
+		       struct nix_txsch_alloc_rsp *rsp)
+{
+	uint16_t schq;
+	uint8_t lvl;
+
+	for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++) {
+		for (schq = 0; schq < MAX_TXSCHQ_PER_FUNC; schq++) {
+			dev->txschq_list[lvl][schq] = rsp->schq_list[lvl][schq];
+			dev->txschq_contig_list[lvl][schq] =
+				rsp->schq_contig_list[lvl][schq];
+		}
+
+		dev->txschq[lvl] = rsp->schq[lvl];
+		dev->txschq_contig[lvl] = rsp->schq_contig[lvl];
+	}
+	return 0;
+}
+
+static int
+nix_tm_assign_id_to_node(struct otx2_eth_dev *dev,
+			 struct otx2_nix_tm_node *child,
+			 struct otx2_nix_tm_node *parent)
+{
+	uint32_t hw_id, schq_con_index, prio_offset;
+	uint32_t l_id, schq_index;
+
+	otx2_tm_dbg("Assign hw id for child node %u, lvl %u, hw_lvl %u (%p)",
+		    child->id, child->level_id, child->hw_lvl_id, child);
+
+	child->flags |= NIX_TM_NODE_HWRES;
+
+	/* Process root nodes */
+	if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL2 &&
+	    child->hw_lvl_id == dev->otx2_tm_root_lvl && !parent) {
+		int idx = 0;
+		uint32_t tschq_con_index;
+
+		l_id = child->hw_lvl_id;
+		tschq_con_index = dev->txschq_contig_index[l_id];
+		hw_id = dev->txschq_contig_list[l_id][tschq_con_index];
+		child->hw_id = hw_id;
+		dev->txschq_contig_index[l_id]++;
+		/* Update TL1 hw_id for its parent for config purpose */
+		idx = dev->txschq_index[NIX_TXSCH_LVL_TL1]++;
+		hw_id = dev->txschq_list[NIX_TXSCH_LVL_TL1][idx];
+		child->parent_hw_id = hw_id;
+		return 0;
+	}
+	if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL1 &&
+	    child->hw_lvl_id == dev->otx2_tm_root_lvl && !parent) {
+		uint32_t tschq_con_index;
+
+		l_id = child->hw_lvl_id;
+		tschq_con_index = dev->txschq_index[l_id];
+		hw_id = dev->txschq_list[l_id][tschq_con_index];
+		child->hw_id = hw_id;
+		dev->txschq_index[l_id]++;
+		return 0;
+	}
+
+	/* Process children with parents */
+	l_id = child->hw_lvl_id;
+	schq_index = dev->txschq_index[l_id];
+	schq_con_index = dev->txschq_contig_index[l_id];
+
+	if (child->priority == parent->rr_prio) {
+		hw_id = dev->txschq_list[l_id][schq_index];
+		child->hw_id = hw_id;
+		child->parent_hw_id = parent->hw_id;
+		dev->txschq_index[l_id]++;
+	} else {
+		prio_offset = schq_con_index + child->priority;
+		hw_id = dev->txschq_contig_list[l_id][prio_offset];
+		child->hw_id = hw_id;
+	}
+	return 0;
+}
+
+static int
+nix_tm_assign_hw_id(struct otx2_eth_dev *dev)
+{
+	struct otx2_nix_tm_node *parent, *child;
+	uint32_t child_hw_lvl, con_index_inc, i;
+
+	for (i = NIX_TXSCH_LVL_TL1; i > 0; i--) {
+		TAILQ_FOREACH(parent, &dev->node_list, node) {
+			child_hw_lvl = parent->hw_lvl_id - 1;
+			if (parent->hw_lvl_id != i)
+				continue;
+			TAILQ_FOREACH(child, &dev->node_list, node) {
+				if (!child->parent)
+					continue;
+				if (child->parent->id != parent->id)
+					continue;
+				nix_tm_assign_id_to_node(dev, child, parent);
+			}
+
+			con_index_inc = parent->max_prio + 1;
+			dev->txschq_contig_index[child_hw_lvl] += con_index_inc;
+
+			/*
+			 * Explicitly assign id to parent node if it
+			 * doesn't have a parent
+			 */
+			if (parent->hw_lvl_id == dev->otx2_tm_root_lvl)
+				nix_tm_assign_id_to_node(dev, parent, NULL);
+		}
+	}
+	return 0;
+}
+
+static uint8_t
+nix_tm_count_req_schq(struct otx2_eth_dev *dev,
+		      struct nix_txsch_alloc_req *req, uint8_t lvl)
+{
+	struct otx2_nix_tm_node *tm_node;
+	uint8_t contig_count;
+
+	TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+		if (lvl == tm_node->hw_lvl_id) {
+			req->schq[lvl - 1] += tm_node->rr_num;
+			if (tm_node->max_prio != UINT32_MAX) {
+				contig_count = tm_node->max_prio + 1;
+				req->schq_contig[lvl - 1] += contig_count;
+			}
+		}
+		if (lvl == dev->otx2_tm_root_lvl &&
+		    dev->otx2_tm_root_lvl && lvl == NIX_TXSCH_LVL_TL2 &&
+		    tm_node->hw_lvl_id == dev->otx2_tm_root_lvl) {
+			req->schq_contig[dev->otx2_tm_root_lvl]++;
+		}
+	}
+
+	req->schq[NIX_TXSCH_LVL_TL1] = 1;
+	req->schq_contig[NIX_TXSCH_LVL_TL1] = 0;
+
+	return 0;
+}
+
+static int
+nix_tm_prepare_txschq_req(struct otx2_eth_dev *dev,
+			  struct nix_txsch_alloc_req *req)
+{
+	uint8_t i;
+
+	for (i = NIX_TXSCH_LVL_TL1; i > 0; i--)
+		nix_tm_count_req_schq(dev, req, i);
+
+	for (i = 0; i < NIX_TXSCH_LVL_CNT; i++) {
+		dev->txschq_index[i] = 0;
+		dev->txschq_contig_index[i] = 0;
+	}
+	return 0;
+}
+
+static int
+nix_tm_send_txsch_alloc_msg(struct otx2_eth_dev *dev)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+	struct nix_txsch_alloc_req *req;
+	struct nix_txsch_alloc_rsp *rsp;
+	int rc;
+
+	req = otx2_mbox_alloc_msg_nix_txsch_alloc(mbox);
+
+	rc = nix_tm_prepare_txschq_req(dev, req);
+	if (rc)
+		return rc;
+
+	rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
+	if (rc)
+		return rc;
+
+	nix_tm_copy_rsp_to_dev(dev, rsp);
+
+	nix_tm_assign_hw_id(dev);
+	return 0;
+}
+
+static int
+nix_tm_alloc_resources(struct rte_eth_dev *eth_dev, bool xmit_enable)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	int rc;
+
+	RTE_SET_USED(xmit_enable);
+
+	nix_tm_update_parent_info(dev);
+
+	rc = nix_tm_send_txsch_alloc_msg(dev);
+	if (rc) {
+		otx2_err("TM failed to alloc tm resources=%d", rc);
+		return rc;
+	}
+
+	return 0;
+}
+
 static int
 nix_tm_prepare_default_tree(struct rte_eth_dev *eth_dev)
 {
@@ -226,6 +557,13 @@ int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev)
 	uint16_t sq_cnt = eth_dev->data->nb_tx_queues;
 	int rc;
 
+	/* Free up all resources already held */
+	rc = nix_tm_free_resources(dev, 0, 0, false);
+	if (rc) {
+		otx2_err("Failed to freeup existing resources,rc=%d", rc);
+		return rc;
+	}
+
 	/* Clear shaper profiles */
 	nix_tm_clear_shaper_profiles(dev);
 	dev->tm_flags = NIX_TM_DEFAULT_TREE;
@@ -234,6 +572,9 @@ int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev)
 	if (rc != 0)
 		return rc;
 
+	rc = nix_tm_alloc_resources(eth_dev, false);
+	if (rc != 0)
+		return rc;
 	dev->tm_leaf_cnt = sq_cnt;
 
 	return 0;
@@ -243,6 +584,15 @@ int
 otx2_nix_tm_fini(struct rte_eth_dev *eth_dev)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	int rc;
+
+	/* Xmit is assumed to be disabled */
+	/* Free up resources already held */
+	rc = nix_tm_free_resources(dev, 0, 0, false);
+	if (rc) {
+		otx2_err("Failed to freeup existing resources,rc=%d", rc);
+		return rc;
+	}
 
 	/* Clear shaper profiles */
 	nix_tm_clear_shaper_profiles(dev);
Signature · 1 line
2.21.0
#158 lore raw

PATCH v3 23/58 net/octeontx2: configure TM HW resources

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

This patch sets up and configure hierarchy in hw nodes. Since all the registers are with RVU AF, register configuration is also done using mbox communication.

---
 drivers/net/octeontx2/otx2_tm.c | 504 ++++++++++++++++++++++++++++++++
 drivers/net/octeontx2/otx2_tm.h |  82 ++++++
 2 files changed, 586 insertions(+)
drivers/net/octeontx2/otx2_tm.c +504 -0
index 91f31df05..c6154e4d4 100644
@@ -20,6 +20,41 @@ enum otx2_tm_node_level {
 	OTX2_TM_LVL_MAX,
 };
 
+static inline
+uint64_t shaper2regval(struct shaper_params *shaper)
+{
+	return (shaper->burst_exponent << 37) | (shaper->burst_mantissa << 29) |
+		(shaper->div_exp << 13) | (shaper->exponent << 9) |
+		(shaper->mantissa << 1);
+}
+
+static int
+nix_get_link(struct otx2_eth_dev *dev)
+{
+	int link = 13 /* SDP */;
+	uint16_t lmac_chan;
+	uint16_t map;
+
+	lmac_chan = dev->tx_chan_base;
+
+	/* CGX lmac link */
+	if (lmac_chan >= 0x800) {
+		map = lmac_chan & 0x7FF;
+		link = 4 * ((map >> 8) & 0xF) + ((map >> 4) & 0xF);
+	} else if (lmac_chan < 0x700) {
+		/* LBK channel */
+		link = 12;
+	}
+
+	return link;
+}
+
+static uint8_t
+nix_get_relchan(struct otx2_eth_dev *dev)
+{
+	return dev->tx_chan_base & 0xff;
+}
+
 static bool
 nix_tm_have_tl1_access(struct otx2_eth_dev *dev)
 {
@@ -28,6 +63,24 @@ nix_tm_have_tl1_access(struct otx2_eth_dev *dev)
 		!is_lbk && !dev->maxvf;
 }
 
+static int
+find_prio_anchor(struct otx2_eth_dev *dev, uint32_t node_id)
+{
+	struct otx2_nix_tm_node *child_node;
+
+	TAILQ_FOREACH(child_node, &dev->node_list, node) {
+		if (!child_node->parent)
+			continue;
+		if (!(child_node->parent->id == node_id))
+			continue;
+		if (child_node->priority == child_node->parent->rr_prio)
+			continue;
+		return child_node->hw_id - child_node->priority;
+	}
+	return 0;
+}
+
+
 static struct otx2_nix_tm_shaper_profile *
 nix_tm_shaper_profile_search(struct otx2_eth_dev *dev, uint32_t shaper_id)
 {
@@ -40,6 +93,451 @@ nix_tm_shaper_profile_search(struct otx2_eth_dev *dev, uint32_t shaper_id)
 	return NULL;
 }
 
+static inline uint64_t
+shaper_rate_to_nix(uint64_t cclk_hz, uint64_t cclk_ticks,
+		   uint64_t value, uint64_t *exponent_p,
+		   uint64_t *mantissa_p, uint64_t *div_exp_p)
+{
+	uint64_t div_exp, exponent, mantissa;
+
+	/* Boundary checks */
+	if (value < MIN_SHAPER_RATE(cclk_hz, cclk_ticks) ||
+	    value > MAX_SHAPER_RATE(cclk_hz, cclk_ticks))
+		return 0;
+
+	if (value <= SHAPER_RATE(cclk_hz, cclk_ticks, 0, 0, 0)) {
+		/* Calculate rate div_exp and mantissa using
+		 * the following formula:
+		 *
+		 * value = (cclk_hz * (256 + mantissa)
+		 *              / ((cclk_ticks << div_exp) * 256)
+		 */
+		div_exp = 0;
+		exponent = 0;
+		mantissa = MAX_RATE_MANTISSA;
+
+		while (value < (cclk_hz / (cclk_ticks << div_exp)))
+			div_exp += 1;
+
+		while (value <
+		       ((cclk_hz * (256 + mantissa)) /
+			((cclk_ticks << div_exp) * 256)))
+			mantissa -= 1;
+	} else {
+		/* Calculate rate exponent and mantissa using
+		 * the following formula:
+		 *
+		 * value = (cclk_hz * ((256 + mantissa) << exponent)
+		 *              / (cclk_ticks * 256)
+		 *
+		 */
+		div_exp = 0;
+		exponent = MAX_RATE_EXPONENT;
+		mantissa = MAX_RATE_MANTISSA;
+
+		while (value < (cclk_hz * (1 << exponent)) / cclk_ticks)
+			exponent -= 1;
+
+		while (value < (cclk_hz * ((256 + mantissa) << exponent)) /
+		       (cclk_ticks * 256))
+			mantissa -= 1;
+	}
+
+	if (div_exp > MAX_RATE_DIV_EXP ||
+	    exponent > MAX_RATE_EXPONENT || mantissa > MAX_RATE_MANTISSA)
+		return 0;
+
+	if (div_exp_p)
+		*div_exp_p = div_exp;
+	if (exponent_p)
+		*exponent_p = exponent;
+	if (mantissa_p)
+		*mantissa_p = mantissa;
+
+	/* Calculate real rate value */
+	return SHAPER_RATE(cclk_hz, cclk_ticks, exponent, mantissa, div_exp);
+}
+
+static inline uint64_t
+lx_shaper_rate_to_nix(uint64_t cclk_hz, uint32_t hw_lvl,
+		      uint64_t value, uint64_t *exponent,
+		      uint64_t *mantissa, uint64_t *div_exp)
+{
+	if (hw_lvl == NIX_TXSCH_LVL_TL1)
+		return shaper_rate_to_nix(cclk_hz, L1_TIME_WHEEL_CCLK_TICKS,
+					  value, exponent, mantissa, div_exp);
+	else
+		return shaper_rate_to_nix(cclk_hz, LX_TIME_WHEEL_CCLK_TICKS,
+					  value, exponent, mantissa, div_exp);
+}
+
+static inline uint64_t
+shaper_burst_to_nix(uint64_t value, uint64_t *exponent_p,
+		    uint64_t *mantissa_p)
+{
+	uint64_t exponent, mantissa;
+
+	if (value < MIN_SHAPER_BURST || value > MAX_SHAPER_BURST)
+		return 0;
+
+	/* Calculate burst exponent and mantissa using
+	 * the following formula:
+	 *
+	 * value = (((256 + mantissa) << (exponent + 1)
+	 / 256)
+	 *
+	 */
+	exponent = MAX_BURST_EXPONENT;
+	mantissa = MAX_BURST_MANTISSA;
+
+	while (value < (1ull << (exponent + 1)))
+		exponent -= 1;
+
+	while (value < ((256 + mantissa) << (exponent + 1)) / 256)
+		mantissa -= 1;
+
+	if (exponent > MAX_BURST_EXPONENT || mantissa > MAX_BURST_MANTISSA)
+		return 0;
+
+	if (exponent_p)
+		*exponent_p = exponent;
+	if (mantissa_p)
+		*mantissa_p = mantissa;
+
+	return SHAPER_BURST(exponent, mantissa);
+}
+
+static int
+configure_shaper_cir_pir_reg(struct otx2_eth_dev *dev,
+			     struct otx2_nix_tm_node *tm_node,
+			     struct shaper_params *cir,
+			     struct shaper_params *pir)
+{
+	uint32_t shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;
+	struct otx2_nix_tm_shaper_profile *shaper_profile = NULL;
+	struct rte_tm_shaper_params *param;
+
+	shaper_profile_id = tm_node->params.shaper_profile_id;
+
+	shaper_profile = nix_tm_shaper_profile_search(dev, shaper_profile_id);
+	if (shaper_profile) {
+		param = &shaper_profile->profile;
+		/* Calculate CIR exponent and mantissa */
+		if (param->committed.rate)
+			cir->rate = lx_shaper_rate_to_nix(CCLK_HZ,
+							  tm_node->hw_lvl_id,
+							  param->committed.rate,
+							  &cir->exponent,
+							  &cir->mantissa,
+							  &cir->div_exp);
+
+		/* Calculate PIR exponent and mantissa */
+		if (param->peak.rate)
+			pir->rate = lx_shaper_rate_to_nix(CCLK_HZ,
+							  tm_node->hw_lvl_id,
+							  param->peak.rate,
+							  &pir->exponent,
+							  &pir->mantissa,
+							  &pir->div_exp);
+
+		/* Calculate CIR burst exponent and mantissa */
+		if (param->committed.size)
+			cir->burst = shaper_burst_to_nix(param->committed.size,
+							 &cir->burst_exponent,
+							 &cir->burst_mantissa);
+
+		/* Calculate PIR burst exponent and mantissa */
+		if (param->peak.size)
+			pir->burst = shaper_burst_to_nix(param->peak.size,
+							 &pir->burst_exponent,
+							 &pir->burst_mantissa);
+	}
+
+	return 0;
+}
+
+static int
+send_tm_reqval(struct otx2_mbox *mbox, struct nix_txschq_config *req)
+{
+	int rc;
+
+	if (req->num_regs > MAX_REGS_PER_MBOX_MSG)
+		return -ERANGE;
+
+	rc = otx2_mbox_process(mbox);
+	if (rc)
+		return rc;
+
+	req->num_regs = 0;
+	return 0;
+}
+
+static int
+populate_tm_registers(struct otx2_eth_dev *dev,
+		      struct otx2_nix_tm_node *tm_node)
+{
+	uint64_t strict_schedul_prio, rr_prio;
+	struct otx2_mbox *mbox = dev->mbox;
+	volatile uint64_t *reg, *regval;
+	uint64_t parent = 0, child = 0;
+	struct shaper_params cir, pir;
+	struct nix_txschq_config *req;
+	uint64_t rr_quantum;
+	uint32_t hw_lvl;
+	uint32_t schq;
+	int rc;
+
+	memset(&cir, 0, sizeof(cir));
+	memset(&pir, 0, sizeof(pir));
+
+	/* Skip leaf nodes */
+	if (tm_node->hw_lvl_id == NIX_TXSCH_LVL_CNT)
+		return 0;
+
+	/* Root node will not have a parent node */
+	if (tm_node->hw_lvl_id == dev->otx2_tm_root_lvl)
+		parent = tm_node->parent_hw_id;
+	else
+		parent = tm_node->parent->hw_id;
+
+	/* Do we need this trigger to configure TL1 */
+	if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL2 &&
+	    tm_node->hw_lvl_id == dev->otx2_tm_root_lvl) {
+		schq = parent;
+		/*
+		 * Default config for TL1.
+		 * For VF this is always ignored.
+		 */
+
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = NIX_TXSCH_LVL_TL1;
+
+		/* Set DWRR quantum */
+		req->reg[0] = NIX_AF_TL1X_SCHEDULE(schq);
+		req->regval[0] = TXSCH_TL1_DFLT_RR_QTM;
+		req->num_regs++;
+
+		req->reg[1] = NIX_AF_TL1X_TOPOLOGY(schq);
+		req->regval[1] = (TXSCH_TL1_DFLT_RR_PRIO << 1);
+		req->num_regs++;
+
+		req->reg[2] = NIX_AF_TL1X_CIR(schq);
+		req->regval[2] = 0;
+		req->num_regs++;
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+	}
+
+	if (tm_node->hw_lvl_id != NIX_TXSCH_LVL_SMQ)
+		child = find_prio_anchor(dev, tm_node->id);
+
+	rr_prio = tm_node->rr_prio;
+	hw_lvl = tm_node->hw_lvl_id;
+	strict_schedul_prio = tm_node->priority;
+	schq = tm_node->hw_id;
+	rr_quantum = (tm_node->weight * NIX_TM_RR_QUANTUM_MAX) /
+		MAX_SCHED_WEIGHT;
+
+	configure_shaper_cir_pir_reg(dev, tm_node, &cir, &pir);
+
+	otx2_tm_dbg("Configure node %p, lvl %u hw_lvl %u, id %u, hw_id %u,"
+		     "parent_hw_id %" PRIx64 ", pir %" PRIx64 ", cir %" PRIx64,
+		     tm_node, tm_node->level_id, hw_lvl,
+		     tm_node->id, schq, parent, pir.rate, cir.rate);
+
+	rc = -EFAULT;
+
+	switch (hw_lvl) {
+	case NIX_TXSCH_LVL_SMQ:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		reg = req->reg;
+		regval = req->regval;
+		req->num_regs = 0;
+
+		/* Set xoff which will be cleared later */
+		*reg++ = NIX_AF_SMQX_CFG(schq);
+		*regval++ = BIT_ULL(50) | ((uint64_t)NIX_MAX_VTAG_INS << 36) |
+				(NIX_MAX_HW_FRS << 8) | NIX_MIN_HW_FRS;
+		req->num_regs++;
+		*reg++ = NIX_AF_MDQX_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_MDQX_SCHEDULE(schq);
+		*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_MDQX_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_MDQX_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL4:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL4X_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL4X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1);
+		req->num_regs++;
+		*reg++ = NIX_AF_TL4X_SCHEDULE(schq);
+		*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_TL4X_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL4X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL3:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL3X_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL3X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1);
+		req->num_regs++;
+		*reg++ = NIX_AF_TL3X_SCHEDULE(schq);
+		*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_TL3X_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL3X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL2:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL2X_PARENT(schq);
+		*regval++ = parent << 16;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL2X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1);
+		req->num_regs++;
+		*reg++ = NIX_AF_TL2X_SCHEDULE(schq);
+		if (dev->otx2_tm_root_lvl == NIX_TXSCH_LVL_TL2)
+			*regval++ = (1 << 24) | rr_quantum;
+		else
+			*regval++ = (strict_schedul_prio << 24) | rr_quantum;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL3_TL2X_LINKX_CFG(schq, nix_get_link(dev));
+		*regval++ = BIT_ULL(12) | nix_get_relchan(dev);
+		req->num_regs++;
+		if (pir.rate && pir.burst) {
+			*reg++ = NIX_AF_TL2X_PIR(schq);
+			*regval++ = shaper2regval(&pir) | 1;
+			req->num_regs++;
+		}
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL2X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	case NIX_TXSCH_LVL_TL1:
+		req = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		req->lvl = hw_lvl;
+		req->num_regs = 0;
+		reg = req->reg;
+		regval = req->regval;
+
+		*reg++ = NIX_AF_TL1X_SCHEDULE(schq);
+		*regval++ = rr_quantum;
+		req->num_regs++;
+		*reg++ = NIX_AF_TL1X_TOPOLOGY(schq);
+		*regval++ = (child << 32) | (rr_prio << 1 /*RR_PRIO*/);
+		req->num_regs++;
+		if (cir.rate && cir.burst) {
+			*reg++ = NIX_AF_TL1X_CIR(schq);
+			*regval++ = shaper2regval(&cir) | 1;
+			req->num_regs++;
+		}
+
+		rc = send_tm_reqval(mbox, req);
+		if (rc)
+			goto error;
+		break;
+	}
+
+	return 0;
+error:
+	otx2_err("Txschq cfg request failed for node %p, rc=%d", tm_node, rc);
+	return rc;
+}
+
+
+static int
+nix_tm_txsch_reg_config(struct otx2_eth_dev *dev)
+{
+	struct otx2_nix_tm_node *tm_node;
+	uint32_t lvl;
+	int rc = 0;
+
+	if (nix_get_link(dev) == 13)
+		return -EPERM;
+
+	for (lvl = 0; lvl < (uint32_t)dev->otx2_tm_root_lvl + 1; lvl++) {
+		TAILQ_FOREACH(tm_node, &dev->node_list, node) {
+			if (tm_node->hw_lvl_id == lvl) {
+				rc = populate_tm_registers(dev, tm_node);
+				if (rc)
+					goto exit;
+			}
+		}
+	}
+exit:
+	return rc;
+}
+
 static struct otx2_nix_tm_node *
 nix_tm_node_search(struct otx2_eth_dev *dev,
 		   uint32_t node_id, bool user)
@@ -443,6 +941,12 @@ nix_tm_alloc_resources(struct rte_eth_dev *eth_dev, bool xmit_enable)
 		return rc;
 	}
 
+	rc = nix_tm_txsch_reg_config(dev);
+	if (rc) {
+		otx2_err("TM failed to configure sched registers=%d", rc);
+		return rc;
+	}
+
 	return 0;
 }
 
drivers/net/octeontx2/otx2_tm.h +82 -0

86 lines not on this page · raw message

Signature · 1 line
2.21.0
#159 lore raw

PATCH v3 24/58 net/octeontx2: enable Tx through traffic manager

In reply to [email protected]

From: Krzysztof Kanas <[email protected]>

This patch enables pkt transmit through traffic manager hierarchy by clearing software XOFF on the nodes and linking tx queues to corresponding leaf nodes.
It also adds support to start and stop tx queue using traffic manager.

---
 drivers/net/octeontx2/otx2_ethdev.c |  75 ++++++-
 drivers/net/octeontx2/otx2_tm.c     | 296 +++++++++++++++++++++++++++-
 drivers/net/octeontx2/otx2_tm.h     |   4 +
 3 files changed, 370 insertions(+), 5 deletions(-)
drivers/net/octeontx2/otx2_ethdev.c +73 -2
index e64159c21..c1b8b37db 100644
@@ -120,6 +120,32 @@ nix_lf_free(struct otx2_eth_dev *dev)
 	return otx2_mbox_process(mbox);
 }
 
+int
+otx2_cgx_rxtx_start(struct otx2_eth_dev *dev)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+
+	if (otx2_dev_is_vf(dev))
+		return 0;
+
+	otx2_mbox_alloc_msg_cgx_start_rxtx(mbox);
+
+	return otx2_mbox_process(mbox);
+}
+
+int
+otx2_cgx_rxtx_stop(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_rxtx(mbox);
+
+	return otx2_mbox_process(mbox);
+}
+
 static inline void
 nix_rx_queue_reset(struct otx2_eth_rxq *rxq)
 {
@@ -461,16 +487,27 @@ nix_sq_init(struct otx2_eth_txq *txq)
 	struct otx2_eth_dev *dev = txq->dev;
 	struct otx2_mbox *mbox = dev->mbox;
 	struct nix_aq_enq_req *sq;
+	uint32_t rr_quantum;
+	uint16_t smq;
+	int rc;
 
 	if (txq->sqb_pool->pool_id == 0)
 		return -EINVAL;
 
+	rc = otx2_nix_tm_get_leaf_data(dev, txq->sq, &rr_quantum, &smq);
+	if (rc) {
+		otx2_err("Failed to get sq->smq(leaf node), rc=%d", rc);
+		return rc;
+	}
+
 	sq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
 	sq->qidx = txq->sq;
 	sq->ctype = NIX_AQ_CTYPE_SQ;
 	sq->op = NIX_AQ_INSTOP_INIT;
 	sq->sq.max_sqe_size = nix_sq_max_sqe_sz(txq);
 
+	sq->sq.smq = smq;
+	sq->sq.smq_rr_quantum = rr_quantum;
 	sq->sq.default_chan = dev->tx_chan_base;
 	sq->sq.sqe_stype = NIX_STYPE_STF;
 	sq->sq.ena = 1;
@@ -711,12 +748,18 @@ static void
 otx2_nix_tx_queue_release(void *_txq)
 {
 	struct otx2_eth_txq *txq = _txq;
+	struct rte_eth_dev *eth_dev;
 
 	if (!txq)
 		return;
 
+	eth_dev = txq->dev->eth_dev;
+
 	otx2_nix_dbg("Releasing txq %u", txq->sq);
 
+	/* Flush and disable tm */
+	otx2_nix_tm_sw_xoff(txq, eth_dev->data->dev_started);
+
 	/* Free sqb's and disable sq */
 	nix_sq_uninit(txq);
 
@@ -1142,24 +1185,52 @@ int
 otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx)
 {
 	struct rte_eth_dev_data *data = eth_dev->data;
+	struct otx2_eth_txq *txq;
+	int rc = -EINVAL;
+
+	txq = eth_dev->data->tx_queues[qidx];
 
 	if (data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED)
 		return 0;
 
+	rc = otx2_nix_sq_sqb_aura_fc(txq, true);
+	if (rc) {
+		otx2_err("Failed to enable sqb aura fc, txq=%u, rc=%d",
+			 qidx, rc);
+		goto done;
+	}
+
 	data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
-	return 0;
+
+done:
+	return rc;
 }
 
 int
 otx2_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
 {
 	struct rte_eth_dev_data *data = eth_dev->data;
+	struct otx2_eth_txq *txq;
+	int rc;
+
+	txq = eth_dev->data->tx_queues[qidx];
 
 	if (data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED)
 		return 0;
 
+	txq->fc_cache_pkts = 0;
+
+	rc = otx2_nix_sq_sqb_aura_fc(txq, false);
+	if (rc) {
+		otx2_err("Failed to disable sqb aura fc, txq=%u, rc=%d",
+			 qidx, rc);
+		goto done;
+	}
+
 	data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
-	return 0;
+
+done:
+	return rc;
 }
 
 static int
drivers/net/octeontx2/otx2_tm.c +293 -3

319 lines not on this page · raw message

drivers/net/octeontx2/otx2_tm.h +4 -0
index af1bb1862..2a009eece 100644
@@ -16,6 +16,10 @@ struct otx2_eth_dev;
 void otx2_nix_tm_conf_init(struct rte_eth_dev *eth_dev);
 int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev);
 int otx2_nix_tm_fini(struct rte_eth_dev *eth_dev);
+int otx2_nix_tm_get_leaf_data(struct otx2_eth_dev *dev, uint16_t sq,
+			      uint32_t *rr_quantum, uint16_t *smq);
+int otx2_nix_tm_sw_xoff(void *_txq, bool dev_started);
+int otx2_nix_sq_sqb_aura_fc(void *_txq, bool enable);
 
 struct otx2_nix_tm_node {
 	TAILQ_ENTRY(otx2_nix_tm_node) node;
Signature · 1 line
2.21.0
#160 lore raw

PATCH v3 25/58 net/octeontx2: add ptype support

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The fields from CQE needs to be converted to
ptype and rx ol flags in mbuf. This patch adds
create lookup memory for those items to be
used in Fastpath.

---
 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              |   1 +
 drivers/net/octeontx2/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |   2 +
 drivers/net/octeontx2/otx2_ethdev.h        |   6 +
 drivers/net/octeontx2/otx2_lookup.c        | 315 +++++++++++++++++++++
 drivers/net/octeontx2/otx2_rx.h            |   7 +
 10 files changed, 336 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_lookup.c
doc/guides/nics/features/octeontx2.ini +1 -0
index ca40358da..0de07776f 100644
@@ -20,6 +20,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index b720c116f..b4b253aa4 100644
@@ -20,6 +20,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index 5a287493f..21cc4861e 100644
@@ -16,6 +16,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/octeontx2.rst +1 -0
index d7e8f3d56..07e44b031 100644
@@ -16,6 +16,7 @@ Features
 
 Features of the OCTEON TX2 Ethdev PMD are:
 
+- Packet type information
 - Promiscuous mode
 - SR-IOV VF
 - Lock-free Tx queue
drivers/net/octeontx2/Makefile +1 -0
index dd64ba6da..dd0f2b9ca 100644
@@ -36,6 +36,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_mac.c	\
 	otx2_link.c	\
 	otx2_stats.c	\
+	otx2_lookup.c	\
 	otx2_ethdev.c	\
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
index e344d877f..3dff3e53d 100644
@@ -8,6 +8,7 @@ sources = files(
 		'otx2_mac.c',
 		'otx2_link.c',
 		'otx2_stats.c',
+		'otx2_lookup.c',
 		'otx2_ethdev.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +2 -0
index c1b8b37db..62514c6f6 100644
@@ -441,6 +441,7 @@ otx2_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t rq,
 	rxq->pool = mp;
 	rxq->qlen = nix_qsize_to_val(qsize);
 	rxq->qsize = qsize;
+	rxq->lookup_mem = otx2_nix_fastpath_lookup_mem_get();
 
 	/* Alloc completion queue */
 	rc = nix_cq_rq_init(eth_dev, dev, rq, rxq, mp);
@@ -1290,6 +1291,7 @@ 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_supported_ptypes_get = otx2_nix_supported_ptypes_get,
 	.stats_get                = otx2_nix_dev_stats_get,
 	.stats_reset              = otx2_nix_dev_stats_reset,
 	.get_reg                  = otx2_nix_dev_get_reg,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
index 9f73bf89b..cfc4dfe14 100644
@@ -355,6 +355,12 @@ int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
 int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 
+/* Lookup configuration */
+void *otx2_nix_fastpath_lookup_mem_get(void);
+
+/* PTYPES */
+const uint32_t *otx2_nix_supported_ptypes_get(struct rte_eth_dev *dev);
+
 /* Mac address handling */
 int otx2_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
drivers/net/octeontx2/otx2_lookup.c new file +315 -0

315 lines not on this page · raw message

drivers/net/octeontx2/otx2_rx.h +7 -0
index 1749c43ff..1283fdf37 100644
@@ -5,6 +5,13 @@
 #ifndef __OTX2_RX_H__
 #define __OTX2_RX_H__
 
+#define PTYPE_WIDTH 12
+#define PTYPE_NON_TUNNEL_ARRAY_SZ	BIT(PTYPE_WIDTH)
+#define PTYPE_TUNNEL_ARRAY_SZ		BIT(PTYPE_WIDTH)
+#define PTYPE_ARRAY_SZ			((PTYPE_NON_TUNNEL_ARRAY_SZ +\
+					 PTYPE_TUNNEL_ARRAY_SZ) *\
+					 sizeof(uint16_t))
+
 #define NIX_RX_OFFLOAD_PTYPE_F         BIT(1)
 
 #endif /* __OTX2_RX_H__ */
Signature · 1 line
2.21.0
#161 lore raw

PATCH v3 26/58 net/octeontx2: add queue info and pool supported operations

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Add Rx and Tx queue info get and pool ops supported operations.

---
 drivers/net/octeontx2/otx2_ethdev.c     |  3 ++
 drivers/net/octeontx2/otx2_ethdev.h     |  5 +++
 drivers/net/octeontx2/otx2_ethdev_ops.c | 51 +++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +3 -0
index 62514c6f6..7ef2cb87c 100644
@@ -1312,6 +1312,9 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_reset             = otx2_nix_xstats_reset,
 	.xstats_get_by_id         = otx2_nix_xstats_get_by_id,
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
+	.rxq_info_get             = otx2_nix_rxq_info_get,
+	.txq_info_get             = otx2_nix_txq_info_get,
+	.pool_ops_supported       = otx2_nix_pool_ops_supported,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +5 -0
index cfc4dfe14..199d5f242 100644
@@ -274,6 +274,11 @@ 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_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
+void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			   struct rte_eth_rxq_info *qinfo);
+void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			   struct rte_eth_txq_info *qinfo);
 
 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
 void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_ops.c +51 -0

63 lines not on this page · raw message

Signature · 1 line
2.21.0
#162 lore raw

PATCH v3 27/58 net/octeontx2: add Rx and Tx descriptor operations

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add Rx and Tx queue descriptor related operations.

---
 doc/guides/nics/features/octeontx2.ini     |  2 +
 doc/guides/nics/features/octeontx2_vec.ini |  2 +
 doc/guides/nics/features/octeontx2_vf.ini  |  2 +
 drivers/net/octeontx2/otx2_ethdev.c        |  4 ++
 drivers/net/octeontx2/otx2_ethdev.h        |  4 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    | 83 ++++++++++++++++++++++
 6 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
index 0de07776f..f07b64f24 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
@@ -21,6 +22,7 @@ RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
index b4b253aa4..911c926e4 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
@@ -21,6 +22,7 @@ RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
index 21cc4861e..e275e6469 100644
@@ -11,12 +11,14 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
drivers/net/octeontx2/otx2_ethdev.c +4 -0
index 7ef2cb87c..909aad65c 100644
@@ -1314,6 +1314,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 	.rxq_info_get             = otx2_nix_rxq_info_get,
 	.txq_info_get             = otx2_nix_txq_info_get,
+	.rx_queue_count           = otx2_nix_rx_queue_count,
+	.rx_descriptor_done       = otx2_nix_rx_descriptor_done,
+	.rx_descriptor_status     = otx2_nix_rx_descriptor_status,
+	.tx_done_cleanup          = otx2_nix_tx_done_cleanup,
 	.pool_ops_supported       = otx2_nix_pool_ops_supported,
 };
 
drivers/net/octeontx2/otx2_ethdev.h +4 -0
index 199d5f242..8f2691c80 100644
@@ -279,6 +279,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_txq_info *qinfo);
+uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
+int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
+int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
+int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
 
 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
 void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_ops.c +83 -0

89 lines not on this page · raw message

Signature · 1 line
2.21.0
#163 lore raw

PATCH v3 28/58 net/octeontx2: add module EEPROM dump

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

add module EEPROM dump 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        |  2 +
 drivers/net/octeontx2/otx2_ethdev.h        |  4 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c    | 51 ++++++++++++++++++++++
 6 files changed, 60 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
index f07b64f24..87141244a 100644
@@ -26,6 +26,7 @@ Rx descriptor status = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+Module EEPROM dump   = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index 911c926e4..dafbe003c 100644
@@ -26,6 +26,7 @@ Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+Module EEPROM dump   = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
index e275e6469..7fba7e1d9 100644
@@ -22,6 +22,7 @@ Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+Module EEPROM dump   = Y
 Registers dump       = Y
 Linux VFIO           = Y
 ARMv8                = Y
drivers/net/octeontx2/otx2_ethdev.c +2 -0
index 909aad65c..fcc2504bf 100644
@@ -1319,6 +1319,8 @@ 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,
+	.get_module_info          = otx2_nix_get_module_info,
+	.get_module_eeprom        = otx2_nix_get_module_eeprom,
 };
 
 static inline int
drivers/net/octeontx2/otx2_ethdev.h +4 -0
index 8f2691c80..5dd5d8c8b 100644
@@ -274,6 +274,10 @@ 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_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,
+			       struct rte_dev_eeprom_info *info);
 int otx2_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
 void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
drivers/net/octeontx2/otx2_ethdev_ops.c +51 -0

57 lines not on this page · raw message

Signature · 1 line
2.21.0
#164 lore raw

PATCH v3 29/58 net/octeontx2: add flow control support

In reply to [email protected]

From: Vamsi Attunuru <[email protected]>

Add flow control operations and exposed
otx2_nix_update_flow_ctrl_mode() to enable on the
configured mode in dev_start().

---
 doc/guides/nics/features/octeontx2.ini     |   1 +
 doc/guides/nics/features/octeontx2_vec.ini |   1 +
 doc/guides/nics/octeontx2.rst              |   1 +
 drivers/net/octeontx2/Makefile             |   1 +
 drivers/net/octeontx2/meson.build          |   1 +
 drivers/net/octeontx2/otx2_ethdev.c        |  20 ++
 drivers/net/octeontx2/otx2_ethdev.h        |  23 +++
 drivers/net/octeontx2/otx2_flow_ctrl.c     | 220 +++++++++++++++++++++
 8 files changed, 268 insertions(+)
 create mode 100644 drivers/net/octeontx2/otx2_flow_ctrl.c
doc/guides/nics/features/octeontx2.ini +1 -0
index 87141244a..00feb0cf2 100644
@@ -21,6 +21,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Flow control         = Y
 Packet type parsing  = Y
 Rx descriptor status = Y
 Basic stats          = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
index dafbe003c..f3f812804 100644
@@ -21,6 +21,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Flow control         = Y
 Packet type parsing  = Y
 Rx descriptor status = Y
 Basic stats          = Y
doc/guides/nics/octeontx2.rst +1 -0
index 07e44b031..20281b030 100644
@@ -25,6 +25,7 @@ Features of the OCTEON TX2 Ethdev PMD are:
 - MAC filtering
 - Port hardware statistics
 - Link state information
+- Link flow control
 - Debug utilities - Context dump and error interrupt support
 
 Prerequisites
drivers/net/octeontx2/Makefile +1 -0
index dd0f2b9ca..582857459 100644
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \
 	otx2_stats.c	\
 	otx2_lookup.c	\
 	otx2_ethdev.c	\
+	otx2_flow_ctrl.c \
 	otx2_ethdev_irq.c \
 	otx2_ethdev_ops.c \
 	otx2_ethdev_debug.c \
drivers/net/octeontx2/meson.build +1 -0
index 3dff3e53d..4b56f4461 100644
@@ -10,6 +10,7 @@ sources = files(
 		'otx2_stats.c',
 		'otx2_lookup.c',
 		'otx2_ethdev.c',
+		'otx2_flow_ctrl.c',
 		'otx2_ethdev_irq.c',
 		'otx2_ethdev_ops.c',
 		'otx2_ethdev_debug.c',
drivers/net/octeontx2/otx2_ethdev.c +20 -0
index fcc2504bf..25469c5f9 100644
@@ -216,6 +216,14 @@ nix_cq_rq_init(struct rte_eth_dev *eth_dev, struct otx2_eth_dev *dev,
 	aq->cq.cq_err_int_ena = BIT(NIX_CQERRINT_CQE_FAULT);
 	aq->cq.cq_err_int_ena |= BIT(NIX_CQERRINT_DOOR_ERR);
 
+	/* TX pause frames enable flowctrl on RX side */
+	if (dev->fc_info.tx_pause) {
+		/* Single bpid is allocated for all rx channels for now */
+		aq->cq.bpid = dev->fc_info.bpid[0];
+		aq->cq.bp = NIX_CQ_BP_LEVEL;
+		aq->cq.bp_ena = 1;
+	}
+
 	/* Many to one reduction */
 	aq->cq.qint_idx = qid % dev->qints;
 
@@ -1092,6 +1100,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);
 		oxt2_nix_unregister_queue_irqs(eth_dev);
 		nix_set_nop_rxtx_function(eth_dev);
 		rc = nix_store_queue_cfg_and_then_release(eth_dev);
@@ -1145,6 +1154,12 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto free_nix_lf;
 	}
 
+	rc = otx2_nix_rxchan_bpid_cfg(eth_dev, true);
+	if (rc) {
+		otx2_err("Failed to configure nix rx chan bpid cfg rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	/*
 	 * Restore queue config when reconfigure followed by
 	 * reconfigure and no queue configure invoked from application case.
@@ -1321,6 +1336,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.pool_ops_supported       = otx2_nix_pool_ops_supported,
 	.get_module_info          = otx2_nix_get_module_info,
 	.get_module_eeprom        = otx2_nix_get_module_eeprom,
+	.flow_ctrl_get            = otx2_nix_flow_ctrl_get,
+	.flow_ctrl_set            = otx2_nix_flow_ctrl_set,
 };
 
 static inline int
@@ -1522,6 +1539,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	/* Disable nix bpid config */
+	otx2_nix_rxchan_bpid_cfg(eth_dev, false);
+
 	/* 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 +23 -0
index 5dd5d8c8b..03ecd32ec 100644
@@ -87,6 +87,9 @@
 #define NIX_TX_NB_SEG_MAX		9
 #endif
 
+/* Apply BP when CQ is 75% full */
+#define NIX_CQ_BP_LEVEL (25 * 256 / 100)
+
 #define CQ_OP_STAT_OP_ERR	63
 #define CQ_OP_STAT_CQ_ERR	46
 
@@ -169,6 +172,14 @@ struct otx2_npc_flow_info {
 	uint16_t flow_max_priority;
 };
 
+struct otx2_fc_info {
+	enum rte_eth_fc_mode mode;  /**< Link flow control mode */
+	uint8_t rx_pause;
+	uint8_t tx_pause;
+	uint8_t chan_cnt;
+	uint16_t bpid[NIX_MAX_CHAN];
+};
+
 struct otx2_eth_dev {
 	OTX2_DEV; /* Base class */
 	MARKER otx2_eth_dev_data_start;
@@ -216,6 +227,7 @@ struct otx2_eth_dev {
 	struct otx2_nix_tm_node_list node_list;
 	struct otx2_nix_tm_shaper_profile_list shaper_profile_list;
 	struct otx2_rss_info rss_info;
+	struct otx2_fc_info fc_info;
 	uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	struct otx2_npc_flow_info npc_flow;
@@ -368,6 +380,17 @@ int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
 int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 
+/* Flow Control */
+int otx2_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_fc_conf *fc_conf);
+
+int otx2_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_fc_conf *fc_conf);
+
+int otx2_nix_rxchan_bpid_cfg(struct rte_eth_dev *eth_dev, bool enb);
+
+int otx2_nix_update_flow_ctrl_mode(struct rte_eth_dev *eth_dev);
+
 /* Lookup configuration */
 void *otx2_nix_fastpath_lookup_mem_get(void);
 
drivers/net/octeontx2/otx2_flow_ctrl.c new file +220 -0

220 lines not on this page · raw message

Signature · 1 line
2.21.0