diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-12 19:09:15 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:07 -0400 |
commit | c9bdd4b5257406b0608385d19c40b5511decf4f6 (patch) | |
tree | fe5319c322a11c0b00e7ef0473762a8d1961da83 /drivers/net/ehea/ehea_main.c | |
parent | 0272ffc46f81a4bbbf302ba093c737e969c5bb55 (diff) |
[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>
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 0e4042bc0a48..b1c90a4fe31e 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -1263,7 +1263,7 @@ static inline void write_ip_start_end(struct ehea_swqe *swqe, | |||
1263 | const struct sk_buff *skb) | 1263 | const struct sk_buff *skb) |
1264 | { | 1264 | { |
1265 | swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data)); | 1265 | swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data)); |
1266 | swqe->ip_end = (u8)(swqe->ip_start + skb->nh.iph->ihl * 4 - 1); | 1266 | swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1); |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | static inline void write_tcp_offset_end(struct ehea_swqe *swqe, | 1269 | static inline void write_tcp_offset_end(struct ehea_swqe *swqe, |
@@ -1300,7 +1300,7 @@ static void write_swqe2_TSO(struct sk_buff *skb, | |||
1300 | /* copy only eth/ip/tcp headers to immediate data and | 1300 | /* copy only eth/ip/tcp headers to immediate data and |
1301 | * the rest of skb->data to sg1entry | 1301 | * the rest of skb->data to sg1entry |
1302 | */ | 1302 | */ |
1303 | headersize = ETH_HLEN + (skb->nh.iph->ihl * 4) + (skb->h.th->doff * 4); | 1303 | headersize = ETH_HLEN + ip_hdrlen(skb) + (skb->h.th->doff * 4); |
1304 | 1304 | ||
1305 | skb_data_size = skb->len - skb->data_len; | 1305 | skb_data_size = skb->len - skb->data_len; |
1306 | 1306 | ||