summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/realtek
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2021-01-12 09:29:45 +0100
committerJakub Kicinski <kuba@kernel.org>2021-01-13 04:01:30 +0100
commit206a75e003e17aad4fd60047deee2252fdc3df38 (patch)
tree392e89381d335acb2ffc840e2086329017bb1389 /drivers/net/ethernet/realtek
parentr8169: align rtl_wol_suspend_quirk with vendor driver and rename it (diff)
downloadlinux-206a75e003e17aad4fd60047deee2252fdc3df38.tar.xz
linux-206a75e003e17aad4fd60047deee2252fdc3df38.zip
r8169: improve rtl8169_rx_csum
Extend the mask to include the checksum failure bits. This allows to simplify the condition in rtl8169_rx_csum(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/realtek')
-rw-r--r--drivers/net/ethernet/realtek/r8169_main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 84f488d1c884..b4c080cc6a28 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -533,6 +533,9 @@ enum rtl_rx_desc_bit {
IPFail = (1 << 16), /* IP checksum failed */
UDPFail = (1 << 15), /* UDP/IP checksum failed */
TCPFail = (1 << 14), /* TCP/IP checksum failed */
+
+#define RxCSFailMask (IPFail | UDPFail | TCPFail)
+
RxVlanTag = (1 << 16), /* VLAN tag available */
};
@@ -4377,10 +4380,9 @@ static inline int rtl8169_fragmented_frame(u32 status)
static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1)
{
- u32 status = opts1 & RxProtoMask;
+ u32 status = opts1 & (RxProtoMask | RxCSFailMask);
- if (((status == RxProtoTCP) && !(opts1 & TCPFail)) ||
- ((status == RxProtoUDP) && !(opts1 & UDPFail)))
+ if (status == RxProtoTCP || status == RxProtoUDP)
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb_checksum_none_assert(skb);