From: "Jan Beulich" Subject: [PATCH] linux: use simplifying macros in Solarflare netfront where possible Date: Thu, 21 Feb 2008 09:03:40 +0000 Message-ID: <47BD4C7C.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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 Index: head-2008-02-20/drivers/xen/sfc_netfront/accel_tso.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 !=3D htons (ETH_P_IP)); EPRINTK_ON(((struct ethhdr*) skb->data)->h_proto !=3D htons = (ETH_P_IP)); EPRINTK_ON(skb->nh.iph->protocol !=3D 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)); } =20 @@ -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 =3D ((skb->h.th->doff << 2u) - + PTR_DIFF(skb->h.th, skb->data)); + st->p.header_length =3D (skb->h.th->doff << 2u) + SKB_TCP_OFF(skb);= st->p.full_packet_size =3D (st->p.header_length + skb_shinfo(skb)->gso_size); st->p.gso_size =3D skb_shinfo(skb)->gso_size;