bnxt patch series
cover bnxt patch series
Patchset fixing various bugs in bnxt PMD based on recent patch submission.
https://patchwork.dpdk.org/patch/56311/
Ajit Khaparde (3):
net/bnxt: fix for doorbell register offset for Tx ring. net/bnxt: save the number of EM flow count net/bnxt: fix a compilation warning
Jay Ding (1):
net/bnxt: fix to avoid sending invalid VNIC id to firmware
Kalesh AP (5):
net/bnxt: fix extended port counter statistics net/bnxt: fix possible segfault in case of probe failure net/bnxt: do not fail VF probe when the MAC address is zero net/bnxt: fix to enable disable interrupts correctly in start stop net/bnxt: fix to check for invalid VNIC in cleanup path
Lance Richardson (4):
net/bnxt: fix Tx hang after port stop/start net/bnxt: reset Rx allocation state on port restart net/bnxt: nq doorbell cleanups
net/bnxt: avoid null pointer dereference
Qingmin Liu (1):
net/bnxt: fix rxq count if ntuple filtering is disabled
Rahul Gupta (1):
net/bnxt: correctly set L4 checksum error for tunnel and non-tunnel
packets
drivers/net/bnxt/bnxt.h | 3 + drivers/net/bnxt/bnxt_ethdev.c | 307 +++++++++++++++++++-------------- drivers/net/bnxt/bnxt_hwrm.c | 56 +++++- drivers/net/bnxt/bnxt_hwrm.h | 1 + drivers/net/bnxt/bnxt_irq.c | 5 +- drivers/net/bnxt/bnxt_ring.c | 11 +- drivers/net/bnxt/bnxt_ring.h | 23 ++- drivers/net/bnxt/bnxt_rxr.c | 43 +++-- drivers/net/bnxt/bnxt_rxr.h | 120 ++++++++++--- drivers/net/bnxt/bnxt_util.c | 11 ++ drivers/net/bnxt/bnxt_util.h | 1 + drivers/net/bnxt/bnxt_vnic.c | 3 + 12 files changed, 409 insertions(+), 175 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 1/15 net/bnxt: fix extended port counter statistics
From: Kalesh AP <[email protected]>
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.
--- 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(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -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))
drivers/net/bnxt/bnxt_ethdev.c +119 -107
251 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.c +5 -2
@@ -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 )); }
Signature · 1 line
2.20.1 (Apple Git-117)
Re: [dpdk-dev] [PATCH 01/15] net/bnxt: fix extended port counter statistics
drivers/net/bnxt/bnxt_ethdev.c int bnxt_alloc_ctx_mem(struct bnxt *bp) · line 3656
Quoted 4 lines · On Fri, 12 Jul 2019 11:36:08 +0530 Ajit Khaparde <[email protected]>…
drivers/net/bnxt/bnxt_ethdev.c +4
-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" );
You could use the PCI_PRI_FMT definition from rte_pci.h here.
PATCH 2/15 net/bnxt: fix possible segfault in case of probe failure
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Fixed couple of possible segfaults due to NULL pointer dereference in case of probe failure.
--- drivers/net/bnxt/bnxt_irq.c | 3 +++ drivers/net/bnxt/bnxt_vnic.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/bnxt/bnxt_irq.c +3 -0
@@ -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) {
drivers/net/bnxt/bnxt_vnic.c +3 -0
@@ -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) {
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 3/15 net/bnxt: do not fail VF probe when the MAC address is zero
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- 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(-)
drivers/net/bnxt/bnxt_ethdev.c +42 -20
@@ -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.
drivers/net/bnxt/bnxt_hwrm.c +25 -0
@@ -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; +}
drivers/net/bnxt/bnxt_hwrm.h +1 -0
@@ -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
drivers/net/bnxt/bnxt_util.c +11 -0
@@ -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 ; +}
drivers/net/bnxt/bnxt_util.h +1 -0
@@ -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_ */
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 4/15 net/bnxt: fix Tx hang after port stop/start
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Initialize the state of the the completion valid indicator when a completion ring is freed, otherwise completions may not be processed when a new ring is allocated.
--- drivers/net/bnxt/bnxt_hwrm.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
@@ -2089,6 +2089,7 @@ static void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)memset (cpr->cp_desc_ring,0 , cpr->cp_ring_struct->ring_size *sizeof (*cpr->cp_desc_ring)); cpr->cp_raw_cons =0 ; + cpr->valid =0 ; }void bnxt_free_hwrm_rx_ring (struct bnxt *bp,int queue_index)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 5/15 net/bnxt: reset Rx allocation state on port restart
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Move call site of bnxt_rxq_vec_setup() to ensure that rxq->rxrearm_nb and rxq->rxrearm_start are reinitialized correctly when a port is restarted.
--- drivers/net/bnxt/bnxt_ring.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_ring.c +3 -0
@@ -613,6 +613,9 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)bnxt_db_write (&rxr->rx_db, rxr->rx_prod);bnxt_db_write (&rxr->ag_db, rxr->ag_prod); rxq->index = i; +#ifdef RTE_LIBRTE_BNXT_INC_VECTOR +bnxt_rxq_vec_setup (rxq); +#endif }for (i =0 ; i < bp->tx_cp_nr_rings; i++) {
Signature · 1 line
2.20.1 (Apple Git-117)
Re: [dpdk-dev] [PATCH 05/15] net/bnxt: reset Rx allocation state on port restart
Quoted 20 lines · Ajit Khaparde
From: Lance Richardson <[email protected]>
Move call site of
bnxt_rxq_vec_setup()to ensure thatrxq->rxrearm_nbandrxq->rxrearm_startare reinitialized correctly when a port is restarted.Fixes af3ed597e305 ("net/bnxt: initial vector-mode driver")Reviewed-by Christopher Reder <[email protected]>Signed-off-by Lance Richardson <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>--- drivers/net/bnxt/bnxt_ring.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/bnxt/bnxt_ring.c +0
-0
drivers/net/bnxt/bnxt_ring.c int bnxt_alloc_hwrm_rings(struct bnxt *bp) · line 616
Quoted 4 lines
drivers/net/bnxt/bnxt_ring.c +1
-0@@ -613,6 +613,9 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)bnxt_db_write (&rxr->rx_db, rxr->rx_prod);bnxt_db_write (&rxr->ag_db, rxr->ag_prod); rxq->index = i; +#ifdef RTE_LIBRTE_BNXT_INC_VECTOR
This #ifdef should be removed, the macro is never defined in upstream.
Quoted 8 lines
drivers/net/bnxt/bnxt_ring.c +2
-1+bnxt_rxq_vec_setup (rxq); +#endif }for (i =0 ; i < bp->tx_cp_nr_rings; i++) { --2.20.1 (Apple Git-117)
Re: [dpdk-dev] [PATCH 05/15] net/bnxt: reset Rx allocation state on port restart
Quoted 18 lines · Lance Richardson
Quoted 15 lines · Ajit Khaparde
From: Lance Richardson <[email protected]>
Move call site of
bnxt_rxq_vec_setup()to ensure thatrxq->rxrearm_nbandrxq->rxrearm_startare reinitialized correctly when a port is restarted.Fixes af3ed597e305 ("net/bnxt: initial vector-mode driver")Reviewed-by Christopher Reder <[email protected]>Signed-off-by Lance Richardson <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>--- drivers/net/bnxt/bnxt_ring.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 11 lines
drivers/net/bnxt/bnxt_ring.c int bnxt_alloc_hwrm_rings(struct bnxt *bp) · line 616
Quoted 9 lines
drivers/net/bnxt/bnxt_ring.c +1
-0@@ -613,6 +613,9 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)bnxt_db_write (&rxr->rx_db, rxr->rx_prod);bnxt_db_write (&rxr->ag_db, rxr->ag_prod); rxq->index = i; +#ifdef RTE_LIBRTE_BNXT_INC_VECTOR This #ifdef should be removed, the macro is never defined in upstream.
Correction, it needs to be changed to "#ifdef RTE_ARCH_X86".
Lance
Quoted 9 lines
Quoted 9 lines
drivers/net/bnxt/bnxt_ring.c +2
-1+bnxt_rxq_vec_setup (rxq); +#endif }for (i =0 ; i < bp->tx_cp_nr_rings; i++) { --2.20.1 (Apple Git-117)
PATCH 6/15 net/bnxt: correctly set L4 checksum error for tunnel and non-tunnel packets
In reply to Ajit KhapardeFrom: Rahul Gupta <[email protected]>
Update ol_flags correctly for checksum errors in case of tunnel and non-tunnel packet.
--- drivers/net/bnxt/bnxt_rxr.c | 43 ++++++++++--- drivers/net/bnxt/bnxt_rxr.h | 120 ++++++++++++++++++++++++++++++------ 2 files changed, 133 insertions(+), 30 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +33 -10
@@ -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);
drivers/net/bnxt/bnxt_rxr.h +100 -20
136 lines not on this page · raw message
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 7/15 net/bnxt: fix for doorbell register offset for Tx ring.
In reply to Ajit KhapardeFor 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.
--- drivers/net/bnxt/bnxt_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ring.c +2 -2
@@ -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); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 8/15 net/bnxt: save the number of EM flow count
In reply to Ajit KhapardeSave 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.
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_hwrm.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -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;
drivers/net/bnxt/bnxt_hwrm.c +9 -2
@@ -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); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 9/15 net/bnxt: nq doorbell cleanups
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Simplify nq doorbell handling code by removing redundant db parameter and consolidating NQ doorbell macro into the inline function that uses it.
Add "enable interrupt" variant of nq write. This will be used in a subsequent commit.
When initializing nq doorbell, don't assume that only the "disable interrupt" form will be used.
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_ring.c | 2 +- drivers/net/bnxt/bnxt_ring.h | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -246,6 +246,7 @@ struct bnxt_coal {#define DBR_TYPE_SRQ (0x2ULL << 60)#define DBR_TYPE_CQ (0x4ULL << 60)#define DBR_TYPE_NQ (0xaULL << 60) +#define DBR_TYPE_NQ_ARM (0xbULL << 60)#define BNXT_RSS_TBL_SIZE_THOR 512#define BNXT_RSS_ENTRIES_PER_CTX_THOR 64
drivers/net/bnxt/bnxt_ring.c +1 -1
@@ -341,7 +341,7 @@ static void bnxt_set_db(struct bnxt *bp, db->db_key64 =DBR_PATH_L2 |DBR_TYPE_CQ ;break ;case HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ : - db->db_key64 =DBR_PATH_L2 |DBR_TYPE_NQ ; + db->db_key64 =DBR_PATH_L2 ;break ; } db->db_key64 |= (uint64_t )fid <<DBR_XID_SFT ;
drivers/net/bnxt/bnxt_ring.h +18 -5
@@ -84,15 +84,28 @@ static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)rte_write32 (db->db_key32 | idx, db->doorbell); } +/* Ring an NQ doorbell and disable interrupts for the ring. */ static inline void bnxt_db_nq (struct bnxt_cp_ring_info *cpr) { -struct bnxt_db_info *db = &cpr->cp_db; +if (unlikely (!cpr->cp_db.db_64)) +return ; + +rte_smp_wmb (); +rte_write64 (cpr->cp_db.db_key64 |DBR_TYPE_NQ | +RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); +} + +/* Ring an NQ doorbell and enable interrupts for the ring. */ +static inline void bnxt_db_nq_arm (struct bnxt_cp_ring_info *cpr) +{ +if (unlikely (!cpr->cp_db.db_64)) +return ;rte_smp_wmb (); -if (likely (db->db_64)) -rte_write64 (db->db_key64 |DBR_TYPE_NQ | -RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), - db->doorbell); +rte_write64 (cpr->cp_db.db_key64 |DBR_TYPE_NQ_ARM | +RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); }static inline void bnxt_db_cq (struct bnxt_cp_ring_info *cpr)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 10/15 net/bnxt: avoid null pointer dereference
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Avoid null pointer dereference when allocating an insolated completion ring by basing nq ring allocation on whether an nq ring was requested instead of whether the device supports nq rings.
--- drivers/net/bnxt/bnxt_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ring.c +1 -1
@@ -280,7 +280,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, } cp_ring_info->hw_stats_ctx_id =HWRM_NA_SIGNATURE ; -if (BNXT_HAS_NQ (bp)) { +if (nq_ring_info) {struct bnxt_ring *nq_ring = nq_ring_info->cp_ring_struct; nq_ring->bd = (char *)mz->addr + nq_ring_start;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 11/15 net/bnxt: fix to enable disable interrupts correctly in start stop
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- drivers/net/bnxt/bnxt_ethdev.c | 17 ++++++++++++++++- drivers/net/bnxt/bnxt_irq.c | 2 -- 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +16 -1
@@ -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 ;
drivers/net/bnxt/bnxt_irq.c +0 -2
@@ -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;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 12/15 net/bnxt: fix to check for invalid VNIC in cleanup path
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
@@ -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);
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 13/15 net/bnxt: fix a compilation warning
In reply to Ajit KhapardeCompiler complains of an uninitialized variable.
Initializing it to avoid the issue.
--- drivers/net/bnxt/bnxt_hwrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +1 -1
@@ -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 ) {
Signature · 1 line
2.20.1 (Apple Git-117)
Re: [dpdk-dev] [PATCH 13/15] net/bnxt: fix a compilation warning
No worries. I will get to it.
From mobile device
Quoted 30 lines · Ajit Khaparde
Compiler complains of an uninitialized variable. Initializing it to avoid the issue.
Fixes db678d5c2b54 ("net/bnxt: add HWRM VNIC configure")Signed-off-by Ajit Khaparde <[email protected]>Reviewed-by Rahul Gupta <[email protected]>---
drivers/net/bnxt/bnxt_hwrm.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/bnxt/bnxt_hwrm.c +1
-2@@ -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)
PATCH 14/15 net/bnxt: fix rxq count if ntuple filtering is disabled
In reply to Ajit KhapardeFrom: Qingmin Liu <[email protected]>
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.
--- drivers/net/bnxt/bnxt_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -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;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 15/15 net/bnxt: fix to avoid sending invalid VNIC id to firmware
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
Add checking for vinc id before sending message to chimp in bnxt_hwrm_vnic_plcmode_cfg().
--- drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
@@ -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);
Signature · 1 line
2.20.1 (Apple Git-117)
v2 cover bnxt patch series
In reply to Ajit KhapardePatchset fixing various bugs in bnxt PMD based on recent patch submission.
https://patchwork.dpdk.org/patch/56311/
Please apply.
Note this patchset supersedes the previous patch series:
https://patchwork.dpdk.org/project/dpdk/list/?series=5464
Ajit Khaparde (3):
net/bnxt: fix for doorbell register offset for Tx ring. net/bnxt: save the number of EM flow count net/bnxt: fix a compilation warning
Jay Ding (1):
net/bnxt: fix to avoid sending invalid VNIC id to firmware
Kalesh AP (5):
net/bnxt: fix extended port counter statistics net/bnxt: fix possible segfault in case of probe failure net/bnxt: do not fail VF probe when the MAC address is zero net/bnxt: fix to enable disable interrupts correctly in start stop net/bnxt: fix to check for invalid VNIC in cleanup path
Lance Richardson (4):
net/bnxt: fix Tx hang after port stop/start net/bnxt: reset Rx allocation state on port restart net/bnxt: nq doorbell cleanups
net/bnxt: avoid null pointer dereference
Qingmin Liu (1):
net/bnxt: fix rxq count if ntuple filtering is disabled
Rahul Gupta (1):
net/bnxt: correctly set L4 checksum error for tunnel and non-tunnel
packets
drivers/net/bnxt/bnxt.h | 3 + drivers/net/bnxt/bnxt_ethdev.c | 307 +++++++++++++++++++-------------- drivers/net/bnxt/bnxt_hwrm.c | 56 +++++- drivers/net/bnxt/bnxt_hwrm.h | 1 + drivers/net/bnxt/bnxt_irq.c | 5 +- drivers/net/bnxt/bnxt_ring.c | 11 +- drivers/net/bnxt/bnxt_ring.h | 23 ++- drivers/net/bnxt/bnxt_rxq.c | 4 - drivers/net/bnxt/bnxt_rxr.c | 43 +++-- drivers/net/bnxt/bnxt_rxr.h | 120 ++++++++++--- drivers/net/bnxt/bnxt_util.c | 11 ++ drivers/net/bnxt/bnxt_util.h | 1 + drivers/net/bnxt/bnxt_vnic.c | 3 + 13 files changed, 409 insertions(+), 179 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 1/15 net/bnxt: fix extended port counter statistics
From: Kalesh AP <[email protected]>
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.
--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(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -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))
drivers/net/bnxt/bnxt_ethdev.c +119 -107
251 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.c +5 -2
@@ -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 )); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 2/15 net/bnxt: fix possible segfault in case of probe failure
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Fixed couple of possible segfaults due to NULL pointer dereference in case of probe failure.
--- drivers/net/bnxt/bnxt_irq.c | 3 +++ drivers/net/bnxt/bnxt_vnic.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/bnxt/bnxt_irq.c +3 -0
@@ -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) {
drivers/net/bnxt/bnxt_vnic.c +3 -0
@@ -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) {
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 3/15 net/bnxt: do not fail VF probe when the MAC address is zero
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- 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(-)
drivers/net/bnxt/bnxt_ethdev.c +42 -20
@@ -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.
drivers/net/bnxt/bnxt_hwrm.c +25 -0
@@ -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; +}
drivers/net/bnxt/bnxt_hwrm.h +1 -0
@@ -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
drivers/net/bnxt/bnxt_util.c +11 -0
@@ -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 ; +}
drivers/net/bnxt/bnxt_util.h +1 -0
@@ -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_ */
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 4/15 net/bnxt: fix Tx hang after port stop/start
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Initialize the state of the the completion valid indicator when a completion ring is freed, otherwise completions may not be processed when a new ring is allocated.
--- drivers/net/bnxt/bnxt_hwrm.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
@@ -2089,6 +2089,7 @@ static void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)memset (cpr->cp_desc_ring,0 , cpr->cp_ring_struct->ring_size *sizeof (*cpr->cp_desc_ring)); cpr->cp_raw_cons =0 ; + cpr->valid =0 ; }void bnxt_free_hwrm_rx_ring (struct bnxt *bp,int queue_index)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 5/15 net/bnxt: reset Rx allocation state on port restart
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Move call site of bnxt_rxq_vec_setup() to ensure that rxq->rxrearm_nb and rxq->rxrearm_start are reinitialized correctly when a port is restarted.
--v1->v2: Move bnxt_rxq_vec_setup under RTE_ARCH_X86.
--- drivers/net/bnxt/bnxt_ring.c | 3 +++ drivers/net/bnxt/bnxt_rxq.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_ring.c +3 -0
@@ -613,6 +613,9 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)bnxt_db_write (&rxr->rx_db, rxr->rx_prod);bnxt_db_write (&rxr->ag_db, rxr->ag_prod); rxq->index = i; +#ifdef RTE_ARCH_X86 +bnxt_rxq_vec_setup (rxq); +#endif }for (i =0 ; i < bp->tx_cp_nr_rings; i++) {
drivers/net/bnxt/bnxt_rxq.c +0 -4
@@ -356,10 +356,6 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queue_state[queue_idx] = queue_state;rte_spinlock_init (&rxq->lock); -#ifdef RTE_ARCH_X86 -bnxt_rxq_vec_setup (rxq); -#endif - out:return rc; }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 6/15 net/bnxt: correctly set L4 checksum error for tunnel and non-tunnel packets
In reply to Ajit KhapardeFrom: Rahul Gupta <[email protected]>
Update ol_flags correctly for checksum errors in case of tunnel and non-tunnel packet.
--- drivers/net/bnxt/bnxt_rxr.c | 43 ++++++++++--- drivers/net/bnxt/bnxt_rxr.h | 120 ++++++++++++++++++++++++++++++------ 2 files changed, 133 insertions(+), 30 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +33 -10
@@ -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);
drivers/net/bnxt/bnxt_rxr.h +100 -20
136 lines not on this page · raw message
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 7/15 net/bnxt: fix for doorbell register offset for Tx ring.
In reply to Ajit KhapardeFor 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.
--- drivers/net/bnxt/bnxt_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ring.c +2 -2
@@ -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); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 8/15 net/bnxt: save the number of EM flow count
In reply to Ajit KhapardeSave 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.
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_hwrm.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -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;
drivers/net/bnxt/bnxt_hwrm.c +9 -2
@@ -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); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 9/15 net/bnxt: nq doorbell cleanups
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Simplify nq doorbell handling code by removing redundant db parameter and consolidating NQ doorbell macro into the inline function that uses it.
Add "enable interrupt" variant of nq write. This will be used in a subsequent commit.
When initializing nq doorbell, don't assume that only the "disable interrupt" form will be used.
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_ring.c | 2 +- drivers/net/bnxt/bnxt_ring.h | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -246,6 +246,7 @@ struct bnxt_coal {#define DBR_TYPE_SRQ (0x2ULL << 60)#define DBR_TYPE_CQ (0x4ULL << 60)#define DBR_TYPE_NQ (0xaULL << 60) +#define DBR_TYPE_NQ_ARM (0xbULL << 60)#define BNXT_RSS_TBL_SIZE_THOR 512#define BNXT_RSS_ENTRIES_PER_CTX_THOR 64
drivers/net/bnxt/bnxt_ring.c +1 -1
@@ -341,7 +341,7 @@ static void bnxt_set_db(struct bnxt *bp, db->db_key64 =DBR_PATH_L2 |DBR_TYPE_CQ ;break ;case HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ : - db->db_key64 =DBR_PATH_L2 |DBR_TYPE_NQ ; + db->db_key64 =DBR_PATH_L2 ;break ; } db->db_key64 |= (uint64_t )fid <<DBR_XID_SFT ;
drivers/net/bnxt/bnxt_ring.h +18 -5
@@ -84,15 +84,28 @@ static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)rte_write32 (db->db_key32 | idx, db->doorbell); } +/* Ring an NQ doorbell and disable interrupts for the ring. */ static inline void bnxt_db_nq (struct bnxt_cp_ring_info *cpr) { -struct bnxt_db_info *db = &cpr->cp_db; +if (unlikely (!cpr->cp_db.db_64)) +return ; + +rte_smp_wmb (); +rte_write64 (cpr->cp_db.db_key64 |DBR_TYPE_NQ | +RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); +} + +/* Ring an NQ doorbell and enable interrupts for the ring. */ +static inline void bnxt_db_nq_arm (struct bnxt_cp_ring_info *cpr) +{ +if (unlikely (!cpr->cp_db.db_64)) +return ;rte_smp_wmb (); -if (likely (db->db_64)) -rte_write64 (db->db_key64 |DBR_TYPE_NQ | -RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), - db->doorbell); +rte_write64 (cpr->cp_db.db_key64 |DBR_TYPE_NQ_ARM | +RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); }static inline void bnxt_db_cq (struct bnxt_cp_ring_info *cpr)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 10/15 net/bnxt: avoid null pointer dereference
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Avoid null pointer dereference when allocating an insolated completion ring by basing nq ring allocation on whether an nq ring was requested instead of whether the device supports nq rings.
--- drivers/net/bnxt/bnxt_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ring.c +1 -1
@@ -280,7 +280,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, } cp_ring_info->hw_stats_ctx_id =HWRM_NA_SIGNATURE ; -if (BNXT_HAS_NQ (bp)) { +if (nq_ring_info) {struct bnxt_ring *nq_ring = nq_ring_info->cp_ring_struct; nq_ring->bd = (char *)mz->addr + nq_ring_start;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 11/15 net/bnxt: fix to enable disable interrupts correctly in start stop
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- drivers/net/bnxt/bnxt_ethdev.c | 17 ++++++++++++++++- drivers/net/bnxt/bnxt_irq.c | 2 -- 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +16 -1
@@ -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 ;
drivers/net/bnxt/bnxt_irq.c +0 -2
@@ -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;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 12/15 net/bnxt: fix to check for invalid VNIC in cleanup path
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
@@ -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);
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 13/15 net/bnxt: fix a compilation warning
In reply to Ajit KhapardeCompiler complains of an uninitialized variable.
Initializing it to avoid the issue.
--- drivers/net/bnxt/bnxt_hwrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +1 -1
@@ -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 ) {
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 14/15 net/bnxt: fix rxq count if ntuple filtering is disabled
In reply to Ajit KhapardeFrom: Qingmin Liu <[email protected]>
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.
--- drivers/net/bnxt/bnxt_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -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;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v2 15/15 net/bnxt: fix to avoid sending invalid VNIC id to firmware
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
Add checking for vinc id before sending message to chimp in bnxt_hwrm_vnic_plcmode_cfg().
--- drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
@@ -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);
Signature · 1 line
2.20.1 (Apple Git-117)
Quoted 28 lines · Ajit Khaparde
Patchset fixing various bugs in bnxt PMD based on recent patch submission.
https://patchwork.dpdk.org/patch/56311/
Please apply.Note this patchset supersedes the previous patch series:
https://patchwork.dpdk.org/project/dpdk/list/?series=5464Ajit Khaparde (3):
net/bnxt: fix for doorbell register offset for Tx ring. net/bnxt: save the number of EM flow count net/bnxt: fix a compilation warningJay Ding (1):
net/bnxt: fix to avoid sending invalid VNIC id to firmwareKalesh AP (5):
net/bnxt: fix extended port counter statistics net/bnxt: fix possible segfault in case of probe failure net/bnxt: do not fail VF probe when the MAC address is zero net/bnxt: fix to enable disable interrupts correctly in start stop net/bnxt: fix to check for invalid VNIC in cleanup pathLance Richardson (4):
net/bnxt: fix Tx hang after port stop/start net/bnxt: reset Rx allocation state on port restart net/bnxt: nq doorbell cleanups
net/bnxt: avoid null pointer dereference
Quoted 6 lines
Qingmin Liu (1):
net/bnxt: fix rxq count if ntuple filtering is disabledRahul Gupta (1):
net/bnxt: correctly set L4 checksum error for tunnel and non-tunnel
packets
Can you please check 'check-git-log.sh' warnings:
./devtools/check-git-log.sh -15
Wrong headline format:
net/bnxt: fix for doorbell register offset for Tx ring.
Headline too long:
net/bnxt: correctly set L4 checksum error for tunnel and non-tunnel packets net/bnxt: fix to enable disable interrupts correctly in start stop
Wrong tag:
Fixes: 65ee636872eb ("net/bnxt: fix Rx checksum flags)Wrong 'Fixes' reference:
Is it candidate for Cc: [email protected] backport?
net/bnxt: fix extended port counter statistics
net/bnxt: fix possible segfault in case of probe failure net/bnxt: do not fail VF probe when the MAC address is zero net/bnxt: fix Tx hang after port stop/start
net/bnxt: correctly set L4 checksum error for tunnel and non-tunnel packets net/bnxt: fix for doorbell register offset for Tx ring. net/bnxt: save the number of EM flow count
net/bnxt: fix to enable disable interrupts correctly in start stop net/bnxt: fix to check for invalid VNIC in cleanup path net/bnxt: fix a compilation warning
net/bnxt: fix rxq count if ntuple filtering is disabled net/bnxt: fix to avoid sending invalid VNIC id to firmware
v3 cover bnxt patch series
Patchset fixing various bugs in bnxt PMD based on recent commit:1e101412320061a4a1cd47db4227b4f8a163e9f6
Ajit Khaparde (3):
net/bnxt: fix for doorbell register offset for Tx ring net/bnxt: save the number of EM flow count net/bnxt: fix a compilation warning
Jay Ding (1):
net/bnxt: fix to avoid sending invalid VNIC id to firmware
Kalesh AP (5):
net/bnxt: fix extended port counter statistics net/bnxt: fix possible segfault in case of probe failure net/bnxt: do not fail VF probe when the MAC address is zero net/bnxt: fix to enable disable interrupts correctly net/bnxt: fix to check for invalid VNIC in cleanup path
Lance Richardson (4):
net/bnxt: fix Tx hang after port stop/start net/bnxt: reset Rx allocation state on port restart net/bnxt: nq doorbell cleanups
net/bnxt: avoid null pointer dereference
Qingmin Liu (1):
net/bnxt: fix rxq count if ntuple filtering is disabled
Rahul Gupta (1):
net/bnxt: fix L4 checksum error indication in Rx path
drivers/net/bnxt/bnxt.h | 3 + drivers/net/bnxt/bnxt_ethdev.c | 307 +++++++++++++++++++-------------- drivers/net/bnxt/bnxt_hwrm.c | 56 +++++- drivers/net/bnxt/bnxt_hwrm.h | 1 + drivers/net/bnxt/bnxt_irq.c | 5 +- drivers/net/bnxt/bnxt_ring.c | 11 +- drivers/net/bnxt/bnxt_ring.h | 23 ++- drivers/net/bnxt/bnxt_rxq.c | 4 - drivers/net/bnxt/bnxt_rxr.c | 43 +++-- drivers/net/bnxt/bnxt_rxr.h | 120 ++++++++++--- drivers/net/bnxt/bnxt_util.c | 11 ++ drivers/net/bnxt/bnxt_util.h | 1 + drivers/net/bnxt/bnxt_vnic.c | 3 + 13 files changed, 409 insertions(+), 179 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 1/15 net/bnxt: fix extended port counter statistics
From: Kalesh AP <[email protected]>
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.
--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(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -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))
drivers/net/bnxt/bnxt_ethdev.c +119 -107
251 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.c +5 -2
@@ -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 )); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 2/15 net/bnxt: fix possible segfault in case of probe failure
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Fixed couple of possible segfaults due to NULL pointer dereference in case of probe failure.
--- drivers/net/bnxt/bnxt_irq.c | 3 +++ drivers/net/bnxt/bnxt_vnic.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/bnxt/bnxt_irq.c +3 -0
@@ -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) {
drivers/net/bnxt/bnxt_vnic.c +3 -0
@@ -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) {
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 3/15 net/bnxt: do not fail VF probe when the MAC address is zero
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- 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(-)
drivers/net/bnxt/bnxt_ethdev.c +42 -20
@@ -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.
drivers/net/bnxt/bnxt_hwrm.c +25 -0
@@ -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; +}
drivers/net/bnxt/bnxt_hwrm.h +1 -0
@@ -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
drivers/net/bnxt/bnxt_util.c +11 -0
@@ -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 ; +}
drivers/net/bnxt/bnxt_util.h +1 -0
@@ -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_ */
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 4/15 net/bnxt: fix Tx hang after port stop/start
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Initialize the state of the the completion valid indicator when a completion ring is freed, otherwise completions may not be processed when a new ring is allocated.
--- drivers/net/bnxt/bnxt_hwrm.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
@@ -2089,6 +2089,7 @@ static void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)memset (cpr->cp_desc_ring,0 , cpr->cp_ring_struct->ring_size *sizeof (*cpr->cp_desc_ring)); cpr->cp_raw_cons =0 ; + cpr->valid =0 ; }void bnxt_free_hwrm_rx_ring (struct bnxt *bp,int queue_index)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 5/15 net/bnxt: reset Rx allocation state on port restart
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Move call site of bnxt_rxq_vec_setup() to ensure that rxq->rxrearm_nb and rxq->rxrearm_start are reinitialized correctly when a port is restarted.
--v1->v2: Move bnxt_rxq_vec_setup under RTE_ARCH_X86.
--- drivers/net/bnxt/bnxt_ring.c | 3 +++ drivers/net/bnxt/bnxt_rxq.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_ring.c +3 -0
@@ -613,6 +613,9 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)bnxt_db_write (&rxr->rx_db, rxr->rx_prod);bnxt_db_write (&rxr->ag_db, rxr->ag_prod); rxq->index = i; +#ifdef RTE_ARCH_X86 +bnxt_rxq_vec_setup (rxq); +#endif }for (i =0 ; i < bp->tx_cp_nr_rings; i++) {
drivers/net/bnxt/bnxt_rxq.c +0 -4
@@ -356,10 +356,6 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queue_state[queue_idx] = queue_state;rte_spinlock_init (&rxq->lock); -#ifdef RTE_ARCH_X86 -bnxt_rxq_vec_setup (rxq); -#endif - out:return rc; }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 6/15 net/bnxt: fix L4 checksum error indication in Rx path
In reply to Ajit KhapardeFrom: Rahul Gupta <[email protected]>
Update ol_flags correctly for checksum errors in case of tunnel and non-tunnel packet.
--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(-)
drivers/net/bnxt/bnxt_rxr.c +33 -10
@@ -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);
drivers/net/bnxt/bnxt_rxr.h +100 -20
136 lines not on this page · raw message
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 7/15 net/bnxt: fix for doorbell register offset for Tx ring
In reply to Ajit KhapardeFor 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.
--v1->v3: Fix output of check-git-log.
--- drivers/net/bnxt/bnxt_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ring.c +2 -2
@@ -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); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 8/15 net/bnxt: save the number of EM flow count
In reply to Ajit KhapardeSave 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.
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_hwrm.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -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;
drivers/net/bnxt/bnxt_hwrm.c +9 -2
@@ -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); }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 9/15 net/bnxt: nq doorbell cleanups
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Simplify nq doorbell handling code by removing redundant db parameter and consolidating NQ doorbell macro into the inline function that uses it.
Add "enable interrupt" variant of nq write. This will be used in a subsequent commit.
When initializing nq doorbell, don't assume that only the "disable interrupt" form will be used.
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_ring.c | 2 +- drivers/net/bnxt/bnxt_ring.h | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -246,6 +246,7 @@ struct bnxt_coal {#define DBR_TYPE_SRQ (0x2ULL << 60)#define DBR_TYPE_CQ (0x4ULL << 60)#define DBR_TYPE_NQ (0xaULL << 60) +#define DBR_TYPE_NQ_ARM (0xbULL << 60)#define BNXT_RSS_TBL_SIZE_THOR 512#define BNXT_RSS_ENTRIES_PER_CTX_THOR 64
drivers/net/bnxt/bnxt_ring.c +1 -1
@@ -341,7 +341,7 @@ static void bnxt_set_db(struct bnxt *bp, db->db_key64 =DBR_PATH_L2 |DBR_TYPE_CQ ;break ;case HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ : - db->db_key64 =DBR_PATH_L2 |DBR_TYPE_NQ ; + db->db_key64 =DBR_PATH_L2 ;break ; } db->db_key64 |= (uint64_t )fid <<DBR_XID_SFT ;
drivers/net/bnxt/bnxt_ring.h +18 -5
@@ -84,15 +84,28 @@ static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)rte_write32 (db->db_key32 | idx, db->doorbell); } +/* Ring an NQ doorbell and disable interrupts for the ring. */ static inline void bnxt_db_nq (struct bnxt_cp_ring_info *cpr) { -struct bnxt_db_info *db = &cpr->cp_db; +if (unlikely (!cpr->cp_db.db_64)) +return ; + +rte_smp_wmb (); +rte_write64 (cpr->cp_db.db_key64 |DBR_TYPE_NQ | +RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); +} + +/* Ring an NQ doorbell and enable interrupts for the ring. */ +static inline void bnxt_db_nq_arm (struct bnxt_cp_ring_info *cpr) +{ +if (unlikely (!cpr->cp_db.db_64)) +return ;rte_smp_wmb (); -if (likely (db->db_64)) -rte_write64 (db->db_key64 |DBR_TYPE_NQ | -RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), - db->doorbell); +rte_write64 (cpr->cp_db.db_key64 |DBR_TYPE_NQ_ARM | +RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); }static inline void bnxt_db_cq (struct bnxt_cp_ring_info *cpr)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 10/15 net/bnxt: avoid null pointer dereference
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Avoid null pointer dereference when allocating an insolated completion ring by basing nq ring allocation on whether an nq ring was requested instead of whether the device supports nq rings.
--- drivers/net/bnxt/bnxt_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ring.c +1 -1
@@ -280,7 +280,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, } cp_ring_info->hw_stats_ctx_id =HWRM_NA_SIGNATURE ; -if (BNXT_HAS_NQ (bp)) { +if (nq_ring_info) {struct bnxt_ring *nq_ring = nq_ring_info->cp_ring_struct; nq_ring->bd = (char *)mz->addr + nq_ring_start;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 11/15 net/bnxt: fix to enable disable interrupts correctly
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--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(-)
drivers/net/bnxt/bnxt_ethdev.c +16 -1
@@ -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 ;
drivers/net/bnxt/bnxt_irq.c +0 -2
@@ -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;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 12/15 net/bnxt: fix to check for invalid VNIC in cleanup path
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
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.
--- drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
@@ -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);
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 13/15 net/bnxt: fix a compilation warning
In reply to Ajit KhapardeCompiler complains of an uninitialized variable.
Initializing it to avoid the issue.
--- drivers/net/bnxt/bnxt_hwrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +1 -1
@@ -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 ) {
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 14/15 net/bnxt: fix rxq count if ntuple filtering is disabled
In reply to Ajit KhapardeFrom: Qingmin Liu <[email protected]>
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.
--- drivers/net/bnxt/bnxt_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -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;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH v3 15/15 net/bnxt: fix to avoid sending invalid VNIC id to firmware
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
Add checking for vinc id before sending message to chimp in bnxt_hwrm_vnic_plcmode_cfg().
--- drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
@@ -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);
Signature · 1 line
2.20.1 (Apple Git-117)
Quoted 24 lines · Ajit Khaparde
Patchset fixing various bugs in bnxt PMD based on recent commit:
1e101412320061a4a1cd47db4227b4f8a163e9f6Ajit Khaparde (3):
net/bnxt: fix for doorbell register offset for Tx ring net/bnxt: save the number of EM flow count net/bnxt: fix a compilation warningJay Ding (1):
net/bnxt: fix to avoid sending invalid VNIC id to firmwareKalesh AP (5):
net/bnxt: fix extended port counter statistics net/bnxt: fix possible segfault in case of probe failure net/bnxt: do not fail VF probe when the MAC address is zero net/bnxt: fix to enable disable interrupts correctly net/bnxt: fix to check for invalid VNIC in cleanup pathLance Richardson (4):
net/bnxt: fix Tx hang after port stop/start net/bnxt: reset Rx allocation state on port restart net/bnxt: nq doorbell cleanups
net/bnxt: avoid null pointer dereference
Quoted 5 lines
Qingmin Liu (1):
net/bnxt: fix rxq count if ntuple filtering is disabledRahul Gupta (1):
net/bnxt: fix L4 checksum error indication in Rx path
Series applied to dpdk-next-net/master, thanks.