bnxt_en: Bug fixes.
Michael Chan
maintainercover bnxt_en: Bug fixes.
These are bug fixes in error code paths, TC Flower VLAN TCI flow checking bug fix, proper filtering of Broadcast packets if IFF_BROADCAST is not set, and a bug fix in bnxt_get_max_rings() to return 0 ring parameters when the return value is -ENOMEM.
Michael Chan (4):
bnxt_en: Fix inconsistent BNXT_FLAG_AGG_RINGS logic.
bnxt_en: Always set output parameters in bnxt_get_max_rings().
bnxt_en: Support clearing of the IFF_BROADCAST flag.
bnxt_en: Do not modify max IRQ count after RDMA driver requests/frees
IRQs.
Venkat Duvvuru (1):
bnxt_en: Fix the vlan_tci exact match check.
Vikas Gupta (1):
bnxt_en: Fix for system hang if request_irq fails
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 24 ++++++++++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 - drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 30 ++++++++++++++++++++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 -- 4 files changed, 44 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 1/6 bnxt_en: Fix the vlan_tci exact match check.
From: Venkat Duvvuru <[email protected]>
It is possible that OVS may set don’t care for DEI/CFI bit in vlan_tci mask. Hence, checking for vlan_tci exact match will endup in a vlan flow rejection.
This patch fixes the problem by checking for vlan_pcp and vid separately, instead of checking for the entire vlan_tci.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 30 +++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +27 -3
@@ -27,6 +27,15 @@#define BNXT_FID_INVALID 0xffff#define VLAN_TCI (vid, prio) ((vid) | ((prio) << VLAN_PRIO_SHIFT)) +#define is_vlan_pcp_wildcarded (vlan_tci_mask) \ + ((ntohs(vlan_tci_mask) & VLAN_PRIO_MASK) == 0x0000) +#define is_vlan_pcp_exactmatch (vlan_tci_mask) \ + ((ntohs(vlan_tci_mask) & VLAN_PRIO_MASK) == VLAN_PRIO_MASK) +#define is_vlan_pcp_zero (vlan_tci) \ + ((ntohs(vlan_tci) & VLAN_PRIO_MASK) == 0x0000) +#define is_vid_exactmatch (vlan_tci_mask) \ + ((ntohs(vlan_tci_mask) & VLAN_VID_MASK) == VLAN_VID_MASK) +/* Return the dst fid of the func for flow forwarding * For PFs: src_fid is the fid of the PF * For VF-reps: src_fid the fid of the VF
@@ -389,6 +398,21 @@ static bool is_exactmatch(void *mask, int len)return true; } +static bool is_vlan_tci_allowed (__be16 vlan_tci_mask, +__be16 vlan_tci) +{ +/* VLAN priority must be either exactly zero or fully wildcarded and +* VLAN id must be exact match. +*/ +if (is_vid_exactmatch (vlan_tci_mask) && + ((is_vlan_pcp_exactmatch (vlan_tci_mask) && +is_vlan_pcp_zero (vlan_tci)) || +is_vlan_pcp_wildcarded (vlan_tci_mask))) +return true; + +return false; +} +static bool bits_set (void *key,int len) {const u8 *p = key;
@@ -803,9 +827,9 @@ static bool bnxt_tc_can_offload(struct bnxt *bp, struct bnxt_tc_flow *flow)/* Currently VLAN fields cannot be partial wildcard */ if (bits_set (&flow->l2_key.inner_vlan_tci,sizeof (flow->l2_key.inner_vlan_tci)) && - !is_exactmatch (&flow->l2_mask.inner_vlan_tci, -sizeof (flow->l2_mask.inner_vlan_tci))) { -netdev_info (bp->dev,"Wildcard match unsupported for VLAN TCI\n" ); + !is_vlan_tci_allowed (flow->l2_mask.inner_vlan_tci, + flow->l2_key.inner_vlan_tci)) { +netdev_info (bp->dev,"Unsupported VLAN TCI\n" );return false; } if (bits_set(&flow->l2_key.inner_vlan_tpid,
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 2/6 bnxt_en: Fix inconsistent BNXT_FLAG_AGG_RINGS logic.
In reply to Michael ChanIf there aren't enough RX rings available, the driver will attempt to use a single RX ring without the aggregation ring. If that also fails, the BNXT_FLAG_AGG_RINGS flag is cleared but the other ring parameters are not set consistently to reflect that. If more RX rings become available at the next open, the RX rings will be in an inconsistent state and may crash when freeing the RX rings.
Fix it by restoring the BNXT_FLAG_AGG_RINGS if not enough RX rings are available to run without aggregation rings.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -1
@@ -8520,8 +8520,11 @@ static int bnxt_get_dflt_rings(struct bnxt *bp, int *max_rx, int *max_tx,/* Not enough rings, try disabling agg rings. */ bp->flags &= ~BNXT_FLAG_AGG_RINGS ; rc =bnxt_get_max_rings (bp, max_rx, max_tx, shared); -if (rc) +if (rc) { +/* set BNXT_FLAG_AGG_RINGS back for consistency */ + bp->flags |=BNXT_FLAG_AGG_RINGS ;return rc; + } bp->flags |=BNXT_FLAG_NO_AGG_RINGS ; bp->dev->hw_features &= ~(NETIF_F_LRO |NETIF_F_GRO_HW ); bp->dev->features &= ~(NETIF_F_LRO |NETIF_F_GRO_HW );
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 3/6 bnxt_en: Always set output parameters in bnxt_get_max_rings().
In reply to Michael ChanThe current code returns -ENOMEM and does not bother to set the output parameters to 0 when no rings are available. Some callers, such as bnxt_get_channels() will display garbage ring numbers when that happens. Fix it by always setting the output parameters.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -2
@@ -8502,11 +8502,11 @@ int bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, bool shared)int rx, tx, cp;_bnxt_get_max_rings (bp, &rx, &tx, &cp); + *max_rx = rx; + *max_tx = tx;if (!rx || !tx || !cp)return -ENOMEM ; - *max_rx = rx; - *max_tx = tx;return bnxt_trim_rings (bp, max_rx, max_tx, cp, shared); }
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 4/6 bnxt_en: Support clearing of the IFF_BROADCAST flag.
In reply to Michael ChanCurrently, the driver assumes IFF_BROADCAST is always set and always sets the broadcast filter. Modify the code to set or clear the broadcast filter according to the IFF_BROADCAST flag.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 -2
@@ -5712,7 +5712,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) } vnic->uc_filter_count =1 ; - vnic->rx_mask =CFA_L2_SET_RX_MASK_REQ_MASK_BCAST ; + vnic->rx_mask =0 ; +if (bp->dev->flags &IFF_BROADCAST ) + vnic->rx_mask |=CFA_L2_SET_RX_MASK_REQ_MASK_BCAST ;if ((bp->dev->flags &IFF_PROMISC ) &&bnxt_promisc_ok (bp)) vnic->rx_mask |=CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS ;
@@ -7214,13 +7216,16 @@ static void bnxt_set_rx_mode(struct net_device *dev) mask &= ~(CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS |CFA_L2_SET_RX_MASK_REQ_MASK_MCAST | -CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST ); +CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST | +CFA_L2_SET_RX_MASK_REQ_MASK_BCAST );if ((dev->flags &IFF_PROMISC ) &&bnxt_promisc_ok (bp)) mask |=CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS ; uc_update =bnxt_uc_list_updated (bp); +if (dev->flags &IFF_BROADCAST ) + mask |=CFA_L2_SET_RX_MASK_REQ_MASK_BCAST ;if (dev->flags &IFF_ALLMULTI ) { mask |=CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST ; vnic->mc_list_count =0 ;
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 5/6 bnxt_en: Do not modify max IRQ count after RDMA driver requests/frees IRQs.
In reply to Michael ChanCalling bnxt_set_max_func_irqs() to modify the max IRQ count requested or freed by the RDMA driver is flawed. The max IRQ count is checked when re-initializing the IRQ vectors and this can happen multiple times during ifup or ethtool -L. If the max IRQ is reduced and the RDMA driver is operational, we may not initailize IRQs correctly. This problem shows up on VFs with very small number of MSIX.
There is no other logic that relies on the IRQ count excluding the ones used by RDMA. So we fix it by just removing the call to subtract or add the IRQs used by RDMA.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 - drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -5919,7 +5919,7 @@ unsigned int bnxt_get_max_func_irqs(struct bnxt *bp) return min_t(unsigned int, hw_resc->max_irqs, hw_resc->max_cp_rings); } -void bnxt_set_max_func_irqs (struct bnxt *bp,unsigned int max_irqs) +static void bnxt_set_max_func_irqs (struct bnxt *bp,unsigned int max_irqs) { bp->hw_resc.max_irqs = max_irqs; }
drivers/net/ethernet/broadcom/bnxt/bnxt.h +0 -1
@@ -1470,7 +1470,6 @@ int bnxt_hwrm_func_rgtr_async_events(struct bnxt *bp, unsigned long *bmap,unsigned int bnxt_get_max_func_cp_rings (struct bnxt *bp);void bnxt_set_max_func_cp_rings (struct bnxt *bp,unsigned int max);unsigned int bnxt_get_max_func_irqs (struct bnxt *bp); -void bnxt_set_max_func_irqs (struct bnxt *bp,unsigned int max);int bnxt_get_avail_msix (struct bnxt *bp,int num);int bnxt_reserve_rings (struct bnxt *bp);void bnxt_tx_disable (struct bnxt *bp);
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +0 -2
@@ -169,7 +169,6 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id, edev->ulp_tbl[ulp_id].msix_requested = avail_msix; }bnxt_fill_msix_vecs (bp, ent); -bnxt_set_max_func_irqs (bp,bnxt_get_max_func_irqs (bp) - avail_msix);bnxt_set_max_func_cp_rings (bp, max_cp_rings - avail_msix); edev->flags |=BNXT_EN_FLAG_MSIX_REQUESTED ;return avail_msix;
@@ -192,7 +191,6 @@ static int bnxt_free_msix_vecs(struct bnxt_en_dev *edev, int ulp_id) msix_requested = edev->ulp_tbl[ulp_id].msix_requested;bnxt_set_max_func_cp_rings (bp, max_cp_rings + msix_requested); edev->ulp_tbl[ulp_id].msix_requested =0 ; -bnxt_set_max_func_irqs (bp,bnxt_get_max_func_irqs (bp) + msix_requested); edev->flags &= ~BNXT_EN_FLAG_MSIX_REQUESTED ;if (netif_running (dev)) {bnxt_close_nic (bp, true, false);
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 6/6 bnxt_en: Fix for system hang if request_irq fails
In reply to Michael ChanFrom: Vikas Gupta <[email protected]>
Fix bug in the error code path when bnxt_request_irq() returns failure. bnxt_disable_napi() should not be called in this error path because NAPI has not been enabled yet.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -1
@@ -6890,7 +6890,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) rc =bnxt_request_irq (bp);if (rc) {netdev_err (bp->dev,"bnxt_request_irq err: %x\n" , rc); - goto open_err; + goto open_err_irq; } }
@@ -6930,6 +6930,8 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) open_err:bnxt_debug_dev_exit (bp);bnxt_disable_napi (bp); + +open_err_irq:bnxt_del_napi (bp); open_err_free_mem:
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Michael Chan <[email protected]>
Date: Mon, 9 Jul 2018 02:24:46 -0400
Quoted 4 lines
These are bug fixes in error code paths, TC Flower VLAN TCI flow checking bug fix, proper filtering of Broadcast packets if
IFF_BROADCASTis not set, and a bug fix inbnxt_get_max_rings()to return 0 ring parameters when the return value is-ENOMEM.
Series applied, thank you.