Skip to content

Commit 966873b

Browse files
committed
iavf: fixup for optimize vol. 2
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
1 parent d011fc6 commit 966873b

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

drivers/net/ethernet/intel/iavf/iavf_txrx.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -929,31 +929,27 @@ static void iavf_rx_checksum(struct iavf_vsi *vsi, struct sk_buff *skb,
929929
u64 qword, struct libie_rx_ptype_parsed parsed)
930930
{
931931
u32 rx_error, rx_status;
932-
bool ipv4, ipv6;
933932

934933
if (!libie_has_rx_checksum(vsi->netdev, parsed))
935934
return;
936935

937-
rx_error = (qword & IAVF_RXD_QW1_ERROR_MASK) >>
938-
IAVF_RXD_QW1_ERROR_SHIFT;
939936
rx_status = (qword & IAVF_RXD_QW1_STATUS_MASK) >>
940937
IAVF_RXD_QW1_STATUS_SHIFT;
941938

942939
/* did the hardware decode the packet and checksum? */
943940
if (!(rx_status & BIT(IAVF_RX_DESC_STATUS_L3L4P_SHIFT)))
944941
return;
945942

946-
ipv4 = parsed.outer_ip == LIBIE_RX_PTYPE_OUTER_IPV4;
947-
ipv6 = parsed.outer_ip == LIBIE_RX_PTYPE_OUTER_IPV6;
943+
rx_error = (qword & IAVF_RXD_QW1_ERROR_MASK) >>
944+
IAVF_RXD_QW1_ERROR_SHIFT;
948945

949-
if (ipv4 &&
946+
if (parsed.outer_ip == LIBIE_RX_PTYPE_OUTER_IPV4 &&
950947
(rx_error & (BIT(IAVF_RX_DESC_ERROR_IPE_SHIFT) |
951948
BIT(IAVF_RX_DESC_ERROR_EIPE_SHIFT))))
952949
goto checksum_fail;
953-
954950
/* likely incorrect csum if alternate IP extension headers found */
955-
if (ipv6 &&
956-
rx_status & BIT(IAVF_RX_DESC_STATUS_IPV6EXADD_SHIFT))
951+
else if (parsed.outer_ip == LIBIE_RX_PTYPE_OUTER_IPV6 &&
952+
(rx_status & BIT(IAVF_RX_DESC_STATUS_IPV6EXADD_SHIFT)))
957953
/* don't increment checksum err here, non-fatal err */
958954
return;
959955

@@ -992,36 +988,40 @@ static void iavf_rx_hash(const struct iavf_ring *ring,
992988
IAVF_RX_DESC_STATUS_FLTSTAT_SHIFT;
993989
u32 hash;
994990

995-
if (!libie_has_rx_hash(ring->netdev, parsed))
991+
if (!libie_has_rx_hash(ring->netdev, parsed) ||
992+
(qword & rss_mask) != rss_mask)
996993
return;
997994

998-
if ((qword & rss_mask) == rss_mask) {
999-
hash = le32_to_cpu(rx_desc->wb.qword0.hi_dword.rss);
1000-
libie_skb_set_hash(skb, hash, parsed);
1001-
}
995+
hash = le32_to_cpu(rx_desc->wb.qword0.hi_dword.rss);
996+
libie_skb_set_hash(skb, hash, parsed);
1002997
}
1003998

1004999
static void iavf_rx_vlan(const struct iavf_ring *rx_ring,
10051000
const union iavf_rx_desc *rx_desc,
10061001
struct sk_buff *skb, u64 qword)
10071002
{
1008-
u16 vlan_tag = 0;
1003+
u16 vlan_tag;
1004+
__be16 prot;
1005+
1006+
if (rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
1007+
prot = htons(ETH_P_8021Q);
1008+
else if (rx_ring->netdev->features & NETIF_F_HW_VLAN_STAG_RX)
1009+
prot = htons(ETH_P_8021AD);
1010+
else
1011+
return;
10091012

10101013
if ((qword & BIT(IAVF_RX_DESC_STATUS_L2TAG1P_SHIFT)) &&
10111014
(rx_ring->flags & IAVF_TXRX_FLAGS_VLAN_TAG_LOC_L2TAG1))
10121015
vlan_tag = le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1);
1013-
if ((rx_desc->wb.qword2.ext_status &
1014-
cpu_to_le16(BIT(IAVF_RX_DESC_EXT_STATUS_L2TAG2P_SHIFT))) &&
1015-
(rx_ring->flags & IAVF_RXR_FLAGS_VLAN_TAG_LOC_L2TAG2_2))
1016+
else if ((rx_ring->flags & IAVF_RXR_FLAGS_VLAN_TAG_LOC_L2TAG2_2) &&
1017+
(rx_desc->wb.qword2.ext_status &
1018+
cpu_to_le16(BIT(IAVF_RX_DESC_EXT_STATUS_L2TAG2P_SHIFT))))
10161019
vlan_tag = le16_to_cpu(rx_desc->wb.qword2.l2tag2_2);
1020+
else
1021+
vlan_tag = 0;
10171022

1018-
if (!(vlan_tag & VLAN_VID_MASK))
1019-
return;
1020-
1021-
if (rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
1022-
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
1023-
else if (rx_ring->netdev->features & NETIF_F_HW_VLAN_STAG_RX)
1024-
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan_tag);
1023+
if (vlan_tag & VLAN_VID_MASK)
1024+
__vlan_hwaccel_put_tag(skb, prot, vlan_tag);
10251025
}
10261026

10271027
/**

0 commit comments

Comments
 (0)