Patchwork [dpdk-dev] net/cxgbe: fix control queue mbuf pool naming convention

login
register
mail settings
Submitter Rahul Lakkireddy
Date Dec. 6, 2018, 10:13 a.m.
Message ID <1544091200-16039-1-git-send-email-rahul.lakkireddy@chelsio.com>
Download mbox | patch
Permalink /patch/673911/
State New
Headers show

Comments

Rahul Lakkireddy - Dec. 6, 2018, 10:13 a.m.
When multiple Chelsio adapters are present, the current naming
convention of using underlying physical port number of the adapter
creates conflicts when allocating control queue mbuf pool for
multiple adapters and hence results in allocation failure. Fix by
using port_id from rte_eth_dev_data, instead of physical port number.

Fixes: 3a3aaabc7c77 ("net/cxgbe: add control queue to communicate filter requests")
Cc: stable@dpdk.org

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/cxgbe/cxgbe_main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
Ferruh Yigit - Dec. 12, 2018, 10:42 a.m.
On 12/6/2018 10:13 AM, Rahul Lakkireddy wrote:
> When multiple Chelsio adapters are present, the current naming
> convention of using underlying physical port number of the adapter
> creates conflicts when allocating control queue mbuf pool for
> multiple adapters and hence results in allocation failure. Fix by
> using port_id from rte_eth_dev_data, instead of physical port number.
> 
> Fixes: 3a3aaabc7c77 ("net/cxgbe: add control queue to communicate filter requests")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>

Applied to dpdk-next-net/master, thanks.

Patch

diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ec080e5d3..0368db509 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -122,6 +122,7 @@  int setup_sge_ctrl_txq(struct adapter *adapter)
 	int err = 0, i = 0;
 
 	for_each_port(adapter, i) {
+		struct port_info *pi = adap2pinfo(adapter, i);
 		char name[RTE_ETH_NAME_MAX_LEN];
 		struct sge_ctrl_txq *q = &s->ctrlq[i];
 
@@ -135,16 +136,19 @@  int setup_sge_ctrl_txq(struct adapter *adapter)
 				err);
 			goto out;
 		}
-		snprintf(name, sizeof(name), "cxgbe_ctrl_pool_%d", i);
+		snprintf(name, sizeof(name), "%s_ctrl_pool_%d",
+			 pi->eth_dev->device->driver->name,
+			 pi->eth_dev->data->port_id);
 		q->mb_pool = rte_pktmbuf_pool_create(name, s->ctrlq[i].q.size,
 						     RTE_CACHE_LINE_SIZE,
 						     RTE_MBUF_PRIV_ALIGN,
 						     RTE_MBUF_DEFAULT_BUF_SIZE,
 						     SOCKET_ID_ANY);
 		if (!q->mb_pool) {
-			dev_err(adapter, "Can't create ctrl pool for port: %d",
-				i);
-			err = -ENOMEM;
+			err = -rte_errno;
+			dev_err(adapter,
+				"Can't create ctrl pool for port %d. Err: %d\n",
+				pi->eth_dev->data->port_id, err);
 			goto out;
 		}
 	}