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/s390 | |
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/s390')
-rw-r--r-- | drivers/s390/net/qeth_eddp.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 893125403c68..1574247abaa1 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -473,9 +473,11 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | |||
473 | QETH_DBF_TEXT(trace, 5, "eddpficx"); | 473 | QETH_DBF_TEXT(trace, 5, "eddpficx"); |
474 | /* create our segmentation headers and copy original headers */ | 474 | /* create our segmentation headers and copy original headers */ |
475 | if (skb->protocol == htons(ETH_P_IP)) | 475 | if (skb->protocol == htons(ETH_P_IP)) |
476 | eddp = qeth_eddp_create_eddp_data(qhdr, (u8 *)skb->nh.iph, | 476 | eddp = qeth_eddp_create_eddp_data(qhdr, |
477 | skb->nh.iph->ihl*4, | 477 | skb_network_header(skb), |
478 | (u8 *)skb->h.th, skb->h.th->doff*4); | 478 | ip_hdrlen(skb), |
479 | skb->h.raw, | ||
480 | skb->h.th->doff * 4); | ||
479 | else | 481 | else |
480 | eddp = qeth_eddp_create_eddp_data(qhdr, (u8 *)skb->nh.ipv6h, | 482 | eddp = qeth_eddp_create_eddp_data(qhdr, (u8 *)skb->nh.ipv6h, |
481 | sizeof(struct ipv6hdr), | 483 | sizeof(struct ipv6hdr), |
@@ -590,8 +592,9 @@ qeth_eddp_create_context_tcp(struct qeth_card *card, struct sk_buff *skb, | |||
590 | QETH_DBF_TEXT(trace, 5, "creddpct"); | 592 | QETH_DBF_TEXT(trace, 5, "creddpct"); |
591 | if (skb->protocol == htons(ETH_P_IP)) | 593 | if (skb->protocol == htons(ETH_P_IP)) |
592 | ctx = qeth_eddp_create_context_generic(card, skb, | 594 | ctx = qeth_eddp_create_context_generic(card, skb, |
593 | sizeof(struct qeth_hdr) + skb->nh.iph->ihl*4 + | 595 | (sizeof(struct qeth_hdr) + |
594 | skb->h.th->doff*4); | 596 | ip_hdrlen(skb) + |
597 | skb->h.th->doff * 4)); | ||
595 | else if (skb->protocol == htons(ETH_P_IPV6)) | 598 | else if (skb->protocol == htons(ETH_P_IPV6)) |
596 | ctx = qeth_eddp_create_context_generic(card, skb, | 599 | ctx = qeth_eddp_create_context_generic(card, skb, |
597 | sizeof(struct qeth_hdr) + sizeof(struct ipv6hdr) + | 600 | sizeof(struct qeth_hdr) + sizeof(struct ipv6hdr) + |