* [dpdk-stable] [PATCH 18.11 01/19] net/bnxt: fix setting default MAC address
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
@ 2019-12-18 6:23 ` Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 02/19] net/bnxt: fix error checking of FW commands Somnath Kotur
` (18 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:23 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Driver was incorrectly programming the MAC with the already
configured one instead of the newly requested MAC by user.
Also, fix to restore the old mac address back to the default
vnic filter if the mac update operation fails.
Fixes: 68f589f2c728 ("net/bnxt: fix setting primary MAC address")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 30a9aa4..1da0b12 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1548,7 +1548,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)
if (filter->mac_index != 0)
continue;
- memcpy(filter->l2_addr, bp->mac_addr, ETHER_ADDR_LEN);
+ memcpy(filter->l2_addr, addr, ETHER_ADDR_LEN);
memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN);
filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX;
filter->enables |=
@@ -1556,8 +1556,10 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)
HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK;
rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter);
- if (rc)
+ if (rc) {
+ memcpy(filter->l2_addr, bp->mac_addr, ETHER_ADDR_LEN);
return rc;
+ }
memcpy(bp->mac_addr, addr, ETHER_ADDR_LEN);
PMD_DRV_LOG(DEBUG, "Set MAC addr\n");
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 02/19] net/bnxt: fix error checking of FW commands
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 01/19] net/bnxt: fix setting default MAC address Somnath Kotur
@ 2019-12-18 6:23 ` Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 03/19] net/bnxt: fix check of address mapping Somnath Kotur
` (17 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:23 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
HWRM_CHECK_RESULT() checks the return value of HWRM command
and returns in case the command fails.
Fixes: 49947a13ba9e ("net/bnxt: support Tx loopback, set VF MAC and queues drop")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 1f26fb4..791bf4b 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3533,16 +3533,8 @@ static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf,
return -ENOMEM;
}
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
- if (rc) {
- HWRM_UNLOCK();
- PMD_DRV_LOG(ERR, "hwrm_func_vf_vnic_query failed rc:%d\n", rc);
- return -1;
- } else if (resp->error_code) {
- rc = rte_le_to_cpu_16(resp->error_code);
- HWRM_UNLOCK();
- PMD_DRV_LOG(ERR, "hwrm_func_vf_vnic_query error %d\n", rc);
- return -1;
- }
+ HWRM_CHECK_RESULT();
+
rc = rte_le_to_cpu_32(resp->vnic_id_cnt);
HWRM_UNLOCK();
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 03/19] net/bnxt: fix check of address mapping
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 01/19] net/bnxt: fix setting default MAC address Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 02/19] net/bnxt: fix error checking of FW commands Somnath Kotur
@ 2019-12-18 6:23 ` Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 04/19] net/bnxt: fix stats errors handling Somnath Kotur
` (16 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:23 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
rte_mem_virt2iova() function returns RTE_BAD_IOVA on failure, not zero.
Fixed wrong checks in bnxt_ethdev.c.
Fixes: 62196f4e0941 ("mem: rename address mapping function to IOVA")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1da0b12..5dc17da 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3301,7 +3301,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
PMD_DRV_LOG(INFO,
"Memzone physical address same as virtual using rte_mem_virt2iova()\n");
mz_phys_addr = rte_mem_virt2iova(mz->addr);
- if (mz_phys_addr == 0) {
+ if (mz_phys_addr == RTE_BAD_IOVA) {
PMD_DRV_LOG(ERR,
"unable to map address to physical memory\n");
return -ENOMEM;
@@ -3340,7 +3340,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
PMD_DRV_LOG(WARNING,
"Using rte_mem_virt2iova()\n");
mz_phys_addr = rte_mem_virt2iova(mz->addr);
- if (mz_phys_addr == 0) {
+ if (mz_phys_addr == RTE_BAD_IOVA) {
PMD_DRV_LOG(ERR,
"unable to map address to physical memory\n");
return -ENOMEM;
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 04/19] net/bnxt: fix stats errors handling
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (2 preceding siblings ...)
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 03/19] net/bnxt: fix check of address mapping Somnath Kotur
@ 2019-12-18 6:23 ` Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 05/19] net/bnxt: move macro definitions to header file Somnath Kotur
` (15 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:23 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
This patch fixes few checks and few return values while getting
and clearing device statistics.
1. Fixed to return standard error code.
2. Clubbed few error checks
3. Removed an unnecessary return check
Fixes: bfb9c2260be2 ("net/bnxt: support xstats get/reset")
Fixes: 88920136688c ("net/bnxt: support xstats get by id")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_stats.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 252a0a6..497da0b 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -387,7 +387,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
memset(bnxt_stats, 0, sizeof(*bnxt_stats));
if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
- return -1;
+ return -EIO;
}
num_q_stats = RTE_MIN(bp->rx_cp_nr_rings,
@@ -418,8 +418,6 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
return rc;
}
rc = bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats);
- if (unlikely(rc))
- return rc;
return rc;
}
@@ -585,16 +583,20 @@ int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
+ int ret;
- if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp))
- bnxt_hwrm_port_clr_stats(bp);
-
- if (BNXT_VF(bp))
- PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n");
- if (!BNXT_SINGLE_PF(bp))
- PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n");
- if (!(bp->flags & BNXT_FLAG_PORT_STATS))
+ if (BNXT_VF(bp) || !BNXT_SINGLE_PF(bp) ||
+ !(bp->flags & BNXT_FLAG_PORT_STATS)) {
PMD_DRV_LOG(ERR, "Operation not supported\n");
+ return;
+ }
+
+ ret = bnxt_hwrm_port_clr_stats(bp);
+ if (ret != 0)
+ PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n",
+ strerror(-ret));
+
+ return;
}
int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
@@ -616,7 +618,7 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
for (i = 0; i < limit; i++) {
if (ids[i] >= stat_cnt) {
PMD_DRV_LOG(ERR, "id value isn't valid");
- return -1;
+ return -EINVAL;
}
values[i] = values_copy[ids[i]];
}
@@ -644,7 +646,7 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
for (i = 0; i < limit; i++) {
if (ids[i] >= stat_cnt) {
PMD_DRV_LOG(ERR, "id value isn't valid");
- return -1;
+ return -EINVAL;
}
strcpy(xstats_names[i].name,
xstats_names_copy[ids[i]].name);
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 05/19] net/bnxt: move macro definitions to header file
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (3 preceding siblings ...)
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 04/19] net/bnxt: fix stats errors handling Somnath Kotur
@ 2019-12-18 6:23 ` Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 06/19] net/bnxt: fix extended port counter statistics Somnath Kotur
` (14 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:23 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Move device and vendor ids macro definition from bnxt_ethdev.c
to bnxt.h.
There is no functionality impact.
Fixes: 882aa9c6e2e1 ("net/bnxt: move PCI device ids to the driver")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 45 +++++++++++++++++++++++++++++++++++++++++
drivers/net/bnxt/bnxt_ethdev.c | 46 +++---------------------------------------
2 files changed, 48 insertions(+), 43 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index eeced3a..77d5614 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -20,6 +20,51 @@
#include "bnxt_cpr.h"
+/* Vendor ID */
+#define PCI_VENDOR_ID_BROADCOM 0x14E4
+
+/* Device IDs */
+#define BROADCOM_DEV_ID_STRATUS_NIC_VF1 0x1606
+#define BROADCOM_DEV_ID_STRATUS_NIC_VF2 0x1609
+#define BROADCOM_DEV_ID_STRATUS_NIC 0x1614
+#define BROADCOM_DEV_ID_57414_VF 0x16c1
+#define BROADCOM_DEV_ID_57301 0x16c8
+#define BROADCOM_DEV_ID_57302 0x16c9
+#define BROADCOM_DEV_ID_57304_PF 0x16ca
+#define BROADCOM_DEV_ID_57304_VF 0x16cb
+#define BROADCOM_DEV_ID_57417_MF 0x16cc
+#define BROADCOM_DEV_ID_NS2 0x16cd
+#define BROADCOM_DEV_ID_57311 0x16ce
+#define BROADCOM_DEV_ID_57312 0x16cf
+#define BROADCOM_DEV_ID_57402 0x16d0
+#define BROADCOM_DEV_ID_57404 0x16d1
+#define BROADCOM_DEV_ID_57406_PF 0x16d2
+#define BROADCOM_DEV_ID_57406_VF 0x16d3
+#define BROADCOM_DEV_ID_57402_MF 0x16d4
+#define BROADCOM_DEV_ID_57407_RJ45 0x16d5
+#define BROADCOM_DEV_ID_57412 0x16d6
+#define BROADCOM_DEV_ID_57414 0x16d7
+#define BROADCOM_DEV_ID_57416_RJ45 0x16d8
+#define BROADCOM_DEV_ID_57417_RJ45 0x16d9
+#define BROADCOM_DEV_ID_5741X_VF 0x16dc
+#define BROADCOM_DEV_ID_57412_MF 0x16de
+#define BROADCOM_DEV_ID_57314 0x16df
+#define BROADCOM_DEV_ID_57317_RJ45 0x16e0
+#define BROADCOM_DEV_ID_5731X_VF 0x16e1
+#define BROADCOM_DEV_ID_57417_SFP 0x16e2
+#define BROADCOM_DEV_ID_57416_SFP 0x16e3
+#define BROADCOM_DEV_ID_57317_SFP 0x16e4
+#define BROADCOM_DEV_ID_57404_MF 0x16e7
+#define BROADCOM_DEV_ID_57406_MF 0x16e8
+#define BROADCOM_DEV_ID_57407_SFP 0x16e9
+#define BROADCOM_DEV_ID_57407_MF 0x16ea
+#define BROADCOM_DEV_ID_57414_MF 0x16ec
+#define BROADCOM_DEV_ID_57416_MF 0x16ee
+#define BROADCOM_DEV_ID_58802 0xd802
+#define BROADCOM_DEV_ID_58804 0xd804
+#define BROADCOM_DEV_ID_58808 0x16f0
+#define BROADCOM_DEV_ID_58802_VF 0xd800
+
#define BNXT_MAX_MTU 9574
#define VLAN_TAG_SIZE 4
/* FW adds extra 4 bytes for FCS */
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 5dc17da..c87ccb6 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -33,49 +33,9 @@ static const char bnxt_version[] =
"Broadcom NetXtreme driver " DRV_MODULE_NAME "\n";
int bnxt_logtype_driver;
-#define PCI_VENDOR_ID_BROADCOM 0x14E4
-
-#define BROADCOM_DEV_ID_STRATUS_NIC_VF1 0x1606
-#define BROADCOM_DEV_ID_STRATUS_NIC_VF2 0x1609
-#define BROADCOM_DEV_ID_STRATUS_NIC 0x1614
-#define BROADCOM_DEV_ID_57414_VF 0x16c1
-#define BROADCOM_DEV_ID_57301 0x16c8
-#define BROADCOM_DEV_ID_57302 0x16c9
-#define BROADCOM_DEV_ID_57304_PF 0x16ca
-#define BROADCOM_DEV_ID_57304_VF 0x16cb
-#define BROADCOM_DEV_ID_57417_MF 0x16cc
-#define BROADCOM_DEV_ID_NS2 0x16cd
-#define BROADCOM_DEV_ID_57311 0x16ce
-#define BROADCOM_DEV_ID_57312 0x16cf
-#define BROADCOM_DEV_ID_57402 0x16d0
-#define BROADCOM_DEV_ID_57404 0x16d1
-#define BROADCOM_DEV_ID_57406_PF 0x16d2
-#define BROADCOM_DEV_ID_57406_VF 0x16d3
-#define BROADCOM_DEV_ID_57402_MF 0x16d4
-#define BROADCOM_DEV_ID_57407_RJ45 0x16d5
-#define BROADCOM_DEV_ID_57412 0x16d6
-#define BROADCOM_DEV_ID_57414 0x16d7
-#define BROADCOM_DEV_ID_57416_RJ45 0x16d8
-#define BROADCOM_DEV_ID_57417_RJ45 0x16d9
-#define BROADCOM_DEV_ID_5741X_VF 0x16dc
-#define BROADCOM_DEV_ID_57412_MF 0x16de
-#define BROADCOM_DEV_ID_57314 0x16df
-#define BROADCOM_DEV_ID_57317_RJ45 0x16e0
-#define BROADCOM_DEV_ID_5731X_VF 0x16e1
-#define BROADCOM_DEV_ID_57417_SFP 0x16e2
-#define BROADCOM_DEV_ID_57416_SFP 0x16e3
-#define BROADCOM_DEV_ID_57317_SFP 0x16e4
-#define BROADCOM_DEV_ID_57404_MF 0x16e7
-#define BROADCOM_DEV_ID_57406_MF 0x16e8
-#define BROADCOM_DEV_ID_57407_SFP 0x16e9
-#define BROADCOM_DEV_ID_57407_MF 0x16ea
-#define BROADCOM_DEV_ID_57414_MF 0x16ec
-#define BROADCOM_DEV_ID_57416_MF 0x16ee
-#define BROADCOM_DEV_ID_58802 0xd802
-#define BROADCOM_DEV_ID_58804 0xd804
-#define BROADCOM_DEV_ID_58808 0x16f0
-#define BROADCOM_DEV_ID_58802_VF 0xd800
-
+/*
+ * The set of PCI devices this driver supports
+ */
static const struct rte_pci_id bnxt_pci_id_map[] = {
{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM,
BROADCOM_DEV_ID_STRATUS_NIC_VF1) },
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 06/19] net/bnxt: fix extended port counter statistics
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (4 preceding siblings ...)
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 05/19] net/bnxt: move macro definitions to header file Somnath Kotur
@ 2019-12-18 6:23 ` Somnath Kotur
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 07/19] net/bnxt: fix VF probe when MAC address is zero Somnath Kotur
` (13 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:23 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
1. refactor stats allocation code to new routine
2. check for extended statistics support depends on "hwrm_spec_code"
which is set in bnxt_hwrm_ver_get called later. Hence we were never
querying extended port stats as flags field was not updated. Fixed
this by moving the stats allocation after the call to
bnxt_hwrm_ver_get.
3. we were incorrectly passing the host address used for port
statistics to PORT_QSTATS_EXT command. Fixed this by passing the
correct extended stats address.
Fixes: f55e12f33416 ("net/bnxt: support extended port counters")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 227 ++++++++++++++++++++++-------------------
drivers/net/bnxt/bnxt_hwrm.c | 4 +-
2 files changed, 122 insertions(+), 109 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c87ccb6..d0d9196 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3193,15 +3193,126 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
bp->pf.vf_req_fwd[((arg) >> 5)] &= \
~rte_cpu_to_le_32(1 << ((arg) & 0x1f)); \
}
-static int
-bnxt_dev_init(struct rte_eth_dev *eth_dev)
+
+static int bnxt_alloc_stats_mem(struct bnxt *bp)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = bp->pdev;
char mz_name[RTE_MEMZONE_NAMESIZE];
const struct rte_memzone *mz = NULL;
- static int version_printed;
uint32_t total_alloc_len;
rte_iova_t mz_phys_addr;
+
+ if (pci_dev->id.device_id == BROADCOM_DEV_ID_NS2)
+ return 0;
+
+ snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
+ "bnxt_%04x:%02x:%02x:%02x-%s", pci_dev->addr.domain,
+ pci_dev->addr.bus, pci_dev->addr.devid,
+ pci_dev->addr.function, "rx_port_stats");
+ mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
+ total_alloc_len =
+ RTE_CACHE_LINE_ROUNDUP(sizeof(struct rx_port_stats) +
+ sizeof(struct rx_port_stats_ext) +
+ 512);
+ mz = rte_memzone_lookup(mz_name);
+ if (!mz) {
+ mz = rte_memzone_reserve(mz_name, total_alloc_len,
+ SOCKET_ID_ANY,
+ RTE_MEMZONE_2MB |
+ RTE_MEMZONE_SIZE_HINT_ONLY |
+ RTE_MEMZONE_IOVA_CONTIG);
+ if (mz == NULL)
+ return -ENOMEM;
+ }
+ memset(mz->addr, 0, mz->len);
+ mz_phys_addr = mz->iova;
+ if ((unsigned long)mz->addr == mz_phys_addr) {
+ PMD_DRV_LOG(DEBUG,
+ "Memzone physical address same as virtual.\n");
+ PMD_DRV_LOG(DEBUG,
+ "Using rte_mem_virt2iova()\n");
+ mz_phys_addr = rte_mem_virt2iova(mz->addr);
+ if (mz_phys_addr == RTE_BAD_IOVA) {
+ PMD_DRV_LOG(ERR,
+ "Can't map address to physical memory\n");
+ return -ENOMEM;
+ }
+ }
+
+ bp->rx_mem_zone = (const void *)mz;
+ bp->hw_rx_port_stats = mz->addr;
+ bp->hw_rx_port_stats_map = mz_phys_addr;
+
+ snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
+ "bnxt_%04x:%02x:%02x:%02x-%s", pci_dev->addr.domain,
+ pci_dev->addr.bus, pci_dev->addr.devid,
+ pci_dev->addr.function, "tx_port_stats");
+ mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
+ total_alloc_len =
+ RTE_CACHE_LINE_ROUNDUP(sizeof(struct tx_port_stats) +
+ sizeof(struct tx_port_stats_ext) +
+ 512);
+ mz = rte_memzone_lookup(mz_name);
+ if (!mz) {
+ mz = rte_memzone_reserve(mz_name,
+ total_alloc_len,
+ SOCKET_ID_ANY,
+ RTE_MEMZONE_2MB |
+ RTE_MEMZONE_SIZE_HINT_ONLY |
+ RTE_MEMZONE_IOVA_CONTIG);
+ if (mz == NULL)
+ return -ENOMEM;
+ }
+ memset(mz->addr, 0, mz->len);
+ mz_phys_addr = mz->iova;
+ if ((unsigned long)mz->addr == mz_phys_addr) {
+ PMD_DRV_LOG(DEBUG,
+ "Memzone physical address same as virtual.\n");
+ PMD_DRV_LOG(DEBUG,
+ "Using rte_mem_virt2iova()\n");
+ mz_phys_addr = rte_mem_virt2iova(mz->addr);
+ if (mz_phys_addr == RTE_BAD_IOVA) {
+ PMD_DRV_LOG(ERR,
+ "Can't map address to physical memory\n");
+ return -ENOMEM;
+ }
+ }
+
+ bp->tx_mem_zone = (const void *)mz;
+ bp->hw_tx_port_stats = mz->addr;
+ bp->hw_tx_port_stats_map = mz_phys_addr;
+ bp->flags |= BNXT_FLAG_PORT_STATS;
+
+ /* Display extended statistics if FW supports it */
+ if (bp->hwrm_spec_code < HWRM_SPEC_CODE_1_8_4 ||
+ bp->hwrm_spec_code == HWRM_SPEC_CODE_1_9_0)
+ return 0;
+
+ bp->hw_rx_port_stats_ext = (void *)
+ ((uint8_t *)bp->hw_rx_port_stats +
+ sizeof(struct rx_port_stats));
+ bp->hw_rx_port_stats_ext_map = bp->hw_rx_port_stats_map +
+ sizeof(struct rx_port_stats);
+ bp->flags |= BNXT_FLAG_EXT_RX_PORT_STATS;
+
+ if (bp->hwrm_spec_code < HWRM_SPEC_CODE_1_9_2) {
+ bp->hw_tx_port_stats_ext = (void *)
+ ((uint8_t *)bp->hw_tx_port_stats +
+ sizeof(struct tx_port_stats));
+ bp->hw_tx_port_stats_ext_map =
+ bp->hw_tx_port_stats_map +
+ sizeof(struct tx_port_stats);
+ bp->flags |= BNXT_FLAG_EXT_TX_PORT_STATS;
+ }
+
+ return 0;
+}
+
+static int
+bnxt_dev_init(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ static int version_printed;
struct bnxt *bp;
int rc;
@@ -3235,109 +3346,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
goto error;
}
- if (pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
- snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
- "bnxt_%04x:%02x:%02x:%02x-%s", pci_dev->addr.domain,
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function, "rx_port_stats");
- mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
- mz = rte_memzone_lookup(mz_name);
- total_alloc_len = RTE_CACHE_LINE_ROUNDUP(
- sizeof(struct rx_port_stats) +
- sizeof(struct rx_port_stats_ext) +
- 512);
- if (!mz) {
- mz = rte_memzone_reserve(mz_name, total_alloc_len,
- SOCKET_ID_ANY,
- RTE_MEMZONE_2MB |
- RTE_MEMZONE_SIZE_HINT_ONLY |
- RTE_MEMZONE_IOVA_CONTIG);
- if (mz == NULL)
- return -ENOMEM;
- }
- memset(mz->addr, 0, mz->len);
- mz_phys_addr = mz->iova;
- if ((unsigned long)mz->addr == mz_phys_addr) {
- PMD_DRV_LOG(INFO,
- "Memzone physical address same as virtual using rte_mem_virt2iova()\n");
- mz_phys_addr = rte_mem_virt2iova(mz->addr);
- if (mz_phys_addr == RTE_BAD_IOVA) {
- PMD_DRV_LOG(ERR,
- "unable to map address to physical memory\n");
- return -ENOMEM;
- }
- }
-
- bp->rx_mem_zone = (const void *)mz;
- bp->hw_rx_port_stats = mz->addr;
- bp->hw_rx_port_stats_map = mz_phys_addr;
-
- snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
- "bnxt_%04x:%02x:%02x:%02x-%s", pci_dev->addr.domain,
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function, "tx_port_stats");
- mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
- mz = rte_memzone_lookup(mz_name);
- total_alloc_len = RTE_CACHE_LINE_ROUNDUP(
- sizeof(struct tx_port_stats) +
- sizeof(struct tx_port_stats_ext) +
- 512);
- if (!mz) {
- mz = rte_memzone_reserve(mz_name,
- total_alloc_len,
- SOCKET_ID_ANY,
- RTE_MEMZONE_2MB |
- RTE_MEMZONE_SIZE_HINT_ONLY |
- RTE_MEMZONE_IOVA_CONTIG);
- if (mz == NULL)
- return -ENOMEM;
- }
- memset(mz->addr, 0, mz->len);
- mz_phys_addr = mz->iova;
- if ((unsigned long)mz->addr == mz_phys_addr) {
- PMD_DRV_LOG(WARNING,
- "Memzone physical address same as virtual.\n");
- PMD_DRV_LOG(WARNING,
- "Using rte_mem_virt2iova()\n");
- mz_phys_addr = rte_mem_virt2iova(mz->addr);
- if (mz_phys_addr == RTE_BAD_IOVA) {
- PMD_DRV_LOG(ERR,
- "unable to map address to physical memory\n");
- return -ENOMEM;
- }
- }
-
- bp->tx_mem_zone = (const void *)mz;
- bp->hw_tx_port_stats = mz->addr;
- bp->hw_tx_port_stats_map = mz_phys_addr;
-
- bp->flags |= BNXT_FLAG_PORT_STATS;
-
- /* Display extended statistics if FW supports it */
- if (bp->hwrm_spec_code < HWRM_SPEC_CODE_1_8_4 ||
- bp->hwrm_spec_code == HWRM_SPEC_CODE_1_9_0)
- goto skip_ext_stats;
-
- bp->hw_rx_port_stats_ext = (void *)
- ((uint8_t *)bp->hw_rx_port_stats +
- sizeof(struct rx_port_stats));
- bp->hw_rx_port_stats_ext_map = bp->hw_rx_port_stats_map +
- sizeof(struct rx_port_stats);
- bp->flags |= BNXT_FLAG_EXT_RX_PORT_STATS;
-
-
- if (bp->hwrm_spec_code < HWRM_SPEC_CODE_1_9_2) {
- bp->hw_tx_port_stats_ext = (void *)
- ((uint8_t *)bp->hw_tx_port_stats +
- sizeof(struct tx_port_stats));
- bp->hw_tx_port_stats_ext_map =
- bp->hw_tx_port_stats_map +
- sizeof(struct tx_port_stats);
- bp->flags |= BNXT_FLAG_EXT_TX_PORT_STATS;
- }
- }
-
-skip_ext_stats:
rc = bnxt_alloc_hwrm_resources(bp);
if (rc) {
PMD_DRV_LOG(ERR,
@@ -3365,6 +3373,11 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
PMD_DRV_LOG(ERR, "hwrm query capability failure rc: %x\n", rc);
goto error_free;
}
+
+ rc = bnxt_alloc_stats_mem(bp);
+ if (rc)
+ goto error_free;
+
if (bp->max_tx_rings == 0) {
PMD_DRV_LOG(ERR, "No TX rings available!\n");
rc = -EBUSY;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 791bf4b..a69e3e3 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3968,13 +3968,13 @@ int bnxt_hwrm_ext_port_qstats(struct bnxt *bp)
req.port_id = rte_cpu_to_le_16(pf->port_id);
if (bp->flags & BNXT_FLAG_EXT_TX_PORT_STATS) {
req.tx_stat_host_addr =
- rte_cpu_to_le_64(bp->hw_tx_port_stats_map);
+ rte_cpu_to_le_64(bp->hw_tx_port_stats_ext_map);
req.tx_stat_size =
rte_cpu_to_le_16(sizeof(struct tx_port_stats_ext));
}
if (bp->flags & BNXT_FLAG_EXT_RX_PORT_STATS) {
req.rx_stat_host_addr =
- rte_cpu_to_le_64(bp->hw_rx_port_stats_map);
+ rte_cpu_to_le_64(bp->hw_rx_port_stats_ext_map);
req.rx_stat_size =
rte_cpu_to_le_16(sizeof(struct rx_port_stats_ext));
}
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 07/19] net/bnxt: fix VF probe when MAC address is zero
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (5 preceding siblings ...)
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 06/19] net/bnxt: fix extended port counter statistics Somnath Kotur
@ 2019-12-18 6:23 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 08/19] net/bnxt: fix coding style Somnath Kotur
` (12 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:23 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
VF driver should not fail probe if the host PF driver has not assigned
any MAC address for the VF. It should generate a random MAC address and
configure the MAC and then continue probing the device.
Fixes: be160484a48d ("net/bnxt: check if MAC address is all zeros")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 61 ++++++++++++++++++++++++++++--------------
drivers/net/bnxt/bnxt_hwrm.c | 25 +++++++++++++++++
drivers/net/bnxt/bnxt_hwrm.h | 1 +
drivers/net/bnxt/bnxt_util.c | 11 ++++++++
drivers/net/bnxt/bnxt_util.h | 1 +
5 files changed, 79 insertions(+), 20 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d0d9196..167618a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3186,6 +3186,45 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
return 0;
}
+static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
+{
+ struct bnxt *bp = eth_dev->data->dev_private;
+ int rc = 0;
+
+ eth_dev->data->mac_addrs = rte_zmalloc("bnxt_mac_addr_tbl",
+ ETHER_ADDR_LEN *
+ bp->max_l2_ctx,
+ 0);
+ if (eth_dev->data->mac_addrs == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc MAC addr tbl\n");
+ return -ENOMEM;
+ }
+
+ if (bnxt_check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) {
+ if (BNXT_PF(bp))
+ return -EINVAL;
+
+ /* Generate a random MAC address, if none was assigned by PF */
+ PMD_DRV_LOG(INFO, "VF MAC address not assigned by Host PF\n");
+ bnxt_eth_hw_addr_random(bp->mac_addr);
+ PMD_DRV_LOG(INFO,
+ "Assign random MAC:%02X:%02X:%02X:%02X:%02X:%02X\n",
+ bp->mac_addr[0], bp->mac_addr[1], bp->mac_addr[2],
+ bp->mac_addr[3], bp->mac_addr[4], bp->mac_addr[5]);
+
+ rc = bnxt_hwrm_set_mac(bp);
+ if (!rc)
+ memcpy(&bp->eth_dev->data->mac_addrs[0], bp->mac_addr,
+ ETHER_ADDR_LEN);
+ return rc;
+ }
+
+ /* Copy the permanent MAC from the FUNC_QCAPS response */
+ memcpy(bp->mac_addr, bp->dflt_mac_addr, ETHER_ADDR_LEN);
+ memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN);
+
+ return rc;
+}
#define ALLOW_FUNC(x) \
{ \
@@ -3383,28 +3422,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
rc = -EBUSY;
goto error_free;
}
- eth_dev->data->mac_addrs = rte_zmalloc("bnxt_mac_addr_tbl",
- ETHER_ADDR_LEN * bp->max_l2_ctx, 0);
- if (eth_dev->data->mac_addrs == NULL) {
- PMD_DRV_LOG(ERR,
- "Failed to alloc %u bytes needed to store MAC addr tbl",
- ETHER_ADDR_LEN * bp->max_l2_ctx);
- rc = -ENOMEM;
- goto error_free;
- }
- if (bnxt_check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) {
- PMD_DRV_LOG(ERR,
- "Invalid MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n",
- bp->dflt_mac_addr[0], bp->dflt_mac_addr[1],
- bp->dflt_mac_addr[2], bp->dflt_mac_addr[3],
- bp->dflt_mac_addr[4], bp->dflt_mac_addr[5]);
- rc = -EINVAL;
+ rc = bnxt_setup_mac_addr(eth_dev);
+ if (rc)
goto error_free;
- }
- /* 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 */
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index a69e3e3..58f5932 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3995,3 +3995,28 @@ int bnxt_hwrm_ext_port_qstats(struct bnxt *bp)
return rc;
}
+
+int bnxt_hwrm_set_mac(struct bnxt *bp)
+{
+ struct hwrm_func_vf_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+ struct hwrm_func_vf_cfg_input req = {0};
+ int rc = 0;
+
+ if (!BNXT_VF(bp))
+ return 0;
+
+ HWRM_PREP(req, FUNC_VF_CFG, BNXT_USE_CHIMP_MB);
+
+ req.enables =
+ rte_cpu_to_le_32(HWRM_FUNC_VF_CFG_INPUT_ENABLES_DFLT_MAC_ADDR);
+ memcpy(req.dflt_mac_addr, bp->mac_addr, ETHER_ADDR_LEN);
+
+ rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+
+ HWRM_CHECK_RESULT();
+
+ memcpy(bp->dflt_mac_addr, bp->mac_addr, ETHER_ADDR_LEN);
+ HWRM_UNLOCK();
+
+ return rc;
+}
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index a3a481b..c586ed3 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -181,4 +181,5 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp,
struct bnxt_coal *coal, uint16_t ring_id);
int bnxt_hwrm_check_vf_rings(struct bnxt *bp);
int bnxt_hwrm_ext_port_qstats(struct bnxt *bp);
+int bnxt_hwrm_set_mac(struct bnxt *bp);
#endif
diff --git a/drivers/net/bnxt/bnxt_util.c b/drivers/net/bnxt/bnxt_util.c
index 7d33427..9190a35 100644
--- a/drivers/net/bnxt/bnxt_util.c
+++ b/drivers/net/bnxt/bnxt_util.c
@@ -4,6 +4,7 @@
*/
#include <inttypes.h>
+#include <rte_ether.h>
#include "bnxt_util.h"
@@ -16,3 +17,13 @@ int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
return 0;
return 1;
}
+
+void bnxt_eth_hw_addr_random(uint8_t *mac_addr)
+{
+ eth_random_addr(mac_addr);
+
+ /* Set Organizationally Unique Identifier (OUI) prefix */
+ mac_addr[0] = 0x00;
+ mac_addr[1] = 0x0a;
+ mac_addr[2] = 0xf7;
+}
diff --git a/drivers/net/bnxt/bnxt_util.h b/drivers/net/bnxt/bnxt_util.h
index 2378833..9f1868a 100644
--- a/drivers/net/bnxt/bnxt_util.h
+++ b/drivers/net/bnxt/bnxt_util.h
@@ -7,5 +7,6 @@
#define _BNXT_UTIL_H_
int bnxt_check_zero_bytes(const uint8_t *bytes, int len);
+void bnxt_eth_hw_addr_random(uint8_t *mac_addr);
#endif /* _BNXT_UTIL_H_ */
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 08/19] net/bnxt: fix coding style
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (6 preceding siblings ...)
2019-12-18 6:23 ` [dpdk-stable] [PATCH 18.11 07/19] net/bnxt: fix VF probe when MAC address is zero Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 09/19] net/bnxt: fix async link handling and update Somnath Kotur
` (11 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
- Remove unnecessary new line
- Remove unnecessary blank lines
- Align rte_* header file inclusion at one place
Fixes: 37d6161a68ba ("net/bnxt: add ring group alloc/free")
Fixes: ec77c6298301 ("net/bnxt: add stats context allocation")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 1 -
drivers/net/bnxt/bnxt_hwrm.c | 12 +++---------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 167618a..f9c7cd2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2425,7 +2425,6 @@ bnxt_parse_fdir_filter(struct bnxt *bp,
return -EINVAL;
}
-
if (fdir_mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
rte_memcpy(filter->dst_macaddr,
fdir->input.flow.mac_vlan_flow.mac_addr.addr_bytes, 6);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 58f5932..4db6e29 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -11,6 +11,7 @@
#include <rte_malloc.h>
#include <rte_memzone.h>
#include <rte_version.h>
+#include <rte_io.h>
#include "bnxt.h"
#include "bnxt_cpr.h"
@@ -24,8 +25,6 @@
#include "bnxt_vnic.h"
#include "hsi_struct_def_dpdk.h"
-#include <rte_io.h>
-
#define HWRM_CMD_TIMEOUT 6000000
#define HWRM_SPEC_CODE_1_8_3 0x10803
#define HWRM_VERSION_1_9_1 0x10901
@@ -1233,8 +1232,7 @@ int bnxt_hwrm_ring_grp_alloc(struct bnxt *bp, unsigned int idx)
HWRM_CHECK_RESULT();
- bp->grp_info[idx].fw_grp_id =
- rte_le_to_cpu_16(resp->ring_group_id);
+ bp->grp_info[idx].fw_grp_id = rte_le_to_cpu_16(resp->ring_group_id);
HWRM_UNLOCK();
@@ -1292,8 +1290,7 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
req.update_period_ms = rte_cpu_to_le_32(0);
- req.stats_dma_addr =
- rte_cpu_to_le_64(cpr->hw_stats_map);
+ req.stats_dma_addr = rte_cpu_to_le_64(cpr->hw_stats_map);
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
@@ -3201,7 +3198,6 @@ int bnxt_hwrm_ctx_qstats(struct bnxt *bp, uint32_t cid, int idx,
stats->q_errors[idx] += rte_le_to_cpu_64(resp->tx_err_pkts);
}
-
HWRM_UNLOCK();
return rc;
@@ -3444,7 +3440,6 @@ int bnxt_hwrm_erase_nvram_directory(struct bnxt *bp, uint8_t index)
return rc;
}
-
int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
uint16_t dir_ordinal, uint16_t dir_ext,
uint16_t dir_attr, const uint8_t *data,
@@ -3787,7 +3782,6 @@ int bnxt_hwrm_set_ntuple_filter(struct bnxt *bp,
HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_ID;
req.dst_id = rte_cpu_to_le_16(dst_id);
-
if (filter->ip_addr_type) {
req.ip_addr_type = filter->ip_addr_type;
enables |=
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 09/19] net/bnxt: fix async link handling and update
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (7 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 08/19] net/bnxt: fix coding style Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 10/19] net/bnxt: fix flow flush handling Somnath Kotur
` (10 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
When updating the link because of an async link notification
there is no need to set wait_for_completion. At this point
the link related information should be available without need to poll.
Use rte_eth_linkstatus_set instead of memcpy to ensure atomicity
while updating the link status.
We force the physical link down as a part of device stop.
But we are not waiting there enough and handling the async notification
before exiting. It just sits in the default CQ till we do a device
start.
Fix it by calling the CQ handler in device stop.
Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_cpr.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++----
drivers/net/bnxt/bnxt_irq.c | 2 +-
drivers/net/bnxt/bnxt_irq.h | 1 +
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index ff8fa04..4529080 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -26,7 +26,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
/* FALLTHROUGH */
- bnxt_link_update_op(bp->eth_dev, 1);
+ bnxt_link_update_op(bp->eth_dev, 0);
break;
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index f9c7cd2..5a62695 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -595,6 +595,8 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
}
+ bnxt_enable_int(bp);
+
rc = bnxt_init_chip(bp);
if (rc)
goto error;
@@ -609,7 +611,6 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
if (rc)
goto error;
- bnxt_enable_int(bp);
bp->flags |= BNXT_FLAG_INIT_DONE;
bp->dev_stopped = 0;
return 0;
@@ -663,7 +664,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
/* TBD: STOP HW queues DMA */
eth_dev->data->dev_link.link_status = 0;
}
- bnxt_set_hwrm_link_config(bp, false);
+ bnxt_dev_set_link_down_op(eth_dev);
+ /* Wait for link to be reset and the async notification to process. */
+ rte_delay_ms(BNXT_LINK_WAIT_INTERVAL * 2);
/* Clean queue intr-vector mapping */
rte_intr_efd_disable(intr_handle);
@@ -675,6 +678,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
bnxt_hwrm_port_clr_stats(bp);
bnxt_free_tx_mbufs(bp);
bnxt_free_rx_mbufs(bp);
+ /* Process any remaining notifications in default completion queue */
+ bnxt_int_handler(eth_dev);
bnxt_shutdown_nic(bp);
bp->dev_stopped = 1;
}
@@ -809,8 +814,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
/* Timed out or success */
if (new.link_status != eth_dev->data->dev_link.link_status ||
new.link_speed != eth_dev->data->dev_link.link_speed) {
- memcpy(ð_dev->data->dev_link, &new,
- sizeof(struct rte_eth_link));
+ rte_eth_linkstatus_set(eth_dev, &new);
_rte_eth_dev_callback_process(eth_dev,
RTE_ETH_EVENT_INTR_LSC,
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 9c913d2..57365d7 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -18,7 +18,7 @@
* Interrupts
*/
-static void bnxt_int_handler(void *param)
+void bnxt_int_handler(void *param)
{
struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
struct bnxt *bp = eth_dev->data->dev_private;
diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h
index 460a97a..1b56e08 100644
--- a/drivers/net/bnxt/bnxt_irq.h
+++ b/drivers/net/bnxt/bnxt_irq.h
@@ -22,5 +22,6 @@ void bnxt_disable_int(struct bnxt *bp);
void bnxt_enable_int(struct bnxt *bp);
int bnxt_setup_int(struct bnxt *bp);
int bnxt_request_int(struct bnxt *bp);
+void bnxt_int_handler(void *param);
#endif
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 10/19] net/bnxt: fix flow flush handling
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (8 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 09/19] net/bnxt: fix async link handling and update Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 11/19] net/bnxt: update trusted VF status only when it changes Somnath Kotur
` (9 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
We are not freeing all the flows when a flow_flush is called.
Iterate through all the flows belonging to all the VNICs in use and
free the filters.
Fixes: 4ace85a7da25 ("net/bnxt: allocate rings and groups")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_flow.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 1df1890..aca5f38 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1133,6 +1133,7 @@ static int
bnxt_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
{
struct bnxt *bp = dev->data->dev_private;
+ struct bnxt_filter_info *filter = NULL;
struct bnxt_vnic_info *vnic;
struct rte_flow *flow;
unsigned int i;
@@ -1140,14 +1141,20 @@ bnxt_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
for (i = 0; i < bp->nr_vnics; i++) {
vnic = &bp->vnic_info[i];
- STAILQ_FOREACH(flow, &vnic->flow_list, next) {
- struct bnxt_filter_info *filter = flow->filter;
+ if (vnic && vnic->fw_vnic_id == (uint16_t)-1)
+ continue;
+
+ while (!STAILQ_EMPTY(&vnic->flow_list)) {
+ flow = STAILQ_FIRST(&vnic->flow_list);
+ filter = flow->filter;
if (filter->filter_type == HWRM_CFA_EM_FILTER)
ret = bnxt_hwrm_clear_em_filter(bp, filter);
if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
ret = bnxt_hwrm_clear_ntuple_filter(bp, filter);
+ ret = bnxt_hwrm_clear_l2_filter(bp, filter);
+
if (ret) {
rte_flow_error_set
(error,
@@ -1158,9 +1165,13 @@ bnxt_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
return -rte_errno;
}
+ bnxt_free_filter(bp, filter);
+
STAILQ_REMOVE(&vnic->flow_list, flow,
rte_flow, next);
+
rte_free(flow);
+
}
}
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 11/19] net/bnxt: update trusted VF status only when it changes
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (9 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 10/19] net/bnxt: fix flow flush handling Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 12/19] net/bnxt: fix doorbell register offset for Tx ring Somnath Kotur
` (8 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
We are currently logging trusted VF information everytime a VF config
change is indicated by the async message. Update it only when new
setting is different from the current setting.
Fixes: b42c15c83e88 ("net/bnxt: support trusted VF")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4db6e29..6ddd226 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2466,9 +2466,16 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
if (BNXT_PF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST))
bp->flags |= BNXT_FLAG_MULTI_HOST;
- if (BNXT_VF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_TRUSTED_VF)) {
+ if (BNXT_VF(bp) &&
+ !BNXT_VF_IS_TRUSTED(bp) &&
+ (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_TRUSTED_VF)) {
bp->flags |= BNXT_FLAG_TRUSTED_VF_EN;
PMD_DRV_LOG(INFO, "Trusted VF cap enabled\n");
+ } else if (BNXT_VF(bp) &&
+ BNXT_VF_IS_TRUSTED(bp) &&
+ !(flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_TRUSTED_VF)) {
+ bp->flags &= ~BNXT_FLAG_TRUSTED_VF_EN;
+ PMD_DRV_LOG(INFO, "Trusted VF cap disabled\n");
}
switch (resp->port_partition_type) {
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 12/19] net/bnxt: fix doorbell register offset for Tx ring
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (10 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 11/19] net/bnxt: update trusted VF status only when it changes Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 13/19] net/bnxt: get default HWRM command timeout from FW Somnath Kotur
` (7 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
For Tx-ring # 104 and higher, the doorbell register was incorrectly
configured due to which FW was not able to receive the notification
of packet to transmit.
With this fix, user can run traffic upto 256 rings.
Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
drivers/net/bnxt/bnxt_ring.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 0628a0b..c2c1dfa 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -486,12 +486,12 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
/* Tx ring */
rc = bnxt_hwrm_ring_alloc(bp, ring,
HWRM_RING_ALLOC_INPUT_RING_TYPE_TX,
- idx, cpr->hw_stats_ctx_id,
+ i, cpr->hw_stats_ctx_id,
cp_ring->fw_ring_id);
if (rc)
goto err_out;
- txr->tx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
+ txr->tx_doorbell = (char *)bp->doorbell_base + i * 0x80;
txq->index = idx;
bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
}
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 13/19] net/bnxt: get default HWRM command timeout from FW
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (11 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 12/19] net/bnxt: fix doorbell register offset for Tx ring Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 14/19] net/bnxt: fix MAC/VLAN filter allocation Somnath Kotur
` (6 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
The HWRM command timeout is set to a very high value.
VER_GET command response returns the default request timeout value.
Use this value for waiting for HWRM commands to complete.
Fixes: cbcd375d37d2 ("net/bnxt: fix HWRM macros and locking")
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 5 +++++
drivers/net/bnxt/bnxt_hwrm.c | 19 ++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 77d5614..20eacc7 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -369,6 +369,11 @@ struct bnxt {
uint16_t max_req_len;
uint16_t max_resp_len;
+ /* default command timeout value of 50ms */
+#define HWRM_CMD_TIMEOUT 50000
+ /* default HWRM request timeout value */
+ uint32_t hwrm_cmd_timeout;
+
struct bnxt_link_info link_info;
struct bnxt_cos_queue_info cos_queue[BNXT_COS_QUEUE_COUNT];
uint8_t tx_cosq_id;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6ddd226..68c70b7 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -25,7 +25,6 @@
#include "bnxt_vnic.h"
#include "hsi_struct_def_dpdk.h"
-#define HWRM_CMD_TIMEOUT 6000000
#define HWRM_SPEC_CODE_1_8_3 0x10803
#define HWRM_VERSION_1_9_1 0x10901
@@ -83,6 +82,13 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
GRCPF_REG_KONG_CHANNEL_OFFSET : GRCPF_REG_CHIMP_CHANNEL_OFFSET;
uint16_t mb_trigger_offset = use_kong_mb ?
GRCPF_REG_KONG_COMM_TRIGGER : GRCPF_REG_CHIMP_COMM_TRIGGER;
+ uint32_t timeout;
+
+ /* For VER_GET command, set timeout as 50ms */
+ if (rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET)
+ timeout = HWRM_CMD_TIMEOUT;
+ else
+ timeout = bp->hwrm_cmd_timeout;
if (bp->flags & BNXT_FLAG_SHORT_CMD) {
void *short_cmd_req = bp->hwrm_short_cmd_req_addr;
@@ -127,7 +133,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
rte_io_mb();
/* Poll for the valid bit */
- for (i = 0; i < HWRM_CMD_TIMEOUT; i++) {
+ for (i = 0; i < timeout; i++) {
/* Sanity check on the resp->resp_len */
rte_cio_rmb();
if (resp->resp_len && resp->resp_len <=
@@ -140,7 +146,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
rte_delay_us(1);
}
- if (i >= HWRM_CMD_TIMEOUT) {
+ if (i >= timeout) {
PMD_DRV_LOG(ERR, "Error(timeout) sending msg 0x%04x\n",
req->req_type);
return -ETIMEDOUT;
@@ -832,6 +838,13 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
fw_version |= resp->hwrm_intf_upd_8b;
bp->hwrm_spec_code = fw_version;
+ /* def_req_timeout value is in milliseconds */
+ bp->hwrm_cmd_timeout = rte_le_to_cpu_16(resp->def_req_timeout);
+ /* convert timeout to usec */
+ bp->hwrm_cmd_timeout *= 1000;
+ if (!bp->hwrm_cmd_timeout)
+ bp->hwrm_cmd_timeout = HWRM_CMD_TIMEOUT;
+
if (resp->hwrm_intf_maj_8b != HWRM_VERSION_MAJOR) {
PMD_DRV_LOG(ERR, "Unsupported firmware API version\n");
rc = -EINVAL;
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 14/19] net/bnxt: fix MAC/VLAN filter allocation
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (12 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 13/19] net/bnxt: get default HWRM command timeout from FW Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 15/19] net/bnxt: fix forwarding with higher mbuf size Somnath Kotur
` (5 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
We were adding the VLAN filters to all the VNICs of the function.
Also, we were adding these VLANs to all the existing MAC only filters.
This was resulting in fewer VLANs getting added. By default we should
allocate MAC+VLAN filter only to the default VNIC of the function using
the default mac address.
Similar logic was followed in the VLAN deletion code. This patch fixes
it. Use inner VLAN fields instead of outer VLAN during filter deletion
to be in sync with VLAN addition code.
Fixes: 246c5cc5f05e ("net/bnxt: use correct flags during VLAN configuration")
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: root <root@dhcp-10-123-153-232.dhcp.broadcom.net>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_ethdev.c | 192 ++++++++++++++++-------------------------
2 files changed, 75 insertions(+), 118 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 20eacc7..909651e 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -348,6 +348,7 @@ struct bnxt {
unsigned int nr_vnics;
+#define BNXT_GET_DEFAULT_VNIC(bp) (&(bp)->vnic_info[0])
struct bnxt_vnic_info *vnic_info;
STAILQ_HEAD(, bnxt_vnic_info) free_vnic_list;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 5a62695..e6a9ad2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1305,141 +1305,97 @@ bnxt_udp_tunnel_port_del_op(struct rte_eth_dev *eth_dev,
static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
{
- struct bnxt_filter_info *filter, *temp_filter, *new_filter;
+ struct bnxt_filter_info *filter;
struct bnxt_vnic_info *vnic;
- unsigned int i;
int rc = 0;
- uint32_t chk = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN;
-
- /* Cycle through all VNICs */
- for (i = 0; i < bp->nr_vnics; i++) {
- /*
- * For each VNIC and each associated filter(s)
- * if VLAN exists && VLAN matches vlan_id
- * remove the MAC+VLAN filter
- * add a new MAC only filter
- * else
- * VLAN filter doesn't exist, just skip and continue
- */
- vnic = &bp->vnic_info[i];
- filter = STAILQ_FIRST(&vnic->filter);
- while (filter) {
- temp_filter = STAILQ_NEXT(filter, next);
-
- if (filter->enables & chk &&
- filter->l2_ovlan == vlan_id) {
- /* Must delete the filter */
- STAILQ_REMOVE(&vnic->filter, filter,
- bnxt_filter_info, next);
- bnxt_hwrm_clear_l2_filter(bp, filter);
- STAILQ_INSERT_TAIL(&bp->free_filter_list,
- filter, next);
+ uint32_t chk = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN;
- /*
- * Need to examine to see if the MAC
- * filter already existed or not before
- * allocating a new one
- */
-
- new_filter = bnxt_alloc_filter(bp);
- if (!new_filter) {
- PMD_DRV_LOG(ERR,
- "MAC/VLAN filter alloc failed\n");
- rc = -ENOMEM;
- goto exit;
- }
- STAILQ_INSERT_TAIL(&vnic->filter,
- new_filter, next);
- /* Inherit MAC from previous filter */
- new_filter->mac_index =
- filter->mac_index;
- memcpy(new_filter->l2_addr, filter->l2_addr,
- ETHER_ADDR_LEN);
- /* MAC only filter */
- rc = bnxt_hwrm_set_l2_filter(bp,
- vnic->fw_vnic_id,
- new_filter);
- if (rc)
- goto exit;
- PMD_DRV_LOG(INFO,
- "Del Vlan filter for %d\n",
- vlan_id);
- }
- filter = temp_filter;
+ /* if VLAN exists && VLAN matches vlan_id
+ * remove the MAC+VLAN filter
+ * add a new MAC only filter
+ * else
+ * VLAN filter doesn't exist, just skip and continue
+ */
+ vnic = BNXT_GET_DEFAULT_VNIC(bp);
+ filter = STAILQ_FIRST(&vnic->filter);
+ while (filter) {
+ /* Search for this matching MAC+VLAN filter */
+ if (filter->enables & chk && filter->l2_ivlan == vlan_id &&
+ !memcmp(filter->l2_addr,
+ bp->mac_addr,
+ ETHER_ADDR_LEN)) {
+ /* Delete the filter */
+ rc = bnxt_hwrm_clear_l2_filter(bp, filter);
+ if (rc)
+ return rc;
+ STAILQ_REMOVE(&vnic->filter, filter,
+ bnxt_filter_info, next);
+ STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next);
+ PMD_DRV_LOG(INFO,
+ "Del vlan filter for %d\n",
+ vlan_id);
+ return rc;
}
+ filter = STAILQ_NEXT(filter, next);
}
-exit:
- return rc;
+ return -ENOENT;
}
static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
{
- struct bnxt_filter_info *filter, *temp_filter, *new_filter;
+ struct bnxt_filter_info *filter;
struct bnxt_vnic_info *vnic;
- unsigned int i;
int rc = 0;
uint32_t en = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN |
HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK;
uint32_t chk = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN;
- /* Cycle through all VNICs */
- for (i = 0; i < bp->nr_vnics; i++) {
- /*
- * For each VNIC and each associated filter(s)
- * if VLAN exists:
- * if VLAN matches vlan_id
- * VLAN filter already exists, just skip and continue
- * else
- * add a new MAC+VLAN filter
- * else
- * Remove the old MAC only filter
- * Add a new MAC+VLAN filter
- */
- vnic = &bp->vnic_info[i];
- filter = STAILQ_FIRST(&vnic->filter);
- while (filter) {
- temp_filter = STAILQ_NEXT(filter, next);
+ /* Implementation notes on the use of VNIC in this command:
+ *
+ * By default, these filters belong to default vnic for the function.
+ * Once these filters are set up, only destination VNIC can be modified.
+ * If the destination VNIC is not specified in this command,
+ * then the HWRM shall only create an l2 context id.
+ */
- if (filter->enables & chk) {
- if (filter->l2_ivlan == vlan_id)
- goto cont;
- } else {
- /* Must delete the MAC filter */
- STAILQ_REMOVE(&vnic->filter, filter,
- bnxt_filter_info, next);
- bnxt_hwrm_clear_l2_filter(bp, filter);
- filter->l2_ovlan = 0;
- STAILQ_INSERT_TAIL(&bp->free_filter_list,
- filter, next);
- }
- new_filter = bnxt_alloc_filter(bp);
- if (!new_filter) {
- PMD_DRV_LOG(ERR,
- "MAC/VLAN filter alloc failed\n");
- rc = -ENOMEM;
- goto exit;
- }
- STAILQ_INSERT_TAIL(&vnic->filter, new_filter, next);
- /* Inherit MAC from the previous filter */
- new_filter->mac_index = filter->mac_index;
- memcpy(new_filter->l2_addr, filter->l2_addr,
- ETHER_ADDR_LEN);
- /* MAC + VLAN ID filter */
- new_filter->l2_ivlan = vlan_id;
- new_filter->l2_ivlan_mask = 0xF000;
- new_filter->enables |= en;
- rc = bnxt_hwrm_set_l2_filter(bp,
- vnic->fw_vnic_id,
- new_filter);
- if (rc)
- goto exit;
- PMD_DRV_LOG(INFO,
- "Added Vlan filter for %d\n", vlan_id);
-cont:
- filter = temp_filter;
- }
+ vnic = BNXT_GET_DEFAULT_VNIC(bp);
+ filter = STAILQ_FIRST(&vnic->filter);
+ /* Check if the VLAN has already been added */
+ while (filter) {
+ if (filter->enables & chk && filter->l2_ivlan == vlan_id &&
+ !memcmp(filter->l2_addr, bp->mac_addr, ETHER_ADDR_LEN))
+ return -EEXIST;
+
+ filter = STAILQ_NEXT(filter, next);
}
-exit:
+
+ /* No match found. Alloc a fresh filter and issue the L2_FILTER_ALLOC
+ * command to create MAC+VLAN filter with the right flags, enables set.
+ */
+ filter = bnxt_alloc_filter(bp);
+ if (!filter) {
+ PMD_DRV_LOG(ERR,
+ "MAC/VLAN filter alloc failed\n");
+ return -ENOMEM;
+ }
+ /* MAC + VLAN ID filter */
+ filter->l2_ivlan = vlan_id;
+ filter->l2_ivlan_mask = 0x0FFF;
+ filter->enables |= en;
+ rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter);
+ if (rc) {
+ /* Free the newly allocated filter as we were
+ * not able to create the filter in hardware.
+ */
+ filter->fw_l2_filter_id = UINT64_MAX;
+ STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next);
+ return rc;
+ }
+
+ /* Add this new filter to the list */
+ STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
+ PMD_DRV_LOG(INFO,
+ "Added Vlan filter for %d\n", vlan_id);
return rc;
}
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 15/19] net/bnxt: fix forwarding with higher mbuf size
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (13 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 14/19] net/bnxt: fix MAC/VLAN filter allocation Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 16/19] net/bnxt: fix crash after removing and adding slaves Somnath Kotur
` (4 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Maximum frame length supported by hw is 9600 bytes.
When user launches testpmd with --mbuf-size=9729,
we are posting buffer descriptors of size 9601 to the ring.
This was causing packets getting discarded.
Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 5 ++++-
drivers/net/bnxt/bnxt_ethdev.c | 15 ++++++++-------
drivers/net/bnxt/bnxt_hwrm.c | 1 +
drivers/net/bnxt/bnxt_ring.c | 5 -----
drivers/net/bnxt/bnxt_rxq.c | 2 +-
drivers/net/bnxt/bnxt_rxq.h | 1 -
drivers/net/bnxt/bnxt_rxr.c | 8 ++------
7 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 909651e..95c1135 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -67,6 +67,10 @@
#define BNXT_MAX_MTU 9574
#define VLAN_TAG_SIZE 4
+#define BNXT_NUM_VLANS 2
+#define BNXT_MAX_PKT_LEN (BNXT_MAX_MTU + ETHER_HDR_LEN + \
+ ETHER_CRC_LEN + \
+ (BNXT_NUM_VLANS * VLAN_TAG_SIZE))
/* FW adds extra 4 bytes for FCS */
#define BNXT_VNIC_MRU(mtu)\
((mtu) + ETHER_HDR_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS)
@@ -75,7 +79,6 @@
/* TODO: For now, do not support VMDq/RFS on VFs. */
#define BNXT_VF_RSV_NUM_VNIC 1
#define BNXT_MAX_LED 4
-#define BNXT_NUM_VLANS 2
#define BNXT_MIN_RING_DESC 16
#define BNXT_MAX_TX_RING_DESC 4096
#define BNXT_MAX_RX_RING_DESC 8192
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e6a9ad2..6aec211 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -426,8 +426,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
/* Fast path specifics */
dev_info->min_rx_bufsize = 1;
- dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
- + VLAN_TAG_SIZE * 2;
+ dev_info->max_rx_pktlen = BNXT_MAX_PKT_LEN;
dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
@@ -1582,6 +1581,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
{
struct bnxt *bp = eth_dev->data->dev_private;
struct rte_eth_dev_info dev_info;
+ uint32_t new_pkt_size;
uint32_t rc = 0;
uint32_t i;
@@ -1592,6 +1592,8 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
ETHER_MIN_MTU, BNXT_MAX_MTU);
return -EINVAL;
}
+ new_pkt_size = new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN +
+ VLAN_TAG_SIZE * BNXT_NUM_VLANS;
if (new_mtu > ETHER_MTU) {
bp->flags |= BNXT_FLAG_JUMBO;
@@ -1603,11 +1605,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
bp->flags &= ~BNXT_FLAG_JUMBO;
}
- eth_dev->data->dev_conf.rxmode.max_rx_pkt_len =
- new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
-
- eth_dev->data->mtu = new_mtu;
- PMD_DRV_LOG(INFO, "New MTU is %d\n", eth_dev->data->mtu);
+ eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size;
for (i = 0; i < bp->nr_vnics; i++) {
struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
@@ -1628,6 +1626,9 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
}
}
+ eth_dev->data->mtu = new_mtu;
+ PMD_DRV_LOG(INFO, "New MTU is %d\n", new_mtu);
+
return rc;
}
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 68c70b7..5fdecab 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1666,6 +1666,7 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
size -= RTE_PKTMBUF_HEADROOM;
+ size = RTE_MIN(BNXT_MAX_PKT_LEN, size);
req.jumbo_thresh = rte_cpu_to_le_16(size);
req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index c2c1dfa..145daee 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -344,9 +344,6 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;
B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
- rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN +
- ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
-
if (bp->eth_dev->data->rx_queue_state[queue_index] ==
RTE_ETH_QUEUE_STATE_STARTED) {
if (bnxt_init_one_rx_ring(rxq)) {
@@ -452,8 +449,6 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
bp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id;
B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
- rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN +
- ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
if (bnxt_init_one_rx_ring(rxq)) {
PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
bnxt_rx_queue_release_op(rxq);
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index fb5328a..5bc2284 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -325,13 +325,13 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
rxq->nb_rx_desc = nb_desc;
rxq->rx_free_thresh = rx_conf->rx_free_thresh;
- PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_use_size);
PMD_DRV_LOG(DEBUG, "RX Buf MTU %d\n", eth_dev->data->mtu);
rc = bnxt_init_rx_ring_struct(rxq, socket_id);
if (rc)
goto out;
+ PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_size);
rxq->queue_id = queue_idx;
rxq->port_id = eth_dev->data->port_id;
if (rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC)
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index e5d6001..90e13a4 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -32,7 +32,6 @@ struct bnxt_rx_queue {
struct bnxt_vnic_info *vnic;
uint32_t rx_buf_size;
- uint32_t rx_buf_use_size; /* useable size */
struct bnxt_rx_ring_info *rx_ring;
struct bnxt_cp_ring_info *cp_ring;
rte_atomic64_t rx_mbuf_alloc_fail;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 6e7ca11..c488620 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -673,10 +673,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
struct bnxt_rx_ring_info *rxr;
struct bnxt_ring *ring;
- rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN +
- (2 * VLAN_TAG_SIZE);
- rxq->rx_buf_size = rxq->rx_buf_use_size + sizeof(struct rte_mbuf);
-
+ rxq->rx_buf_size = BNXT_MAX_PKT_LEN + sizeof(struct rte_mbuf);
rxr = rte_zmalloc_socket("bnxt_rx_ring",
sizeof(struct bnxt_rx_ring_info),
RTE_CACHE_LINE_SIZE, socket_id);
@@ -760,8 +757,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
uint16_t size;
size = rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM;
- if (rxq->rx_buf_use_size <= size)
- size = rxq->rx_buf_use_size;
+ size = RTE_MIN(BNXT_MAX_PKT_LEN, size);
type = RX_PROD_PKT_BD_TYPE_RX_PROD_PKT | RX_PROD_PKT_BD_FLAGS_EOP_PAD;
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 16/19] net/bnxt: fix crash after removing and adding slaves
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (14 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 15/19] net/bnxt: fix forwarding with higher mbuf size Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 17/19] net/bnxt: fix Rx queue count Somnath Kotur
` (3 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
On removing the slave interface, slave_remove in bonding module calls
_rte_eth_dev_reset which in turn frees both Tx and Rx queues.
1. segfault is seen after removing/adding the slave interface and starting
bond interface.
In this below path, when mtu is set for the slave interface, queues are
not created yet and driver reference to queue[0] causes the segfault.
slave_configure:
rte_eth_dev_set_mtu
rte_eth_dev_configure
rte_eth_rx_queue_setup
2. segfault is seen on starting the port after removing from bond device.
This is a testpmd bug where in, on starting the port, testpmd is supposed
to recreate the queues before starting the port.
Fixed these by adding check for queues created before accessing them.
Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: root <root@dhcp-10-123-153-232.dhcp.broadcom.net>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_ethdev.c | 23 ++++++++++++++++++-----
drivers/net/bnxt/bnxt_rxq.c | 4 ++++
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 95c1135..425d425 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -411,6 +411,7 @@ struct bnxt {
uint16_t vf_resv_strategy;
};
+int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 6aec211..fb40816 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -115,7 +115,6 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
-static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
/***********************/
@@ -588,6 +587,11 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
int vlan_mask = 0;
int rc;
+ if (!eth_dev->data->nb_tx_queues || !eth_dev->data->nb_rx_queues) {
+ PMD_DRV_LOG(ERR, "Queues are not configured yet!\n");
+ return -EINVAL;
+ }
+
if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS) {
PMD_DRV_LOG(ERR,
"RxQ cnt %d > CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
@@ -1577,7 +1581,7 @@ bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
}
-static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
+int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
{
struct bnxt *bp = eth_dev->data->dev_private;
struct rte_eth_dev_info dev_info;
@@ -1585,6 +1589,10 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
uint32_t rc = 0;
uint32_t i;
+ /* Exit if receive queues are not configured yet */
+ if (!eth_dev->data->nb_rx_queues)
+ return rc;
+
bnxt_dev_info_get_op(eth_dev, &dev_info);
if (new_mtu < ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) {
@@ -1605,7 +1613,9 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
bp->flags &= ~BNXT_FLAG_JUMBO;
}
- eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size;
+ /* Is there a change in mtu setting? */
+ if (eth_dev->data->dev_conf.rxmode.max_rx_pkt_len == new_pkt_size)
+ return rc;
for (i = 0; i < bp->nr_vnics; i++) {
struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
@@ -1626,8 +1636,11 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
}
}
- eth_dev->data->mtu = new_mtu;
- PMD_DRV_LOG(INFO, "New MTU is %d\n", new_mtu);
+ if (!rc) {
+ eth_dev->data->mtu = new_mtu;
+ eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size;
+ PMD_DRV_LOG(INFO, "New MTU is %d\n", new_mtu);
+ }
return rc;
}
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 5bc2284..2df61ee 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -356,6 +356,10 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
RTE_ETH_QUEUE_STATE_STARTED;
eth_dev->data->rx_queue_state[queue_idx] = queue_state;
rte_spinlock_init(&rxq->lock);
+
+ /* Configure mtu if it is different from what was configured before */
+ if (!queue_idx)
+ bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
out:
return rc;
}
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 17/19] net/bnxt: fix Rx queue count
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (15 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 16/19] net/bnxt: fix crash after removing and adding slaves Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 18/19] net/bnxt: fix deferred start of Tx queues Somnath Kotur
` (2 subsequent siblings)
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Rahul Gupta <rahul.gupta@broadcom.com>
Fix Computing of number of used descriptors in an Rx queue.
Fixes: 1b7ceba3e375 ("net/bnxt: support Rx queue count")
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index fb40816..d1b5a81 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1688,39 +1688,22 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
struct bnxt_cp_ring_info *cpr;
struct bnxt_rx_queue *rxq;
struct rx_pkt_cmpl *rxcmp;
- uint16_t cmp_type;
- uint8_t cmp = 1;
- bool valid;
rxq = dev->data->rx_queues[rx_queue_id];
cpr = rxq->cp_ring;
- valid = cpr->valid;
+ raw_cons = cpr->cp_raw_cons;
- while (raw_cons < rxq->nb_rx_desc) {
+ while (1) {
cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
+ rte_prefetch0(&cpr->cp_desc_ring[cons]);
rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
- if (!CMPL_VALID(rxcmp, valid))
- goto nothing_to_do;
- valid = FLIP_VALID(cons, cpr->cp_ring_struct->ring_mask, valid);
- cmp_type = CMP_TYPE(rxcmp);
- if (cmp_type == RX_TPA_END_CMPL_TYPE_RX_TPA_END) {
- cmp = (rte_le_to_cpu_32(
- ((struct rx_tpa_end_cmpl *)
- (rxcmp))->agg_bufs_v1) &
- RX_TPA_END_CMPL_AGG_BUFS_MASK) >>
- RX_TPA_END_CMPL_AGG_BUFS_SFT;
- desc++;
- } else if (cmp_type == 0x11) {
- desc++;
- cmp = (rxcmp->agg_bufs_v1 &
- RX_PKT_CMPL_AGG_BUFS_MASK) >>
- RX_PKT_CMPL_AGG_BUFS_SFT;
+ if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct)) {
+ break;
} else {
- cmp = 1;
+ raw_cons++;
+ desc++;
}
-nothing_to_do:
- raw_cons += cmp ? cmp : 2;
}
return desc;
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 18/19] net/bnxt: fix deferred start of Tx queues
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (16 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 17/19] net/bnxt: fix Rx queue count Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 10:21 ` Kevin Traynor
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 19/19] net/bnxt: fix rx queue start/stop Somnath Kotur
2019-12-18 11:22 ` [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Kevin Traynor
19 siblings, 1 reply; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
[ upstream commit aa2c00702bad7b2c742e11a86cb9dbbb8364fd88 ]
[ upstream commit 3955e26870bcc3336c87d1fabe6ebdf18b2a337b ]
Driver should not change "deferred_start" state of the tx queues.
It should get the state in queue_setup_op() and use that value.
Since the deferred start state was being used in the packet transmit
functions to determine whether the queue has been stopped already,
introduced a per-txq flag to track queue stopped/started state.
Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
---
drivers/net/bnxt/bnxt_txq.c | 6 ++++++
drivers/net/bnxt/bnxt_txq.h | 1 +
drivers/net/bnxt/bnxt_txr.c | 6 +++---
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index b76ad05..cf6ddfb 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -113,6 +113,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
txq->bp = bp;
txq->nb_tx_desc = nb_desc;
txq->tx_free_thresh = tx_conf->tx_free_thresh;
+ txq->tx_deferred_start = tx_conf->tx_deferred_start;
rc = bnxt_init_tx_ring_struct(txq, socket_id);
if (rc)
@@ -139,6 +140,11 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
eth_dev->data->tx_queues[queue_idx] = txq;
+ if (txq->tx_deferred_start)
+ txq->tx_started = false;
+ else
+ txq->tx_started = true;
+
out:
return rc;
}
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index 720ca90..29b90bf 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -24,6 +24,7 @@ struct bnxt_tx_queue {
uint8_t wthresh; /* Write-back threshold reg */
uint32_t ctx_curr; /* Hardware context states */
uint8_t tx_deferred_start; /* not in global dev start */
+ uint8_t tx_started; /* TX queue is started */
struct bnxt *bp;
int index;
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 95272c9..348b111 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -418,7 +418,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
bnxt_handle_tx_cp(txq);
/* Tx queue was stopped; wait for it to be restarted */
- if (txq->tx_deferred_start) {
+ if (unlikely(!txq->tx_started)) {
PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
return 0;
}
@@ -448,7 +448,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
- txq->tx_deferred_start = false;
+ txq->tx_started = true;
PMD_DRV_LOG(DEBUG, "Tx queue started\n");
return 0;
@@ -463,7 +463,7 @@ int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
bnxt_handle_tx_cp(txq);
dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
- txq->tx_deferred_start = true;
+ txq->tx_started = false;
PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
return 0;
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-stable] [PATCH 18.11 18/19] net/bnxt: fix deferred start of Tx queues
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 18/19] net/bnxt: fix deferred start of Tx queues Somnath Kotur
@ 2019-12-18 10:21 ` Kevin Traynor
0 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2019-12-18 10:21 UTC (permalink / raw)
To: Somnath Kotur, stable
On 18/12/2019 06:24, Somnath Kotur wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> [ upstream commit aa2c00702bad7b2c742e11a86cb9dbbb8364fd88 ]
> [ upstream commit 3955e26870bcc3336c87d1fabe6ebdf18b2a337b ]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I believe this should be 2171e66f938fb86623ad7c16f5dbad3b33938142
and 3955e2687 is patch 19/19 in this series. I will make the change when
applying.
>
> Driver should not change "deferred_start" state of the tx queues.
> It should get the state in queue_setup_op() and use that value.
>
> Since the deferred start state was being used in the packet transmit
> functions to determine whether the queue has been stopped already,
> introduced a per-txq flag to track queue stopped/started state.
>
> Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
> ---
> drivers/net/bnxt/bnxt_txq.c | 6 ++++++
> drivers/net/bnxt/bnxt_txq.h | 1 +
> drivers/net/bnxt/bnxt_txr.c | 6 +++---
> 3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
> index b76ad05..cf6ddfb 100644
> --- a/drivers/net/bnxt/bnxt_txq.c
> +++ b/drivers/net/bnxt/bnxt_txq.c
> @@ -113,6 +113,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
> txq->bp = bp;
> txq->nb_tx_desc = nb_desc;
> txq->tx_free_thresh = tx_conf->tx_free_thresh;
> + txq->tx_deferred_start = tx_conf->tx_deferred_start;
>
> rc = bnxt_init_tx_ring_struct(txq, socket_id);
> if (rc)
> @@ -139,6 +140,11 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
>
> eth_dev->data->tx_queues[queue_idx] = txq;
>
> + if (txq->tx_deferred_start)
> + txq->tx_started = false;
> + else
> + txq->tx_started = true;
> +
> out:
> return rc;
> }
> diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
> index 720ca90..29b90bf 100644
> --- a/drivers/net/bnxt/bnxt_txq.h
> +++ b/drivers/net/bnxt/bnxt_txq.h
> @@ -24,6 +24,7 @@ struct bnxt_tx_queue {
> uint8_t wthresh; /* Write-back threshold reg */
> uint32_t ctx_curr; /* Hardware context states */
> uint8_t tx_deferred_start; /* not in global dev start */
> + uint8_t tx_started; /* TX queue is started */
>
> struct bnxt *bp;
> int index;
> diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
> index 95272c9..348b111 100644
> --- a/drivers/net/bnxt/bnxt_txr.c
> +++ b/drivers/net/bnxt/bnxt_txr.c
> @@ -418,7 +418,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> bnxt_handle_tx_cp(txq);
>
> /* Tx queue was stopped; wait for it to be restarted */
> - if (txq->tx_deferred_start) {
> + if (unlikely(!txq->tx_started)) {
> PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
> return 0;
> }
> @@ -448,7 +448,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
> struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
>
> dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
> - txq->tx_deferred_start = false;
> + txq->tx_started = true;
> PMD_DRV_LOG(DEBUG, "Tx queue started\n");
>
> return 0;
> @@ -463,7 +463,7 @@ int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
> bnxt_handle_tx_cp(txq);
>
> dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
> - txq->tx_deferred_start = true;
> + txq->tx_started = false;
> PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
>
> return 0;
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-stable] [PATCH 18.11 19/19] net/bnxt: fix rx queue start/stop
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (17 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 18/19] net/bnxt: fix deferred start of Tx queues Somnath Kotur
@ 2019-12-18 6:24 ` Somnath Kotur
2019-12-18 11:22 ` [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Kevin Traynor
19 siblings, 0 replies; 22+ messages in thread
From: Somnath Kotur @ 2019-12-18 6:24 UTC (permalink / raw)
To: stable; +Cc: ktraynor
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Driver should not change "deferred_start" state of the rx queues.
It should get the state in queue_setup_op() and use that value.
Since the deferred start state was being used in the packet receive
functions to determine whether a stopped rx ring should be polled,
introduced a per-rxq flag to track queue stopped/started state.
Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 2 +-
drivers/net/bnxt/bnxt_ring.c | 3 +--
drivers/net/bnxt/bnxt_rxq.c | 31 +++++++++++++++++++++++++------
drivers/net/bnxt/bnxt_rxq.h | 1 +
drivers/net/bnxt/bnxt_rxr.c | 2 +-
5 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d1b5a81..3c773eb 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1559,7 +1559,7 @@ bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
qinfo->conf.rx_drop_en = 0;
- qinfo->conf.rx_deferred_start = 0;
+ qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
}
static void
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 145daee..7a154e2 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -344,8 +344,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;
B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
- if (bp->eth_dev->data->rx_queue_state[queue_index] ==
- RTE_ETH_QUEUE_STATE_STARTED) {
+ if (rxq->rx_started) {
if (bnxt_init_one_rx_ring(rxq)) {
RTE_LOG(ERR, PMD,
"bnxt_init_one_rx_ring failed!\n");
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 2df61ee..005c9f2 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -351,9 +351,20 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
}
rte_atomic64_init(&rxq->rx_mbuf_alloc_fail);
- rxq->rx_deferred_start = rx_conf->rx_deferred_start;
- queue_state = rxq->rx_deferred_start ? RTE_ETH_QUEUE_STATE_STOPPED :
- RTE_ETH_QUEUE_STATE_STARTED;
+ /* rxq 0 must not be stopped when used as async CPR */
+ if (queue_idx == 0)
+ rxq->rx_deferred_start = false;
+ else
+ rxq->rx_deferred_start = rx_conf->rx_deferred_start;
+
+ if (rxq->rx_deferred_start) {
+ queue_state = RTE_ETH_QUEUE_STATE_STOPPED;
+ rxq->rx_started = false;
+ } else {
+ queue_state = RTE_ETH_QUEUE_STATE_STARTED;
+ rxq->rx_started = true;
+ }
+
eth_dev->data->rx_queue_state[queue_idx] = queue_state;
rte_spinlock_init(&rxq->lock);
@@ -413,7 +424,12 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
return -EINVAL;
}
+ /* Set the queue state to started here.
+ * We check the status of the queue while posting buffer.
+ * If queue is it started, we do not post buffers for Rx.
+ */
dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+ rxq->rx_started = true;
bnxt_free_hwrm_rx_ring(bp, rx_queue_id);
bnxt_alloc_hwrm_rx_ring(bp, rx_queue_id);
@@ -434,8 +450,11 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
rc = bnxt_vnic_rss_configure(bp, vnic);
}
- if (rc == 0)
- rxq->rx_deferred_start = false;
+ if (rc != 0) {
+ dev->data->rx_queue_state[rx_queue_id] =
+ RTE_ETH_QUEUE_STATE_STOPPED;
+ rxq->rx_started = false;
+ }
return rc;
}
@@ -462,7 +481,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
}
dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
- rxq->rx_deferred_start = true;
+ rxq->rx_started = false;
PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index 90e13a4..00570b8 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -26,6 +26,7 @@ struct bnxt_rx_queue {
uint16_t port_id; /* Device port identifier */
uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */
uint8_t rx_deferred_start; /* not in global dev start */
+ uint8_t rx_started; /* RX queue is started */
struct bnxt *bp;
int index;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index c488620..bcfbad1 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -550,7 +550,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
bool evt = false;
/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
- if (unlikely(((rxq->rx_deferred_start ||
+ if (unlikely(((!rxq->rx_started ||
!rte_spinlock_trylock(&rxq->lock)) &&
rxq->queue_id)))
return 0;
--
2.10.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11
2019-12-18 6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
` (18 preceding siblings ...)
2019-12-18 6:24 ` [dpdk-stable] [PATCH 18.11 19/19] net/bnxt: fix rx queue start/stop Somnath Kotur
@ 2019-12-18 11:22 ` Kevin Traynor
19 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2019-12-18 11:22 UTC (permalink / raw)
To: Somnath Kotur, stable
On 18/12/2019 06:23, Somnath Kotur wrote:
> bnxt driver fixes backported to 18.11.
>
> Please apply.
>
> Ajit Khaparde (5):
> net/bnxt: fix async link handling and update
> net/bnxt: fix flow flush handling
> net/bnxt: update trusted VF status only when it changes
> net/bnxt: fix doorbell register offset for Tx ring
> net/bnxt: get default HWRM command timeout from FW
>
> Kalesh AP (11):
> net/bnxt: fix setting default MAC address
> net/bnxt: fix error checking of FW commands
> net/bnxt: fix check of address mapping
> net/bnxt: fix stats errors handling
> net/bnxt: move macro definitions to header file
> net/bnxt: fix extended port counter statistics
> net/bnxt: fix VF probe when MAC address is zero
> net/bnxt: fix coding style
> net/bnxt: fix forwarding with higher mbuf size
> net/bnxt: fix deferred start of Tx queues
> net/bnxt: fix rx queue start/stop
>
> Rahul Gupta (1):
> net/bnxt: fix Rx queue count
>
> Santoshkumar Karanappa Rastapur (2):
> net/bnxt: fix MAC/VLAN filter allocation
> net/bnxt: fix crash after removing and adding slaves
>
> drivers/net/bnxt/bnxt.h | 57 +++-
> drivers/net/bnxt/bnxt_cpr.c | 2 +-
> drivers/net/bnxt/bnxt_ethdev.c | 610 +++++++++++++++++++----------------------
> drivers/net/bnxt/bnxt_flow.c | 15 +-
> drivers/net/bnxt/bnxt_hwrm.c | 82 ++++--
> drivers/net/bnxt/bnxt_hwrm.h | 1 +
> drivers/net/bnxt/bnxt_irq.c | 2 +-
> drivers/net/bnxt/bnxt_irq.h | 1 +
> drivers/net/bnxt/bnxt_ring.c | 12 +-
> drivers/net/bnxt/bnxt_rxq.c | 37 ++-
> drivers/net/bnxt/bnxt_rxq.h | 2 +-
> drivers/net/bnxt/bnxt_rxr.c | 10 +-
> drivers/net/bnxt/bnxt_stats.c | 28 +-
> drivers/net/bnxt/bnxt_txq.c | 6 +
> drivers/net/bnxt/bnxt_txq.h | 1 +
> drivers/net/bnxt/bnxt_txr.c | 6 +-
> drivers/net/bnxt/bnxt_util.c | 11 +
> drivers/net/bnxt/bnxt_util.h | 1 +
> 18 files changed, 485 insertions(+), 399 deletions(-)
>
Thanks Som, added master commit ids and applied to 18.11 branch.
^ permalink raw reply [flat|nested] 22+ messages in thread