Commit 8852ddb4 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Simplify VLAN receive logic.

Since both CTAG and STAG rx acceleration must be enabled together, we
only need to check one feature flag (NETIF_F_HW_VLAN_CTAG_RX) before
calling __vlan_hwaccel_put_tag().
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a9f6b23
......@@ -1113,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);
......@@ -1278,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment