bnxt patchset
cover bnxt patchset
bnxt patchset against dpdk-next-net.
This patchset is **dependent** on
"bnxt patchset for thor and bnxt vector PMD" a series submitted eariler.
Please apply.
Ajit Khaparde (2):
net/bnxt: subscribe to link speed change notification net/bnxt: fix async link handling and update
Kalesh AP (9):
net/bnxt: fix rxq stop/start handling
net/bnxt: fix l2 context calculation for thor net/bnxt: fix use of deferred start of transmit queues net/bnxt: remove unnecessary return check net/bnxt: remove unused macro
net/bnxt: remove unnecessary interrupt disable net/bnxt: fix accessing variable before null check net/bnxt: fix mbuf flags for PTP packets in vector mode rx net/bnxt: handle reset notify async event on ns3 devices
Rahul Gupta (1):
net/bnxt: fix Rx queue count devop
Santoshkumar Karanappa Rastapur (3):
net/bnxt: fix incorrect flow steering net/bnxt: fix traffic failure with higher mbuf size net/bnxt: fix 40G link failure for Thor
drivers/net/bnxt/bnxt.h | 9 +- drivers/net/bnxt/bnxt_cpr.c | 27 ++++- drivers/net/bnxt/bnxt_ethdev.c | 70 ++++------- drivers/net/bnxt/bnxt_flow.c | 4 + drivers/net/bnxt/bnxt_hwrm.c | 161 ++++++++++++++----------- drivers/net/bnxt/bnxt_hwrm.h | 2 + drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_irq.h | 1 + drivers/net/bnxt/bnxt_ring.c | 8 +- drivers/net/bnxt/bnxt_rxq.c | 93 ++++++++------ drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 14 +-- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 15 ++- drivers/net/bnxt/bnxt_txq.c | 5 + drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 6 +- drivers/net/bnxt/hsi_struct_def_dpdk.h | 8 ++ 17 files changed, 245 insertions(+), 183 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 1/15 net/bnxt: fix incorrect flow steering
From: Santoshkumar Karanappa Rastapur <[email protected]>
When user creates a flow similar to an existing flow with just the destination queue change, we delete the old filter and allocate a new one with this destination queue change. We were also allocating a new L2 filter matching the same destination mac resulting in 2 L2 filters for the same destination mac. This was causing any flow matching the destination mac to be steered to this queue instead of the default queue. Fixed it by deleting this stale L2 filter.
--- drivers/net/bnxt/bnxt_flow.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/bnxt/bnxt_flow.c +4 -0
@@ -1028,6 +1028,10 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf) sizeof(nf->dst_ipaddr_mask))) {if (mf->dst_id == nf->dst_id)return -EEXIST ; +/* Clear the new L2 filter that was created +* earlier in bnxt_validate_and_parse_flow. +*/ +bnxt_hwrm_clear_l2_filter (bp, nf);/* * Same Flow, Different queue * Clear the old ntuple filter
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 2/15 net/bnxt: fix traffic failure with higher mbuf size
In reply to Ajit KhapardeFrom: Santoshkumar Karanappa Rastapur <[email protected]>
Maximum frame length supported by hw is 9600 bytes. When user launches testpmd with --mbuf-size=9729, we are posting buffer descriptors of size 9601 to the ring. This was causing packets getting discarded.
--- drivers/net/bnxt/bnxt.h | 5 ++++- drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++---------------- drivers/net/bnxt/bnxt_hwrm.c | 3 +++ drivers/net/bnxt/bnxt_ring.c | 5 ----- drivers/net/bnxt/bnxt_rxq.c | 2 +- drivers/net/bnxt/bnxt_rxq.h | 1 - drivers/net/bnxt/bnxt_rxr.c | 7 ++----- 7 files changed, 19 insertions(+), 29 deletions(-)
drivers/net/bnxt/bnxt.h +4 -1
@@ -23,12 +23,15 @@#define BNXT_MAX_MTU 9574#define VLAN_TAG_SIZE 4 +#define BNXT_NUM_VLANS 2 +#define BNXT_MAX_PKT_LEN (BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\ + RTE_ETHER_CRC_LEN +\ + (BNXT_NUM_VLANS * VLAN_TAG_SIZE))#define BNXT_VF_RSV_NUM_RSS_CTX 1#define BNXT_VF_RSV_NUM_L2_CTX 4/* TODO: For now, do not support VMDq/RFS on VFs. */ #define BNXT_VF_RSV_NUM_VNIC 1#define BNXT_MAX_LED 4 -#define BNXT_NUM_VLANS 2#define BNXT_MIN_RING_DESC 16#define BNXT_MAX_TX_RING_DESC 4096#define BNXT_MAX_RX_RING_DESC 8192
drivers/net/bnxt/bnxt_ethdev.c +9 -16
@@ -548,10 +548,13 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->hash_key_size =40 ; max_vnics = bp->max_vnics; +/* MTU specifics */ + dev_info->min_mtu =RTE_ETHER_MIN_MTU ; + dev_info->max_mtu =BNXT_MAX_MTU ; +/* Fast path specifics */ dev_info->min_rx_bufsize =1 ; - dev_info->max_rx_pktlen =BNXT_MAX_MTU +RTE_ETHER_HDR_LEN + -RTE_ETHER_CRC_LEN +VLAN_TAG_SIZE *2 ; + dev_info->max_rx_pktlen =BNXT_MAX_PKT_LEN ; dev_info->rx_offload_capa =BNXT_DEV_RX_OFFLOAD_SUPPORT ;if (bp->flags &BNXT_FLAG_PTP_SUPPORTED )
@@ -1906,7 +1909,6 @@ bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,static int bnxt_mtu_set_op (struct rte_eth_dev *eth_dev,uint16_t new_mtu) {struct bnxt *bp = eth_dev->data->dev_private; -struct rte_eth_dev_info dev_info;uint32_t new_pkt_size;uint32_t rc =0 ;uint32_t i;
@@ -1918,14 +1920,6 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) new_pkt_size = new_mtu +RTE_ETHER_HDR_LEN +RTE_ETHER_CRC_LEN +VLAN_TAG_SIZE *BNXT_NUM_VLANS ; -bnxt_dev_info_get_op (eth_dev, &dev_info); - -if (new_mtu <RTE_ETHER_MIN_MTU || new_mtu >BNXT_MAX_MTU ) { -PMD_DRV_LOG (ERR ,"MTU requested must be within (%d, %d)\n" , -RTE_ETHER_MIN_MTU ,BNXT_MAX_MTU ); -return -EINVAL ; - } -#ifdef RTE_ARCH_X86 /* * If vector-mode tx/rx is active, disallow any MTU change that would
@@ -1955,15 +1949,12 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size; - eth_dev->data->mtu = new_mtu; -PMD_DRV_LOG (INFO ,"New MTU is %d\n" , eth_dev->data->mtu); -for (i =0 ; i < bp->nr_vnics; i++) {struct bnxt_vnic_info *vnic = &bp->vnic_info[i];uint16_t size =0 ; - vnic->mru = bp->eth_dev->data->mtu +RTE_ETHER_HDR_LEN + -RTE_ETHER_CRC_LEN +VLAN_TAG_SIZE *2 ; + vnic->mru = new_mtu +RTE_ETHER_HDR_LEN + +RTE_ETHER_CRC_LEN +VLAN_TAG_SIZE *2 ; rc =bnxt_hwrm_vnic_cfg (bp, vnic);if (rc)break ;
@@ -1978,6 +1969,8 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) } } +PMD_DRV_LOG (INFO ,"New MTU is %d\n" , new_mtu); +return rc; }
drivers/net/bnxt/bnxt_hwrm.c +3 -0
@@ -1233,6 +1233,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp, mb_pool = bp->rx_queues[0 ]->mb_pool; rx_buf_size =rte_pktmbuf_data_room_size (mb_pool) -RTE_PKTMBUF_HEADROOM ; + rx_buf_size =RTE_MIN (BNXT_MAX_PKT_LEN , rx_buf_size); req.rx_buf_size =rte_cpu_to_le_16 (rx_buf_size); enables |=HWRM_RING_ALLOC_INPUT_ENABLES_RX_BUF_SIZE_VALID ;
@@ -1263,6 +1264,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp, mb_pool = bp->rx_queues[0 ]->mb_pool; rx_buf_size =rte_pktmbuf_data_room_size (mb_pool) -RTE_PKTMBUF_HEADROOM ; + rx_buf_size =RTE_MIN (BNXT_MAX_PKT_LEN , rx_buf_size); req.rx_buf_size =rte_cpu_to_le_16 (rx_buf_size); req.stat_ctx_id =rte_cpu_to_le_32 (stats_ctx_id);
@@ -1880,6 +1882,7 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp, size =rte_pktmbuf_data_room_size (bp->rx_queues[0 ]->mb_pool); size -=RTE_PKTMBUF_HEADROOM ; + size =RTE_MIN (BNXT_MAX_PKT_LEN , size); req.jumbo_thresh =rte_cpu_to_le_16 (size); req.vnic_id =rte_cpu_to_le_16 (vnic->fw_vnic_id);
drivers/net/bnxt/bnxt_ring.c +0 -5
@@ -615,9 +615,6 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)if (rc) goto err_out; - rxq->rx_buf_use_size =BNXT_MAX_MTU +RTE_ETHER_HDR_LEN + -RTE_ETHER_CRC_LEN + (2 *VLAN_TAG_SIZE ); -if (bp->eth_dev->data->rx_queue_state[queue_index] ==RTE_ETH_QUEUE_STATE_STARTED ) {if (bnxt_init_one_rx_ring (rxq)) {
@@ -688,8 +685,6 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)if (bnxt_alloc_rx_agg_ring (bp, i)) goto err_out; - rxq->rx_buf_use_size =BNXT_MAX_MTU +RTE_ETHER_HDR_LEN + -RTE_ETHER_CRC_LEN + (2 *VLAN_TAG_SIZE );if (bnxt_init_one_rx_ring (rxq)) {PMD_DRV_LOG (ERR ,"bnxt_init_one_rx_ring failed!\n" );bnxt_rx_queue_release_op (rxq);
drivers/net/bnxt/bnxt_rxq.c +1 -1
@@ -333,13 +333,13 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, rxq->nb_rx_desc = nb_desc; rxq->rx_free_thresh = rx_conf->rx_free_thresh; -PMD_DRV_LOG (DEBUG ,"RX Buf size is %d\n" , rxq->rx_buf_use_size);PMD_DRV_LOG (DEBUG ,"RX Buf MTU %d\n" , eth_dev->data->mtu); rc =bnxt_init_rx_ring_struct (rxq, socket_id);if (rc) goto out; +PMD_DRV_LOG (DEBUG ,"RX Buf size is %d\n" , rxq->rx_buf_size); rxq->queue_id = queue_idx; rxq->port_id = eth_dev->data->port_id;if (rx_offloads &DEV_RX_OFFLOAD_KEEP_CRC )
drivers/net/bnxt/bnxt_rxq.h +0 -1
@@ -36,7 +36,6 @@ struct bnxt_rx_queue {struct bnxt_vnic_info *vnic;uint32_t rx_buf_size; -uint32_t rx_buf_use_size;/* useable size */ struct bnxt_rx_ring_info *rx_ring;struct bnxt_cp_ring_info *cp_ring;rte_atomic64_t rx_mbuf_alloc_fail;
drivers/net/bnxt/bnxt_rxr.c +2 -5
@@ -714,9 +714,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)struct bnxt_rx_ring_info *rxr;struct bnxt_ring *ring; - rxq->rx_buf_use_size =BNXT_MAX_MTU +RTE_ETHER_HDR_LEN + -RTE_ETHER_CRC_LEN + (2 *VLAN_TAG_SIZE ); - rxq->rx_buf_size = rxq->rx_buf_use_size +sizeof (struct rte_mbuf ); + rxq->rx_buf_size =BNXT_MAX_PKT_LEN +sizeof (struct rte_mbuf ); rxr = rte_zmalloc_socket("bnxt_rx_ring", sizeof(struct bnxt_rx_ring_info),
@@ -801,8 +799,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)uint16_t size; size =rte_pktmbuf_data_room_size (rxq->mb_pool) -RTE_PKTMBUF_HEADROOM ; -if (rxq->rx_buf_use_size <= size) - size = rxq->rx_buf_use_size; + size =RTE_MIN (BNXT_MAX_PKT_LEN , size); type =RX_PROD_PKT_BD_TYPE_RX_PROD_PKT |RX_PROD_PKT_BD_FLAGS_EOP_PAD ;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 3/15 net/bnxt: fix rxq stop/start handling
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Driver should not change "deferred_start" state of the rx queues. It should get the state in queue_setup_op() and use that value.
Since the deferred start state was being used in the packet receive functions to determine whether a stopped rx ring should be polled, introduced a per-rxq flag to track queue stopped/started state.
--- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_ring.c | 3 +-- drivers/net/bnxt/bnxt_rxq.c | 36 +++++++++++++++++++--------- drivers/net/bnxt/bnxt_rxq.h | 1 + drivers/net/bnxt/bnxt_rxr.c | 7 +++--- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 2 +- 6 files changed, 32 insertions(+), 19 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -1884,7 +1884,7 @@ bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->conf.rx_free_thresh = rxq->rx_free_thresh; qinfo->conf.rx_drop_en =0 ; - qinfo->conf.rx_deferred_start =0 ; + qinfo->conf.rx_deferred_start = rxq->rx_deferred_start; } static void
drivers/net/bnxt/bnxt_ring.c +1 -2
@@ -615,8 +615,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)if (rc) goto err_out; -if (bp->eth_dev->data->rx_queue_state[queue_index] == -RTE_ETH_QUEUE_STATE_STARTED ) { +if (!rxq->rx_started) {if (bnxt_init_one_rx_ring (rxq)) {RTE_LOG (ERR ,PMD ,"bnxt_init_one_rx_ring failed!\n" );
drivers/net/bnxt/bnxt_rxq.c +25 -11
@@ -359,9 +359,19 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, }rte_atomic64_init (&rxq->rx_mbuf_alloc_fail); - rxq->rx_deferred_start = rx_conf->rx_deferred_start; - queue_state = rxq->rx_deferred_start ?RTE_ETH_QUEUE_STATE_STOPPED : -RTE_ETH_QUEUE_STATE_STARTED ; +/* rxq 0 must not be stopped when used as async CPR */ +if (!BNXT_NUM_ASYNC_CPR (bp) && queue_idx ==0 ) + rxq->rx_deferred_start = false; +else + rxq->rx_deferred_start = rx_conf->rx_deferred_start; + +if (rxq->rx_deferred_start) { + queue_state =RTE_ETH_QUEUE_STATE_STOPPED ; + rxq->rx_started = false; + }else { + queue_state =RTE_ETH_QUEUE_STATE_STARTED ; + rxq->rx_started = true; + } eth_dev->data->rx_queue_state[queue_idx] = queue_state;rte_spinlock_init (&rxq->lock);
@@ -434,6 +444,11 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)return -EINVAL ; } +/* Set the queue state to started here. +* We check the status of the queue while posting buffer. +* If queue is it started, we do not post buffers for Rx. +*/ + rxq->rx_started = true;bnxt_free_hwrm_rx_ring (bp, rx_queue_id); rc =bnxt_alloc_hwrm_rx_ring (bp, rx_queue_id);if (rc)
@@ -450,20 +465,19 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) vnic->fw_grp_ids[rx_queue_id] = bp->grp_info[rx_queue_id].fw_grp_id; +PMD_DRV_LOG (DEBUG , +"vnic = %p fw_grp_id = %d\n" , + vnic, bp->grp_info[rx_queue_id].fw_grp_id); } -PMD_DRV_LOG (DEBUG , -"vnic = %p fw_grp_id = %d\n" , - vnic, bp->grp_info[rx_queue_id].fw_grp_id); - rc =bnxt_vnic_rss_configure (bp, vnic); } -if (rc ==0 ) { +if (rc ==0 ) dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; - rxq->rx_deferred_start = false; - } +else + rxq->rx_started = false; PMD_DRV_LOG(INFO, "queue %d, rx_deferred_start %d, state %d!\n",
@@ -502,7 +516,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) } dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; - rxq->rx_deferred_start = true; + rxq->rx_started = false;PMD_DRV_LOG (DEBUG ,"Rx queue stopped\n" );if (dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS_FLAG ) {
drivers/net/bnxt/bnxt_rxq.h +1 -0
@@ -30,6 +30,7 @@ struct bnxt_rx_queue {uint16_t port_id;/* Device port identifier */ uint8_t crc_len;/* 0 if CRC stripped, 4 otherwise */ uint8_t rx_deferred_start;/* not in global dev start */ +uint8_t rx_started;/* RX queue is started */ struct bnxt *bp;int index;
drivers/net/bnxt/bnxt_rxr.c +3 -4
@@ -576,10 +576,9 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,if (unlikely (is_bnxt_in_error (rxq->bp)))return 0 ; -/* If Rx Q was stopped return. RxQ0 cannot be stopped. */ -if (unlikely (((rxq->rx_deferred_start || - !rte_spinlock_trylock (&rxq->lock)) && - rxq->queue_id))) +/* If Rx Q was stopped return */ +if (unlikely (!rxq->rx_started || + !rte_spinlock_trylock (&rxq->lock)))return 0 ;/* Handle RX burst request */
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +1 -1
@@ -224,7 +224,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, 0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) *//* If Rx Q was stopped return */ -if (rxq->rx_deferred_start) +if (unlikely (!rxq->rx_started))return 0 ;if (rxq->rxrearm_nb >=RTE_BNXT_RXQ_REARM_THRESH )
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 4/15 net/bnxt: subscribe to link speed change notification
In reply to Ajit KhapardeWe are not subscribing to link speed change notification. This patch addresses that.
--- drivers/net/bnxt/bnxt_hwrm.c | 1 + drivers/net/bnxt/bnxt_hwrm.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
@@ -738,6 +738,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)rte_cpu_to_le_32 (ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE |ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED |ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE | +ASYNC_CMPL_EVENT_ID_LINK_SPEED_CHANGE |ASYNC_CMPL_EVENT_ID_RESET_NOTIFY );if (bp->flags &BNXT_FLAG_FW_CAP_ERROR_RECOVERY ) req.async_event_fwd[0] |=
drivers/net/bnxt/bnxt_hwrm.h +2 -0
@@ -21,6 +21,8 @@ struct bnxt_cp_ring_info; (1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED)#define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE \ (1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE) +#define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CHANGE \ + (1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE)#define ASYNC_CMPL_EVENT_ID_RESET_NOTIFY \ (1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY)#define ASYNC_CMPL_EVENT_ID_ERROR_RECOVERY \
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 5/15 net/bnxt: fix async link handling and update
In reply to Ajit KhapardeWhen updating the link because of an async link notification there is no need to set wait_for_completion. At this point the link related information should be available without need to poll. Use rte_eth_linkstatus_set instead of memcpy to ensure atomicity while updating the link status.
We force the physical link down as a part of device stop.
But we are not waiting there enough and handling the async notification before exiting. It just sits in the default CQ till we do a device start. Fix it by calling the CQ handler in device stop.
--- drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++---- drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_irq.h | 1 + 4 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +1 -1
@@ -31,7 +31,7 @@ void bnxt_handle_async_event(struct bnxt *bp,case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE :case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE :/* FALLTHROUGH */ -bnxt_link_update_op (bp->eth_dev,1 ); +bnxt_link_update_op (bp->eth_dev,0 );break ;case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD :PMD_DRV_LOG (INFO ,"Async event: PF driver unloaded\n" );
drivers/net/bnxt/bnxt_ethdev.c +7 -4
@@ -815,6 +815,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS); } +bnxt_enable_int (bp);bnxt_hwrm_if_change (bp,1 ); rc =bnxt_init_chip (bp);
@@ -836,7 +837,6 @@ 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 ; eth_dev->data->dev_started =1 ; bp->dev_stopped =0 ;
@@ -897,7 +897,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)/* TBD: STOP HW queues DMA */ eth_dev->data->dev_link.link_status =0 ; } -bnxt_set_hwrm_link_config (bp, false); +bnxt_dev_set_link_down_op (eth_dev); +/* Wait for link to be reset and the async notification to process. */ +rte_delay_ms (BNXT_LINK_WAIT_INTERVAL *2 );/* Clean queue intr-vector mapping */ rte_intr_efd_disable (intr_handle);
@@ -909,6 +911,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)bnxt_hwrm_port_clr_stats (bp);bnxt_free_tx_mbufs (bp);bnxt_free_rx_mbufs (bp); +/* Process any remaining notifications in default completion queue */ +bnxt_int_handler (eth_dev);bnxt_shutdown_nic (bp);bnxt_hwrm_if_change (bp,0 ); bp->dev_stopped =1 ;
@@ -1055,8 +1059,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)/* Timed out or success */ if (new.link_status != eth_dev->data->dev_link.link_status || new.link_speed != eth_dev->data->dev_link.link_speed) { -memcpy (ð_dev->data->dev_link, &new, -sizeof (struct rte_eth_link )); +rte_eth_linkstatus_set (eth_dev, &new); _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC,
drivers/net/bnxt/bnxt_irq.c +1 -1
@@ -18,7 +18,7 @@* Interrupts */ -static void bnxt_int_handler (void *param) +void bnxt_int_handler (void *param) {struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;struct bnxt *bp = eth_dev->data->dev_private;
drivers/net/bnxt/bnxt_irq.h +1 -0
@@ -22,5 +22,6 @@ void bnxt_disable_int(struct bnxt *bp);void bnxt_enable_int (struct bnxt *bp);int bnxt_setup_int (struct bnxt *bp);int bnxt_request_int (struct bnxt *bp); +void bnxt_int_handler (void *param);#endif
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 6/15 net/bnxt: fix 40G link failure for Thor
In reply to Ajit KhapardeFrom: Santoshkumar Karanappa Rastapur <[email protected]>
Link autonegotiation for 40G is not supported by Thor.
Hence speed needs to be forced and autoneg disabled to configure 40G speed.
--- drivers/net/bnxt/bnxt_hwrm.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +19 -3
@@ -2677,11 +2677,27 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) goto port_phy_cfg; autoneg =bnxt_check_eth_link_autoneg (dev_conf->link_speeds); +if (BNXT_CHIP_THOR (bp) && + dev_conf->link_speeds ==ETH_LINK_SPEED_40G ) { +/* 40G is not supported as part of media auto detect. +* The speed should be forced and autoneg disabled +* to configure 40G speed. +*/ +PMD_DRV_LOG (INFO ,"Disabling autoneg for 40G\n" ); + autoneg =0 ; + } + speed =bnxt_parse_eth_link_speed (dev_conf->link_speeds); link_req.phy_flags =HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY ; -/* Autoneg can be done only when the FW allows */ -if (autoneg ==1 && !(bp->link_info.auto_link_speed || - bp->link_info.force_link_speed)) { +/* Autoneg can be done only when the FW allows. +* When user configures fixed speed of 40G and later changes to +* any other speed, auto_link_speed/force_link_speed is still set +* to 40G until link comes up at new speed. +*/ +if (autoneg ==1 && + !(!BNXT_CHIP_THOR (bp) && + (bp->link_info.auto_link_speed || + bp->link_info.force_link_speed))) { link_req.phy_flags |=HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG ; link_req.auto_link_speed_mask =
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 7/15 net/bnxt: fix L2 context calculation for Thor
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
On Wh+, number of L2 context supported by FW is the sum of number of EM flow count and number of L2 context count returned in HWRM_FUNC_QCFG. This is not true for Thor. Restrict this only for Whitney for now.
--- drivers/net/bnxt/bnxt_hwrm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +6 -5
@@ -601,8 +601,9 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->max_rx_rings =rte_le_to_cpu_16 (resp->max_rx_rings); 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; + bp->max_l2_ctx =rte_le_to_cpu_16 (resp->max_l2_ctxs); +if (!BNXT_CHIP_THOR (bp)) + bp->max_l2_ctx += bp->max_rx_em_flows;/* TODO: For now, do not support VMDq/RFS on VFs. */ if (BNXT_PF (bp)) {if (bp->pf.max_vfs)
@@ -858,9 +859,9 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)/* 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_l2_ctx =rte_le_to_cpu_16 (resp->max_l2_ctxs); +if (!BNXT_CHIP_THOR (bp)) + bp->max_l2_ctx += 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 8/15 net/bnxt: fix use of deferred start of transmit queues
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Driver should not change "deferred_start" state of the tx queues. It should get the state in queue_setup_op() and use that value.
Since the deferred start state was being used in the packet transmit functions to determine whether the queue has been stopped already, introduced a per-txq flag to track queue stopped/started state.
--- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 2 +- drivers/net/bnxt/bnxt_txq.c | 5 +++++ drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 6 +++--- 4 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +1 -1
@@ -464,7 +464,7 @@ bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,struct bnxt_tx_queue *txq = tx_queue;/* Tx queue was stopped; wait for it to be restarted */ -if (unlikely (txq->tx_deferred_start)) { +if (unlikely (!txq->tx_started)) {PMD_DRV_LOG (DEBUG ,"Tx q stopped;return\n" );return 0 ; }
drivers/net/bnxt/bnxt_txq.c +5 -0
@@ -131,6 +131,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, txq->bp = bp; txq->nb_tx_desc = nb_desc; txq->tx_free_thresh = tx_conf->tx_free_thresh; + txq->tx_deferred_start = tx_conf->tx_deferred_start; rc =bnxt_init_tx_ring_struct (txq, socket_id);if (rc)
@@ -157,6 +158,10 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, eth_dev->data->tx_queues[queue_idx] = txq; +if (txq->tx_deferred_start) + txq->tx_started = false; +else + txq->tx_started = true; out:return rc; }
drivers/net/bnxt/bnxt_txq.h +1 -0
@@ -24,6 +24,7 @@ struct bnxt_tx_queue {uint8_t wthresh;/* Write-back threshold reg */ uint32_t ctx_curr;/* Hardware context states */ uint8_t tx_deferred_start;/* not in global dev start */ +uint8_t tx_started;/* TX queue is started */ struct bnxt *bp;int index;
drivers/net/bnxt/bnxt_txr.c +3 -3
@@ -439,7 +439,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,bnxt_handle_tx_cp (txq);/* Tx queue was stopped; wait for it to be restarted */ -if (txq->tx_deferred_start) { +if (unlikely (!txq->tx_started)) {PMD_DRV_LOG (DEBUG ,"Tx q stopped;return\n" );return 0 ; }
@@ -488,7 +488,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)return rc; dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; - txq->tx_deferred_start = false; + txq->tx_started = true;PMD_DRV_LOG (DEBUG ,"Tx queue started\n" );return 0 ;
@@ -508,7 +508,7 @@ int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)bnxt_handle_tx_cp (txq); dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; - txq->tx_deferred_start = true; + txq->tx_started = false;PMD_DRV_LOG (DEBUG ,"Tx queue stopped\n" );return 0 ;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 9/15 net/bnxt: remove unnecessary return check
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
HWRM_CHECK_RESULT_SILENT() returns if the HWRM command fails. There is no need to check the return value after this call.
--- drivers/net/bnxt/bnxt_hwrm.c | 119 +++++++++++++++++------------------ 1 file changed, 56 insertions(+), 63 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +56 -63
@@ -4377,7 +4377,10 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)struct hwrm_func_backing_store_qcaps_input req = {0 };struct hwrm_func_backing_store_qcaps_output *resp = bp->hwrm_cmd_resp_addr; -int rc; +struct bnxt_ctx_pg_info *ctx_pg; +struct bnxt_ctx_mem_info *ctx; +int total_alloc_len; +int rc, i; if (!BNXT_CHIP_THOR(bp) || bp->hwrm_spec_code < HWRM_VERSION_1_9_2 ||
@@ -4389,70 +4392,60 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp) rc =bnxt_hwrm_send_message (bp, &req,sizeof (req),BNXT_USE_CHIMP_MB );HWRM_CHECK_RESULT_SILENT (); -if (!rc) { -struct bnxt_ctx_pg_info *ctx_pg; -struct bnxt_ctx_mem_info *ctx; -int total_alloc_len; -int i; - - total_alloc_len =sizeof (*ctx); - ctx =rte_malloc ("bnxt_ctx_mem" , total_alloc_len, -RTE_CACHE_LINE_SIZE ); -if (!ctx) { - rc = -ENOMEM ; - goto ctx_err; - } -memset (ctx,0 , total_alloc_len); + total_alloc_len =sizeof (*ctx); + ctx =rte_zmalloc ("bnxt_ctx_mem" , total_alloc_len, +RTE_CACHE_LINE_SIZE ); +if (!ctx) { + rc = -ENOMEM ; + goto ctx_err; + } - ctx_pg =rte_malloc ("bnxt_ctx_pg_mem" , -sizeof (*ctx_pg) *BNXT_MAX_Q , -RTE_CACHE_LINE_SIZE ); -if (!ctx_pg) { - rc = -ENOMEM ; - goto ctx_err; - } -for (i =0 ; i <BNXT_MAX_Q ; i++, ctx_pg++) - ctx->tqm_mem[i] = ctx_pg; - - bp->ctx = ctx; - ctx->qp_max_entries =rte_le_to_cpu_32 (resp->qp_max_entries); - ctx->qp_min_qp1_entries = -rte_le_to_cpu_16 (resp->qp_min_qp1_entries); - ctx->qp_max_l2_entries = -rte_le_to_cpu_16 (resp->qp_max_l2_entries); - ctx->qp_entry_size =rte_le_to_cpu_16 (resp->qp_entry_size); - ctx->srq_max_l2_entries = -rte_le_to_cpu_16 (resp->srq_max_l2_entries); - ctx->srq_max_entries =rte_le_to_cpu_32 (resp->srq_max_entries); - ctx->srq_entry_size =rte_le_to_cpu_16 (resp->srq_entry_size); - ctx->cq_max_l2_entries = -rte_le_to_cpu_16 (resp->cq_max_l2_entries); - ctx->cq_max_entries =rte_le_to_cpu_32 (resp->cq_max_entries); - ctx->cq_entry_size =rte_le_to_cpu_16 (resp->cq_entry_size); - ctx->vnic_max_vnic_entries = -rte_le_to_cpu_16 (resp->vnic_max_vnic_entries); - ctx->vnic_max_ring_table_entries = -rte_le_to_cpu_16 (resp->vnic_max_ring_table_entries); - ctx->vnic_entry_size =rte_le_to_cpu_16 (resp->vnic_entry_size); - ctx->stat_max_entries = -rte_le_to_cpu_32 (resp->stat_max_entries); - ctx->stat_entry_size =rte_le_to_cpu_16 (resp->stat_entry_size); - ctx->tqm_entry_size =rte_le_to_cpu_16 (resp->tqm_entry_size); - ctx->tqm_min_entries_per_ring = -rte_le_to_cpu_32 (resp->tqm_min_entries_per_ring); - ctx->tqm_max_entries_per_ring = -rte_le_to_cpu_32 (resp->tqm_max_entries_per_ring); - ctx->tqm_entries_multiple = resp->tqm_entries_multiple; -if (!ctx->tqm_entries_multiple) - ctx->tqm_entries_multiple =1 ; - ctx->mrav_max_entries = -rte_le_to_cpu_32 (resp->mrav_max_entries); - ctx->mrav_entry_size =rte_le_to_cpu_16 (resp->mrav_entry_size); - ctx->tim_entry_size =rte_le_to_cpu_16 (resp->tim_entry_size); - ctx->tim_max_entries =rte_le_to_cpu_32 (resp->tim_max_entries); - }else { - rc =0 ; + ctx_pg =rte_malloc ("bnxt_ctx_pg_mem" , +sizeof (*ctx_pg) *BNXT_MAX_Q , +RTE_CACHE_LINE_SIZE ); +if (!ctx_pg) { + rc = -ENOMEM ; + goto ctx_err; } +for (i =0 ; i <BNXT_MAX_Q ; i++, ctx_pg++) + ctx->tqm_mem[i] = ctx_pg; + + bp->ctx = ctx; + ctx->qp_max_entries =rte_le_to_cpu_32 (resp->qp_max_entries); + ctx->qp_min_qp1_entries = +rte_le_to_cpu_16 (resp->qp_min_qp1_entries); + ctx->qp_max_l2_entries = +rte_le_to_cpu_16 (resp->qp_max_l2_entries); + ctx->qp_entry_size =rte_le_to_cpu_16 (resp->qp_entry_size); + ctx->srq_max_l2_entries = +rte_le_to_cpu_16 (resp->srq_max_l2_entries); + ctx->srq_max_entries =rte_le_to_cpu_32 (resp->srq_max_entries); + ctx->srq_entry_size =rte_le_to_cpu_16 (resp->srq_entry_size); + ctx->cq_max_l2_entries = +rte_le_to_cpu_16 (resp->cq_max_l2_entries); + ctx->cq_max_entries =rte_le_to_cpu_32 (resp->cq_max_entries); + ctx->cq_entry_size =rte_le_to_cpu_16 (resp->cq_entry_size); + ctx->vnic_max_vnic_entries = +rte_le_to_cpu_16 (resp->vnic_max_vnic_entries); + ctx->vnic_max_ring_table_entries = +rte_le_to_cpu_16 (resp->vnic_max_ring_table_entries); + ctx->vnic_entry_size =rte_le_to_cpu_16 (resp->vnic_entry_size); + ctx->stat_max_entries = +rte_le_to_cpu_32 (resp->stat_max_entries); + ctx->stat_entry_size =rte_le_to_cpu_16 (resp->stat_entry_size); + ctx->tqm_entry_size =rte_le_to_cpu_16 (resp->tqm_entry_size); + ctx->tqm_min_entries_per_ring = +rte_le_to_cpu_32 (resp->tqm_min_entries_per_ring); + ctx->tqm_max_entries_per_ring = +rte_le_to_cpu_32 (resp->tqm_max_entries_per_ring); + ctx->tqm_entries_multiple = resp->tqm_entries_multiple; +if (!ctx->tqm_entries_multiple) + ctx->tqm_entries_multiple =1 ; + ctx->mrav_max_entries = +rte_le_to_cpu_32 (resp->mrav_max_entries); + ctx->mrav_entry_size =rte_le_to_cpu_16 (resp->mrav_entry_size); + ctx->tim_entry_size =rte_le_to_cpu_16 (resp->tim_entry_size); + ctx->tim_max_entries =rte_le_to_cpu_32 (resp->tim_max_entries); ctx_err:HWRM_UNLOCK ();return rc;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 10/15 net/bnxt: remove unused macro
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
remove MAX_NUM_MAC_ADDR macro
--- drivers/net/bnxt/bnxt.h | 1 - 1 file changed, 1 deletion(-)
drivers/net/bnxt/bnxt.h +0 -1
@@ -492,7 +492,6 @@ struct bnxt {struct bnxt_irq *irq_tbl; -#define MAX_NUM_MAC_ADDR 32uint8_t mac_addr[RTE_ETHER_ADDR_LEN ];uint16_t hwrm_cmd_seq;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 11/15 net/bnxt: remove unnecessary interrupt disable
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Since bnxt_enable_int() is called at start time, invoke bnxt_disable_int() during stop only. Remove it from device uninit function.
--- drivers/net/bnxt/bnxt_ethdev.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +0 -1
@@ -4463,7 +4463,6 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev) {int rc; -bnxt_disable_int (bp);bnxt_free_int (bp);bnxt_free_mem (bp, reconfig_dev);bnxt_hwrm_func_buf_unrgtr (bp);
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 12/15 net/bnxt: fix accessing variable before null check
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
Check input argument "rxq" in bnxt_rx_queue_release_mbufs(), to be sure variable is not NULL before accessing it.
--- drivers/net/bnxt/bnxt_rxq.c | 55 +++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 27 deletions(-)
drivers/net/bnxt/bnxt_rxq.c +28 -27
@@ -207,41 +207,42 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)struct bnxt_tpa_info *tpa_info;uint16_t i; +if (!rxq) +return ; +rte_spinlock_lock (&rxq->lock); -if (rxq) { - sw_ring = rxq->rx_ring->rx_buf_ring; -if (sw_ring) { -for (i =0 ; - i < rxq->rx_ring->rx_ring_struct->ring_size; i++) { -if (sw_ring[i].mbuf) { -rte_pktmbuf_free_seg (sw_ring[i].mbuf); - sw_ring[i].mbuf =NULL ; - } + sw_ring = rxq->rx_ring->rx_buf_ring; +if (sw_ring) { +for (i =0 ; + i < rxq->rx_ring->rx_ring_struct->ring_size; i++) { +if (sw_ring[i].mbuf) { +rte_pktmbuf_free_seg (sw_ring[i].mbuf); + sw_ring[i].mbuf =NULL ; } } -/* Free up mbufs in Agg ring */ - sw_ring = rxq->rx_ring->ag_buf_ring; -if (sw_ring) { -for (i =0 ; - i < rxq->rx_ring->ag_ring_struct->ring_size; i++) { -if (sw_ring[i].mbuf) { -rte_pktmbuf_free_seg (sw_ring[i].mbuf); - sw_ring[i].mbuf =NULL ; - } + } +/* Free up mbufs in Agg ring */ + sw_ring = rxq->rx_ring->ag_buf_ring; +if (sw_ring) { +for (i =0 ; + i < rxq->rx_ring->ag_ring_struct->ring_size; i++) { +if (sw_ring[i].mbuf) { +rte_pktmbuf_free_seg (sw_ring[i].mbuf); + sw_ring[i].mbuf =NULL ; } } + } -/* Free up mbufs in TPA */ - tpa_info = rxq->rx_ring->tpa_info; -if (tpa_info) { -int max_aggs =BNXT_TPA_MAX_AGGS (rxq->bp); +/* Free up mbufs in TPA */ + tpa_info = rxq->rx_ring->tpa_info; +if (tpa_info) { +int max_aggs =BNXT_TPA_MAX_AGGS (rxq->bp); -for (i =0 ; i < max_aggs; i++) { -if (tpa_info[i].mbuf) { -rte_pktmbuf_free_seg (tpa_info[i].mbuf); - tpa_info[i].mbuf =NULL ; - } +for (i =0 ; i < max_aggs; i++) { +if (tpa_info[i].mbuf) { +rte_pktmbuf_free_seg (tpa_info[i].mbuf); + tpa_info[i].mbuf =NULL ; } } }
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 13/15 net/bnxt: fix Rx queue count devop
In reply to Ajit KhapardeFrom: Rahul Gupta <[email protected]>
Fix Computing of number of used descriptors in an Rx queue.
--- drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +7 -24
@@ -2035,9 +2035,6 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)struct bnxt_cp_ring_info *cpr;struct bnxt_rx_queue *rxq;struct rx_pkt_cmpl *rxcmp; -uint16_t cmp_type; -uint8_t cmp =1 ; -bool valid;int rc; rc =is_bnxt_in_error (bp);
@@ -2046,33 +2043,19 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id) rxq = dev->data->rx_queues[rx_queue_id]; cpr = rxq->cp_ring; - valid = cpr->valid; + raw_cons = cpr->cp_raw_cons; -while (raw_cons < rxq->nb_rx_desc) { +while (1 ) { cons =RING_CMP (cpr->cp_ring_struct, raw_cons); +rte_prefetch0 (&cpr->cp_desc_ring[cons]); rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons]; -if (!CMPL_VALID (rxcmp, valid)) - goto nothing_to_do; - valid =FLIP_VALID (cons, cpr->cp_ring_struct->ring_mask, valid); - cmp_type =CMP_TYPE (rxcmp); -if (cmp_type ==RX_TPA_END_CMPL_TYPE_RX_TPA_END ) { - cmp = (rte_le_to_cpu_32 ( - ((struct rx_tpa_end_cmpl *) - (rxcmp))->agg_bufs_v1) & -RX_TPA_END_CMPL_AGG_BUFS_MASK ) >> -RX_TPA_END_CMPL_AGG_BUFS_SFT ; - desc++; - }else if (cmp_type ==0x11 ) { - desc++; - cmp = (rxcmp->agg_bufs_v1 & -RX_PKT_CMPL_AGG_BUFS_MASK ) >> -RX_PKT_CMPL_AGG_BUFS_SFT ; +if (!CMP_VALID (rxcmp, raw_cons, cpr->cp_ring_struct)) { +break ; }else { - cmp =1 ; + raw_cons++; + desc++; } -nothing_to_do: - raw_cons += cmp ? cmp :2 ; }return desc;
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 14/15 net/bnxt: fix mbuf flags for PTP packets in vector mode Rx
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
PKT_RX_IEEE1588_PTP and PKT_RX_IEEE1588_TMST flags need to be set in the offload flags for the received pkt in case of PTP offload.
--- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +10 -1
@@ -251,6 +251,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,uint16_t cp_cons;struct rte_mbuf *mbuf;__m128i mm_rxcmp, pkt_mb; +uint16_t flags_type; tmp_raw_cons =NEXT_RAW_CMP (raw_cons); cp_cons =RING_CMP (cpr->cp_ring_struct, tmp_raw_cons);
@@ -280,9 +281,17 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,rte_compiler_barrier (); -if (rxcmp->flags_type &RX_PKT_CMPL_FLAGS_RSS_VALID ) + flags_type =rte_le_to_cpu_16 (rxcmp->flags_type); + +if (flags_type &RX_PKT_CMPL_FLAGS_RSS_VALID ) mbuf->ol_flags |=PKT_RX_RSS_HASH ; +#ifdef RTE_LIBRTE_IEEE1588 +if ((flags_type &RX_PKT_CMPL_FLAGS_MASK ) == +RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP ) + mbuf->ol_flags |=PKT_RX_IEEE1588_PTP | +PKT_RX_IEEE1588_TMST ; +#endif if (rxcmp1->flags2 &RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN ) { mbuf->vlan_tci = rxcmp1->metadata &
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 15/15 net/bnxt: handle reset notify async event on ns3 devices
In reply to Ajit KhapardeFrom: Kalesh AP <[email protected]>
FW sets HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD in HWRM_FUNC_QCAPS command, if device requires to invoke fastboot FW during FW reset.
Wait for FW_STATUS to set the SHUTDOWN bit in health register before the master function calls fastboot FW.
--- drivers/net/bnxt/bnxt.h | 3 +++ drivers/net/bnxt/bnxt_cpr.c | 25 +++++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ drivers/net/bnxt/hsi_struct_def_dpdk.h | 8 ++++++++ 4 files changed, 41 insertions(+)
drivers/net/bnxt/bnxt.h +3 -0
@@ -409,6 +409,8 @@ struct bnxt_error_recovery_info {#define BNXT_GRCP_WINDOW_2_BASE 0x2000#define BNXT_GRCP_WINDOW_3_BASE 0x3000 +#define BNXT_FW_STATUS_SHUTDOWN 0x100000 +#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)struct bnxt {void *bar0;
@@ -442,6 +444,7 @@ struct bnxt {#define BNXT_FLAG_EXT_STATS_SUPPORTED BIT(20)#define BNXT_FLAG_NEW_RM BIT(21)#define BNXT_FLAG_INIT_DONE BIT(22) +#define BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD BIT(23)#define BNXT_PF (bp) (!((bp)->flags & BNXT_FLAG_VF))#define BNXT_VF (bp) ((bp)->flags & BNXT_FLAG_VF)#define BNXT_NPAR (bp) ((bp)->port_partition_type)
drivers/net/bnxt/bnxt_cpr.c +25 -0
@@ -5,6 +5,7 @@#include <rte_malloc.h> #include <rte_alarm.h> +#include <rte_cycles.h> #include "bnxt.h" #include "bnxt_cpr.h"
@@ -12,6 +13,29 @@#include "bnxt_ring.h" #include "hsi_struct_def_dpdk.h" +static void bnxt_handle_fatal_event (struct bnxt *bp) +{ +uint32_t val, timeout; + +/* if HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD is set +* in HWRM_FUNC_QCAPS command, wait for FW_STATUS to set +* the SHUTDOWN bit in health register +*/ +if (!(bp->recovery_info && + (bp->flags &BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD ))) +return ; + + timeout = bp->fw_reset_min_msecs; +do { + val =bnxt_read_fw_status_reg (bp,BNXT_FW_STATUS_REG ); +if (val &BNXT_FW_STATUS_SHUTDOWN ) +return ; + +rte_delay_ms (100 ); + timeout -=100 ; + }while (timeout); +} +/* * Async event handling */
@@ -57,6 +81,7 @@ void bnxt_handle_async_event(struct bnxt *bp,PMD_DRV_LOG (INFO ,"Firmware fatal reset event received\n" ); bp->flags |=BNXT_FLAG_FATAL_ERROR ; +bnxt_handle_fatal_event (bp); }else {PMD_DRV_LOG (INFO ,"Firmware non-fatal reset event received\n" );
drivers/net/bnxt/bnxt_hwrm.c +5 -0
@@ -634,6 +634,11 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_FW_CAP_ERROR_RECOVERY ; } +if (flags &HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD ) + bp->flags |=BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD ; +else + bp->flags &= ~BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD ; +HWRM_UNLOCK ();return rc;
drivers/net/bnxt/hsi_struct_def_dpdk.h +8 -0
@@ -7327,6 +7327,14 @@ struct hwrm_func_qcaps_output {*/ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_STATS_SUPPORTED \ UINT32_C(0x1000000) +/* +* If the query is for a VF, then this flag shall be ignored. +* If this query is for a PF and this flag is set to 1, then host +* must initiate reset or reload (or fastboot) the firmware image +* upon detection of device shutdown state. +*/ +#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD \ + UINT32_C(0x2000000)/* * This value is current MAC address configured for this * function. A value of 00-00-00-00-00-00 indicates no
Signature · 1 line
2.20.1 (Apple Git-117)