* [dpdk-stable] [PATCH v3 01/15] net/bnxt: fix extended port counter statistics
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 02/15] net/bnxt: fix possible segfault in case of probe failure Ajit Khaparde
` (9 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Ajit Kumar Khaparde
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")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: Use PCI_PRI_FMT to format PCI address.
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_ethdev.c | 226 +++++++++++++++++----------------
drivers/net/bnxt/bnxt_hwrm.c | 7 +-
3 files changed, 125 insertions(+), 109 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 942da7ff0..45e7359b2 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -350,6 +350,7 @@ struct bnxt {
#define BNXT_FLAG_TRUSTED_VF_EN (1 << 11)
#define BNXT_FLAG_DFLT_VNIC_SET (1 << 12)
#define BNXT_FLAG_THOR_CHIP (1 << 13)
+#define BNXT_FLAG_EXT_STATS_SUPPORTED (1 << 29)
#define BNXT_FLAG_NEW_RM (1 << 30)
#define BNXT_FLAG_INIT_DONE (1U << 31)
#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 14b69a480..da0486c62 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3639,6 +3639,120 @@ int bnxt_alloc_ctx_mem(struct bnxt *bp)
return 0;
}
+static int bnxt_alloc_stats_mem(struct bnxt *bp)
+{
+ struct rte_pci_device *pci_dev = bp->pdev;
+ char mz_name[RTE_MEMZONE_NAMESIZE];
+ const struct rte_memzone *mz = NULL;
+ 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_" PCI_PRI_FMT "-%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(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 == 0) {
+ 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_" PCI_PRI_FMT "-%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 == 0) {
+ 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 ||
+ !(bp->flags & BNXT_FLAG_EXT_STATS_SUPPORTED))
+ 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->flags & BNXT_FLAG_EXT_STATS_SUPPORTED) {
+ 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;
+}
+
#define ALLOW_FUNC(x) \
{ \
uint32_t arg = (x); \
@@ -3649,11 +3763,7 @@ static int
bnxt_dev_init(struct rte_eth_dev *eth_dev)
{
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
- 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;
struct bnxt *bp;
uint16_t mtu;
int rc;
@@ -3692,109 +3802,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- 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 == 0) {
- 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 == 0) {
- 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,
@@ -3823,6 +3830,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 8f0d33dca..f691922bd 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -611,6 +611,9 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
}
}
+ if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_STATS_SUPPORTED)
+ bp->flags |= BNXT_FLAG_EXT_STATS_SUPPORTED;
+
HWRM_UNLOCK();
return rc;
@@ -4495,13 +4498,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.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 02/15] net/bnxt: fix possible segfault in case of probe failure
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 01/15] net/bnxt: fix extended port counter statistics Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 03/15] net/bnxt: do not fail VF probe when the MAC address is zero Ajit Khaparde
` (8 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Kalesh AP, stable
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Fixed couple of possible segfaults due to NULL pointer
dereference in case of probe failure.
Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_irq.c | 3 +++
drivers/net/bnxt/bnxt_vnic.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 0bb3eb4fa..61f7498a5 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -52,6 +52,9 @@ void bnxt_free_int(struct bnxt *bp)
{
struct bnxt_irq *irq;
+ if (bp->irq_tbl == NULL)
+ return;
+
irq = bp->irq_tbl;
if (irq) {
if (irq->requested) {
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 262cfc18d..20e5bf2d1 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -89,6 +89,9 @@ void bnxt_free_vnic_attributes(struct bnxt *bp)
struct bnxt_vnic_info *vnic;
unsigned int i;
+ if (bp->vnic_info == NULL)
+ return;
+
for (i = 0; i < bp->max_vnics; i++) {
vnic = &bp->vnic_info[i];
if (vnic->rss_table) {
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 03/15] net/bnxt: do not fail VF probe when the MAC address is zero
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 01/15] net/bnxt: fix extended port counter statistics Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 02/15] net/bnxt: fix possible segfault in case of probe failure Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 06/15] net/bnxt: fix L4 checksum error indication in Rx path Ajit Khaparde
` (7 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Kalesh AP, stable
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")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 62 +++++++++++++++++++++++-----------
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, 80 insertions(+), 20 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index da0486c62..e44df1881 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3753,6 +3753,46 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
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",
+ RTE_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, RTE_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,
+ RTE_ETHER_ADDR_LEN);
+ return rc;
+ }
+
+ /* Copy the permanent MAC from the FUNC_QCAPS response */
+ memcpy(bp->mac_addr, bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN);
+ memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, RTE_ETHER_ADDR_LEN);
+
+ return rc;
+}
+
#define ALLOW_FUNC(x) \
{ \
uint32_t arg = (x); \
@@ -3840,28 +3880,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",
- RTE_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",
- RTE_ETHER_ADDR_LEN * bp->max_l2_ctx);
- rc = -ENOMEM;
- goto error_free;
- }
- if (bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_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, RTE_ETHER_ADDR_LEN);
/* THOR does not support ring groups.
* But we will use the array to save RSS context IDs.
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index f691922bd..a9356c6b8 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4607,3 +4607,28 @@ int bnxt_hwrm_tunnel_redirect_info(struct bnxt *bp, uint8_t tun_type,
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, RTE_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, RTE_ETHER_ADDR_LEN);
+ HWRM_UNLOCK();
+
+ return rc;
+}
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index e35462cb4..37aaa1a9e 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -196,4 +196,5 @@ int bnxt_hwrm_tunnel_redirect_free(struct bnxt *bp, uint8_t type);
int bnxt_hwrm_tunnel_redirect_query(struct bnxt *bp, uint32_t *type);
int bnxt_hwrm_tunnel_redirect_info(struct bnxt *bp, uint8_t tun_type,
uint16_t *dst_fid);
+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 7d3342719..dda40af28 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)
+{
+ rte_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 2378833cc..9f1868a78 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.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 06/15] net/bnxt: fix L4 checksum error indication in Rx path
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (2 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 03/15] net/bnxt: do not fail VF probe when the MAC address is zero Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 07/15] net/bnxt: fix for doorbell register offset for Tx ring Ajit Khaparde
` (6 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Rahul Gupta, stable
From: Rahul Gupta <rahul.gupta@broadcom.com>
Update ol_flags correctly for checksum errors in case of tunnel and
non-tunnel packet.
Fixes: 65ee636872eb ("net/bnxt: fix Rx checksum flags")
Cc: stable@dpdk.org
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v3: Fix check-git-log output.
---
drivers/net/bnxt/bnxt_rxr.c | 43 ++++++++++---
drivers/net/bnxt/bnxt_rxr.h | 120 ++++++++++++++++++++++++++++++------
2 files changed, 133 insertions(+), 30 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 44303f3b0..54a2cf5fd 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -362,6 +362,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
int rc = 0;
uint8_t agg_buf = 0;
uint16_t cmp_type;
+ uint32_t flags2_f = 0;
rxcmp = (struct rx_pkt_cmpl *)
&cpr->cp_desc_ring[cp_cons];
@@ -440,19 +441,41 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
mbuf->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
}
- if (likely(RX_CMP_IP_CS_OK(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
- else if (likely(RX_CMP_IP_CS_UNKNOWN(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
- else
+ flags2_f = flags2_0xf(rxcmp1);
+ /* IP Checksum */
+ if (unlikely(((IS_IP_NONTUNNEL_PKT(flags2_f)) &&
+ (RX_CMP_IP_CS_ERROR(rxcmp1))) ||
+ (IS_IP_TUNNEL_PKT(flags2_f) &&
+ (RX_CMP_IP_OUTER_CS_ERROR(rxcmp1))))) {
mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
+ } else if (unlikely(RX_CMP_IP_CS_UNKNOWN(rxcmp1))) {
+ mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
+ } else {
+ mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+ }
- if (likely(RX_CMP_L4_CS_OK(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
- else if (likely(RX_CMP_L4_CS_UNKNOWN(rxcmp1)))
+ /* L4 Checksum */
+ if (likely(IS_L4_NONTUNNEL_PKT(flags2_f))) {
+ if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
+ mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+ else
+ mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
+ } else if (IS_L4_TUNNEL_PKT(flags2_f)) {
+ if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
+ mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+ else
+ mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
+ if (unlikely(RX_CMP_L4_OUTER_CS_ERR2(rxcmp1))) {
+ mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+ } else if (unlikely(IS_L4_TUNNEL_PKT_ONLY_INNER_L4_CS
+ (flags2_f))) {
+ mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_UNKNOWN;
+ } else {
+ mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+ }
+ } else if (unlikely(RX_CMP_L4_CS_UNKNOWN(rxcmp1))) {
mbuf->ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
- else
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+ }
mbuf->packet_type = bnxt_parse_pkt_type(rxcmp, rxcmp1);
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index 6523b94c6..6a80c37c8 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -24,36 +24,116 @@
#define BNXT_TPA_OUTER_L3_OFF(hdr_info) \
((hdr_info) & 0x1ff)
-#define RX_CMP_L4_CS_BITS \
- rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_L4_CS_CALC | \
- RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC)
-
-#define RX_CMP_L4_CS_ERR_BITS \
- rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_L4_CS_ERROR | \
- RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR)
+#define flags2_0xf(rxcmp1) \
+ (((rxcmp1)->flags2) & 0xf)
-#define RX_CMP_L4_CS_OK(rxcmp1) \
- (((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS) && \
- !((rxcmp1)->errors_v2 & RX_CMP_L4_CS_ERR_BITS))
+/* IP non tunnel can be with or without L4-
+ * Ether / (vlan) / IP|IP6 / UDP|TCP|SCTP Or
+ * Ether / (vlan) / outer IP|IP6 / ICMP
+ * we use '==' instead of '&' because tunnel pkts have all 4 fields set.
+ */
+#define IS_IP_NONTUNNEL_PKT(flags2_f) \
+ ( \
+ ((flags2_f) == \
+ (rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC))) || \
+ ((flags2_f) == \
+ (rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC | \
+ RX_PKT_CMPL_FLAGS2_L4_CS_CALC))) \
+ )
+
+/* IP Tunnel pkt must have atleast tunnel-IP-calc set.
+ * again tunnel ie outer L4 is optional bcoz of
+ * Ether / (vlan) / outer IP|IP6 / GRE / Ether / IP|IP6 / UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / outer UDP / VxLAN / Ether / IP|IP6 /
+ * UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / outer UDP / VXLAN-GPE / Ether / IP|IP6 /
+ * UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / outer UDP / VXLAN-GPE / IP|IP6 /
+ * UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / GRE / IP|IP6 / UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / IP|IP6 / UDP|TCP|SCTP
+ * also inner L3 chksum error is not taken into consideration by DPDK.
+ */
+#define IS_IP_TUNNEL_PKT(flags2_f) \
+ ((flags2_f) & rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC))
-#define RX_CMP_L4_CS_UNKNOWN(rxcmp1) \
- !((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS)
+/* RX_PKT_CMPL_ERRORS_IP_CS_ERROR only for Non-tunnel pkts.
+ * For tunnel pkts RX_PKT_CMPL_ERRORS_IP_CS_ERROR is not accounted and treated
+ * as good csum pkt.
+ */
+#define RX_CMP_IP_CS_ERROR(rxcmp1) \
+ ((rxcmp1)->errors_v2 & \
+ rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_IP_CS_ERROR))
-#define RX_CMP_IP_CS_ERR_BITS \
- rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_IP_CS_ERROR | \
- RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR)
+#define RX_CMP_IP_OUTER_CS_ERROR(rxcmp1) \
+ ((rxcmp1)->errors_v2 & \
+ rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR))
#define RX_CMP_IP_CS_BITS \
rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC | \
RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC)
-#define RX_CMP_IP_CS_OK(rxcmp1) \
- (((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS) && \
- !((rxcmp1)->errors_v2 & RX_CMP_IP_CS_ERR_BITS))
-
-#define RX_CMP_IP_CS_UNKNOWN(rxcmp1) \
+#define RX_CMP_IP_CS_UNKNOWN(rxcmp1) \
!((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS)
+/* L4 non tunnel pkt-
+ * Ether / (vlan) / IP6 / UDP|TCP|SCTP
+ */
+#define IS_L4_NONTUNNEL_PKT(flags2_f) \
+ ( \
+ ((flags2_f) == \
+ (rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC | \
+ RX_PKT_CMPL_FLAGS2_L4_CS_CALC))))
+
+/* L4 tunnel pkt-
+ * Outer L4 is not mandatory. Eg: GRE-
+ * Ether / (vlan) / outer IP|IP6 / GRE / Ether / IP|IP6 / UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / outer UDP / VxLAN / Ether / IP|IP6 /
+ * UDP|TCP|SCTP
+ */
+#define IS_L4_TUNNEL_PKT_INNER_OUTER_L4_CS(flags2_f) \
+ ((flags2_f) == \
+ (rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC | \
+ RX_PKT_CMPL_FLAGS2_L4_CS_CALC | \
+ RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC | \
+ RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC)))
+
+#define IS_L4_TUNNEL_PKT_ONLY_INNER_L4_CS(flags2_f) \
+ ((flags2_f) == \
+ (rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC | \
+ RX_PKT_CMPL_FLAGS2_L4_CS_CALC | \
+ RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC)))
+
+#define IS_L4_TUNNEL_PKT(flags2_f) \
+ ( \
+ IS_L4_TUNNEL_PKT_INNER_OUTER_L4_CS(flags2_f) || \
+ IS_L4_TUNNEL_PKT_ONLY_INNER_L4_CS(flags2_f) \
+ )
+
+#define RX_CMP_L4_CS_BITS \
+ rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_L4_CS_CALC)
+
+#define RX_CMP_L4_CS_UNKNOWN(rxcmp1) \
+ !((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS)
+
+#define RX_CMP_T_L4_CS_BITS \
+ rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC)
+
+#define RX_CMP_T_L4_CS_UNKNOWN(rxcmp1) \
+ !((rxcmp1)->flags2 & RX_CMP_T_L4_CS_BITS)
+
+/* Outer L4 chksum error
+ */
+#define RX_CMP_L4_OUTER_CS_ERR2(rxcmp1) \
+ ((rxcmp1)->errors_v2 & \
+ rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR))
+
+/* Inner L4 chksum error
+ */
+#define RX_CMP_L4_INNER_CS_ERR2(rxcmp1) \
+ ((rxcmp1)->errors_v2 & \
+ rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_L4_CS_ERROR))
+
#define BNXT_RX_POST_THRESH 32
enum pkt_hash_types {
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 07/15] net/bnxt: fix for doorbell register offset for Tx ring
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (3 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 06/15] net/bnxt: fix L4 checksum error indication in Rx path Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 08/15] net/bnxt: save the number of EM flow count Ajit Khaparde
` (5 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, stable, Rahul Gupta
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")
Cc: stable@dpdk.org
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v3: Fix output of check-git-log.
---
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 7453d4b56..9b19459b6 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -639,12 +639,12 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_TX;
rc = bnxt_hwrm_ring_alloc(bp, ring,
ring_type,
- idx, cpr->hw_stats_ctx_id,
+ i, cpr->hw_stats_ctx_id,
cp_ring->fw_ring_id);
if (rc)
goto err_out;
- bnxt_set_db(bp, &txr->tx_db, ring_type, idx, ring->fw_ring_id);
+ bnxt_set_db(bp, &txr->tx_db, ring_type, i, ring->fw_ring_id);
txq->index = idx;
bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
}
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 08/15] net/bnxt: save the number of EM flow count
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (4 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 07/15] net/bnxt: fix for doorbell register offset for Tx ring Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 11/15] net/bnxt: fix to enable disable interrupts correctly Ajit Khaparde
` (4 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, stable, Kalesh Anakkur Purayil
Save the number of EM flow count returned by the FW in HWRM_FUNC_QCFG
and use it to calculate the overall pool of L2 contexts supported by FW.
Fixes: 6d8109bcb398 ("net/bnxt: check VF resources if resource manager is enabled")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_hwrm.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 45e7359b2..cd809b385 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -429,6 +429,7 @@ struct bnxt {
uint16_t max_rx_rings;
uint16_t max_nq_rings;
uint16_t max_l2_ctx;
+ uint16_t max_rx_em_flows;
uint16_t max_vnics;
uint16_t max_stat_ctx;
uint16_t first_vf_id;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index b6f9ec0a0..84cda5e6c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -589,8 +589,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
bp->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings);
bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
bp->max_rx_rings = rte_le_to_cpu_16(resp->max_rx_rings);
- bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
bp->first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
+ bp->max_rx_em_flows = rte_le_to_cpu_16(resp->max_rx_em_flows);
+ bp->max_l2_ctx =
+ rte_le_to_cpu_16(resp->max_l2_ctxs) + bp->max_rx_em_flows;
/* TODO: For now, do not support VMDq/RFS on VFs. */
if (BNXT_PF(bp)) {
if (bp->pf.max_vfs)
@@ -796,7 +798,12 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
bp->max_rx_rings = rte_le_to_cpu_16(resp->max_rx_rings);
bp->max_ring_grps = rte_le_to_cpu_32(resp->max_hw_ring_grps);
- bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
+ /* func_resource_qcaps does not return max_rx_em_flows.
+ * So use the value provided by func_qcaps.
+ */
+ bp->max_l2_ctx =
+ rte_le_to_cpu_16(resp->max_l2_ctxs) +
+ bp->max_rx_em_flows;
bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
}
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 11/15] net/bnxt: fix to enable disable interrupts correctly
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (5 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 08/15] net/bnxt: save the number of EM flow count Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 12/15] net/bnxt: fix to check for invalid VNIC in cleanup path Ajit Khaparde
` (3 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
1. disable interrupts in dev_stop_op()
2. enable interrupts in dev_start_op()
3. Clean queue intr-vector mapping in dev_stop_op() and thus
fix a possible memory leak.
Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
Cc: stable@dpdk.org
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>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v3: Fix errors reported by check-git-log script.
---
drivers/net/bnxt/bnxt_ethdev.c | 17 ++++++++++++++++-
drivers/net/bnxt/bnxt_irq.c | 2 --
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e44df1881..538bed1a5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -779,6 +779,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
+ bnxt_enable_int(bp);
bp->flags |= BNXT_FLAG_INIT_DONE;
return 0;
@@ -818,6 +819,13 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+
+ bnxt_disable_int(bp);
+
+ /* disable uio/vfio intr/eventfd mapping */
+ rte_intr_disable(intr_handle);
bp->flags &= ~BNXT_FLAG_INIT_DONE;
if (bp->eth_dev->data->dev_started) {
@@ -825,6 +833,14 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
eth_dev->data->dev_link.link_status = 0;
}
bnxt_set_hwrm_link_config(bp, false);
+
+ /* Clean queue intr-vector mapping */
+ rte_intr_efd_disable(intr_handle);
+ if (intr_handle->intr_vec != NULL) {
+ rte_free(intr_handle->intr_vec);
+ intr_handle->intr_vec = NULL;
+ }
+
bnxt_hwrm_port_clr_stats(bp);
bnxt_free_tx_mbufs(bp);
bnxt_free_rx_mbufs(bp);
@@ -3991,7 +4007,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
if (rc)
goto error_free_int;
- bnxt_enable_int(bp);
bnxt_init_nic(bp);
return 0;
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 61f7498a5..6c4dce401 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -58,7 +58,6 @@ void bnxt_free_int(struct bnxt *bp)
irq = bp->irq_tbl;
if (irq) {
if (irq->requested) {
- rte_intr_disable(&bp->pdev->intr_handle);
rte_intr_callback_unregister(&bp->pdev->intr_handle,
irq->handler,
(void *)bp->eth_dev);
@@ -123,7 +122,6 @@ int bnxt_request_int(struct bnxt *bp)
rte_intr_callback_register(&bp->pdev->intr_handle, irq->handler,
(void *)bp->eth_dev);
- rte_intr_enable(&bp->pdev->intr_handle);
irq->requested = 1;
return rc;
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 12/15] net/bnxt: fix to check for invalid VNIC in cleanup path
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (6 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 11/15] net/bnxt: fix to enable disable interrupts correctly Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 13/15] net/bnxt: fix a compilation warning Ajit Khaparde
` (2 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
The cleanup/rollback operation post rte_eth_dev_start failure might end
up invoking an HWRM cmd even on an invalid vNIC resulting in error
messages being logged needlessly.
Fix to check for the same before issuing the HWRM cmd.
Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
Cc: stable@dpdk.org
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>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 84cda5e6c..1a0265f8a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2325,6 +2325,11 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp)
for (i = bp->nr_vnics - 1; i >= 0; i--) {
struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+ if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+ PMD_DRV_LOG(DEBUG, "Invalid vNIC ID\n");
+ return;
+ }
+
bnxt_clear_hwrm_vnic_flows(bp, vnic);
bnxt_clear_hwrm_vnic_filters(bp, vnic);
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 13/15] net/bnxt: fix a compilation warning
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (7 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 12/15] net/bnxt: fix to check for invalid VNIC in cleanup path Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 14/15] net/bnxt: fix rxq count if ntuple filtering is disabled Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 15/15] net/bnxt: fix to avoid sending invalid VNIC id to firmware Ajit Khaparde
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, stable, Rahul Gupta
Compiler complains of an uninitialized variable.
Initializing it to avoid the issue.
Fixes: db678d5c2b54 ("net/bnxt: add HWRM VNIC configure")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 1a0265f8a..a4e0c2e0c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1523,8 +1523,8 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
int rc = 0;
struct hwrm_vnic_cfg_input req = {.req_type = 0 };
struct hwrm_vnic_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+ struct bnxt_plcmodes_cfg pmodes = { 0 };
uint32_t ctx_enable_flag = 0;
- struct bnxt_plcmodes_cfg pmodes;
uint32_t enables = 0;
if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 14/15] net/bnxt: fix rxq count if ntuple filtering is disabled
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (8 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 13/15] net/bnxt: fix a compilation warning Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 15/15] net/bnxt: fix to avoid sending invalid VNIC id to firmware Ajit Khaparde
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Qingmin Liu, stable, Randy Schacher, Somnath Kotur
From: Qingmin Liu <qingmin.liu@broadcom.com>
If ntuple filtering is disabled, FW will return max_vnics=1.
Due to this only single Rxq is created.
Change to max_rx_rings = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx) to
fix it.
Fixes: 6d8109bcb398 ("net/bnxt: check VF resources if resource manager is enabled")
Cc: stable@dpdk.org
Signed-off-by: Qingmin Liu <qingmin.liu@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Tested-by: Qingmin Liu <qingmin.liu@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 538bed1a5..cd87d0dbc 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -493,7 +493,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
/* PF/VF specifics */
if (BNXT_PF(bp))
dev_info->max_vfs = bp->pdev->max_vfs;
- max_rx_rings = RTE_MIN(bp->max_vnics, bp->max_stat_ctx);
+ max_rx_rings = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx);
/* For the sake of symmetry, max_rx_queues = max_tx_queues */
dev_info->max_rx_queues = max_rx_rings;
dev_info->max_tx_queues = max_rx_rings;
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-stable] [PATCH v3 15/15] net/bnxt: fix to avoid sending invalid VNIC id to firmware
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
` (9 preceding siblings ...)
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 14/15] net/bnxt: fix rxq count if ntuple filtering is disabled Ajit Khaparde
@ 2019-07-17 10:41 ` Ajit Khaparde
10 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2019-07-17 10:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, Jay Ding, stable, Randy Schacher
From: Jay Ding <jay.ding@broadcom.com>
Add checking for vinc id before sending message to chimp in
bnxt_hwrm_vnic_plcmode_cfg().
Fixes: db678d5c2b54 ("net/bnxt: add HWRM VNIC configure")
Cc: stable@dpdk.org
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index a4e0c2e0c..313459aaf 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1497,6 +1497,11 @@ static int bnxt_hwrm_vnic_plcmodes_cfg(struct bnxt *bp,
struct hwrm_vnic_plcmodes_cfg_input req = {.req_type = 0 };
struct hwrm_vnic_plcmodes_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+ if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+ PMD_DRV_LOG(DEBUG, "VNIC ID %x\n", vnic->fw_vnic_id);
+ return rc;
+ }
+
HWRM_PREP(req, VNIC_PLCMODES_CFG, BNXT_USE_CHIMP_MB);
req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-07-17 10:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <0c1b327c-2c36-652f-c88d-cbca8f873c13@intel.com>
[not found] ` <20190717104139.21155-1-ajit.khaparde@broadcom.com>
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 01/15] net/bnxt: fix extended port counter statistics Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 02/15] net/bnxt: fix possible segfault in case of probe failure Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 03/15] net/bnxt: do not fail VF probe when the MAC address is zero Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 06/15] net/bnxt: fix L4 checksum error indication in Rx path Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 07/15] net/bnxt: fix for doorbell register offset for Tx ring Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 08/15] net/bnxt: save the number of EM flow count Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 11/15] net/bnxt: fix to enable disable interrupts correctly Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 12/15] net/bnxt: fix to check for invalid VNIC in cleanup path Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 13/15] net/bnxt: fix a compilation warning Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 14/15] net/bnxt: fix rxq count if ntuple filtering is disabled Ajit Khaparde
2019-07-17 10:41 ` [dpdk-stable] [PATCH v3 15/15] net/bnxt: fix to avoid sending invalid VNIC id to firmware Ajit Khaparde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).