[03/21] common/cnxk: skip flow ctrl set on non-existent meta aura

Message ID 20230411091144.1087887-3-ndabilpuram@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers
Series [01/21] common/cnxk: allocate dynamic BPIDs |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Nithin Dabilpuram April 11, 2023, 9:11 a.m. UTC
  Skip setting flow control on local meta aura if it is not yet
created. Also in flow control mode set, do get to confirm
if it is in same state to avoid a set and unnecessary mbox
failures.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 .mailmap                           | 1 +
 drivers/common/cnxk/roc_dev.c      | 1 +
 drivers/common/cnxk/roc_nix_fc.c   | 4 ++--
 drivers/common/cnxk/roc_nix_inl.c  | 3 +++
 drivers/net/cnxk/cnxk_ethdev.c     | 5 +++--
 drivers/net/cnxk/cnxk_ethdev_ops.c | 4 ++++
 6 files changed, 14 insertions(+), 4 deletions(-)
  

Patch

diff --git a/.mailmap b/.mailmap
index 0859104404..be2eddf1b3 100644
--- a/.mailmap
+++ b/.mailmap
@@ -988,6 +988,7 @@  Nipun Gupta <nipun.gupta@nxp.com>
 Nir Efrati <nir.efrati@intel.com>
 Nirmoy Das <ndas@suse.de>
 Nithin Dabilpuram <ndabilpuram@marvell.com> <nithin.dabilpuram@caviumnetworks.com>
+Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
 Nitin Saxena <nitin.saxena@caviumnetworks.com>
 Nitzan Weller <nitzanwe@mellanox.com>
 Noa Ezra <noae@mellanox.com>
diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index 2388237186..5e4e564ebe 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -421,6 +421,7 @@  process_msgs(struct dev *dev, struct mbox *mbox)
 			dev->pf_func = msg->pcifunc;
 			break;
 		case MBOX_MSG_CGX_PRIO_FLOW_CTRL_CFG:
+		case MBOX_MSG_CGX_CFG_PAUSE_FRM:
 			/* 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.
diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c
index 8b7659fb9a..3618d2920b 100644
--- a/drivers/common/cnxk/roc_nix_fc.c
+++ b/drivers/common/cnxk/roc_nix_fc.c
@@ -311,7 +311,7 @@  nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
 				      fc_cfg->rq_cfg.enable, true,
 				      fc_cfg->rq_cfg.tc);
 
-		if (roc_nix->local_meta_aura_ena)
+		if (roc_nix->local_meta_aura_ena && roc_nix->meta_aura_handle)
 			roc_nix_fc_npa_bp_cfg(roc_nix, roc_nix->meta_aura_handle,
 					      fc_cfg->rq_cfg.enable, true, fc_cfg->rq_cfg.tc);
 	}
@@ -409,6 +409,7 @@  roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode)
 		goto exit;
 	}
 
+	/* Set new config */
 	req = mbox_alloc_msg_cgx_cfg_pause_frm(mbox);
 	if (req == NULL)
 		goto exit;
@@ -422,7 +423,6 @@  roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode)
 
 	nix->rx_pause = rx_pause;
 	nix->tx_pause = tx_pause;
-
 exit:
 	mbox_put(mbox);
 	return rc;
diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c
index 9485bba099..b16756d642 100644
--- a/drivers/common/cnxk/roc_nix_inl.c
+++ b/drivers/common/cnxk/roc_nix_inl.c
@@ -131,6 +131,9 @@  nix_inl_meta_aura_create(struct idev_cfg *idev, struct roc_nix *roc_nix, uint16_
 	}
 	roc_nix->meta_mempool = mp;
 
+	plt_nix_dbg("Created meta aura %p(%s)for port %d", (void *)*meta_aura, mp_name,
+		    roc_nix->port_id);
+
 	if (!roc_nix->local_meta_aura_ena) {
 		inl_cfg->buf_sz = buf_sz;
 		inl_cfg->nb_bufs = nb_bufs;
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 1cae3084e1..3bccc34d79 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -378,8 +378,9 @@  nix_init_flow_ctrl_config(struct rte_eth_dev *eth_dev)
 	if (rc)
 		return rc;
 
-	fc->mode = (fc_mode == ROC_NIX_FC_FULL) ? RTE_ETH_FC_FULL :
-						  RTE_ETH_FC_TX_PAUSE;
+	fc->mode = (fc_mode == ROC_NIX_FC_FULL) ? RTE_ETH_FC_FULL : RTE_ETH_FC_TX_PAUSE;
+	fc->rx_pause = (fc->mode == RTE_ETH_FC_FULL) || (fc->mode == RTE_ETH_FC_RX_PAUSE);
+	fc->tx_pause = (fc->mode == RTE_ETH_FC_FULL) || (fc->mode == RTE_ETH_FC_TX_PAUSE);
 	return rc;
 }
 
diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
index 068b7c3502..bce6d59bbc 100644
--- a/drivers/net/cnxk/cnxk_ethdev_ops.c
+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
@@ -342,6 +342,10 @@  cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 			return rc;
 	}
 
+	/* Skip mode set if it is we are in same state */
+	if (fc->rx_pause == rx_pause && fc->tx_pause == tx_pause)
+		return 0;
+
 	rc = roc_nix_fc_mode_set(nix, mode_map[fc_conf->mode]);
 	if (rc)
 		return rc;