]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/decnet/dn_nsp_out.c
Merge branch 'cfq-merge' of git://brick.kernel.dk/data/git/linux-2.6-block
[linux-2.6-omap-h63xx.git] / net / decnet / dn_nsp_out.c
index cd08244aa10c1191043dfb8876d4a9ea221d5a77..c2e21cd89b3cd273600e80b955f27f1b011d0658 100644 (file)
@@ -117,8 +117,7 @@ try_again:
  * The eventual aim is for each socket to have a cached header size
  * for its outgoing packets, and to set hdr from this when sk != NULL.
  */
-struct sk_buff *dn_alloc_skb(struct sock *sk, int size,
-                            unsigned int __nocast pri)
+struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri)
 {
        struct sk_buff *skb;
        int hdr = 64;
@@ -212,7 +211,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
  * Returns: The number of times the packet has been sent previously
  */
 static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb,
-                                            unsigned int __nocast gfp)
+                                            gfp_t gfp)
 {
        struct dn_skb_cb *cb = DN_SKB_CB(skb);
        struct sk_buff *skb2;
@@ -288,26 +287,26 @@ int dn_nsp_xmit_timeout(struct sock *sk)
        return 0;
 }
 
-static inline unsigned char *dn_mk_common_header(struct dn_scp *scp, struct sk_buff *skb, unsigned char msgflag, int len)
+static inline __le16 *dn_mk_common_header(struct dn_scp *scp, struct sk_buff *skb, unsigned char msgflag, int len)
 {
        unsigned char *ptr = skb_push(skb, len);
 
        BUG_ON(len < 5);
 
        *ptr++ = msgflag;
-       *((unsigned short *)ptr) = scp->addrrem;
+       *((__le16 *)ptr) = scp->addrrem;
        ptr += 2;
-       *((unsigned short *)ptr) = scp->addrloc;
+       *((__le16 *)ptr) = scp->addrloc;
        ptr += 2;
-       return ptr;
+       return (__le16 __force *)ptr;
 }
 
-static unsigned short *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, unsigned char msgflag, int hlen, int other)
+static __le16 *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, unsigned char msgflag, int hlen, int other)
 {
        struct dn_scp *scp = DN_SK(sk);
        unsigned short acknum = scp->numdat_rcv & 0x0FFF;
        unsigned short ackcrs = scp->numoth_rcv & 0x0FFF;
-       unsigned short *ptr;
+       __le16 *ptr;
 
        BUG_ON(hlen < 9);
 
@@ -326,7 +325,7 @@ static unsigned short *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, un
        /* Set "cross subchannel" bit in ackcrs */
        ackcrs |= 0x2000;
 
-       ptr = (unsigned short *)dn_mk_common_header(scp, skb, msgflag, hlen);
+       ptr = (__le16 *)dn_mk_common_header(scp, skb, msgflag, hlen);
 
        *ptr++ = dn_htons(acknum);
        *ptr++ = dn_htons(ackcrs);
@@ -334,11 +333,11 @@ static unsigned short *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, un
        return ptr;
 }
 
-static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *skb, int oth)
+static __le16 *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *skb, int oth)
 {
        struct dn_scp *scp = DN_SK(sk);
        struct dn_skb_cb *cb = DN_SKB_CB(skb);
-       unsigned short *ptr = dn_mk_ack_header(sk, skb, cb->nsp_flags, 11, oth);
+       __le16 *ptr = dn_mk_ack_header(sk, skb, cb->nsp_flags, 11, oth);
 
        if (unlikely(oth)) {
                cb->segnum = scp->numoth;
@@ -353,7 +352,7 @@ static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *sk
 }
 
 void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb,
-                       unsigned int __nocast gfp, int oth)
+                       gfp_t gfp, int oth)
 {
        struct dn_scp *scp = DN_SK(sk);
        struct dn_skb_cb *cb = DN_SKB_CB(skb);
@@ -520,14 +519,14 @@ static int dn_nsp_retrans_conn_conf(struct sock *sk)
        return 0;
 }
 
-void dn_send_conn_conf(struct sock *sk, unsigned int __nocast gfp)
+void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
 {
        struct dn_scp *scp = DN_SK(sk);
        struct sk_buff *skb = NULL;
         struct nsp_conn_init_msg *msg;
-       unsigned char len = scp->conndata_out.opt_optl;
+       __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl);
 
-       if ((skb = dn_alloc_skb(sk, 50 + scp->conndata_out.opt_optl, gfp)) == NULL)
+       if ((skb = dn_alloc_skb(sk, 50 + dn_ntohs(scp->conndata_out.opt_optl), gfp)) == NULL)
                return;
 
         msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg));
@@ -552,9 +551,9 @@ void dn_send_conn_conf(struct sock *sk, unsigned int __nocast gfp)
 
 
 static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, 
-                       unsigned short reason, unsigned int __nocast gfp,
+                       unsigned short reason, gfp_t gfp,
                        struct dst_entry *dst,
-                       int ddl, unsigned char *dd, __u16 rem, __u16 loc)
+                       int ddl, unsigned char *dd, __le16 rem, __le16 loc)
 {
        struct sk_buff *skb = NULL;
        int size = 7 + ddl + ((msgflg == NSP_DISCINIT) ? 1 : 0);
@@ -562,7 +561,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
 
        if ((dst == NULL) || (rem == 0)) {
                if (net_ratelimit())
-                       printk(KERN_DEBUG "DECnet: dn_nsp_do_disc: BUG! Please report this to SteveW@ACM.org rem=%u dst=%p\n", (unsigned)rem, dst);
+                       printk(KERN_DEBUG "DECnet: dn_nsp_do_disc: BUG! Please report this to SteveW@ACM.org rem=%u dst=%p\n", dn_ntohs(rem), dst);
                return;
        }
 
@@ -571,11 +570,11 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
 
        msg = skb_put(skb, size);
        *msg++ = msgflg;
-       *(__u16 *)msg = rem;
+       *(__le16 *)msg = rem;
        msg += 2;
-       *(__u16 *)msg = loc;
+       *(__le16 *)msg = loc;
        msg += 2;
-       *(__u16 *)msg = dn_htons(reason);
+       *(__le16 *)msg = dn_htons(reason);
        msg += 2;
        if (msgflg == NSP_DISCINIT)
                *msg++ = ddl;
@@ -595,16 +594,16 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
 
 
 void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, 
-                       unsigned short reason, unsigned int __nocast gfp)
+                       unsigned short reason, gfp_t gfp)
 {
        struct dn_scp *scp = DN_SK(sk);
        int ddl = 0;
 
        if (msgflg == NSP_DISCINIT)
-               ddl = scp->discdata_out.opt_optl;
+               ddl = dn_ntohs(scp->discdata_out.opt_optl);
 
        if (reason == 0)
-               reason = scp->discdata_out.opt_status;
+               reason = dn_ntohs(scp->discdata_out.opt_status);
 
        dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, 
                scp->discdata_out.opt_data, scp->addrrem, scp->addrloc);
@@ -616,7 +615,7 @@ void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,
 {
        struct dn_skb_cb *cb = DN_SKB_CB(skb);
        int ddl = 0;
-       unsigned int __nocast gfp = GFP_ATOMIC;
+       gfp_t gfp = GFP_ATOMIC;
 
        dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, 
                        NULL, cb->src_port, cb->dst_port);
@@ -628,7 +627,7 @@ void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval)
        struct dn_scp *scp = DN_SK(sk);
        struct sk_buff *skb;
        unsigned char *ptr;
-       unsigned int __nocast gfp = GFP_ATOMIC;
+       gfp_t gfp = GFP_ATOMIC;
 
        if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL)
                return;
@@ -663,8 +662,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
        unsigned char menuver;
        struct dn_skb_cb *cb;
        unsigned char type = 1;
-       unsigned int __nocast allocation =
-                       (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC;
+       gfp_t allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC;
        struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation);
 
        if (!skb)
@@ -710,7 +708,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
        if (aux > 0)
        memcpy(skb_put(skb, aux), scp->accessdata.acc_acc, aux);
 
-       aux = scp->conndata_out.opt_optl;
+       aux = (__u8)dn_ntohs(scp->conndata_out.opt_optl);
        *skb_put(skb, 1) = aux;
        if (aux > 0)
        memcpy(skb_put(skb,aux), scp->conndata_out.opt_data, aux);