[8/9] net/cnxk: allow fc on lbk and enable tm bp on Rx pause

Message ID 20211102155421.486-8-ndabilpuram@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/9] common/cnxk: add code to write CPT CTX through microcode op |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Nithin Dabilpuram Nov. 2, 2021, 3:54 p.m. UTC
  Allow flow control on LBK VF's and enable TM to listen on
backpressure when Rx pause is enabled.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/net/cnxk/cnxk_ethdev.c     | 12 ++++++------
 drivers/net/cnxk/cnxk_ethdev_ops.c | 14 +++++++++++++-
 2 files changed, 19 insertions(+), 7 deletions(-)
  

Patch

diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 5059fca..a62ded6 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -332,7 +332,7 @@  nix_update_flow_ctrl_config(struct rte_eth_dev *eth_dev)
 	struct cnxk_fc_cfg *fc = &dev->fc_cfg;
 	struct rte_eth_fc_conf fc_cfg = {0};
 
-	if (roc_nix_is_vf_or_sdp(&dev->nix))
+	if (roc_nix_is_vf_or_sdp(&dev->nix) && !roc_nix_is_lbk(&dev->nix))
 		return 0;
 
 	fc_cfg.mode = fc->mode;
@@ -1233,6 +1233,11 @@  cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		goto cq_fini;
 	}
 
+	/* Setup Inline security support */
+	rc = nix_security_setup(dev);
+	if (rc)
+		goto cq_fini;
+
 	/* Init flow control configuration */
 	fc_cfg.type = ROC_NIX_FC_RXCHAN_CFG;
 	fc_cfg.rxchan_cfg.enable = true;
@@ -1249,11 +1254,6 @@  cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		goto cq_fini;
 	}
 
-	/* Setup Inline security support */
-	rc = nix_security_setup(dev);
-	if (rc)
-		goto cq_fini;
-
 	/*
 	 * Restore queue config when reconfigure followed by
 	 * reconfigure and no queue configure invoked from application case.
diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
index baa474f..7b3ee75 100644
--- a/drivers/net/cnxk/cnxk_ethdev_ops.c
+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
@@ -250,7 +250,7 @@  cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 	uint8_t rx_pause, tx_pause;
 	int rc, i;
 
-	if (roc_nix_is_vf_or_sdp(nix)) {
+	if (roc_nix_is_vf_or_sdp(nix) && !roc_nix_is_lbk(nix)) {
 		plt_err("Flow control configuration is not allowed on VFs");
 		return -ENOTSUP;
 	}
@@ -287,6 +287,18 @@  cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 		}
 	}
 
+	/* Check if RX pause frame is enabled or not */
+	if (fc->rx_pause ^ rx_pause) {
+		struct roc_nix_fc_cfg fc_cfg;
+
+		memset(&fc_cfg, 0, sizeof(struct roc_nix_fc_cfg));
+		fc_cfg.type = ROC_NIX_FC_TM_CFG;
+		fc_cfg.tm_cfg.enable = !!rx_pause;
+		rc = roc_nix_fc_config_set(nix, &fc_cfg);
+		if (rc)
+			return rc;
+	}
+
 	rc = roc_nix_fc_mode_set(nix, mode_map[fc_conf->mode]);
 	if (rc)
 		return rc;