Skip to contentSkip to conversation

common/cnxk: use computed value for wqe skip

PATCH Superseded Nithin Dabilpuram 3 participants 29 messages Jun 16, 2022 – Jun 23, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/12 common/cnxk: use computed value for wqe skip

Use computed value for WQE skip instead of a hardcoded value. WQE skip needs to be number of 128B lines to accommodate rte_mbuf.

---
Depends-on: series=23500 ("common/cnxk: add cnf10kb support")

 drivers/common/cnxk/roc_nix_inl.h        | 2 +-
 drivers/common/cnxk/roc_nix_inl_priv.h   | 2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c | 5 ++++-
 drivers/net/cnxk/cnxk_ethdev_sec.c       | 5 ++++-
 4 files changed, 10 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_nix_inl.h +1 -1
index b1b4c5b..c7b1817 100644
@@ -131,7 +131,7 @@ struct roc_nix_inl_dev {
 	uint16_t channel;
 	uint16_t chan_mask;
 	bool attach_cptlf;
-	bool wqe_skip;
+	uint16_t wqe_skip;
 	uint8_t spb_drop_pc;
 	uint8_t lpb_drop_pc;
 	bool set_soft_exp_poll;
drivers/common/cnxk/roc_nix_inl_priv.h +1 -1
index d61c7b2..a775efc 100644
@@ -84,7 +84,7 @@ struct nix_inl_dev {
 	uint32_t ipsec_in_max_spi;
 	uint32_t inb_spi_mask;
 	bool attach_cptlf;
-	bool wqe_skip;
+	uint16_t wqe_skip;
 	bool ts_ena;
 };
 
drivers/event/cnxk/cnxk_eventdev_adptr.c +4 -1
index fa96090..cf5b1dd 100644
@@ -125,6 +125,7 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 {
 	struct roc_nix *nix = &cnxk_eth_dev->nix;
 	struct roc_nix_rq *rq;
+	uint16_t wqe_skip;
 	int rc;
 
 	rq = &cnxk_eth_dev->rqs[rq_id];
@@ -132,7 +133,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 	rq->tt = ev->sched_type;
 	rq->hwgrp = ev->queue_id;
 	rq->flow_tag_width = 20;
-	rq->wqe_skip = 1;
+	wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+	wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+	rq->wqe_skip = wqe_skip;
 	rq->tag_mask = (port_id & 0xF) << 20;
 	rq->tag_mask |= (((port_id >> 4) & 0xF) | (RTE_EVENT_TYPE_ETHDEV << 4))
 			<< 24;
drivers/net/cnxk/cnxk_ethdev_sec.c +4 -1
index d01ebb4..1de3454 100644
@@ -264,6 +264,7 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
 	char name[CNXK_NIX_INL_DEV_NAME_LEN];
 	struct roc_nix_inl_dev *inl_dev;
 	const struct rte_memzone *mz;
+	uint16_t wqe_skip;
 	int rc = -ENOMEM;
 
 	RTE_SET_USED(pci_drv);
@@ -295,7 +296,9 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
 
 	inl_dev->attach_cptlf = true;
 	/* WQE skip is one for DPDK */
-	inl_dev->wqe_skip = true;
+	wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+	wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+	inl_dev->wqe_skip = wqe_skip;
 	inl_dev->set_soft_exp_poll = true;
 	rc = roc_nix_inl_dev_init(inl_dev);
 	if (rc) {
Signature · 1 line
2.8.4
#1 lore raw

PATCH 2/12 common/cnxk: avoid CPT backpressure due to errata

Avoid enabling CPT backpressure due to errata where backpressure would block requests from even other CPT LF's. Also allow CQ size >=16K.

---
 drivers/common/cnxk/roc_errata.h | 7 +++++++
 drivers/common/cnxk/roc_nix.h    | 2 +-
 drivers/common/cnxk/roc_nix_fc.c | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_errata.h +7 -0
index 31162d5..f048297 100644
@@ -77,4 +77,11 @@ roc_errata_nix_has_perf_issue_on_stats_update(void)
 	return true;
 }
 
+/* Errata IPBUCPT-38726, IPBUCPT-38727 */
+static inline bool
+roc_errata_cpt_hang_on_x2p_bp(void)
+{
+	return roc_model_is_cn10ka_a0();
+}
+
 #endif /* _ROC_ERRATA_H_ */
drivers/common/cnxk/roc_nix.h +1 -1
index aedde1c..944e4c6 100644
@@ -309,7 +309,7 @@ struct roc_nix_rq {
 struct roc_nix_cq {
 	/* Input parameters */
 	uint16_t qid;
-	uint16_t nb_desc;
+	uint32_t nb_desc;
 	/* End of Input parameters */
 	uint16_t drop_thresh;
 	struct roc_nix *roc_nix;
drivers/common/cnxk/roc_nix_fc.c +2 -1
index a0505bd..cef5d07 100644
@@ -77,7 +77,8 @@ nix_fc_rxchan_bpid_set(struct roc_nix *roc_nix, bool enable)
 		goto exit;
 
 	/* Enable backpressure on CPT if inline inb is enabled */
-	if (enable && roc_nix_inl_inb_is_enabled(roc_nix)) {
+	if (enable && roc_nix_inl_inb_is_enabled(roc_nix) &&
+	    !roc_errata_cpt_hang_on_x2p_bp()) {
 		req = mbox_alloc_msg_nix_cpt_bp_enable(mbox);
 		if (req == NULL)
 			return rc;
Signature · 1 line
2.8.4
#2 lore raw

PATCH 3/12 common/cnxk: add PFC support for VFs

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Current PFC implementation does not support VFs.
Patch enables PFC on VFs too.

Also fix the config of aura.bp to be based on number of buffers(aura.limit) and corresponding shift value(aura.shift).

Fixes cb4bfd6e7bdf ("event/cnxk: support Rx adapter")
---
 drivers/common/cnxk/roc_nix.h            |  14 +++-
 drivers/common/cnxk/roc_nix_fc.c         | 120 +++++++++++++++++++++++++++----
 drivers/common/cnxk/roc_nix_priv.h       |   2 +
 drivers/common/cnxk/roc_nix_queue.c      |  47 ++++++++++++
 drivers/common/cnxk/roc_nix_tm.c         |  67 +++++++++--------
 drivers/common/cnxk/version.map          |   3 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c |  12 ++--
 drivers/net/cnxk/cnxk_ethdev.h           |   2 +
 8 files changed, 217 insertions(+), 50 deletions(-)
drivers/common/cnxk/roc_nix.h +12 -2
index 944e4c6..f0d7fc8 100644
@@ -157,6 +157,7 @@ struct roc_nix_fc_cfg {
 #define ROC_NIX_FC_RXCHAN_CFG 0
 #define ROC_NIX_FC_CQ_CFG     1
 #define ROC_NIX_FC_TM_CFG     2
+#define ROC_NIX_FC_RQ_CFG     3
 	uint8_t type;
 	union {
 		struct {
@@ -171,6 +172,14 @@ struct roc_nix_fc_cfg {
 		} cq_cfg;
 
 		struct {
+			uint32_t rq;
+			uint16_t tc;
+			uint16_t cq_drop;
+			bool enable;
+			uint64_t pool;
+		} rq_cfg;
+
+		struct {
 			uint32_t sq;
 			uint16_t tc;
 			bool enable;
@@ -791,8 +800,8 @@ uint16_t __roc_api roc_nix_chan_count_get(struct roc_nix *roc_nix);
 
 enum roc_nix_fc_mode __roc_api roc_nix_fc_mode_get(struct roc_nix *roc_nix);
 
-void __roc_api rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id,
-				     uint8_t ena, uint8_t force);
+void __roc_api roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id,
+				     uint8_t ena, uint8_t force, uint8_t tc);
 
 /* NPC */
 int __roc_api roc_nix_npc_promisc_ena_dis(struct roc_nix *roc_nix, int enable);
@@ -845,6 +854,7 @@ int __roc_api roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq,
 int __roc_api roc_nix_rq_modify(struct roc_nix *roc_nix, struct roc_nix_rq *rq,
 				bool ena);
 int __roc_api roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable);
+int __roc_api roc_nix_rq_is_sso_enable(struct roc_nix *roc_nix, uint32_t qid);
 int __roc_api roc_nix_rq_fini(struct roc_nix_rq *rq);
 int __roc_api roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq);
 int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq);
drivers/common/cnxk/roc_nix_fc.c +107 -13

196 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +2 -0
index cc69d71..5e865f8 100644
@@ -357,6 +357,8 @@ nix_tm_tree2str(enum roc_nix_tm_tree tree)
 		return "Default Tree";
 	else if (tree == ROC_NIX_TM_RLIMIT)
 		return "Rate Limit Tree";
+	else if (tree == ROC_NIX_TM_PFC)
+		return "PFC Tree";
 	else if (tree == ROC_NIX_TM_USER)
 		return "User Tree";
 	return "???";
drivers/common/cnxk/roc_nix_queue.c +47 -0

53 lines not on this page · raw message

drivers/common/cnxk/roc_nix_tm.c +38 -29

130 lines not on this page · raw message

drivers/common/cnxk/version.map +2 -1
index 1ba5b4f..27e81f2 100644
@@ -122,7 +122,7 @@ INTERNAL {
 	roc_nix_fc_config_set;
 	roc_nix_fc_mode_set;
 	roc_nix_fc_mode_get;
-	rox_nix_fc_npa_bp_cfg;
+	roc_nix_fc_npa_bp_cfg;
 	roc_nix_get_base_chan;
 	roc_nix_get_pf;
 	roc_nix_get_pf_func;
@@ -220,6 +220,7 @@ INTERNAL {
 	roc_nix_rq_ena_dis;
 	roc_nix_rq_fini;
 	roc_nix_rq_init;
+	roc_nix_rq_is_sso_enable;
 	roc_nix_rq_modify;
 	roc_nix_rss_default_setup;
 	roc_nix_rss_flowkey_set;
drivers/event/cnxk/cnxk_eventdev_adptr.c +7 -5
index cf5b1dd..8fcc377 100644
@@ -250,9 +250,11 @@ cnxk_sso_rx_adapter_queue_add(
 				rc |= roc_nix_rx_drop_re_set(&cnxk_eth_dev->nix,
 							     false);
 		}
-		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
-				      rxq_sp->qconf.mp->pool_id, true,
-				      dev->force_ena_bp);
+
+		if (rxq_sp->tx_pause)
+			roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
+					      rxq_sp->qconf.mp->pool_id, true,
+					      dev->force_ena_bp, rxq_sp->tc);
 		cnxk_eth_dev->nb_rxq_sso++;
 	}
 
@@ -293,9 +295,9 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev,
 		rxq_sp = cnxk_eth_rxq_to_sp(
 			eth_dev->data->rx_queues[rx_queue_id]);
 		rc = cnxk_sso_rxq_disable(cnxk_eth_dev, (uint16_t)rx_queue_id);
-		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
+		roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, false,
-				      dev->force_ena_bp);
+				      dev->force_ena_bp, 0);
 		cnxk_eth_dev->nb_rxq_sso--;
 
 		/* Enable drop_re if it was disabled earlier */
drivers/net/cnxk/cnxk_ethdev.h +2 -0
index e992302..0400d73 100644
@@ -443,6 +443,8 @@ struct cnxk_eth_rxq_sp {
 	struct cnxk_eth_dev *dev;
 	struct cnxk_eth_qconf qconf;
 	uint16_t qid;
+	uint8_t tx_pause;
+	uint8_t tc;
 } __plt_cache_aligned;
 
 struct cnxk_eth_txq_sp {
Signature · 1 line
2.8.4
Acked-by on v1 3/12
#3 lore raw

Re: [PATCH 03/12] common/cnxk: add PFC support for VFs

Quoted 11 lines · Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Current PFC implementation does not support VFs.
Patch enables PFC on VFs too.

Also fix the config of aura.bp to be based on number of buffers(aura.limit) and corresponding shift value(aura.shift).

Fixes cb4bfd6e7bdf ("event/cnxk: support Rx adapter")
Quoted 10 lines
---
 drivers/common/cnxk/roc_nix.h            |  14 +++-
 drivers/common/cnxk/roc_nix_fc.c         | 120 +++++++++++++++++++++++++++----
 drivers/common/cnxk/roc_nix_priv.h       |   2 +
 drivers/common/cnxk/roc_nix_queue.c      |  47 ++++++++++++
 drivers/common/cnxk/roc_nix_tm.c         |  67 +++++++++--------
 drivers/common/cnxk/version.map          |   3 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c |  12 ++--
 drivers/net/cnxk/cnxk_ethdev.h           |   2 +
 8 files changed, 217 insertions(+), 50 deletions(-)
#4 lore raw

PATCH 4/12 common/cnxk: support same TC value across multiple queues

In reply to Nithin Dabilpuram

From: Harman Kalra <[email protected]>

User may want to configure same TC value across multiple queues, but for that all queues should have a common TL3 where this TC value will get configured.

Changed the pfc_tc_cq_map/pfc_tc_sq_map array indexing to qid and store TC values in the array. As multiple queues may have same TC value.

---
 drivers/common/cnxk/roc_dev.c        | 18 ++++++++
 drivers/common/cnxk/roc_nix.h        |  4 +-
 drivers/common/cnxk/roc_nix_fc.c     |  2 +-
 drivers/common/cnxk/roc_nix_priv.h   |  3 +-
 drivers/common/cnxk/roc_nix_tm.c     | 87 ++++++++++++++++++++++++------------
 drivers/common/cnxk/roc_nix_tm_ops.c |  3 +-
 6 files changed, 84 insertions(+), 33 deletions(-)
drivers/common/cnxk/roc_dev.c +18 -0
index 09199ac..59128a3 100644
@@ -421,6 +421,24 @@ process_msgs(struct dev *dev, struct mbox *mbox)
 			/* Get our identity */
 			dev->pf_func = msg->pcifunc;
 			break;
+		case MBOX_MSG_CGX_PRIO_FLOW_CTRL_CFG:
+			/* Handling the case where one VF tries to disable PFC
+			 * while PFC already configured on other VFs. This is
+			 * not an error but a warning which can be ignored.
+			 */
+#define LMAC_AF_ERR_PERM_DENIED -1103
+			if (msg->rc) {
+				if (msg->rc == LMAC_AF_ERR_PERM_DENIED) {
+					plt_mbox_dbg(
+						"Receive Flow control disable not permitted "
+						"as its used by other PFVFs");
+					msg->rc = 0;
+				} else {
+					plt_err("Message (%s) response has err=%d",
+						mbox_id2name(msg->id), msg->rc);
+				}
+			}
+			break;
 
 		default:
 			if (msg->rc)
drivers/common/cnxk/roc_nix.h +3 -1
index f0d7fc8..4e5cf05 100644
@@ -11,7 +11,8 @@
 #define ROC_NIX_BPF_LEVEL_IDX_INVALID 0xFF
 #define ROC_NIX_BPF_LEVEL_MAX	      3
 #define ROC_NIX_BPF_STATS_MAX	      12
-#define ROC_NIX_MTR_ID_INVALID       UINT32_MAX
+#define ROC_NIX_MTR_ID_INVALID	      UINT32_MAX
+#define ROC_NIX_PFC_CLASS_INVALID     UINT8_MAX
 
 enum roc_nix_rss_reta_sz {
 	ROC_NIX_RSS_RETA_SZ_64 = 64,
@@ -349,6 +350,7 @@ struct roc_nix_sq {
 	void *lmt_addr;
 	void *sqe_mem;
 	void *fc;
+	uint8_t tc;
 };
 
 struct roc_nix_link_info {
drivers/common/cnxk/roc_nix_fc.c +1 -1
index daae285..f4cfa11 100644
@@ -312,7 +312,7 @@ roc_nix_fc_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
 	else if (fc_cfg->type == ROC_NIX_FC_TM_CFG)
 		return nix_tm_bp_config_set(roc_nix, fc_cfg->tm_cfg.sq,
 					    fc_cfg->tm_cfg.tc,
-					    fc_cfg->tm_cfg.enable);
+					    fc_cfg->tm_cfg.enable, false);
 
 	return -EINVAL;
 }
drivers/common/cnxk/roc_nix_priv.h +2 -1
index 5e865f8..5b0522c 100644
@@ -100,6 +100,7 @@ struct nix_tm_node {
 	/* Last stats */
 	uint64_t last_pkts;
 	uint64_t last_bytes;
+	uint32_t tc_refcnt;
 };
 
 struct nix_tm_shaper_profile {
@@ -402,7 +403,7 @@ int nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
 int nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable);
 int nix_tm_bp_config_get(struct roc_nix *roc_nix, bool *is_enabled);
 int nix_tm_bp_config_set(struct roc_nix *roc_nix, uint16_t sq, uint16_t tc,
-			 bool enable);
+			 bool enable, bool force_flush);
 void nix_rq_vwqe_flush(struct roc_nix_rq *rq, uint16_t vwqe_interval);
 int nix_tm_mark_init(struct nix *nix);
 
drivers/common/cnxk/roc_nix_tm.c +58 -29

138 lines not on this page · raw message

drivers/common/cnxk/roc_nix_tm_ops.c +2 -1
index 5884ce5..4aa5500 100644
@@ -292,6 +292,7 @@ roc_nix_tm_node_add(struct roc_nix *roc_nix, struct roc_nix_tm_node *roc_node)
 	node->pkt_mode_set = roc_node->pkt_mode_set;
 	node->free_fn = roc_node->free_fn;
 	node->tree = ROC_NIX_TM_USER;
+	node->rel_chan = NIX_TM_CHAN_INVALID;
 
 	return nix_tm_node_add(roc_nix, node);
 }
@@ -473,7 +474,7 @@ roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix)
 		if (!sq)
 			continue;
 
-		rc = nix_tm_bp_config_set(roc_nix, sq->qid, 0, false);
+		rc = nix_tm_bp_config_set(roc_nix, sq->qid, 0, false, false);
 		if (rc && rc != -ENOENT) {
 			plt_err("Failed to disable backpressure, rc=%d", rc);
 			goto cleanup;
Signature · 1 line
2.8.4
#5 lore raw

PATCH 5/12 common/cnxk: enhance CPT parse header dump

In reply to Nithin Dabilpuram

Enhance CPT parse header dump to dump fragment info and swap pointers before printing.

---
 drivers/common/cnxk/roc_cpt_debug.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_cpt_debug.c +31 -2
index be6ddb5..5602e53 100644
@@ -8,6 +8,10 @@
 void
 roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
 {
+	struct cpt_frag_info_s *frag_info;
+	uint32_t offset;
+	uint64_t *slot;
+
 	plt_print("CPT_PARSE \t0x%p:", cpth);
 
 	/* W0 */
@@ -19,7 +23,7 @@ roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
 		  cpth->w0.pad_len, cpth->w0.num_frags, cpth->w0.pkt_out);
 
 	/* W1 */
-	plt_print("W1: wqe_ptr \t0x%016lx\t", cpth->wqe_ptr);
+	plt_print("W1: wqe_ptr \t0x%016lx\t", plt_be_to_cpu_64(cpth->wqe_ptr));
 
 	/* W2 */
 	plt_print("W2: frag_age \t0x%x\t\torig_pf_func \t0x%04x",
@@ -33,7 +37,32 @@ roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
 
 	/* W4 */
 	plt_print("W4: esn \t%" PRIx64 " \t OR frag1_wqe_ptr \t0x%" PRIx64,
-		  cpth->esn, cpth->frag1_wqe_ptr);
+		  cpth->esn, plt_be_to_cpu_64(cpth->frag1_wqe_ptr));
+
+	/* offset of 0 implies 256B, otherwise it implies offset*8B */
+	offset = cpth->w2.fi_offset;
+	offset = (((offset - 1) & 0x1f) + 1) * 8;
+	frag_info = PLT_PTR_ADD(cpth, offset);
+
+	plt_print("CPT Fraginfo \t0x%p:", frag_info);
+
+	/* W0 */
+	plt_print("W0: f0.info \t0x%x", frag_info->w0.f0.info);
+	plt_print("W0: f1.info \t0x%x", frag_info->w0.f1.info);
+	plt_print("W0: f2.info \t0x%x", frag_info->w0.f2.info);
+	plt_print("W0: f3.info \t0x%x", frag_info->w0.f3.info);
+
+	/* W1 */
+	plt_print("W1: frag_size0 \t0x%x", frag_info->w1.frag_size0);
+	plt_print("W1: frag_size1 \t0x%x", frag_info->w1.frag_size1);
+	plt_print("W1: frag_size2 \t0x%x", frag_info->w1.frag_size2);
+	plt_print("W1: frag_size3 \t0x%x", frag_info->w1.frag_size3);
+
+	slot = (uint64_t *)(frag_info + 1);
+	plt_print("Frag Slot2:  WQE ptr \t%p",
+		  (void *)plt_be_to_cpu_64(slot[0]));
+	plt_print("Frag Slot3:  WQE ptr \t%p",
+		  (void *)plt_be_to_cpu_64(slot[1]));
 }
 
 static int
Signature · 1 line
2.8.4
#6 lore raw

PATCH 6/12 common/cnxk: fix mbox structs to avoid unaligned access

In reply to Nithin Dabilpuram

Fix mbox structs to avoid unaligned access as mbox memory is from BAR space.

Fixes 503b82de2cbf ("common/cnxk: add mbox request and response definitions")
Fixes e746aec161cc ("common/cnxk: fix SQ flush sequence")
---
 drivers/common/cnxk/roc_mbox.h    | 18 +++++++++---------
 drivers/common/cnxk/roc_nix_inl.c |  2 ++
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/common/cnxk/roc_mbox.h +9 -9
index 2c30f19..965c704 100644
@@ -777,7 +777,7 @@ struct nix_lf_alloc_req {
 	uint64_t __io way_mask;
 #define NIX_LF_RSS_TAG_LSB_AS_ADDER BIT_ULL(0)
 #define NIX_LF_LBK_BLK_SEL	    BIT_ULL(1)
-	uint64_t flags;
+	uint64_t __io flags;
 };
 
 struct nix_lf_alloc_rsp {
@@ -798,7 +798,7 @@ struct nix_lf_alloc_rsp {
 	uint8_t __io cgx_links;	      /* No. of CGX links present in HW */
 	uint8_t __io lbk_links;	      /* No. of LBK links present in HW */
 	uint8_t __io sdp_links;	      /* No. of SDP links present in HW */
-	uint8_t tx_link;	      /* Transmit channel link number */
+	uint8_t __io tx_link;	      /* Transmit channel link number */
 };
 
 struct nix_lf_free_req {
@@ -1275,8 +1275,8 @@ struct ssow_lf_free_req {
 #define SSOW_INVAL_SELECTIVE_VER 0x1000
 struct ssow_lf_inv_req {
 	struct mbox_msghdr hdr;
-	uint16_t nb_hws;		 /* Number of HWS to invalidate*/
-	uint16_t hws[MAX_RVU_BLKLF_CNT]; /* Array of HWS */
+	uint16_t __io nb_hws;		      /* Number of HWS to invalidate*/
+	uint16_t __io hws[MAX_RVU_BLKLF_CNT]; /* Array of HWS */
 };
 
 struct ssow_config_lsw {
@@ -1453,11 +1453,11 @@ struct cpt_sts_rsp {
 struct cpt_rxc_time_cfg_req {
 	struct mbox_msghdr hdr;
 	int blkaddr;
-	uint32_t step;
-	uint16_t zombie_thres;
-	uint16_t zombie_limit;
-	uint16_t active_thres;
-	uint16_t active_limit;
+	uint32_t __io step;
+	uint16_t __io zombie_thres;
+	uint16_t __io zombie_limit;
+	uint16_t __io active_thres;
+	uint16_t __io active_limit;
 };
 
 struct cpt_rx_inline_lf_cfg_msg {
drivers/common/cnxk/roc_nix_inl.c +2 -0
index 39b9bec..7da8938 100644
@@ -246,6 +246,8 @@ roc_nix_reassembly_configure(uint32_t max_wait_time, uint16_t max_frags)
 	struct roc_cpt_rxc_time_cfg cfg;
 
 	PLT_SET_USED(max_frags);
+	if (idev == NULL)
+		return -ENOTSUP;
 	roc_cpt = idev->cpt;
 	if (!roc_cpt) {
 		plt_err("Cannot support inline inbound, cryptodev not probed");
Signature · 1 line
2.8.4
#7 lore raw

PATCH 7/12 net/cnxk: add SDP link status

In reply to Nithin Dabilpuram

From: Satananda Burla <[email protected]>

Add SDP link status reporting

---
 drivers/net/cnxk/cnxk_link.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/cnxk/cnxk_link.c +3 -3
index b1d59e3..127c9e7 100644
@@ -13,7 +13,7 @@ cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set)
 		dev->flags &= ~CNXK_LINK_CFG_IN_PROGRESS_F;
 
 	/* Update link info for LBK */
-	if (!set && roc_nix_is_lbk(&dev->nix)) {
+	if (!set && (roc_nix_is_lbk(&dev->nix) || roc_nix_is_sdp(&dev->nix))) {
 		struct rte_eth_link link;
 
 		link.link_status = RTE_ETH_LINK_UP;
@@ -124,10 +124,10 @@ cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	RTE_SET_USED(wait_to_complete);
 	memset(&link, 0, sizeof(struct rte_eth_link));
 
-	if (!eth_dev->data->dev_started || roc_nix_is_sdp(&dev->nix))
+	if (!eth_dev->data->dev_started)
 		return 0;
 
-	if (roc_nix_is_lbk(&dev->nix)) {
+	if (roc_nix_is_lbk(&dev->nix) || roc_nix_is_sdp(&dev->nix)) {
 		link.link_status = RTE_ETH_LINK_UP;
 		link.link_speed = RTE_ETH_SPEED_NUM_100G;
 		link.link_autoneg = RTE_ETH_LINK_FIXED;
Signature · 1 line
2.8.4
#8 lore raw

PATCH 8/12 net/cnxk: remove restriction on VFs for PFC config

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Currently PFC configuration is not allowed on VFs. Patch enables PFC configuration on VFs

---
 drivers/net/cnxk/cnxk_ethdev.c     |   9 +-
 drivers/net/cnxk/cnxk_ethdev.h     |  13 +--
 drivers/net/cnxk/cnxk_ethdev_ops.c | 219 +++++++++++++++++++++----------------
 3 files changed, 137 insertions(+), 104 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +4 -5
index 09e5736..941b270 100644
@@ -323,7 +323,7 @@ nix_init_flow_ctrl_config(struct rte_eth_dev *eth_dev)
 	struct cnxk_fc_cfg *fc = &dev->fc_cfg;
 	int rc;
 
-	if (roc_nix_is_sdp(&dev->nix))
+	if (roc_nix_is_vf_or_sdp(&dev->nix))
 		return 0;
 
 	/* To avoid Link credit deadlock on Ax, disable Tx FC if it's enabled */
@@ -604,6 +604,9 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq_sp->qconf.conf.rx.offloads = dev->rx_offloads;
 	rxq_sp->qconf.nb_desc = nb_desc;
 	rxq_sp->qconf.mp = mp;
+	rxq_sp->tc = 0;
+	rxq_sp->tx_pause = (dev->fc_cfg.mode == RTE_ETH_FC_FULL ||
+			    dev->fc_cfg.mode == RTE_ETH_FC_TX_PAUSE);
 
 	if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) {
 		/* Pass a tagmask used to handle error packets in inline device.
@@ -1795,7 +1798,6 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 		if (dev->pfc_tc_sq_map[i] != 0xFFFF) {
 			pfc_conf.rx_pause.tx_qid = dev->pfc_tc_sq_map[i];
 			pfc_conf.rx_pause.tc = i;
-			pfc_conf.tx_pause.rx_qid = i;
 			pfc_conf.tx_pause.tc = i;
 			rc = cnxk_nix_priority_flow_ctrl_queue_config(eth_dev,
 				&pfc_conf);
@@ -1805,9 +1807,6 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 		}
 	}
 
-	fc_conf.mode = RTE_ETH_FC_FULL;
-	rc = cnxk_nix_flow_ctrl_set(eth_dev, &fc_conf);
-
 	/* Disable and free rte_meter entries */
 	nix_meter_fini(dev);
 
drivers/net/cnxk/cnxk_ethdev.h +6 -7
index 0400d73..db2d849 100644
@@ -156,13 +156,10 @@ struct cnxk_fc_cfg {
 };
 
 struct cnxk_pfc_cfg {
-	struct cnxk_fc_cfg fc_cfg;
 	uint16_t class_en;
 	uint16_t pause_time;
-	uint8_t rx_tc;
-	uint8_t rx_qid;
-	uint8_t tx_tc;
-	uint8_t tx_qid;
+	uint16_t rx_pause_en;
+	uint16_t tx_pause_en;
 };
 
 struct cnxk_eth_qconf {
@@ -669,8 +666,10 @@ int nix_mtr_color_action_validate(struct rte_eth_dev *eth_dev, uint32_t id,
 				  uint32_t *prev_id, uint32_t *next_id,
 				  struct cnxk_mtr_policy_node *policy,
 				  int *tree_level);
-int nix_priority_flow_ctrl_configure(struct rte_eth_dev *eth_dev,
-				     struct cnxk_pfc_cfg *conf);
+int nix_priority_flow_ctrl_rq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
+				   uint8_t tx_pause, uint8_t tc);
+int nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
+				   uint8_t rx_pause, uint8_t tc);
 
 /* Inlines */
 static __rte_always_inline uint64_t
drivers/net/cnxk/cnxk_ethdev_ops.c +127 -92

317 lines not on this page · raw message

Signature · 1 line
2.8.4
#9 lore raw

PATCH 9/12 net/cnxk: pfc class disable resulting in invalid behaviour

In reply to Nithin Dabilpuram

From: Harman Kalra <[email protected]>

Disabling a specific pfc class on a SQ is resulting in disabling PFC on the entire port.

---
 drivers/net/cnxk/cnxk_ethdev.c     | 25 ++++++++++++-------------
 drivers/net/cnxk/cnxk_ethdev.h     |  1 -
 drivers/net/cnxk/cnxk_ethdev_ops.c | 34 +++++++++++++++++++++++++++-------
 3 files changed, 39 insertions(+), 21 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +12 -13
index 941b270..4ea1617 100644
@@ -439,6 +439,7 @@ cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	sq->qid = qid;
 	sq->nb_desc = nb_desc;
 	sq->max_sqe_sz = nix_sq_max_sqe_sz(dev);
+	sq->tc = ROC_NIX_PFC_CLASS_INVALID;
 
 	rc = roc_nix_sq_init(&dev->nix, sq);
 	if (rc) {
@@ -1281,8 +1282,6 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		goto cq_fini;
 	}
 
-	/* Initialize TC to SQ mapping as invalid */
-	memset(dev->pfc_tc_sq_map, 0xFF, sizeof(dev->pfc_tc_sq_map));
 	/*
 	 * Restore queue config when reconfigure followed by
 	 * reconfigure and no queue configure invoked from application case.
@@ -1794,17 +1793,17 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 	rc = cnxk_nix_flow_ctrl_set(eth_dev, &fc_conf);
 
 	pfc_conf.mode = RTE_ETH_FC_NONE;
-	for (i = 0; i < CNXK_NIX_PFC_CHAN_COUNT; i++) {
-		if (dev->pfc_tc_sq_map[i] != 0xFFFF) {
-			pfc_conf.rx_pause.tx_qid = dev->pfc_tc_sq_map[i];
-			pfc_conf.rx_pause.tc = i;
-			pfc_conf.tx_pause.tc = i;
-			rc = cnxk_nix_priority_flow_ctrl_queue_config(eth_dev,
-				&pfc_conf);
-			if (rc)
-				plt_err("Failed to reset PFC. error code(%d)",
-					rc);
-		}
+	for (i = 0; i < RTE_MAX(eth_dev->data->nb_rx_queues,
+				eth_dev->data->nb_tx_queues);
+	     i++) {
+		pfc_conf.rx_pause.tc = ROC_NIX_PFC_CLASS_INVALID;
+		pfc_conf.rx_pause.tx_qid = i;
+		pfc_conf.tx_pause.tc = ROC_NIX_PFC_CLASS_INVALID;
+		pfc_conf.tx_pause.rx_qid = i;
+		rc = cnxk_nix_priority_flow_ctrl_queue_config(eth_dev,
+							      &pfc_conf);
+		if (rc)
+			plt_err("Failed to reset PFC. error code(%d)", rc);
 	}
 
 	/* Disable and free rte_meter entries */
drivers/net/cnxk/cnxk_ethdev.h +0 -1
index db2d849..a4e96f0 100644
@@ -396,7 +396,6 @@ struct cnxk_eth_dev {
 	struct cnxk_eth_qconf *rx_qconf;
 
 	/* Flow control configuration */
-	uint16_t pfc_tc_sq_map[CNXK_NIX_PFC_CHAN_COUNT];
 	struct cnxk_pfc_cfg pfc_cfg;
 	struct cnxk_fc_cfg fc_cfg;
 
drivers/net/cnxk/cnxk_ethdev_ops.c +27 -7
index caace9d..1592971 100644
@@ -1129,8 +1129,10 @@ nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
 	struct rte_eth_dev_data *data = eth_dev->data;
 	struct cnxk_pfc_cfg *pfc = &dev->pfc_cfg;
 	struct roc_nix *nix = &dev->nix;
+	struct roc_nix_pfc_cfg pfc_cfg;
 	struct roc_nix_fc_cfg fc_cfg;
 	struct cnxk_eth_txq_sp *txq;
+	enum roc_nix_fc_mode mode;
 	struct roc_nix_sq *sq;
 	int rc;
 
@@ -1140,12 +1142,6 @@ nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
 	if (qid >= eth_dev->data->nb_tx_queues)
 		return -ENOTSUP;
 
-	if (dev->pfc_tc_sq_map[tc] != 0xFFFF &&
-	    dev->pfc_tc_sq_map[tc] != qid) {
-		plt_err("Same TC can not be configured on multiple SQs");
-		return -ENOTSUP;
-	}
-
 	/* Check if RX pause frame is enabled or not */
 	if (!pfc->rx_pause_en) {
 		if ((roc_nix_tm_tree_type_get(nix) == ROC_NIX_TM_DEFAULT) &&
@@ -1180,7 +1176,31 @@ nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
 	if (rc)
 		return rc;
 
-	dev->pfc_tc_sq_map[tc] = sq->qid;
+	/* Maintaining a count for SQs which are configured for PFC. This is
+	 * required to handle disabling of a particular SQ without affecting
+	 * PFC on other SQs.
+	 */
+	if (!fc_cfg.tm_cfg.enable && sq->tc != ROC_NIX_PFC_CLASS_INVALID) {
+		sq->tc = ROC_NIX_PFC_CLASS_INVALID;
+		pfc->rx_pause_en--;
+	} else if (fc_cfg.tm_cfg.enable &&
+		   sq->tc == ROC_NIX_PFC_CLASS_INVALID) {
+		sq->tc = tc;
+		pfc->rx_pause_en++;
+	}
+
+	if (pfc->rx_pause_en > 1)
+		goto exit;
+
+	if (pfc->tx_pause_en)
+		mode = pfc->rx_pause_en ? ROC_NIX_FC_FULL : ROC_NIX_FC_TX;
+	else
+		mode = pfc->rx_pause_en ? ROC_NIX_FC_RX : ROC_NIX_FC_NONE;
+
+	memset(&pfc_cfg, 0, sizeof(struct roc_nix_pfc_cfg));
+	pfc_cfg.mode = mode;
+	pfc_cfg.tc = pfc->class_en;
+	rc = roc_nix_pfc_mode_set(nix, &pfc_cfg);
 exit:
 	return rc;
 }
Signature · 1 line
2.8.4
#10 lore raw

PATCH 10/12 net/cnxk: resize CQ for Rx security for errata

In reply to Nithin Dabilpuram

Resize CQ for Rx security offload in case of HW errata.

ci: skip_checkpatch skip_klocwork

---
 drivers/net/cnxk/cnxk_ethdev.c | 43 +++++++++++++++++++++++++++++++++++++++++-
 drivers/net/cnxk/cnxk_ethdev.h |  2 +-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +42 -1
index 4ea1617..2418290 100644
@@ -5,6 +5,8 @@
 
 #include <rte_eventdev.h>
 
+#define CNXK_NIX_CQ_INL_CLAMP_MAX (64UL * 1024UL)
+
 static inline uint64_t
 nix_get_rx_offload_capa(struct cnxk_eth_dev *dev)
 {
@@ -40,6 +42,39 @@ nix_get_speed_capa(struct cnxk_eth_dev *dev)
 	return speed_capa;
 }
 
+static uint32_t
+nix_inl_cq_sz_clamp_up(struct roc_nix *nix, struct rte_mempool *mp,
+		       uint32_t nb_desc)
+{
+	struct roc_nix_rq *inl_rq;
+	uint64_t limit;
+
+	if (!roc_errata_cpt_hang_on_x2p_bp())
+		return nb_desc;
+
+	/* CQ should be able to hold all buffers in first pass RQ's aura
+	 * this RQ's aura.
+	 */
+	inl_rq = roc_nix_inl_dev_rq(nix);
+	if (!inl_rq) {
+		/* This itself is going to be inline RQ's aura */
+		limit = roc_npa_aura_op_limit_get(mp->pool_id);
+	} else {
+		limit = roc_npa_aura_op_limit_get(inl_rq->aura_handle);
+		/* Also add this RQ's aura if it is different */
+		if (inl_rq->aura_handle != mp->pool_id)
+			limit += roc_npa_aura_op_limit_get(mp->pool_id);
+	}
+	nb_desc = PLT_MAX(limit + 1, nb_desc);
+	if (nb_desc > CNXK_NIX_CQ_INL_CLAMP_MAX) {
+		plt_warn("Could not setup CQ size to accommodate"
+			 " all buffers in related auras (%" PRIu64 ")",
+			 limit);
+		nb_desc = CNXK_NIX_CQ_INL_CLAMP_MAX;
+	}
+	return nb_desc;
+}
+
 int
 cnxk_nix_inb_mode_set(struct cnxk_eth_dev *dev, bool use_inl_dev)
 {
@@ -504,7 +539,7 @@ cnxk_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid)
 
 int
 cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
-			uint16_t nb_desc, uint16_t fp_rx_q_sz,
+			uint32_t nb_desc, uint16_t fp_rx_q_sz,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp)
 {
@@ -552,6 +587,12 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	    dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY)
 		roc_nix_inl_dev_xaq_realloc(mp->pool_id);
 
+	/* Increase CQ size to Aura size to avoid CQ overflow and
+	 * then CPT buffer leak.
+	 */
+	if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
+		nb_desc = nix_inl_cq_sz_clamp_up(nix, mp, nb_desc);
+
 	/* Setup ROC CQ */
 	cq = &dev->cqs[qid];
 	cq->qid = qid;
drivers/net/cnxk/cnxk_ethdev.h +1 -1
index a4e96f0..4cb7c9e 100644
@@ -530,7 +530,7 @@ int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
 			    const struct rte_eth_txconf *tx_conf);
 int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
-			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
+			    uint32_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
 			    struct rte_mempool *mp);
 int cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid);
Signature · 1 line
2.8.4
#11 lore raw

Re: [PATCH 10/12] net/cnxk: resize CQ for Rx security for errata

Quoted 4 lines · Nithin Dabilpuram

Resize CQ for Rx security offload in case of HW errata.

ci: skip_checkpatch skip_klocwork

Remove this.

Please fix any ./devtools/checkpatches.sh ./devtools/check-git-log.sh in issues in the series.

Quoted 98 lines
---
 drivers/net/cnxk/cnxk_ethdev.c | 43 +++++++++++++++++++++++++++++++++++++++++-
 drivers/net/cnxk/cnxk_ethdev.h |  2 +-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +42 -1
index 4ea1617..2418290 100644
@@ -5,6 +5,8 @@
 
 #include <rte_eventdev.h>
 
+#define CNXK_NIX_CQ_INL_CLAMP_MAX (64UL * 1024UL)
+
 static inline uint64_t
 nix_get_rx_offload_capa(struct cnxk_eth_dev *dev)
 {
@@ -40,6 +42,39 @@ nix_get_speed_capa(struct cnxk_eth_dev *dev)
        return speed_capa;
 }
 
+static uint32_t
+nix_inl_cq_sz_clamp_up(struct roc_nix *nix, struct rte_mempool *mp,
+                      uint32_t nb_desc)
+{
+       struct roc_nix_rq *inl_rq;
+       uint64_t limit;
+
+       if (!roc_errata_cpt_hang_on_x2p_bp())
+               return nb_desc;
+
+       /* CQ should be able to hold all buffers in first pass RQ's aura
+        * this RQ's aura.
+        */
+       inl_rq = roc_nix_inl_dev_rq(nix);
+       if (!inl_rq) {
+               /* This itself is going to be inline RQ's aura */
+               limit = roc_npa_aura_op_limit_get(mp->pool_id);
+       } else {
+               limit = roc_npa_aura_op_limit_get(inl_rq->aura_handle);
+               /* Also add this RQ's aura if it is different */
+               if (inl_rq->aura_handle != mp->pool_id)
+                       limit += roc_npa_aura_op_limit_get(mp->pool_id);
+       }
+       nb_desc = PLT_MAX(limit + 1, nb_desc);
+       if (nb_desc > CNXK_NIX_CQ_INL_CLAMP_MAX) {
+               plt_warn("Could not setup CQ size to accommodate"
+                        " all buffers in related auras (%" PRIu64 ")",
+                        limit);
+               nb_desc = CNXK_NIX_CQ_INL_CLAMP_MAX;
+       }
+       return nb_desc;
+}
+
 int
 cnxk_nix_inb_mode_set(struct cnxk_eth_dev *dev, bool use_inl_dev)
 {
@@ -504,7 +539,7 @@ cnxk_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid)
 
 int
 cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
-                       uint16_t nb_desc, uint16_t fp_rx_q_sz,
+                       uint32_t nb_desc, uint16_t fp_rx_q_sz,
                        const struct rte_eth_rxconf *rx_conf,
                        struct rte_mempool *mp)
 {
@@ -552,6 +587,12 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
            dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY)
                roc_nix_inl_dev_xaq_realloc(mp->pool_id);
 
+       /* Increase CQ size to Aura size to avoid CQ overflow and
+        * then CPT buffer leak.
+        */
+       if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
+               nb_desc = nix_inl_cq_sz_clamp_up(nix, mp, nb_desc);
+
        /* Setup ROC CQ */
        cq = &dev->cqs[qid];
        cq->qid = qid;
drivers/net/cnxk/cnxk_ethdev.h +1 -2
index a4e96f0..4cb7c9e 100644
@@ -530,7 +530,7 @@ int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
                            uint16_t nb_desc, uint16_t fp_tx_q_sz,
                            const struct rte_eth_txconf *tx_conf);
 int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
-                           uint16_t nb_desc, uint16_t fp_rx_q_sz,
+                           uint32_t nb_desc, uint16_t fp_rx_q_sz,
                            const struct rte_eth_rxconf *rx_conf,
                            struct rte_mempool *mp);
 int cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid);
--

2.8.4

#12 lore raw

PATCH 11/12 net/cnxk: add SDP VF device ID for probe matching

In reply to Nithin Dabilpuram

From: Radha Mohan Chintakuntla <[email protected]>

Add SDP VF device ID in the table for probe matching.

---
 drivers/net/cnxk/cn10k_ethdev.c | 5 +++++
 drivers/net/cnxk/cn9k_ethdev.c  | 6 ++++++
 2 files changed, 11 insertions(+)
drivers/net/cnxk/cn10k_ethdev.c +5 -0
index 550cec5..80c5c0e 100644
@@ -824,6 +824,11 @@ static const struct rte_pci_id cn10k_pci_nix_map[] = {
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KA, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KB, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KB, PCI_DEVID_CNXK_RVU_AF_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KA, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KB, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KB, PCI_DEVID_CNXK_RVU_SDP_VF),
 	{
 		.vendor_id = 0,
 	},
drivers/net/cnxk/cn9k_ethdev.c +6 -0
index 2663aa6..4fb0e2d 100644
@@ -777,6 +777,12 @@ static const struct rte_pci_id cn9k_pci_nix_map[] = {
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_AF_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KA, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KB, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KC, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_SDP_VF),
 	{
 		.vendor_id = 0,
 	},
Signature · 1 line
2.8.4
#13 lore raw

PATCH 12/12 event/cnxk: offset timestamp data only if enabled on port

In reply to Nithin Dabilpuram

Offset timestamp data only when enabled on the port instead of just checking for offload flags.

---
 drivers/event/cnxk/cn10k_worker.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/event/cnxk/cn10k_worker.h +4 -2
index 034f508..7412a1b 100644
@@ -112,8 +112,7 @@ static __rte_always_inline void
 cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags,
 		   void *lookup_mem, void *tstamp, uintptr_t lbase)
 {
-	uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM |
-			     (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0);
+	uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM;
 	struct rte_event_vector *vec;
 	uint64_t aura_handle, laddr;
 	uint16_t nb_mbufs, non_vec;
@@ -133,6 +132,9 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags,
 	for (i = OBJS_PER_CLINE; i < vec->nb_elem; i += OBJS_PER_CLINE)
 		rte_prefetch0(&vec->ptrs[i]);
 
+	if (flags & NIX_RX_OFFLOAD_TSTAMP_F && tstamp)
+		mbuf_init |= 8;
+
 	nb_mbufs = RTE_ALIGN_FLOOR(vec->nb_elem, NIX_DESCS_PER_LOOP);
 	nb_mbufs = cn10k_nix_recv_pkts_vector(&mbuf_init, wqe, nb_mbufs,
 					      flags | NIX_RX_VWQE_F, lookup_mem,
Signature · 1 line
2.8.4
#14 lore raw
In reply to Nithin Dabilpuram
Quoted 3 lines · Nithin Dabilpuram

Use computed value for WQE skip instead of a hardcoded value. WQE skip needs to be number of 128B lines to accommodate rte_mbuf.

Change wqe -> WQE in subject

Quoted 86 lines

---
Depends-on: series=23500 ("common/cnxk: add cnf10kb support")

 drivers/common/cnxk/roc_nix_inl.h        | 2 +-
 drivers/common/cnxk/roc_nix_inl_priv.h   | 2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c | 5 ++++-
 drivers/net/cnxk/cnxk_ethdev_sec.c       | 5 ++++-
 4 files changed, 10 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_nix_inl.h +1 -1
index b1b4c5b..c7b1817 100644
@@ -131,7 +131,7 @@ struct roc_nix_inl_dev {
        uint16_t channel;
        uint16_t chan_mask;
        bool attach_cptlf;
-       bool wqe_skip;
+       uint16_t wqe_skip;
        uint8_t spb_drop_pc;
        uint8_t lpb_drop_pc;
        bool set_soft_exp_poll;
drivers/common/cnxk/roc_nix_inl_priv.h +1 -1
index d61c7b2..a775efc 100644
@@ -84,7 +84,7 @@ struct nix_inl_dev {
        uint32_t ipsec_in_max_spi;
        uint32_t inb_spi_mask;
        bool attach_cptlf;
-       bool wqe_skip;
+       uint16_t wqe_skip;
        bool ts_ena;
 };
 
drivers/event/cnxk/cnxk_eventdev_adptr.c +4 -1
index fa96090..cf5b1dd 100644
@@ -125,6 +125,7 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 {
        struct roc_nix *nix = &cnxk_eth_dev->nix;
        struct roc_nix_rq *rq;
+       uint16_t wqe_skip;
        int rc;
 
        rq = &cnxk_eth_dev->rqs[rq_id];
@@ -132,7 +133,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
        rq->tt = ev->sched_type;
        rq->hwgrp = ev->queue_id;
        rq->flow_tag_width = 20;
-       rq->wqe_skip = 1;
+       wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+       wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+       rq->wqe_skip = wqe_skip;
        rq->tag_mask = (port_id & 0xF) << 20;
        rq->tag_mask |= (((port_id >> 4) & 0xF) | (RTE_EVENT_TYPE_ETHDEV << 4))
                        << 24;
drivers/net/cnxk/cnxk_ethdev_sec.c +4 -2
index d01ebb4..1de3454 100644
@@ -264,6 +264,7 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
        char name[CNXK_NIX_INL_DEV_NAME_LEN];
        struct roc_nix_inl_dev *inl_dev;
        const struct rte_memzone *mz;
+       uint16_t wqe_skip;
        int rc = -ENOMEM;
 
        RTE_SET_USED(pci_drv);
@@ -295,7 +296,9 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
 
        inl_dev->attach_cptlf = true;
        /* WQE skip is one for DPDK */
-       inl_dev->wqe_skip = true;
+       wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+       wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+       inl_dev->wqe_skip = wqe_skip;
        inl_dev->set_soft_exp_poll = true;
        rc = roc_nix_inl_dev_init(inl_dev);
        if (rc) {
--

2.8.4

#15 lore raw

PATCH v2 1/12 common/cnxk: use computed value for WQE skip

In reply to Nithin Dabilpuram

Use computed value for WQE skip instead of a hardcoded value. WQE skip needs to be number of 128B lines to accommodate rte_mbuf.

---
Depends-on: series=23500 ("common/cnxk: add cnf10kb support")

v2:
- Fixed commit message in 10/12, 1/12 patches

 drivers/common/cnxk/roc_nix_inl.h        | 2 +-
 drivers/common/cnxk/roc_nix_inl_priv.h   | 2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c | 5 ++++-
 drivers/net/cnxk/cnxk_ethdev_sec.c       | 5 ++++-
 4 files changed, 10 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_nix_inl.h +1 -1
index b1b4c5b..c7b1817 100644
@@ -131,7 +131,7 @@ struct roc_nix_inl_dev {
 	uint16_t channel;
 	uint16_t chan_mask;
 	bool attach_cptlf;
-	bool wqe_skip;
+	uint16_t wqe_skip;
 	uint8_t spb_drop_pc;
 	uint8_t lpb_drop_pc;
 	bool set_soft_exp_poll;
drivers/common/cnxk/roc_nix_inl_priv.h +1 -1
index d61c7b2..a775efc 100644
@@ -84,7 +84,7 @@ struct nix_inl_dev {
 	uint32_t ipsec_in_max_spi;
 	uint32_t inb_spi_mask;
 	bool attach_cptlf;
-	bool wqe_skip;
+	uint16_t wqe_skip;
 	bool ts_ena;
 };
 
drivers/event/cnxk/cnxk_eventdev_adptr.c +4 -1
index fa96090..cf5b1dd 100644
@@ -125,6 +125,7 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 {
 	struct roc_nix *nix = &cnxk_eth_dev->nix;
 	struct roc_nix_rq *rq;
+	uint16_t wqe_skip;
 	int rc;
 
 	rq = &cnxk_eth_dev->rqs[rq_id];
@@ -132,7 +133,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 	rq->tt = ev->sched_type;
 	rq->hwgrp = ev->queue_id;
 	rq->flow_tag_width = 20;
-	rq->wqe_skip = 1;
+	wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+	wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+	rq->wqe_skip = wqe_skip;
 	rq->tag_mask = (port_id & 0xF) << 20;
 	rq->tag_mask |= (((port_id >> 4) & 0xF) | (RTE_EVENT_TYPE_ETHDEV << 4))
 			<< 24;
drivers/net/cnxk/cnxk_ethdev_sec.c +4 -1
index d01ebb4..1de3454 100644
@@ -264,6 +264,7 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
 	char name[CNXK_NIX_INL_DEV_NAME_LEN];
 	struct roc_nix_inl_dev *inl_dev;
 	const struct rte_memzone *mz;
+	uint16_t wqe_skip;
 	int rc = -ENOMEM;
 
 	RTE_SET_USED(pci_drv);
@@ -295,7 +296,9 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
 
 	inl_dev->attach_cptlf = true;
 	/* WQE skip is one for DPDK */
-	inl_dev->wqe_skip = true;
+	wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+	wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+	inl_dev->wqe_skip = wqe_skip;
 	inl_dev->set_soft_exp_poll = true;
 	rc = roc_nix_inl_dev_init(inl_dev);
 	if (rc) {
Signature · 1 line
2.8.4
#16 lore raw

PATCH v2 2/12 common/cnxk: avoid CPT backpressure due to errata

Avoid enabling CPT backpressure due to errata where backpressure would block requests from even other CPT LF's. Also allow CQ size >=16K.

---
 drivers/common/cnxk/roc_errata.h | 7 +++++++
 drivers/common/cnxk/roc_nix.h    | 2 +-
 drivers/common/cnxk/roc_nix_fc.c | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_errata.h +7 -0
index 31162d5..f048297 100644
@@ -77,4 +77,11 @@ roc_errata_nix_has_perf_issue_on_stats_update(void)
 	return true;
 }
 
+/* Errata IPBUCPT-38726, IPBUCPT-38727 */
+static inline bool
+roc_errata_cpt_hang_on_x2p_bp(void)
+{
+	return roc_model_is_cn10ka_a0();
+}
+
 #endif /* _ROC_ERRATA_H_ */
drivers/common/cnxk/roc_nix.h +1 -1
index aedde1c..944e4c6 100644
@@ -309,7 +309,7 @@ struct roc_nix_rq {
 struct roc_nix_cq {
 	/* Input parameters */
 	uint16_t qid;
-	uint16_t nb_desc;
+	uint32_t nb_desc;
 	/* End of Input parameters */
 	uint16_t drop_thresh;
 	struct roc_nix *roc_nix;
drivers/common/cnxk/roc_nix_fc.c +2 -1
index a0505bd..cef5d07 100644
@@ -77,7 +77,8 @@ nix_fc_rxchan_bpid_set(struct roc_nix *roc_nix, bool enable)
 		goto exit;
 
 	/* Enable backpressure on CPT if inline inb is enabled */
-	if (enable && roc_nix_inl_inb_is_enabled(roc_nix)) {
+	if (enable && roc_nix_inl_inb_is_enabled(roc_nix) &&
+	    !roc_errata_cpt_hang_on_x2p_bp()) {
 		req = mbox_alloc_msg_nix_cpt_bp_enable(mbox);
 		if (req == NULL)
 			return rc;
Signature · 1 line
2.8.4
#17 lore raw

PATCH v2 3/12 common/cnxk: add PFC support for VFs

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Current PFC implementation does not support VFs.
Patch enables PFC on VFs too.

Also fix the config of aura.bp to be based on number of buffers(aura.limit) and corresponding shift value(aura.shift).

Fixes cb4bfd6e7bdf ("event/cnxk: support Rx adapter")
---
 drivers/common/cnxk/roc_nix.h            |  14 +++-
 drivers/common/cnxk/roc_nix_fc.c         | 120 +++++++++++++++++++++++++++----
 drivers/common/cnxk/roc_nix_priv.h       |   2 +
 drivers/common/cnxk/roc_nix_queue.c      |  47 ++++++++++++
 drivers/common/cnxk/roc_nix_tm.c         |  67 +++++++++--------
 drivers/common/cnxk/version.map          |   3 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c |  12 ++--
 drivers/net/cnxk/cnxk_ethdev.h           |   2 +
 8 files changed, 217 insertions(+), 50 deletions(-)
drivers/common/cnxk/roc_nix.h +12 -2
index 944e4c6..f0d7fc8 100644
@@ -157,6 +157,7 @@ struct roc_nix_fc_cfg {
 #define ROC_NIX_FC_RXCHAN_CFG 0
 #define ROC_NIX_FC_CQ_CFG     1
 #define ROC_NIX_FC_TM_CFG     2
+#define ROC_NIX_FC_RQ_CFG     3
 	uint8_t type;
 	union {
 		struct {
@@ -171,6 +172,14 @@ struct roc_nix_fc_cfg {
 		} cq_cfg;
 
 		struct {
+			uint32_t rq;
+			uint16_t tc;
+			uint16_t cq_drop;
+			bool enable;
+			uint64_t pool;
+		} rq_cfg;
+
+		struct {
 			uint32_t sq;
 			uint16_t tc;
 			bool enable;
@@ -791,8 +800,8 @@ uint16_t __roc_api roc_nix_chan_count_get(struct roc_nix *roc_nix);
 
 enum roc_nix_fc_mode __roc_api roc_nix_fc_mode_get(struct roc_nix *roc_nix);
 
-void __roc_api rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id,
-				     uint8_t ena, uint8_t force);
+void __roc_api roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id,
+				     uint8_t ena, uint8_t force, uint8_t tc);
 
 /* NPC */
 int __roc_api roc_nix_npc_promisc_ena_dis(struct roc_nix *roc_nix, int enable);
@@ -845,6 +854,7 @@ int __roc_api roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq,
 int __roc_api roc_nix_rq_modify(struct roc_nix *roc_nix, struct roc_nix_rq *rq,
 				bool ena);
 int __roc_api roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable);
+int __roc_api roc_nix_rq_is_sso_enable(struct roc_nix *roc_nix, uint32_t qid);
 int __roc_api roc_nix_rq_fini(struct roc_nix_rq *rq);
 int __roc_api roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq);
 int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq);
drivers/common/cnxk/roc_nix_fc.c +107 -13

196 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +2 -0
index cc69d71..5e865f8 100644
@@ -357,6 +357,8 @@ nix_tm_tree2str(enum roc_nix_tm_tree tree)
 		return "Default Tree";
 	else if (tree == ROC_NIX_TM_RLIMIT)
 		return "Rate Limit Tree";
+	else if (tree == ROC_NIX_TM_PFC)
+		return "PFC Tree";
 	else if (tree == ROC_NIX_TM_USER)
 		return "User Tree";
 	return "???";
drivers/common/cnxk/roc_nix_queue.c +47 -0

53 lines not on this page · raw message

drivers/common/cnxk/roc_nix_tm.c +38 -29

130 lines not on this page · raw message

drivers/common/cnxk/version.map +2 -1
index 1ba5b4f..27e81f2 100644
@@ -122,7 +122,7 @@ INTERNAL {
 	roc_nix_fc_config_set;
 	roc_nix_fc_mode_set;
 	roc_nix_fc_mode_get;
-	rox_nix_fc_npa_bp_cfg;
+	roc_nix_fc_npa_bp_cfg;
 	roc_nix_get_base_chan;
 	roc_nix_get_pf;
 	roc_nix_get_pf_func;
@@ -220,6 +220,7 @@ INTERNAL {
 	roc_nix_rq_ena_dis;
 	roc_nix_rq_fini;
 	roc_nix_rq_init;
+	roc_nix_rq_is_sso_enable;
 	roc_nix_rq_modify;
 	roc_nix_rss_default_setup;
 	roc_nix_rss_flowkey_set;
drivers/event/cnxk/cnxk_eventdev_adptr.c +7 -5
index cf5b1dd..8fcc377 100644
@@ -250,9 +250,11 @@ cnxk_sso_rx_adapter_queue_add(
 				rc |= roc_nix_rx_drop_re_set(&cnxk_eth_dev->nix,
 							     false);
 		}
-		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
-				      rxq_sp->qconf.mp->pool_id, true,
-				      dev->force_ena_bp);
+
+		if (rxq_sp->tx_pause)
+			roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
+					      rxq_sp->qconf.mp->pool_id, true,
+					      dev->force_ena_bp, rxq_sp->tc);
 		cnxk_eth_dev->nb_rxq_sso++;
 	}
 
@@ -293,9 +295,9 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev,
 		rxq_sp = cnxk_eth_rxq_to_sp(
 			eth_dev->data->rx_queues[rx_queue_id]);
 		rc = cnxk_sso_rxq_disable(cnxk_eth_dev, (uint16_t)rx_queue_id);
-		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
+		roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, false,
-				      dev->force_ena_bp);
+				      dev->force_ena_bp, 0);
 		cnxk_eth_dev->nb_rxq_sso--;
 
 		/* Enable drop_re if it was disabled earlier */
drivers/net/cnxk/cnxk_ethdev.h +2 -0
index e992302..0400d73 100644
@@ -443,6 +443,8 @@ struct cnxk_eth_rxq_sp {
 	struct cnxk_eth_dev *dev;
 	struct cnxk_eth_qconf qconf;
 	uint16_t qid;
+	uint8_t tx_pause;
+	uint8_t tc;
 } __plt_cache_aligned;
 
 struct cnxk_eth_txq_sp {
Signature · 1 line
2.8.4
#18 lore raw

PATCH v2 4/12 common/cnxk: support same TC value across multiple queues

In reply to Nithin Dabilpuram

From: Harman Kalra <[email protected]>

User may want to configure same TC value across multiple queues, but for that all queues should have a common TL3 where this TC value will get configured.

Changed the pfc_tc_cq_map/pfc_tc_sq_map array indexing to qid and store TC values in the array. As multiple queues may have same TC value.

---
 drivers/common/cnxk/roc_dev.c        | 18 ++++++++
 drivers/common/cnxk/roc_nix.h        |  4 +-
 drivers/common/cnxk/roc_nix_fc.c     |  2 +-
 drivers/common/cnxk/roc_nix_priv.h   |  3 +-
 drivers/common/cnxk/roc_nix_tm.c     | 87 ++++++++++++++++++++++++------------
 drivers/common/cnxk/roc_nix_tm_ops.c |  3 +-
 6 files changed, 84 insertions(+), 33 deletions(-)
drivers/common/cnxk/roc_dev.c +18 -0
index 09199ac..59128a3 100644
@@ -421,6 +421,24 @@ process_msgs(struct dev *dev, struct mbox *mbox)
 			/* Get our identity */
 			dev->pf_func = msg->pcifunc;
 			break;
+		case MBOX_MSG_CGX_PRIO_FLOW_CTRL_CFG:
+			/* Handling the case where one VF tries to disable PFC
+			 * while PFC already configured on other VFs. This is
+			 * not an error but a warning which can be ignored.
+			 */
+#define LMAC_AF_ERR_PERM_DENIED -1103
+			if (msg->rc) {
+				if (msg->rc == LMAC_AF_ERR_PERM_DENIED) {
+					plt_mbox_dbg(
+						"Receive Flow control disable not permitted "
+						"as its used by other PFVFs");
+					msg->rc = 0;
+				} else {
+					plt_err("Message (%s) response has err=%d",
+						mbox_id2name(msg->id), msg->rc);
+				}
+			}
+			break;
 
 		default:
 			if (msg->rc)
drivers/common/cnxk/roc_nix.h +3 -1
index f0d7fc8..4e5cf05 100644
@@ -11,7 +11,8 @@
 #define ROC_NIX_BPF_LEVEL_IDX_INVALID 0xFF
 #define ROC_NIX_BPF_LEVEL_MAX	      3
 #define ROC_NIX_BPF_STATS_MAX	      12
-#define ROC_NIX_MTR_ID_INVALID       UINT32_MAX
+#define ROC_NIX_MTR_ID_INVALID	      UINT32_MAX
+#define ROC_NIX_PFC_CLASS_INVALID     UINT8_MAX
 
 enum roc_nix_rss_reta_sz {
 	ROC_NIX_RSS_RETA_SZ_64 = 64,
@@ -349,6 +350,7 @@ struct roc_nix_sq {
 	void *lmt_addr;
 	void *sqe_mem;
 	void *fc;
+	uint8_t tc;
 };
 
 struct roc_nix_link_info {
drivers/common/cnxk/roc_nix_fc.c +1 -1
index daae285..f4cfa11 100644
@@ -312,7 +312,7 @@ roc_nix_fc_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
 	else if (fc_cfg->type == ROC_NIX_FC_TM_CFG)
 		return nix_tm_bp_config_set(roc_nix, fc_cfg->tm_cfg.sq,
 					    fc_cfg->tm_cfg.tc,
-					    fc_cfg->tm_cfg.enable);
+					    fc_cfg->tm_cfg.enable, false);
 
 	return -EINVAL;
 }
drivers/common/cnxk/roc_nix_priv.h +2 -1
index 5e865f8..5b0522c 100644
@@ -100,6 +100,7 @@ struct nix_tm_node {
 	/* Last stats */
 	uint64_t last_pkts;
 	uint64_t last_bytes;
+	uint32_t tc_refcnt;
 };
 
 struct nix_tm_shaper_profile {
@@ -402,7 +403,7 @@ int nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
 int nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable);
 int nix_tm_bp_config_get(struct roc_nix *roc_nix, bool *is_enabled);
 int nix_tm_bp_config_set(struct roc_nix *roc_nix, uint16_t sq, uint16_t tc,
-			 bool enable);
+			 bool enable, bool force_flush);
 void nix_rq_vwqe_flush(struct roc_nix_rq *rq, uint16_t vwqe_interval);
 int nix_tm_mark_init(struct nix *nix);
 
drivers/common/cnxk/roc_nix_tm.c +58 -29

138 lines not on this page · raw message

drivers/common/cnxk/roc_nix_tm_ops.c +2 -1
index 5884ce5..4aa5500 100644
@@ -292,6 +292,7 @@ roc_nix_tm_node_add(struct roc_nix *roc_nix, struct roc_nix_tm_node *roc_node)
 	node->pkt_mode_set = roc_node->pkt_mode_set;
 	node->free_fn = roc_node->free_fn;
 	node->tree = ROC_NIX_TM_USER;
+	node->rel_chan = NIX_TM_CHAN_INVALID;
 
 	return nix_tm_node_add(roc_nix, node);
 }
@@ -473,7 +474,7 @@ roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix)
 		if (!sq)
 			continue;
 
-		rc = nix_tm_bp_config_set(roc_nix, sq->qid, 0, false);
+		rc = nix_tm_bp_config_set(roc_nix, sq->qid, 0, false, false);
 		if (rc && rc != -ENOENT) {
 			plt_err("Failed to disable backpressure, rc=%d", rc);
 			goto cleanup;
Signature · 1 line
2.8.4
#19 lore raw

PATCH v2 5/12 common/cnxk: enhance CPT parse header dump

In reply to Nithin Dabilpuram

Enhance CPT parse header dump to dump fragment info and swap pointers before printing.

---
 drivers/common/cnxk/roc_cpt_debug.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_cpt_debug.c +31 -2
index be6ddb5..5602e53 100644
@@ -8,6 +8,10 @@
 void
 roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
 {
+	struct cpt_frag_info_s *frag_info;
+	uint32_t offset;
+	uint64_t *slot;
+
 	plt_print("CPT_PARSE \t0x%p:", cpth);
 
 	/* W0 */
@@ -19,7 +23,7 @@ roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
 		  cpth->w0.pad_len, cpth->w0.num_frags, cpth->w0.pkt_out);
 
 	/* W1 */
-	plt_print("W1: wqe_ptr \t0x%016lx\t", cpth->wqe_ptr);
+	plt_print("W1: wqe_ptr \t0x%016lx\t", plt_be_to_cpu_64(cpth->wqe_ptr));
 
 	/* W2 */
 	plt_print("W2: frag_age \t0x%x\t\torig_pf_func \t0x%04x",
@@ -33,7 +37,32 @@ roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
 
 	/* W4 */
 	plt_print("W4: esn \t%" PRIx64 " \t OR frag1_wqe_ptr \t0x%" PRIx64,
-		  cpth->esn, cpth->frag1_wqe_ptr);
+		  cpth->esn, plt_be_to_cpu_64(cpth->frag1_wqe_ptr));
+
+	/* offset of 0 implies 256B, otherwise it implies offset*8B */
+	offset = cpth->w2.fi_offset;
+	offset = (((offset - 1) & 0x1f) + 1) * 8;
+	frag_info = PLT_PTR_ADD(cpth, offset);
+
+	plt_print("CPT Fraginfo \t0x%p:", frag_info);
+
+	/* W0 */
+	plt_print("W0: f0.info \t0x%x", frag_info->w0.f0.info);
+	plt_print("W0: f1.info \t0x%x", frag_info->w0.f1.info);
+	plt_print("W0: f2.info \t0x%x", frag_info->w0.f2.info);
+	plt_print("W0: f3.info \t0x%x", frag_info->w0.f3.info);
+
+	/* W1 */
+	plt_print("W1: frag_size0 \t0x%x", frag_info->w1.frag_size0);
+	plt_print("W1: frag_size1 \t0x%x", frag_info->w1.frag_size1);
+	plt_print("W1: frag_size2 \t0x%x", frag_info->w1.frag_size2);
+	plt_print("W1: frag_size3 \t0x%x", frag_info->w1.frag_size3);
+
+	slot = (uint64_t *)(frag_info + 1);
+	plt_print("Frag Slot2:  WQE ptr \t%p",
+		  (void *)plt_be_to_cpu_64(slot[0]));
+	plt_print("Frag Slot3:  WQE ptr \t%p",
+		  (void *)plt_be_to_cpu_64(slot[1]));
 }
 
 static int
Signature · 1 line
2.8.4
#20 lore raw

PATCH v2 6/12 common/cnxk: fix mbox structs to avoid unaligned access

In reply to Nithin Dabilpuram

Fix mbox structs to avoid unaligned access as mbox memory is from BAR space.

Fixes 503b82de2cbf ("common/cnxk: add mbox request and response definitions")
Fixes e746aec161cc ("common/cnxk: fix SQ flush sequence")
---
 drivers/common/cnxk/roc_mbox.h    | 18 +++++++++---------
 drivers/common/cnxk/roc_nix_inl.c |  2 ++
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/common/cnxk/roc_mbox.h +9 -9
index 2c30f19..965c704 100644
@@ -777,7 +777,7 @@ struct nix_lf_alloc_req {
 	uint64_t __io way_mask;
 #define NIX_LF_RSS_TAG_LSB_AS_ADDER BIT_ULL(0)
 #define NIX_LF_LBK_BLK_SEL	    BIT_ULL(1)
-	uint64_t flags;
+	uint64_t __io flags;
 };
 
 struct nix_lf_alloc_rsp {
@@ -798,7 +798,7 @@ struct nix_lf_alloc_rsp {
 	uint8_t __io cgx_links;	      /* No. of CGX links present in HW */
 	uint8_t __io lbk_links;	      /* No. of LBK links present in HW */
 	uint8_t __io sdp_links;	      /* No. of SDP links present in HW */
-	uint8_t tx_link;	      /* Transmit channel link number */
+	uint8_t __io tx_link;	      /* Transmit channel link number */
 };
 
 struct nix_lf_free_req {
@@ -1275,8 +1275,8 @@ struct ssow_lf_free_req {
 #define SSOW_INVAL_SELECTIVE_VER 0x1000
 struct ssow_lf_inv_req {
 	struct mbox_msghdr hdr;
-	uint16_t nb_hws;		 /* Number of HWS to invalidate*/
-	uint16_t hws[MAX_RVU_BLKLF_CNT]; /* Array of HWS */
+	uint16_t __io nb_hws;		      /* Number of HWS to invalidate*/
+	uint16_t __io hws[MAX_RVU_BLKLF_CNT]; /* Array of HWS */
 };
 
 struct ssow_config_lsw {
@@ -1453,11 +1453,11 @@ struct cpt_sts_rsp {
 struct cpt_rxc_time_cfg_req {
 	struct mbox_msghdr hdr;
 	int blkaddr;
-	uint32_t step;
-	uint16_t zombie_thres;
-	uint16_t zombie_limit;
-	uint16_t active_thres;
-	uint16_t active_limit;
+	uint32_t __io step;
+	uint16_t __io zombie_thres;
+	uint16_t __io zombie_limit;
+	uint16_t __io active_thres;
+	uint16_t __io active_limit;
 };
 
 struct cpt_rx_inline_lf_cfg_msg {
drivers/common/cnxk/roc_nix_inl.c +2 -0
index 39b9bec..7da8938 100644
@@ -246,6 +246,8 @@ roc_nix_reassembly_configure(uint32_t max_wait_time, uint16_t max_frags)
 	struct roc_cpt_rxc_time_cfg cfg;
 
 	PLT_SET_USED(max_frags);
+	if (idev == NULL)
+		return -ENOTSUP;
 	roc_cpt = idev->cpt;
 	if (!roc_cpt) {
 		plt_err("Cannot support inline inbound, cryptodev not probed");
Signature · 1 line
2.8.4
#21 lore raw

PATCH v2 7/12 net/cnxk: add SDP link status

In reply to Nithin Dabilpuram

From: Satananda Burla <[email protected]>

Add SDP link status reporting

---
 drivers/net/cnxk/cnxk_link.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/cnxk/cnxk_link.c +3 -3
index b1d59e3..127c9e7 100644
@@ -13,7 +13,7 @@ cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set)
 		dev->flags &= ~CNXK_LINK_CFG_IN_PROGRESS_F;
 
 	/* Update link info for LBK */
-	if (!set && roc_nix_is_lbk(&dev->nix)) {
+	if (!set && (roc_nix_is_lbk(&dev->nix) || roc_nix_is_sdp(&dev->nix))) {
 		struct rte_eth_link link;
 
 		link.link_status = RTE_ETH_LINK_UP;
@@ -124,10 +124,10 @@ cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	RTE_SET_USED(wait_to_complete);
 	memset(&link, 0, sizeof(struct rte_eth_link));
 
-	if (!eth_dev->data->dev_started || roc_nix_is_sdp(&dev->nix))
+	if (!eth_dev->data->dev_started)
 		return 0;
 
-	if (roc_nix_is_lbk(&dev->nix)) {
+	if (roc_nix_is_lbk(&dev->nix) || roc_nix_is_sdp(&dev->nix)) {
 		link.link_status = RTE_ETH_LINK_UP;
 		link.link_speed = RTE_ETH_SPEED_NUM_100G;
 		link.link_autoneg = RTE_ETH_LINK_FIXED;
Signature · 1 line
2.8.4
#22 lore raw

PATCH v2 8/12 net/cnxk: remove restriction on VFs for PFC config

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Currently PFC configuration is not allowed on VFs. Patch enables PFC configuration on VFs

---
 drivers/net/cnxk/cnxk_ethdev.c     |   9 +-
 drivers/net/cnxk/cnxk_ethdev.h     |  13 +--
 drivers/net/cnxk/cnxk_ethdev_ops.c | 219 +++++++++++++++++++++----------------
 3 files changed, 137 insertions(+), 104 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +4 -5
index 09e5736..941b270 100644
@@ -323,7 +323,7 @@ nix_init_flow_ctrl_config(struct rte_eth_dev *eth_dev)
 	struct cnxk_fc_cfg *fc = &dev->fc_cfg;
 	int rc;
 
-	if (roc_nix_is_sdp(&dev->nix))
+	if (roc_nix_is_vf_or_sdp(&dev->nix))
 		return 0;
 
 	/* To avoid Link credit deadlock on Ax, disable Tx FC if it's enabled */
@@ -604,6 +604,9 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq_sp->qconf.conf.rx.offloads = dev->rx_offloads;
 	rxq_sp->qconf.nb_desc = nb_desc;
 	rxq_sp->qconf.mp = mp;
+	rxq_sp->tc = 0;
+	rxq_sp->tx_pause = (dev->fc_cfg.mode == RTE_ETH_FC_FULL ||
+			    dev->fc_cfg.mode == RTE_ETH_FC_TX_PAUSE);
 
 	if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) {
 		/* Pass a tagmask used to handle error packets in inline device.
@@ -1795,7 +1798,6 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 		if (dev->pfc_tc_sq_map[i] != 0xFFFF) {
 			pfc_conf.rx_pause.tx_qid = dev->pfc_tc_sq_map[i];
 			pfc_conf.rx_pause.tc = i;
-			pfc_conf.tx_pause.rx_qid = i;
 			pfc_conf.tx_pause.tc = i;
 			rc = cnxk_nix_priority_flow_ctrl_queue_config(eth_dev,
 				&pfc_conf);
@@ -1805,9 +1807,6 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 		}
 	}
 
-	fc_conf.mode = RTE_ETH_FC_FULL;
-	rc = cnxk_nix_flow_ctrl_set(eth_dev, &fc_conf);
-
 	/* Disable and free rte_meter entries */
 	nix_meter_fini(dev);
 
drivers/net/cnxk/cnxk_ethdev.h +6 -7
index 0400d73..db2d849 100644
@@ -156,13 +156,10 @@ struct cnxk_fc_cfg {
 };
 
 struct cnxk_pfc_cfg {
-	struct cnxk_fc_cfg fc_cfg;
 	uint16_t class_en;
 	uint16_t pause_time;
-	uint8_t rx_tc;
-	uint8_t rx_qid;
-	uint8_t tx_tc;
-	uint8_t tx_qid;
+	uint16_t rx_pause_en;
+	uint16_t tx_pause_en;
 };
 
 struct cnxk_eth_qconf {
@@ -669,8 +666,10 @@ int nix_mtr_color_action_validate(struct rte_eth_dev *eth_dev, uint32_t id,
 				  uint32_t *prev_id, uint32_t *next_id,
 				  struct cnxk_mtr_policy_node *policy,
 				  int *tree_level);
-int nix_priority_flow_ctrl_configure(struct rte_eth_dev *eth_dev,
-				     struct cnxk_pfc_cfg *conf);
+int nix_priority_flow_ctrl_rq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
+				   uint8_t tx_pause, uint8_t tc);
+int nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
+				   uint8_t rx_pause, uint8_t tc);
 
 /* Inlines */
 static __rte_always_inline uint64_t
drivers/net/cnxk/cnxk_ethdev_ops.c +127 -92

317 lines not on this page · raw message

Signature · 1 line
2.8.4
#23 lore raw

PATCH v2 9/12 net/cnxk: pfc class disable resulting in invalid behaviour

In reply to Nithin Dabilpuram

From: Harman Kalra <[email protected]>

Disabling a specific pfc class on a SQ is resulting in disabling PFC on the entire port.

---
 drivers/net/cnxk/cnxk_ethdev.c     | 25 ++++++++++++-------------
 drivers/net/cnxk/cnxk_ethdev.h     |  1 -
 drivers/net/cnxk/cnxk_ethdev_ops.c | 34 +++++++++++++++++++++++++++-------
 3 files changed, 39 insertions(+), 21 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +12 -13
index 941b270..4ea1617 100644
@@ -439,6 +439,7 @@ cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	sq->qid = qid;
 	sq->nb_desc = nb_desc;
 	sq->max_sqe_sz = nix_sq_max_sqe_sz(dev);
+	sq->tc = ROC_NIX_PFC_CLASS_INVALID;
 
 	rc = roc_nix_sq_init(&dev->nix, sq);
 	if (rc) {
@@ -1281,8 +1282,6 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		goto cq_fini;
 	}
 
-	/* Initialize TC to SQ mapping as invalid */
-	memset(dev->pfc_tc_sq_map, 0xFF, sizeof(dev->pfc_tc_sq_map));
 	/*
 	 * Restore queue config when reconfigure followed by
 	 * reconfigure and no queue configure invoked from application case.
@@ -1794,17 +1793,17 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 	rc = cnxk_nix_flow_ctrl_set(eth_dev, &fc_conf);
 
 	pfc_conf.mode = RTE_ETH_FC_NONE;
-	for (i = 0; i < CNXK_NIX_PFC_CHAN_COUNT; i++) {
-		if (dev->pfc_tc_sq_map[i] != 0xFFFF) {
-			pfc_conf.rx_pause.tx_qid = dev->pfc_tc_sq_map[i];
-			pfc_conf.rx_pause.tc = i;
-			pfc_conf.tx_pause.tc = i;
-			rc = cnxk_nix_priority_flow_ctrl_queue_config(eth_dev,
-				&pfc_conf);
-			if (rc)
-				plt_err("Failed to reset PFC. error code(%d)",
-					rc);
-		}
+	for (i = 0; i < RTE_MAX(eth_dev->data->nb_rx_queues,
+				eth_dev->data->nb_tx_queues);
+	     i++) {
+		pfc_conf.rx_pause.tc = ROC_NIX_PFC_CLASS_INVALID;
+		pfc_conf.rx_pause.tx_qid = i;
+		pfc_conf.tx_pause.tc = ROC_NIX_PFC_CLASS_INVALID;
+		pfc_conf.tx_pause.rx_qid = i;
+		rc = cnxk_nix_priority_flow_ctrl_queue_config(eth_dev,
+							      &pfc_conf);
+		if (rc)
+			plt_err("Failed to reset PFC. error code(%d)", rc);
 	}
 
 	/* Disable and free rte_meter entries */
drivers/net/cnxk/cnxk_ethdev.h +0 -1
index db2d849..a4e96f0 100644
@@ -396,7 +396,6 @@ struct cnxk_eth_dev {
 	struct cnxk_eth_qconf *rx_qconf;
 
 	/* Flow control configuration */
-	uint16_t pfc_tc_sq_map[CNXK_NIX_PFC_CHAN_COUNT];
 	struct cnxk_pfc_cfg pfc_cfg;
 	struct cnxk_fc_cfg fc_cfg;
 
drivers/net/cnxk/cnxk_ethdev_ops.c +27 -7
index caace9d..1592971 100644
@@ -1129,8 +1129,10 @@ nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
 	struct rte_eth_dev_data *data = eth_dev->data;
 	struct cnxk_pfc_cfg *pfc = &dev->pfc_cfg;
 	struct roc_nix *nix = &dev->nix;
+	struct roc_nix_pfc_cfg pfc_cfg;
 	struct roc_nix_fc_cfg fc_cfg;
 	struct cnxk_eth_txq_sp *txq;
+	enum roc_nix_fc_mode mode;
 	struct roc_nix_sq *sq;
 	int rc;
 
@@ -1140,12 +1142,6 @@ nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
 	if (qid >= eth_dev->data->nb_tx_queues)
 		return -ENOTSUP;
 
-	if (dev->pfc_tc_sq_map[tc] != 0xFFFF &&
-	    dev->pfc_tc_sq_map[tc] != qid) {
-		plt_err("Same TC can not be configured on multiple SQs");
-		return -ENOTSUP;
-	}
-
 	/* Check if RX pause frame is enabled or not */
 	if (!pfc->rx_pause_en) {
 		if ((roc_nix_tm_tree_type_get(nix) == ROC_NIX_TM_DEFAULT) &&
@@ -1180,7 +1176,31 @@ nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
 	if (rc)
 		return rc;
 
-	dev->pfc_tc_sq_map[tc] = sq->qid;
+	/* Maintaining a count for SQs which are configured for PFC. This is
+	 * required to handle disabling of a particular SQ without affecting
+	 * PFC on other SQs.
+	 */
+	if (!fc_cfg.tm_cfg.enable && sq->tc != ROC_NIX_PFC_CLASS_INVALID) {
+		sq->tc = ROC_NIX_PFC_CLASS_INVALID;
+		pfc->rx_pause_en--;
+	} else if (fc_cfg.tm_cfg.enable &&
+		   sq->tc == ROC_NIX_PFC_CLASS_INVALID) {
+		sq->tc = tc;
+		pfc->rx_pause_en++;
+	}
+
+	if (pfc->rx_pause_en > 1)
+		goto exit;
+
+	if (pfc->tx_pause_en)
+		mode = pfc->rx_pause_en ? ROC_NIX_FC_FULL : ROC_NIX_FC_TX;
+	else
+		mode = pfc->rx_pause_en ? ROC_NIX_FC_RX : ROC_NIX_FC_NONE;
+
+	memset(&pfc_cfg, 0, sizeof(struct roc_nix_pfc_cfg));
+	pfc_cfg.mode = mode;
+	pfc_cfg.tc = pfc->class_en;
+	rc = roc_nix_pfc_mode_set(nix, &pfc_cfg);
 exit:
 	return rc;
 }
Signature · 1 line
2.8.4
#24 lore raw

PATCH v2 10/12 net/cnxk: resize CQ for Rx security for errata

In reply to Nithin Dabilpuram

Resize CQ for Rx security offload in case of HW errata.

---
 drivers/net/cnxk/cnxk_ethdev.c | 43 +++++++++++++++++++++++++++++++++++++++++-
 drivers/net/cnxk/cnxk_ethdev.h |  2 +-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +42 -1
index 4ea1617..2418290 100644
@@ -5,6 +5,8 @@
 
 #include <rte_eventdev.h>
 
+#define CNXK_NIX_CQ_INL_CLAMP_MAX (64UL * 1024UL)
+
 static inline uint64_t
 nix_get_rx_offload_capa(struct cnxk_eth_dev *dev)
 {
@@ -40,6 +42,39 @@ nix_get_speed_capa(struct cnxk_eth_dev *dev)
 	return speed_capa;
 }
 
+static uint32_t
+nix_inl_cq_sz_clamp_up(struct roc_nix *nix, struct rte_mempool *mp,
+		       uint32_t nb_desc)
+{
+	struct roc_nix_rq *inl_rq;
+	uint64_t limit;
+
+	if (!roc_errata_cpt_hang_on_x2p_bp())
+		return nb_desc;
+
+	/* CQ should be able to hold all buffers in first pass RQ's aura
+	 * this RQ's aura.
+	 */
+	inl_rq = roc_nix_inl_dev_rq(nix);
+	if (!inl_rq) {
+		/* This itself is going to be inline RQ's aura */
+		limit = roc_npa_aura_op_limit_get(mp->pool_id);
+	} else {
+		limit = roc_npa_aura_op_limit_get(inl_rq->aura_handle);
+		/* Also add this RQ's aura if it is different */
+		if (inl_rq->aura_handle != mp->pool_id)
+			limit += roc_npa_aura_op_limit_get(mp->pool_id);
+	}
+	nb_desc = PLT_MAX(limit + 1, nb_desc);
+	if (nb_desc > CNXK_NIX_CQ_INL_CLAMP_MAX) {
+		plt_warn("Could not setup CQ size to accommodate"
+			 " all buffers in related auras (%" PRIu64 ")",
+			 limit);
+		nb_desc = CNXK_NIX_CQ_INL_CLAMP_MAX;
+	}
+	return nb_desc;
+}
+
 int
 cnxk_nix_inb_mode_set(struct cnxk_eth_dev *dev, bool use_inl_dev)
 {
@@ -504,7 +539,7 @@ cnxk_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid)
 
 int
 cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
-			uint16_t nb_desc, uint16_t fp_rx_q_sz,
+			uint32_t nb_desc, uint16_t fp_rx_q_sz,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp)
 {
@@ -552,6 +587,12 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	    dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY)
 		roc_nix_inl_dev_xaq_realloc(mp->pool_id);
 
+	/* Increase CQ size to Aura size to avoid CQ overflow and
+	 * then CPT buffer leak.
+	 */
+	if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
+		nb_desc = nix_inl_cq_sz_clamp_up(nix, mp, nb_desc);
+
 	/* Setup ROC CQ */
 	cq = &dev->cqs[qid];
 	cq->qid = qid;
drivers/net/cnxk/cnxk_ethdev.h +1 -1
index a4e96f0..4cb7c9e 100644
@@ -530,7 +530,7 @@ int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
 			    const struct rte_eth_txconf *tx_conf);
 int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
-			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
+			    uint32_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
 			    struct rte_mempool *mp);
 int cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid);
Signature · 1 line
2.8.4
#25 lore raw

PATCH v2 11/12 net/cnxk: add SDP VF device ID for probe matching

In reply to Nithin Dabilpuram

From: Radha Mohan Chintakuntla <[email protected]>

Add SDP VF device ID in the table for probe matching.

---
 drivers/net/cnxk/cn10k_ethdev.c | 5 +++++
 drivers/net/cnxk/cn9k_ethdev.c  | 6 ++++++
 2 files changed, 11 insertions(+)
drivers/net/cnxk/cn10k_ethdev.c +5 -0
index 550cec5..80c5c0e 100644
@@ -824,6 +824,11 @@ static const struct rte_pci_id cn10k_pci_nix_map[] = {
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KA, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KB, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KB, PCI_DEVID_CNXK_RVU_AF_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KA, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KB, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KB, PCI_DEVID_CNXK_RVU_SDP_VF),
 	{
 		.vendor_id = 0,
 	},
drivers/net/cnxk/cn9k_ethdev.c +6 -0
index 2663aa6..4fb0e2d 100644
@@ -777,6 +777,12 @@ static const struct rte_pci_id cn9k_pci_nix_map[] = {
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_AF_VF),
 	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_AF_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KA, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KB, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KC, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_SDP_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_SDP_VF),
 	{
 		.vendor_id = 0,
 	},
Signature · 1 line
2.8.4
#26 lore raw

PATCH v2 12/12 event/cnxk: offset timestamp data only if enabled on port

In reply to Nithin Dabilpuram

Offset timestamp data only when enabled on the port instead of just checking for offload flags.

---
 drivers/event/cnxk/cn10k_worker.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/event/cnxk/cn10k_worker.h +4 -2
index 034f508..7412a1b 100644
@@ -112,8 +112,7 @@ static __rte_always_inline void
 cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags,
 		   void *lookup_mem, void *tstamp, uintptr_t lbase)
 {
-	uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM |
-			     (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0);
+	uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM;
 	struct rte_event_vector *vec;
 	uint64_t aura_handle, laddr;
 	uint16_t nb_mbufs, non_vec;
@@ -133,6 +132,9 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags,
 	for (i = OBJS_PER_CLINE; i < vec->nb_elem; i += OBJS_PER_CLINE)
 		rte_prefetch0(&vec->ptrs[i]);
 
+	if (flags & NIX_RX_OFFLOAD_TSTAMP_F && tstamp)
+		mbuf_init |= 8;
+
 	nb_mbufs = RTE_ALIGN_FLOOR(vec->nb_elem, NIX_DESCS_PER_LOOP);
 	nb_mbufs = cn10k_nix_recv_pkts_vector(&mbuf_init, wqe, nb_mbufs,
 					      flags | NIX_RX_VWQE_F, lookup_mem,
Signature · 1 line
2.8.4
#27 lore raw

Re: [PATCH v2 12/12] event/cnxk: offset timestamp data only if enabled on port

Please ignore this particular patch 12/12. It is already part of other patch.

https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Thanks
Nithin

Quoted 32 lines · Nithin Dabilpuram

Offset timestamp data only when enabled on the port instead of just checking for offload flags.

---
  drivers/event/cnxk/cn10k_worker.h | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/event/cnxk/cn10k_worker.h +4 -2
index 034f508..7412a1b 100644
@@ -112,8 +112,7 @@ static __rte_always_inline void
  cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags,
  		   void *lookup_mem, void *tstamp, uintptr_t lbase)
  {
-	uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM |
-			     (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0);
+	uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM;
  	struct rte_event_vector *vec;
  	uint64_t aura_handle, laddr;
  	uint16_t nb_mbufs, non_vec;
@@ -133,6 +132,9 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags,
  	for (i = OBJS_PER_CLINE; i < vec->nb_elem; i += OBJS_PER_CLINE)
  		rte_prefetch0(&vec->ptrs[i]);
 
+	if (flags & NIX_RX_OFFLOAD_TSTAMP_F && tstamp)
+		mbuf_init |= 8;
+
  	nb_mbufs = RTE_ALIGN_FLOOR(vec->nb_elem, NIX_DESCS_PER_LOOP);
  	nb_mbufs = cn10k_nix_recv_pkts_vector(&mbuf_init, wqe, nb_mbufs,
  					      flags | NIX_RX_VWQE_F, lookup_mem,
#28 lore raw

Re: [PATCH v2 01/12] common/cnxk: use computed value for WQE skip

In reply to Nithin Dabilpuram
Quoted 7 lines · Nithin Dabilpuram

Use computed value for WQE skip instead of a hardcoded value. WQE skip needs to be number of 128B lines to accommodate rte_mbuf.

---
Depends-on: series=23500 ("common/cnxk: add cnf10kb support")

Series(except 12/12) applied to dpdk-next-net-mrvl/for-next-net. Thanks

Quoted 85 lines

v2:
- Fixed commit message in 10/12, 1/12 patches

 drivers/common/cnxk/roc_nix_inl.h        | 2 +-
 drivers/common/cnxk/roc_nix_inl_priv.h   | 2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c | 5 ++++-
 drivers/net/cnxk/cnxk_ethdev_sec.c       | 5 ++++-
 4 files changed, 10 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_nix_inl.h +1 -1
index b1b4c5b..c7b1817 100644
@@ -131,7 +131,7 @@ struct roc_nix_inl_dev {
        uint16_t channel;
        uint16_t chan_mask;
        bool attach_cptlf;
-       bool wqe_skip;
+       uint16_t wqe_skip;
        uint8_t spb_drop_pc;
        uint8_t lpb_drop_pc;
        bool set_soft_exp_poll;
drivers/common/cnxk/roc_nix_inl_priv.h +1 -1
index d61c7b2..a775efc 100644
@@ -84,7 +84,7 @@ struct nix_inl_dev {
        uint32_t ipsec_in_max_spi;
        uint32_t inb_spi_mask;
        bool attach_cptlf;
-       bool wqe_skip;
+       uint16_t wqe_skip;
        bool ts_ena;
 };
 
drivers/event/cnxk/cnxk_eventdev_adptr.c +4 -1
index fa96090..cf5b1dd 100644
@@ -125,6 +125,7 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 {
        struct roc_nix *nix = &cnxk_eth_dev->nix;
        struct roc_nix_rq *rq;
+       uint16_t wqe_skip;
        int rc;
 
        rq = &cnxk_eth_dev->rqs[rq_id];
@@ -132,7 +133,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
        rq->tt = ev->sched_type;
        rq->hwgrp = ev->queue_id;
        rq->flow_tag_width = 20;
-       rq->wqe_skip = 1;
+       wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+       wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+       rq->wqe_skip = wqe_skip;
        rq->tag_mask = (port_id & 0xF) << 20;
        rq->tag_mask |= (((port_id >> 4) & 0xF) | (RTE_EVENT_TYPE_ETHDEV << 4))
                        << 24;
drivers/net/cnxk/cnxk_ethdev_sec.c +4 -2
index d01ebb4..1de3454 100644
@@ -264,6 +264,7 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
        char name[CNXK_NIX_INL_DEV_NAME_LEN];
        struct roc_nix_inl_dev *inl_dev;
        const struct rte_memzone *mz;
+       uint16_t wqe_skip;
        int rc = -ENOMEM;
 
        RTE_SET_USED(pci_drv);
@@ -295,7 +296,9 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
 
        inl_dev->attach_cptlf = true;
        /* WQE skip is one for DPDK */
-       inl_dev->wqe_skip = true;
+       wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+       wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+       inl_dev->wqe_skip = wqe_skip;
        inl_dev->set_soft_exp_poll = true;
        rc = roc_nix_inl_dev_init(inl_dev);
        if (rc) {
--

2.8.4