Skip to content

Commit

Permalink
r8152: use new helper tcp_v6_gso_csum_prep
Browse files Browse the repository at this point in the history
Use new helper tcp_v6_gso_csum_prep in additional network drivers.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Feb 19, 2020
1 parent 1eb2c57 commit 2344120
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions drivers/net/usb/r8152.c
Original file line number Diff line number Diff line change
Expand Up @@ -1948,29 +1948,6 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb,
}
}

/* msdn_giant_send_check()
* According to the document of microsoft, the TCP Pseudo Header excludes the
* packet length for IPv6 TCP large packets.
*/
static int msdn_giant_send_check(struct sk_buff *skb)
{
const struct ipv6hdr *ipv6h;
struct tcphdr *th;
int ret;

ret = skb_cow_head(skb, 0);
if (ret)
return ret;

ipv6h = ipv6_hdr(skb);
th = tcp_hdr(skb);

th->check = 0;
th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0);

return ret;
}

static inline void rtl_tx_vlan_tag(struct tx_desc *desc, struct sk_buff *skb)
{
if (skb_vlan_tag_present(skb)) {
Expand Down Expand Up @@ -2016,10 +1993,11 @@ static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc,
break;

case htons(ETH_P_IPV6):
if (msdn_giant_send_check(skb)) {
if (skb_cow_head(skb, 0)) {
ret = TX_CSUM_TSO;
goto unavailable;
}
tcp_v6_gso_csum_prep(skb);
opts1 |= GTSENDV6;
break;

Expand Down

0 comments on commit 2344120

Please sign in to comment.