* [dpdk-dev] [PATCH v2 0/3] bnxt patchset
@ 2018-04-20 4:08 Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 4:08 UTC (permalink / raw)
To: dev
Please apply.
Ajit Khaparde (3):
net/bnxt: cache address of doorbell to subsequent access
net/bnxt: fix set_rx_mask from using invalid vnic id
net/bnxt: fix mbuf data_off initialization
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_cpr.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 19 ++++++++++++++-----
drivers/net/bnxt/bnxt_hwrm.c | 3 +++
drivers/net/bnxt/bnxt_ring.c | 17 +++++------------
drivers/net/bnxt/bnxt_rxr.c | 2 ++
6 files changed, 26 insertions(+), 18 deletions(-)
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2 1/3] net/bnxt: cache address of doorbell to subsequent access
2018-04-20 4:08 [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ajit Khaparde
@ 2018-04-20 4:08 ` Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 2/3] net/bnxt: fix set_rx_mask from using invalid vnic id Ajit Khaparde
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 4:08 UTC (permalink / raw)
To: dev
While creating TX, Rx, CQ rings use cached DB address instead of
getting it from the PCI memory resource.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_cpr.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++++++
drivers/net/bnxt/bnxt_ring.c | 17 +++++------------
4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index bdca2622f..97b0e0853 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -208,6 +208,7 @@ struct bnxt {
struct rte_eth_dev *eth_dev;
struct rte_eth_rss_conf rss_conf;
struct rte_pci_device *pdev;
+ void *doorbell_base;
uint32_t flags;
#define BNXT_FLAG_REGISTERED (1 << 0)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 5ac197ea7..8dde8cc0f 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -144,7 +144,7 @@ int bnxt_alloc_def_cp_ring(struct bnxt *bp)
HWRM_NA_SIGNATURE);
if (rc)
goto err_out;
- cpr->cp_doorbell = bp->pdev->mem_resource[2].addr;
+ cpr->cp_doorbell = (char *)bp->doorbell_base;
B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
if (BNXT_PF(bp))
rc = bnxt_hwrm_func_cfg_def_cp(bp);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7632c326b..a133114a3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3095,11 +3095,23 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
rc = -ENOMEM;
goto init_err_release;
}
+
+ if (!pci_dev->mem_resource[2].addr) {
+ PMD_DRV_LOG(ERR,
+ "Cannot find PCI device BAR 2 address, aborting\n");
+ rc = -ENODEV;
+ goto init_err_release;
+ } else {
+ bp->doorbell_base = (void *)pci_dev->mem_resource[2].addr;
+ }
+
return 0;
init_err_release:
if (bp->bar0)
bp->bar0 = NULL;
+ if (bp->doorbell_base)
+ bp->doorbell_base = NULL;
init_err_disable:
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 478eab4f3..8e822e11f 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -261,7 +261,6 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
*/
int bnxt_alloc_hwrm_rings(struct bnxt *bp)
{
- struct rte_pci_device *pci_dev = bp->pdev;
unsigned int i;
int rc = 0;
@@ -283,8 +282,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
HWRM_NA_SIGNATURE);
if (rc)
goto err_out;
- cpr->cp_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ cpr->cp_doorbell = (char *)bp->doorbell_base + idx * 0x80;
bp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id;
B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
@@ -296,8 +294,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
if (rc)
goto err_out;
rxr->rx_prod = 0;
- rxr->rx_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ rxr->rx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
bp->grp_info[i].rx_fw_ring_id = ring->fw_ring_id;
B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
@@ -316,9 +313,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
goto err_out;
PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
rxr->ag_prod = 0;
- rxr->ag_doorbell =
- (char *)pci_dev->mem_resource[2].addr +
- map_idx * 0x80;
+ rxr->ag_doorbell = (char *)bp->doorbell_base + map_idx * 0x80;
bp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id;
B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
@@ -350,8 +345,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
if (rc)
goto err_out;
- cpr->cp_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ cpr->cp_doorbell = (char *)bp->doorbell_base + idx * 0x80;
B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
/* Tx ring */
@@ -362,8 +356,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
if (rc)
goto err_out;
- txr->tx_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ txr->tx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
txq->index = idx;
}
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2 2/3] net/bnxt: fix set_rx_mask from using invalid vnic id
2018-04-20 4:08 [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
@ 2018-04-20 4:08 ` Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 3/3] net/bnxt: fix mbuf data_off initialization Ajit Khaparde
2018-04-20 10:20 ` [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ferruh Yigit
3 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 4:08 UTC (permalink / raw)
To: dev; +Cc: stable
In some cases bnxt_hwrm_cfa_l2_set_rx_mask is being called before
VNICs are allocated. The FW returns an error in such cases.
Move bnxt_init_nic to bnxt_dev_init such that the ids are initialized
to an invalid id.
Prevent sending the command to the FW only with a valid vnic id.
Fixes: 244bc98b0da7 ("net/bnxt: set L2 Rx mask")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: update commit message and commit log
---
drivers/net/bnxt/bnxt_ethdev.c | 7 ++-----
drivers/net/bnxt/bnxt_hwrm.c | 3 +++
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a133114a3..348129dad 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -395,10 +395,6 @@ static int bnxt_init_nic(struct bnxt *bp)
bnxt_init_vnics(bp);
bnxt_init_filters(bp);
- rc = bnxt_init_chip(bp);
- if (rc)
- return rc;
-
return 0;
}
@@ -594,7 +590,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
}
bp->dev_stopped = 0;
- rc = bnxt_init_nic(bp);
+ rc = bnxt_init_chip(bp);
if (rc)
goto error;
@@ -3398,6 +3394,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
goto error_free_int;
bnxt_enable_int(bp);
+ bnxt_init_nic(bp);
return 0;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 11204bf42..bc8773509 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -221,6 +221,9 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp,
struct hwrm_cfa_l2_set_rx_mask_output *resp = bp->hwrm_cmd_resp_addr;
uint32_t mask = 0;
+ if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+ return rc;
+
HWRM_PREP(req, CFA_L2_SET_RX_MASK);
req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2 3/3] net/bnxt: fix mbuf data_off initialization
2018-04-20 4:08 [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 2/3] net/bnxt: fix set_rx_mask from using invalid vnic id Ajit Khaparde
@ 2018-04-20 4:08 ` Ajit Khaparde
2018-04-20 10:20 ` [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ferruh Yigit
3 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 4:08 UTC (permalink / raw)
To: dev; +Cc: stable
Initialize mbuf->data_off to RTE_PKTMBUF_HEADROOM after allocation.
Without this, it might be possible that the DMA address provided
to the HW may not be in sync to what is indicated to the application
in bnxt_rx_pkt.
Fixes: 2eb53b134aae ("net/bnxt: add initial Rx code")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: update commit message and commit log
---
drivers/net/bnxt/bnxt_rxr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 4bc320430..7b956ac78 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -46,6 +46,7 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
}
rx_buf->mbuf = mbuf;
+ mbuf->data_off = RTE_PKTMBUF_HEADROOM;
rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
@@ -73,6 +74,7 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
rx_buf->mbuf = mbuf;
+ mbuf->data_off = RTE_PKTMBUF_HEADROOM;
rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] bnxt patchset
2018-04-20 4:08 [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ajit Khaparde
` (2 preceding siblings ...)
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 3/3] net/bnxt: fix mbuf data_off initialization Ajit Khaparde
@ 2018-04-20 10:20 ` Ferruh Yigit
2018-04-20 10:46 ` Thomas Monjalon
3 siblings, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2018-04-20 10:20 UTC (permalink / raw)
To: Ajit Khaparde, dev; +Cc: Thomas Monjalon
On 4/20/2018 5:08 AM, Ajit Khaparde wrote:
> Please apply.
>
> Ajit Khaparde (3):
> net/bnxt: cache address of doorbell to subsequent access
> net/bnxt: fix set_rx_mask from using invalid vnic id
> net/bnxt: fix mbuf data_off initialization
Hi Ajit,
Still getting warnings with check-git-log.sh [1], can you please check?
$ ./devtools/check-git-log.sh -3
Wrong headline format:
net/bnxt: fix set_rx_mask from using invalid vnic id
net/bnxt: fix mbuf data_off initialization
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] bnxt patchset
2018-04-20 10:20 ` [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ferruh Yigit
@ 2018-04-20 10:46 ` Thomas Monjalon
2018-04-20 14:21 ` [dpdk-dev] [PATCH v3 " Ajit Khaparde
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2018-04-20 10:46 UTC (permalink / raw)
To: Ajit Khaparde; +Cc: Ferruh Yigit, dev
20/04/2018 12:20, Ferruh Yigit:
> On 4/20/2018 5:08 AM, Ajit Khaparde wrote:
> > Please apply.
> >
> > Ajit Khaparde (3):
> > net/bnxt: cache address of doorbell to subsequent access
> > net/bnxt: fix set_rx_mask from using invalid vnic id
> > net/bnxt: fix mbuf data_off initialization
>
> Hi Ajit,
>
> Still getting warnings with check-git-log.sh [1], can you please check?
>
> $ ./devtools/check-git-log.sh -3
> Wrong headline format:
> net/bnxt: fix set_rx_mask from using invalid vnic id
> net/bnxt: fix mbuf data_off initialization
It's better to use real english words or well know abbreviations for patch titles.
Example:
net/bnxt: avoid invalid vNIC in L2 Rx mask
net/bnxt: fix mbuf data offset initialization
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v3 0/3] bnxt patchset
2018-04-20 10:46 ` Thomas Monjalon
@ 2018-04-20 14:21 ` Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 14:21 UTC (permalink / raw)
To: dev
Apologize for the multiple iterations.
Please apply.
Ajit Khaparde (3):
net/bnxt: cache address of doorbell to subsequent access
net/bnxt: avoid invalid vnic id in set L2 Rx mask
net/bnxt: fix mbuf data offset initialization
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_cpr.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 19 ++++++++++++++-----
drivers/net/bnxt/bnxt_hwrm.c | 3 +++
drivers/net/bnxt/bnxt_ring.c | 17 +++++------------
drivers/net/bnxt/bnxt_rxr.c | 2 ++
6 files changed, 26 insertions(+), 18 deletions(-)
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v3 1/3] net/bnxt: cache address of doorbell to subsequent access
2018-04-20 14:21 ` [dpdk-dev] [PATCH v3 " Ajit Khaparde
@ 2018-04-20 14:22 ` Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 2/3] net/bnxt: avoid invalid vnic id in set L2 Rx mask Ajit Khaparde
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 14:22 UTC (permalink / raw)
To: dev
While creating TX, Rx, CQ rings use cached DB address instead of
getting it from the PCI memory resource.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_cpr.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++++++
drivers/net/bnxt/bnxt_ring.c | 17 +++++------------
4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index bdca2622f..97b0e0853 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -208,6 +208,7 @@ struct bnxt {
struct rte_eth_dev *eth_dev;
struct rte_eth_rss_conf rss_conf;
struct rte_pci_device *pdev;
+ void *doorbell_base;
uint32_t flags;
#define BNXT_FLAG_REGISTERED (1 << 0)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 5ac197ea7..8dde8cc0f 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -144,7 +144,7 @@ int bnxt_alloc_def_cp_ring(struct bnxt *bp)
HWRM_NA_SIGNATURE);
if (rc)
goto err_out;
- cpr->cp_doorbell = bp->pdev->mem_resource[2].addr;
+ cpr->cp_doorbell = (char *)bp->doorbell_base;
B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
if (BNXT_PF(bp))
rc = bnxt_hwrm_func_cfg_def_cp(bp);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7632c326b..a133114a3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3095,11 +3095,23 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
rc = -ENOMEM;
goto init_err_release;
}
+
+ if (!pci_dev->mem_resource[2].addr) {
+ PMD_DRV_LOG(ERR,
+ "Cannot find PCI device BAR 2 address, aborting\n");
+ rc = -ENODEV;
+ goto init_err_release;
+ } else {
+ bp->doorbell_base = (void *)pci_dev->mem_resource[2].addr;
+ }
+
return 0;
init_err_release:
if (bp->bar0)
bp->bar0 = NULL;
+ if (bp->doorbell_base)
+ bp->doorbell_base = NULL;
init_err_disable:
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 478eab4f3..8e822e11f 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -261,7 +261,6 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
*/
int bnxt_alloc_hwrm_rings(struct bnxt *bp)
{
- struct rte_pci_device *pci_dev = bp->pdev;
unsigned int i;
int rc = 0;
@@ -283,8 +282,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
HWRM_NA_SIGNATURE);
if (rc)
goto err_out;
- cpr->cp_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ cpr->cp_doorbell = (char *)bp->doorbell_base + idx * 0x80;
bp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id;
B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
@@ -296,8 +294,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
if (rc)
goto err_out;
rxr->rx_prod = 0;
- rxr->rx_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ rxr->rx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
bp->grp_info[i].rx_fw_ring_id = ring->fw_ring_id;
B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
@@ -316,9 +313,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
goto err_out;
PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
rxr->ag_prod = 0;
- rxr->ag_doorbell =
- (char *)pci_dev->mem_resource[2].addr +
- map_idx * 0x80;
+ rxr->ag_doorbell = (char *)bp->doorbell_base + map_idx * 0x80;
bp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id;
B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
@@ -350,8 +345,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
if (rc)
goto err_out;
- cpr->cp_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ cpr->cp_doorbell = (char *)bp->doorbell_base + idx * 0x80;
B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
/* Tx ring */
@@ -362,8 +356,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
if (rc)
goto err_out;
- txr->tx_doorbell = (char *)pci_dev->mem_resource[2].addr +
- idx * 0x80;
+ txr->tx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
txq->index = idx;
}
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v3 2/3] net/bnxt: avoid invalid vnic id in set L2 Rx mask
2018-04-20 14:21 ` [dpdk-dev] [PATCH v3 " Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
@ 2018-04-20 14:22 ` Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 3/3] net/bnxt: fix mbuf data offset initialization Ajit Khaparde
2018-04-20 14:54 ` [dpdk-dev] [PATCH v3 0/3] bnxt patchset Ferruh Yigit
3 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 14:22 UTC (permalink / raw)
To: dev; +Cc: stable
In some cases bnxt_hwrm_cfa_l2_set_rx_mask is being called before
VNICs are allocated. The FW returns an error in such cases.
Move bnxt_init_nic to bnxt_dev_init such that the ids are initialized
to an invalid id.
Prevent sending the command to the FW only with a valid vnic id.
Fixes: 244bc98b0da7 ("net/bnxt: set L2 Rx mask")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: update commit message and commit log
v2->v3: fix commit log as suggested
---
drivers/net/bnxt/bnxt_ethdev.c | 7 ++-----
drivers/net/bnxt/bnxt_hwrm.c | 3 +++
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a133114a3..348129dad 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -395,10 +395,6 @@ static int bnxt_init_nic(struct bnxt *bp)
bnxt_init_vnics(bp);
bnxt_init_filters(bp);
- rc = bnxt_init_chip(bp);
- if (rc)
- return rc;
-
return 0;
}
@@ -594,7 +590,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
}
bp->dev_stopped = 0;
- rc = bnxt_init_nic(bp);
+ rc = bnxt_init_chip(bp);
if (rc)
goto error;
@@ -3398,6 +3394,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
goto error_free_int;
bnxt_enable_int(bp);
+ bnxt_init_nic(bp);
return 0;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 11204bf42..bc8773509 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -221,6 +221,9 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp,
struct hwrm_cfa_l2_set_rx_mask_output *resp = bp->hwrm_cmd_resp_addr;
uint32_t mask = 0;
+ if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+ return rc;
+
HWRM_PREP(req, CFA_L2_SET_RX_MASK);
req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v3 3/3] net/bnxt: fix mbuf data offset initialization
2018-04-20 14:21 ` [dpdk-dev] [PATCH v3 " Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 2/3] net/bnxt: avoid invalid vnic id in set L2 Rx mask Ajit Khaparde
@ 2018-04-20 14:22 ` Ajit Khaparde
2018-04-20 14:54 ` [dpdk-dev] [PATCH v3 0/3] bnxt patchset Ferruh Yigit
3 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2018-04-20 14:22 UTC (permalink / raw)
To: dev; +Cc: stable
Initialize mbuf->data_off to RTE_PKTMBUF_HEADROOM after allocation.
Without this, it might be possible that the DMA address provided
to the HW may not be in sync to what is indicated to the application
in bnxt_rx_pkt.
Fixes: 2eb53b134aae ("net/bnxt: add initial Rx code")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: update commit message and commit log
v2->v3: fix commit log as suggested
---
drivers/net/bnxt/bnxt_rxr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 4bc320430..7b956ac78 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -46,6 +46,7 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
}
rx_buf->mbuf = mbuf;
+ mbuf->data_off = RTE_PKTMBUF_HEADROOM;
rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
@@ -73,6 +74,7 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
rx_buf->mbuf = mbuf;
+ mbuf->data_off = RTE_PKTMBUF_HEADROOM;
rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
--
2.15.1 (Apple Git-101)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/3] bnxt patchset
2018-04-20 14:21 ` [dpdk-dev] [PATCH v3 " Ajit Khaparde
` (2 preceding siblings ...)
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 3/3] net/bnxt: fix mbuf data offset initialization Ajit Khaparde
@ 2018-04-20 14:54 ` Ferruh Yigit
3 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2018-04-20 14:54 UTC (permalink / raw)
To: Ajit Khaparde, dev
On 4/20/2018 3:21 PM, Ajit Khaparde wrote:
> Apologize for the multiple iterations.
> Please apply.
>
> Ajit Khaparde (3):
> net/bnxt: cache address of doorbell to subsequent access
> net/bnxt: avoid invalid vnic id in set L2 Rx mask
> net/bnxt: fix mbuf data offset initialization
Series applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-04-20 14:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 4:08 [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 2/3] net/bnxt: fix set_rx_mask from using invalid vnic id Ajit Khaparde
2018-04-20 4:08 ` [dpdk-dev] [PATCH v2 3/3] net/bnxt: fix mbuf data_off initialization Ajit Khaparde
2018-04-20 10:20 ` [dpdk-dev] [PATCH v2 0/3] bnxt patchset Ferruh Yigit
2018-04-20 10:46 ` Thomas Monjalon
2018-04-20 14:21 ` [dpdk-dev] [PATCH v3 " Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 2/3] net/bnxt: avoid invalid vnic id in set L2 Rx mask Ajit Khaparde
2018-04-20 14:22 ` [dpdk-dev] [PATCH v3 3/3] net/bnxt: fix mbuf data offset initialization Ajit Khaparde
2018-04-20 14:54 ` [dpdk-dev] [PATCH v3 0/3] bnxt patchset Ferruh Yigit
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).