[IP]: Introduce ip_hdrlen()
For the common sequence "skb->nh.iph->ihl * 4", removing a good number of open coded skb->nh.iph uses, now to go after the rest... Just out of curiosity, here are the idioms found to get the same result: skb->nh.iph->ihl << 2 skb->nh.iph->ihl<<2 skb->nh.iph->ihl * 4 skb->nh.iph->ihl*4 (skb->nh.iph)->ihl * sizeof(u32) 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
0272ffc46f
commit
c9bdd4b525
@@ -1263,7 +1263,7 @@ static inline void write_ip_start_end(struct ehea_swqe *swqe,
|
||||
const struct sk_buff *skb)
|
||||
{
|
||||
swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data));
|
||||
swqe->ip_end = (u8)(swqe->ip_start + skb->nh.iph->ihl * 4 - 1);
|
||||
swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1);
|
||||
}
|
||||
|
||||
static inline void write_tcp_offset_end(struct ehea_swqe *swqe,
|
||||
@@ -1300,7 +1300,7 @@ static void write_swqe2_TSO(struct sk_buff *skb,
|
||||
/* copy only eth/ip/tcp headers to immediate data and
|
||||
* the rest of skb->data to sg1entry
|
||||
*/
|
||||
headersize = ETH_HLEN + (skb->nh.iph->ihl * 4) + (skb->h.th->doff * 4);
|
||||
headersize = ETH_HLEN + ip_hdrlen(skb) + (skb->h.th->doff * 4);
|
||||
|
||||
skb_data_size = skb->len - skb->data_len;
|
||||
|
||||
|
Reference in New Issue
Block a user