* [dpdk-dev] [PATCH 01/13] net/bnxt: check return values in bnxt_dev_init
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:53 ` Stephen Hemminger
2018-01-08 20:24 ` [dpdk-dev] [PATCH 02/13] net/bnxt: fix double increment of idx during Tx ring alloc Ajit Khaparde
` (12 subsequent siblings)
13 siblings, 1 reply; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
We are not checking for return values of functions like
bnxt_hwrm_queue_qportcfg and bnxt_hwrm_func_qcfg in bnxt_dev_init
thereby preventing a cleanup in case of a HWRM command failure.
This patch fixes that.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 6f8a6335b..29f494302 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3172,9 +3172,17 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
rc = bnxt_hwrm_ver_get(bp);
if (rc)
goto error_free;
- bnxt_hwrm_queue_qportcfg(bp);
+ rc = bnxt_hwrm_queue_qportcfg(bp);
+ if (rc) {
+ RTE_LOG(ERR, PMD, "hwrm queue qportcfg failed\n");
+ goto error_free;
+ }
- bnxt_hwrm_func_qcfg(bp);
+ rc = bnxt_hwrm_func_qcfg(bp);
+ if (rc) {
+ RTE_LOG(ERR, PMD, "hwrm func qcfg failed\n");
+ goto error_free;
+ }
/* Get the MAX capabilities for this function */
rc = bnxt_hwrm_func_qcaps(bp);
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 02/13] net/bnxt: fix double increment of idx during Tx ring alloc
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 01/13] net/bnxt: check return values in bnxt_dev_init Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 03/13] net/bnxt: parse checksum offload flags Ajit Khaparde
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
We are incrementing idx twice while allocating Tx rings.
Since this is passed to the firmware, it may cause unexpected behavior.
Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ring.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 0fa2f0c0d..e0ca0e7f3 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -362,9 +362,6 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
struct bnxt_ring *ring = txr->tx_ring_struct;
unsigned int idx = i + 1 + bp->rx_cp_nr_rings;
- /* Account for AGG Rings. AGG ring cnt = Rx Cmpl ring cnt */
- idx += bp->rx_cp_nr_rings;
-
/* Tx cmpl */
rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 03/13] net/bnxt: parse checksum offload flags
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 01/13] net/bnxt: check return values in bnxt_dev_init Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 02/13] net/bnxt: fix double increment of idx during Tx ring alloc Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 04/13] net/bnxt: fix grp_info usage Ajit Khaparde
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
Parse the Tx checksum offload flags and set the proper bits
in the Tx descriptor.
Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_txr.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 8ca4bbd80..4a152aa86 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -217,23 +217,28 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
tx_pkt->outer_l3_len;
txbd1->mss = tx_pkt->tso_segsz;
- } else if (tx_pkt->ol_flags & PKT_TX_OIP_IIP_TCP_UDP_CKSUM) {
+ } else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_TCP_UDP_CKSUM) ==
+ PKT_TX_OIP_IIP_TCP_UDP_CKSUM) {
/* Outer IP, Inner IP, Inner TCP/UDP CSO */
txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
txbd1->mss = 0;
- } else if (tx_pkt->ol_flags & PKT_TX_IIP_TCP_UDP_CKSUM) {
+ } else if ((tx_pkt->ol_flags & PKT_TX_IIP_TCP_UDP_CKSUM) ==
+ PKT_TX_IIP_TCP_UDP_CKSUM) {
/* (Inner) IP, (Inner) TCP/UDP CSO */
txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
txbd1->mss = 0;
- } else if (tx_pkt->ol_flags & PKT_TX_OIP_TCP_UDP_CKSUM) {
+ } else if ((tx_pkt->ol_flags & PKT_TX_OIP_TCP_UDP_CKSUM) ==
+ PKT_TX_OIP_TCP_UDP_CKSUM) {
/* Outer IP, (Inner) TCP/UDP CSO */
txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
txbd1->mss = 0;
- } else if (tx_pkt->ol_flags & PKT_TX_OIP_IIP_CKSUM) {
+ } else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_CKSUM) ==
+ PKT_TX_OIP_IIP_CKSUM) {
/* Outer IP, Inner IP CSO */
txbd1->lflags |= TX_BD_FLG_TIP_IP_CHKSUM;
txbd1->mss = 0;
- } else if (tx_pkt->ol_flags & PKT_TX_TCP_UDP_CKSUM) {
+ } else if ((tx_pkt->ol_flags & PKT_TX_TCP_UDP_CKSUM) ==
+ PKT_TX_TCP_UDP_CKSUM) {
/* TCP/UDP CSO */
txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
txbd1->mss = 0;
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 04/13] net/bnxt: fix grp_info usage
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (2 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 03/13] net/bnxt: parse checksum offload flags Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 05/13] net/bnxt: return proper error code Ajit Khaparde
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
Ring groups is a Rx only attribute. Make sure there are sufficient
ring groups available. Return an error if they are not available.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_cpr.c | 1 -
drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++--
drivers/net/bnxt/bnxt_hwrm.c | 14 ++++----------
drivers/net/bnxt/bnxt_ring.c | 4 +++-
drivers/net/bnxt/bnxt_ring.h | 2 +-
5 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 19c684caa..cde8adc3b 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -165,7 +165,6 @@ int bnxt_alloc_def_cp_ring(struct bnxt *bp)
goto err_out;
cpr->cp_doorbell = bp->pdev->mem_resource[2].addr;
B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
- bp->grp_info[0].cp_fw_ring_id = cp_ring->fw_ring_id;
if (BNXT_PF(bp))
rc = bnxt_hwrm_func_cfg_def_cp(bp);
else
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 29f494302..d0002824f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -393,7 +393,10 @@ static int bnxt_init_nic(struct bnxt *bp)
{
int rc;
- bnxt_init_ring_grps(bp);
+ rc = bnxt_init_ring_grps(bp);
+ if (rc)
+ return rc;
+
bnxt_init_vnics(bp);
bnxt_init_filters(bp);
@@ -3207,11 +3210,19 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
/* Copy the permanent MAC from the qcap response address now. */
memcpy(bp->mac_addr, bp->dflt_mac_addr, sizeof(bp->mac_addr));
memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN);
+
+ if (bp->max_ring_grps < bp->rx_cp_nr_rings) {
+ /* 1 ring is for default completion ring */
+ RTE_LOG(ERR, PMD, "Insufficient resource: Ring Group\n");
+ rc = -ENOSPC;
+ goto error_free;
+ }
+
bp->grp_info = rte_zmalloc("bnxt_grp_info",
sizeof(*bp->grp_info) * bp->max_ring_grps, 0);
if (!bp->grp_info) {
RTE_LOG(ERR, PMD,
- "Failed to alloc %zu bytes needed to store group info table\n",
+ "Failed to alloc %zu bytes to store group info table\n",
sizeof(*bp->grp_info) * bp->max_ring_grps);
rc = -ENOMEM;
goto error_free;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 2f1d88f2c..68e211395 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1138,7 +1138,6 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
cpr->hw_stats_ctx_id = rte_le_to_cpu_16(resp->stat_ctx_id);
HWRM_UNLOCK();
- bp->grp_info[idx].fw_stats_ctx = cpr->hw_stats_ctx_id;
return rc;
}
@@ -1661,19 +1660,15 @@ int bnxt_free_all_hwrm_stat_ctxs(struct bnxt *bp)
for (i = 0; i < bp->rx_cp_nr_rings + bp->tx_cp_nr_rings; i++) {
- if (i >= bp->rx_cp_nr_rings)
+ if (i >= bp->rx_cp_nr_rings) {
cpr = bp->tx_queues[i - bp->rx_cp_nr_rings]->cp_ring;
- else
+ } else {
cpr = bp->rx_queues[i]->cp_ring;
+ bp->grp_info[i].fw_stats_ctx = -1;
+ }
if (cpr->hw_stats_ctx_id != HWRM_NA_SIGNATURE) {
rc = bnxt_hwrm_stat_ctx_free(bp, cpr, i);
cpr->hw_stats_ctx_id = HWRM_NA_SIGNATURE;
- /*
- * TODO. Need a better way to reset grp_info.stats_ctx
- * for Rx rings only. stats_ctx is not saved for Tx
- * in grp_info.
- */
- bp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id;
if (rc)
return rc;
}
@@ -1733,7 +1728,6 @@ static void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
bnxt_hwrm_ring_free(bp, cp_ring,
HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL);
cp_ring->fw_ring_id = INVALID_HW_RING_ID;
- bp->grp_info[idx].cp_fw_ring_id = INVALID_HW_RING_ID;
memset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size *
sizeof(*cpr->cp_desc_ring));
cpr->cp_raw_cons = 0;
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index e0ca0e7f3..59d1035fd 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -63,13 +63,15 @@ void bnxt_free_ring(struct bnxt_ring *ring)
* Ring groups
*/
-void bnxt_init_ring_grps(struct bnxt *bp)
+int bnxt_init_ring_grps(struct bnxt *bp)
{
unsigned int i;
for (i = 0; i < bp->max_ring_grps; i++)
memset(&bp->grp_info[i], (uint8_t)HWRM_NA_SIGNATURE,
sizeof(struct bnxt_ring_grp_info));
+
+ return 0;
}
/*
diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h
index 164f482e3..a88ab55f4 100644
--- a/drivers/net/bnxt/bnxt_ring.h
+++ b/drivers/net/bnxt/bnxt_ring.h
@@ -94,7 +94,7 @@ struct bnxt_tx_ring_info;
struct bnxt_rx_ring_info;
struct bnxt_cp_ring_info;
void bnxt_free_ring(struct bnxt_ring *ring);
-void bnxt_init_ring_grps(struct bnxt *bp);
+int bnxt_init_ring_grps(struct bnxt *bp);
int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
struct bnxt_tx_ring_info *tx_ring_info,
struct bnxt_rx_ring_info *rx_ring_info,
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 05/13] net/bnxt: return proper error code
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (3 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 04/13] net/bnxt: fix grp_info usage Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 06/13] net/bnxt: add check for multi host PF per port Ajit Khaparde
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
If the FW fails bnxt_hwrm_func_reset() with an error status,
instead of returning -1, return a more standard value of -EIO.
Similarly sometimes the status returned by certain FW commands
may not be generic. Return a more standard value of -EIO in
that case as well.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d0002824f..ce7030d1a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -378,6 +378,10 @@ static int bnxt_init_chip(struct bnxt *bp)
err_out:
bnxt_free_all_hwrm_resources(bp);
+ /* Some of the error status returned by FW may not be from errno.h */
+ if (rc > 0)
+ rc = -EIO;
+
return rc;
}
@@ -3268,7 +3272,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
rc = bnxt_hwrm_func_reset(bp);
if (rc) {
RTE_LOG(ERR, PMD, "hwrm chip reset failure rc: %x\n", rc);
- rc = -1;
+ rc = -EIO;
goto error_free;
}
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 06/13] net/bnxt: add check for multi host PF per port.
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (4 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 05/13] net/bnxt: return proper error code Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 07/13] net/bnxt: check if initialization is done before accessing stats Ajit Khaparde
` (7 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
Certain SKUs of NIC can support features like NPAR, Multi Host PFs per
port. We need to check for such features in order to restrict certain
HWRM commands from being sent to the FW.
For the single PF per port model, allow commands like hwrm_port_phy_cfg
from the PF driver. In NPAR and MH environments with multiple PFs per port,
we should not allow HWRM commands like hwrm_port_phy_cfg to be sent to
the FW.
This patch takes care of that.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 6 ++++--
drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
drivers/net/bnxt/bnxt_hwrm.c | 6 +++++-
drivers/net/bnxt/bnxt_stats.c | 4 ++--
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e46759f25..345750be7 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -244,10 +244,12 @@ struct bnxt {
#define BNXT_FLAG_SHORT_CMD (1 << 4)
#define BNXT_FLAG_UPDATE_HASH (1 << 5)
#define BNXT_FLAG_PTP_SUPPORTED (1 << 6)
+#define BNXT_FLAG_MULTI_HOST (1 << 7)
#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
#define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF)
-#define BNXT_NPAR_ENABLED(bp) ((bp)->port_partition_type)
-#define BNXT_NPAR_PF(bp) (BNXT_PF(bp) && BNXT_NPAR_ENABLED(bp))
+#define BNXT_NPAR(bp) ((bp)->port_partition_type)
+#define BNXT_MH(bp) ((bp)->flags & BNXT_FLAG_MULTI_HOST)
+#define BNXT_SINGLE_PF(bp) (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp))
unsigned int rx_nr_rings;
unsigned int rx_cp_nr_rings;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ce7030d1a..475faac2a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1039,7 +1039,7 @@ static int bnxt_flow_ctrl_set_op(struct rte_eth_dev *dev,
{
struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
- if (BNXT_NPAR_PF(bp) || BNXT_VF(bp)) {
+ if (!BNXT_SINGLE_PF(bp) || BNXT_VF(bp)) {
RTE_LOG(ERR, PMD, "Flow Control Settings cannot be modified\n");
return -ENOTSUP;
}
@@ -1570,7 +1570,7 @@ bnxt_vlan_pvid_set_op(struct rte_eth_dev *dev, uint16_t pvid, int on)
uint16_t vlan = bp->vlan;
int rc;
- if (BNXT_NPAR_PF(bp) || BNXT_VF(bp)) {
+ if (!BNXT_SINGLE_PF(bp) || BNXT_VF(bp)) {
RTE_LOG(ERR, PMD,
"PVID cannot be modified for this function\n");
return -ENOTSUP;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 68e211395..0c8f6443c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2193,7 +2193,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
struct bnxt_link_info link_req;
uint16_t speed, autoneg;
- if (BNXT_NPAR_PF(bp) || BNXT_VF(bp))
+ if (!BNXT_SINGLE_PF(bp) || BNXT_VF(bp))
return 0;
rc = bnxt_valid_link_speed(dev_conf->link_speeds,
@@ -2249,6 +2249,7 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
{
struct hwrm_func_qcfg_input req = {0};
struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+ uint16_t flags;
int rc = 0;
HWRM_PREP(req, FUNC_QCFG);
@@ -2260,6 +2261,9 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
/* Hard Coded.. 0xfff VLAN ID mask */
bp->vlan = rte_le_to_cpu_16(resp->vlan) & 0xfff;
+ flags = rte_le_to_cpu_16(resp->flags);
+ if (BNXT_PF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST))
+ bp->flags |= BNXT_FLAG_MULTI_HOST;
switch (resp->port_partition_type) {
case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0:
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index fe83d370a..2606e93c1 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -358,12 +358,12 @@ void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
- if (bp->flags & BNXT_FLAG_PORT_STATS && !BNXT_NPAR_PF(bp))
+ if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp))
bnxt_hwrm_port_clr_stats(bp);
if (BNXT_VF(bp))
RTE_LOG(ERR, PMD, "Operation not supported on a VF device\n");
- if (BNXT_NPAR_PF(bp))
+ if (!BNXT_SINGLE_PF(bp))
RTE_LOG(ERR, PMD, "Operation not supported on a MF device\n");
if (!(bp->flags & BNXT_FLAG_PORT_STATS))
RTE_LOG(ERR, PMD, "Operation not supported\n");
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 07/13] net/bnxt: check if initialization is done before accessing stats
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (5 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 06/13] net/bnxt: add check for multi host PF per port Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 08/13] net/bnxt: fix check for ether_type Ajit Khaparde
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
Maintain state of PMD initialization and check it before checking stats.
In certain cases, we might end up accessing stats before the required
HWRM commands are processed by FW.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_ethdev.c | 2 ++
drivers/net/bnxt/bnxt_stats.c | 9 +++++++++
3 files changed, 12 insertions(+)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 345750be7..7e3d7aefd 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -245,6 +245,7 @@ struct bnxt {
#define BNXT_FLAG_UPDATE_HASH (1 << 5)
#define BNXT_FLAG_PTP_SUPPORTED (1 << 6)
#define BNXT_FLAG_MULTI_HOST (1 << 7)
+#define BNXT_FLAG_INIT_DONE (1 << 31)
#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
#define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF)
#define BNXT_NPAR(bp) ((bp)->port_partition_type)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 475faac2a..c2d158dea 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -590,6 +590,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
if (rc)
goto error;
+ bp->flags |= BNXT_FLAG_INIT_DONE;
return 0;
error:
@@ -635,6 +636,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
}
bnxt_set_hwrm_link_config(bp, false);
bnxt_hwrm_port_clr_stats(bp);
+ bp->flags &= ~BNXT_FLAG_INIT_DONE;
bnxt_shutdown_nic(bp);
bp->dev_stopped = 1;
}
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 2606e93c1..470c6438d 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -236,6 +236,10 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
struct bnxt *bp = eth_dev->data->dev_private;
memset(bnxt_stats, 0, sizeof(*bnxt_stats));
+ if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
+ RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+ return 0;
+ }
for (i = 0; i < bp->rx_cp_nr_rings; i++) {
struct bnxt_rx_queue *rxq = bp->rx_queues[i];
@@ -267,6 +271,11 @@ void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+ if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
+ RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+ return;
+ }
+
bnxt_clear_all_hwrm_stat_ctxs(bp);
rte_atomic64_clear(&bp->rx_mbuf_alloc_fail);
}
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 08/13] net/bnxt: fix check for ether_type
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (6 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 07/13] net/bnxt: check if initialization is done before accessing stats Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 09/13] net/bnxt: remove unnecessary addition of a temporary filter Ajit Khaparde
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
As per documentation, While supporting ethertype_filters matching
ether_types 0x0800 (IPv4) and 0x86DD (IPv6) is invalid.
But we were wrongly doing that. This patch fixes it.
Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c2d158dea..049d98b1d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1732,9 +1732,9 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp,
int match = 0;
*ret = 0;
- if (efilter->ether_type != ETHER_TYPE_IPv4 &&
- efilter->ether_type != ETHER_TYPE_IPv6) {
- RTE_LOG(ERR, PMD, "unsupported ether_type(0x%04x) in"
+ if (efilter->ether_type == ETHER_TYPE_IPv4 ||
+ efilter->ether_type == ETHER_TYPE_IPv6) {
+ RTE_LOG(ERR, PMD, "invalid ether_type(0x%04x) in"
" ethertype filter.", efilter->ether_type);
*ret = -EINVAL;
goto exit;
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 09/13] net/bnxt: remove unnecessary addition of a temporary filter
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (7 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 08/13] net/bnxt: fix check for ether_type Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 10/13] net/bnxt: fix duplicate filter pattern creation error Ajit Khaparde
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Somnath Kotur
filter1 which is used to just get the l2 filter FW id and not used
later was unecessarily being inserted into a list and was not being
freed after it's use was done.
Fix it by not doing the list insertion and releasing it back to the free
filter pool.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_filter.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index 65d30fb38..2c9b7c78d 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -806,7 +806,6 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf,
bnxt_free_filter(bp, filter1);
return NULL;
}
- STAILQ_INSERT_TAIL(&vnic->filter, filter1, next);
return filter1;
}
@@ -957,7 +956,11 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
goto ret;
}
-//done:
+ if (filter1) {
+ bnxt_free_filter(bp, filter1);
+ filter1->fw_l2_filter_id = -1;
+ }
+
act = nxt_non_void_action(++act);
if (act->type != RTE_FLOW_ACTION_TYPE_END) {
rte_flow_error_set(error, EINVAL,
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 10/13] net/bnxt: fix duplicate filter pattern creation error
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (8 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 09/13] net/bnxt: remove unnecessary addition of a temporary filter Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 11/13] net/bnxt: fix bug with duplicate pattern for 5tuple filter Ajit Khaparde
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Somnath Kotur
From: Somnath Kotur <somnath.kotur@broadcom.com>
If the attribute/pattern for a flow is the same, with only the 'action'
i.e the destination queue index changing, allow it by cleaning up
the older ntuple filter and updating the existing flow with
the new filter rule having the new destination queue ID.
Also, clear the L2 filter during flow_destroy after destroying
the ntuple filter, otherwise the flow record is not completely purged
from the HW.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_filter.c | 42 +++++++++++++++++++++++++++++++++++++-----
drivers/net/bnxt/bnxt_hwrm.c | 1 -
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index 2c9b7c78d..22cfbd372 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -1045,8 +1045,23 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf)
!memcmp(mf->dst_ipaddr, nf->dst_ipaddr,
sizeof(nf->dst_ipaddr)) &&
!memcmp(mf->dst_ipaddr_mask, nf->dst_ipaddr_mask,
- sizeof(nf->dst_ipaddr_mask)))
- return -EEXIST;
+ sizeof(nf->dst_ipaddr_mask))) {
+ if (mf->dst_id == nf->dst_id)
+ return -EEXIST;
+ /* Same Flow, Different queue
+ * Clear the old ntuple filter
+ */
+ if (nf->filter_type == HWRM_CFA_EM_FILTER)
+ bnxt_hwrm_clear_em_filter(bp, mf);
+ if (nf->filter_type == HWRM_CFA_NTUPLE_FILTER)
+ bnxt_hwrm_clear_ntuple_filter(bp, mf);
+ /* Free the old filter, update flow
+ * with new filter
+ */
+ bnxt_free_filter(bp, mf);
+ flow->filter = nf;
+ return -EXDEV;
+ }
}
}
return 0;
@@ -1062,6 +1077,7 @@ bnxt_flow_create(struct rte_eth_dev *dev,
struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
struct bnxt_filter_info *filter;
struct bnxt_vnic_info *vnic = NULL;
+ bool update_flow = false;
struct rte_flow *flow;
unsigned int i;
int ret = 0;
@@ -1092,9 +1108,17 @@ bnxt_flow_create(struct rte_eth_dev *dev,
goto free_filter;
ret = bnxt_match_filter(bp, filter);
- if (ret != 0) {
+ if (ret == -EEXIST) {
RTE_LOG(DEBUG, PMD, "Flow already exists.\n");
+ /* Clear the filter that was created as part of
+ * validate_and_parse_flow() above
+ */
+ bnxt_hwrm_clear_l2_filter(bp, filter);
goto free_filter;
+ } else if (ret == -EXDEV) {
+ RTE_LOG(DEBUG, PMD, "Flow with same pattern exists");
+ RTE_LOG(DEBUG, PMD, "Updating with different destination\n");
+ update_flow = true;
}
if (filter->filter_type == HWRM_CFA_EM_FILTER) {
@@ -1117,22 +1141,29 @@ bnxt_flow_create(struct rte_eth_dev *dev,
if (!ret) {
flow->filter = filter;
flow->vnic = vnic;
+ if (update_flow) {
+ ret = -EXDEV;
+ goto free_flow;
+ }
RTE_LOG(ERR, PMD, "Successfully created flow.\n");
STAILQ_INSERT_TAIL(&vnic->flow_list, flow, next);
return flow;
}
free_filter:
- filter->fw_l2_filter_id = -1;
bnxt_free_filter(bp, filter);
free_flow:
if (ret == -EEXIST)
rte_flow_error_set(error, ret,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
"Matching Flow exists.");
+ else if (ret == -EXDEV)
+ rte_flow_error_set(error, ret,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Flow with pattern exists, updating destination queue");
else
rte_flow_error_set(error, -ret,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
- "Failed to create flow.");
+ "Failed to create flow.");
rte_free(flow);
flow = NULL;
return flow;
@@ -1156,6 +1187,7 @@ bnxt_flow_destroy(struct rte_eth_dev *dev,
if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
ret = bnxt_hwrm_clear_ntuple_filter(bp, filter);
+ bnxt_hwrm_clear_l2_filter(bp, filter);
if (!ret) {
STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next);
rte_free(flow);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 0c8f6443c..06737b1e1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3665,7 +3665,6 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
HWRM_UNLOCK();
filter->fw_ntuple_filter_id = -1;
- filter->fw_l2_filter_id = -1;
return 0;
}
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 11/13] net/bnxt: fix bug with duplicate pattern for 5tuple filter
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (9 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 10/13] net/bnxt: fix duplicate filter pattern creation error Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 12/13] bnxt/bnxt: free the aggregration ring while freeing all the HWRM rings Ajit Khaparde
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Somnath Kotur
From: Somnath Kotur <somnath.kotur@broadcom.com>
When user re-issues same 5 tuple filter pattern cmd with different
destination queue, it would flag it as an existing match.
However, when deletion on this filter was attempted, it would crash
as the 'vnic' from which the filter was being removed from would be
different. Fix by updating the filter in the scenario where there
is a pattern match and only the destination queue varies.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 049d98b1d..41b23cc4f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1962,7 +1962,8 @@ parse_ntuple_filter(struct bnxt *bp,
static struct bnxt_filter_info*
bnxt_match_ntuple_filter(struct bnxt *bp,
- struct bnxt_filter_info *bfilter)
+ struct bnxt_filter_info *bfilter,
+ struct bnxt_vnic_info **mvnic)
{
struct bnxt_filter_info *mfilter = NULL;
int i;
@@ -1981,8 +1982,11 @@ bnxt_match_ntuple_filter(struct bnxt *bp,
bfilter->dst_port == mfilter->dst_port &&
bfilter->dst_port_mask == mfilter->dst_port_mask &&
bfilter->flags == mfilter->flags &&
- bfilter->enables == mfilter->enables)
+ bfilter->enables == mfilter->enables) {
+ if (mvnic)
+ *mvnic = vnic;
return mfilter;
+ }
}
}
return NULL;
@@ -1994,7 +1998,7 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
enum rte_filter_op filter_op)
{
struct bnxt_filter_info *bfilter, *mfilter, *filter1;
- struct bnxt_vnic_info *vnic, *vnic0;
+ struct bnxt_vnic_info *vnic, *vnic0, *mvnic;
int ret;
if (nfilter->flags != RTE_5TUPLE_FLAGS) {
@@ -2032,12 +2036,22 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
bfilter->ethertype = 0x800;
bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE;
- mfilter = bnxt_match_ntuple_filter(bp, bfilter);
+ mfilter = bnxt_match_ntuple_filter(bp, bfilter, &mvnic);
- if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD) {
- RTE_LOG(ERR, PMD, "filter exists.");
+ if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD &&
+ bfilter->dst_id == mfilter->dst_id) {
+ RTE_LOG(ERR, PMD, "filter exists.\n");
ret = -EEXIST;
goto free_filter;
+ } else if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD &&
+ bfilter->dst_id != mfilter->dst_id) {
+ mfilter->dst_id = vnic->fw_vnic_id;
+ ret = bnxt_hwrm_set_ntuple_filter(bp, mfilter->dst_id, mfilter);
+ STAILQ_REMOVE(&mvnic->filter, mfilter, bnxt_filter_info, next);
+ STAILQ_INSERT_TAIL(&vnic->filter, mfilter, next);
+ RTE_LOG(ERR, PMD, "filter with matching pattern exists.\n");
+ RTE_LOG(ERR, PMD, " Updated it to the new destination queue\n");
+ goto free_filter;
}
if (mfilter == NULL && filter_op == RTE_ETH_FILTER_DELETE) {
RTE_LOG(ERR, PMD, "filter doesn't exist.");
@@ -2059,11 +2073,11 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
}
ret = bnxt_hwrm_clear_ntuple_filter(bp, mfilter);
- STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info,
- next);
+ STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info, next);
bnxt_free_filter(bp, mfilter);
- bfilter->fw_l2_filter_id = -1;
+ mfilter->fw_l2_filter_id = -1;
bnxt_free_filter(bp, bfilter);
+ bfilter->fw_l2_filter_id = -1;
}
return 0;
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 12/13] bnxt/bnxt: free the aggregration ring while freeing all the HWRM rings
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (10 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 11/13] net/bnxt: fix bug with duplicate pattern for 5tuple filter Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 13/13] net/bnxt: check on-chip resources Ajit Khaparde
2018-01-10 20:32 ` [dpdk-dev] [PATCH 00/13] bnxt atchset Ferruh Yigit
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Somnath Kotur
From: Somnath Kotur <somnath.kotur@broadcom.com>
bnxt_free_all_hwrm_rings() was freeing all the Rx Rings including
zero-ing out the memory for the Aggregration rings, but was not issuing
the FW cmd to destroy the AGG ring(s) from HW. This would manifest in
problems when port stop/port start would be issued as there would be a
HW ring leak everytime port stop was issued.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 06737b1e1..d88061c9f 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1783,10 +1783,17 @@ int bnxt_free_all_hwrm_rings(struct bnxt *bp)
rxr->rx_ring_struct->ring_size *
sizeof(*rxr->rx_buf_ring));
rxr->rx_prod = 0;
+ }
+ ring = rxr->ag_ring_struct;
+ if (ring->fw_ring_id != INVALID_HW_RING_ID) {
+ bnxt_hwrm_ring_free(bp, ring,
+ HWRM_RING_FREE_INPUT_RING_TYPE_RX);
+ ring->fw_ring_id = INVALID_HW_RING_ID;
memset(rxr->ag_buf_ring, 0,
- rxr->ag_ring_struct->ring_size *
- sizeof(*rxr->ag_buf_ring));
+ rxr->ag_ring_struct->ring_size *
+ sizeof(*rxr->ag_buf_ring));
rxr->ag_prod = 0;
+ bp->grp_info[i].ag_fw_ring_id = INVALID_HW_RING_ID;
}
if (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID) {
bnxt_free_cp_ring(bp, cpr, idx);
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [dpdk-dev] [PATCH 13/13] net/bnxt: check on-chip resources
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (11 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 12/13] bnxt/bnxt: free the aggregration ring while freeing all the HWRM rings Ajit Khaparde
@ 2018-01-08 20:24 ` Ajit Khaparde
2018-01-10 20:32 ` [dpdk-dev] [PATCH 00/13] bnxt atchset Ferruh Yigit
13 siblings, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2018-01-08 20:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
Check for availability of on-chip resources - like Queue count,
number stat context, number of ring groups before inheriting and
initializing as per application requirements.
Also check before creating a Tx or Rx queue make sure there are
enough resources to complete the request.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 20 ++++++++++++++++++++
drivers/net/bnxt/bnxt_rxq.c | 7 +++++++
drivers/net/bnxt/bnxt_txq.c | 7 +++++++
3 files changed, 34 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 41b23cc4f..87a07bab9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -530,6 +530,26 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
bp->tx_queues = (void *)eth_dev->data->tx_queues;
/* Inherit new configurations */
+ if (eth_dev->data->nb_rx_queues > bp->rx_nr_rings ||
+ eth_dev->data->nb_tx_queues > bp->tx_nr_rings ||
+ eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues + 1 >
+ bp->max_cp_rings ||
+ eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
+ bp->max_stat_ctx ||
+ (uint32_t)(eth_dev->data->nb_rx_queues + 1) > bp->max_ring_grps) {
+ RTE_LOG(ERR, PMD,
+ "Insufficient resources to support requested config\n");
+ RTE_LOG(ERR, PMD,
+ "Num Queues Requested: Tx %d, Rx %d\n",
+ eth_dev->data->nb_tx_queues,
+ eth_dev->data->nb_rx_queues);
+ RTE_LOG(ERR, PMD,
+ "Res available: TxQ %d, RxQ %d, CQ %d Stat %d, Grp %d\n",
+ bp->tx_nr_rings, bp->rx_nr_rings, bp->max_cp_rings,
+ bp->max_stat_ctx, bp->max_ring_grps);
+ return -ENOSPC;
+ }
+
bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
bp->tx_nr_rings = eth_dev->data->nb_tx_queues;
bp->rx_cp_nr_rings = bp->rx_nr_rings;
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index c4da474e9..f7fbb2856 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -311,6 +311,13 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
struct bnxt_rx_queue *rxq;
int rc = 0;
+ if (queue_idx >= bp->max_rx_rings) {
+ RTE_LOG(ERR, PMD,
+ "Cannot create Rx ring %d. Only %d rings available\n",
+ queue_idx, bp->max_rx_rings);
+ return -ENOSPC;
+ }
+
if (!nb_desc || nb_desc > MAX_RX_DESC_CNT) {
RTE_LOG(ERR, PMD, "nb_desc %d is invalid\n", nb_desc);
rc = -EINVAL;
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 99dddddfc..25c33f5e4 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -108,6 +108,13 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
struct bnxt_tx_queue *txq;
int rc = 0;
+ if (queue_idx >= bp->max_tx_rings) {
+ RTE_LOG(ERR, PMD,
+ "Cannot create Tx ring %d. Only %d rings available\n",
+ queue_idx, bp->max_tx_rings);
+ return -ENOSPC;
+ }
+
if (!nb_desc || nb_desc > MAX_TX_DESC_CNT) {
RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc);
rc = -EINVAL;
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [dpdk-dev] [PATCH 00/13] bnxt atchset
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
` (12 preceding siblings ...)
2018-01-08 20:24 ` [dpdk-dev] [PATCH 13/13] net/bnxt: check on-chip resources Ajit Khaparde
@ 2018-01-10 20:32 ` Ferruh Yigit
13 siblings, 0 replies; 16+ messages in thread
From: Ferruh Yigit @ 2018-01-10 20:32 UTC (permalink / raw)
To: Ajit Khaparde, dev
On 1/8/2018 8:24 PM, Ajit Khaparde wrote:
> Please apply these patches.
>
> Ajit Khaparde (10):
> net/bnxt: check return values in bnxt_dev_init
> net/bnxt: fix double increment of idx during Tx ring alloc
> net/bnxt: parse checksum offload flags
> net/bnxt: fix grp_info usage
> net/bnxt: return proper error code
> net/bnxt: add check for multi host PF per port.
> net/bnxt: check if initialization is done before accessing stats
> net/bnxt: fix check for ether_type
> net/bnxt: check on-chip resources
>
> Somnath Kotur (3):
> net/bnxt: fix duplicate filter pattern creation error
> net/bnxt: remove unnecessary addition of a temporary filter
> net/bnxt: fix bug with duplicate pattern for 5tuple filter
> bnxt/bnxt: free the aggregration ring while freeing all the HWRM rings
Series applied to dpdk-next-net/master, thanks.
Fixes lines are missing for some patches [1], can you please provide them, I can
update commits when received.
[1]
$ ./devtools/check-git-log.sh -13
Missing 'Fixes' tag:
net/bnxt: fix group info usage
net/bnxt: fix duplicate filter pattern creation error
net/bnxt: fix bug with duplicate pattern for 5tuple filter
^ permalink raw reply [flat|nested] 16+ messages in thread