netdev
[Top] [All Lists]

[PATCH 1/11] [NET] Reorder struct inet_sock

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: [PATCH 1/11] [NET] Reorder struct inet_sock
From: Thomas Graf <tgraf@xxxxxxx>
Date: Wed, 9 Mar 2005 20:46:21 +0100
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20050309194521.GH31837@xxxxxxxxxxxxxx>
References: <20050309194521.GH31837@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
tos: int -> 8bit
uc_ttl: int -> 16 bit
cmsg_flags: int -> 16 bit
hdrincl: 8bit -> 1 bit
mc_loop: 8bit -> 1 bit

Saves 12 bytes together with the reordering.

Signed-off-by: Thomas Graf <tgraf@xxxxxxx>

diff -Nru linux-2.6.11-rc4.orig/include/linux/ip.h 
linux-2.6.11-rc4/include/linux/ip.h
--- linux-2.6.11-rc4.orig/include/linux/ip.h    2005-03-08 18:11:22.000000000 
+0100
+++ linux-2.6.11-rc4/include/linux/ip.h 2005-03-08 20:26:37.000000000 +0100
@@ -121,18 +121,18 @@
        __u16                   dport;          /* Destination port */
        __u16                   num;            /* Local port */
        __u32                   saddr;          /* Sending source */
-       int                     uc_ttl;         /* Unicast TTL */
-       int                     tos;            /* TOS */
-       unsigned                cmsg_flags;
+       __s16                   uc_ttl;         /* Unicast TTL */
+       __u16                   cmsg_flags;
        struct ip_options       *opt;
        __u16                   sport;          /* Source port */
-       unsigned char           hdrincl;        /* Include headers ? */
+       __u16                   id;             /* ID counter for DF pkts */
+       __u8                    tos;            /* TOS */
        __u8                    mc_ttl;         /* Multicasting TTL */
-       __u8                    mc_loop;        /* Loopback */
        __u8                    pmtudisc;
-       __u16                   id;             /* ID counter for DF pkts */
        unsigned                recverr : 1,
-                               freebind : 1;
+                               freebind : 1,
+                               hdrincl : 1,
+                               mc_loop : 1;
        int                     mc_index;       /* Multicast device index */
        __u32                   mc_addr;
        struct ip_mc_socklist   *mc_list;       /* Group array */

<Prev in Thread] Current Thread [Next in Thread>