Jan Beulich
2008-Feb-21 09:03 UTC
[Xen-devel] [PATCH] linux: use simplifying macros in Solarflare netfront where possible
Using the header offset macros where possible simplifies forward porting to 2.6.22+. As usual, written and tested on 2.6.24.1 and made apply to the 2.6.18 tree without further testing. Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: head-2008-02-20/drivers/xen/sfc_netfront/accel_tso.c ==================================================================--- head-2008-02-20.orig/drivers/xen/sfc_netfront/accel_tso.c 2008-02-20 14:46:49.000000000 +0100 +++ head-2008-02-20/drivers/xen/sfc_netfront/accel_tso.c 2008-02-20 14:52:57.000000000 +0100 @@ -115,7 +115,7 @@ struct netfront_accel_tso_state { EPRINTK_ON(skb->protocol != htons (ETH_P_IP)); EPRINTK_ON(((struct ethhdr*) skb->data)->h_proto != htons (ETH_P_IP)); EPRINTK_ON(skb->nh.iph->protocol != IPPROTO_TCP); - EPRINTK_ON((PTR_DIFF(skb->h.th, skb->data) + EPRINTK_ON((SKB_TCP_OFF(skb) + (skb->h.th->doff << 2u)) > skb_headlen(skb)); } @@ -129,8 +127,7 @@ static inline void tso_start(struct netf * All ethernet/IP/TCP headers combined size is TCP header size * plus offset of TCP header relative to start of packet. */ - st->p.header_length = ((skb->h.th->doff << 2u) - + PTR_DIFF(skb->h.th, skb->data)); + st->p.header_length = (skb->h.th->doff << 2u) + SKB_TCP_OFF(skb); st->p.full_packet_size = (st->p.header_length + skb_shinfo(skb)->gso_size); st->p.gso_size = skb_shinfo(skb)->gso_size; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel