ipv6: Separate tcp offload functionality
Pull TCPv6 offload functionality into its won file in preparation for moving it out of the module. Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d1da932ed4
commit
8663e02aba
@@ -31,6 +31,8 @@
|
||||
#include <net/ip.h>
|
||||
#include <asm/checksum.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/ipv6.h>
|
||||
|
||||
#ifndef _HAVE_ARCH_IPV6_CSUM
|
||||
|
||||
@@ -91,4 +93,37 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static __inline__ __sum16 tcp_v6_check(int len,
|
||||
const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr,
|
||||
__wsum base)
|
||||
{
|
||||
return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
|
||||
}
|
||||
|
||||
static inline void __tcp_v6_send_check(struct sk_buff *skb,
|
||||
const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr)
|
||||
{
|
||||
struct tcphdr *th = tcp_hdr(skb);
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
th->check = ~tcp_v6_check(skb->len, saddr, daddr, 0);
|
||||
skb->csum_start = skb_transport_header(skb) - skb->head;
|
||||
skb->csum_offset = offsetof(struct tcphdr, check);
|
||||
} else {
|
||||
th->check = tcp_v6_check(skb->len, saddr, daddr,
|
||||
csum_partial(th, th->doff << 2,
|
||||
skb->csum));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
|
||||
__tcp_v6_send_check(skb, &np->saddr, &np->daddr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user