aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-13 13:28:48 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:22 -0400
commit4bedb45203eab92a87b4c863fe2d0cded633427f (patch)
treed46e43d0a08253cf85ee2db64df6aee5e4ff5a07
parentd9edf9e2be0f7661558984c32bd53867a7037fd3 (diff)
[SK_BUFF]: Introduce udp_hdr(), remove skb->h.uh
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/ioc3-eth.c2
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--include/linux/skbuff.h1
-rw-r--r--include/linux/udp.h9
-rw-r--r--include/net/udplite.h2
-rw-r--r--net/core/netpoll.c4
-rw-r--r--net/core/pktgen.c4
-rw-r--r--net/ipv4/udp.c12
-rw-r--r--net/ipv6/udp.c10
-rw-r--r--net/rxrpc/connection.c4
-rw-r--r--net/rxrpc/transport.c4
12 files changed, 34 insertions, 24 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index c9abc96a0919..b9f44602c5e1 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -944,9 +944,9 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb)
944 /* And provide the already calculated phcs */ 944 /* And provide the already calculated phcs */
945 if (ip_hdr(skb)->protocol == IPPROTO_UDP) { 945 if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
946 flags |= TXFCB_UDP; 946 flags |= TXFCB_UDP;
947 fcb->phcs = skb->h.uh->check; 947 fcb->phcs = udp_hdr(skb)->check;
948 } else 948 } else
949 fcb->phcs = skb->h.th->check; 949 fcb->phcs = udp_hdr(skb)->check;
950 950
951 /* l3os is the distance between the start of the 951 /* l3os is the distance between the start of the
952 * frame (skb->data) and the start of the IP hdr. 952 * frame (skb->data) and the start of the IP hdr.
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index d375e786b4b3..ba012e10d79a 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1422,7 +1422,7 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
1422 csoff = ETH_HLEN + (ih->ihl << 2); 1422 csoff = ETH_HLEN + (ih->ihl << 2);
1423 if (proto == IPPROTO_UDP) { 1423 if (proto == IPPROTO_UDP) {
1424 csoff += offsetof(struct udphdr, check); 1424 csoff += offsetof(struct udphdr, check);
1425 skb->h.uh->check = csum; 1425 udp_hdr(skb)->check = csum;
1426 } 1426 }
1427 if (proto == IPPROTO_TCP) { 1427 if (proto == IPPROTO_TCP) {
1428 csoff += offsetof(struct tcphdr, check); 1428 csoff += offsetof(struct tcphdr, check);
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 6b39a268ec29..43723839e934 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1166,7 +1166,7 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp,
1166 switch (ip_hdr(skb)->protocol) { 1166 switch (ip_hdr(skb)->protocol) {
1167 case IPPROTO_UDP: 1167 case IPPROTO_UDP:
1168 cmd_sts |= ETH_UDP_FRAME; 1168 cmd_sts |= ETH_UDP_FRAME;
1169 desc->l4i_chk = skb->h.uh->check; 1169 desc->l4i_chk = udp_hdr(skb)->check;
1170 break; 1170 break;
1171 case IPPROTO_TCP: 1171 case IPPROTO_TCP:
1172 desc->l4i_chk = skb->h.th->check; 1172 desc->l4i_chk = skb->h.th->check;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 0a4a7ac034fa..cb1ac48cc808 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -238,7 +238,6 @@ struct sk_buff {
238 238
239 union { 239 union {
240 struct tcphdr *th; 240 struct tcphdr *th;
241 struct udphdr *uh;
242 struct icmphdr *icmph; 241 struct icmphdr *icmph;
243 struct iphdr *ipiph; 242 struct iphdr *ipiph;
244 struct ipv6hdr *ipv6h; 243 struct ipv6hdr *ipv6h;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 7e08c07efe0f..1f58503af9a6 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,6 +26,15 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb->h.raw;
35}
36#endif
37
29/* UDP socket options */ 38/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */ 39#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 765032036657..635b0eafca95 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -101,7 +101,7 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
101 101
102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) 102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
103{ 103{
104 int cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); 104 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
105 __wsum csum = 0; 105 __wsum csum = 0;
106 106
107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 8b22723d6436..57a82445c465 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -296,7 +296,9 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
296 memcpy(skb->data, msg, len); 296 memcpy(skb->data, msg, len);
297 skb->len += len; 297 skb->len += len;
298 298
299 skb->h.uh = udph = (struct udphdr *) skb_push(skb, sizeof(*udph)); 299 skb_push(skb, sizeof(*udph));
300 skb_reset_transport_header(skb);
301 udph = udp_hdr(skb);
300 udph->source = htons(np->local_port); 302 udph->source = htons(np->local_port);
301 udph->dest = htons(np->remote_port); 303 udph->dest = htons(np->remote_port);
302 udph->len = htons(udp_len); 304 udph->len = htons(udp_len);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index ee82364c8f31..160d4f01c46e 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2392,7 +2392,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
2392 skb->dev = odev; 2392 skb->dev = odev;
2393 skb->pkt_type = PACKET_HOST; 2393 skb->pkt_type = PACKET_HOST;
2394 skb->nh.raw = (unsigned char *)iph; 2394 skb->nh.raw = (unsigned char *)iph;
2395 skb->h.uh = udph; 2395 skb->h.raw = (unsigned char *)udph;
2396 2396
2397 if (pkt_dev->nfrags <= 0) 2397 if (pkt_dev->nfrags <= 0)
2398 pgh = (struct pktgen_hdr *)skb_put(skb, datalen); 2398 pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
@@ -2737,7 +2737,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2737 skb->dev = odev; 2737 skb->dev = odev;
2738 skb->pkt_type = PACKET_HOST; 2738 skb->pkt_type = PACKET_HOST;
2739 skb->nh.raw = (unsigned char *)iph; 2739 skb->nh.raw = (unsigned char *)iph;
2740 skb->h.uh = udph; 2740 skb->h.raw = (unsigned char *)udph;
2741 2741
2742 if (pkt_dev->nfrags <= 0) 2742 if (pkt_dev->nfrags <= 0)
2743 pgh = (struct pktgen_hdr *)skb_put(skb, datalen); 2743 pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 13875e8419a7..926404c5e58c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -420,7 +420,7 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
420 __be32 src, __be32 dst, int len ) 420 __be32 src, __be32 dst, int len )
421{ 421{
422 unsigned int offset; 422 unsigned int offset;
423 struct udphdr *uh = skb->h.uh; 423 struct udphdr *uh = udp_hdr(skb);
424 __wsum csum = 0; 424 __wsum csum = 0;
425 425
426 if (skb_queue_len(&sk->sk_write_queue) == 1) { 426 if (skb_queue_len(&sk->sk_write_queue) == 1) {
@@ -470,7 +470,7 @@ static int udp_push_pending_frames(struct sock *sk)
470 /* 470 /*
471 * Create a UDP header 471 * Create a UDP header
472 */ 472 */
473 uh = skb->h.uh; 473 uh = udp_hdr(skb);
474 uh->source = fl->fl_ip_sport; 474 uh->source = fl->fl_ip_sport;
475 uh->dest = fl->fl_ip_dport; 475 uh->dest = fl->fl_ip_dport;
476 uh->len = htons(up->len); 476 uh->len = htons(up->len);
@@ -866,7 +866,7 @@ try_again:
866 if (sin) 866 if (sin)
867 { 867 {
868 sin->sin_family = AF_INET; 868 sin->sin_family = AF_INET;
869 sin->sin_port = skb->h.uh->source; 869 sin->sin_port = udp_hdr(skb)->source;
870 sin->sin_addr.s_addr = ip_hdr(skb)->saddr; 870 sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
871 memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); 871 memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
872 } 872 }
@@ -949,7 +949,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
949 return 1; 949 return 1;
950 950
951 /* Now we can get the pointers */ 951 /* Now we can get the pointers */
952 uh = skb->h.uh; 952 uh = udp_hdr(skb);
953 udpdata = (__u8 *)uh + sizeof(struct udphdr); 953 udpdata = (__u8 *)uh + sizeof(struct udphdr);
954 udpdata32 = (__be32 *)udpdata; 954 udpdata32 = (__be32 *)udpdata;
955 955
@@ -1207,7 +1207,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1207 int proto) 1207 int proto)
1208{ 1208{
1209 struct sock *sk; 1209 struct sock *sk;
1210 struct udphdr *uh = skb->h.uh; 1210 struct udphdr *uh = udp_hdr(skb);
1211 unsigned short ulen; 1211 unsigned short ulen;
1212 struct rtable *rt = (struct rtable*)skb->dst; 1212 struct rtable *rt = (struct rtable*)skb->dst;
1213 __be32 saddr = ip_hdr(skb)->saddr; 1213 __be32 saddr = ip_hdr(skb)->saddr;
@@ -1227,7 +1227,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1227 /* UDP validates ulen. */ 1227 /* UDP validates ulen. */
1228 if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen)) 1228 if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen))
1229 goto short_packet; 1229 goto short_packet;
1230 uh = skb->h.uh; 1230 uh = udp_hdr(skb);
1231 } 1231 }
1232 1232
1233 if (udp4_csum_init(skb, uh, proto)) 1233 if (udp4_csum_init(skb, uh, proto))
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 55affe39b2eb..1e3dfb20b1cf 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -172,7 +172,7 @@ try_again:
172 172
173 sin6 = (struct sockaddr_in6 *) msg->msg_name; 173 sin6 = (struct sockaddr_in6 *) msg->msg_name;
174 sin6->sin6_family = AF_INET6; 174 sin6->sin6_family = AF_INET6;
175 sin6->sin6_port = skb->h.uh->source; 175 sin6->sin6_port = udp_hdr(skb)->source;
176 sin6->sin6_flowinfo = 0; 176 sin6->sin6_flowinfo = 0;
177 sin6->sin6_scope_id = 0; 177 sin6->sin6_scope_id = 0;
178 178
@@ -346,7 +346,7 @@ static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr,
346 struct in6_addr *daddr, struct hlist_head udptable[]) 346 struct in6_addr *daddr, struct hlist_head udptable[])
347{ 347{
348 struct sock *sk, *sk2; 348 struct sock *sk, *sk2;
349 const struct udphdr *uh = skb->h.uh; 349 const struct udphdr *uh = udp_hdr(skb);
350 int dif; 350 int dif;
351 351
352 read_lock(&udp_hash_lock); 352 read_lock(&udp_hash_lock);
@@ -420,7 +420,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
420 420
421 saddr = &ipv6_hdr(skb)->saddr; 421 saddr = &ipv6_hdr(skb)->saddr;
422 daddr = &ipv6_hdr(skb)->daddr; 422 daddr = &ipv6_hdr(skb)->daddr;
423 uh = skb->h.uh; 423 uh = udp_hdr(skb);
424 424
425 ulen = ntohs(uh->len); 425 ulen = ntohs(uh->len);
426 if (ulen > skb->len) 426 if (ulen > skb->len)
@@ -441,7 +441,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
441 goto short_packet; 441 goto short_packet;
442 saddr = &ipv6_hdr(skb)->saddr; 442 saddr = &ipv6_hdr(skb)->saddr;
443 daddr = &ipv6_hdr(skb)->daddr; 443 daddr = &ipv6_hdr(skb)->daddr;
444 uh = skb->h.uh; 444 uh = udp_hdr(skb);
445 } 445 }
446 } 446 }
447 447
@@ -534,7 +534,7 @@ static int udp_v6_push_pending_frames(struct sock *sk)
534 /* 534 /*
535 * Create a UDP header 535 * Create a UDP header
536 */ 536 */
537 uh = skb->h.uh; 537 uh = udp_hdr(skb);
538 uh->source = fl->fl_ip_sport; 538 uh->source = fl->fl_ip_sport;
539 uh->dest = fl->fl_ip_dport; 539 uh->dest = fl->fl_ip_dport;
540 uh->len = htons(up->len); 540 uh->len = htons(up->len);
diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c
index e601fa87bb77..665a99952440 100644
--- a/net/rxrpc/connection.c
+++ b/net/rxrpc/connection.c
@@ -229,10 +229,10 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
229 _enter("%p{{%hu}},%u,%hu", 229 _enter("%p{{%hu}},%u,%hu",
230 peer, 230 peer,
231 peer->trans->port, 231 peer->trans->port,
232 ntohs(pkt->h.uh->source), 232 ntohs(udp_hdr(pkt)->source),
233 ntohs(msg->hdr.serviceId)); 233 ntohs(msg->hdr.serviceId));
234 234
235 x_port = pkt->h.uh->source; 235 x_port = udp_hdr(pkt)->source;
236 x_epoch = msg->hdr.epoch; 236 x_epoch = msg->hdr.epoch;
237 x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED; 237 x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED;
238 x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK); 238 x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK);
diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c
index cac078b74068..62398fd01f85 100644
--- a/net/rxrpc/transport.c
+++ b/net/rxrpc/transport.c
@@ -479,7 +479,7 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans)
479 } 479 }
480 480
481 addr = ip_hdr(pkt)->saddr; 481 addr = ip_hdr(pkt)->saddr;
482 port = pkt->h.uh->source; 482 port = udp_hdr(pkt)->source;
483 483
484 _net("Rx Received UDP packet from %08x:%04hu", 484 _net("Rx Received UDP packet from %08x:%04hu",
485 ntohl(addr), ntohs(port)); 485 ntohl(addr), ntohs(port));
@@ -625,7 +625,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
625 625
626 memset(&sin,0,sizeof(sin)); 626 memset(&sin,0,sizeof(sin));
627 sin.sin_family = AF_INET; 627 sin.sin_family = AF_INET;
628 sin.sin_port = msg->pkt->h.uh->source; 628 sin.sin_port = udp_hdr(msg->pkt)->source;
629 sin.sin_addr.s_addr = ip_hdr(msg->pkt)->saddr; 629 sin.sin_addr.s_addr = ip_hdr(msg->pkt)->saddr;
630 630
631 msghdr.msg_name = &sin; 631 msghdr.msg_name = &sin;