aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 21:07:29 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:27:18 -0500
commitff1dcadb1b55dbf471c5ed109dbbdf06bd19ef3b (patch)
treecbcd17d33ecc52c90d218b43c5aec430be448058
parent5b14027bf2132c0631ea9f3be11ced89a5057220 (diff)
[NET]: Split skb->csum
... 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>
-rw-r--r--drivers/net/cassini.c2
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/ixgb/ixgb_main.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c2
-rw-r--r--drivers/net/sk98lin/skge.c4
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/sky2.c2
-rw-r--r--drivers/net/sungem.c2
-rw-r--r--drivers/net/sunhme.c2
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/ipv4/tcp_ipv4.c4
-rw-r--r--net/ipv4/udp.c2
-rw-r--r--net/ipv6/tcp_ipv6.c4
15 files changed, 22 insertions, 19 deletions
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 521c5b71023c..fd2cc13f7d97 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -2825,7 +2825,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
2825 u64 csum_start_off, csum_stuff_off; 2825 u64 csum_start_off, csum_stuff_off;
2826 2826
2827 csum_start_off = (u64) (skb->h.raw - skb->data); 2827 csum_start_off = (u64) (skb->h.raw - skb->data);
2828 csum_stuff_off = (u64) ((skb->h.raw + skb->csum) - skb->data); 2828 csum_stuff_off = csum_start_off + skb->csum_offset;
2829 2829
2830 ctrl = TX_DESC_CSUM_EN | 2830 ctrl = TX_DESC_CSUM_EN |
2831 CAS_BASE(TX_DESC_CSUM_START, csum_start_off) | 2831 CAS_BASE(TX_DESC_CSUM_START, csum_start_off) |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 7a0828869ecf..32dde0adb683 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2826,7 +2826,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2826 context_desc = E1000_CONTEXT_DESC(*tx_ring, i); 2826 context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
2827 2827
2828 context_desc->upper_setup.tcp_fields.tucss = css; 2828 context_desc->upper_setup.tcp_fields.tucss = css;
2829 context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; 2829 context_desc->upper_setup.tcp_fields.tucso = css + skb->csum_offset;
2830 context_desc->upper_setup.tcp_fields.tucse = 0; 2830 context_desc->upper_setup.tcp_fields.tucse = 0;
2831 context_desc->tcp_seg_setup.data = 0; 2831 context_desc->tcp_seg_setup.data = 0;
2832 context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); 2832 context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT);
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index e09f575a3a38..7b127212e62b 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1249,7 +1249,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
1249 if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 1249 if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
1250 struct ixgb_buffer *buffer_info; 1250 struct ixgb_buffer *buffer_info;
1251 css = skb->h.raw - skb->data; 1251 css = skb->h.raw - skb->data;
1252 cso = (skb->h.raw + skb->csum) - skb->data; 1252 cso = css + skb->csum_offset;
1253 1253
1254 i = adapter->tx_ring.next_to_use; 1254 i = adapter->tx_ring.next_to_use;
1255 context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i); 1255 context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i);
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 806081b59733..36350e6db1c1 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1955,7 +1955,7 @@ again:
1955 flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST); 1955 flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST);
1956 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 1956 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
1957 cksum_offset = (skb->h.raw - skb->data); 1957 cksum_offset = (skb->h.raw - skb->data);
1958 pseudo_hdr_offset = (skb->h.raw + skb->csum) - skb->data; 1958 pseudo_hdr_offset = cksum_offset + skb->csum_offset;
1959 /* If the headers are excessively large, then we must 1959 /* If the headers are excessively large, then we must
1960 * fall back to a software checksum */ 1960 * fall back to a software checksum */
1961 if (unlikely(cksum_offset > 255 || pseudo_hdr_offset > 127)) { 1961 if (unlikely(cksum_offset > 255 || pseudo_hdr_offset > 127)) {
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index a5d41ebc9fb4..12cbfd190dd7 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -1562,7 +1562,7 @@ struct sk_buff *pMessage) /* pointer to send-message */
1562 1562
1563 if (pMessage->ip_summed == CHECKSUM_PARTIAL) { 1563 if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
1564 u16 hdrlen = pMessage->h.raw - pMessage->data; 1564 u16 hdrlen = pMessage->h.raw - pMessage->data;
1565 u16 offset = hdrlen + pMessage->csum; 1565 u16 offset = hdrlen + pMessage->csum_offset;
1566 1566
1567 if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && 1567 if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) &&
1568 (pAC->GIni.GIChipRev == 0) && 1568 (pAC->GIni.GIChipRev == 0) &&
@@ -1681,7 +1681,7 @@ struct sk_buff *pMessage) /* pointer to send-message */
1681 */ 1681 */
1682 if (pMessage->ip_summed == CHECKSUM_PARTIAL) { 1682 if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
1683 u16 hdrlen = pMessage->h.raw - pMessage->data; 1683 u16 hdrlen = pMessage->h.raw - pMessage->data;
1684 u16 offset = hdrlen + pMessage->csum; 1684 u16 offset = hdrlen + pMessage->csum_offset;
1685 1685
1686 Control = BMU_STFWD; 1686 Control = BMU_STFWD;
1687 1687
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 27b537c8d5e3..5513907e8393 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2565,7 +2565,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
2565 2565
2566 td->csum_offs = 0; 2566 td->csum_offs = 0;
2567 td->csum_start = offset; 2567 td->csum_start = offset;
2568 td->csum_write = offset + skb->csum; 2568 td->csum_write = offset + skb->csum_offset;
2569 } else 2569 } else
2570 control = BMU_CHECK; 2570 control = BMU_CHECK;
2571 2571
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 0ef1848b9761..842abd9396c6 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1350,7 +1350,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1350 u32 tcpsum; 1350 u32 tcpsum;
1351 1351
1352 tcpsum = offset << 16; /* sum start */ 1352 tcpsum = offset << 16; /* sum start */
1353 tcpsum |= offset + skb->csum; /* sum write */ 1353 tcpsum |= offset + skb->csum_offset; /* sum write */
1354 1354
1355 ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; 1355 ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
1356 if (skb->nh.iph->protocol == IPPROTO_UDP) 1356 if (skb->nh.iph->protocol == IPPROTO_UDP)
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 253e96e7ad20..334c6cfd6595 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1030,7 +1030,7 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
1030 u64 csum_start_off, csum_stuff_off; 1030 u64 csum_start_off, csum_stuff_off;
1031 1031
1032 csum_start_off = (u64) (skb->h.raw - skb->data); 1032 csum_start_off = (u64) (skb->h.raw - skb->data);
1033 csum_stuff_off = (u64) ((skb->h.raw + skb->csum) - skb->data); 1033 csum_stuff_off = csum_start_off + skb->csum_offset;
1034 1034
1035 ctrl = (TXDCTRL_CENAB | 1035 ctrl = (TXDCTRL_CENAB |
1036 (csum_start_off << 15) | 1036 (csum_start_off << 15) |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 9d7cd130c19d..ec432ea879fb 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2272,7 +2272,7 @@ static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev)
2272 u32 csum_start_off, csum_stuff_off; 2272 u32 csum_start_off, csum_stuff_off;
2273 2273
2274 csum_start_off = (u32) (skb->h.raw - skb->data); 2274 csum_start_off = (u32) (skb->h.raw - skb->data);
2275 csum_stuff_off = (u32) ((skb->h.raw + skb->csum) - skb->data); 2275 csum_stuff_off = csum_start_off + skb->csum_offset;
2276 2276
2277 tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE | 2277 tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE |
2278 ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) | 2278 ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fcab543d79ac..14ec16d2d9ba 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -274,7 +274,10 @@ struct sk_buff {
274 unsigned int len, 274 unsigned int len,
275 data_len, 275 data_len,
276 mac_len; 276 mac_len;
277 __wsum csum; 277 union {
278 __wsum csum;
279 __u32 csum_offset;
280 };
278 __u32 priority; 281 __u32 priority;
279 __u8 local_df:1, 282 __u8 local_df:1,
280 cloned:1, 283 cloned:1,
diff --git a/net/core/dev.c b/net/core/dev.c
index 1a36b17f4b51..59d058a3b504 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1191,9 +1191,9 @@ int skb_checksum_help(struct sk_buff *skb)
1191 1191
1192 offset = skb->tail - skb->h.raw; 1192 offset = skb->tail - skb->h.raw;
1193 BUG_ON(offset <= 0); 1193 BUG_ON(offset <= 0);
1194 BUG_ON(skb->csum + 2 > offset); 1194 BUG_ON(skb->csum_offset + 2 > offset);
1195 1195
1196 *(__sum16*)(skb->h.raw + skb->csum) = csum_fold(csum); 1196 *(__sum16*)(skb->h.raw + skb->csum_offset) = csum_fold(csum);
1197 1197
1198out_set_summed: 1198out_set_summed:
1199 skb->ip_summed = CHECKSUM_NONE; 1199 skb->ip_summed = CHECKSUM_NONE;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 07c25d601922..a90bc439488e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1414,7 +1414,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
1414 skb->len - csstart, 0); 1414 skb->len - csstart, 0);
1415 1415
1416 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1416 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1417 long csstuff = csstart + skb->csum; 1417 long csstuff = csstart + skb->csum_offset;
1418 1418
1419 *((__sum16 *)(to + csstuff)) = csum_fold(csum); 1419 *((__sum16 *)(to + csstuff)) = csum_fold(csum);
1420 } 1420 }
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index e9d467124c4d..4913f25e5ad5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -504,7 +504,7 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
504 if (skb->ip_summed == CHECKSUM_PARTIAL) { 504 if (skb->ip_summed == CHECKSUM_PARTIAL) {
505 th->check = ~tcp_v4_check(th, len, 505 th->check = ~tcp_v4_check(th, len,
506 inet->saddr, inet->daddr, 0); 506 inet->saddr, inet->daddr, 0);
507 skb->csum = offsetof(struct tcphdr, check); 507 skb->csum_offset = offsetof(struct tcphdr, check);
508 } else { 508 } else {
509 th->check = tcp_v4_check(th, len, inet->saddr, inet->daddr, 509 th->check = tcp_v4_check(th, len, inet->saddr, inet->daddr,
510 csum_partial((char *)th, 510 csum_partial((char *)th,
@@ -526,7 +526,7 @@ int tcp_v4_gso_send_check(struct sk_buff *skb)
526 526
527 th->check = 0; 527 th->check = 0;
528 th->check = ~tcp_v4_check(th, skb->len, iph->saddr, iph->daddr, 0); 528 th->check = ~tcp_v4_check(th, skb->len, iph->saddr, iph->daddr, 0);
529 skb->csum = offsetof(struct tcphdr, check); 529 skb->csum_offset = offsetof(struct tcphdr, check);
530 skb->ip_summed = CHECKSUM_PARTIAL; 530 skb->ip_summed = CHECKSUM_PARTIAL;
531 return 0; 531 return 0;
532} 532}
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 28e4cf662ce0..1807a30694d9 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -422,7 +422,7 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
422 /* 422 /*
423 * Only one fragment on the socket. 423 * Only one fragment on the socket.
424 */ 424 */
425 skb->csum = offsetof(struct udphdr, check); 425 skb->csum_offset = offsetof(struct udphdr, check);
426 uh->check = ~csum_tcpudp_magic(src, dst, len, IPPROTO_UDP, 0); 426 uh->check = ~csum_tcpudp_magic(src, dst, len, IPPROTO_UDP, 0);
427 } else { 427 } else {
428 /* 428 /*
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 0adb337c4b7e..517c50024bfc 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -948,7 +948,7 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
948 948
949 if (skb->ip_summed == CHECKSUM_PARTIAL) { 949 if (skb->ip_summed == CHECKSUM_PARTIAL) {
950 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); 950 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0);
951 skb->csum = offsetof(struct tcphdr, check); 951 skb->csum_offset = offsetof(struct tcphdr, check);
952 } else { 952 } else {
953 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 953 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP,
954 csum_partial((char *)th, th->doff<<2, 954 csum_partial((char *)th, th->doff<<2,
@@ -970,7 +970,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
970 th->check = 0; 970 th->check = 0;
971 th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, 971 th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len,
972 IPPROTO_TCP, 0); 972 IPPROTO_TCP, 0);
973 skb->csum = offsetof(struct tcphdr, check); 973 skb->csum_offset = offsetof(struct tcphdr, check);
974 skb->ip_summed = CHECKSUM_PARTIAL; 974 skb->ip_summed = CHECKSUM_PARTIAL;
975 return 0; 975 return 0;
976} 976}