From patchwork Tue Oct 22 13:43:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Naaman X-Patchwork-Id: 13845721 X-Patchwork-Delegate: kuba@kernel.org Received: from dispatch1-eu1.ppe-hosted.com (dispatch1-eu1.ppe-hosted.com [185.183.29.33]) (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 41E511E481 for ; Tue, 22 Oct 2024 13:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.183.29.33 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729604651; cv=fail; b=jS0/uyXRMjyru9dK3ZLWKeZD8H0ZYd4hSa1T1kBrZCtiDPq6SQJSkH6JR/XMjHt25eGycwvZr0i8LOz0XUcXllV73pwY1cNFYCe7EiNM3tY/Dsp6M30KABsy/kKzJRugu3W2o7LzrYIp40LxqX1PNqg92NABwNxPnor7ZNY6q8A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729604651; c=relaxed/simple; bh=A+5WLTVTgKnbJgd5p+xzqrEFTvxsdewGTqgillMnlVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=lLuxXGJIHokOGN38j8PcQL5FLzQtpDqd9naCGP19AuB8RZTQ+8a9V+8KTJiSKfEA6+g209HEJwW+gmB7IFTRAGt2tLEb0twMZzuMhoKc2mxRKZa9PRT2WNCESIHu6B3tFlbSSZPbNaOYdVtaclOXtX7afLKIQOmQ3wiJWnT725s= 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=qxqcUkl6; arc=fail smtp.client-ip=185.183.29.33 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="qxqcUkl6" X-Virus-Scanned: Proofpoint Essentials engine Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2239.outbound.protection.outlook.com [104.47.51.239]) (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 02D75200058; Tue, 22 Oct 2024 13:44:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EbAP+jehdwIIoc/AIQB7M9ZiP9kNVEO4lhrKv7sgdYQD/RshywM7SA3G5gbG7K+6Tpc3RXY1hd6CiW8rgk+W9c5JwlIj2DOjify/zMWJ9JrbxXoNJvGl9S0DABDraZvYC/fHjK/xL/diL0n6XXa1QaYRggfZXEyHUFvsqXDlQ2++ndKisuHDXQXpPzlC02kmN+g0PVyIAXbamMZAseplK9ytEh1DwRT0aJLonMoinq5WoqrpbTtEbWeSv90x8hS/WoLW7ksKQuCxCTm6X39O38EgGdAqjo0o5Zn4R+3rrZVusfmDqeHqHN66wpcggAZhYlBIuViwKenCz9ihSya+bw== 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=fy/ACKewfP7sEl0cZE4T+cAE4k27kkH0B8TZrwPgTLxVnb4AjcffJGpgOFG6GbpRIXjBRXCG3vLKaXxYS9D/j60mA1yiXHXFzJH9cvrejN6rqcPX2Y7mE/Ykc6aJVMrrb/3YZ5oHAKupXJdFzyp4y5jYpvYO/OuAjpbsCZrftUs4t2tDSRGgLtZa7FMmQ2C71EbCUFCcMJj0fT1Vo/kxK9wOtZRjuZa2V8aDz+Rtdcc1vL3iW6xB6hhEGbiMncjFXH4CfHgs583qQ7wzhp0zcLapJPUy3EocjnUe3ehrQHALz++0yKNd+DLR4M91Tcw3dLQcyJQ35HlWWSPbMh4z/w== 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=qxqcUkl6Nl65V+4vSMkMk9cGpgcwYrmh6Wum7R0lK1rnexWFFBmbvzRM0G5RzktY7bIHYl65livMrKC1svfS4evj1z8cQUE6khWVlntF8dU4ThowG2NI1Mpzi1ffW6fEmTi8sMRJrO0irBJNNepFYCYSTbWD5GCo62mFjLhrBN0= 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 DU0PR08MB9077.eurprd08.prod.outlook.com (2603:10a6:10:471::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 13:43:54 +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; Tue, 22 Oct 2024 13:43:54 +0000 From: Gilad Naaman To: netdev , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Gilad Naaman , Kuniyuki Iwashima Subject: [PATCH net-next v7 2/6] neighbour: Define neigh_for_each_in_bucket Date: Tue, 22 Oct 2024 13:43:37 +0000 Message-ID: <20241022134343.3354111-3-gnaaman@drivenets.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241022134343.3354111-1-gnaaman@drivenets.com> References: <20241022134343.3354111-1-gnaaman@drivenets.com> X-ClientProxiedBy: LO2P265CA0192.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::36) 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_|DU0PR08MB9077:EE_ X-MS-Office365-Filtering-Correlation-Id: 79d41c71-600c-4a6c-602a-08dcf29f91fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: LiXeIKJ7LumMcRhby78IIue/qkZAKUFqFsXBz8/BNajg1gQ8L6pHDabbQyq75/ueMCg7fF4nlDys3xJfQVsmsiXNvonLxQjZGeYOeG7S1hHJ+rrHnoe+9/sL6nWjuopzwmbd3WfCMSstpBATHINnHBGEUp2jWdF9D9kxDQ1VpnyDHYoDWLdxYnm9mKaybnfwsctPMebrTggq66ykByUA+Z01xM4VBWZCbx+ArqdD/ix4sfjazpfqADjvD0AL+76nffxxNPTi4nz6r/QWLQawxLnfbC96EHqLPsreSm94nkAj3u1xD0jMNDdJ6TelxLN1yclFbA0S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255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR08MB5388.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sh5Cj8pRBH11tvKhv406hZ8T1jwUgIQEJ/YOnxxI49yIbnTwPAX/Hek5zzP7KB1eu3OehZb4lY2rh9PtKM3EeSM2714G7/YyZ3c4HwXAI2kSNeUAuDeob9PNqPMA9LlDxkOhz6a1+lVCaF9YZgXaTrRQ5F0S9nGgQY9Fu8GDAZlsq9GvpVLeyYOBPWI6Ka+HzRHh8Q2z9ha5WZ8yOWqQVMdCylOQxdIbjKGPQ37S4TONf38anDdICyQ09feZWR5DEDc6n7plHxOPNk5G4qlUM5OrFZ1qHZgaA7nCmMA2vC5IVaVqKCEI4fxgulodANVYm0ze6bSsGZIaQ98dKFIXYJCEaUyyS6R/qillu9ioaDCOQuYuSSk66BUON8X13j0pOiRTrcmueE6ErGdml82jnZ1phVsn5B4szM1xp8V8mAXLA86vv22ZZYBEOUvTVHAwlzYRttx0VVy7dpA9b9XyrgDzV9plLvqcfVtVHNhqOwEkY56xkHFm5//SSMlHgeCr8L4Vuosi7rEy7uNL9CXc+Yrj/EtWjPSot7dULS6WIqvCaMX+aL6qR0wdAXmHx4CAAuBgtEOdWORsIpNlh22puB0fa5RACGtQq5OTs7v0JXWyTK1Qz88xXdnczbyyI3xWfhEfbTGboWPPsUZaAqyZjJHNOmJphFC69obOJTSydGnl0F40h6C8AgLb3ROSU4zCmuUaK6/gCqp4G7/hr1wEEOj0t091NKJgt/OA/7+rO6DV4I3+c6L49zLiGEAMKc6gwXuuVwRPahpkhOXdyGOJ5jtQNpBcZWQ/PrVVN1F/xbhxiS9Gg1gL3/GTeTbsEk6Hdr1EnxT/4eLdM9pqyTI7BXwZ6MpOuJnpkJ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zxGG3vhGEdeWXCz//3Xf5njvCN7Z/MM+BaGOvHxU7JJb84Wzj8PDRpVq3h3oCmIr9ATSeg2fAU9bndQXYxAcw/4/rAuU2aOrsRwCylSzHO0I64fE2WwrpNmnkKvMKg5GXukfnHAwy3ehnmuyeYveF6gfR6oBQL7mz0zEKVApDSEdsa5g4x9tnGcfVAGfVwWulgemUPcP5Y+i7Nwm0AFa19LGwkKI2po/cjveHqkQ/RDh4GSs0ywACiE6rn/wSCeahE4d+TeqYiqpsla+qlAdsAGNVh8JO0jwJ1Nij6aNMMVbjFsinPq0BIwgIvGjP1o/k2pWmOcwf0NL8zAeYPheNHNSZamkIsyPpmFMHOTzUkxH612xBjoQ4HfulExE0x X-OriginatorOrg: drivenets.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79d41c71-600c-4a6c-602a-08dcf29f91fc X-MS-Exchange-CrossTenant-AuthSource: DB8PR08MB5388.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 13:43:54.3974 (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: PXasvq61ZRYSjMQkFf9ttTwX9x8urxmIwpYUx5bhqN9/TKu94WvSj26dHCDzpxKc2xq4Py5lkfJwB3+nrXWBIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9077 X-MDID: 1729604641-BJzk2hdVjgyq X-MDID-O: eu1;ams;1729604641;BJzk2hdVjgyq;;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;