From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 EC0BC329E4B for ; Sun, 12 Jul 2026 19:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783883793; cv=none; b=YGQSCaV4IPzvU0pnqVlSySbq/nq7jucBOWijJMTTbi6lty/m/qxZSG4g4/QRc4uBTu7oHtaWbX9Gii6LO7QWbuIshV+uIt0l4yj4FueCatCWkDLDgczSI++kkDh2+m6dgEU/Twuuwb9Vbsf1yseHFoxD1TRBpRTu6bfaE8dAHQE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783883793; c=relaxed/simple; bh=DJBwYwVsgPOCiwKIL01/cm5VStqL4G3HoUtXiwz6cU0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Qemj5BDwjBd1ZwtRTCngA0hyVJ3J1yxwPRJPQIAVjzbVnTe02wTXHH6t4jzffZr7r7Xy1uYkVgkHCS4wqEhPqw0mhXJ2PLSRnUfmQhopFTq4ueBXVaSot2D3mXknCXwRx4oEMPdT3HT+wX+khyob2yVcvb0PFNgZZdnUWLHlwSM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nkG6TpMY; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nkG6TpMY" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-84862b0d5aeso2442870b3a.2 for ; Sun, 12 Jul 2026 12:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783883791; x=1784488591; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=BoTRrCxFYKoh3zbhLA1zriCt6azN6tlIA/01b51ap1g=; b=nkG6TpMY07QNHuIvuj0q4UwtABK+Igie10MFBDXmM1I/8XiVk0oYFGlT5fXxmsELtM oqmBoeVvShqTNkDVQDtWRcaBaKgmKm94jc2eWWd6WvDCs6qmMxdKALElZLEyvuXhF5NJ kJWHFK4BuFYexJgFL/CoIVx3WmoIoT5vfjx9WKOq2TRAogAWZ1XdwYJRRCWTF8gYibR4 Sf4XSz9u/0d5ewc9daWgIdRRQXoB7nFZWvp0OhtLfjO0+zIuYMU7eWTcP9gsxZIQ4ivf UBb+aZFQQGLm5clHWZFIWACTwCZf0zIOqVqb8f/JzTCIBorn07rDwrrNRwrUllRQ9Hq6 XWIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783883791; x=1784488591; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=BoTRrCxFYKoh3zbhLA1zriCt6azN6tlIA/01b51ap1g=; b=fXh9QxcAuvKGOPjpUyUfSifr0Wp0Nn+/7tBWPF174n4mR19SXmPj2qVHzfd6/gUMF8 aJrBmqsWcVGPqQ+TOMaSuivGl/7sSFsA/P132/dSx9l42OQRg7jUZKx9q5937++VBESU leXcSY2Qe6JwQ0dDBrOZpmHuNGETcuqZtwT/XSv5x9ppd+hal/cX34lh6k+fY37StNAu kqqTOy6ghfW7aUiGXkPYxGxPhuv28+l8NYUbA4w1xpwx8FwiF207Ngm2VlteLru5HQ63 LFL7jPCCVitXZSAlIHF7NP4Uz8Nzr2gNM6o5llzIpBrnL2QZRz7LiovyJToDE6XdiarE WNHg== X-Forwarded-Encrypted: i=1; AHgh+Rq0+9ZW7bVfl9npaJ46vKwnhFhwFVhfHDyTxHwar638kdp5VHvu/T8IUc+XU8yVP+R1nX5EyPrKzVye1ks=@vger.kernel.org X-Gm-Message-State: AOJu0Ywbk0NnCwxhyfUJ+XhUa55NfDIqwDbpGt8XRP3akj8VNmffYVyc BqDRx5Qr2hu8VcbLmUISHJ4TBc+QUv4Mr/6Kbc8MHR8X1gBkemPYIpEw X-Gm-Gg: AfdE7ckraxG1bZBcbennSy6pGHgDnxagr/VY29vOjveEEZxWsQbj1Neh0oBpmvamGjz FxTQgJFYp3hmVm8qDJcPddfvcZzj3mhBROuaehq/qCHPOzGenKwab3RRLtWLoNAcEi4KmUf8H+l Xv7nNZ/9o1wq+qYWx8StZtw+LLD82E0jCMckU1n1dtuyZyc8q+lHH1ChgLRbf36ETUqO6gJybS/ TfktcRaTCrAeTCDkiluVOfHVhYsgpozG+i/6YgTE+ZsvXSmxRtHdDGvohbcuJeRb03mHojeSaU+ 4vdfkOPangXmCRvcYkXyXKYdaGs5uH2h9Y+lmbjbbJEjiyRGhZ3OJe4sGdrTBXzHMYmr/OVihwC HaDbJSWl6+wkXpvgs89OmfRth4muXwBrYSqzFrobqUXsKy5V/lVno7jNLxgbXiHVkiti20IBEr4 vyhF05fMi67wNY4i8CbyIPx3KtxPZ0WpyJpm0wAw2pGAuvroOnIkoD2mpW X-Received: by 2002:a05:6a00:4605:b0:845:e440:d0ca with SMTP id d2e1a72fcca58-8488963a140mr6089737b3a.8.1783883791030; Sun, 12 Jul 2026 12:16:31 -0700 (PDT) Received: from CPC-mjac-HKWGEZ.redmond.corp.microsoft.com ([70.37.26.40]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6ddc974sm13079371b3a.60.2026.07.12.12.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 12:16:30 -0700 (PDT) From: Jack Ma To: netdev@vger.kernel.org, David Ahern Cc: Ido Schimmel , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Jack Ma Subject: [PATCH net-next 0/3] net: nexthop: per-nexthop UDP dst port for fdb (VXLAN) nexthops Date: Sun, 12 Jul 2026 19:12:15 +0000 Message-ID: <20260712191218.236-1-jack4it@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit FDB nexthops let a VXLAN fdb entry point at a group of remote VTEPs, with the kernel flow-hashing across the group (commit 1274e1cc4226 ("vxlan: ecmp support for mac fdb entries")). Each leg carries its own remote IP, but the UDP destination port is always taken from the VXLAN device (vxlan->cfg.dst_port) and cannot be set per leg. Some deployments pack several receivers behind a single underlay IP and tell them apart by UDP destination port. To spread flows across such receivers they need a nexthop group whose legs share the remote IP but differ in UDP port, which is not currently expressible. This series adds an optional per-nexthop UDP destination port for fdb nexthops: - Patch 1 adds a netlink attribute NHA_FDB_PORT (__be16, mirroring NDA_PORT), stored in struct nh_info and echoed back on dump. It is only accepted together with NHA_FDB and NHA_GATEWAY. Control-plane only; datapath behaviour is unchanged. - Patch 2 wires it into the VXLAN datapath: vxlan_fdb_nh_path_select() sets rdst->remote_port to the selected leg's port. vxlan_xmit_one() already prefers rdst->remote_port when non-zero and otherwise falls back to the device port, so nexthops without a port are unaffected (backward compatible). - Patch 3 adds a selftest. Example: ip nexthop add id 1 via 192.0.2.10 fdb port 4789 ip nexthop add id 2 via 192.0.2.10 fdb port 5789 ip nexthop add id 10 group 1/2 fdb bridge fdb add 00:11:22:33:44:55 dev vxlan0 nhid 10 Both legs share gateway 192.0.2.10 and differ only in UDP port; the kernel hashes flows across them. Testing: kernel and iproute2 built on net-next. The control-plane selftest passes (6/6) and a datapath test (two netns, tcpdump on the underlay) confirms outer traffic is hashed across both UDP ports. The series is bisectable: patches 1 and 2 each build individually. Note: remote_vni has the same per-leg limitation and could be exposed the same way (e.g. NHA_FDB_VNI); left as a follow-up to keep this series focused. Naming NHA_FDB_PORT vs a generic NHA_PORT is open to discussion -- VXLAN is the only fdb-nexthop consumer today. A matching iproute2 change (the `ip nexthop ... fdb port N` keyword) is posted separately to the iproute2 list. Jack Ma (3): net: nexthop: add NHA_FDB_PORT for fdb nexthops vxlan: honor per-nexthop fdb destination port selftests: net: add coverage for fdb nexthop dst port include/net/nexthop.h | 7 +- include/net/vxlan.h | 5 +- include/uapi/linux/nexthop.h | 3 + net/ipv4/nexthop.c | 20 ++++- tools/testing/selftests/net/Makefile | 1 + .../selftests/net/fib_nexthops_fdb_port.sh | 78 +++++++++++++++++++ 6 files changed, 111 insertions(+), 3 deletions(-) create mode 100755 tools/testing/selftests/net/fib_nexthops_fdb_port.sh base-commit: f6f3b36c15ed44de1fbb44e645e4fae8c4a4453e -- 2.43.0