atomic_t subscription_count;
 };
 
+static inline u16 mod(u16 x)
+{
+       return x & 0xffffu;
+}
+
+static inline int less_eq(u16 left, u16 right)
+{
+       return mod(right - left) < 32768u;
+}
+
+static inline int more(u16 left, u16 right)
+{
+       return !less_eq(left, right);
+}
+
+static inline int less(u16 left, u16 right)
+{
+       return less_eq(left, right) && (mod(right) != mod(left));
+}
+
 #ifdef CONFIG_SYSCTL
 int tipc_register_sysctl(void);
 void tipc_unregister_sysctl(void);
 
        unsigned int maxwin = link->window;
        unsigned int imp = msg_importance(msg);
        uint mtu = link->mtu;
-       uint ack = mod(link->next_in_no - 1);
-       uint seqno = link->next_out_no;
-       uint bc_last_in = link->owner->bclink.last_in;
+       u16 ack = mod(link->next_in_no - 1);
+       u16 seqno = link->next_out_no;
+       u16 bc_last_in = link->owner->bclink.last_in;
        struct tipc_media_addr *addr = &link->media_addr;
        struct sk_buff_head *transmq = &link->transmq;
        struct sk_buff_head *backlogq = &link->backlogq;
 {
        struct sk_buff *skb;
        struct tipc_msg *msg;
-       unsigned int ack = mod(link->next_in_no - 1);
+       u16 ack = mod(link->next_in_no - 1);
 
        while (skb_queue_len(&link->transmq) < link->window) {
                skb = __skb_dequeue(&link->backlogq);
 static void link_retrieve_defq(struct tipc_link *link,
                               struct sk_buff_head *list)
 {
-       u32 seq_no;
+       u16 seq_no;
 
        if (skb_queue_empty(&link->deferdq))
                return;
 
        seq_no = buf_seqno(skb_peek(&link->deferdq));
-       if (seq_no == mod(link->next_in_no))
+       if (seq_no == link->next_in_no)
                skb_queue_splice_tail_init(&link->deferdq, list);
 }
 
        struct tipc_link *l_ptr;
        struct sk_buff *skb1, *tmp;
        struct tipc_msg *msg;
-       u32 seq_no;
-       u32 ackd;
+       u16 seq_no;
+       u16 ackd;
        u32 released;
 
        skb2list(skb, &head);
                }
 
                /* Link is now in state WORKING_WORKING */
-               if (unlikely(seq_no != mod(l_ptr->next_in_no))) {
+               if (unlikely(seq_no != l_ptr->next_in_no)) {
                        link_handle_out_of_seq_msg(l_ptr, skb);
                        link_retrieve_defq(l_ptr, &head);
                        skb = NULL;
 u32 tipc_link_defer_pkt(struct sk_buff_head *list, struct sk_buff *skb)
 {
        struct sk_buff *skb1;
-       u32 seq_no = buf_seqno(skb);
+       u16 seq_no = buf_seqno(skb);
 
        /* Empty queue ? */
        if (skb_queue_empty(list)) {
 
        /* Locate insertion point in queue, then insert; discard if duplicate */
        skb_queue_walk(list, skb1) {
-               u32 curr_seqno = buf_seqno(skb1);
+               u16 curr_seqno = buf_seqno(skb1);
 
                if (seq_no == curr_seqno) {
                        kfree_skb(skb);
         * Discard packet if a duplicate; otherwise add it to deferred queue
         * and notify peer of gap as per protocol specification
         */
-       if (less(seq_no, mod(l_ptr->next_in_no))) {
+       if (less(seq_no, l_ptr->next_in_no)) {
                l_ptr->stats.duplicates++;
                kfree_skb(buf);
                return;
        struct tipc_msg *msg = l_ptr->pmsg;
        u32 msg_size = sizeof(l_ptr->proto_msg);
        int r_flag;
+       u16 last_rcv;
 
        /* Don't send protocol message during link failover */
        if (l_ptr->flags & LINK_FAILINGOVER)
        msg_set_last_bcast(msg, tipc_bclink_get_last_sent(l_ptr->owner->net));
 
        if (msg_typ == STATE_MSG) {
-               u32 next_sent = mod(l_ptr->next_out_no);
+               u16 next_sent = l_ptr->next_out_no;
 
                if (!tipc_link_is_up(l_ptr))
                        return;
                        next_sent = buf_seqno(skb_peek(&l_ptr->backlogq));
                msg_set_next_sent(msg, next_sent);
                if (!skb_queue_empty(&l_ptr->deferdq)) {
-                       u32 rec = buf_seqno(skb_peek(&l_ptr->deferdq));
-                       gap = mod(rec - mod(l_ptr->next_in_no));
+                       last_rcv = buf_seqno(skb_peek(&l_ptr->deferdq));
+                       gap = mod(last_rcv - l_ptr->next_in_no);
                }
                msg_set_seq_gap(msg, gap);
                if (gap)
                if (link_reset_unknown(l_ptr))
                        break;
 
-               if (less_eq(mod(l_ptr->next_in_no), msg_next_sent(msg))) {
-                       rec_gap = mod(msg_next_sent(msg) -
-                                     mod(l_ptr->next_in_no));
-               }
+               if (less_eq(l_ptr->next_in_no, msg_next_sent(msg)))
+                       rec_gap = mod(msg_next_sent(msg) - l_ptr->next_in_no);
 
                if (msg_probe(msg))
                        l_ptr->stats.recv_probes++;
 
 
        /* Management and link supervision data */
        unsigned int flags;
-       u32 checkpoint;
+       u16 checkpoint;
        u32 peer_session;
        u32 peer_bearer_id;
        u32 bearer_id;
                u16 len;
                u16 limit;
        } backlog[5];
-       u32 next_out_no;
+       u16 next_out_no;
+       u16 last_retransmitted;
        u32 window;
-       u32 last_retransmitted;
        u32 stale_count;
 
        /* Reception */
-       u32 next_in_no;
+       u16 next_in_no;
        u32 rcv_unacked;
        struct sk_buff_head deferdq;
        struct sk_buff_head inputq;
 int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
 void link_prepare_wakeup(struct tipc_link *l);
 
-/*
- * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
- */
-static inline u32 buf_seqno(struct sk_buff *buf)
-{
-       return msg_seqno(buf_msg(buf));
-}
-
-static inline u32 mod(u32 x)
-{
-       return x & 0xffffu;
-}
-
-static inline int less_eq(u32 left, u32 right)
-{
-       return mod(right - left) < 32768u;
-}
-
-static inline int more(u32 left, u32 right)
-{
-       return !less_eq(left, right);
-}
-
-static inline int less(u32 left, u32 right)
-{
-       return less_eq(left, right) && (mod(right) != mod(left));
-}
-
-static inline u32 lesser(u32 left, u32 right)
-{
-       return less_eq(left, right) ? left : right;
-}
-
 static inline u32 link_own_addr(struct tipc_link *l)
 {
        return msg_prevnode(l->pmsg);
 
        msg_set_bits(m, 1, 19, 0x3, n);
 }
 
-static inline u32 msg_bcast_ack(struct tipc_msg *m)
+static inline u16 msg_bcast_ack(struct tipc_msg *m)
 {
        return msg_bits(m, 1, 0, 0xffff);
 }
 
-static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n)
+static inline void msg_set_bcast_ack(struct tipc_msg *m, u16 n)
 {
        msg_set_bits(m, 1, 0, 0xffff, n);
 }
 /*
  * Word 2
  */
-static inline u32 msg_ack(struct tipc_msg *m)
+static inline u16 msg_ack(struct tipc_msg *m)
 {
        return msg_bits(m, 2, 16, 0xffff);
 }
 
-static inline void msg_set_ack(struct tipc_msg *m, u32 n)
+static inline void msg_set_ack(struct tipc_msg *m, u16 n)
 {
        msg_set_bits(m, 2, 16, 0xffff, n);
 }
 
-static inline u32 msg_seqno(struct tipc_msg *m)
+static inline u16 msg_seqno(struct tipc_msg *m)
 {
        return msg_bits(m, 2, 0, 0xffff);
 }
 
-static inline void msg_set_seqno(struct tipc_msg *m, u32 n)
+static inline void msg_set_seqno(struct tipc_msg *m, u16 n)
 {
        msg_set_bits(m, 2, 0, 0xffff, n);
 }
                          int *err);
 struct sk_buff *tipc_msg_reassemble(struct sk_buff_head *list);
 
+static inline u16 buf_seqno(struct sk_buff *skb)
+{
+       return msg_seqno(buf_msg(skb));
+}
+
 /* tipc_skb_peek(): peek and reserve first buffer in list
  * @list: list to be peeked in
  * Returns pointer to first buffer in list, if any