net/bnxt: fix duplicate creation of ntuple filter
PATCH 1/2 net/bnxt: fix duplicate creation of ntuple filter
Prevent the creation of duplicate 5tuple filters.
--- drivers/net/bnxt/bnxt_ethdev.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +20 -16
@@ -1956,25 +1956,29 @@ parse_ntuple_filter(struct bnxt *bp, }static struct bnxt_filter_info * -bnxt_match_ntuple_filter (struct bnxt_vnic_info *vnic, +bnxt_match_ntuple_filter (struct bnxt *bp,struct bnxt_filter_info *bfilter) {struct bnxt_filter_info *mfilter =NULL ; +int i; - STAILQ_FOREACH(mfilter, &vnic->filter, next) { -if (bfilter->src_ipaddr[0 ] == mfilter->src_ipaddr[0 ] && - bfilter->src_ipaddr_mask[0 ] == - mfilter->src_ipaddr_mask[0 ] && - bfilter->src_port == mfilter->src_port && - bfilter->src_port_mask == mfilter->src_port_mask && - bfilter->dst_ipaddr[0 ] == mfilter->dst_ipaddr[0 ] && - bfilter->dst_ipaddr_mask[0 ] == - mfilter->dst_ipaddr_mask[0 ] && - bfilter->dst_port == mfilter->dst_port && - bfilter->dst_port_mask == mfilter->dst_port_mask && - bfilter->flags == mfilter->flags && - bfilter->enables == mfilter->enables) -return mfilter; +for (i = bp->nr_vnics -1 ; i >=0 ; i--) { +struct bnxt_vnic_info *vnic = &bp->vnic_info[i]; + STAILQ_FOREACH(mfilter, &vnic->filter, next) { +if (bfilter->src_ipaddr[0 ] == mfilter->src_ipaddr[0 ] && + bfilter->src_ipaddr_mask[0 ] == + mfilter->src_ipaddr_mask[0 ] && + bfilter->src_port == mfilter->src_port && + bfilter->src_port_mask == mfilter->src_port_mask && + bfilter->dst_ipaddr[0 ] == mfilter->dst_ipaddr[0 ] && + bfilter->dst_ipaddr_mask[0 ] == + mfilter->dst_ipaddr_mask[0 ] && + bfilter->dst_port == mfilter->dst_port && + bfilter->dst_port_mask == mfilter->dst_port_mask && + bfilter->flags == mfilter->flags && + bfilter->enables == mfilter->enables) +return mfilter; + } }return NULL ; }
@@ -2023,7 +2027,7 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, bfilter->ethertype =0x800 ; bfilter->enables |=NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE ; - mfilter =bnxt_match_ntuple_filter (vnic, bfilter); + mfilter =bnxt_match_ntuple_filter (bp, bfilter);if (mfilter !=NULL && filter_op ==RTE_ETH_FILTER_ADD ) {RTE_LOG (ERR ,PMD ,"filter exists." );
Signature · 1 line
2.13.6 (Apple Git-96)
PATCH 2/2 net/bnxt: fix link handling and configuration
Remove a case where we were sending a depricated field to the FW. There is no need to send auto_link_speed to the FW.
Also set the auto_mode correctly depending on the setting requested.
--- drivers/net/bnxt/bnxt.h | 2 ++ drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 32 ++++++++++----------- drivers/net/bnxt/bnxt_hwrm.c | 63 +++++++++++++++++++++++++++--------------- 4 files changed, 58 insertions(+), 41 deletions(-)
drivers/net/bnxt/bnxt.h +2 -0
@@ -164,6 +164,8 @@ struct bnxt_link_info {uint16_t auto_link_speed;uint16_t auto_link_speed_mask;uint32_t preemphasis; +uint8_t phy_type; +uint8_t media_type; };#define BNXT_COS_QUEUE_COUNT 8
drivers/net/bnxt/bnxt_cpr.c +1 -1
@@ -55,7 +55,7 @@ void bnxt_handle_async_event(struct bnxt *bp,case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE :case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE :case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE : -bnxt_link_update_op (bp->eth_dev,0 ); +bnxt_link_update_op (bp->eth_dev,1 );break ;default :RTE_LOG (DEBUG ,PMD ,"handle_async_event id = 0x%x\n" , event_id);
drivers/net/bnxt/bnxt_ethdev.c +14 -18
@@ -146,6 +146,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { ETH_RSS_NONFRAG_IPV6_UDP) static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask); +static void bnxt_print_link_info (struct rte_eth_dev *eth_dev);/***********************/
@@ -370,6 +371,7 @@ static int bnxt_init_chip(struct bnxt *bp) goto err_out; } } +bnxt_print_link_info (bp->eth_dev);return 0 ;
@@ -533,20 +535,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)return 0 ; } -static inline int -rte_bnxt_atomic_write_link_status (struct rte_eth_dev *eth_dev, -struct rte_eth_link *link) -{ -struct rte_eth_link *dst = ð_dev->data->dev_link; -struct rte_eth_link *src = link; - -if (rte_atomic64_cmpset ((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) ==0 ) -return 1 ; - -return 0 ; -} -static void bnxt_print_link_info (struct rte_eth_dev *eth_dev) {struct rte_eth_link *link = ð_dev->data->dev_link;
@@ -585,7 +573,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)if (rc) goto error; -bnxt_link_update_op (eth_dev,0 ); +bnxt_link_update_op (eth_dev,1 );if (eth_dev->data->dev_conf.rxmode.hw_vlan_filter) vlan_mask |=ETH_VLAN_FILTER_MASK ;
@@ -607,9 +595,14 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)static int bnxt_dev_set_link_up_op (struct rte_eth_dev *eth_dev) {struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; +int rc =0 ; + +if (!bp->link_info.link_up) + rc =bnxt_set_hwrm_link_config (bp, true); +if (!rc) + eth_dev->data->dev_link.link_status =1 ; - eth_dev->data->dev_link.link_status =1 ; -bnxt_set_hwrm_link_config (bp, true); +bnxt_print_link_info (eth_dev);return 0 ; }
@@ -619,6 +612,8 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev) eth_dev->data->dev_link.link_status =0 ;bnxt_set_hwrm_link_config (bp, false); + bp->link_info.link_up =0 ; +return 0 ; }
@@ -760,7 +755,8 @@ 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) { -rte_bnxt_atomic_write_link_status (eth_dev, &new); +memcpy (ð_dev->data->dev_link, &new, +sizeof (struct rte_eth_link ));bnxt_print_link_info (eth_dev); }
drivers/net/bnxt/bnxt_hwrm.c +41 -22
121 lines not on this page · raw message
Signature · 1 line
2.13.6 (Apple Git-96)
Re: [PATCH 2/2] net/bnxt: fix link handling and configuration
Quoted 7 lines · Ajit Khaparde
Remove a case where we were sending a depricated field to the FW. There is no need to send
auto_link_speedto the FW.
Also set theauto_modecorrectly depending on the setting requested.Fixes 7bc8e9a227cc ("net/bnxt: support async link notification")Signed-off-by Ajit Khaparde <[email protected]>
Hi Ajit,
What is the scope of these fixes? How critical are they? I am for postponing them into next release.
We should stop somewhere to get patches, normally they have been sent later than initial planned release date.
<...>
Quoted 4 lines · Ajit Khaparde
Prevent the creation of duplicate 5tuple filters.
Fixes b7435d660a8c ("net/bnxt: add ntuple filtering support")Signed-off-by Ajit Khaparde <[email protected]>
Series applied to dpdk/master, thanks.