[SK_BUFF]: Introduce skb_network_header_len
For the common sequence "skb->h.raw - skb->nh.raw", similar to skb->mac_len, that is precalculated tho, don't think we need to bloat skb with one more member, so just use this new helper, reducing the number of non-skbuff.h references to the layer headers even more. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
bff9b61ce3
commit
cfe1fc7759
@@ -953,7 +953,7 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb)
|
||||
* l4os is the distance between the start of the
|
||||
* l3 hdr and the l4 hdr */
|
||||
fcb->l3os = (u16)(skb_network_offset(skb) - GMAC_FCB_LEN);
|
||||
fcb->l4os = (u16)(skb->h.raw - skb->nh.raw);
|
||||
fcb->l4os = skb_network_header_len(skb);
|
||||
|
||||
fcb->flags = flags;
|
||||
}
|
||||
|
||||
@@ -734,12 +734,12 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
|
||||
switch (ip_hdr(skb)->protocol) {
|
||||
case IPPROTO_TCP:
|
||||
dflags |= XCT_MACTX_CSUM_TCP;
|
||||
dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2);
|
||||
dflags |= XCT_MACTX_IPH(skb_network_header_len(skb) >> 2);
|
||||
dflags |= XCT_MACTX_IPO(nh - skb->data);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
dflags |= XCT_MACTX_CSUM_UDP;
|
||||
dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2);
|
||||
dflags |= XCT_MACTX_IPH(skb_network_header_len(skb) >> 2);
|
||||
dflags |= XCT_MACTX_IPO(nh - skb->data);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user