diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2010-12-14 10:24:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-16 17:43:15 -0500 |
commit | 0d0b16727f24f8258eeb33818347ca0f4557f982 (patch) | |
tree | e89fec837700b02aff0d08de1c5cbae3ff5060a8 | |
parent | 55508d601dab7df5cbcc7a63f4be8620eface204 (diff) |
net: Fix drivers advertising HW_CSUM feature to use csum_start
Some drivers are using skb_transport_offset(skb) instead of skb->csum_start
for NETIF_F_HW_CSUM offload. This does not matter now, but if someone
implements checksumming of encapsulated packets then this will break silently.
TSO output paths are left as they are, since they are for IP+TCP only
(might be worth converting though).
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/atl1c/atl1c_main.c | 2 | ||||
-rw-r--r-- | drivers/net/atl1e/atl1e_main.c | 2 | ||||
-rw-r--r-- | drivers/net/cassini.c | 2 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 2 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 2 | ||||
-rw-r--r-- | drivers/net/enic/enic_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ll_temac_main.c | 2 | ||||
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 2 | ||||
-rw-r--r-- | drivers/net/niu.c | 2 | ||||
-rw-r--r-- | drivers/net/skge.c | 2 | ||||
-rw-r--r-- | drivers/net/sungem.c | 2 | ||||
-rw-r--r-- | drivers/net/sunhme.c | 2 | ||||
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_drv.c | 4 |
14 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c index 09b099bfab2b..e48ea956c51f 100644 --- a/drivers/net/atl1c/atl1c_main.c +++ b/drivers/net/atl1c/atl1c_main.c | |||
@@ -2078,7 +2078,7 @@ static int atl1c_tso_csum(struct atl1c_adapter *adapter, | |||
2078 | check_sum: | 2078 | check_sum: |
2079 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 2079 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
2080 | u8 css, cso; | 2080 | u8 css, cso; |
2081 | cso = skb_transport_offset(skb); | 2081 | cso = skb_checksum_start_offset(skb); |
2082 | 2082 | ||
2083 | if (unlikely(cso & 0x1)) { | 2083 | if (unlikely(cso & 0x1)) { |
2084 | if (netif_msg_tx_err(adapter)) | 2084 | if (netif_msg_tx_err(adapter)) |
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c index ef6349bf3b33..e28f8baf394e 100644 --- a/drivers/net/atl1e/atl1e_main.c +++ b/drivers/net/atl1e/atl1e_main.c | |||
@@ -1649,7 +1649,7 @@ check_sum: | |||
1649 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 1649 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
1650 | u8 css, cso; | 1650 | u8 css, cso; |
1651 | 1651 | ||
1652 | cso = skb_transport_offset(skb); | 1652 | cso = skb_checksum_start_offset(skb); |
1653 | if (unlikely(cso & 0x1)) { | 1653 | if (unlikely(cso & 0x1)) { |
1654 | netdev_err(adapter->netdev, | 1654 | netdev_err(adapter->netdev, |
1655 | "payload offset should not ant event number\n"); | 1655 | "payload offset should not ant event number\n"); |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index a8a32bc9aae6..73502fef8769 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -2788,7 +2788,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, | |||
2788 | 2788 | ||
2789 | ctrl = 0; | 2789 | ctrl = 0; |
2790 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2790 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2791 | const u64 csum_start_off = skb_transport_offset(skb); | 2791 | const u64 csum_start_off = skb_checksum_start_offset(skb); |
2792 | const u64 csum_stuff_off = csum_start_off + skb->csum_offset; | 2792 | const u64 csum_stuff_off = csum_start_off + skb->csum_offset; |
2793 | 2793 | ||
2794 | ctrl = TX_DESC_CSUM_EN | | 2794 | ctrl = TX_DESC_CSUM_EN | |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 491bf2a1babd..340e12d2e4a9 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2726,7 +2726,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, | |||
2726 | break; | 2726 | break; |
2727 | } | 2727 | } |
2728 | 2728 | ||
2729 | css = skb_transport_offset(skb); | 2729 | css = skb_checksum_start_offset(skb); |
2730 | 2730 | ||
2731 | i = tx_ring->next_to_use; | 2731 | i = tx_ring->next_to_use; |
2732 | buffer_info = &tx_ring->buffer_info[i]; | 2732 | buffer_info = &tx_ring->buffer_info[i]; |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 02d093d1dd5c..a45dafdf343a 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4473,7 +4473,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
4473 | break; | 4473 | break; |
4474 | } | 4474 | } |
4475 | 4475 | ||
4476 | css = skb_transport_offset(skb); | 4476 | css = skb_checksum_start_offset(skb); |
4477 | 4477 | ||
4478 | i = tx_ring->next_to_use; | 4478 | i = tx_ring->next_to_use; |
4479 | buffer_info = &tx_ring->buffer_info[i]; | 4479 | buffer_info = &tx_ring->buffer_info[i]; |
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 77d91381a74d..9710047c12a4 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
@@ -702,7 +702,7 @@ static inline void enic_queue_wq_skb_csum_l4(struct enic *enic, | |||
702 | { | 702 | { |
703 | unsigned int head_len = skb_headlen(skb); | 703 | unsigned int head_len = skb_headlen(skb); |
704 | unsigned int len_left = skb->len - head_len; | 704 | unsigned int len_left = skb->len - head_len; |
705 | unsigned int hdr_len = skb_transport_offset(skb); | 705 | unsigned int hdr_len = skb_checksum_start_offset(skb); |
706 | unsigned int csum_offset = hdr_len + skb->csum_offset; | 706 | unsigned int csum_offset = hdr_len + skb->csum_offset; |
707 | int eop = (len_left == 0); | 707 | int eop = (len_left == 0); |
708 | 708 | ||
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index b021798ef49f..5639cccb4935 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1262,7 +1262,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1262 | 1262 | ||
1263 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 1263 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
1264 | struct ixgb_buffer *buffer_info; | 1264 | struct ixgb_buffer *buffer_info; |
1265 | css = skb_transport_offset(skb); | 1265 | css = skb_checksum_start_offset(skb); |
1266 | cso = css + skb->csum_offset; | 1266 | cso = css + skb->csum_offset; |
1267 | 1267 | ||
1268 | i = adapter->tx_ring.next_to_use; | 1268 | i = adapter->tx_ring.next_to_use; |
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c index 9f8e7027b0b3..e2c2a7202dba 100644 --- a/drivers/net/ll_temac_main.c +++ b/drivers/net/ll_temac_main.c | |||
@@ -692,7 +692,7 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
692 | 692 | ||
693 | cur_p->app0 = 0; | 693 | cur_p->app0 = 0; |
694 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 694 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
695 | unsigned int csum_start_off = skb_transport_offset(skb); | 695 | unsigned int csum_start_off = skb_checksum_start_offset(skb); |
696 | unsigned int csum_index_off = csum_start_off + skb->csum_offset; | 696 | unsigned int csum_index_off = csum_start_off + skb->csum_offset; |
697 | 697 | ||
698 | cur_p->app0 |= 1; /* TX Checksum Enabled */ | 698 | cur_p->app0 |= 1; /* TX Checksum Enabled */ |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 1ce0207e62a9..a37fcf11ab36 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -2736,7 +2736,7 @@ again: | |||
2736 | odd_flag = 0; | 2736 | odd_flag = 0; |
2737 | flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST); | 2737 | flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST); |
2738 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 2738 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
2739 | cksum_offset = skb_transport_offset(skb); | 2739 | cksum_offset = skb_checksum_start_offset(skb); |
2740 | pseudo_hdr_offset = cksum_offset + skb->csum_offset; | 2740 | pseudo_hdr_offset = cksum_offset + skb->csum_offset; |
2741 | /* If the headers are excessively large, then we must | 2741 | /* If the headers are excessively large, then we must |
2742 | * fall back to a software checksum */ | 2742 | * fall back to a software checksum */ |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index f64c42414bd7..2541321bad82 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -6589,7 +6589,7 @@ static u64 niu_compute_tx_flags(struct sk_buff *skb, struct ethhdr *ehdr, | |||
6589 | (ip_proto == IPPROTO_UDP ? | 6589 | (ip_proto == IPPROTO_UDP ? |
6590 | TXHDR_CSUM_UDP : TXHDR_CSUM_SCTP)); | 6590 | TXHDR_CSUM_UDP : TXHDR_CSUM_SCTP)); |
6591 | 6591 | ||
6592 | start = skb_transport_offset(skb) - | 6592 | start = skb_checksum_start_offset(skb) - |
6593 | (pad_bytes + sizeof(struct tx_pkt_hdr)); | 6593 | (pad_bytes + sizeof(struct tx_pkt_hdr)); |
6594 | stuff = start + skb->csum_offset; | 6594 | stuff = start + skb->csum_offset; |
6595 | 6595 | ||
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 8c1404b58382..50815fb963fe 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -2764,7 +2764,7 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
2764 | td->dma_hi = map >> 32; | 2764 | td->dma_hi = map >> 32; |
2765 | 2765 | ||
2766 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2766 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2767 | const int offset = skb_transport_offset(skb); | 2767 | const int offset = skb_checksum_start_offset(skb); |
2768 | 2768 | ||
2769 | /* This seems backwards, but it is what the sk98lin | 2769 | /* This seems backwards, but it is what the sk98lin |
2770 | * does. Looks like hardware is wrong? | 2770 | * does. Looks like hardware is wrong? |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 9e992ca4f543..1c5408f83937 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -1004,7 +1004,7 @@ static netdev_tx_t gem_start_xmit(struct sk_buff *skb, | |||
1004 | 1004 | ||
1005 | ctrl = 0; | 1005 | ctrl = 0; |
1006 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1006 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1007 | const u64 csum_start_off = skb_transport_offset(skb); | 1007 | const u64 csum_start_off = skb_checksum_start_offset(skb); |
1008 | const u64 csum_stuff_off = csum_start_off + skb->csum_offset; | 1008 | const u64 csum_stuff_off = csum_start_off + skb->csum_offset; |
1009 | 1009 | ||
1010 | ctrl = (TXDCTRL_CENAB | | 1010 | ctrl = (TXDCTRL_CENAB | |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index 5e28c414421a..55bbb9c15d96 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -2266,7 +2266,7 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2266 | 2266 | ||
2267 | tx_flags = TXFLAG_OWN; | 2267 | tx_flags = TXFLAG_OWN; |
2268 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2268 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2269 | const u32 csum_start_off = skb_transport_offset(skb); | 2269 | const u32 csum_start_off = skb_checksum_start_offset(skb); |
2270 | const u32 csum_stuff_off = csum_start_off + skb->csum_offset; | 2270 | const u32 csum_stuff_off = csum_start_off + skb->csum_offset; |
2271 | 2271 | ||
2272 | tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE | | 2272 | tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE | |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 0169be7694a9..23154cf601e9 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -798,7 +798,7 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | |||
798 | { | 798 | { |
799 | struct Vmxnet3_TxDataDesc *tdd; | 799 | struct Vmxnet3_TxDataDesc *tdd; |
800 | 800 | ||
801 | if (ctx->mss) { | 801 | if (ctx->mss) { /* TSO */ |
802 | ctx->eth_ip_hdr_size = skb_transport_offset(skb); | 802 | ctx->eth_ip_hdr_size = skb_transport_offset(skb); |
803 | ctx->l4_hdr_size = ((struct tcphdr *) | 803 | ctx->l4_hdr_size = ((struct tcphdr *) |
804 | skb_transport_header(skb))->doff * 4; | 804 | skb_transport_header(skb))->doff * 4; |
@@ -807,7 +807,7 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | |||
807 | unsigned int pull_size; | 807 | unsigned int pull_size; |
808 | 808 | ||
809 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 809 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
810 | ctx->eth_ip_hdr_size = skb_transport_offset(skb); | 810 | ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb); |
811 | 811 | ||
812 | if (ctx->ipv4) { | 812 | if (ctx->ipv4) { |
813 | struct iphdr *iph = (struct iphdr *) | 813 | struct iphdr *iph = (struct iphdr *) |