[v2,18/21] net/cnxk: enable flow control by default on device configure

Message ID 20220222193512.19292-18-ndabilpuram@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2,01/21] common/cnxk: increase SMQ resource count |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Nithin Dabilpuram Feb. 22, 2022, 7:35 p.m. UTC
  Enable flow control by default on device configuration
instead of basing it on Kernel behaviour.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/net/cnxk/cnxk_ethdev.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
  

Patch

diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index ad1e63d..9481af9 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -306,24 +306,22 @@  static int
 nix_init_flow_ctrl_config(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	enum roc_nix_fc_mode fc_mode = ROC_NIX_FC_FULL;
 	struct cnxk_fc_cfg *fc = &dev->fc_cfg;
-	struct rte_eth_fc_conf fc_conf = {0};
 	int rc;
 
-	/* Both Rx & Tx flow ctrl get enabled(RTE_ETH_FC_FULL) in HW
-	 * by AF driver, update those info in PMD structure.
-	 */
-	rc = cnxk_nix_flow_ctrl_get(eth_dev, &fc_conf);
+	/* To avoid Link credit deadlock on Ax, disable Tx FC if it's enabled */
+	if (roc_model_is_cn96_ax() &&
+	    dev->npc.switch_header_type != ROC_PRIV_FLAGS_HIGIG)
+		fc_mode = ROC_NIX_FC_TX;
+
+	/* By default enable flow control */
+	rc = roc_nix_fc_mode_set(&dev->nix, fc_mode);
 	if (rc)
-		goto exit;
+		return rc;
 
-	fc->mode = fc_conf.mode;
-	fc->rx_pause = (fc_conf.mode == RTE_ETH_FC_FULL) ||
-			(fc_conf.mode == RTE_ETH_FC_RX_PAUSE);
-	fc->tx_pause = (fc_conf.mode == RTE_ETH_FC_FULL) ||
-			(fc_conf.mode == RTE_ETH_FC_TX_PAUSE);
-
-exit:
+	fc->mode = (fc_mode == ROC_NIX_FC_FULL) ? RTE_ETH_FC_FULL :
+						  RTE_ETH_FC_TX_PAUSE;
 	return rc;
 }