Skip to contentSkip to conversation

linux: use simplifying macros in Solarflare netfront where possible

PATCH New Jan Beulich 1 participant 1 message Feb 21, 2008 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/xen/sfc_netfront/accel_tso.c +2 -3
Index: head-2008-02-20/drivers/xen/sfc_netfront/accel_tso.c
===================================================================
@@ -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;