patchset for bnxt PMD
cover patchset for bnxt PMD
Patchset against dpdk-next
Apart from couple of fixes, this set updates the HWRM version to 1.8.2. The patch to update the HWRM is based on a file which is autogenerated and most of the changes in the actual PMD are macro name changes. This patch will throw a bunch of checkpatch warnings, but they are because of macro names which span > 80 characters.
Please apply.
Ajit Khaparde (3):
net/bnxt: handle Rx multi queue creation properly net/bnxt: remove redundant code parsing pool_map net/bnxt: update HWRM API to 1.8.2
drivers/net/bnxt/bnxt.h | 2 - drivers/net/bnxt/bnxt_ethdev.c | 7 +- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bnxt/bnxt_hwrm.h | 2 + drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_rxq.c | 29 +- drivers/net/bnxt/bnxt_rxr.c | 4 +- drivers/net/bnxt/bnxt_txr.c | 2 +- drivers/net/bnxt/hsi_struct_def_dpdk.h | 30829 ++++++++++++++++++++++++------- 9 files changed, 24385 insertions(+), 6494 deletions(-)
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH 1/3 net/bnxt: handle Rx multi queue creation properly
This patch simplifies logic for RSS queue creation.
1) Do not hardcode number of VNIC pools in case of RSS
2) Log a message if Number of queues is > RTE_ETHDEV_QUEUE_STAT_CNTRS
3) Move the check for allocation of l2_filter inside the for loop.
--- drivers/net/bnxt/bnxt_ethdev.c | 5 +++++ drivers/net/bnxt/bnxt_rxq.c | 18 ++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
@@ -569,6 +569,11 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)int vlan_mask =0 ;int rc; +if (bp->rx_cp_nr_rings >RTE_ETHDEV_QUEUE_STAT_CNTRS ) { +RTE_LOG (ERR ,PMD , +"RxQ cnt %d > CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n" , + bp->rx_cp_nr_rings,RTE_ETHDEV_QUEUE_STAT_CNTRS ); + } bp->dev_stopped =0 ; rc =bnxt_init_nic (bp);
drivers/net/bnxt/bnxt_rxq.c +6 -12
@@ -68,7 +68,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp)struct bnxt_filter_info *filter;enum rte_eth_nb_pools pools = bp->rx_cp_nr_rings, max_pools =0 ;struct bnxt_rx_queue *rxq; -bool rss_dflt_cr = false; bp->nr_vnics =0 ;
@@ -119,7 +118,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) pools = max_pools;break ;case ETH_MQ_RX_RSS : - pools =1 ; + pools = bp->rx_cp_nr_rings;break ;default : RTE_LOG(ERR, PMD, "Unsupported mq_mod %d\n",
@@ -128,13 +127,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp) goto err_out; } } -/* -* If MQ RX w/o RSS no need for per VNIC filter. -*/ -if ((dev_conf->rxmode.mq_mode Ð_MQ_RX_VMDQ_DCB ) || - (bp->rx_cp_nr_rings && - !(dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS ))) - rss_dflt_cr = true; nb_q_per_grp = bp->rx_cp_nr_rings / pools; start_grp_id =0 ;
@@ -151,7 +143,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)STAILQ_INSERT_TAIL (&bp->ff_pool[i], vnic, next); bp->nr_vnics++; -for (j =0 , ring_idx =0 ; j < nb_q_per_grp; j++, ring_idx++) { +for (j =0 ; j < nb_q_per_grp; j++, ring_idx++) { rxq = bp->eth_dev->data->rx_queues[ring_idx]; rxq->vnic = vnic; }
@@ -166,8 +158,10 @@ int bnxt_mq_rx_configure(struct bnxt *bp) vnic->start_grp_id = start_grp_id; vnic->end_grp_id = end_grp_id; -if (rss_dflt_cr && i) { - vnic->rss_dflt_cr = true; +if (i) { +if (dev_conf->rxmode.mq_mode Ð_MQ_RX_VMDQ_DCB || + !(dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS )) + vnic->rss_dflt_cr = true; goto skip_filter_allocation; } filter =bnxt_alloc_filter (bp);
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH 2/3 net/bnxt: remove redundant code parsing pool_map
In reply to Ajit KhapardeThis patch removes some redundant code from bnxt_mq_rx_configure().
--- drivers/net/bnxt/bnxt_rxq.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/net/bnxt/bnxt_rxq.c +0 -11
@@ -170,17 +170,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp) rc = -ENOMEM ; goto err_out; } -for (j =0 ; j < conf->nb_pool_maps; j++) { -if (conf->pool_map[j].pools & (1UL << i)) { -RTE_LOG (ERR ,PMD , -"Add vlan %u to vmdq pool %u\n" , - conf->pool_map[j].vlan_id, i); - - filter->l2_ivlan = conf->pool_map[j].vlan_id; - filter->enables |= -HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN ; - } - }/* * TODO: Configure & associate CFA rule for * each VNIC for each VMDq with MACVLAN, MACVLAN+TC
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH 3/3 net/bnxt: update HWRM API to 1.8.2
In reply to Ajit KhapardeThis patch updates the HWRM APi to version 1.8.2 This patch is based on an autogenerated file. Almost all the changes in the PMD are macro name changes.
--- drivers/net/bnxt/bnxt.h | 2 - drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bnxt/bnxt_hwrm.h | 2 + drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 4 +- drivers/net/bnxt/bnxt_txr.c | 2 +- drivers/net/bnxt/hsi_struct_def_dpdk.h | 30829 ++++++++++++++++++++++++------- 8 files changed, 24374 insertions(+), 6471 deletions(-)
drivers/net/bnxt/bnxt.h +0 -2
@@ -274,8 +274,6 @@ struct bnxt {int bnxt_link_update_op (struct rte_eth_dev *eth_dev,int wait_to_complete);int bnxt_rcv_msg_from_vf (struct bnxt *bp,uint16_t vf_id,void *msg); -#define RX_PROD_AGG_BD_TYPE_RX_PROD_AGG 0x6 -bool is_bnxt_supported (struct rte_eth_dev *dev);extern const struct rte_flow_ops bnxt_flow_ops;#endif
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -1609,7 +1609,7 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id) goto nothing_to_do; valid =FLIP_VALID (cons, cpr->cp_ring_struct->ring_mask, valid); cmp_type =CMP_TYPE (rxcmp); -if (cmp_type ==RX_PKT_CMPL_TYPE_RX_L2_TPA_END ) { +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) &
drivers/net/bnxt/bnxt_hwrm.c +1 -1
@@ -785,7 +785,7 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp, (link_info->phy_link_status ==HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK ) ?1 :0 ; link_info->link_speed =rte_le_to_cpu_16 (resp->link_speed); - link_info->duplex = resp->duplex; + link_info->duplex = resp->duplex_cfg; link_info->pause = resp->pause; link_info->auto_pause = resp->auto_pause; link_info->force_pause = resp->force_pause;
drivers/net/bnxt/bnxt_hwrm.h +2 -0
@@ -42,6 +42,8 @@ struct bnxt_filter_info;struct bnxt_cp_ring_info ;#define HWRM_SEQ_ID_INVALID -1U +#define HWRM_SHORT_REQ_SIGNATURE_SHORT_CMD \ + HWRM_SHORT_INPUT_SIGNATURE_SHORT_CMDint bnxt_hwrm_cfa_l2_clear_rx_mask (struct bnxt *bp,struct bnxt_vnic_info *vnic);
drivers/net/bnxt/bnxt_irq.c +1 -1
@@ -81,7 +81,7 @@ static void bnxt_int_handler(void *param) goto no_more; }RTE_LOG (INFO ,PMD , -"Ignoring %02x completion\n" ,CMP_TYPE (cmp)); +"Ignoring %02lx completion\n" ,CMP_TYPE (cmp));break ; } raw_cons =NEXT_RAW_CMP (raw_cons);
drivers/net/bnxt/bnxt_rxr.c +2 -2
@@ -410,12 +410,12 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt, cpr->valid); cmp_type =CMP_TYPE (rxcmp); -if (cmp_type ==RX_PKT_CMPL_TYPE_RX_L2_TPA_START ) { +if (cmp_type ==CMPL_BASE_TYPE_RX_TPA_START ) {bnxt_tpa_start (rxq, (struct rx_tpa_start_cmpl *)rxcmp, (struct rx_tpa_start_cmpl_hi *)rxcmp1); rc = -EINVAL ;/* Continue w/o new mbuf */ goto next_rx; - }else if (cmp_type ==RX_PKT_CMPL_TYPE_RX_L2_TPA_END ) { + }else if (cmp_type ==CMPL_BASE_TYPE_RX_TPA_END ) { mbuf =bnxt_tpa_end (rxq, &tmp_raw_cons, (struct rx_tpa_end_cmpl *)rxcmp, (struct rx_tpa_end_cmpl_hi *)rxcmp1);
drivers/net/bnxt/bnxt_txr.c +1 -1
@@ -321,7 +321,7 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq) nb_tx_pkts++; else RTE_LOG_DP(DEBUG, PMD, -"Unhandled CMP type %02x\n" , +"Unhandled CMP type %02lx\n" , CMP_TYPE(txcmp)); raw_cons =NEXT_RAW_CMP (raw_cons); }
drivers/net/bnxt/hsi_struct_def_dpdk.h +24366 -6463
2,938 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.13.5 (Apple Git-94)
Part of the diff is not shown here. View the raw message.
Re: [PATCH 3/3] net/bnxt: update HWRM API to 1.8.2
Hi Ajit,
drivers/net/bnxt/hsi_struct_def_dpdk.h line 7
Quoted 12 lines · Ajit Khaparde
drivers/net/bnxt/hsi_struct_def_dpdk.h +6
-4@@ -1,174 +1,51 @@ -/*- -* BSD LICENSE +/**************************************************************************** +* Copyright(c) 2001-2017 Broadcom Corporation, all rights reserved +* Proprietary and Confidential Information. * -* Copyright(c) 2001-2017 Broadcom Limited. -* All rights reserved. +* This source file is the property of Broadcom Corporation, and +* may not be copied or distributed in any isomorphic form without +* the prior written consent of Broadcom Corporation.
Is this license header correct?
Quoted 30 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +2
-25* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: +* Name: hsi_struct_def_linux_external.h * -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Broadcom Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. +* Description: Definition of HSI data structures * -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -
Re: [PATCH 3/3] net/bnxt: update HWRM API to 1.8.2
In reply to Ajit KhapardeQuoted 5 lines · Ajit Khaparde
This patch updates the HWRM APi to version 1.8.2 This patch is based on an autogenerated file. Almost all the changes in the PMD are macro name changes.
Signed-off-by Ajit Khaparde <[email protected]>
Quoted 9 lines
--- drivers/net/bnxt/bnxt.h | 2 - drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bnxt/bnxt_hwrm.h | 2 + drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 4 +- drivers/net/bnxt/bnxt_txr.c | 2 +- drivers/net/bnxt/hsi_struct_def_dpdk.h | 30829 ++++++++++++++++++++++++-------
Only 30K lines of code :)
Quoted 1 line
8 files changed, 24374 insertions(+), 6471 deletions(-)
There are some replacement in hsi_struct_def_dpdk.h, but also there are lots of new additions.
Are those new additions really used within the driver?
What do you think adding structures that are only used by driver?
I am aware code is auto-generated, but it may be possible to add some #ifdefs to the parts DPDK uses and auto-generate file specific for DPDK?
Thanks,
ferruh
v2 cover bnxt patchset
The first patch updates the HWRM API to version 1.8.2 Some of the patches fix issues reported by Coverity.
Please apply.
Ajit Khaparde (15):
net/bnxt: update HWRM to 1.8.2
net/bnxt: fix tx_offload capability net/bnxt: fix rx_offload capability net/bnxt: handle Rx multi queue creation properly net/bnxt: remove redundant code parsing pool_map net/bnxt: fix redirecting traffic to a VF net/bnxt: fix a bad bit shift operation net/bnxt: fix a null pointer dereference net/bnxt: fix an issue reported by Coverity net/bnxt: fix a potential null pointer dereference net/bnxt: fix a potential null poiner dereference net/bnxt: fix a null pointer deref net/bnxt: fix a pointer deref before null check net/bnxt: fix an issue reported by Coverity net/bnxt: check VLANs from pool_map only for VMDQ
drivers/net/bnxt/bnxt_ethdev.c | 30 +- drivers/net/bnxt/bnxt_filter.c | 94 ++- drivers/net/bnxt/bnxt_filter.h | 2 + drivers/net/bnxt/bnxt_hwrm.c | 5 +- drivers/net/bnxt/bnxt_irq.c | 8 +- drivers/net/bnxt/bnxt_ring.c | 4 +- drivers/net/bnxt/bnxt_rxq.c | 29 +- drivers/net/bnxt/bnxt_rxr.c | 8 +- drivers/net/bnxt/hsi_struct_def_dpdk.h | 1406 +++++++++++++++++++------------- drivers/net/bnxt/rte_pmd_bnxt.c | 2 +- 10 files changed, 994 insertions(+), 594 deletions(-)
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 1/15 net/bnxt: update HWRM to 1.8.2
This patch updates the HWRM API to version 1.8.2
--v1->v2: Trim down the patch size to avoid unused structures
--- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 4 +- drivers/net/bnxt/hsi_struct_def_dpdk.h | 1406 +++++++++++++++++++------------- 4 files changed, 856 insertions(+), 558 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -1604,7 +1604,7 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id) goto nothing_to_do; valid =FLIP_VALID (cons, cpr->cp_ring_struct->ring_mask, valid); cmp_type =CMP_TYPE (rxcmp); -if (cmp_type ==RX_PKT_CMPL_TYPE_RX_L2_TPA_END ) { +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) &
drivers/net/bnxt/bnxt_hwrm.c +1 -1
@@ -785,7 +785,7 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp, (link_info->phy_link_status ==HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK ) ?1 :0 ; link_info->link_speed =rte_le_to_cpu_16 (resp->link_speed); - link_info->duplex = resp->duplex; + link_info->duplex = resp->duplex_cfg; link_info->pause = resp->pause; link_info->auto_pause = resp->auto_pause; link_info->force_pause = resp->force_pause;
drivers/net/bnxt/bnxt_rxr.c +2 -2
@@ -410,12 +410,12 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt, cpr->valid); cmp_type =CMP_TYPE (rxcmp); -if (cmp_type ==RX_PKT_CMPL_TYPE_RX_L2_TPA_START ) { +if (cmp_type ==RX_TPA_START_CMPL_TYPE_RX_TPA_START ) {bnxt_tpa_start (rxq, (struct rx_tpa_start_cmpl *)rxcmp, (struct rx_tpa_start_cmpl_hi *)rxcmp1); rc = -EINVAL ;/* Continue w/o new mbuf */ goto next_rx; - }else if (cmp_type ==RX_PKT_CMPL_TYPE_RX_L2_TPA_END ) { + }else if (cmp_type ==RX_TPA_END_CMPL_TYPE_RX_TPA_END ) { mbuf =bnxt_tpa_end (rxq, &tmp_raw_cons, (struct rx_tpa_end_cmpl *)rxcmp, (struct rx_tpa_end_cmpl_hi *)rxcmp1);
drivers/net/bnxt/hsi_struct_def_dpdk.h +852 -554
1,758 lines not on this page · raw message
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 2/15 net/bnxt: fix tx_offload capability
In reply to Ajit KhapardeWe are not indicating VLAN insert capability of HW. Fixing it.
--- drivers/net/bnxt/bnxt_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +2 -1
@@ -437,7 +437,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->max_rx_pktlen =BNXT_MAX_MTU +ETHER_HDR_LEN +ETHER_CRC_LEN +VLAN_TAG_SIZE ; dev_info->rx_offload_capa =0 ; - dev_info->tx_offload_capa =DEV_TX_OFFLOAD_IPV4_CKSUM | + dev_info->tx_offload_capa =DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM |DEV_TX_OFFLOAD_TCP_CKSUM |DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO |
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 3/15 net/bnxt: fix rx_offload capability
In reply to Ajit KhapardeWe are not setting the rx_offload capabilities. Fixing that.
--- drivers/net/bnxt/bnxt_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +5 -1
@@ -436,7 +436,11 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->min_rx_bufsize =1 ; dev_info->max_rx_pktlen =BNXT_MAX_MTU +ETHER_HDR_LEN +ETHER_CRC_LEN +VLAN_TAG_SIZE ; - dev_info->rx_offload_capa =0 ; + dev_info->rx_offload_capa =DEV_RX_OFFLOAD_VLAN_STRIP | +DEV_RX_OFFLOAD_IPV4_CKSUM | +DEV_RX_OFFLOAD_UDP_CKSUM | +DEV_RX_OFFLOAD_TCP_CKSUM | +DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM ; dev_info->tx_offload_capa =DEV_TX_OFFLOAD_VLAN_INSERT |DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM |
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 4/15 net/bnxt: handle Rx multi queue creation properly
In reply to Ajit KhapardeThis patch simplifies logic for RSS queue creation.
1) Do not hardcode number of VNIC pools in case of RSS
2) Log a message if Number of queues is > RTE_ETHDEV_QUEUE_STAT_CNTRS
3) Move the check for allocation of l2_filter inside the for loop.
--- drivers/net/bnxt/bnxt_ethdev.c | 5 +++++ drivers/net/bnxt/bnxt_rxq.c | 18 ++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
@@ -574,6 +574,11 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)int vlan_mask =0 ;int rc; +if (bp->rx_cp_nr_rings >RTE_ETHDEV_QUEUE_STAT_CNTRS ) { +RTE_LOG (ERR ,PMD , +"RxQ cnt %d > CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n" , + bp->rx_cp_nr_rings,RTE_ETHDEV_QUEUE_STAT_CNTRS ); + } bp->dev_stopped =0 ; rc =bnxt_init_nic (bp);
drivers/net/bnxt/bnxt_rxq.c +6 -12
@@ -68,7 +68,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp)struct bnxt_filter_info *filter;enum rte_eth_nb_pools pools = bp->rx_cp_nr_rings, max_pools =0 ;struct bnxt_rx_queue *rxq; -bool rss_dflt_cr = false; bp->nr_vnics =0 ;
@@ -119,7 +118,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) pools = max_pools;break ;case ETH_MQ_RX_RSS : - pools =1 ; + pools = bp->rx_cp_nr_rings;break ;default : RTE_LOG(ERR, PMD, "Unsupported mq_mod %d\n",
@@ -128,13 +127,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp) goto err_out; } } -/* -* If MQ RX w/o RSS no need for per VNIC filter. -*/ -if ((dev_conf->rxmode.mq_mode Ð_MQ_RX_VMDQ_DCB ) || - (bp->rx_cp_nr_rings && - !(dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS ))) - rss_dflt_cr = true; nb_q_per_grp = bp->rx_cp_nr_rings / pools; start_grp_id =0 ;
@@ -151,7 +143,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)STAILQ_INSERT_TAIL (&bp->ff_pool[i], vnic, next); bp->nr_vnics++; -for (j =0 , ring_idx =0 ; j < nb_q_per_grp; j++, ring_idx++) { +for (j =0 ; j < nb_q_per_grp; j++, ring_idx++) { rxq = bp->eth_dev->data->rx_queues[ring_idx]; rxq->vnic = vnic; }
@@ -166,8 +158,10 @@ int bnxt_mq_rx_configure(struct bnxt *bp) vnic->start_grp_id = start_grp_id; vnic->end_grp_id = end_grp_id; -if (rss_dflt_cr && i) { - vnic->rss_dflt_cr = true; +if (i) { +if (dev_conf->rxmode.mq_mode Ð_MQ_RX_VMDQ_DCB || + !(dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS )) + vnic->rss_dflt_cr = true; goto skip_filter_allocation; } filter =bnxt_alloc_filter (bp);
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 5/15 net/bnxt: remove redundant code parsing pool_map
In reply to Ajit KhapardeThis patch removes some redundant code from bnxt_mq_rx_configure().
--- drivers/net/bnxt/bnxt_rxq.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/net/bnxt/bnxt_rxq.c +0 -11
@@ -170,17 +170,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp) rc = -ENOMEM ; goto err_out; } -for (j =0 ; j < conf->nb_pool_maps; j++) { -if (conf->pool_map[j].pools & (1UL << i)) { -RTE_LOG (ERR ,PMD , -"Add vlan %u to vmdq pool %u\n" , - conf->pool_map[j].vlan_id, i); - - filter->l2_ivlan = conf->pool_map[j].vlan_id; - filter->enables |= -HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN ; - } - }/* * TODO: Configure & associate CFA rule for * each VNIC for each VMDq with MACVLAN, MACVLAN+TC
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 6/15 net/bnxt: fix redirecting traffic to a VF
In reply to Ajit KhapardeThe case to handle redirect a flow to a VF is not handled. This patch fixes it.
--- drivers/net/bnxt/bnxt_filter.c | 92 +++++++++++++++++++++++++++++++++++++++++- drivers/net/bnxt/bnxt_filter.h | 2 + 2 files changed, 92 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_filter.c +90 -2
@@ -301,7 +301,8 @@ bnxt_filter_type_check(const struct rte_flow_item pattern[], }static int -bnxt_validate_and_parse_flow_type (const struct rte_flow_item pattern[], +bnxt_validate_and_parse_flow_type (struct bnxt *bp, +const struct rte_flow_item pattern[],struct rte_flow_error *error,struct bnxt_filter_info *filter) {
@@ -318,11 +319,14 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_item pattern[],const struct rte_flow_item_vxlan *vxlan_mask;uint8_t vni_mask[] = {0xFF ,0xFF ,0xFF };uint8_t tni_mask[] = {0xFF ,0xFF ,0xFF }; +const struct rte_flow_item_vf *vf_spec;uint32_t tenant_id_be =0 ;bool vni_masked =0 ;bool tni_masked =0 ; +uint32_t vf =0 ;int use_ntuple;uint32_t en =0 ; +int dflt_vnic; use_ntuple =bnxt_filter_type_check (pattern, error);RTE_LOG (DEBUG ,PMD ,"Use NTUPLE %d\n" , use_ntuple);
@@ -687,6 +691,40 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_item pattern[],CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_NVGRE ; }break ; +case RTE_FLOW_ITEM_TYPE_VF : + vf_spec = (const struct rte_flow_item_vf *)item->spec; + vf = vf_spec->id; +if (!BNXT_PF (bp)) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Configuring on a VF!" ); +return -rte_errno; + } + +if (vf >= bp->pdev->max_vfs) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Incorrect VF id!" ); +return -rte_errno; + } + + filter->mirror_vnic_id = + dflt_vnic =bnxt_hwrm_func_qcfg_vf_dflt_vnic_id (bp, vf); +if (dflt_vnic <0 ) { +/* This simply indicates there's no driver +* loaded. This is not an error. +*/ +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Unable to get default VNIC for VF" ); +return -rte_errno; + } + filter->mirror_vnic_id = dflt_vnic; + en |=NTUPLE_FLTR_ALLOC_INPUT_EN_MIRROR_VNIC_ID ; +break ;default :break ; }
@@ -781,8 +819,11 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,const struct rte_flow_action *act =nxt_non_void_action (actions);struct bnxt *bp = (struct bnxt *)dev->data->dev_private;const struct rte_flow_action_queue *act_q; +const struct rte_flow_action_vf *act_vf;struct bnxt_vnic_info *vnic, *vnic0;struct bnxt_filter_info *filter1; +uint32_t vf =0 ; +int dflt_vnic;int rc;if (bp->eth_dev->data->dev_conf.rxmode.mq_mode Ð_MQ_RX_RSS ) {
@@ -794,7 +835,7 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, goto ret; } - rc =bnxt_validate_and_parse_flow_type (pattern, error, filter); + rc =bnxt_validate_and_parse_flow_type (bp, pattern, error, filter);if (rc !=0 ) goto ret;
@@ -860,6 +901,52 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, filter->fw_l2_filter_id = filter1->fw_l2_filter_id; filter->flags =HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_METER ;break ; +case RTE_FLOW_ACTION_TYPE_VF : + act_vf = (const struct rte_flow_action_vf *)act->conf; + vf = act_vf->id; +if (!BNXT_PF (bp)) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , + act, +"Configuring on a VF!" ); + rc = -rte_errno; + goto ret; + } + +if (vf >= bp->pdev->max_vfs) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , + act, +"Incorrect VF id!" ); + rc = -rte_errno; + goto ret; + } + + filter->mirror_vnic_id = + dflt_vnic =bnxt_hwrm_func_qcfg_vf_dflt_vnic_id (bp, vf); +if (dflt_vnic <0 ) { +/* This simply indicates there's no driver loaded. +* This is not an error. +*/ +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , + act, +"Unable to get default VNIC for VF" ); + rc = -rte_errno; + goto ret; + } + filter->mirror_vnic_id = dflt_vnic; + filter->enables |=NTUPLE_FLTR_ALLOC_INPUT_EN_MIRROR_VNIC_ID ; + + vnic0 =STAILQ_FIRST (&bp->ff_pool[0 ]); + filter1 =bnxt_get_l2_filter (bp, filter, vnic0); +if (filter1 ==NULL ) { + rc = -ENOSPC ; + goto ret; + } + filter->fw_l2_filter_id = filter1->fw_l2_filter_id; +break ; +default : rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act,
@@ -868,6 +955,7 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, goto ret; } +//done: act =nxt_non_void_action (++act);if (act->type !=RTE_FLOW_ACTION_TYPE_END ) { rte_flow_error_set(error, EINVAL,
drivers/net/bnxt/bnxt_filter.h +2 -0
@@ -160,4 +160,6 @@ struct bnxt_filter_info *bnxt_get_l2_filter(struct bnxt *bp, HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_ADDR_TYPE_IPV4#define NTUPLE_FLTR_ALLOC_INPUT_EN_MIRROR_VNIC_ID \ HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID +#define NTUPLE_FLTR_ALLOC_INPUT_EN_MIRROR_VNIC_ID \ + HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID#endif
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 7/15 net/bnxt: fix a bad bit shift operation
In reply to Ajit KhapardeWe are left shifting more bits than we should be doing. This patch fixes that.
Coverity issue: 127546
--- drivers/net/bnxt/bnxt_ethdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +3 -2
@@ -662,13 +662,14 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,uint64_t pool_mask = eth_dev->data->mac_pool_sel[index];struct bnxt_vnic_info *vnic;struct bnxt_filter_info *filter, *temp_filter; -int i; +uint32_t pool =RTE_MIN (MAX_FF_POOLS ,ETH_64_POOLS ); +uint32_t i;/* * Loop through all VNICs from the specified filter flow pools to * remove the corresponding MAC addr filter */ -for (i =0 ; i <MAX_FF_POOLS ; i++) { +for (i =0 ; i < pool; i++) {if (!(pool_mask & (1ULL << i)))continue ;
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 8/15 net/bnxt: fix a null pointer dereference
In reply to Ajit KhapardeFix a potential null pointer reported by Coverity. Coverity issue: 195001
--- drivers/net/bnxt/bnxt_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +4 -0
@@ -1728,10 +1728,12 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp,RTE_LOG (ERR ,PMD ,"unsupported ether_type(0x%04x) in" " ethertype filter." , efilter->ether_type); *ret = -EINVAL ; + goto exit; }if (efilter->queue >= bp->rx_nr_rings) {RTE_LOG (ERR ,PMD ,"Invalid queue %d\n" , efilter->queue); *ret = -EINVAL ; + goto exit; } vnic0 =STAILQ_FIRST (&bp->ff_pool[0 ]);
@@ -1739,6 +1741,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp,if (vnic ==NULL ) {RTE_LOG (ERR ,PMD ,"Invalid queue %d\n" , efilter->queue); *ret = -EINVAL ; + goto exit; }if (efilter->flags &RTE_ETHTYPE_FLAGS_DROP ) {
@@ -1767,6 +1770,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp,if (match) *ret = -EEXIST ; +exit:return mfilter; }
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 9/15 net/bnxt: fix an issue reported by Coverity
In reply to Ajit KhapardeCoverity issue: 195015
--- drivers/net/bnxt/bnxt_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
@@ -2039,6 +2039,11 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, goto free_filter;STAILQ_INSERT_TAIL (&vnic->filter, bfilter, next); }else { +if (mfilter ==NULL ) { +/* This should not happen. But for Coverity! */ + ret = -ENOENT ; + goto free_filter; + } ret =bnxt_hwrm_clear_ntuple_filter (bp, mfilter); STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info,
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 10/15 net/bnxt: fix a potential null pointer dereference
In reply to Ajit KhapardeCoverity issue: 195017
--- drivers/net/bnxt/bnxt_filter.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/bnxt/bnxt_filter.c +2 -0
@@ -793,6 +793,8 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf,//This flow needs DST MAC which is not same as port/l2 RTE_LOG (DEBUG ,PMD ,"Create L2 filter for DST MAC\n" ); filter1 =bnxt_get_unused_filter (bp); +if (filter1 ==NULL ) +return NULL ; filter1->flags =HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX ; filter1->enables =HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR |L2_FILTER_ALLOC_INPUT_EN_L2_ADDR_MASK ;
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 11/15 net/bnxt: fix a potential null poiner dereference
In reply to Ajit KhapardeCoverity issue: 195046
--- drivers/net/bnxt/bnxt_irq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_irq.c +6 -2
@@ -50,10 +50,14 @@ static void bnxt_int_handler(void *param)struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;struct bnxt_cp_ring_info *cpr = bp->def_cp_ring; -uint32_t raw_cons = cpr->cp_raw_cons; -uint32_t cons;struct cmpl_base *cmp; +uint32_t raw_cons; +uint32_t cons; + +if (cpr ==NULL ) +return ; + raw_cons = cpr->cp_raw_cons;while (1 ) {if (!cpr || !cpr->cp_ring_struct)return ;
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 12/15 net/bnxt: fix a null pointer deref
In reply to Ajit KhapardeCoverity issue: 158634
--- drivers/net/bnxt/bnxt_ring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ring.c +3 -1
@@ -323,8 +323,10 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) ring = rxr->ag_ring_struct;/* Agg ring */ -if (ring ==NULL ) +if (ring ==NULL ) {RTE_LOG (ERR ,PMD ,"Alloc AGG Ring is NULL!\n" ); + goto err_out; + } rc = bnxt_hwrm_ring_alloc(bp, ring, HWRM_RING_ALLOC_INPUT_RING_TYPE_RX,
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 13/15 net/bnxt: fix a pointer deref before null check
In reply to Ajit KhapardeCoverity issue: 158634
--- drivers/net/bnxt/bnxt_rxr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +2 -2
@@ -437,11 +437,11 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt, cons = rxcmp->opaque; mbuf =bnxt_consume_rx_buf (rxr, cons); -rte_prefetch0 (mbuf); -if (mbuf ==NULL )return -EBUSY ; +rte_prefetch0 (mbuf); + mbuf->nb_segs =1 ; mbuf->next =NULL ; mbuf->pkt_len = rxcmp->len;
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 14/15 net/bnxt: fix an issue reported by Coverity
In reply to Ajit KhapardeCoverity issue: 147216
--- drivers/net/bnxt/rte_pmd_bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/rte_pmd_bnxt.c +1 -1
@@ -709,7 +709,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr,/* If the VF currently uses a random MAC, update default to this one */ if (bp->pf.vf_info[vf_id].random_mac) {if (rte_pmd_bnxt_get_vf_rx_status (port, vf_id) <=0 ) - rc =bnxt_hwrm_func_vf_mac (bp, vf_id, (uint8_t *)addr); +bnxt_hwrm_func_vf_mac (bp, vf_id, (uint8_t *)addr); }/* query the default VNIC id used by the function */
Signature · 1 line
2.13.5 (Apple Git-94)
PATCH v2 15/15 net/bnxt: check VLANs from pool_map only for VMDQ
In reply to Ajit Khaparde--- drivers/net/bnxt/bnxt_hwrm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +2 -1
@@ -367,7 +367,8 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp,uint16_t j = dst_id -1 ;//TODO: Is there a better way to add VLANs to each VNIC in case of VMDQ -if (conf->pool_map[j].pools & (1UL << j)) { +if ((dev_conf->rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) && + conf->pool_map[j].pools & (1UL << j)) {RTE_LOG (DEBUG ,PMD ,"Add vlan %u to vmdq pool %u\n" , conf->pool_map[j].vlan_id, j);
Signature · 1 line
2.13.5 (Apple Git-94)
Re: [PATCH v2 00/15] bnxt patchset
In reply to Ajit KhapardeQuoted 5 lines · Ajit Khaparde
The first patch updates the HWRM API to version 1.8.2 Some of the patches fix issues reported by Coverity.
Please apply.
Quoted 16 lines
Ajit Khaparde (15):
net/bnxt: update HWRM to 1.8.2
net/bnxt: fixtx_offloadcapability net/bnxt: fixrx_offloadcapability net/bnxt: handle Rx multi queue creation properly net/bnxt: remove redundant code parsingpool_mapnet/bnxt: fix redirecting traffic to a VF net/bnxt: fix a bad bit shift operation net/bnxt: fix a null pointer dereference net/bnxt: fix an issue reported by Coverity net/bnxt: fix a potential null pointer dereference net/bnxt: fix a potential null poiner dereference net/bnxt: fix a null pointer deref net/bnxt: fix a pointer deref before null check net/bnxt: fix an issue reported by Coverity net/bnxt: check VLANs frompool_maponly for VMDQ
Series applied to dpdk-next-net/master, thanks.
Re: [PATCH v2 01/15] net/bnxt: update HWRM to 1.8.2
In reply to Ajit KhapardeQuoted 11 lines · Ajit Khaparde
This patch updates the HWRM API to version 1.8.2
Signed-off-by Ajit Khaparde <[email protected]>--
v1->v2: Trim down the patch size to avoid unused structures--- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 4 +- drivers/net/bnxt/hsi_struct_def_dpdk.h | 1406 +++++++++++++++++++------------- 4 files changed, 856 insertions(+), 558 deletions(-)
Thanks for updating this, file size seems reduced significantly.