net: Fix drivers advertising HW_CSUM feature to use csum_start
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Tue, 14 Dec 2010 15:24:08 +0000 (15:24 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Dec 2010 22:43:15 +0000 (14:43 -0800)
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>
14 files changed:
drivers/net/atl1c/atl1c_main.c
drivers/net/atl1e/atl1e_main.c
drivers/net/cassini.c
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/netdev.c
drivers/net/enic/enic_main.c
drivers/net/ixgb/ixgb_main.c
drivers/net/ll_temac_main.c
drivers/net/myri10ge/myri10ge.c
drivers/net/niu.c
drivers/net/skge.c
drivers/net/sungem.c
drivers/net/sunhme.c
drivers/net/vmxnet3/vmxnet3_drv.c

index 09b099bfab2b1b75c5dc7e3f0b323393e0124f8a..e48ea956c51f269dc2aaad5bf0e6ac12bab748d4 100644 (file)
@@ -2078,7 +2078,7 @@ static int atl1c_tso_csum(struct atl1c_adapter *adapter,
 check_sum:
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                u8 css, cso;
-               cso = skb_transport_offset(skb);
+               cso = skb_checksum_start_offset(skb);
 
                if (unlikely(cso & 0x1)) {
                        if (netif_msg_tx_err(adapter))
index ef6349bf3b33e8f8ce328147826f8e890a16abf0..e28f8baf394ec6b55049b934156a4aab6e84996c 100644 (file)
@@ -1649,7 +1649,7 @@ check_sum:
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                u8 css, cso;
 
-               cso = skb_transport_offset(skb);
+               cso = skb_checksum_start_offset(skb);
                if (unlikely(cso & 0x1)) {
                        netdev_err(adapter->netdev,
                                   "payload offset should not ant event number\n");
index a8a32bc9aae6cf88e99106c86b523b23942828ac..73502fef876928dc147a95b9655c8ae4d0dc4099 100644 (file)
@@ -2788,7 +2788,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
 
        ctrl = 0;
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               const u64 csum_start_off = skb_transport_offset(skb);
+               const u64 csum_start_off = skb_checksum_start_offset(skb);
                const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
 
                ctrl =  TX_DESC_CSUM_EN |
index 491bf2a1babdee1081fe28fd20e2fc2ab595a4f4..340e12d2e4a91eeea196c0b4edae97b530ed1f4d 100644 (file)
@@ -2726,7 +2726,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter,
                break;
        }
 
-       css = skb_transport_offset(skb);
+       css = skb_checksum_start_offset(skb);
 
        i = tx_ring->next_to_use;
        buffer_info = &tx_ring->buffer_info[i];
index 02d093d1dd5c48ca273bbb73c00cd1bdbed894af..a45dafdf343a200d74ff1f351896b0e3f7e30f46 100644 (file)
@@ -4473,7 +4473,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb)
                break;
        }
 
-       css = skb_transport_offset(skb);
+       css = skb_checksum_start_offset(skb);
 
        i = tx_ring->next_to_use;
        buffer_info = &tx_ring->buffer_info[i];
index 77d91381a74d2bb33cd6420c27f33a9b7ed145a5..9710047c12a4f84d47c58e3cd519ac8673f9c81f 100644 (file)
@@ -702,7 +702,7 @@ static inline void enic_queue_wq_skb_csum_l4(struct enic *enic,
 {
        unsigned int head_len = skb_headlen(skb);
        unsigned int len_left = skb->len - head_len;
-       unsigned int hdr_len = skb_transport_offset(skb);
+       unsigned int hdr_len = skb_checksum_start_offset(skb);
        unsigned int csum_offset = hdr_len + skb->csum_offset;
        int eop = (len_left == 0);
 
index b021798ef49f847c9234186b7cb7639c82916a80..5639cccb49351a4e6466fc8d692eb86c81fcc386 100644 (file)
@@ -1262,7 +1262,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
 
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                struct ixgb_buffer *buffer_info;
-               css = skb_transport_offset(skb);
+               css = skb_checksum_start_offset(skb);
                cso = css + skb->csum_offset;
 
                i = adapter->tx_ring.next_to_use;
index 9f8e7027b0b32de8030d6e100a8b0e9467e35685..e2c2a7202dba9a2a6fa34a1c81cffa6d94553b42 100644 (file)
@@ -692,7 +692,7 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
        cur_p->app0 = 0;
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               unsigned int csum_start_off = skb_transport_offset(skb);
+               unsigned int csum_start_off = skb_checksum_start_offset(skb);
                unsigned int csum_index_off = csum_start_off + skb->csum_offset;
 
                cur_p->app0 |= 1; /* TX Checksum Enabled */
index 1ce0207e62a945f085a6e2153c1b1c1735afdfd3..a37fcf11ab3622febf86e65499ff21fe9ba76b13 100644 (file)
@@ -2736,7 +2736,7 @@ again:
        odd_flag = 0;
        flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST);
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
-               cksum_offset = skb_transport_offset(skb);
+               cksum_offset = skb_checksum_start_offset(skb);
                pseudo_hdr_offset = cksum_offset + skb->csum_offset;
                /* If the headers are excessively large, then we must
                 * fall back to a software checksum */
index f64c42414bd752b713df5a0534d29437f5d55d97..2541321bad82f11119db23c4ac7d3a3bed5208f2 100644 (file)
@@ -6589,7 +6589,7 @@ static u64 niu_compute_tx_flags(struct sk_buff *skb, struct ethhdr *ehdr,
                             (ip_proto == IPPROTO_UDP ?
                              TXHDR_CSUM_UDP : TXHDR_CSUM_SCTP));
 
-               start = skb_transport_offset(skb) -
+               start = skb_checksum_start_offset(skb) -
                        (pad_bytes + sizeof(struct tx_pkt_hdr));
                stuff = start + skb->csum_offset;
 
index 8c1404b58382b2fc644c32c095d7e62b21871bec..50815fb963fe323186e53a70340abe267b15f98f 100644 (file)
@@ -2764,7 +2764,7 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,
        td->dma_hi = map >> 32;
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               const int offset = skb_transport_offset(skb);
+               const int offset = skb_checksum_start_offset(skb);
 
                /* This seems backwards, but it is what the sk98lin
                 * does.  Looks like hardware is wrong?
index 9e992ca4f54389de849fcc052a4f0019e4e2b5b1..1c5408f83937a47716ed561181e262b0009c95b7 100644 (file)
@@ -1004,7 +1004,7 @@ static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
 
        ctrl = 0;
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               const u64 csum_start_off = skb_transport_offset(skb);
+               const u64 csum_start_off = skb_checksum_start_offset(skb);
                const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
 
                ctrl = (TXDCTRL_CENAB |
index 5e28c414421ad0768e8a8e4082b188bf371536e9..55bbb9c15d96e2501039d34093f951ebad0f1294 100644 (file)
@@ -2266,7 +2266,7 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb,
 
        tx_flags = TXFLAG_OWN;
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               const u32 csum_start_off = skb_transport_offset(skb);
+               const u32 csum_start_off = skb_checksum_start_offset(skb);
                const u32 csum_stuff_off = csum_start_off + skb->csum_offset;
 
                tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE |
index 0169be7694a94a6cbfb0f8870536e374dd8034e3..23154cf601e9e2e36ddd8fe60ca2fcfcf709cf84 100644 (file)
@@ -798,7 +798,7 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
 {
        struct Vmxnet3_TxDataDesc *tdd;
 
-       if (ctx->mss) {
+       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;
@@ -807,7 +807,7 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
                unsigned int pull_size;
 
                if (skb->ip_summed == CHECKSUM_PARTIAL) {
-                       ctx->eth_ip_hdr_size = skb_transport_offset(skb);
+                       ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb);
 
                        if (ctx->ipv4) {
                                struct iphdr *iph = (struct iphdr *)