* [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes @ 2019-11-04 10:02 Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 1/5] net/bnxt: fix L4 checksum error indication in non-vector mode rx Kalesh A P ` (5 more replies) 0 siblings, 6 replies; 13+ messages in thread From: Kalesh A P @ 2019-11-04 10:02 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Please apply. Ajit Khaparde (1): net/bnxt: fix incorrect COS queue mapping Kalesh AP (2): net/bnxt: fix L4 checksum error indication in non-vector mode rx net/bnxt: fix a failure case during initialization Santoshkumar Karanappa Rastapur (1): net/bnxt: fix vnic allocation failure on port toggle Venkat Duvvuru (1): net/bnxt: fix redundant mac addr check drivers/net/bnxt/bnxt_ethdev.c | 126 +++++++++++++---------------------------- drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 ++- drivers/net/bnxt/bnxt_hwrm.c | 14 ++--- drivers/net/bnxt/bnxt_ring.c | 5 +- drivers/net/bnxt/bnxt_ring.h | 1 - drivers/net/bnxt/bnxt_rxq.c | 2 + drivers/net/bnxt/bnxt_rxr.c | 18 +++--- drivers/net/bnxt/bnxt_vnic.c | 5 +- drivers/net/bnxt/bnxt_vnic.h | 1 - 10 files changed, 73 insertions(+), 111 deletions(-) v1->v2: updated commit log of patch2 -- 2.10.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 1/5] net/bnxt: fix L4 checksum error indication in non-vector mode rx 2019-11-04 10:02 [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes Kalesh A P @ 2019-11-04 10:02 ` Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 2/5] net/bnxt: fix redundant mac addr check Kalesh A P ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Kalesh A P @ 2019-11-04 10:02 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Update "mbuf->ol_flags" correctly for inner and ourter ip checksum errors in case of tunnel and non-tunnel packets. Fixes: 65ee636872eb ("net/bnxt: fix Rx checksum flags") Cc: stable@dpdk.org Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> --- drivers/net/bnxt/bnxt_rxr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index ee1444c..c35bc1a 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -512,15 +512,19 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt, flags2_f = flags2_0xf(rxcmp1); /* IP Checksum */ - if (unlikely(((IS_IP_NONTUNNEL_PKT(flags2_f)) && - (RX_CMP_IP_CS_ERROR(rxcmp1))) || - (IS_IP_TUNNEL_PKT(flags2_f) && - (RX_CMP_IP_OUTER_CS_ERROR(rxcmp1))))) { - mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD; + if (likely(IS_IP_NONTUNNEL_PKT(flags2_f))) { + if (unlikely(RX_CMP_IP_CS_ERROR(rxcmp1))) + mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD; + else + mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD; + } else if (IS_IP_TUNNEL_PKT(flags2_f)) { + if (unlikely(RX_CMP_IP_OUTER_CS_ERROR(rxcmp1) || + RX_CMP_IP_CS_ERROR(rxcmp1))) + mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD; + else + mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD; } else if (unlikely(RX_CMP_IP_CS_UNKNOWN(rxcmp1))) { mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN; - } else { - mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD; } /* L4 Checksum */ -- 2.10.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 2/5] net/bnxt: fix redundant mac addr check 2019-11-04 10:02 [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 1/5] net/bnxt: fix L4 checksum error indication in non-vector mode rx Kalesh A P @ 2019-11-04 10:02 ` Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 3/5] net/bnxt: fix vnic allocation failure on port toggle Kalesh A P ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Kalesh A P @ 2019-11-04 10:02 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com> filter->mac_index is used to check, if a same mac is already programmed. Hence, filter->dflt member is not needed which is also used for mac addr redundancy check. This patch fixes it by moving mac_index based redundant check from bnxt_mac_addr_add_op to bnxt_add_mac_filter Fixes: 6118503d8071 ("net/bnxt: fix VLAN filtering") Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> --- drivers/net/bnxt/bnxt_ethdev.c | 107 +++++++++++++++-------------------------- drivers/net/bnxt/bnxt_filter.c | 1 + drivers/net/bnxt/bnxt_filter.h | 7 ++- drivers/net/bnxt/bnxt_hwrm.c | 9 ++-- drivers/net/bnxt/bnxt_rxq.c | 2 + 5 files changed, 51 insertions(+), 75 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 7d9459f..0b0ce87 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1018,8 +1018,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, bnxt_hwrm_clear_l2_filter(bp, filter); filter->mac_index = INVALID_MAC_INDEX; memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); - STAILQ_INSERT_TAIL(&bp->free_filter_list, - filter, next); + bnxt_free_filter(bp, filter); } filter = temp_filter; } @@ -1027,19 +1026,21 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, } static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic, - struct rte_ether_addr *mac_addr, uint32_t index) + struct rte_ether_addr *mac_addr, uint32_t index, + uint32_t pool) { struct bnxt_filter_info *filter; int rc = 0; - filter = STAILQ_FIRST(&vnic->filter); - /* During bnxt_mac_addr_add_op, default MAC is - * already programmed, so skip it. But, when - * hw-vlan-filter is turned OFF from ON, default - * MAC filter should be restored - */ - if (index == 0 && filter->dflt) - return 0; + /* Attach requested MAC address to the new l2_filter */ + STAILQ_FOREACH(filter, &vnic->filter, next) { + if (filter->mac_index == index) { + PMD_DRV_LOG(ERR, + "MAC addr already existed for pool %d\n", + pool); + return 0; + } + } filter = bnxt_alloc_filter(bp); if (!filter) { @@ -1047,7 +1048,6 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic, return -ENODEV; } - filter->mac_index = index; /* bnxt_alloc_filter copies default MAC to filter->l2_addr. So, * if the MAC that's been programmed now is a different one, then, * copy that addr to filter->l2_addr @@ -1058,14 +1058,12 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic, rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); if (!rc) { - if (filter->mac_index == 0) { - filter->dflt = true; + filter->mac_index = index; + if (filter->mac_index == 0) STAILQ_INSERT_HEAD(&vnic->filter, filter, next); - } else { + else STAILQ_INSERT_TAIL(&vnic->filter, filter, next); - } } else { - filter->mac_index = INVALID_MAC_INDEX; memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); bnxt_free_filter(bp, filter); } @@ -1079,7 +1077,6 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, { struct bnxt *bp = eth_dev->data->dev_private; struct bnxt_vnic_info *vnic = &bp->vnic_info[pool]; - struct bnxt_filter_info *filter; int rc = 0; rc = is_bnxt_in_error(bp); @@ -1095,16 +1092,8 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, PMD_DRV_LOG(ERR, "VNIC not found for pool %d!\n", pool); return -EINVAL; } - /* Attach requested MAC address to the new l2_filter */ - STAILQ_FOREACH(filter, &vnic->filter, next) { - if (filter->mac_index == index) { - PMD_DRV_LOG(ERR, - "MAC addr already existed for pool %d\n", pool); - return 0; - } - } - rc = bnxt_add_mac_filter(bp, vnic, mac_addr, index); + rc = bnxt_add_mac_filter(bp, vnic, mac_addr, index, pool); return rc; } @@ -1726,33 +1715,22 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id) int rc = 0; uint32_t chk = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN; - /* if VLAN exists && VLAN matches vlan_id - * remove the MAC+VLAN filter - * add a new MAC only filter - * else - * VLAN filter doesn't exist, just skip and continue - */ vnic = BNXT_GET_DEFAULT_VNIC(bp); filter = STAILQ_FIRST(&vnic->filter); while (filter) { /* Search for this matching MAC+VLAN filter */ - if ((filter->enables & chk) && - (filter->l2_ivlan == vlan_id && - filter->l2_ivlan_mask != 0) && - !memcmp(filter->l2_addr, bp->mac_addr, - RTE_ETHER_ADDR_LEN)) { + if (bnxt_vlan_filter_exists(bp, filter, chk, vlan_id)) { /* Delete the filter */ rc = bnxt_hwrm_clear_l2_filter(bp, filter); if (rc) return rc; STAILQ_REMOVE(&vnic->filter, filter, bnxt_filter_info, next); - STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next); - + bnxt_free_filter(bp, filter); PMD_DRV_LOG(INFO, - "Del Vlan filter for %d\n", + "Deleted vlan filter for %d\n", vlan_id); - return rc; + return 0; } filter = STAILQ_NEXT(filter, next); } @@ -1780,11 +1758,7 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) filter = STAILQ_FIRST(&vnic->filter); /* Check if the VLAN has already been added */ while (filter) { - if ((filter->enables & chk) && - (filter->l2_ivlan == vlan_id && - filter->l2_ivlan_mask == 0x0FFF) && - !memcmp(filter->l2_addr, bp->mac_addr, - RTE_ETHER_ADDR_LEN)) + if (bnxt_vlan_filter_exists(bp, filter, chk, vlan_id)) return -EEXIST; filter = STAILQ_NEXT(filter, next); @@ -1817,18 +1791,17 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) * not able to create the filter in hardware. */ filter->fw_l2_filter_id = UINT64_MAX; - STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next); + bnxt_free_filter(bp, filter); return rc; - } else { - /* Add this new filter to the list */ - if (vlan_id == 0) { - filter->dflt = true; - STAILQ_INSERT_HEAD(&vnic->filter, filter, next); - } else { - STAILQ_INSERT_TAIL(&vnic->filter, filter, next); - } } + filter->mac_index = 0; + /* Add this new filter to the list */ + if (vlan_id == 0) + STAILQ_INSERT_HEAD(&vnic->filter, filter, next); + else + STAILQ_INSERT_TAIL(&vnic->filter, filter, next); + PMD_DRV_LOG(INFO, "Added Vlan filter for %d\n", vlan_id); return rc; @@ -1859,19 +1832,17 @@ static int bnxt_del_dflt_mac_filter(struct bnxt *bp, filter = STAILQ_FIRST(&vnic->filter); while (filter) { - if (filter->dflt && + if (filter->mac_index == 0 && !memcmp(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN)) { rc = bnxt_hwrm_clear_l2_filter(bp, filter); - if (rc) - return rc; - filter->dflt = false; - STAILQ_REMOVE(&vnic->filter, filter, - bnxt_filter_info, next); - STAILQ_INSERT_TAIL(&bp->free_filter_list, - filter, next); - filter->fw_l2_filter_id = -1; - break; + if (!rc) { + STAILQ_REMOVE(&vnic->filter, filter, + bnxt_filter_info, next); + bnxt_free_filter(bp, filter); + filter->fw_l2_filter_id = UINT64_MAX; + } + return rc; } filter = STAILQ_NEXT(filter, next); } @@ -1894,10 +1865,10 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) vnic = BNXT_GET_DEFAULT_VNIC(bp); if (!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { /* Remove any VLAN filters programmed */ - for (i = 0; i < 4095; i++) + for (i = 0; i < RTE_ETHER_MAX_VLAN_ID; i++) bnxt_del_vlan_filter(bp, i); - rc = bnxt_add_mac_filter(bp, vnic, NULL, 0); + rc = bnxt_add_mac_filter(bp, vnic, NULL, 0, 0); if (rc) return rc; } else { diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index 1c8e3e3..7e29468 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -34,6 +34,7 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp) } STAILQ_REMOVE_HEAD(&bp->free_filter_list, next); + filter->mac_index = INVALID_MAC_INDEX; /* Default to L2 MAC Addr filter */ filter->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h index e09b435..7415b36 100644 --- a/drivers/net/bnxt/bnxt_filter.h +++ b/drivers/net/bnxt/bnxt_filter.h @@ -8,6 +8,12 @@ #include <rte_ether.h> +#define bnxt_vlan_filter_exists(bp, filter, chk, vlan_id) \ + (((filter)->enables & (chk)) && \ + ((filter)->l2_ivlan == (vlan_id) && \ + (filter)->l2_ivlan_mask == 0x0FFF) && \ + !memcmp((filter)->l2_addr, (bp)->mac_addr, \ + RTE_ETHER_ADDR_LEN)) struct bnxt; #define BNXT_FLOW_L2_VALID_FLAG BIT(0) @@ -71,7 +77,6 @@ struct bnxt_filter_info { uint16_t ip_addr_type; uint16_t ethertype; uint32_t priority; - uint8_t dflt; }; struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index c777c73..daed4ee 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2468,18 +2468,15 @@ int bnxt_set_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic) int rc = 0; STAILQ_FOREACH(filter, &vnic->filter, next) { - if (filter->filter_type == HWRM_CFA_EM_FILTER) { + if (filter->filter_type == HWRM_CFA_EM_FILTER) rc = bnxt_hwrm_set_em_filter(bp, filter->dst_id, filter); - } else if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) { + else if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) rc = bnxt_hwrm_set_ntuple_filter(bp, filter->dst_id, filter); - } else { + else rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); - if (!rc) - filter->dflt = 1; - } if (rc) break; } diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index d55adc3..6420281 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -63,6 +63,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) rc = -ENOMEM; goto err_out; } + filter->mac_index = 0; filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST; STAILQ_INSERT_TAIL(&vnic->filter, filter, next); goto out; @@ -146,6 +147,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) rc = -ENOMEM; goto err_out; } + filter->mac_index = 0; filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST; /* * TODO: Configure & associate CFA rule for -- 2.10.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 3/5] net/bnxt: fix vnic allocation failure on port toggle 2019-11-04 10:02 [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 1/5] net/bnxt: fix L4 checksum error indication in non-vector mode rx Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 2/5] net/bnxt: fix redundant mac addr check Kalesh A P @ 2019-11-04 10:02 ` Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 4/5] net/bnxt: fix a failure case during initialization Kalesh A P ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Kalesh A P @ 2019-11-04 10:02 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> bnxt_init_chip called on port start keeps incrementing rx_cosq_cnt. Hence more vnics are allocated with less number of rings on each port stop/start operation. Eventually vnic allocation fails due to incorrect ring group as no ring gets allocated to the vnic. Fixes: 84d49664b5b2 ("net/bnxt: support CoS classification") Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> --- drivers/net/bnxt/bnxt_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 0b0ce87..3acf66d 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -967,6 +967,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) bnxt_shutdown_nic(bp); bnxt_hwrm_if_change(bp, 0); bp->dev_stopped = 1; + bp->rx_cosq_cnt = 0; } static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) -- 2.10.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 4/5] net/bnxt: fix a failure case during initialization 2019-11-04 10:02 [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes Kalesh A P ` (2 preceding siblings ...) 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 3/5] net/bnxt: fix vnic allocation failure on port toggle Kalesh A P @ 2019-11-04 10:02 ` Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 5/5] net/bnxt: fix incorrect COS queue mapping Kalesh A P 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde 5 siblings, 0 replies; 13+ messages in thread From: Kalesh A P @ 2019-11-04 10:02 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> During initialization sequence in bnxt_alloc_mem() if bnxt_alloc_async_cp_ring() fails, driver invokes bnxt_free_mem() which in turn call bnxt_free_vnic_mem() which causes the error logs "bnxt_free_vnic_mem(): VNIC is not freed yet!". This is because vnic memory is allocated but not initialized yet. Fix this by moving bnxt_init_vnics() from bnxt_init_nic() to bnxt_alloc_vnic_mem(). Also get rid of bnxt_init_nic() as the initialization is done in respective functions now. Fixes: 1bf01f5135f8 ("net/bnxt: prevent device access when device is in reset") Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> --- drivers/net/bnxt/bnxt_ethdev.c | 18 ------------------ drivers/net/bnxt/bnxt_filter.c | 3 ++- drivers/net/bnxt/bnxt_filter.h | 1 - drivers/net/bnxt/bnxt_ring.c | 5 ++--- drivers/net/bnxt/bnxt_ring.h | 1 - drivers/net/bnxt/bnxt_vnic.c | 5 +++-- drivers/net/bnxt/bnxt_vnic.h | 1 - 7 files changed, 7 insertions(+), 27 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3acf66d..b9b055e 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -479,22 +479,6 @@ static int bnxt_shutdown_nic(struct bnxt *bp) return 0; } -static int bnxt_init_nic(struct bnxt *bp) -{ - int rc; - - if (BNXT_HAS_RING_GRPS(bp)) { - rc = bnxt_init_ring_grps(bp); - if (rc) - return rc; - } - - bnxt_init_vnics(bp); - bnxt_init_filters(bp); - - return 0; -} - /* * Device configuration and status function */ @@ -4665,8 +4649,6 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev) if (rc) return rc; - bnxt_init_nic(bp); - rc = bnxt_request_int(bp); if (rc) return rc; diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index 7e29468..da1a6c2 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -61,7 +61,7 @@ struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf) return filter; } -void bnxt_init_filters(struct bnxt *bp) +static void bnxt_init_filters(struct bnxt *bp) { struct bnxt_filter_info *filter; int i, max_filters; @@ -171,6 +171,7 @@ int bnxt_alloc_filter_mem(struct bnxt *bp) return -ENOMEM; } bp->filter_info = filter_mem; + bnxt_init_filters(bp); return 0; } diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h index 7415b36..9db3e74 100644 --- a/drivers/net/bnxt/bnxt_filter.h +++ b/drivers/net/bnxt/bnxt_filter.h @@ -81,7 +81,6 @@ struct bnxt_filter_info { struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp); struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf); -void bnxt_init_filters(struct bnxt *bp); void bnxt_free_all_filters(struct bnxt *bp); void bnxt_free_filter_mem(struct bnxt *bp); int bnxt_alloc_filter_mem(struct bnxt *bp); diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 0a182d3..ea46fa9 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -38,15 +38,13 @@ void bnxt_free_ring(struct bnxt_ring *ring) * Ring groups */ -int bnxt_init_ring_grps(struct bnxt *bp) +static void bnxt_init_ring_grps(struct bnxt *bp) { unsigned int i; for (i = 0; i < bp->max_ring_grps; i++) memset(&bp->grp_info[i], (uint8_t)HWRM_NA_SIGNATURE, sizeof(struct bnxt_ring_grp_info)); - - return 0; } int bnxt_alloc_ring_grps(struct bnxt *bp) @@ -76,6 +74,7 @@ int bnxt_alloc_ring_grps(struct bnxt *bp) "Failed to alloc grp info tbl.\n"); return -ENOMEM; } + bnxt_init_ring_grps(bp); } return 0; diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h index 8331183..48a39d7 100644 --- a/drivers/net/bnxt/bnxt_ring.h +++ b/drivers/net/bnxt/bnxt_ring.h @@ -65,7 +65,6 @@ struct bnxt_tx_ring_info; struct bnxt_rx_ring_info; struct bnxt_cp_ring_info; void bnxt_free_ring(struct bnxt_ring *ring); -int bnxt_init_ring_grps(struct bnxt *bp); int bnxt_alloc_ring_grps(struct bnxt *bp); int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, struct bnxt_tx_queue *txq, diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 2f0ed10..412a53d 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -35,7 +35,7 @@ void prandom_bytes(void *dest_ptr, size_t len) } } -void bnxt_init_vnics(struct bnxt *bp) +static void bnxt_init_vnics(struct bnxt *bp) { struct bnxt_vnic_info *vnic; uint16_t max_vnics; @@ -52,7 +52,6 @@ void bnxt_init_vnics(struct bnxt *bp) vnic->hash_mode = HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT; - prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE); STAILQ_INIT(&vnic->filter); STAILQ_INIT(&vnic->flow_list); STAILQ_INSERT_TAIL(&bp->free_vnic_list, vnic, next); @@ -179,6 +178,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) HW_HASH_KEY_SIZE); vnic->mc_list_dma_addr = vnic->rss_hash_key_dma_addr + HW_HASH_KEY_SIZE; + prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE); } return 0; @@ -220,6 +220,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp) return -ENOMEM; } bp->vnic_info = vnic_mem; + bnxt_init_vnics(bp); return 0; } diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h index 4f760e0..a372b89 100644 --- a/drivers/net/bnxt/bnxt_vnic.h +++ b/drivers/net/bnxt/bnxt_vnic.h @@ -58,7 +58,6 @@ struct bnxt_vnic_info { }; struct bnxt; -void bnxt_init_vnics(struct bnxt *bp); int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic, int pool); struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp); -- 2.10.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 5/5] net/bnxt: fix incorrect COS queue mapping 2019-11-04 10:02 [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes Kalesh A P ` (3 preceding siblings ...) 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 4/5] net/bnxt: fix a failure case during initialization Kalesh A P @ 2019-11-04 10:02 ` Kalesh A P 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde 5 siblings, 0 replies; 13+ messages in thread From: Kalesh A P @ 2019-11-04 10:02 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit From: Ajit Khaparde <ajit.khaparde@broadcom.com> While issuing hwrm_queue_qportcfg command, we are setting the drv_qmap_cap bit which is causing the firmware to return incorrect COS queue mapping. This bit is not required when COS classification is enabled. Fixes: 698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue") Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> --- drivers/net/bnxt/bnxt_hwrm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index daed4ee..ab6cb1d 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1217,8 +1217,9 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt *bp) HWRM_PREP(req, QUEUE_QPORTCFG, BNXT_USE_CHIMP_MB); req.flags = rte_cpu_to_le_32(dir); - /* HWRM Version >= 1.9.1 */ - if (bp->hwrm_spec_code >= HWRM_VERSION_1_9_1) + /* HWRM Version >= 1.9.1 only if COS Classification is not required. */ + if (bp->hwrm_spec_code >= HWRM_VERSION_1_9_1 && + !(bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY)) req.drv_qmap_cap = HWRM_QUEUE_QPORTCFG_INPUT_DRV_QMAP_CAP_ENABLED; rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); -- 2.10.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes 2019-11-04 10:02 [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes Kalesh A P ` (4 preceding siblings ...) 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 5/5] net/bnxt: fix incorrect COS queue mapping Kalesh A P @ 2019-11-04 22:50 ` Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 1/5] net/bnxt: fix L4 checksum indication in non-vector Rx Ajit Khaparde ` (5 more replies) 5 siblings, 6 replies; 13+ messages in thread From: Ajit Khaparde @ 2019-11-04 22:50 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit v2->v3: Sending with updated the commit logs for patch 1 & 2 Ajit Khaparde (1): net/bnxt: fix incorrect COS queue mapping Kalesh AP (2): net/bnxt: fix L4 checksum indication in non-vector Rx net/bnxt: fix a failure case during initialization Santoshkumar Karanappa Rastapur (1): net/bnxt: fix vnic allocation failure on port toggle Venkat Duvvuru (1): net/bnxt: fix redundant MAC address check drivers/net/bnxt/bnxt_ethdev.c | 126 +++++++++++---------------------- drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 ++- drivers/net/bnxt/bnxt_hwrm.c | 14 ++-- drivers/net/bnxt/bnxt_ring.c | 5 +- drivers/net/bnxt/bnxt_ring.h | 1 - drivers/net/bnxt/bnxt_rxq.c | 2 + drivers/net/bnxt/bnxt_rxr.c | 18 +++-- drivers/net/bnxt/bnxt_vnic.c | 5 +- drivers/net/bnxt/bnxt_vnic.h | 1 - 10 files changed, 73 insertions(+), 111 deletions(-) -- 2.21.0 (Apple Git-122) ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v3 1/5] net/bnxt: fix L4 checksum indication in non-vector Rx 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde @ 2019-11-04 22:50 ` Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 2/5] net/bnxt: fix redundant MAC address check Ajit Khaparde ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Ajit Khaparde @ 2019-11-04 22:50 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Update "mbuf->ol_flags" correctly for inner and ourter ip checksum errors in case of tunnel and non-tunnel packets. Fixes: 65ee636872eb ("net/bnxt: fix Rx checksum flags") Cc: stable@dpdk.org Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com> --- drivers/net/bnxt/bnxt_rxr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index ee1444c1d..c35bc1afd 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -512,15 +512,19 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt, flags2_f = flags2_0xf(rxcmp1); /* IP Checksum */ - if (unlikely(((IS_IP_NONTUNNEL_PKT(flags2_f)) && - (RX_CMP_IP_CS_ERROR(rxcmp1))) || - (IS_IP_TUNNEL_PKT(flags2_f) && - (RX_CMP_IP_OUTER_CS_ERROR(rxcmp1))))) { - mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD; + if (likely(IS_IP_NONTUNNEL_PKT(flags2_f))) { + if (unlikely(RX_CMP_IP_CS_ERROR(rxcmp1))) + mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD; + else + mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD; + } else if (IS_IP_TUNNEL_PKT(flags2_f)) { + if (unlikely(RX_CMP_IP_OUTER_CS_ERROR(rxcmp1) || + RX_CMP_IP_CS_ERROR(rxcmp1))) + mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD; + else + mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD; } else if (unlikely(RX_CMP_IP_CS_UNKNOWN(rxcmp1))) { mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN; - } else { - mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD; } /* L4 Checksum */ -- 2.21.0 (Apple Git-122) ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v3 2/5] net/bnxt: fix redundant MAC address check 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 1/5] net/bnxt: fix L4 checksum indication in non-vector Rx Ajit Khaparde @ 2019-11-04 22:50 ` Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 3/5] net/bnxt: fix vnic allocation failure on port toggle Ajit Khaparde ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Ajit Khaparde @ 2019-11-04 22:50 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, Venkat Duvvuru, Somnath Kotur From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com> filter->mac_index is used to check, if a same mac is already programmed. Hence, filter->dflt member is not needed which is also used for mac addr redundancy check. This patch fixes it by moving mac_index based redundant check from bnxt_mac_addr_add_op to bnxt_add_mac_filter Fixes: 6118503d8071 ("net/bnxt: fix VLAN filtering") Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com> --- drivers/net/bnxt/bnxt_ethdev.c | 107 ++++++++++++--------------------- drivers/net/bnxt/bnxt_filter.c | 1 + drivers/net/bnxt/bnxt_filter.h | 7 ++- drivers/net/bnxt/bnxt_hwrm.c | 9 +-- drivers/net/bnxt/bnxt_rxq.c | 2 + 5 files changed, 51 insertions(+), 75 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 7d9459f0a..0b0ce8785 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1018,8 +1018,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, bnxt_hwrm_clear_l2_filter(bp, filter); filter->mac_index = INVALID_MAC_INDEX; memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); - STAILQ_INSERT_TAIL(&bp->free_filter_list, - filter, next); + bnxt_free_filter(bp, filter); } filter = temp_filter; } @@ -1027,19 +1026,21 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, } static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic, - struct rte_ether_addr *mac_addr, uint32_t index) + struct rte_ether_addr *mac_addr, uint32_t index, + uint32_t pool) { struct bnxt_filter_info *filter; int rc = 0; - filter = STAILQ_FIRST(&vnic->filter); - /* During bnxt_mac_addr_add_op, default MAC is - * already programmed, so skip it. But, when - * hw-vlan-filter is turned OFF from ON, default - * MAC filter should be restored - */ - if (index == 0 && filter->dflt) - return 0; + /* Attach requested MAC address to the new l2_filter */ + STAILQ_FOREACH(filter, &vnic->filter, next) { + if (filter->mac_index == index) { + PMD_DRV_LOG(ERR, + "MAC addr already existed for pool %d\n", + pool); + return 0; + } + } filter = bnxt_alloc_filter(bp); if (!filter) { @@ -1047,7 +1048,6 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic, return -ENODEV; } - filter->mac_index = index; /* bnxt_alloc_filter copies default MAC to filter->l2_addr. So, * if the MAC that's been programmed now is a different one, then, * copy that addr to filter->l2_addr @@ -1058,14 +1058,12 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic, rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); if (!rc) { - if (filter->mac_index == 0) { - filter->dflt = true; + filter->mac_index = index; + if (filter->mac_index == 0) STAILQ_INSERT_HEAD(&vnic->filter, filter, next); - } else { + else STAILQ_INSERT_TAIL(&vnic->filter, filter, next); - } } else { - filter->mac_index = INVALID_MAC_INDEX; memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); bnxt_free_filter(bp, filter); } @@ -1079,7 +1077,6 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, { struct bnxt *bp = eth_dev->data->dev_private; struct bnxt_vnic_info *vnic = &bp->vnic_info[pool]; - struct bnxt_filter_info *filter; int rc = 0; rc = is_bnxt_in_error(bp); @@ -1095,16 +1092,8 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, PMD_DRV_LOG(ERR, "VNIC not found for pool %d!\n", pool); return -EINVAL; } - /* Attach requested MAC address to the new l2_filter */ - STAILQ_FOREACH(filter, &vnic->filter, next) { - if (filter->mac_index == index) { - PMD_DRV_LOG(ERR, - "MAC addr already existed for pool %d\n", pool); - return 0; - } - } - rc = bnxt_add_mac_filter(bp, vnic, mac_addr, index); + rc = bnxt_add_mac_filter(bp, vnic, mac_addr, index, pool); return rc; } @@ -1726,33 +1715,22 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id) int rc = 0; uint32_t chk = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN; - /* if VLAN exists && VLAN matches vlan_id - * remove the MAC+VLAN filter - * add a new MAC only filter - * else - * VLAN filter doesn't exist, just skip and continue - */ vnic = BNXT_GET_DEFAULT_VNIC(bp); filter = STAILQ_FIRST(&vnic->filter); while (filter) { /* Search for this matching MAC+VLAN filter */ - if ((filter->enables & chk) && - (filter->l2_ivlan == vlan_id && - filter->l2_ivlan_mask != 0) && - !memcmp(filter->l2_addr, bp->mac_addr, - RTE_ETHER_ADDR_LEN)) { + if (bnxt_vlan_filter_exists(bp, filter, chk, vlan_id)) { /* Delete the filter */ rc = bnxt_hwrm_clear_l2_filter(bp, filter); if (rc) return rc; STAILQ_REMOVE(&vnic->filter, filter, bnxt_filter_info, next); - STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next); - + bnxt_free_filter(bp, filter); PMD_DRV_LOG(INFO, - "Del Vlan filter for %d\n", + "Deleted vlan filter for %d\n", vlan_id); - return rc; + return 0; } filter = STAILQ_NEXT(filter, next); } @@ -1780,11 +1758,7 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) filter = STAILQ_FIRST(&vnic->filter); /* Check if the VLAN has already been added */ while (filter) { - if ((filter->enables & chk) && - (filter->l2_ivlan == vlan_id && - filter->l2_ivlan_mask == 0x0FFF) && - !memcmp(filter->l2_addr, bp->mac_addr, - RTE_ETHER_ADDR_LEN)) + if (bnxt_vlan_filter_exists(bp, filter, chk, vlan_id)) return -EEXIST; filter = STAILQ_NEXT(filter, next); @@ -1817,18 +1791,17 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) * not able to create the filter in hardware. */ filter->fw_l2_filter_id = UINT64_MAX; - STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next); + bnxt_free_filter(bp, filter); return rc; - } else { - /* Add this new filter to the list */ - if (vlan_id == 0) { - filter->dflt = true; - STAILQ_INSERT_HEAD(&vnic->filter, filter, next); - } else { - STAILQ_INSERT_TAIL(&vnic->filter, filter, next); - } } + filter->mac_index = 0; + /* Add this new filter to the list */ + if (vlan_id == 0) + STAILQ_INSERT_HEAD(&vnic->filter, filter, next); + else + STAILQ_INSERT_TAIL(&vnic->filter, filter, next); + PMD_DRV_LOG(INFO, "Added Vlan filter for %d\n", vlan_id); return rc; @@ -1859,19 +1832,17 @@ static int bnxt_del_dflt_mac_filter(struct bnxt *bp, filter = STAILQ_FIRST(&vnic->filter); while (filter) { - if (filter->dflt && + if (filter->mac_index == 0 && !memcmp(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN)) { rc = bnxt_hwrm_clear_l2_filter(bp, filter); - if (rc) - return rc; - filter->dflt = false; - STAILQ_REMOVE(&vnic->filter, filter, - bnxt_filter_info, next); - STAILQ_INSERT_TAIL(&bp->free_filter_list, - filter, next); - filter->fw_l2_filter_id = -1; - break; + if (!rc) { + STAILQ_REMOVE(&vnic->filter, filter, + bnxt_filter_info, next); + bnxt_free_filter(bp, filter); + filter->fw_l2_filter_id = UINT64_MAX; + } + return rc; } filter = STAILQ_NEXT(filter, next); } @@ -1894,10 +1865,10 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) vnic = BNXT_GET_DEFAULT_VNIC(bp); if (!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { /* Remove any VLAN filters programmed */ - for (i = 0; i < 4095; i++) + for (i = 0; i < RTE_ETHER_MAX_VLAN_ID; i++) bnxt_del_vlan_filter(bp, i); - rc = bnxt_add_mac_filter(bp, vnic, NULL, 0); + rc = bnxt_add_mac_filter(bp, vnic, NULL, 0, 0); if (rc) return rc; } else { diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index 1c8e3e329..7e29468b7 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -34,6 +34,7 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp) } STAILQ_REMOVE_HEAD(&bp->free_filter_list, next); + filter->mac_index = INVALID_MAC_INDEX; /* Default to L2 MAC Addr filter */ filter->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h index e09b435db..7415b3612 100644 --- a/drivers/net/bnxt/bnxt_filter.h +++ b/drivers/net/bnxt/bnxt_filter.h @@ -8,6 +8,12 @@ #include <rte_ether.h> +#define bnxt_vlan_filter_exists(bp, filter, chk, vlan_id) \ + (((filter)->enables & (chk)) && \ + ((filter)->l2_ivlan == (vlan_id) && \ + (filter)->l2_ivlan_mask == 0x0FFF) && \ + !memcmp((filter)->l2_addr, (bp)->mac_addr, \ + RTE_ETHER_ADDR_LEN)) struct bnxt; #define BNXT_FLOW_L2_VALID_FLAG BIT(0) @@ -71,7 +77,6 @@ struct bnxt_filter_info { uint16_t ip_addr_type; uint16_t ethertype; uint32_t priority; - uint8_t dflt; }; struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index c777c73bd..daed4ee76 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2468,18 +2468,15 @@ int bnxt_set_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic) int rc = 0; STAILQ_FOREACH(filter, &vnic->filter, next) { - if (filter->filter_type == HWRM_CFA_EM_FILTER) { + if (filter->filter_type == HWRM_CFA_EM_FILTER) rc = bnxt_hwrm_set_em_filter(bp, filter->dst_id, filter); - } else if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) { + else if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) rc = bnxt_hwrm_set_ntuple_filter(bp, filter->dst_id, filter); - } else { + else rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); - if (!rc) - filter->dflt = 1; - } if (rc) break; } diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index d55adc33a..6420281d3 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -63,6 +63,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) rc = -ENOMEM; goto err_out; } + filter->mac_index = 0; filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST; STAILQ_INSERT_TAIL(&vnic->filter, filter, next); goto out; @@ -146,6 +147,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) rc = -ENOMEM; goto err_out; } + filter->mac_index = 0; filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST; /* * TODO: Configure & associate CFA rule for -- 2.21.0 (Apple Git-122) ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v3 3/5] net/bnxt: fix vnic allocation failure on port toggle 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 1/5] net/bnxt: fix L4 checksum indication in non-vector Rx Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 2/5] net/bnxt: fix redundant MAC address check Ajit Khaparde @ 2019-11-04 22:50 ` Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 4/5] net/bnxt: fix a failure case during initialization Ajit Khaparde ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Ajit Khaparde @ 2019-11-04 22:50 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, Santoshkumar Karanappa Rastapur, Somnath Kotur From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> bnxt_init_chip called on port start keeps incrementing rx_cosq_cnt. Hence more vnics are allocated with less number of rings on each port stop/start operation. Eventually vnic allocation fails due to incorrect ring group as no ring gets allocated to the vnic. Fixes: 84d49664b5b2 ("net/bnxt: support CoS classification") Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> --- drivers/net/bnxt/bnxt_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 0b0ce8785..3acf66d59 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -967,6 +967,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) bnxt_shutdown_nic(bp); bnxt_hwrm_if_change(bp, 0); bp->dev_stopped = 1; + bp->rx_cosq_cnt = 0; } static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) -- 2.21.0 (Apple Git-122) ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v3 4/5] net/bnxt: fix a failure case during initialization 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde ` (2 preceding siblings ...) 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 3/5] net/bnxt: fix vnic allocation failure on port toggle Ajit Khaparde @ 2019-11-04 22:50 ` Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 5/5] net/bnxt: fix incorrect COS queue mapping Ajit Khaparde 2019-11-04 23:12 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde 5 siblings, 0 replies; 13+ messages in thread From: Ajit Khaparde @ 2019-11-04 22:50 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, Kalesh AP, Santoshkumar Karanappa Rastapur From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> During initialization sequence in bnxt_alloc_mem() if bnxt_alloc_async_cp_ring() fails, driver invokes bnxt_free_mem() which in turn call bnxt_free_vnic_mem() which causes the error logs "bnxt_free_vnic_mem(): VNIC is not freed yet!". This is because vnic memory is allocated but not initialized yet. Fix this by moving bnxt_init_vnics() from bnxt_init_nic() to bnxt_alloc_vnic_mem(). Also get rid of bnxt_init_nic() as the initialization is done in respective functions now. Fixes: 1bf01f5135f8 ("net/bnxt: prevent device access when device is in reset") Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com> --- drivers/net/bnxt/bnxt_ethdev.c | 18 ------------------ drivers/net/bnxt/bnxt_filter.c | 3 ++- drivers/net/bnxt/bnxt_filter.h | 1 - drivers/net/bnxt/bnxt_ring.c | 5 ++--- drivers/net/bnxt/bnxt_ring.h | 1 - drivers/net/bnxt/bnxt_vnic.c | 5 +++-- drivers/net/bnxt/bnxt_vnic.h | 1 - 7 files changed, 7 insertions(+), 27 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3acf66d59..b9b055e71 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -479,22 +479,6 @@ static int bnxt_shutdown_nic(struct bnxt *bp) return 0; } -static int bnxt_init_nic(struct bnxt *bp) -{ - int rc; - - if (BNXT_HAS_RING_GRPS(bp)) { - rc = bnxt_init_ring_grps(bp); - if (rc) - return rc; - } - - bnxt_init_vnics(bp); - bnxt_init_filters(bp); - - return 0; -} - /* * Device configuration and status function */ @@ -4665,8 +4649,6 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev) if (rc) return rc; - bnxt_init_nic(bp); - rc = bnxt_request_int(bp); if (rc) return rc; diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index 7e29468b7..da1a6c24a 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -61,7 +61,7 @@ struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf) return filter; } -void bnxt_init_filters(struct bnxt *bp) +static void bnxt_init_filters(struct bnxt *bp) { struct bnxt_filter_info *filter; int i, max_filters; @@ -171,6 +171,7 @@ int bnxt_alloc_filter_mem(struct bnxt *bp) return -ENOMEM; } bp->filter_info = filter_mem; + bnxt_init_filters(bp); return 0; } diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h index 7415b3612..9db3e7487 100644 --- a/drivers/net/bnxt/bnxt_filter.h +++ b/drivers/net/bnxt/bnxt_filter.h @@ -81,7 +81,6 @@ struct bnxt_filter_info { struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp); struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf); -void bnxt_init_filters(struct bnxt *bp); void bnxt_free_all_filters(struct bnxt *bp); void bnxt_free_filter_mem(struct bnxt *bp); int bnxt_alloc_filter_mem(struct bnxt *bp); diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 0a182d3a8..ea46fa9bc 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -38,15 +38,13 @@ void bnxt_free_ring(struct bnxt_ring *ring) * Ring groups */ -int bnxt_init_ring_grps(struct bnxt *bp) +static void bnxt_init_ring_grps(struct bnxt *bp) { unsigned int i; for (i = 0; i < bp->max_ring_grps; i++) memset(&bp->grp_info[i], (uint8_t)HWRM_NA_SIGNATURE, sizeof(struct bnxt_ring_grp_info)); - - return 0; } int bnxt_alloc_ring_grps(struct bnxt *bp) @@ -76,6 +74,7 @@ int bnxt_alloc_ring_grps(struct bnxt *bp) "Failed to alloc grp info tbl.\n"); return -ENOMEM; } + bnxt_init_ring_grps(bp); } return 0; diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h index 833118391..48a39d788 100644 --- a/drivers/net/bnxt/bnxt_ring.h +++ b/drivers/net/bnxt/bnxt_ring.h @@ -65,7 +65,6 @@ struct bnxt_tx_ring_info; struct bnxt_rx_ring_info; struct bnxt_cp_ring_info; void bnxt_free_ring(struct bnxt_ring *ring); -int bnxt_init_ring_grps(struct bnxt *bp); int bnxt_alloc_ring_grps(struct bnxt *bp); int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, struct bnxt_tx_queue *txq, diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 2f0ed1026..412a53dc0 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -35,7 +35,7 @@ void prandom_bytes(void *dest_ptr, size_t len) } } -void bnxt_init_vnics(struct bnxt *bp) +static void bnxt_init_vnics(struct bnxt *bp) { struct bnxt_vnic_info *vnic; uint16_t max_vnics; @@ -52,7 +52,6 @@ void bnxt_init_vnics(struct bnxt *bp) vnic->hash_mode = HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT; - prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE); STAILQ_INIT(&vnic->filter); STAILQ_INIT(&vnic->flow_list); STAILQ_INSERT_TAIL(&bp->free_vnic_list, vnic, next); @@ -179,6 +178,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) HW_HASH_KEY_SIZE); vnic->mc_list_dma_addr = vnic->rss_hash_key_dma_addr + HW_HASH_KEY_SIZE; + prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE); } return 0; @@ -220,6 +220,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp) return -ENOMEM; } bp->vnic_info = vnic_mem; + bnxt_init_vnics(bp); return 0; } diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h index 4f760e0b0..a372b899b 100644 --- a/drivers/net/bnxt/bnxt_vnic.h +++ b/drivers/net/bnxt/bnxt_vnic.h @@ -58,7 +58,6 @@ struct bnxt_vnic_info { }; struct bnxt; -void bnxt_init_vnics(struct bnxt *bp); int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic, int pool); struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp); -- 2.21.0 (Apple Git-122) ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v3 5/5] net/bnxt: fix incorrect COS queue mapping 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde ` (3 preceding siblings ...) 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 4/5] net/bnxt: fix a failure case during initialization Ajit Khaparde @ 2019-11-04 22:50 ` Ajit Khaparde 2019-11-04 23:12 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde 5 siblings, 0 replies; 13+ messages in thread From: Ajit Khaparde @ 2019-11-04 22:50 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, Somnath Kotur While issuing hwrm_queue_qportcfg command, we are setting the drv_qmap_cap bit which is causing the firmware to return incorrect COS queue mapping. This bit is not required when COS classification is enabled. Fixes: 698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue") Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> --- drivers/net/bnxt/bnxt_hwrm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index daed4ee76..ab6cb1dc3 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1217,8 +1217,9 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt *bp) HWRM_PREP(req, QUEUE_QPORTCFG, BNXT_USE_CHIMP_MB); req.flags = rte_cpu_to_le_32(dir); - /* HWRM Version >= 1.9.1 */ - if (bp->hwrm_spec_code >= HWRM_VERSION_1_9_1) + /* HWRM Version >= 1.9.1 only if COS Classification is not required. */ + if (bp->hwrm_spec_code >= HWRM_VERSION_1_9_1 && + !(bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY)) req.drv_qmap_cap = HWRM_QUEUE_QPORTCFG_INPUT_DRV_QMAP_CAP_ENABLED; rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); -- 2.21.0 (Apple Git-122) ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde ` (4 preceding siblings ...) 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 5/5] net/bnxt: fix incorrect COS queue mapping Ajit Khaparde @ 2019-11-04 23:12 ` Ajit Khaparde 5 siblings, 0 replies; 13+ messages in thread From: Ajit Khaparde @ 2019-11-04 23:12 UTC (permalink / raw) To: dpdk-dev, Kalesh Anakkur Purayil; +Cc: Ferruh Yigit On Mon, Nov 4, 2019 at 2:50 PM Ajit Khaparde <ajit.khaparde@broadcom.com> wrote: > v2->v3: > Sending with updated the commit logs for patch 1 & 2 > > > Ajit Khaparde (1): > net/bnxt: fix incorrect COS queue mapping > > Kalesh AP (2): > net/bnxt: fix L4 checksum indication in non-vector Rx > net/bnxt: fix a failure case during initialization > > Santoshkumar Karanappa Rastapur (1): > net/bnxt: fix vnic allocation failure on port toggle > > Venkat Duvvuru (1): > net/bnxt: fix redundant MAC address check > > drivers/net/bnxt/bnxt_ethdev.c | 126 +++++++++++---------------------- > drivers/net/bnxt/bnxt_filter.c | 4 +- > drivers/net/bnxt/bnxt_filter.h | 8 ++- > drivers/net/bnxt/bnxt_hwrm.c | 14 ++-- > drivers/net/bnxt/bnxt_ring.c | 5 +- > drivers/net/bnxt/bnxt_ring.h | 1 - > drivers/net/bnxt/bnxt_rxq.c | 2 + > drivers/net/bnxt/bnxt_rxr.c | 18 +++-- > drivers/net/bnxt/bnxt_vnic.c | 5 +- > drivers/net/bnxt/bnxt_vnic.h | 1 - > 10 files changed, 73 insertions(+), 111 deletions(-) > Patchset applied to dpdk-next-net-brcm. > > -- > 2.21.0 (Apple Git-122) > > ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-11-04 23:12 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-11-04 10:02 [dpdk-dev] [PATCH v2 0/5] bnxt patchset with bug fixes Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 1/5] net/bnxt: fix L4 checksum error indication in non-vector mode rx Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 2/5] net/bnxt: fix redundant mac addr check Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 3/5] net/bnxt: fix vnic allocation failure on port toggle Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 4/5] net/bnxt: fix a failure case during initialization Kalesh A P 2019-11-04 10:02 ` [dpdk-dev] [PATCH v2 5/5] net/bnxt: fix incorrect COS queue mapping Kalesh A P 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 1/5] net/bnxt: fix L4 checksum indication in non-vector Rx Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 2/5] net/bnxt: fix redundant MAC address check Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 3/5] net/bnxt: fix vnic allocation failure on port toggle Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 4/5] net/bnxt: fix a failure case during initialization Ajit Khaparde 2019-11-04 22:50 ` [dpdk-dev] [PATCH v3 5/5] net/bnxt: fix incorrect COS queue mapping Ajit Khaparde 2019-11-04 23:12 ` [dpdk-dev] [PATCH v3 0/5] bnxt patchset with bug fixes Ajit Khaparde
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).