[NET]: Split skb->csum
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Nov 2006 02:07:29 +0000 (18:07 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:27:18 +0000 (21:27 -0800)
... into anonymous union of __wsum and __u32 (csum and csum_offset resp.)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 files changed:
drivers/net/cassini.c
drivers/net/e1000/e1000_main.c
drivers/net/ixgb/ixgb_main.c
drivers/net/myri10ge/myri10ge.c
drivers/net/sk98lin/skge.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/sungem.c
drivers/net/sunhme.c
include/linux/skbuff.h
net/core/dev.c
net/core/skbuff.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c
net/ipv6/tcp_ipv6.c

index 521c5b71023c60c5ba1199268d1d441bfac03ce1..fd2cc13f7d97b90d200d741207c0f87a61413159 100644 (file)
@@ -2825,7 +2825,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
                u64 csum_start_off, csum_stuff_off;
 
                csum_start_off = (u64) (skb->h.raw - skb->data);
-               csum_stuff_off = (u64) ((skb->h.raw + skb->csum) - skb->data);
+               csum_stuff_off = csum_start_off + skb->csum_offset;
 
                ctrl =  TX_DESC_CSUM_EN |
                        CAS_BASE(TX_DESC_CSUM_START, csum_start_off) |
index 7a0828869ecf5affb46a81c55c29cc07e1762210..32dde0adb6839c107fad7ce9cbd32ec7686674e1 100644 (file)
@@ -2826,7 +2826,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
 
                context_desc->upper_setup.tcp_fields.tucss = css;
-               context_desc->upper_setup.tcp_fields.tucso = css + skb->csum;
+               context_desc->upper_setup.tcp_fields.tucso = css + skb->csum_offset;
                context_desc->upper_setup.tcp_fields.tucse = 0;
                context_desc->tcp_seg_setup.data = 0;
                context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT);
index e09f575a3a38bbfdfe1676286a7eaed8d373a4b2..7b127212e62b579107881901e5d4e00e07d13464 100644 (file)
@@ -1249,7 +1249,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->h.raw - skb->data;
-               cso = (skb->h.raw + skb->csum) - skb->data;
+               cso = css + skb->csum_offset;
 
                i = adapter->tx_ring.next_to_use;
                context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i);
index 806081b5973392cad24f7ac15a007e2f317f1438..36350e6db1c1bec6a6aac55eb3c578a1846b659e 100644 (file)
@@ -1955,7 +1955,7 @@ again:
        flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST);
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                cksum_offset = (skb->h.raw - skb->data);
-               pseudo_hdr_offset = (skb->h.raw + skb->csum) - skb->data;
+               pseudo_hdr_offset = cksum_offset + skb->csum_offset;
                /* If the headers are excessively large, then we must
                 * fall back to a software checksum */
                if (unlikely(cksum_offset > 255 || pseudo_hdr_offset > 127)) {
index a5d41ebc9fb4b4b1d5398a9d8a8773eb39e212df..12cbfd190dd7893c1ade0a4b9feadd9a6bf76414 100644 (file)
@@ -1562,7 +1562,7 @@ struct sk_buff    *pMessage)      /* pointer to send-message              */
 
        if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
                u16 hdrlen = pMessage->h.raw - pMessage->data;
-               u16 offset = hdrlen + pMessage->csum;
+               u16 offset = hdrlen + pMessage->csum_offset;
 
                if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) &&
                        (pAC->GIni.GIChipRev == 0) &&
@@ -1681,7 +1681,7 @@ struct sk_buff    *pMessage)      /* pointer to send-message              */
        */
        if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
                u16 hdrlen = pMessage->h.raw - pMessage->data;
-               u16 offset = hdrlen + pMessage->csum;
+               u16 offset = hdrlen + pMessage->csum_offset;
 
                Control = BMU_STFWD;
 
index 27b537c8d5e32dde27a326ab7b02d88e4a9e1620..5513907e8393d4188dd727aeea1f484d7598bd92 100644 (file)
@@ -2565,7 +2565,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 
                td->csum_offs = 0;
                td->csum_start = offset;
-               td->csum_write = offset + skb->csum;
+               td->csum_write = offset + skb->csum_offset;
        } else
                control = BMU_CHECK;
 
index 0ef1848b97617030d74321f283e6869b48466937..842abd9396c64ca7aecee1de7be90e06a141d0f1 100644 (file)
@@ -1350,7 +1350,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
                u32 tcpsum;
 
                tcpsum = offset << 16;          /* sum start */
-               tcpsum |= offset + skb->csum;   /* sum write */
+               tcpsum |= offset + skb->csum_offset;    /* sum write */
 
                ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
                if (skb->nh.iph->protocol == IPPROTO_UDP)
index 253e96e7ad20ae0ff860dae8f7ceb6d55cf4d888..334c6cfd659573b627ac25e875cc5c12ed0d5538 100644 (file)
@@ -1030,7 +1030,7 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
                u64 csum_start_off, csum_stuff_off;
 
                csum_start_off = (u64) (skb->h.raw - skb->data);
-               csum_stuff_off = (u64) ((skb->h.raw + skb->csum) - skb->data);
+               csum_stuff_off = csum_start_off + skb->csum_offset;
 
                ctrl = (TXDCTRL_CENAB |
                        (csum_start_off << 15) |
index 9d7cd130c19db7b9946535e856bd6fb6d5773756..ec432ea879fbaa8d178a5a0e7253309264e3b1ec 100644 (file)
@@ -2272,7 +2272,7 @@ static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev)
                u32 csum_start_off, csum_stuff_off;
 
                csum_start_off = (u32) (skb->h.raw - skb->data);
-               csum_stuff_off = (u32) ((skb->h.raw + skb->csum) - skb->data);
+               csum_stuff_off = csum_start_off + skb->csum_offset;
 
                tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE |
                            ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) |
index fcab543d79acee998970d35b49ca6023260483fc..14ec16d2d9ba7bd6254093df7db05a242bb4f7a0 100644 (file)
@@ -274,7 +274,10 @@ struct sk_buff {
        unsigned int            len,
                                data_len,
                                mac_len;
-       __wsum                  csum;
+       union {
+               __wsum          csum;
+               __u32           csum_offset;
+       };
        __u32                   priority;
        __u8                    local_df:1,
                                cloned:1,
index 1a36b17f4b51935058ef4044ac62df939e3c36e0..59d058a3b50487ea6c7c9dfcec8b541422ae3c45 100644 (file)
@@ -1191,9 +1191,9 @@ int skb_checksum_help(struct sk_buff *skb)
 
        offset = skb->tail - skb->h.raw;
        BUG_ON(offset <= 0);
-       BUG_ON(skb->csum + 2 > offset);
+       BUG_ON(skb->csum_offset + 2 > offset);
 
-       *(__sum16*)(skb->h.raw + skb->csum) = csum_fold(csum);
+       *(__sum16*)(skb->h.raw + skb->csum_offset) = csum_fold(csum);
 
 out_set_summed:
        skb->ip_summed = CHECKSUM_NONE;
index 07c25d601922aa0a885985d478650d5802706416..a90bc439488e1f0ec07e81d4953f409a9a09d064 100644 (file)
@@ -1414,7 +1414,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
                                              skb->len - csstart, 0);
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               long csstuff = csstart + skb->csum;
+               long csstuff = csstart + skb->csum_offset;
 
                *((__sum16 *)(to + csstuff)) = csum_fold(csum);
        }
index e9d467124c4d138ea1861a086bb73728a6989a8e..4913f25e5ad503e9bf50e8dd62c330603ed65fb7 100644 (file)
@@ -504,7 +504,7 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
                th->check = ~tcp_v4_check(th, len,
                                          inet->saddr, inet->daddr, 0);
-               skb->csum = offsetof(struct tcphdr, check);
+               skb->csum_offset = offsetof(struct tcphdr, check);
        } else {
                th->check = tcp_v4_check(th, len, inet->saddr, inet->daddr,
                                         csum_partial((char *)th,
@@ -526,7 +526,7 @@ int tcp_v4_gso_send_check(struct sk_buff *skb)
 
        th->check = 0;
        th->check = ~tcp_v4_check(th, skb->len, iph->saddr, iph->daddr, 0);
-       skb->csum = offsetof(struct tcphdr, check);
+       skb->csum_offset = offsetof(struct tcphdr, check);
        skb->ip_summed = CHECKSUM_PARTIAL;
        return 0;
 }
index 28e4cf662ce050896f4e5528216412eb98a8b6c0..1807a30694d98f2d8e080580717fc73fdf794a7a 100644 (file)
@@ -422,7 +422,7 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
                /*
                 * Only one fragment on the socket.
                 */
-               skb->csum = offsetof(struct udphdr, check);
+               skb->csum_offset = offsetof(struct udphdr, check);
                uh->check = ~csum_tcpudp_magic(src, dst, len, IPPROTO_UDP, 0);
        } else {
                /*
index 0adb337c4b7e4ca196d749790126f828d1a9663c..517c50024bfcc1060780c41d8d3d7079c56ddf0e 100644 (file)
@@ -948,7 +948,7 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
                th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP,  0);
-               skb->csum = offsetof(struct tcphdr, check);
+               skb->csum_offset = offsetof(struct tcphdr, check);
        } else {
                th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 
                                            csum_partial((char *)th, th->doff<<2, 
@@ -970,7 +970,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
        th->check = 0;
        th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len,
                                     IPPROTO_TCP, 0);
-       skb->csum = offsetof(struct tcphdr, check);
+       skb->csum_offset = offsetof(struct tcphdr, check);
        skb->ip_summed = CHECKSUM_PARTIAL;
        return 0;
 }