Nikolay Aleksandrov
2018-Sep-26 12:18 UTC
[Bridge] [PATCH net-next 9/9] net: bridge: pack net_bridge better
Further reduce the size of net_bridge with 8 bytes and reduce the number of holes in it: Before: holes: 5, sum holes: 15 After: holes: 2, sum holes: 3 Also as a bonus we get offload_fwd_mark in the first cache line and remove the need to pull the last cache line of net_bridge just for that member in fast path (should_deliver -> nbp_switchdev_allowed_egress). Signed-off-by: Nikolay Aleksandrov <nikolay at cumulusnetworks.com> --- net/bridge/br_private.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 92d08f8c7dd4..e50506225666 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -329,6 +329,9 @@ struct net_bridge { struct net_device *dev; struct pcpu_sw_netstats __percpu *stats; unsigned long options; +#ifdef CONFIG_NET_SWITCHDEV + int offload_fwd_mark; +#endif /* These fields are accessed on each packet */ #ifdef CONFIG_BRIDGE_VLAN_FILTERING __be16 vlan_proto; @@ -349,7 +352,6 @@ struct net_bridge { /* STP */ bridge_id designated_root; bridge_id bridge_id; - u32 root_path_cost; unsigned char topology_change; unsigned char topology_change_detected; u16 root_port; @@ -361,6 +363,7 @@ struct net_bridge { unsigned long bridge_hello_time; unsigned long bridge_forward_delay; unsigned long bridge_ageing_time; + u32 root_path_cost; u8 group_addr[ETH_ALEN]; @@ -383,6 +386,7 @@ struct net_bridge { #if IS_ENABLED(CONFIG_IPV6) u8 multicast_mld_version; #endif + spinlock_t multicast_lock; unsigned long multicast_last_member_interval; unsigned long multicast_membership_interval; unsigned long multicast_querier_interval; @@ -390,7 +394,6 @@ struct net_bridge { unsigned long multicast_query_response_interval; unsigned long multicast_startup_query_interval; - spinlock_t multicast_lock; struct net_bridge_mdb_htable __rcu *mdb; struct hlist_head router_list; @@ -411,12 +414,9 @@ struct net_bridge { struct timer_list topology_change_timer; struct delayed_work gc_work; struct kobject *ifobj; - u32 auto_cnt; -#ifdef CONFIG_NET_SWITCHDEV - int offload_fwd_mark; -#endif struct hlist_head fdb_list; + u32 auto_cnt; }; struct br_input_skb_cb { -- 2.11.0
Ido Schimmel
2018-Sep-26 13:30 UTC
[Bridge] [PATCH net-next 9/9] net: bridge: pack net_bridge better
On Wed, Sep 26, 2018 at 03:18:02PM +0300, Nikolay Aleksandrov wrote:> Further reduce the size of net_bridge with 8 bytes and reduce the number of > holes in it: > Before: holes: 5, sum holes: 15 > After: holes: 2, sum holes: 3 > > Also as a bonus we get offload_fwd_mark in the first cache line and remove > the need to pull the last cache line of net_bridge just for that member in > fast path (should_deliver -> nbp_switchdev_allowed_egress).But nbp_switchdev_allowed_egress() compares with 'offload_fwd_mark' from 'net_bridge_port', not 'net_bridge'...
Nikolay Aleksandrov
2018-Sep-26 13:35 UTC
[Bridge] [PATCH net-next 9/9] net: bridge: pack net_bridge better
On 26/09/18 16:30, Ido Schimmel wrote:> On Wed, Sep 26, 2018 at 03:18:02PM +0300, Nikolay Aleksandrov wrote: >> Further reduce the size of net_bridge with 8 bytes and reduce the number of >> holes in it: >> Before: holes: 5, sum holes: 15 >> After: holes: 2, sum holes: 3 >> >> Also as a bonus we get offload_fwd_mark in the first cache line and remove >> the need to pull the last cache line of net_bridge just for that member in >> fast path (should_deliver -> nbp_switchdev_allowed_egress). > > But nbp_switchdev_allowed_egress() compares with 'offload_fwd_mark' from > 'net_bridge_port', not 'net_bridge'... >ha, right you are! I need to check my glasses :) Anyway, I'll correct my commit message and resend v2. We can leave the net_bridge mark in the end, there're 4 bytes there anyway. I was thinking of net_bridge_port, but that is a different patch-set I have. Apparently I've mixed the commit messages. Thanks!