lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f78cf69-fb44-c846-1af8-3408e1b7ef0a@gmail.com>
Date:   Wed, 5 Jan 2022 10:30:08 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>
Subject: Re: [PATCH v2 net-next 1/7] net: dsa: move dsa_port :: stp_state near
 dsa_port :: mac

On 1/5/22 5:21 AM, Vladimir Oltean wrote:
> The MAC address of a port is 6 octets in size, and this creates a 2
> octet hole after it. There are some other u8 members of struct dsa_port
> that we can put in that hole. One such member is the stp_state.
> 
> Before:
> 
> pahole -C dsa_port net/dsa/slave.o
> struct dsa_port {
>         union {
>                 struct net_device * master;              /*     0     8 */
>                 struct net_device * slave;               /*     0     8 */
>         };                                               /*     0     8 */
>         const struct dsa_device_ops  * tag_ops;          /*     8     8 */
>         struct dsa_switch_tree *   dst;                  /*    16     8 */
>         struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
>         enum {
>                 DSA_PORT_TYPE_UNUSED = 0,
>                 DSA_PORT_TYPE_CPU    = 1,
>                 DSA_PORT_TYPE_DSA    = 2,
>                 DSA_PORT_TYPE_USER   = 3,
>         } type;                                          /*    32     4 */
> 
>         /* XXX 4 bytes hole, try to pack */
> 
>         struct dsa_switch *        ds;                   /*    40     8 */
>         unsigned int               index;                /*    48     4 */
> 
>         /* XXX 4 bytes hole, try to pack */
> 
>         const char  *              name;                 /*    56     8 */
>         /* --- cacheline 1 boundary (64 bytes) --- */
>         struct dsa_port *          cpu_dp;               /*    64     8 */
>         u8                         mac[6];               /*    72     6 */
> 
>         /* XXX 2 bytes hole, try to pack */
> 
>         struct device_node *       dn;                   /*    80     8 */
>         unsigned int               ageing_time;          /*    88     4 */
>         bool                       vlan_filtering;       /*    92     1 */
>         bool                       learning;             /*    93     1 */
>         u8                         stp_state;            /*    94     1 */
> 
>         /* XXX 1 byte hole, try to pack */
> 
>         struct dsa_bridge *        bridge;               /*    96     8 */
>         struct devlink_port        devlink_port;         /*   104   288 */
>         /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
>         bool                       devlink_port_setup;   /*   392     1 */
> 
>         /* XXX 7 bytes hole, try to pack */
> 
>         struct phylink *           pl;                   /*   400     8 */
>         struct phylink_config      pl_config;            /*   408    40 */
>         /* --- cacheline 7 boundary (448 bytes) --- */
>         struct net_device *        lag_dev;              /*   448     8 */
>         bool                       lag_tx_enabled;       /*   456     1 */
> 
>         /* XXX 7 bytes hole, try to pack */
> 
>         struct net_device *        hsr_dev;              /*   464     8 */
>         struct list_head           list;                 /*   472    16 */
>         const struct ethtool_ops  * orig_ethtool_ops;    /*   488     8 */
>         const struct dsa_netdevice_ops  * netdev_ops;    /*   496     8 */
>         struct mutex               addr_lists_lock;      /*   504    32 */
>         /* --- cacheline 8 boundary (512 bytes) was 24 bytes ago --- */
>         struct list_head           fdbs;                 /*   536    16 */
>         struct list_head           mdbs;                 /*   552    16 */
>         bool                       setup;                /*   568     1 */
> 
>         /* size: 576, cachelines: 9, members: 30 */
>         /* sum members: 544, holes: 6, sum holes: 25 */
>         /* padding: 7 */
> };
> 
> After:
> 
> pahole -C dsa_port net/dsa/slave.o
> struct dsa_port {
>         union {
>                 struct net_device * master;              /*     0     8 */
>                 struct net_device * slave;               /*     0     8 */
>         };                                               /*     0     8 */
>         const struct dsa_device_ops  * tag_ops;          /*     8     8 */
>         struct dsa_switch_tree *   dst;                  /*    16     8 */
>         struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
>         enum {
>                 DSA_PORT_TYPE_UNUSED = 0,
>                 DSA_PORT_TYPE_CPU    = 1,
>                 DSA_PORT_TYPE_DSA    = 2,
>                 DSA_PORT_TYPE_USER   = 3,
>         } type;                                          /*    32     4 */
> 
>         /* XXX 4 bytes hole, try to pack */
> 
>         struct dsa_switch *        ds;                   /*    40     8 */
>         unsigned int               index;                /*    48     4 */
> 
>         /* XXX 4 bytes hole, try to pack */
> 
>         const char  *              name;                 /*    56     8 */
>         /* --- cacheline 1 boundary (64 bytes) --- */
>         struct dsa_port *          cpu_dp;               /*    64     8 */
>         u8                         mac[6];               /*    72     6 */
>         u8                         stp_state;            /*    78     1 */
> 
>         /* XXX 1 byte hole, try to pack */
> 
>         struct device_node *       dn;                   /*    80     8 */
>         unsigned int               ageing_time;          /*    88     4 */
>         bool                       vlan_filtering;       /*    92     1 */
>         bool                       learning;             /*    93     1 */
> 
>         /* XXX 2 bytes hole, try to pack */
> 
>         struct dsa_bridge *        bridge;               /*    96     8 */
>         struct devlink_port        devlink_port;         /*   104   288 */
>         /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
>         bool                       devlink_port_setup;   /*   392     1 */
> 
>         /* XXX 7 bytes hole, try to pack */
> 
>         struct phylink *           pl;                   /*   400     8 */
>         struct phylink_config      pl_config;            /*   408    40 */
>         /* --- cacheline 7 boundary (448 bytes) --- */
>         struct net_device *        lag_dev;              /*   448     8 */
>         bool                       lag_tx_enabled;       /*   456     1 */
> 
>         /* XXX 7 bytes hole, try to pack */
> 
>         struct net_device *        hsr_dev;              /*   464     8 */
>         struct list_head           list;                 /*   472    16 */
>         const struct ethtool_ops  * orig_ethtool_ops;    /*   488     8 */
>         const struct dsa_netdevice_ops  * netdev_ops;    /*   496     8 */
>         struct mutex               addr_lists_lock;      /*   504    32 */
>         /* --- cacheline 8 boundary (512 bytes) was 24 bytes ago --- */
>         struct list_head           fdbs;                 /*   536    16 */
>         struct list_head           mdbs;                 /*   552    16 */
>         bool                       setup;                /*   568     1 */
> 
>         /* size: 576, cachelines: 9, members: 30 */
>         /* sum members: 544, holes: 6, sum holes: 25 */
>         /* padding: 7 */
> };
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>

Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ