Skip to content

Commit

Permalink
Merge branch 'bnxt_en-fixes'
Browse files Browse the repository at this point in the history
Michael Chan says:

====================
bnxt_en: Bug fixes.

Fix a race condition and VLAN rx acceleration logic.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 7, 2016
2 parents fa54cc7 + 8852ddb commit 71743ff
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
cpu_to_le32(DB_KEY_TX_PUSH | DB_LONG_TX_PUSH | prod);
txr->tx_prod = prod;

tx_buf->is_push = 1;
netdev_tx_sent_queue(txq, skb->len);
wmb(); /* Sync is_push and byte queue before pushing data */

push_len = (length + sizeof(*tx_push) + 7) / 8;
if (push_len > 16) {
Expand All @@ -298,7 +300,6 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
push_len);
}

tx_buf->is_push = 1;
goto tx_done;
}

Expand Down Expand Up @@ -1112,19 +1113,13 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
if (tpa_info->hash_type != PKT_HASH_TYPE_NONE)
skb_set_hash(skb, tpa_info->rss_hash, tpa_info->hash_type);

if (tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) {
netdev_features_t features = skb->dev->features;
if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) &&
(skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
u16 vlan_proto = tpa_info->metadata >>
RX_CMP_FLAGS2_METADATA_TPID_SFT;
u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_VID_MASK;

if (((features & NETIF_F_HW_VLAN_CTAG_RX) &&
vlan_proto == ETH_P_8021Q) ||
((features & NETIF_F_HW_VLAN_STAG_RX) &&
vlan_proto == ETH_P_8021AD)) {
__vlan_hwaccel_put_tag(skb, htons(vlan_proto),
tpa_info->metadata &
RX_CMP_FLAGS2_METADATA_VID_MASK);
}
__vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
}

skb_checksum_none_assert(skb);
Expand Down Expand Up @@ -1277,19 +1272,14 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,

skb->protocol = eth_type_trans(skb, dev);

if (rxcmp1->rx_cmp_flags2 &
cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) {
netdev_features_t features = skb->dev->features;
if ((rxcmp1->rx_cmp_flags2 &
cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) &&
(skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data);
u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_VID_MASK;
u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT;

if (((features & NETIF_F_HW_VLAN_CTAG_RX) &&
vlan_proto == ETH_P_8021Q) ||
((features & NETIF_F_HW_VLAN_STAG_RX) &&
vlan_proto == ETH_P_8021AD))
__vlan_hwaccel_put_tag(skb, htons(vlan_proto),
meta_data &
RX_CMP_FLAGS2_METADATA_VID_MASK);
__vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
}

skb_checksum_none_assert(skb);
Expand Down Expand Up @@ -5466,6 +5456,20 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,

if (!bnxt_rfs_capable(bp))
features &= ~NETIF_F_NTUPLE;

/* Both CTAG and STAG VLAN accelaration on the RX side have to be
* turned on or off together.
*/
if ((features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) !=
(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) {
if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
features &= ~(NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_STAG_RX);
else
features |= NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_STAG_RX;
}

return features;
}

Expand Down

0 comments on commit 71743ff

Please sign in to comment.