patchset for bnxt
cover patchset for bnxt
Patchset mostly contains bug fixes apart from
removing some dead code and unnecessary comments.
Please apply.
Kalesh AP (5):
net/bnxt: fix dereference before null check net/bnxt: cleanup comments in source net/bnxt: move macro definitions to header file net/bnxt: fix endianness while retrieving MTU from FW net/bnxt: fix error handling
Lance Richardson (1):
net/bnxt: reset Rx allocation state on Rx queue restart
Somnath Kotur (1):
net/bnxt: fix race between interrupt handler and dev config
drivers/net/bnxt/bnxt.h | 51 +++++++++++++++++++++++++ drivers/net/bnxt/bnxt_cpr.c | 2 - drivers/net/bnxt/bnxt_ethdev.c | 70 ++++++++++------------------------ drivers/net/bnxt/bnxt_filter.c | 1 - drivers/net/bnxt/bnxt_flow.c | 7 ---- drivers/net/bnxt/bnxt_hwrm.c | 30 +++++---------- drivers/net/bnxt/bnxt_irq.c | 7 +++- drivers/net/bnxt/bnxt_ring.c | 3 ++ drivers/net/bnxt/bnxt_rxr.c | 16 +++++--- drivers/net/bnxt/bnxt_stats.c | 2 +- 10 files changed, 101 insertions(+), 88 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 1/7 net/bnxt: fix dereference before null check
From: Kalesh AP <[email protected]>
This patch fixes potential null pointer access in bnxt_alloc_ag_data(). Fix to return an error if null check is true.
--- drivers/net/bnxt/bnxt_rxr.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +10 -6
@@ -63,18 +63,22 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,struct bnxt_sw_rx_bd *rx_buf = &rxr->ag_buf_ring[prod];struct rte_mbuf *mbuf; +if (rxbd ==NULL ) { +PMD_DRV_LOG (ERR ,"Jumbo Frame. rxbd is NULL\n" ); +return -EINVAL ; + } + +if (rx_buf ==NULL ) { +PMD_DRV_LOG (ERR ,"Jumbo Frame. rx_buf is NULL\n" ); +return -EINVAL ; + } + mbuf =__bnxt_alloc_rx_data (rxq->mb_pool);if (!mbuf) {rte_atomic64_inc (&rxq->rx_mbuf_alloc_fail);return -ENOMEM ; } -if (rxbd ==NULL ) -PMD_DRV_LOG (ERR ,"Jumbo Frame. rxbd is NULL\n" ); -if (rx_buf ==NULL ) -PMD_DRV_LOG (ERR ,"Jumbo Frame. rx_buf is NULL\n" ); - - rx_buf->mbuf = mbuf; mbuf->data_off =RTE_PKTMBUF_HEADROOM ;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 2/7 net/bnxt: reset Rx allocation state on Rx queue restart
In reply to Ajit KhapardeFrom: Lance Richardson <[email protected]>
Call bnxt_rxq_vec_setup() to ensure that rxq->rxrearm_nb and rxq->rxrearm_start are initialized correctly when a receive queue is restarted.
--- drivers/net/bnxt/bnxt_ring.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_ring.c +3 -0
@@ -626,6 +626,9 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)bnxt_db_write (&rxr->ag_db, rxr->ag_prod); } rxq->index = queue_index; +#ifdef RTE_ARCH_X86 +bnxt_rxq_vec_setup (rxq); +#endif return 0 ;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 3/7 net/bnxt: cleanup comments in source
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
- updated one comment for more readability and understanding
- fixed typo in comments
- moved a comment to right place
- removed one out-of-date comment
- removed few commented code
--- drivers/net/bnxt/bnxt_cpr.c | 2 -- drivers/net/bnxt/bnxt_filter.c | 1 - drivers/net/bnxt/bnxt_flow.c | 7 ------- drivers/net/bnxt/bnxt_hwrm.c | 28 +++++++++------------------- 4 files changed, 9 insertions(+), 29 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +0 -2
@@ -58,8 +58,6 @@ void bnxt_handle_async_event(struct bnxt *bp,struct bnxt_error_recovery_info *info;uint32_t event_data; -/* TODO: HWRM async events are not defined yet */ -/* Needs to handle: link events, error events, etc. */ switch (event_id) {case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE :case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE :
drivers/net/bnxt/bnxt_filter.c +0 -1
@@ -82,7 +82,6 @@ void bnxt_free_all_filters(struct bnxt *bp)struct bnxt_filter_info *filter, *temp_filter;unsigned int i; -// for (i = 0; i < MAX_FF_POOLS; i++) { for (i =0 ; i < bp->nr_vnics; i++) { vnic = &bp->vnic_info[i]; filter =STAILQ_FIRST (&vnic->filter);
drivers/net/bnxt/bnxt_flow.c +0 -7
@@ -1087,10 +1087,6 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, vnic->fw_vnic_id != INVALID_HW_RING_ID) goto use_vnic; -//if (!rxq || -//bp->vnic_info[0].fw_grp_ids[act_q->index] != -//INVALID_HW_RING_ID || -//!rxq->rx_deferred_start) { if (!rxq || bp->vnic_info[0 ].fw_grp_ids[act_q->index] !=INVALID_HW_RING_ID ) {
@@ -1320,9 +1316,6 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, } rxq = bp->rx_queues[rss->queue[i]]; -//if (bp->vnic_info[0].fw_grp_ids[rss->queue[i]] != -//INVALID_HW_RING_ID || -//!rxq->rx_deferred_start) { if (bp->vnic_info[0 ].fw_grp_ids[rss->queue[i]] !=INVALID_HW_RING_ID ) { PMD_DRV_LOG(ERR,
drivers/net/bnxt/bnxt_hwrm.c +9 -19
@@ -74,9 +74,9 @@ static void bnxt_hwrm_set_pg_attr(struct bnxt_ring_mem_info *rmem,/* * HWRM Functions (sent to HWRM) -* These are named bnxt_hwrm_*() and return -1 if bnxt_hwrm_send_message() -* fails (ie: a timeout), and a positive non-zero HWRM error code if the HWRM -* command was failed by the ChiMP. +* These are named bnxt_hwrm_*() and return 0 on success or -110 if the +* HWRM command times out, or a negative error code if the HWRM +* command was failed by the FW. */ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
@@ -176,11 +176,11 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, }/* -* HWRM_PREP() should be used to prepare *ALL* HWRM commands. It grabs the +* HWRM_PREP() should be used to prepare *ALL* HWRM commands. It grabs the * spinlock, and does initial processing. * * HWRM_CHECK_RESULT() returns errors on failure and may not be used. It -* releases the spinlock only if it returns. If the regular int return codes +* releases the spinlock only if it returns. If the regular int return codes * are not used by the function, HWRM_CHECK_RESULT() should not be used * directly, rather it should be copied and modified to suit the function. *
@@ -518,7 +518,6 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)struct hwrm_port_mac_ptp_qcfg_output *resp = bp->hwrm_cmd_resp_addr;struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; -/* if (bp->hwrm_spec_code < 0x10801 || ptp) TBD */ if (ptp)return 0 ;
@@ -2161,10 +2160,6 @@ int bnxt_hwrm_func_clr_stats(struct bnxt *bp, uint16_t fid)return rc; } -/* -* HWRM utility functions -*/ -int bnxt_clear_all_hwrm_stat_ctxs (struct bnxt *bp) {unsigned int i;
@@ -2383,6 +2378,10 @@ int bnxt_alloc_all_hwrm_ring_grps(struct bnxt *bp)return rc; } +/* +* HWRM utility functions +*/ +void bnxt_free_hwrm_resources (struct bnxt *bp) {/* Release memzone */
@@ -2432,8 +2431,6 @@ int bnxt_clear_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic) rc =bnxt_hwrm_clear_l2_filter (bp, filter);STAILQ_REMOVE (&vnic->filter, filter, bnxt_filter_info, next);bnxt_free_filter (bp, filter); -//if (rc) -//break; }return rc; }
@@ -2458,8 +2455,6 @@ bnxt_clear_hwrm_vnic_flows(struct bnxt *bp, struct bnxt_vnic_info *vnic)STAILQ_REMOVE (&vnic->flow_list, flow, rte_flow, next);rte_free (flow); -//if (rc) -//break; }return rc; }
@@ -2514,7 +2509,6 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp)for (i = bp->max_vnics -1 ; i >=0 ; i--) {struct bnxt_vnic_info *vnic = &bp->vnic_info[i]; -// If the VNIC ID is invalid we are not currently using the VNIC if (vnic->fw_vnic_id ==INVALID_HW_RING_ID )continue ;
@@ -4226,10 +4220,6 @@ int bnxt_hwrm_set_ntuple_filter(struct bnxt *bp, HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR) memcpy(req.src_macaddr, filter->src_macaddr,RTE_ETHER_ADDR_LEN ); -//if (enables & -//HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_MACADDR) -//memcpy(req.dst_macaddr, filter->dst_macaddr, -//RTE_ETHER_ADDR_LEN); if (enables &HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_ETHERTYPE ) req.ethertype =rte_cpu_to_be_16 (filter->ethertype);
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 4/7 net/bnxt: move macro definitions to header file
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Move device and vendor ids macro definition from bnxt_ethdev.c to bnxt.h.
There is no functionality impact.
--- drivers/net/bnxt/bnxt.h | 50 +++++++++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_ethdev.c | 51 ++-------------------------------- 2 files changed, 53 insertions(+), 48 deletions(-)
drivers/net/bnxt/bnxt.h +50 -0
@@ -21,6 +21,56 @@#include "bnxt_cpr.h" #include "bnxt_util.h" +/* Vendor ID */ +#define PCI_VENDOR_ID_BROADCOM 0x14E4 + +/* Device IDs */ +#define BROADCOM_DEV_ID_STRATUS_NIC_VF1 0x1606 +#define BROADCOM_DEV_ID_STRATUS_NIC_VF2 0x1609 +#define BROADCOM_DEV_ID_STRATUS_NIC 0x1614 +#define BROADCOM_DEV_ID_57414_VF 0x16c1 +#define BROADCOM_DEV_ID_57301 0x16c8 +#define BROADCOM_DEV_ID_57302 0x16c9 +#define BROADCOM_DEV_ID_57304_PF 0x16ca +#define BROADCOM_DEV_ID_57304_VF 0x16cb +#define BROADCOM_DEV_ID_57417_MF 0x16cc +#define BROADCOM_DEV_ID_NS2 0x16cd +#define BROADCOM_DEV_ID_57311 0x16ce +#define BROADCOM_DEV_ID_57312 0x16cf +#define BROADCOM_DEV_ID_57402 0x16d0 +#define BROADCOM_DEV_ID_57404 0x16d1 +#define BROADCOM_DEV_ID_57406_PF 0x16d2 +#define BROADCOM_DEV_ID_57406_VF 0x16d3 +#define BROADCOM_DEV_ID_57402_MF 0x16d4 +#define BROADCOM_DEV_ID_57407_RJ45 0x16d5 +#define BROADCOM_DEV_ID_57412 0x16d6 +#define BROADCOM_DEV_ID_57414 0x16d7 +#define BROADCOM_DEV_ID_57416_RJ45 0x16d8 +#define BROADCOM_DEV_ID_57417_RJ45 0x16d9 +#define BROADCOM_DEV_ID_5741X_VF 0x16dc +#define BROADCOM_DEV_ID_57412_MF 0x16de +#define BROADCOM_DEV_ID_57314 0x16df +#define BROADCOM_DEV_ID_57317_RJ45 0x16e0 +#define BROADCOM_DEV_ID_5731X_VF 0x16e1 +#define BROADCOM_DEV_ID_57417_SFP 0x16e2 +#define BROADCOM_DEV_ID_57416_SFP 0x16e3 +#define BROADCOM_DEV_ID_57317_SFP 0x16e4 +#define BROADCOM_DEV_ID_57404_MF 0x16e7 +#define BROADCOM_DEV_ID_57406_MF 0x16e8 +#define BROADCOM_DEV_ID_57407_SFP 0x16e9 +#define BROADCOM_DEV_ID_57407_MF 0x16ea +#define BROADCOM_DEV_ID_57414_MF 0x16ec +#define BROADCOM_DEV_ID_57416_MF 0x16ee +#define BROADCOM_DEV_ID_57508 0x1750 +#define BROADCOM_DEV_ID_57504 0x1751 +#define BROADCOM_DEV_ID_57502 0x1752 +#define BROADCOM_DEV_ID_57500_VF1 0x1806 +#define BROADCOM_DEV_ID_57500_VF2 0x1807 +#define BROADCOM_DEV_ID_58802 0xd802 +#define BROADCOM_DEV_ID_58804 0xd804 +#define BROADCOM_DEV_ID_58808 0x16f0 +#define BROADCOM_DEV_ID_58802_VF 0xd800 +#define BNXT_MAX_MTU 9574#define VLAN_TAG_SIZE 4#define BNXT_NUM_VLANS 2
drivers/net/bnxt/bnxt_ethdev.c +3 -48
57 lines not on this page · raw message
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 5/7 net/bnxt: fix race between interrupt handler and dev config
In reply to Ajit KhapardeFrom: Somnath Kotur <[email protected]>
Fix a possible that while interrupt handler is in the middle of processing, dev_configure_op() might come in and try to destroy/realloc the default completion ring on which interrupt completions arrive. Synchronize the two so they don't race each other
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++-- drivers/net/bnxt/bnxt_irq.c | 7 ++++++- 3 files changed, 24 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -574,6 +574,7 @@ struct bnxt {void *hwrm_short_cmd_req_addr;rte_iova_t hwrm_short_cmd_req_dma_addr;rte_spinlock_t hwrm_lock; +pthread_mutex_t def_cp_lock;uint16_t max_req_len;uint16_t max_resp_len;uint16_t hwrm_max_ext_req_len;
drivers/net/bnxt/bnxt_ethdev.c +17 -2
@@ -627,6 +627,9 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)* resource reservation. This will ensure the resource counts * are calculated correctly. */ + +pthread_mutex_lock (&bp->def_cp_lock); +if (!BNXT_HAS_NQ (bp) && bp->async_cp_ring) {bnxt_disable_int (bp);bnxt_free_cp_ring (bp, bp->async_cp_ring);
@@ -635,15 +638,20 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) rc =bnxt_hwrm_func_reserve_vf_resc (bp, false);if (rc) {PMD_DRV_LOG (ERR ,"HWRM resource alloc fail:%x\n" , rc); +pthread_mutex_unlock (&bp->def_cp_lock);return -ENOSPC ; }if (!BNXT_HAS_NQ (bp) && bp->async_cp_ring) { rc =bnxt_alloc_async_cp_ring (bp); -if (rc) +if (rc) { +pthread_mutex_unlock (&bp->def_cp_lock);return rc; + }bnxt_enable_int (bp); } + +pthread_mutex_unlock (&bp->def_cp_lock); }else {/* legacy driver needs to get updated values */ rc =bnxt_hwrm_func_qcaps (bp);
@@ -4585,8 +4593,14 @@ bnxt_init_locks(struct bnxt *bp)int err; err =pthread_mutex_init (&bp->flow_lock,NULL ); -if (err) +if (err) {PMD_DRV_LOG (ERR ,"Unable to initialize flow_lock\n" ); +return err; + } + + err =pthread_mutex_init (&bp->def_cp_lock,NULL ); +if (err) +PMD_DRV_LOG (ERR ,"Unable to initialize def_cp_lock\n" );return err; }
@@ -4735,6 +4749,7 @@ static void bnxt_uninit_locks(struct bnxt *bp) {pthread_mutex_destroy (&bp->flow_lock); +pthread_mutex_destroy (&bp->def_cp_lock); } static int
drivers/net/bnxt/bnxt_irq.c +6 -1
@@ -30,9 +30,12 @@ void bnxt_int_handler(void *param)return ; raw_cons = cpr->cp_raw_cons; +pthread_mutex_lock (&bp->def_cp_lock);while (1 ) { -if (!cpr || !cpr->cp_ring_struct || !cpr->cp_db.doorbell) +if (!cpr || !cpr->cp_ring_struct || !cpr->cp_db.doorbell) { +pthread_mutex_unlock (&bp->def_cp_lock);return ; + } cons =RING_CMP (cpr->cp_ring_struct, raw_cons); cmp = &cpr->cp_desc_ring[cons];
@@ -49,6 +52,8 @@ void bnxt_int_handler(void *param)bnxt_db_nq_arm (cpr); else B_CP_DB_REARM(cpr, cpr->cp_raw_cons); + +pthread_mutex_unlock (&bp->def_cp_lock); }int bnxt_free_int (struct bnxt *bp)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 6/7 net/bnxt: fix endianness while retrieving MTU from FW
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
In bnxt_hwrm_func_qcfg(), use rte_le_to_cpu_16 while getting the mtu value from command response.
--- drivers/net/bnxt/bnxt_hwrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +1 -1
@@ -2882,7 +2882,7 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) }if (mtu) - *mtu = resp->mtu; + *mtu =rte_le_to_cpu_16 (resp->mtu);switch (resp->port_partition_type) {case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0 :
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 7/7 net/bnxt: fix error handling
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Add missing return instead of setting the error status in case of error.
--- drivers/net/bnxt/bnxt_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_stats.c +1 -1
@@ -575,7 +575,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)if (BNXT_VF (bp) || !BNXT_SINGLE_PF (bp) || !(bp->flags &BNXT_FLAG_PORT_STATS )) {PMD_DRV_LOG (ERR ,"Operation not supported\n" ); - ret = -ENOTSUP ; +return -ENOTSUP ; } ret =bnxt_hwrm_port_clr_stats (bp);
Signature · 1 line
2.20.1 (Apple Git-117)
Quoted 4 lines · Ajit Khaparde
Patchset mostly contains bug fixes apart from
removing some dead code and unnecessary comments.
Please apply.
Patchset applied to dpdk-next-net-brcm
Quoted 30 lines
Kalesh AP (5):
net/bnxt: fix dereference before null check net/bnxt: cleanup comments in source net/bnxt: move macro definitions to header file net/bnxt: fix endianness while retrieving MTU from FW net/bnxt: fix error handlingLance Richardson (1):
net/bnxt: reset Rx allocation state on Rx queue restartSomnath Kotur (1):
net/bnxt: fix race between interrupt handler and dev configdrivers/net/bnxt/bnxt.h | 51 +++++++++++++++++++++++++ drivers/net/bnxt/bnxt_cpr.c | 2 - drivers/net/bnxt/bnxt_ethdev.c | 70 ++++++++++------------------------ drivers/net/bnxt/bnxt_filter.c | 1 - drivers/net/bnxt/bnxt_flow.c | 7 ---- drivers/net/bnxt/bnxt_hwrm.c | 30 +++++---------- drivers/net/bnxt/bnxt_irq.c | 7 +++- drivers/net/bnxt/bnxt_ring.c | 3 ++ drivers/net/bnxt/bnxt_rxr.c | 16 +++++--- drivers/net/bnxt/bnxt_stats.c | 2 +- 10 files changed, 101 insertions(+), 88 deletions(-)--
2.20.1 (Apple Git-117)