* [PATCH net-next] vmxnet3: cleanup tso headers manipulation
@ 2012-01-25 5:47 Eric Dumazet
2012-01-25 21:53 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2012-01-25 5:47 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Shreyas Bhatewara
Use existing helpers to clarify skb headers manipulation.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Shreyas Bhatewara <sbhatewara@vmware.com>
---
drivers/net/vmxnet3/vmxnet3_drv.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index de7fc34..be6aa35 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -816,27 +816,24 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
if (ctx->mss) { /* TSO */
ctx->eth_ip_hdr_size = skb_transport_offset(skb);
- ctx->l4_hdr_size = ((struct tcphdr *)
- skb_transport_header(skb))->doff * 4;
+ ctx->l4_hdr_size = tcp_hdrlen(skb);
ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size;
} else {
if (skb->ip_summed == CHECKSUM_PARTIAL) {
ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb);
if (ctx->ipv4) {
- struct iphdr *iph = (struct iphdr *)
- skb_network_header(skb);
+ const struct iphdr *iph = ip_hdr(skb);
+
if (iph->protocol == IPPROTO_TCP)
- ctx->l4_hdr_size = ((struct tcphdr *)
- skb_transport_header(skb))->doff * 4;
+ ctx->l4_hdr_size = tcp_hdrlen(skb);
else if (iph->protocol == IPPROTO_UDP)
/*
* Use tcp header size so that bytes to
* be copied are more than required by
* the device.
*/
- ctx->l4_hdr_size =
- sizeof(struct tcphdr);
+ ctx->l4_hdr_size = sizeof(struct tcphdr);
else
ctx->l4_hdr_size = 0;
} else {
@@ -881,14 +878,17 @@ static void
vmxnet3_prepare_tso(struct sk_buff *skb,
struct vmxnet3_tx_ctx *ctx)
{
- struct tcphdr *tcph = (struct tcphdr *)skb_transport_header(skb);
+ struct tcphdr *tcph = tcp_hdr(skb);
+
if (ctx->ipv4) {
- struct iphdr *iph = (struct iphdr *)skb_network_header(skb);
+ struct iphdr *iph = ip_hdr(skb);
+
iph->check = 0;
tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 0,
IPPROTO_TCP, 0);
} else {
- struct ipv6hdr *iph = (struct ipv6hdr *)skb_network_header(skb);
+ struct ipv6hdr *iph = ipv6_hdr(skb);
+
tcph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, 0,
IPPROTO_TCP, 0);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] vmxnet3: cleanup tso headers manipulation
2012-01-25 5:47 [PATCH net-next] vmxnet3: cleanup tso headers manipulation Eric Dumazet
@ 2012-01-25 21:53 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-01-25 21:53 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, sbhatewara
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 25 Jan 2012 06:47:21 +0100
> Use existing helpers to clarify skb headers manipulation.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Shreyas Bhatewara <sbhatewara@vmware.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-25 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-25 5:47 [PATCH net-next] vmxnet3: cleanup tso headers manipulation Eric Dumazet
2012-01-25 21:53 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).