From patchwork Wed Jan 5 13:21:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12704324 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26B8DC433EF for ; Wed, 5 Jan 2022 13:21:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240219AbiAENV5 (ORCPT ); Wed, 5 Jan 2022 08:21:57 -0500 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60]:53697 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234666AbiAENVy (ORCPT ); Wed, 5 Jan 2022 08:21:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BHv60I6CANtXhl8n8tuUm8TzQZalahCdxjUBaHtwrwI6fHSk4aEw2RsG0qVBaC+11DsflSo3hDba7jPFdW0hJxywz0grgkT2E3QeAL/n80bE8PFVBsKuDN0Rt90D7pWVO3bSDkYAgBGd9wPd7iSWPV8vE474ayIjiFgNXQQtvp6+xlXSH44n5P8bV+rsLCQr4eLHUBeGF8AC+TEsoZgym2m5xwwz9Um4BKsmoAG4ARyenzWEOXwztvKJR8VtWECL3iZNDj0WTFrP4GvS8ugiScRLkhgzl3FJIvB6yIJJapal5l3VU/uvZE1SJh7ZGgMoTkqBOP7PkbmJLEZOtqMeOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oZPMTKyZaWhnzT8T/b+FyyuwxuT/r+Fxoyhrc/77PkA=; b=U3K9hwfAh7j9BMgI63UELWWu0DzuaMg2AbrrkdrSTzyDszv0bMH0+MVbGTTrAeldZeexWl5WYcPcn2Rwm1lRy4Xe3fbaDCvbohsIKtY9n1bJoaFC4Ak7fX4Pvd89RU7CjLcjoO2O7Gvsm6yI/sEWqA9I1nmG0XrfR1H3m4kruEWf3Ate+ORwHP9Qpaia/rdRlr+XJvK/livYBp7cXcCNL3hmpNdIhZY/Spetbueac0BrA5UFeBgblM5BwD6ZcGTCY+1GCIDKA+i5hj6sr+bHrSzyiHmmsQKAwNK3gUkpa60xVjP8zR9X5Mxwf7zlX0EnQ24sLU9DpwoQBMxO45yVww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oZPMTKyZaWhnzT8T/b+FyyuwxuT/r+Fxoyhrc/77PkA=; b=Veq5kXFFjXAUYbIOadwbBF9Zepq5HRj4BnEh+Vd10LUUg/jI5YUxmMUCpyWnZXzj30AhV9oaQDZOVvOq1QEfE7jpcWRc5HDdicXqdtov6zPecNKiuOwRR+GZQSds1jsw/IZ/4jxAWbeCK2JC6/QutMfrgmMCfPDAxt56J6RPtbA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7408.eurprd04.prod.outlook.com (2603:10a6:800:1b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Wed, 5 Jan 2022 13:21:53 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226%3]) with mapi id 15.20.4844.016; Wed, 5 Jan 2022 13:21:52 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli Subject: [PATCH v2 net-next 1/7] net: dsa: move dsa_port :: stp_state near dsa_port :: mac Date: Wed, 5 Jan 2022 15:21:35 +0200 Message-Id: <20220105132141.2648876-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220105132141.2648876-1-vladimir.oltean@nxp.com> References: <20220105132141.2648876-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS9PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:20b:467::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 281d31f3-f323-4969-d3f7-08d9d04e5683 X-MS-TrafficTypeDiagnostic: VE1PR04MB7408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r4Un6uvD6DrENWt/5cev020YBBzIYFa3j9GeGMQqcsfKBW6zun5zTRF1NTtZ6QBaHISJV/vwAldS4Ef5XnDQsqGzHsv19p0v2YYIuVKOka8N/SxXvTybD/WrbtGYSJHtocz5TNVht/POYFP7fyYnnRx1Rf3FCa5juRE/30skw7A9QecrxKZa9SvYhdF9UcH3AQqxu/BPBXhP4kcMAy3WKHMAQRSmRECHQshWtaW+H1RN3R6GiFUlPLtRG28O63rG/L7ZeOPw7+oXUJaKho+JkTVzPi2aBHQlTiXBjah3DD/HA0M2v1iMKyPdcGKE7eDwbpAKjGMtHGlTd0n0VhOBJwg1ZBX8mf236VS0QkD0gT+azEBaCdX4b2Mm9BybV3l3AWYSVvGuVb1DAqjSs/ef5YhXAQ239FUnBqlYroxCTqm3IlUssSXc96laSIMHxycz2rBEnOCoZG4KgW68zbVHP8gAFIBPf+1jDESZYRpkfrEn//k5qiXYDUwVS82ykPietISoMLW3Arb9ywpl1A9bhN5dlqwIsgI+4SHjmjTHcF4ltoCI019fFmrkuDZh/AgKudH3V+nDdWq78n+ietI5Vd7zIB8w2SLWb01rtnO7WUGhR9yIFisHN+mZb8Ak94WTeYzCbEW2Zx6Dcq9Zk8XNrUK2zKJ31erQApRvvuoRRSLyQ8K9NRziEFLFElx8Zg/D5iIg02tw86VYZJkGTGDZQOTcRXRzLMkq5QYZsww6X9A= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(66476007)(8936002)(38100700002)(38350700002)(316002)(36756003)(2616005)(2906002)(6486002)(66556008)(66946007)(6916009)(5660300002)(44832011)(83380400001)(6512007)(508600001)(86362001)(54906003)(4326008)(8676002)(1076003)(186003)(26005)(6666004)(52116002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dy1QWuYOYvFdc0ky6Cslu6eLPTJ5Bj2aEQH0ZznNEYHol0n3kjb9zBkZJ7MEqiCxiUABD7MjoS/X8qn8BUawaIlHVxghHNCkd9U4jhNk8XEAW161LR3DxYnOZBnJ6smweSCVQ0sHqUunGRNKMUH1Bs2Sd4EWxaZ6gcM9O9y9pqFHEHBHPo6gyn82pJSck+fwc2PqTrEz3jAuRjumqL7JCaZWo8iSCFTDt/ZNfP6H/7nyEdkpkqFdezX1jSK3TK5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WyCGu4aT2AYTCN8ZgK2s5FkPnc2jErmGCRgij91VjGIzb+Oj0apCeXsk4YsilETkuyyZczgfCWH7+7cmTCnsEFL90r8dYgNwTQN8khORz1SzQda2vQzeDTLzT0Oot5DbL/i3sUvbkP/YPU/2Zx7KGaEXZxkbdt10LzpW62bVC3YCg3wMQUYm6jekS0Y3npttslBu5YZuVIgAuXD9Kjwpix0H/WIx3ZXtOF3SzrSzD2SFWoL5raCbJiraiOzL9AmGjpx5v2cibCMeux7M0MIWFy+gdHZG6E08qeSCaiUUnVdWtLJ/CeKmxc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 281d31f3-f323-4969-d3f7-08d9d04e5683 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2022 13:21:52.8704 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: frcUlzsEUNlSPMBA0Wjn3RMA/767lnw9d14qNo3KgEnhVM/hky6nP6ZZRNqv1HtDoleVBeK1UdvTHlRzN3jcmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Reviewed-by: Florian Fainelli --- include/net/dsa.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index f16959444ae1..8878f9ce251b 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -258,12 +258,14 @@ struct dsa_port { const char *name; struct dsa_port *cpu_dp; u8 mac[ETH_ALEN]; + + u8 stp_state; + struct device_node *dn; unsigned int ageing_time; bool vlan_filtering; /* Managed by DSA on user ports and by drivers on CPU and DSA ports */ bool learning; - u8 stp_state; struct dsa_bridge *bridge; struct devlink_port devlink_port; bool devlink_port_setup; From patchwork Wed Jan 5 13:21:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12704325 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DB68C433FE for ; Wed, 5 Jan 2022 13:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240259AbiAENV5 (ORCPT ); Wed, 5 Jan 2022 08:21:57 -0500 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60]:53697 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234458AbiAENV4 (ORCPT ); Wed, 5 Jan 2022 08:21:56 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwVqeWSvaTKIQDncjlDNxj4OkYbMPtV2pFAshP3OVP+J443ijiQgqT4v26tLyCvBDAL3iCLAZqaE7v27p638oH/kYuyOP1rbPpquLOCLjdhk0HcUrpz4Zl6zJwGRlD7hcRCNcWftPgpmP+vXeXtZJeKoPKBTCIJpVA2BLBAUx0PFsOxn89EQHm6ZJiTp+AwRoPHTzp1OBx1I2C3RuBt4A1Vipq8T5M3SjHiXlzcCyVnnWjuE0RlRdHAEhBqcTEFGw/TvQvsEy4R/JYuzRCXjeoWzxr/Lv68w0YfZIcMr2s0yLxKubk6dOUgzpHsxZJvuY2nCmP0XYtnBJkPLurPr4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z26c5Hm9BM3R9Ri0xrzsaCOXV+PbNTah+U5ZyoIK0Ss=; b=X5V5ACjtINKJkAkS3d/XvJOl8mctJsR5fWoB7567UyrjxaHJqDW+ia1JQ6eL0XM08bvnCywUFDTUL0q/en14yxySUo13Z37qjoC/kgBaDvZmEhw/AnqRtbFFwm5ili0T8O0P24oczgTgA5owlU0TAjGf03leDdlUm4g7d7eFCDhJ5xYa3IZTPPxSJ4py3flR11BEO/B2uwhS4khZwayaFs/ujinMT5XtPobwJVDUzCKfX4FXUvT0vVBkU3HCXuU9hoJvVAPOw52IIehabFWLHk1PLX8xU8RAl2SmFUXGaNvuLIb8RJ5pjj8cQlZ7UUzuAoCRPd9VtieP07Jv8yMTMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z26c5Hm9BM3R9Ri0xrzsaCOXV+PbNTah+U5ZyoIK0Ss=; b=bB52zRtrOVOYlhMUicxn6Uz10uhAZhNqWcPV0scE1j4e3nCkG1KByhopET/uv2KoJ5X9v8k0RfYN64z5/vk0ajs/qnC8GD4VfnOH6grpgJbcXqkpX+8NcQcadtEgdwzPUNGrQvE7tvMhgYCKJceDfUNcCZsMyy7prPYdkiY6eZw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7408.eurprd04.prod.outlook.com (2603:10a6:800:1b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Wed, 5 Jan 2022 13:21:53 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226%3]) with mapi id 15.20.4844.016; Wed, 5 Jan 2022 13:21:53 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli Subject: [PATCH v2 net-next 2/7] net: dsa: merge all bools of struct dsa_port into a single u8 Date: Wed, 5 Jan 2022 15:21:36 +0200 Message-Id: <20220105132141.2648876-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220105132141.2648876-1-vladimir.oltean@nxp.com> References: <20220105132141.2648876-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS9PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:20b:467::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93ffef7b-1c42-4c51-909a-08d9d04e5704 X-MS-TrafficTypeDiagnostic: VE1PR04MB7408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Tx46F0QKyjYgsRmYPq0/dGlBy6/IgYF0HEXWkg+t8OsXtxV24m2hIOFIDlds08wwxFsd/FZ3YeO1asgY7mjVUKvG1mn7I4om/XVS7dWgMucaKp6+eAQkaNgrKyQDfSfuqS2rRYKG7fXKKBvJVKX/uQoLAOCt2tNfx+vlena3eECN753C2orq0u6pOSD2bdPAretASUk1F7nLiAziHBNf9wTf5NJrTIi5L1mY7qoLxM44S8TKJZmXapFz/cudOJB8fDSr1Pc73N3AN/x7HBCl79e8g8ST02SHiOYrefXIFljfrqcUhXQQaWLjrAN/9EB1qUjUb1+zlBmiKqMjLRcJ6Ca7xS1fYXISOuM26sBuIfBxrQBYpG64EfYwLIxGR35ACozh7cEDb/a1+hI4c8/dSJt09jg3D64Uv9dLoMBydxQnNhmHyxcTT5ro9APGO70bLnDYzFlMJVagdN17iy/xxBkC7ryDEfQ8RQJjITeSSp3rKyUCYHiYXv6vcQSytfl0pNrf4DVMlRBt7REJRwctAM7S9mp3dXQqYp/pl8UzLcurATpF3MQDRWrydlTkLtuP721WXTqu4bHYfTT403xCa0tBU36HlONPVrhEt5lv7RH0JZw0hIZSXRx656O/QgydxTKbng3csf2qoKVuO0aXhptbEgMuE94xIdfGfZ4cqPxrVGQI4ckGeH4fmSDHblBCr3oBOsT/9Z9N1c5mnHjrOs6jr9mRSt5RBqEjiFzknc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(66476007)(8936002)(38100700002)(38350700002)(316002)(36756003)(2616005)(2906002)(6486002)(66556008)(66946007)(6916009)(5660300002)(44832011)(83380400001)(6512007)(508600001)(86362001)(54906003)(4326008)(8676002)(1076003)(186003)(26005)(6666004)(52116002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: at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KBzh58N3bVGZo6t0pNAF3+NetyhngHfR+jRILvr/aX9QTjsHiiZuvxewQs8u+z7YnfvyDicXEiNex0vmz6H/Dh2eiEZ9FvkCNNq4GHKDI8aXXnSbosaqSRyRQg5QZRXkl6ve+klgwhBg2vLyCiqeM3JyJ1mwbDvdrAn1iMnHzWp5PsslXuVVjgI8vUDkEizpeBRpVxZZ/yB/WQZvWREu2n3W7S/wfU43+5wPsmKm5Rbz5qjK6ktJ7yydDwL2d/8lAlJMcEn43TM1udmcX0tDzQyTmQYI7I4i7CIJt3fDDQouEjJHLpsohBoc6o+t92RkQuydasHrJ2aF0y64bHtBJY40CwXlzIXZeE+3fty6/9O23s2xMAEjAyC6FUA2rQuhs+IxVsdeykIlIoAYPXXyIfPhSLbsu6V2Qmuui16kjFwwjG8ACVOze3RSOEDEWjEsaB9tLYFsUh2pVkDPnGOaUvImP3+IxnYCiTCpehYvz42/mpO47+NPnSTZSzd23vfpDG51Pq9dCOgRumg1jMfaDwLeBth/mpe5Qg3h+7pEoWxZcVHFeT6fIoevU= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93ffef7b-1c42-4c51-909a-08d9d04e5704 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2022 13:21:53.7297 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x71JlRdcHzO56qt2je3w0h5jivH4l033xnStmlD0mhy7JXg6jPKPcwvHhqvXI9B0lhzo+KeOk1qNheMsjlZkcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org struct dsa_port has 5 bool members which create quite a number of 7 byte holes in the structure layout. By merging them all into bitfields of an u8, and placing that u8 in the 1-byte hole after dp->mac and dp->stp_state, we can reduce the structure size from 576 bytes to 552 bytes on arm64. 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 */ 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 */ }; 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 */ u8 vlan_filtering:1; /* 79: 0 1 */ u8 learning:1; /* 79: 1 1 */ u8 lag_tx_enabled:1; /* 79: 2 1 */ u8 devlink_port_setup:1; /* 79: 3 1 */ u8 setup:1; /* 79: 4 1 */ /* XXX 3 bits hole, try to pack */ struct device_node * dn; /* 80 8 */ unsigned int ageing_time; /* 88 4 */ /* XXX 4 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 --- */ struct phylink * pl; /* 392 8 */ struct phylink_config pl_config; /* 400 40 */ struct net_device * lag_dev; /* 440 8 */ /* --- cacheline 7 boundary (448 bytes) --- */ struct net_device * hsr_dev; /* 448 8 */ struct list_head list; /* 456 16 */ const struct ethtool_ops * orig_ethtool_ops; /* 472 8 */ const struct dsa_netdevice_ops * netdev_ops; /* 480 8 */ struct mutex addr_lists_lock; /* 488 32 */ /* --- cacheline 8 boundary (512 bytes) was 8 bytes ago --- */ struct list_head fdbs; /* 520 16 */ struct list_head mdbs; /* 536 16 */ /* size: 552, cachelines: 9, members: 30 */ /* sum members: 539, holes: 3, sum holes: 12 */ /* sum bitfield members: 5 bits, bit holes: 1, sum bit holes: 3 bits */ /* last cacheline: 40 bytes */ }; Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 8878f9ce251b..a8f0037b58e2 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -261,18 +261,23 @@ struct dsa_port { u8 stp_state; + u8 vlan_filtering:1, + /* Managed by DSA on user ports and by + * drivers on CPU and DSA ports + */ + learning:1, + lag_tx_enabled:1, + devlink_port_setup:1, + setup:1; + struct device_node *dn; unsigned int ageing_time; - bool vlan_filtering; - /* Managed by DSA on user ports and by drivers on CPU and DSA ports */ - bool learning; + struct dsa_bridge *bridge; struct devlink_port devlink_port; - bool devlink_port_setup; struct phylink *pl; struct phylink_config pl_config; struct net_device *lag_dev; - bool lag_tx_enabled; struct net_device *hsr_dev; struct list_head list; @@ -293,8 +298,6 @@ struct dsa_port { struct mutex addr_lists_lock; struct list_head fdbs; struct list_head mdbs; - - bool setup; }; /* TODO: ideally DSA ports would have a single dp->link_dp member, From patchwork Wed Jan 5 13:21:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12704326 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D814AC433F5 for ; Wed, 5 Jan 2022 13:22:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240269AbiAENV7 (ORCPT ); Wed, 5 Jan 2022 08:21:59 -0500 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60]:53697 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235186AbiAENV5 (ORCPT ); Wed, 5 Jan 2022 08:21:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QgSRq5umjdKmb3zESq34POGbhfe6ZF/I6yImtg9VOvFVNsf5aA5wxfxdGLZ/vql3pAT79s/YKr3JFvFupd9PEpMUwODxqmwGgp5lidmPOUvceFBre2ZCsj7t7pUduLkX1nfh7fDtbjwsDcshbCchIIYTgrWR3w6kqJxmies/qmpUiaPj6iK7wRsEOAA2yv+6PKFee4WQMnJsXkSl5E//c54q6YXeI5KYqtHhawmNqNMAltABaJSvrND9EGXVANDwvOtZdXRzC+u/iek47Wiwx/6JdX1ix1yTGYWBgo3iJpHwCAdHEzFEYEwPxUsVe3UBA6MZZvBhCwprSfCRFW/zNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v78TTxDRv5KP48eXVu+ERE5yLA062w4etMoW1ObC4v4=; b=fp19wscdI+xzP6om9cV71TSkfBZ9cigjTtkrcu6KiSP50/zdozaMF8d1RqsaN6dyFdphspBrblgwFz23qHU0LSgXGn/R+HSETDGWMXSuETky3CAFDQCQw6etFxDgiFxg9YwyRLRsj5JHRP4FSgdZ1mLNcOCkvDsVOxn4IZNEU/NH5Iug5+A2o3eOqELID0G5QXgATDFTEUWohuxFs6u5Ss4nYM91RGBKBqT2OX5DEkRcRS1RrhfmwY0idDmSlk4iM95S8aZfwumonn4z8XcXMnTWQcpQMwwCiAbiIPxq4omIUy2+za9ZX8Rr37HMm65dpj1b7wD8k/qyTPQ7JCV5Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v78TTxDRv5KP48eXVu+ERE5yLA062w4etMoW1ObC4v4=; b=Iw4e4EM57h7yNx+n4moOIfhDv3qJt2EpHriMbEoksZrPyOPZS4I+8uv0cEKxhG4ZWd2BeQx4FeCLWTUBIqzWHLDMhgcVmCCJItUHZ7hceX9vDLrwbGjH8ZXjzUl896PjkQ3jurWFoqiARY9gNCs9F+ypU9u6PoP9nGnvP9yyxNk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7408.eurprd04.prod.outlook.com (2603:10a6:800:1b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Wed, 5 Jan 2022 13:21:54 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226%3]) with mapi id 15.20.4844.016; Wed, 5 Jan 2022 13:21:54 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli Subject: [PATCH v2 net-next 3/7] net: dsa: move dsa_port :: type near dsa_port :: index Date: Wed, 5 Jan 2022 15:21:37 +0200 Message-Id: <20220105132141.2648876-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220105132141.2648876-1-vladimir.oltean@nxp.com> References: <20220105132141.2648876-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS9PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:20b:467::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54dfb5a0-5963-45f2-4d3a-08d9d04e5785 X-MS-TrafficTypeDiagnostic: VE1PR04MB7408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yKc8d72s0cQy9Yt/024xUSxq4iWR/Lj4Ghoq4MT6YcBnZFxbOuXj778a7j6500W8HHLv7bQ6Qs/wae4yUSGv3DFHtdddZL/fe4OsosfGIYe2A1ZcZPSRV9piTyuxX8J63EujA3FUAt4Wu+wUgSDokuok4j+D+bXmWNYRFHvwnavt/hqlR2yxVE9rZ2Mh5pB8rQeHOioXSK7Z9f8SzMR8r0qiH49gBzvH+ltVVh7cQI/3rbgZZ/DRYP8s8y/w6hNnHxX1CWV3IMGzMsdsGDW1ODMvlduOFci3CF9M/QWkfjc+m7GkCaL05zZ8JsMDPYQU5aInA14uIR0JZA+/0uGy6B3AbDxUFGOUEJ9ioVUvUMuEF9KfEFAM2+rOTz6xpXZ6mi5oYmB1AT7gx4lw29+u8cDszr1pCA0U1uL+t7UMAE+CcFqCDj2AQsaT+CmVi/3u+XKH7hv7x/aOcfxstXf74vZNGvw4xmG0oZQ5q0UHCBPfpl2BI3qZ6IvlnntnKzUSwwfjUE1XX8FrWfKlEEDXco39VHkHKr1X4DmSoP/eVmeC/gLUHr8xu9TJd913cHzZwi/Xj9oJsQtKCcWpng+qfRUBRkpzOd6n58bzVJWx82pXGNqzYaKYOQ31B8IZ2Z0BrwT/1kj58jR/ufdn9VAXWLkAEOU4wU2GtdxuDopFyiSdWf29a0nhshyo5rRKNYh7yXtnHiUqqRfdcTrdE757NemNl2LmLRLog66S1Z+JnPk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(66476007)(8936002)(38100700002)(38350700002)(316002)(36756003)(2616005)(2906002)(6486002)(66556008)(66946007)(6916009)(5660300002)(44832011)(83380400001)(6512007)(508600001)(86362001)(54906003)(4326008)(8676002)(1076003)(186003)(26005)(6666004)(52116002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4KvCFOsMOgYeWmJ9tmJHhp1pNpyU6a2eh8ALlMqJ9frRUv2uwBw77P+9bb550EB6SGarnk4ScEpkF6Uvh5XVZ9LXyRlFH1acHKNd/10LTJLJ33w59W7PTGZywSScQdlJP4QytueyXRqkfymoABT54cR8zzKaPpmslquRQbQyAL4Do8x3AyKwuXQ0g7axlwNW90GkTL2hojAp36QwW4giF1yUAh4MAmcdsvXUhBKL44NiNoeXhUkI+hZ9FyXQAXvZClLxMna6AaKSYuMvDeF5T1tTdP1rAIM//ss74XI5lSh63nhLB3HrR8nBiHoUwaRPbtfrufM2mJoyWMIBcr+IwJ+2G71/zKBi8NbM4YNY9Ll0JEn7JrdK5amQ10TpDAmMV+UwxOkM0wThqqiYvOAor+WxTk88Ub0reKsFUW/eZFRvt2NJAIze3T7yxdhTujy6N0ufVAw2p/AcF4KbIkPIFIPir+mYIOwmEda2POzjGXXfqc8i2qfU2PTpRTWSahMCiR2rF0NwKzYj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JN1L+PSdNoBr96DvnRoE6Ncfx4u1J+9d4NRyiXsK+qlcWkw= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54dfb5a0-5963-45f2-4d3a-08d9d04e5785 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2022 13:21:54.5422 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Cd80f5Sw4rLAPZNFb9xgYSHC1oSDHlU2+uQ4hfv7vSwAK+RXYbfUofbVjX5kYvMikYq9RG48bzeA0HidC2zT+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Both dsa_port :: type and dsa_port :: index introduce a 4 octet hole after them, so we can group them together and the holes would be eliminated, turning 16 octets of storage into just 8. This makes the cpu_dp pointer fit in the first cache line, which is good, because dsa_slave_to_master(), called by dsa_enqueue_skb(), uses it. 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 */ u8 stp_state; /* 78 1 */ u8 vlan_filtering:1; /* 79: 0 1 */ u8 learning:1; /* 79: 1 1 */ u8 lag_tx_enabled:1; /* 79: 2 1 */ u8 devlink_port_setup:1; /* 79: 3 1 */ u8 setup:1; /* 79: 4 1 */ /* XXX 3 bits hole, try to pack */ struct device_node * dn; /* 80 8 */ unsigned int ageing_time; /* 88 4 */ /* XXX 4 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 --- */ struct phylink * pl; /* 392 8 */ struct phylink_config pl_config; /* 400 40 */ struct net_device * lag_dev; /* 440 8 */ /* --- cacheline 7 boundary (448 bytes) --- */ struct net_device * hsr_dev; /* 448 8 */ struct list_head list; /* 456 16 */ const struct ethtool_ops * orig_ethtool_ops; /* 472 8 */ const struct dsa_netdevice_ops * netdev_ops; /* 480 8 */ struct mutex addr_lists_lock; /* 488 32 */ /* --- cacheline 8 boundary (512 bytes) was 8 bytes ago --- */ struct list_head fdbs; /* 520 16 */ struct list_head mdbs; /* 536 16 */ /* size: 552, cachelines: 9, members: 30 */ /* sum members: 539, holes: 3, sum holes: 12 */ /* sum bitfield members: 5 bits, bit holes: 1, sum bit holes: 3 bits */ /* last cacheline: 40 bytes */ }; 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 */ struct dsa_switch * ds; /* 32 8 */ unsigned int index; /* 40 4 */ enum { DSA_PORT_TYPE_UNUSED = 0, DSA_PORT_TYPE_CPU = 1, DSA_PORT_TYPE_DSA = 2, DSA_PORT_TYPE_USER = 3, } type; /* 44 4 */ const char * name; /* 48 8 */ struct dsa_port * cpu_dp; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u8 mac[6]; /* 64 6 */ u8 stp_state; /* 70 1 */ u8 vlan_filtering:1; /* 71: 0 1 */ u8 learning:1; /* 71: 1 1 */ u8 lag_tx_enabled:1; /* 71: 2 1 */ u8 devlink_port_setup:1; /* 71: 3 1 */ u8 setup:1; /* 71: 4 1 */ /* XXX 3 bits hole, try to pack */ struct device_node * dn; /* 72 8 */ unsigned int ageing_time; /* 80 4 */ /* XXX 4 bytes hole, try to pack */ struct dsa_bridge * bridge; /* 88 8 */ struct devlink_port devlink_port; /* 96 288 */ /* --- cacheline 6 boundary (384 bytes) --- */ struct phylink * pl; /* 384 8 */ struct phylink_config pl_config; /* 392 40 */ struct net_device * lag_dev; /* 432 8 */ struct net_device * hsr_dev; /* 440 8 */ /* --- cacheline 7 boundary (448 bytes) --- */ struct list_head list; /* 448 16 */ const struct ethtool_ops * orig_ethtool_ops; /* 464 8 */ const struct dsa_netdevice_ops * netdev_ops; /* 472 8 */ struct mutex addr_lists_lock; /* 480 32 */ /* --- cacheline 8 boundary (512 bytes) --- */ struct list_head fdbs; /* 512 16 */ struct list_head mdbs; /* 528 16 */ /* size: 544, cachelines: 9, members: 30 */ /* sum members: 539, holes: 1, sum holes: 4 */ /* sum bitfield members: 5 bits, bit holes: 1, sum bit holes: 3 bits */ /* last cacheline: 32 bytes */ }; Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index a8f0037b58e2..5e42fa7ea377 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -246,6 +246,10 @@ struct dsa_port { struct dsa_switch_tree *dst; struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev); + struct dsa_switch *ds; + + unsigned int index; + enum { DSA_PORT_TYPE_UNUSED = 0, DSA_PORT_TYPE_CPU, @@ -253,8 +257,6 @@ struct dsa_port { DSA_PORT_TYPE_USER, } type; - struct dsa_switch *ds; - unsigned int index; const char *name; struct dsa_port *cpu_dp; u8 mac[ETH_ALEN]; From patchwork Wed Jan 5 13:21:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12704327 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94118C433F5 for ; Wed, 5 Jan 2022 13:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240268AbiAENWD (ORCPT ); Wed, 5 Jan 2022 08:22:03 -0500 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60]:53697 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240256AbiAENV5 (ORCPT ); Wed, 5 Jan 2022 08:21:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByH/fbOKuOVym89GNdt4UzZeefYYRRj0dmc8cpysVou1LM04nc6NK0FXduTr150ciaeInmDUlomdOKPkoDkplXxZt/WkRej6U8uqSMeYdCmqSHsGciKA3P6GyPvJhWrsUc4DA884H9vfD9fu1/YOmTqJraJ6vIaBxiBHcXs99ZY3twib0/rS0oKRg3wayEIig+PS/DBZOddVmPcavMrCj4okxWfs8Lst35p6Tggv6Znox7gDuN0H1M9sCGhq5iBUneYWwJMlY4sr5a0QnzQ0QwhgqL39iZg66IYeI3YK9DRsQSsBgdB396jpbBO4M/2rT3qqT3uohxhY9kzkM5/k1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4r/+JADHi7tHwdY3uObPHJE1fi4/O02LFgLf0E7kLao=; b=lH9U+OoS4600UchAFI+KeobWm0451N0g6hOsT/ohaiyWVeRCuaPhz5LhqdBX4lhtG2owRQl/r/AlLeT5e69Lcmpswk/DDq3SF8YVmBEM1i/GezjzPm0+YrhTU/ys8fd429YqXIgQtfrZ8FP1tTPVugl0b899TxPO1QKg2WohwUVoJ85nMUdPxqGC2QLLrB07fk/KZDPCXEjhBStU6vo/PWCEyegxAizYHOVN/n6fTlCi1qbJBCbZyu/n0MLYbbySUKgrSlTfJLK2wyFZptvk3XNLYt4GCXLiX45VFRkYvCnom3Dt/oxkRxS7+YZ2h48iuWCpazcJiqTu+fFuAzWf9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4r/+JADHi7tHwdY3uObPHJE1fi4/O02LFgLf0E7kLao=; b=Cbj/5M9k7fCpuoHbOtXsNJ+ho5zCH9/msRJlCgQq7puEcSc9LwV/HCGMXepkCwKi/Oh5YCbKbdkwVVQi8xnflUmhFv0/UgCl/6VpQwbvIuxldViXEDICSPIgoU/Ym8PrEfJRhIqpw2s1fP0ynhbBgHYggtZT/4UBPuLHbL58aMU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7408.eurprd04.prod.outlook.com (2603:10a6:800:1b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Wed, 5 Jan 2022 13:21:55 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226%3]) with mapi id 15.20.4844.016; Wed, 5 Jan 2022 13:21:55 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli Subject: [PATCH v2 net-next 4/7] net: dsa: merge all bools of struct dsa_switch into a single u32 Date: Wed, 5 Jan 2022 15:21:38 +0200 Message-Id: <20220105132141.2648876-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220105132141.2648876-1-vladimir.oltean@nxp.com> References: <20220105132141.2648876-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS9PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:20b:467::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eafe07a3-1dda-40ee-6c2b-08d9d04e5808 X-MS-TrafficTypeDiagnostic: VE1PR04MB7408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j4DGii3L7KdCQ6NdVi0cAvcvt+GmzRWePv7SBkMcepvp4EnCdVS1Q7ooy86tIGwlfBo1YWPExKeY9tu/zrj1GhSgS3F9C3OP6cJRSUo0UnHlEL+uxTkZxHCfiQNmZ6YwvF5r9OGHOv0qUgV9fjKka+VMuP12aKnFPsfi1DX2NGEIYAQqrQqplx3k/M2Fx4lR17SMvdY3KcNeNSKGgGFEHB5Z5tBbNRlb66ZkXKrC9owIPmYAWRE0F6S+J2y52AMOhiVWEMqJ7JIjokKm3wYrsgW8zdjX8KSPN9W4Wd6HOfy+llLZ8seSSlLp1GpKGb5b+z5GJCpksjP57S4XazCrSghH/7d0GamRVU0xXo6hOr7gS6kBrpGIT2trFhDzqe1LJdZUR3D8KQv8Ku9wKQVgMBA5QnPej8SDkthLylkMo0bTJxyzWEkAfjtGBeyQLov/KzAmXW8rl0mcB9aIIcett1U2Lo3NVqB86Q68HeKTQHn60eG9mEa2lwHTQawhh09Y+oQVUmJQbsRkcybNbNRa1EaZmZFM1vKIUjDNr0vDSvZIqwjAC5WshRIUlldRYdL9bJdms5ibrX7qIyW95bcmhNf3QH1TmGij2l11TmU7Td9RVl8/jd5cjzVOotJw6C6WtWeMWjFJaBwGugipqRlnJv5duPBEKZ4/0ehLWnJP1QLY+xlyr8w8BGzYSm1UJLtWu6MQ366IITGx/dHexwPMgHa+LsUfzCIl4wjGTkgb0lQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(66476007)(8936002)(38100700002)(38350700002)(316002)(36756003)(2616005)(2906002)(6486002)(66556008)(66946007)(6916009)(5660300002)(44832011)(83380400001)(6512007)(508600001)(86362001)(54906003)(4326008)(8676002)(1076003)(186003)(26005)(6666004)(52116002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WqRVrqCnBir4mZPcePdMUvvizuYfolOYgMiIaKJVxxuktdWpx515EyCQOBipNIRsWcK8qb2qFW5l61K30KNc3UewjydXId1ccGttpA4US8vWeVBX6chxXLCQH2I1B0wWtOZyXsz3siaFvhXWx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365GcMeNG1elTJLebEKrITTrpIOWjb5HGpvzXSe1Pg4nfCh0a/Ix8ZfHonJ0kHdnwhExwZK/EInOeie4NL8t0DnbK1pBZkp1IIFOWUuZTa/OUzwmbRLzk+eX97kX4maU+XiztVjAxRK3dD4u237RBw15n9eWORMYqT3546I5PjLNYqp+8PCKhW5B4HFZPLf8QGWkOnKCmIVwDILAABJ7gVnAzj2e490mUzUetS4pkDBgeGtGkaSUcDo83qVF2sdS9xrFgJ7bkolEtBHoppKE/XXsZSxFC2J5XwFv0HwP5T8dojH2voBA/AC4LD5lFV/R9qfsKFv82cZg+Wni+6nfeSscObI5zZTtufazziTJlycESaHMURJTOo04DhcIYXKqepWtdaHae6kc0k4DqaVAw2pd9TkkWG05GPh3M5UTs4B5o= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eafe07a3-1dda-40ee-6c2b-08d9d04e5808 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2022 13:21:55.4327 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TEVGfUobE/iT0BRo4SArR38eyCjzVNphdIq+FHHUieDIdDAEU08nWSZbrZv/pzlm4ev/bxE0CqzTv9D7ZpcAAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org struct dsa_switch has 9 boolean properties, many of which are in fact set by drivers for custom behavior (vlan_filtering_is_global, needs_standalone_vlan_filtering, etc etc). The binary layout of the structure could be improved. For example, the "bool setup" at the beginning introduces a gratuitous 7 byte hole in the first cache line. The change merges all boolean properties into bitfields of an u32, and places that u32 in the first cache line of the structure, since many bools are accessed from the data path (untag_bridge_pvid, vlan_filtering, vlan_filtering_is_global). We place this u32 after the existing ds->index, which is also 4 bytes in size. As a positive side effect, ds->tagger_data now fits into the first cache line too, because 4 bytes are saved. Before: pahole -C dsa_switch net/dsa/slave.o struct dsa_switch { bool setup; /* 0 1 */ /* XXX 7 bytes hole, try to pack */ struct device * dev; /* 8 8 */ struct dsa_switch_tree * dst; /* 16 8 */ unsigned int index; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ struct notifier_block nb; /* 32 24 */ /* XXX last struct has 4 bytes of padding */ void * priv; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ void * tagger_data; /* 64 8 */ struct dsa_chip_data * cd; /* 72 8 */ const struct dsa_switch_ops * ops; /* 80 8 */ u32 phys_mii_mask; /* 88 4 */ /* XXX 4 bytes hole, try to pack */ struct mii_bus * slave_mii_bus; /* 96 8 */ unsigned int ageing_time_min; /* 104 4 */ unsigned int ageing_time_max; /* 108 4 */ struct dsa_8021q_context * tag_8021q_ctx; /* 112 8 */ struct devlink * devlink; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ unsigned int num_tx_queues; /* 128 4 */ bool vlan_filtering_is_global; /* 132 1 */ bool needs_standalone_vlan_filtering; /* 133 1 */ bool configure_vlan_while_not_filtering; /* 134 1 */ bool untag_bridge_pvid; /* 135 1 */ bool assisted_learning_on_cpu_port; /* 136 1 */ bool vlan_filtering; /* 137 1 */ bool pcs_poll; /* 138 1 */ bool mtu_enforcement_ingress; /* 139 1 */ unsigned int num_lag_ids; /* 140 4 */ unsigned int max_num_bridges; /* 144 4 */ /* XXX 4 bytes hole, try to pack */ size_t num_ports; /* 152 8 */ /* size: 160, cachelines: 3, members: 27 */ /* sum members: 141, holes: 4, sum holes: 19 */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 32 bytes */ }; After: pahole -C dsa_switch net/dsa/slave.o struct dsa_switch { struct device * dev; /* 0 8 */ struct dsa_switch_tree * dst; /* 8 8 */ unsigned int index; /* 16 4 */ u32 setup:1; /* 20: 0 4 */ u32 vlan_filtering_is_global:1; /* 20: 1 4 */ u32 needs_standalone_vlan_filtering:1; /* 20: 2 4 */ u32 configure_vlan_while_not_filtering:1; /* 20: 3 4 */ u32 untag_bridge_pvid:1; /* 20: 4 4 */ u32 assisted_learning_on_cpu_port:1; /* 20: 5 4 */ u32 vlan_filtering:1; /* 20: 6 4 */ u32 pcs_poll:1; /* 20: 7 4 */ u32 mtu_enforcement_ingress:1; /* 20: 8 4 */ /* XXX 23 bits hole, try to pack */ struct notifier_block nb; /* 24 24 */ /* XXX last struct has 4 bytes of padding */ void * priv; /* 48 8 */ void * tagger_data; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct dsa_chip_data * cd; /* 64 8 */ const struct dsa_switch_ops * ops; /* 72 8 */ u32 phys_mii_mask; /* 80 4 */ /* XXX 4 bytes hole, try to pack */ struct mii_bus * slave_mii_bus; /* 88 8 */ unsigned int ageing_time_min; /* 96 4 */ unsigned int ageing_time_max; /* 100 4 */ struct dsa_8021q_context * tag_8021q_ctx; /* 104 8 */ struct devlink * devlink; /* 112 8 */ unsigned int num_tx_queues; /* 120 4 */ unsigned int num_lag_ids; /* 124 4 */ /* --- cacheline 2 boundary (128 bytes) --- */ unsigned int max_num_bridges; /* 128 4 */ /* XXX 4 bytes hole, try to pack */ size_t num_ports; /* 136 8 */ /* size: 144, cachelines: 3, members: 27 */ /* sum members: 132, holes: 2, sum holes: 8 */ /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 23 bits */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 16 bytes */ }; Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 97 +++++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 5e42fa7ea377..a8a586039033 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -321,8 +321,6 @@ struct dsa_mac_addr { }; struct dsa_switch { - bool setup; - struct device *dev; /* @@ -331,6 +329,57 @@ struct dsa_switch { struct dsa_switch_tree *dst; unsigned int index; + u32 setup:1, + /* Disallow bridge core from requesting + * different VLAN awareness settings on ports + * if not hardware-supported + */ + vlan_filtering_is_global:1, + /* Keep VLAN filtering enabled on ports not + * offloading any upper + */ + needs_standalone_vlan_filtering:1, + /* Pass .port_vlan_add and .port_vlan_del to + * drivers even for bridges that have + * vlan_filtering=0. All drivers should ideally + * set this (and then the option would get + * removed), but it is unknown whether this + * would break things or not. + */ + configure_vlan_while_not_filtering:1, + /* If the switch driver always programs the CPU + * port as egress tagged despite the VLAN + * configuration indicating otherwise, then + * setting @untag_bridge_pvid will force the + * DSA receive path to pop the bridge's + * default_pvid VLAN tagged frames to offer a + * consistent behavior between a + * vlan_filtering=0 and vlan_filtering=1 bridge + * device. + */ + untag_bridge_pvid:1, + /* Let DSA manage the FDB entries towards the + * CPU, based on the software bridge database. + */ + assisted_learning_on_cpu_port:1, + /* In case vlan_filtering_is_global is set, the + * VLAN awareness state should be retrieved + * from here and not from the per-port + * settings. + */ + vlan_filtering:1, + /* MAC PCS does not provide link state change + * interrupt, and requires polling. Flag passed + * on to PHYLINK. + */ + pcs_poll:1, + /* For switches that only have the MRU + * configurable. To ensure the configured MTU + * is not exceeded, normalization of MRU on all + * bridged interfaces is needed. + */ + mtu_enforcement_ingress:1; + /* Listener for switch fabric events */ struct notifier_block nb; @@ -371,50 +420,6 @@ struct dsa_switch { /* Number of switch port queues */ unsigned int num_tx_queues; - /* Disallow bridge core from requesting different VLAN awareness - * settings on ports if not hardware-supported - */ - bool vlan_filtering_is_global; - - /* Keep VLAN filtering enabled on ports not offloading any upper. */ - bool needs_standalone_vlan_filtering; - - /* Pass .port_vlan_add and .port_vlan_del to drivers even for bridges - * that have vlan_filtering=0. All drivers should ideally set this (and - * then the option would get removed), but it is unknown whether this - * would break things or not. - */ - bool configure_vlan_while_not_filtering; - - /* If the switch driver always programs the CPU port as egress tagged - * despite the VLAN configuration indicating otherwise, then setting - * @untag_bridge_pvid will force the DSA receive path to pop the bridge's - * default_pvid VLAN tagged frames to offer a consistent behavior - * between a vlan_filtering=0 and vlan_filtering=1 bridge device. - */ - bool untag_bridge_pvid; - - /* Let DSA manage the FDB entries towards the CPU, based on the - * software bridge database. - */ - bool assisted_learning_on_cpu_port; - - /* In case vlan_filtering_is_global is set, the VLAN awareness state - * should be retrieved from here and not from the per-port settings. - */ - bool vlan_filtering; - - /* MAC PCS does not provide link state change interrupt, and requires - * polling. Flag passed on to PHYLINK. - */ - bool pcs_poll; - - /* For switches that only have the MRU configurable. To ensure the - * configured MTU is not exceeded, normalization of MRU on all bridged - * interfaces is needed. - */ - bool mtu_enforcement_ingress; - /* Drivers that benefit from having an ID associated with each * offloaded LAG should set this to the maximum number of * supported IDs. DSA will then maintain a mapping of _at From patchwork Wed Jan 5 13:21:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12704328 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56C45C433F5 for ; Wed, 5 Jan 2022 13:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240272AbiAENWE (ORCPT ); Wed, 5 Jan 2022 08:22:04 -0500 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60]:53697 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234666AbiAENWD (ORCPT ); Wed, 5 Jan 2022 08:22:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ejutLAZVNXQxtkXp3mEvK1qi/QxxRc+g4olyGfr7MPpq40zfHkBT7qU/TLWq0CMUs/1RrgdKzkC+EPPPLJcxz5wEJhb9Sktj2IWeR0pB+Yi5HmIWNO9Z/0TyWxIuOlEj7+bDJGklohAESSWGHMEj7yZeQV4qQdoSWrbvTWndJvGBqZpB0b7ALHd/MThe4uPynylsm8NjDBtysvF/8BjpJvjYKUK1f3/Arh18z7SbSMC//wFhA5beTciqaBuq/PD1JMgZYq7gU92eyyjHCR6t5bU/xkP5XL4aXWRAgo195f2PiDiCRl4KxGIjm2dVauU52bKvGwF1rIzKfYy2Ewr7yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UKrwzzw3/o7/9morQIfzIY9KE+aQwy1TqbbcCH/VCuM=; b=G4wrS4y0dfFRkPrhLeVJFy4XF/owTaDAKb6SdOJYatMWfSQtgFw3wz6cUWRpKuy34XMUXyYxPBjSPDa4eUy8FHrfVRryXWsOxGgAfg+S99Beg41V5yHolfrvw59tnxtA+OAFOE4vgXpWMfLPQR37xGgBBji9lfDHu/Qw2PHmo+ZmHteCqi0Qu3LVWibn8tWduG8FZKTeHoYACS+pSyWXilWwcYcDzTSeQWVURKhZzvNUlvjhqTQYaM6F6D/E5MuMy7Vr67y3SYeYf2rCaH2g1vmTE6UN85a2sXzsWVh5MXRWF0SpO+mekEfnBYyUJTmYPlzkijZMO9CJADv85mVG5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UKrwzzw3/o7/9morQIfzIY9KE+aQwy1TqbbcCH/VCuM=; b=TxiwWoNWxpy4dKTJIkNRppVVB6gvEsTGn2fhtiI5TlMH39p78e8tDMrC3wdRECb7qTUF/Qcehbf5r6EbiXJK83H3PuBpsCqnSlYp/U4LUedeEZHv5PcAq8qHQuJ8QbnGmqD8u0psVWRydMj+J8lqKTc/PVf+ubrzs3EJbPpWgXk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7408.eurprd04.prod.outlook.com (2603:10a6:800:1b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Wed, 5 Jan 2022 13:21:56 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226%3]) with mapi id 15.20.4844.016; Wed, 5 Jan 2022 13:21:56 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli Subject: [PATCH v2 net-next 5/7] net: dsa: make dsa_switch :: num_ports an unsigned int Date: Wed, 5 Jan 2022 15:21:39 +0200 Message-Id: <20220105132141.2648876-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220105132141.2648876-1-vladimir.oltean@nxp.com> References: <20220105132141.2648876-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS9PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:20b:467::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c0ce31f-25ae-46d6-ed62-08d9d04e588d X-MS-TrafficTypeDiagnostic: VE1PR04MB7408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 89Lg+ELRX85SuPUPc5/ObIAQOiKNNh93t+vdzw9ZZ+4AXlih+k5cEUTVHFqCroqvk1MnTggRgIIJrVnR5KN4AQMmobDJC1GRwECr4+6LI4Oj/U/y0fD60BmOXiNR2vZCp319ba5a4F1AYQRUCjkEFxmvTgBIYmZtSJ5dkwtCea8toxhS2bsvpJ9UXNjqUC6O2aO3FiVrrrEY6ejngAS6utkQbSHcjZGTpYtN7tyBX6f/Os/Khh72Cs8rV3cFYMPN6+OpY8DpBF72ljUJ0D6Z7bqKdZk/mXl50702kkEqMgLyHXpyNuXU1g7OKtnpF003W3umUpQKNG7eN3Kwt/F4l0VpxX+2OVjf47vGTdEq3RqpwbvU6Tljb2Nr8Wpt8hPwXq0xTlr9KOziaUoW1xeE5O5AsR12U9znthX+g1RedUnCt7aHVplfpZppvZQcqq5CcJUftZJHSwT8JRqCyC8avpwraS4OtBzqMNDv1QHXHZdJ/LHguiF9ZhSXoph7jDK0SWEy9zzW9KXu7HgosDLQ+qDFRfHAKazpznlr0Euh17WdwU1bgIQPFEUqF57cZ9XQtuii34EP7VFAetpfc8bGu/QgmOA0wT7Kipn+SldJS+Y5mnwRxX4t66nwDeN1pwvUDrbh6FOmVZl/yol5q6coZEaq//WxjdpWXQi1Tkj4qiCZT1sMwtljttYtZl4vwt3F6f2N4bEGuFihN6vLAAig5xu8a0u3UfmXYAjaxOKJ2Lg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(66476007)(8936002)(38100700002)(38350700002)(316002)(36756003)(2616005)(2906002)(6486002)(66556008)(66946007)(6916009)(5660300002)(44832011)(83380400001)(6512007)(508600001)(86362001)(54906003)(4326008)(8676002)(1076003)(186003)(26005)(6666004)(52116002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XfWsJFawSjoC8VZG9rlk39jC+S0QAUXCAyBJoyhv3rsrnOhWMggOvbEOekTJzuvgbHP7jS8q/GkFAMh5yTjlfx4TEGsaB8nkwixXjvZardumqrWKkgmMBhQ8rDSLZcLUk6c9NyB7XV3o8gNWpOuRhd4IIyO4rSeNADSEUCXCqH5nLKvD4sySy8RNm+eS/P1x6ChMuSJCisEF60KSRFgUtlyR/5DJK+cDgNidCYt5/7m/Yxgx/5wESyH/DkkDE1TQPJey/K39yo/sFW2lnlJ29ZUM7lHLR8Caq0YHXTOsSwIo/nrQZsKfqN1qbZ9VKhIU+6LJkb/zsUn++zFHAeFDPKSS1ErgS+Kc6b2GJ62XfC/eAipPmf9amO26GCcpeyXm4ua08uXx9Zq6vOilHB5BCYgfA89Rie7/+QofNbzGpYFvXoXd4bSjMwJr1Bfrj01zTIhibZANmDoMQ1C31ZSR2/7A01qAOPaRbEy4nIiQJNkOZP1d44D1s77uQVJse/4sMALddNY6T6NgbPvqL28QJNl0o8Eat8Nd/6O0X1XQQy+1Z36DIWBnlDE50n5Nl0gG1T2EMPWk3Sq1cVKBq7HOZkLavu5oOrB9RD57BPFVMnhaQRYGeZgNkNDRHCCo5vkKATZnrYivvAmkwvT3gVr/A3/CjYYYtdfVt7PlEDZ3xr5HijJd1QedKYSEVNYajYlngMoO/4ZkQ/zBuw8LNLiec9UltkNWicCf9SqBP1Sgmly4rK973ZfATU6nhEC/FZCin99gNvfKcTeItZUXoSEv3TEF87v8cQroZ4jYalmd9XlgIQAvLccHUzOc0mcBnA5LHUB8ouLYNtWZCOzx5vRL7t3tHrTgsCu3Ij8ecYrITnUKye4c/NuegjuuGeh0fLW+b11TPJx3zW1gK2AHvClA2EXmOkH9NTCjrJuhQa975mFrlCIIw7mCY6/s14XoF01W7Hzx9tkT6Cwb2qhX+CPeJX7i4Rt+8bPoCKhshO7U/TnFtqv1/Gv5tHLjdGWyZcFzjRDvAyAxlDAQ+ugDmgfJ1nS9mWB1s23FRVZYBZtv7iqJZIcSTi68sWZouMnj2L+v5sM2U2F2Z3U157TUoHDrNmnkgi1B6UjCKnY3hIAqovVy3skTjvziYa0dXHLlvk0XALGSeH/ppR2iZg7MZV+zPCNoMG+AEDmDpy88k65xtIoO9ARwI0tWub5dLvEY5qzppjr3d/rNahZjVpzSTOb9JwHN96tTC87CrXGHUhUf/JgMJC6+272iwcDzWBh4gs7mNUEkH2y1qkYNv/6eFrf4GQdnaJKYLf97YlKkpPiKoI4l6KWLarrVDF7IPm9Obx9QEDLSd4tfG6Qj+GQpvKBUbSAYXlvhOlETiQAa1EDCv6QY7oLLL737mLvutSJavpuhQpwsJdvz7PcaErylhxOYt3pcRx1DVCFVV1tQIzXU1NOVToAKH5G0IiYAr8EE0PUY5xYG0ZS+6dd+YumyNWdDmGSDrVbSw4z1YhdL8IojYZfu1WdvXcH4NlpJPcvXo4Dgue/KWt05sTJeGsI/aZL6h/r0uYzl2Xgqnim7rPL569IJ6jW+luGgaLpjhWX54M8tPbslUQyApQkLV/hx+VmR+RQauiGIqtEIvnBix7ZqJPE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c0ce31f-25ae-46d6-ed62-08d9d04e588d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2022 13:21:56.2921 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xgdERrAwJjKSWFgv72jzkIFYsVUoz+V6JYTIVayTO1MK271invXEPXCDh/jPw+f9gYaKCJZXqPrgVWNkkqIybw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently, num_ports is declared as size_t, which is defined as __kernel_ulong_t, therefore it occupies 8 bytes of memory. Even switches with port numbers in the range of tens are exotic, so there is no need for this amount of storage. Additionally, because the max_num_bridges member right above it is also 4 bytes, it means the compiler needs to add padding between the last 2 fields. By reducing the size, we don't need that padding and can reduce the struct size. Before: pahole -C dsa_switch net/dsa/slave.o struct dsa_switch { struct device * dev; /* 0 8 */ struct dsa_switch_tree * dst; /* 8 8 */ unsigned int index; /* 16 4 */ u32 setup:1; /* 20: 0 4 */ u32 vlan_filtering_is_global:1; /* 20: 1 4 */ u32 needs_standalone_vlan_filtering:1; /* 20: 2 4 */ u32 configure_vlan_while_not_filtering:1; /* 20: 3 4 */ u32 untag_bridge_pvid:1; /* 20: 4 4 */ u32 assisted_learning_on_cpu_port:1; /* 20: 5 4 */ u32 vlan_filtering:1; /* 20: 6 4 */ u32 pcs_poll:1; /* 20: 7 4 */ u32 mtu_enforcement_ingress:1; /* 20: 8 4 */ /* XXX 23 bits hole, try to pack */ struct notifier_block nb; /* 24 24 */ /* XXX last struct has 4 bytes of padding */ void * priv; /* 48 8 */ void * tagger_data; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct dsa_chip_data * cd; /* 64 8 */ const struct dsa_switch_ops * ops; /* 72 8 */ u32 phys_mii_mask; /* 80 4 */ /* XXX 4 bytes hole, try to pack */ struct mii_bus * slave_mii_bus; /* 88 8 */ unsigned int ageing_time_min; /* 96 4 */ unsigned int ageing_time_max; /* 100 4 */ struct dsa_8021q_context * tag_8021q_ctx; /* 104 8 */ struct devlink * devlink; /* 112 8 */ unsigned int num_tx_queues; /* 120 4 */ unsigned int num_lag_ids; /* 124 4 */ /* --- cacheline 2 boundary (128 bytes) --- */ unsigned int max_num_bridges; /* 128 4 */ /* XXX 4 bytes hole, try to pack */ size_t num_ports; /* 136 8 */ /* size: 144, cachelines: 3, members: 27 */ /* sum members: 132, holes: 2, sum holes: 8 */ /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 23 bits */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 16 bytes */ }; After: pahole -C dsa_switch net/dsa/slave.o struct dsa_switch { struct device * dev; /* 0 8 */ struct dsa_switch_tree * dst; /* 8 8 */ unsigned int index; /* 16 4 */ u32 setup:1; /* 20: 0 4 */ u32 vlan_filtering_is_global:1; /* 20: 1 4 */ u32 needs_standalone_vlan_filtering:1; /* 20: 2 4 */ u32 configure_vlan_while_not_filtering:1; /* 20: 3 4 */ u32 untag_bridge_pvid:1; /* 20: 4 4 */ u32 assisted_learning_on_cpu_port:1; /* 20: 5 4 */ u32 vlan_filtering:1; /* 20: 6 4 */ u32 pcs_poll:1; /* 20: 7 4 */ u32 mtu_enforcement_ingress:1; /* 20: 8 4 */ /* XXX 23 bits hole, try to pack */ struct notifier_block nb; /* 24 24 */ /* XXX last struct has 4 bytes of padding */ void * priv; /* 48 8 */ void * tagger_data; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct dsa_chip_data * cd; /* 64 8 */ const struct dsa_switch_ops * ops; /* 72 8 */ u32 phys_mii_mask; /* 80 4 */ /* XXX 4 bytes hole, try to pack */ struct mii_bus * slave_mii_bus; /* 88 8 */ unsigned int ageing_time_min; /* 96 4 */ unsigned int ageing_time_max; /* 100 4 */ struct dsa_8021q_context * tag_8021q_ctx; /* 104 8 */ struct devlink * devlink; /* 112 8 */ unsigned int num_tx_queues; /* 120 4 */ unsigned int num_lag_ids; /* 124 4 */ /* --- cacheline 2 boundary (128 bytes) --- */ unsigned int max_num_bridges; /* 128 4 */ unsigned int num_ports; /* 132 4 */ /* size: 136, cachelines: 3, members: 27 */ /* sum members: 128, holes: 1, sum holes: 4 */ /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 23 bits */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 8 bytes */ }; Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 2 +- net/dsa/dsa2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index a8a586039033..fef9d8bb5190 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -435,7 +435,7 @@ struct dsa_switch { */ unsigned int max_num_bridges; - size_t num_ports; + unsigned int num_ports; }; static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index c1da813786a4..3d21521453fe 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -1475,7 +1475,7 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds, } if (reg >= ds->num_ports) { - dev_err(ds->dev, "port %pOF index %u exceeds num_ports (%zu)\n", + dev_err(ds->dev, "port %pOF index %u exceeds num_ports (%u)\n", port, reg, ds->num_ports); of_node_put(port); err = -EINVAL; From patchwork Wed Jan 5 13:21:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12704329 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7DE0C433EF for ; Wed, 5 Jan 2022 13:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240308AbiAENWL (ORCPT ); Wed, 5 Jan 2022 08:22:11 -0500 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60]:53697 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235186AbiAENWE (ORCPT ); Wed, 5 Jan 2022 08:22:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mdbII56TdKHnwhDjmkjoMfetDgz1xzhYAY679GPVHrCVnK8xyFx1bJYb4BHD/Z9Y19JcHgPur8Jy7ghbhThf1gkpZMNBzmvJSsSUg/IGYP7u9yO15WCdp6pYQWu34+398rIo5f7lx7DmcMp1HvWKNKQx+rGK9nnK7KiuLM+c+bKZaN1So0+Ce9FjQwoz8X7aeA6G9p1gU62UVNpvwnWjjO+x3NKEqyOwNfrlZGkIKwqpC5H/ZY1YPBc+9wz0wws2vglKTwbdoGknwge7fI4BEbwy6uvifv3ElrZBHuphiDIf+lRHqoRaIP0toKmLOn4YVg/g4uoN1+pOLjRc0RJYHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OVes2I22LqyvIMkv7l6UANxjhDHISZ2RgZXPj5KUsgw=; b=QIA9ROWmqSy4KSQ/ZQeIwuDpBB9F7tXS0AgeXEmZyXKG9YOfb3u8R4aCLDjCa59mGipKHKdLrL381HN4YTa7APyNwqtcI1//E4+qLncTgUNi95b3Hru6hJDmE23VSZdG1iE/Vd2VX4HBg++Bf0cB7f3beiw6zZCzfADtOkXvvRuReFIviUO0s9u5F/RbcqlBTW8l4YGNUAgvuHPSO1DAVyag8Zn8Kc3I+m5uWlyZAE6bX5BX4nqCzERrS2jZKgXhPnGIZG9wVMHhD+EBfduc9+Sqkr/Ndg7w6Em+35UHFR10Qf6GHTzdQBLv/262EcCmqMmr8I/uZ954ScVjceMKNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OVes2I22LqyvIMkv7l6UANxjhDHISZ2RgZXPj5KUsgw=; b=J9urtfIhz2icI4M2dRnhIqwGO+LlFvW72fBH3alBS7TtiN7lU2ocXyhwnzQANDSbayowixJ4TllkTDFOffYBwzocdRXGYDSbHANhX3tG3CjTAY7Te+urK7okk9s1OqkhLZ1FkhaYCGYVGczuDgJae9Ds7ui0U3aCU9qcSrs2vSw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7408.eurprd04.prod.outlook.com (2603:10a6:800:1b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Wed, 5 Jan 2022 13:21:57 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226%3]) with mapi id 15.20.4844.016; Wed, 5 Jan 2022 13:21:57 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli Subject: [PATCH v2 net-next 6/7] net: dsa: move dsa_switch_tree :: ports and lags to first cache line Date: Wed, 5 Jan 2022 15:21:40 +0200 Message-Id: <20220105132141.2648876-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220105132141.2648876-1-vladimir.oltean@nxp.com> References: <20220105132141.2648876-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS9PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:20b:467::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5363893c-1c24-4a0d-6ea0-08d9d04e5913 X-MS-TrafficTypeDiagnostic: VE1PR04MB7408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8KaRJZCtxyLcQAIf8Iv/j2E3GLCumWRFf5WkeFZrequaD8L34pahWZq+z7I1lDF08c7AM+ZA26ksej3siqXif4cYUPzg6+VVaND7ASzyX8u9h5WAGLVpTfeGazGjTjMCSxfxyc1iWX+fc52EX1vv1h5v/cvSJQvlYwv0YlgJ4aIj8tz9Rabfw/8pBDvgd94zT2os4FDZ6HyEznlU78fegWL09SJ/khGRZA05kUAykXKT1R/bnVRmyw+hv28pKc4o+X+sLQw/mpm4ADO+Jfs2iKs4idCQgRTJB8duoivFfoJeQIKHLpKY2E298V9t8Leu1W0fa9Lr11WX0MSTEeRnEG/rB8OEPmR87sSlJqyQyHonMiX7Up5GNMxYxICeW94j4vuHc0rSA3oUOl5ZmsAb87+xnWl4EeNKIEi/vB+HQQIDW8Uf6gBxlLzN+9vWUTg1lZDF9jej0uozvf7T4HhbfGGf07Aef/0OKsxnav2y2QSRA89H4aylFiYnXJ9HTDwmNfPpy/cO93FspPSBWp/f1HyOAlZ98rlMNxB2tKHPn0qhs0/FuqexKxtypQ7AuwJDfKK5GHseFLd4FJxKUGhl0lSmhML5BLPVPubFbnUy5k4xJU91Uiy9wkFvsVGikvExT/xGm6CK8lTZslj0M1p0mlmh7IB7uRuXHbz7o5SYT7w4UhIF4vNHbO4Vkq8qvuDFhqQyXIDlk18tL40SIB7HRGg2WYLPjzZ03XD/Lf75Km8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(66476007)(8936002)(38100700002)(38350700002)(316002)(36756003)(2616005)(2906002)(6486002)(66556008)(66946007)(6916009)(5660300002)(44832011)(83380400001)(6512007)(508600001)(86362001)(54906003)(4326008)(8676002)(1076003)(186003)(26005)(6666004)(52116002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZJF5IAwxAWGwgpGlFM9r+NvGXCU73R6NPy8ybf3dCXjYrpY/AtIfNbBm83zl+77TfyTBQPxxwDh2Hozvq3toPKjhiZGTcLD+epgqBcu9OO0oynHw6eZ/i/CaCP9kmg5u2P7CZKjqjFHwSKJHDtU5Sh5AlDhbomnydmSys+Qp4mc+9AbgSIC2BStqQb72qwGImRv8bBNknCfCLmm61ovGEdxsVk1thYTgLJS0xRZBqQgtOHXpNqiSZXXqpycM/FUO1yCsWkppLDxgbDJNPU547SPRx+Lp+sJf1RaQZ+dju6lbhWUFm3fOvEwSRlanqQk9sew8kY+iGwoPPcxw99Ka7zqkK1Z9DKxZko5nXq6TTBJnOEc3z4TPfh9oc2nx+aRCE4MwbAba75KRXnV2ow4TX+VBlcaRufbBFI9S1mysu3A49h3x2UaFE6MEtLNB2KE/yMElZxoCNRgRBkHJuM0M6tW3d7RRdyvqSyGOIyYSQDdLEZTGyuOHQMAkuo/wA44cyaG1fSIgqIPj17blP5FMxo+bdsau1CNLZCRfnEjxT95U7tb2Wa85Zzr3Wysn7A54vxDa55qxhYoTau5qhXAmp7sbh0UAFBPuoSSZGm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: 5363893c-1c24-4a0d-6ea0-08d9d04e5913 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2022 13:21:57.1357 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sBkebYrR9p1ON0LldCtIXEJd9Ei1LDFHcgaNRdh30XLVu1nU9UoFNZPb2LZfmMRf/z+N0XEQDQDksDe1iUvrYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org dst->ports is accessed most notably by dsa_master_find_slave(), which is invoked in the RX path. dst->lags is accessed by dsa_lag_dev(), which is invoked in the RX path of tag_dsa.c. dst->tag_ops, dst->default_proto and dst->pd don't need to be in the first cache line, so they are moved out by this change. Before: pahole -C dsa_switch_tree net/dsa/slave.o struct dsa_switch_tree { struct list_head list; /* 0 16 */ struct raw_notifier_head nh; /* 16 8 */ unsigned int index; /* 24 4 */ struct kref refcount; /* 28 4 */ bool setup; /* 32 1 */ /* XXX 7 bytes hole, try to pack */ const struct dsa_device_ops * tag_ops; /* 40 8 */ enum dsa_tag_protocol default_proto; /* 48 4 */ /* XXX 4 bytes hole, try to pack */ struct dsa_platform_data * pd; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct list_head ports; /* 64 16 */ struct list_head rtable; /* 80 16 */ struct net_device * * lags; /* 96 8 */ unsigned int lags_len; /* 104 4 */ unsigned int last_switch; /* 108 4 */ /* size: 112, cachelines: 2, members: 13 */ /* sum members: 101, holes: 2, sum holes: 11 */ /* last cacheline: 48 bytes */ }; After: pahole -C dsa_switch_tree net/dsa/slave.o struct dsa_switch_tree { struct list_head list; /* 0 16 */ struct list_head ports; /* 16 16 */ struct raw_notifier_head nh; /* 32 8 */ unsigned int index; /* 40 4 */ struct kref refcount; /* 44 4 */ struct net_device * * lags; /* 48 8 */ bool setup; /* 56 1 */ /* XXX 7 bytes hole, try to pack */ /* --- cacheline 1 boundary (64 bytes) --- */ const struct dsa_device_ops * tag_ops; /* 64 8 */ enum dsa_tag_protocol default_proto; /* 72 4 */ /* XXX 4 bytes hole, try to pack */ struct dsa_platform_data * pd; /* 80 8 */ struct list_head rtable; /* 88 16 */ unsigned int lags_len; /* 104 4 */ unsigned int last_switch; /* 108 4 */ /* size: 112, cachelines: 2, members: 13 */ /* sum members: 101, holes: 2, sum holes: 11 */ /* last cacheline: 48 bytes */ }; Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index fef9d8bb5190..cbbac75138d9 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -119,6 +119,9 @@ struct dsa_netdevice_ops { struct dsa_switch_tree { struct list_head list; + /* List of switch ports */ + struct list_head ports; + /* Notifier chain for switch-wide events */ struct raw_notifier_head nh; @@ -128,6 +131,11 @@ struct dsa_switch_tree { /* Number of switches attached to this tree */ struct kref refcount; + /* Maps offloaded LAG netdevs to a zero-based linear ID for + * drivers that need it. + */ + struct net_device **lags; + /* Has this tree been applied to the hardware? */ bool setup; @@ -145,16 +153,10 @@ struct dsa_switch_tree { */ struct dsa_platform_data *pd; - /* List of switch ports */ - struct list_head ports; - /* List of DSA links composing the routing table */ struct list_head rtable; - /* Maps offloaded LAG netdevs to a zero-based linear ID for - * drivers that need it. - */ - struct net_device **lags; + /* Length of "lags" array */ unsigned int lags_len; /* Track the largest switch index within a tree */ From patchwork Wed Jan 5 13:21:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12704330 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6D73C433F5 for ; Wed, 5 Jan 2022 13:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240290AbiAENWY (ORCPT ); Wed, 5 Jan 2022 08:22:24 -0500 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60]:53697 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240296AbiAENWI (ORCPT ); Wed, 5 Jan 2022 08:22:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R6c4TTTOpZ+oGKcO0TtX0NdqGxjVsLVrL6uGzJLSLpE69Uy4NoKnvF8grCK+2acDk59AE6Nr20pzyPtznnbs24wsNc24eV9DfwL67a6N4eBvwbSxA1j8co1cZjC7CriCY0S+bgetQux8n2fMrkRqgYqOqDq6m+6+z8aSJjlPngyOfHFfXznRwJCGLybm5TJ5RDvMVmRzufHY3LlkdYwbabwT65ivz/YjMBpiP/YQNBVOojY+vOlw2GqmMxFqDqMN+sic0q2cOQyRVtW7Egl/WRN8t7zy7WX5KshFLtKXlWG0fG14dI7Hz+CJdJx2dx9Ft30yiGedsFJeJB6HzNp9Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mavQUYFYXwhcIFmdkles8ujxVOHZYvjvkNhUq/6aKME=; b=mUo5IziB9/cgzVYmmU7AcQ7EuCwidQogz4e8xBjmdG0eK9UudPXNb2b0Yv23OqN56kUt31kTYhorbGFv1cUxTSeENVoJNnz/JX34iBr9jjki8GBGcCkCrK+YgZ6dKOYTmZkDRAr3eYglbmcdy37qVUv8OX7OVJLIhLP/17dGCwF/cFr085XztmYw+fBwE03IWfR1vrDyE/U3ADF1a7J/iFbyhMzSjdOvwcYBD799SnfJDeV9/rC80qBXg2BHp4f/CLdo7jqND4pMpS4f1xkbIuxwaUvl/0Prb4UmI3nJUXGhQ1X0cmb1c0FikmtmXwc1OtUfgRiIexIHQJbojxi96A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mavQUYFYXwhcIFmdkles8ujxVOHZYvjvkNhUq/6aKME=; b=MBNtUMpPvefCm99PIgPt3B8fNd/U1+w60U2LSghaR9b5yR/qqSmItb4cBqR+aPFPwMRj531fD3lOcAtGy+gVZPcSISM8iy9F3X+82dBBNWbtY2BIxgH2BVCjbwqemAS5uBr6OcEVJI+x4TWVNOm8vBwKcuknXLhrj1gTZBxLyGg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7408.eurprd04.prod.outlook.com (2603:10a6:800:1b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Wed, 5 Jan 2022 13:21:58 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::c84:1f0b:cc79:9226%3]) with mapi id 15.20.4844.016; Wed, 5 Jan 2022 13:21:58 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli Subject: [PATCH v2 net-next 7/7] net: dsa: combine two holes in struct dsa_switch_tree Date: Wed, 5 Jan 2022 15:21:41 +0200 Message-Id: <20220105132141.2648876-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220105132141.2648876-1-vladimir.oltean@nxp.com> References: <20220105132141.2648876-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS9PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:20b:467::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5979138e-a47c-4951-16d7-08d9d04e59a0 X-MS-TrafficTypeDiagnostic: VE1PR04MB7408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B370eCpC29spFidJ8zv67Guw00/lofCC2b3YoxjYYtCazPShRwl7xOXe27Hr0mb74EPqIT9wTHLIT3iN9nOauP0MoLXkKWMRmxf7BDF/zB0LaKuVu2HF0KyHuYXPwq/nnNsKfxuOXrL5Inef28gT3uThissiTzusThGz79Q8+Drg6cY9UQmqpxgKM6r4jLrlWpsPMjk6Yxdd8oMd19ShrY9TEW3prTT0RinrhEoIwDut5R1vMoByU0tx2h1AMFTfwxvf168YmYxP1U3oCjnxlND1We72Gy0nCLwBHGq/tLA0C79fEEgPCXaer6SZNTzsp7l98CuUOy5knXk1OQrBAhAsytvZuEsCOstZGVAgi9idL3fpLjZhtp3tdZ5axwHL0dsTV5OfCt/cigBLL0fHf5TerIECMNwkLsdRiT1GRNRf7vqtaDb4LnRP9YsvjuOSUxAF+Gb2qvCcEdSBt4ilWa42T1h7AEEjsfnLHu0vt2BG5ia46xoUVyMzoq1qH+ixFSiGW8Kgy0VilKMxQKfnstSNbSUKK58qnEgO6DjlbTvgtLevUiNdJHjvfKdf1tRxJz31u3b78Xw+hDCVVt0PS6VKsRHN9z8Skqy6sxfC3AY2ZKq482h3ZkaJ9a1sDBSK32Oi9+wpzJywTlk2/ifU6Ae3HtQ4bOhYYMCsBsEdeUIuMBAK5jQu+mb5HInycYUovkTrj5BsbG02ZFwWyi6aiJmwZwCsSik/mCdZJqr9KrY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(66476007)(8936002)(38100700002)(38350700002)(316002)(36756003)(2616005)(2906002)(6486002)(66556008)(66946007)(6916009)(5660300002)(44832011)(83380400001)(6512007)(508600001)(86362001)(54906003)(4326008)(8676002)(1076003)(186003)(26005)(6666004)(52116002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A6nTh91pxXI0H/48mQ7Qf3cwhicCVbIE/JyOsyQXyQLBzS9RVGmezqOQCcF02lvogcKeZ+e0eCuIkwBHlqGZEXYMO+WaO+uFe2GMiRJmDFCAqlx70/a1ohh0XexNzJ36Or/Po8xY/RAqrAIgxWSlSGjv/DQWclXo4a3FV5EHBzBPnin1MfLYV52rGISWr8GjoUMsN0Jo9JJ09uf3VUmPRZNGLbD40e9BPExRCLG0pOauBX7jqySAZeuhdzAFZevTu3mRJUyXydYZDC/JdHri3o/qUYvDgVKhbtewyR97JJjxjrcy69M9v8JkGjRG7oyGRMvZXXf5Z31YWIw1rGh5fFPxZhoMZQBb8n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EP3ze+9I0ol95FipuwgKTJvTKfy33dKSinGG8S6hBjvXjHWyZvwIFY6RcywX696XkPiKKbdLx8mLDcLGhy/19VNahHE9huwXIou5zOx4lY/UdauAtkOL5mcIcQruuTfEnbFGF1ZfcqyPQzTMcZXzGrTjQvI7R93Wb8BwPW+UDD1TsP3tpPD9Xuh0qmQoPkh8yJCIze58XnchMc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5979138e-a47c-4951-16d7-08d9d04e59a0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2022 13:21:58.1357 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zs+zscVjYLCIRyfgYGdysqrJR+7kx1TvYGUVFtXBlYL2z23vuE/g4zY3nF7oE4TkkrNZMlpMfOxtjnglwLwLuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There is a 7 byte hole after dst->setup and a 4 byte hole after dst->default_proto. Combining them, we have a single hole of just 3 bytes on 64 bit machines. Before: pahole -C dsa_switch_tree net/dsa/slave.o struct dsa_switch_tree { struct list_head list; /* 0 16 */ struct list_head ports; /* 16 16 */ struct raw_notifier_head nh; /* 32 8 */ unsigned int index; /* 40 4 */ struct kref refcount; /* 44 4 */ struct net_device * * lags; /* 48 8 */ bool setup; /* 56 1 */ /* XXX 7 bytes hole, try to pack */ /* --- cacheline 1 boundary (64 bytes) --- */ const struct dsa_device_ops * tag_ops; /* 64 8 */ enum dsa_tag_protocol default_proto; /* 72 4 */ /* XXX 4 bytes hole, try to pack */ struct dsa_platform_data * pd; /* 80 8 */ struct list_head rtable; /* 88 16 */ unsigned int lags_len; /* 104 4 */ unsigned int last_switch; /* 108 4 */ /* size: 112, cachelines: 2, members: 13 */ /* sum members: 101, holes: 2, sum holes: 11 */ /* last cacheline: 48 bytes */ }; After: pahole -C dsa_switch_tree net/dsa/slave.o struct dsa_switch_tree { struct list_head list; /* 0 16 */ struct list_head ports; /* 16 16 */ struct raw_notifier_head nh; /* 32 8 */ unsigned int index; /* 40 4 */ struct kref refcount; /* 44 4 */ struct net_device * * lags; /* 48 8 */ const struct dsa_device_ops * tag_ops; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ enum dsa_tag_protocol default_proto; /* 64 4 */ bool setup; /* 68 1 */ /* XXX 3 bytes hole, try to pack */ struct dsa_platform_data * pd; /* 72 8 */ struct list_head rtable; /* 80 16 */ unsigned int lags_len; /* 96 4 */ unsigned int last_switch; /* 100 4 */ /* size: 104, cachelines: 2, members: 13 */ /* sum members: 101, holes: 1, sum holes: 3 */ /* last cacheline: 40 bytes */ }; Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index cbbac75138d9..5d0fec6db3ae 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -136,9 +136,6 @@ struct dsa_switch_tree { */ struct net_device **lags; - /* Has this tree been applied to the hardware? */ - bool setup; - /* Tagging protocol operations */ const struct dsa_device_ops *tag_ops; @@ -147,6 +144,9 @@ struct dsa_switch_tree { */ enum dsa_tag_protocol default_proto; + /* Has this tree been applied to the hardware? */ + bool setup; + /* * Configuration data for the platform device that owns * this dsa switch tree instance.