]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SK_BUFF]: Introduce udp_hdr(), remove skb->h.uh
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 13 Mar 2007 17:28:48 +0000 (14:28 -0300)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:25:22 +0000 (22:25 -0700)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
drivers/net/gianfar.c
drivers/net/ioc3-eth.c
drivers/net/mv643xx_eth.c
include/linux/skbuff.h
include/linux/udp.h
include/net/udplite.h
net/core/netpoll.c
net/core/pktgen.c
net/ipv4/udp.c
net/ipv6/udp.c
net/rxrpc/connection.c
net/rxrpc/transport.c

index c9abc96a091926eb479327866444cb250ca03082..b9f44602c5e14e640211425a1b2232a550504d58 100644 (file)
@@ -944,9 +944,9 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb)
        /* And provide the already calculated phcs */
        if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
                flags |= TXFCB_UDP;
-               fcb->phcs = skb->h.uh->check;
+               fcb->phcs = udp_hdr(skb)->check;
        } else
-               fcb->phcs = skb->h.th->check;
+               fcb->phcs = udp_hdr(skb)->check;
 
        /* l3os is the distance between the start of the
         * frame (skb->data) and the start of the IP hdr.
index d375e786b4b3bc211a8a1b5cc7926d17feafb56e..ba012e10d79aa989ef9836b9c3931092ef49b8bc 100644 (file)
@@ -1422,7 +1422,7 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
                csoff = ETH_HLEN + (ih->ihl << 2);
                if (proto == IPPROTO_UDP) {
                        csoff += offsetof(struct udphdr, check);
-                       skb->h.uh->check = csum;
+                       udp_hdr(skb)->check = csum;
                }
                if (proto == IPPROTO_TCP) {
                        csoff += offsetof(struct tcphdr, check);
index 6b39a268ec29409ea0c6b378709ef078b4d84d7a..43723839e934369de5ff678931bd86c78dbefaa0 100644 (file)
@@ -1166,7 +1166,7 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp,
                switch (ip_hdr(skb)->protocol) {
                case IPPROTO_UDP:
                        cmd_sts |= ETH_UDP_FRAME;
-                       desc->l4i_chk = skb->h.uh->check;
+                       desc->l4i_chk = udp_hdr(skb)->check;
                        break;
                case IPPROTO_TCP:
                        desc->l4i_chk = skb->h.th->check;
index 0a4a7ac034fa9b067a426fd8d8a223a857ac38f6..cb1ac48cc808e9a84cfefb7b7a4d2e7c5905b8bf 100644 (file)
@@ -238,7 +238,6 @@ struct sk_buff {
 
        union {
                struct tcphdr   *th;
-               struct udphdr   *uh;
                struct icmphdr  *icmph;
                struct iphdr    *ipiph;
                struct ipv6hdr  *ipv6h;
index 7e08c07efe0fa001f59a0c0c36d03c5a2fa52590..1f58503af9a6c430b32583d4b06a846824bcc256 100644 (file)
@@ -26,6 +26,15 @@ struct udphdr {
        __sum16 check;
 };
 
+#ifdef __KERNEL__
+#include <linux/skbuff.h>
+
+static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
+{
+       return (struct udphdr *)skb->h.raw;
+}
+#endif
+
 /* UDP socket options */
 #define UDP_CORK       1       /* Never send partially complete segments */
 #define UDP_ENCAP      100     /* Set the socket to accept encapsulated packets */
index 765032036657008d0816a469ac3e6c1b2b7b9879..635b0eafca95d256e789edb0323cbb8aef759f4f 100644 (file)
@@ -101,7 +101,7 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
 
 static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
 {
-       int cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
+       int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
        __wsum csum = 0;
 
        skb->ip_summed = CHECKSUM_NONE;     /* no HW support for checksumming */
index 8b22723d643645a22d0d1e4fcc416ae27932142a..57a82445c4654cbb6557acbef54af9f7232dc033 100644 (file)
@@ -296,7 +296,9 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        memcpy(skb->data, msg, len);
        skb->len += len;
 
-       skb->h.uh = udph = (struct udphdr *) skb_push(skb, sizeof(*udph));
+       skb_push(skb, sizeof(*udph));
+       skb_reset_transport_header(skb);
+       udph = udp_hdr(skb);
        udph->source = htons(np->local_port);
        udph->dest = htons(np->remote_port);
        udph->len = htons(udp_len);
index ee82364c8f31ceb7d5792f6f1dfbde19d548a6ac..160d4f01c46e74ce7b0b0231cda98224df2863b3 100644 (file)
@@ -2392,7 +2392,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
        skb->dev = odev;
        skb->pkt_type = PACKET_HOST;
        skb->nh.raw = (unsigned char *)iph;
-       skb->h.uh = udph;
+       skb->h.raw = (unsigned char *)udph;
 
        if (pkt_dev->nfrags <= 0)
                pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
@@ -2737,7 +2737,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
        skb->dev = odev;
        skb->pkt_type = PACKET_HOST;
        skb->nh.raw = (unsigned char *)iph;
-       skb->h.uh = udph;
+       skb->h.raw = (unsigned char *)udph;
 
        if (pkt_dev->nfrags <= 0)
                pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
index 13875e8419a7467360490fc8915fdf1ad669e84b..926404c5e58c64e60ddeea29f1e1c4b75d23b5c3 100644 (file)
@@ -420,7 +420,7 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
                                 __be32 src, __be32 dst, int len      )
 {
        unsigned int offset;
-       struct udphdr *uh = skb->h.uh;
+       struct udphdr *uh = udp_hdr(skb);
        __wsum csum = 0;
 
        if (skb_queue_len(&sk->sk_write_queue) == 1) {
@@ -470,7 +470,7 @@ static int udp_push_pending_frames(struct sock *sk)
        /*
         * Create a UDP header
         */
-       uh = skb->h.uh;
+       uh = udp_hdr(skb);
        uh->source = fl->fl_ip_sport;
        uh->dest = fl->fl_ip_dport;
        uh->len = htons(up->len);
@@ -866,7 +866,7 @@ try_again:
        if (sin)
        {
                sin->sin_family = AF_INET;
-               sin->sin_port = skb->h.uh->source;
+               sin->sin_port = udp_hdr(skb)->source;
                sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
                memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
        }
@@ -949,7 +949,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
                return 1;
 
        /* Now we can get the pointers */
-       uh = skb->h.uh;
+       uh = udp_hdr(skb);
        udpdata = (__u8 *)uh + sizeof(struct udphdr);
        udpdata32 = (__be32 *)udpdata;
 
@@ -1207,7 +1207,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
                   int proto)
 {
        struct sock *sk;
-       struct udphdr *uh = skb->h.uh;
+       struct udphdr *uh = udp_hdr(skb);
        unsigned short ulen;
        struct rtable *rt = (struct rtable*)skb->dst;
        __be32 saddr = ip_hdr(skb)->saddr;
@@ -1227,7 +1227,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
                /* UDP validates ulen. */
                if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen))
                        goto short_packet;
-               uh = skb->h.uh;
+               uh = udp_hdr(skb);
        }
 
        if (udp4_csum_init(skb, uh, proto))
index 55affe39b2ebbb985fdda2d155e1e8c7524bf8fb..1e3dfb20b1cf95d6760f72bae148fbc436a22e16 100644 (file)
@@ -172,7 +172,7 @@ try_again:
 
                sin6 = (struct sockaddr_in6 *) msg->msg_name;
                sin6->sin6_family = AF_INET6;
-               sin6->sin6_port = skb->h.uh->source;
+               sin6->sin6_port = udp_hdr(skb)->source;
                sin6->sin6_flowinfo = 0;
                sin6->sin6_scope_id = 0;
 
@@ -346,7 +346,7 @@ static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr,
                           struct in6_addr *daddr, struct hlist_head udptable[])
 {
        struct sock *sk, *sk2;
-       const struct udphdr *uh = skb->h.uh;
+       const struct udphdr *uh = udp_hdr(skb);
        int dif;
 
        read_lock(&udp_hash_lock);
@@ -420,7 +420,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
 
        saddr = &ipv6_hdr(skb)->saddr;
        daddr = &ipv6_hdr(skb)->daddr;
-       uh = skb->h.uh;
+       uh = udp_hdr(skb);
 
        ulen = ntohs(uh->len);
        if (ulen > skb->len)
@@ -441,7 +441,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
                                goto short_packet;
                        saddr = &ipv6_hdr(skb)->saddr;
                        daddr = &ipv6_hdr(skb)->daddr;
-                       uh = skb->h.uh;
+                       uh = udp_hdr(skb);
                }
        }
 
@@ -534,7 +534,7 @@ static int udp_v6_push_pending_frames(struct sock *sk)
        /*
         * Create a UDP header
         */
-       uh = skb->h.uh;
+       uh = udp_hdr(skb);
        uh->source = fl->fl_ip_sport;
        uh->dest = fl->fl_ip_dport;
        uh->len = htons(up->len);
index e601fa87bb77a99a0766c54e8514d819d45ab393..665a99952440b17d8a8014f48efab119013004b3 100644 (file)
@@ -229,10 +229,10 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
        _enter("%p{{%hu}},%u,%hu",
               peer,
               peer->trans->port,
-              ntohs(pkt->h.uh->source),
+              ntohs(udp_hdr(pkt)->source),
               ntohs(msg->hdr.serviceId));
 
-       x_port          = pkt->h.uh->source;
+       x_port          = udp_hdr(pkt)->source;
        x_epoch         = msg->hdr.epoch;
        x_clflag        = msg->hdr.flags & RXRPC_CLIENT_INITIATED;
        x_connid        = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK);
index cac078b7406895b4953590b2f05fa5feed584840..62398fd01f858d394e0f2aea0a269920725b58ec 100644 (file)
@@ -479,7 +479,7 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans)
                }
 
                addr = ip_hdr(pkt)->saddr;
-               port = pkt->h.uh->source;
+               port = udp_hdr(pkt)->source;
 
                _net("Rx Received UDP packet from %08x:%04hu",
                     ntohl(addr), ntohs(port));
@@ -625,7 +625,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
 
        memset(&sin,0,sizeof(sin));
        sin.sin_family          = AF_INET;
-       sin.sin_port            = msg->pkt->h.uh->source;
+       sin.sin_port            = udp_hdr(msg->pkt)->source;
        sin.sin_addr.s_addr     = ip_hdr(msg->pkt)->saddr;
 
        msghdr.msg_name         = &sin;