From patchwork Mon Oct 21 10:20:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Naaman X-Patchwork-Id: 13843833 X-Patchwork-Delegate: kuba@kernel.org Received: from dispatch1-eu1.ppe-hosted.com (dispatch1-eu1.ppe-hosted.com [185.132.181.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7228A1E2840 for ; Mon, 21 Oct 2024 10:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.181.6 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729506284; cv=fail; b=HxrdevX4ta4l7zM3Vou/ytrKEA6LqC/rpMullh+zg/kwlqgpfPE2f7e0t2rvykndUFRWmdk0z7CKbIf7ZE1N0sB5q9ShDk9ax5+NjKRmggYWLpsObOEEJmsyEUP16eZPoV/B8LUFB/IiJco0LT59d/84+4fZrKPx3Tax5xDtCHc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729506284; c=relaxed/simple; bh=A+5WLTVTgKnbJgd5p+xzqrEFTvxsdewGTqgillMnlVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=jZ9yR9OwsW+IeX8DEf+oGV+vow1cA06wF87t6hsR1kj9Hv4G0fh3Zusp9X/dJNZL2EpvfDhseyiF99lWuQoXhnJzx7rOLtIuuooyCf+ePlpCmLv6x5aCuIpJX8SNf82RAA23k7FLDSLTDBbfecmNvBMq0Po4LIsXFsE1BzEA6w4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=drivenets.com; spf=pass smtp.mailfrom=drivenets.com; dkim=pass (1024-bit key) header.d=drivenets.onmicrosoft.com header.i=@drivenets.onmicrosoft.com header.b=lUQl7m3N; arc=fail smtp.client-ip=185.132.181.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=drivenets.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=drivenets.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=drivenets.onmicrosoft.com header.i=@drivenets.onmicrosoft.com header.b="lUQl7m3N" X-Virus-Scanned: Proofpoint Essentials engine Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2110.outbound.protection.outlook.com [104.47.18.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1-eu1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id EF7B26C0075; Mon, 21 Oct 2024 10:24:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XxuVbmYbiQWHYJjVTcpTdr6Lwf3D6wvTyOJT76750issRqwF/har3E+ENJlZjjgQDMr+oA1qsrZ1am2Zbbj7ZNEwWkWAW6xXw8QxRYqM8h2DPSP8YLR+Sj36OKNraVgw64JFbJT45DJyM0JgX7Asn8Nkprt6z0J/qFg4I6U0K/AoV70JzHhH9hnjIQ9GJCssqk/SaGf7Rtg0iZr5PWlHFQvklfygABceKrGh+1l8ugr36I5bq2CNc2GeV7EYeU1ZsPc0jFAdIQrsoOqIePHKKoyNsqwPZSh7+x3GY0B19YSPCtLlxAzP1PzI0kmiHaYRSbs7h5pYLs9onIOyXRx4dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=S82OqHsPVGbQfGIM4S/NdJl8U8lhgnpRIP+IpeCwvVw=; b=Uu3GDpNPI+RQ+p1wfSCK6y8ZjiNNVxGT4FDhWv3g8uV1x5fYk64tAU2PXnxrUFlyaVGKhf2YNZdcCgfdx1kiNsa0qTXOpCmepw4sB3byIl6Q+J+7hH/0TPQfhudqLsVjfSd1UelrJr89vzDTuoerQBJiKOt5lNN3/vlKTBlC2fgL+A5fdw0Ol9z2ye/rFARJt6UFdsUPKaYh/3b38PaQQkX/Q5XIyygVseYJMb33KUi3bciHDOTIXyxP3LSDNbQuBRSq5fF7HbVLluWMseBHA3hJQUOQXeCqR8ocgeVQwZsah1z/VEbJhLM1rIHtogxM8xJNLaknYc9IzVtarlk0GA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=drivenets.com; dmarc=pass action=none header.from=drivenets.com; dkim=pass header.d=drivenets.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=drivenets.onmicrosoft.com; s=selector2-drivenets-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S82OqHsPVGbQfGIM4S/NdJl8U8lhgnpRIP+IpeCwvVw=; b=lUQl7m3Npvre3/inhx6EEhI9fY4NSRt3WuyVJMFA0N0B4AcN/1Bna2PGBh3ZOUjdzw5rUU6ineTExZ7hLS0XNpeWW6uwgQzSCNZ8YLqrMYU2sEXGvYG1h7gw+JFiUzaIrfvEqPRsypuA6mPN54zIcUpd3SJ19ePaDPl5ASWkp88= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=drivenets.com; Received: from DB8PR08MB5388.eurprd08.prod.outlook.com (2603:10a6:10:11c::7) by DU0PR08MB9051.eurprd08.prod.outlook.com (2603:10a6:10:470::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 10:24:33 +0000 Received: from DB8PR08MB5388.eurprd08.prod.outlook.com ([fe80::29dd:6773:4977:dc4e]) by DB8PR08MB5388.eurprd08.prod.outlook.com ([fe80::29dd:6773:4977:dc4e%5]) with mapi id 15.20.8069.027; Mon, 21 Oct 2024 10:24:33 +0000 From: Gilad Naaman To: netdev , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Gilad Naaman , Kuniyuki Iwashima Subject: [PATCH net-next v6 2/6] neighbour: Define neigh_for_each_in_bucket Date: Mon, 21 Oct 2024 10:20:54 +0000 Message-ID: <20241021102102.2560279-3-gnaaman@drivenets.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241021102102.2560279-1-gnaaman@drivenets.com> References: <20241021102102.2560279-1-gnaaman@drivenets.com> X-ClientProxiedBy: LO4P302CA0010.GBRP302.PROD.OUTLOOK.COM (2603:10a6:600:2c2::18) To DB8PR08MB5388.eurprd08.prod.outlook.com (2603:10a6:10:11c::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8PR08MB5388:EE_|DU0PR08MB9051:EE_ X-MS-Office365-Filtering-Correlation-Id: d4aa08a3-95c4-40c5-4aa8-08dcf1ba8e0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: u1oPARCKL9tUK1X+eZdfLV4F3xK3VRdlOvvzKEXuLlgr+4XsGM/FnrDoqoRBUT63/aA1EQ6gOZ9YTTd/HLPiv2J3N7wwrtdtalVMj3U+lDqEvJhhzVnDQ4SF8p/KFQdWaOaU3IXkLsYRV+560jJJTPmB41HXzyZQUcqVKpyKAhqqQdmi+MPwafcqQld5nGxAmuQ2V0RMuV9FEJq2WHT3XbMDE0C8uYLNhsLcr7rwntlBF5f13CAkunBYpf/iac7BpteFfNnmL6ChSJNswiht9q5Zgs1WlBp4fQGg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Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR08MB5388.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DH9ct8UT0snPEyuFSLmNEufSRKYqo0nm/+tTV2MyPG0jAPDKZPy9EZpzvzuY4U3DdjMOtWc2jElprTVVyB/1djNbOwytazBdtGof8vNLVbJclA6FwdPF/B6L+fJz77mhlZotKI6OqA3wb5CYa8avqa+ab++WP0IDUMTlwj4rrJ91Hi6HR5psb53GbXIq9QA3Eo8qRbg/Irh7VrGIHt20cbfvIrk/mJVo9iadGsty5JzI7/4RBK2o7gblxfjMtDpvKrsPEYwpEdH9t3T1GSqQ2f1eEobOJK1PPJfAwN5uDRvXeMkOfI2fY/9Bwc9fJowkuQkla4w3QyFGf+moZmJ9uIt5RWfSpbCgUcNFzkfwZUFVBXWTajj9RhuabIDrg1pCRiqNGz1rTGKtCckZ5mYbTtdXibpEk0EHv1I/6+TA9k1FNcNgbTGlTBPHLQuRpXEygME4suzxJ8dNzu3citQS2LgAvyOalFuvjBOE5YuykWqu3hevlmTRsm5Z1pCyifUl5iwPz6hLRhrlpUEeEaEOonDwITrXHg0OnMnRH1CKyK7uq7fTLYg/OTpRwrDFbr+aYt5gdw6DVKwip16/RLdyxUQK+eJJ7up7VtSJJ5QjktK9J3ZoM95Hp8y9Xo9x0SocIvw6LZRf31Ov5vHUaAwfwdI++kTb3uI7I3tsb3EWDuwtrt94oyO1q2lee1+vTtlaaIYEYvd2VflBPttOugsUqBbb7HAF0CHjCPLkDLUPMcFaj0AEhZM8OYjDL+IJEkmWsRozZ/672EzV+e7B2fSsvBEehV/dwkJzDFkm3oFKpST6WGTIY5YzmpY3ZvLrfcPl8TgKwsxi0tkVpsxaLVPAh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pDrcILtdAAn1rX30Dmpoi1v4reuYiqfmwtLUGTMAuNgp6t0CRWuWUj1Oir4KFkQjLC1BB7zjJguHW6Yt7BjGjga2NrDsDn5EBgTIvrK0K6Uq0B2MjuXcZg8FK2Dps16T2uE+6AZKa5B6InhqiCK7SdeQuEH0OZ/qHggGnNDJyqiZ68im3M5LTT56LwKTj47L/bSKxUmlwtIyU5O2XAY3787kr5ZzsJg2dTmtanuEi3rS3X+A+9v1hR02ipxG+VwXEM6dHJ6nShkVbcWfz5+4NFeaQcoukrQ1cVqmevd35U5ZNioYHj1QfgSAKYluX2RUk6rmiq27fwQwUmLbZ6GJODfXAJYM5mCWcNODJEdUsN8l8FGYcJ7IkXvMDkBPTU1jKxkG+agBxAlrm1HpDJs5oVGT4TR7xtHtR X-OriginatorOrg: drivenets.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4aa08a3-95c4-40c5-4aa8-08dcf1ba8e0c X-MS-Exchange-CrossTenant-AuthSource: DB8PR08MB5388.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 10:24:33.0443 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 662f82da-cf45-4bdf-b295-33b083f5d229 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RMmG549HmD8X+Q9S0DGLfDKMsztAkD10t1ELA6YD4crH9zcJnErjpyt0QQSYWHu97wYdrgi+NstM4TNHzX048A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9051 X-MDID: 1729506274-pFf_MJ8A2d53 X-MDID-O: eu1;fra;1729506274;pFf_MJ8A2d53;;495c1e7a27a6c3e35a5fabc922783896 X-PPE-TRUSTED: V=1;DIR=OUT; X-Patchwork-Delegate: kuba@kernel.org Introduce neigh_for_each_in_bucket in neighbour.h, to help iterate over the neighbour table more succinctly. Signed-off-by: Gilad Naaman --- include/net/neighbour.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 0402447854c7..69aaacd1419f 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -277,6 +277,10 @@ static inline void *neighbour_priv(const struct neighbour *n) extern const struct nla_policy nda_policy[]; +#define neigh_for_each_in_bucket(pos, head) hlist_for_each_entry(pos, head, hash) +#define neigh_for_each_in_bucket_safe(pos, tmp, head) \ + hlist_for_each_entry_safe(pos, tmp, head, hash) + static inline bool neigh_key_eq32(const struct neighbour *n, const void *pkey) { return *(const u32 *)n->primary_key == *(const u32 *)pkey;