From nobody Mon May 25 05:12:29 2026 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (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 2DEB548C403 for ; Mon, 18 May 2026 16:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779122450; cv=none; b=pf7RYhD17HzqvZb9TBsGRa4i5It8Air189WY9OoC6B/L6QPI8SkaICx8zdIGOFUFpyyPnzavnKZkQhU0JhuL5v0vFy2J04034RC/Q8R3tVYZKLiiJ1XEhsdoS3cA7mKuMfAQMf7056oOvQA7P1GU6v4CjjNNbdmjN/MCPYeCO0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779122450; c=relaxed/simple; bh=6YSVS5kkWuXkdYKSZyYUu6RF0k7wNNZX9nmDxqJjj94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=joWtMHLL4AzEBIymyf+fq8cmTxZCrWlcqBQIzKXWaRRYNhS/3yhYm/dSMMx81SWf/Sg+qpUV+unSZ2JqieHABIgp6kRQJFeZgKxTHzuCW489YTBirJ1k0viXf2HKPm2VxQtKok5CGm9TzxTUfOSwUgbzcsujVmvOhqCqdklrBbM= 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=L3SyRPWR; arc=none smtp.client-ip=209.85.167.176 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="L3SyRPWR" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-479d9b155deso701001b6e.3 for ; Mon, 18 May 2026 09:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779122448; x=1779727248; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OVJKiAuHQ5r89pkL74jN+DOLogpMgUXAIknghHQozjo=; b=L3SyRPWRpz8qiQ3BHxX2ObL7W4JKxj7/Lp3QoJnUJISDEAoumACFpe7+EO5/BTIbSy TSd4s3LEaSv4K9CkoKutxZK8Gcfr/iOrpyt6aRsh3qOA9qMKRjs+da64QkpjaUWOpCKj /A171oeTyWx81rNXPyv2vchphRNDZwKggJushD6H77GqIhX1+XVQ4PPmm6BNH4KpKEGS ze3HF4DBzKvInUhmpXRGUIsYhba6gHoqxGVbaxRzK+9ojTS+dT4lKtch6A5K4aI0Ojuw VlDgE9ue9WRdDuoFJRVqBG/iGrlGzQkIXwIBrC4iC+Nr4d/U2YtSc24l83khDjM6q6oy 738g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779122448; x=1779727248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OVJKiAuHQ5r89pkL74jN+DOLogpMgUXAIknghHQozjo=; b=OQIUNYmjFRaoJYeMIJWtXomnLiWR2OD0XUArZm5dpxRDzhYWQZHQKTbWmLwbuT2S6f R3ObrBeRBAs/cl/HsGViyArpzUfSuBorqSEwxjkKgST6baT8FIhxgyW5WOUrLKizOxuL kAkoa+r0NHDZOXcmk0JnjBPv/nhrgd03OnrCY3OaIfOxBcuix0Uc9Psx4e/q+t8RYQ+w yB8e0Ms0YOjzdVvIb1KxKxlIKBchWvf9rYDdk+Pfp4piXHdtxASUGA9P8q5sulSfkIVr H9Z0KYTKHvuTW1DAaVp7aygqoy0ZNYI8Q1X55ijXIxAY9txafTFUDztyFo1htQnbFAWi bY+g== X-Forwarded-Encrypted: i=1; AFNElJ+sCrJhIYSWJ8NV6W73q3BbbixTrc09v1mPLN75ynowAYhhfyefBKJV6hBEtemQi8HKKm9FLKBSRVNNzm8=@vger.kernel.org X-Gm-Message-State: AOJu0YwMzYqFY19H9WCNiIXFKEBn3QlQigL5Ikpje5XyVC9r9irm+smB etmXSVk+1jvwN7yBfGmdbtP4tJnp8s/1y1Fi9iKuz7p/Fjl3itbQYQFQ X-Gm-Gg: Acq92OE6J+wTkpN6kMp9stRQAcMVoPNLZam5QLmKEYRgWa/PPrHZhKxVPN8CKMgdVMl sBbUhU52TGfSaukaQJ7daIbU/rM+FHPgxJiV0bHUNZbuE/ANN003ZGqTumzD0MPgVu/mT6HbZCF 7Ch0bHxbc8TOZ/00rbePnJhidwvXpN0w4L346r5khfmSlZHF6RRw97CybhqZEjZhJZSLOAKPNjV F7YwKsBKIEzzEINmGIvlXaWimqkFv+QGWX3MNwDQ4girCU9h56grLzmcXTX3+LQo1cERO/llZxD XgQKbJ/GmTznFMIDDcmR2pPCWBcL26+cu3v5s+aya9tsqtWTc0jW+cJoEe/DHdq8QXtE63qTAu0 40vvBE1ZcQk5SUJi7MrP5qBwo0t9Lj55ONz0R6K3ent1rCQfhA7LnQIpuo8dk9scWmivZMPzuhJ MvVksNAojehVlrIxU= X-Received: by 2002:a05:6808:3383:b0:466:f57b:2ad2 with SMTP id 5614622812f47-482e57396f4mr9766307b6e.31.1779122448079; Mon, 18 May 2026 09:40:48 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-43a94fc2cdbsm4593877fac.6.2026.05.18.09.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 09:40:47 -0700 (PDT) From: Minxi Hou To: netdev@vger.kernel.org Cc: donald.hunter@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, aconole@redhat.com, linux-kernel@vger.kernel.org, Minxi Hou Subject: [PATCH v2 1/2] netlink: specs: add OVS packet family specification Date: Tue, 19 May 2026 00:40:27 +0800 Message-ID: <20260518164029.439928-2-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260518164029.439928-1-houminxi@gmail.com> References: <20260518164029.439928-1-houminxi@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add YAML netlink spec for the OVS_PACKET_FAMILY (ovs_packet). This completes the set of OVS genetlink family specs (ovs_datapath, ovs_flow, ovs_vport already exist). The spec defines three operations: MISS (event), ACTION (event), and EXECUTE (do). MISS and ACTION are kernel-to-userspace upcalls sent via genlmsg_unicast(); EXECUTE is the only registered genl operation. Key, actions, and egress-tun-key attributes are typed as binary rather than nest because the nested attribute definitions belong to the ovs_flow spec and cross-spec references are not supported by the YNL framework. Signed-off-by: Minxi Hou Reviewed-by: Donald Hunter --- Documentation/netlink/specs/ovs_packet.yaml | 130 ++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 Documentation/netlink/specs/ovs_packet.yaml diff --git a/Documentation/netlink/specs/ovs_packet.yaml b/Documentation/ne= tlink/specs/ovs_packet.yaml new file mode 100644 index 000000000000..4c1f06630e4e --- /dev/null +++ b/Documentation/netlink/specs/ovs_packet.yaml @@ -0,0 +1,130 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cla= use) + +name: ovs_packet +version: 1 +protocol: genetlink-legacy +uapi-header: linux/openvswitch.h + +doc: | + OVS packet execution over generic netlink. + + Only OVS_PACKET_CMD_EXECUTE is exposed as a genl operation. + OVS_PACKET_CMD_MISS and OVS_PACKET_CMD_ACTION are kernel-to-userspace + upcalls sent via genlmsg_unicast() to the vport's upcall_pid and have + no associated genl_ops or multicast group. + + Several attributes in the attribute set (userdata, egress-tun-key, len) + exist for the upcall path and are not used by the EXECUTE operation. + For EXECUTE, packet, key, and actions are mandatory (kernel returns + -EINVAL without them). + +definitions: + - + name: ovs-header + type: struct + members: + - + name: dp-ifindex + type: u32 + +attribute-sets: + - + name: packet + name-prefix: ovs-packet-attr- + enum-name: ovs-packet-attr + attributes: + - + name: packet + type: binary + doc: Packet data, from the start of the Ethernet header. + checks: + min-len: 14 + - + name: key + type: binary + doc: | + Nested OVS_KEY_ATTR_* attributes, extracted flow key. + Defined as binary because the key attribute-set belongs to the + ovs_flow family spec; cross-spec references are not supported. + - + name: actions + type: binary + doc: | + Nested OVS_ACTION_ATTR_* attributes. + Defined as binary for the same reason as key. + - + name: userdata + type: binary + doc: Opaque userspace cookie from OVS_USERSPACE_ATTR_USERDATA. + - + name: egress-tun-key + type: binary + doc: Nested OVS_TUNNEL_KEY_ATTR_* for output tunnel metadata. + - + name: unused1 + type: unused + - + name: unused2 + type: unused + - + name: probe + type: flag + doc: Packet operation is a feature probe, error logging suppressed. + - + name: mru + type: u16 + doc: Maximum received IP fragment size. + - + name: len + type: u32 + doc: Packet size before truncation. + - + name: hash + type: u64 + doc: Packet hash, low 32 bits are skb hash, upper bits are flags. + - + name: upcall-pid + type: u32 + doc: Netlink PID to use for upcalls during EXECUTE processing. + +operations: + fixed-header: ovs-header + name-prefix: ovs-packet-cmd- + list: + - + name: miss + doc: Notify userspace of a flow table miss for a received packet. + value: 1 + attribute-set: packet + event: + attributes: &event-attrs + - packet + - key + - userdata + - actions + - egress-tun-key + - mru + - len + - hash + - + name: action + doc: Notify userspace as requested by an OVS_ACTION_ATTR_USERSPACE a= ction. + value: 2 + attribute-set: packet + event: + attributes: *event-attrs + - + name: execute + doc: Apply actions to a packet. + value: 3 + attribute-set: packet + do: + request: + attributes: + - packet + - key + - actions + - probe + - mru + - hash + - upcall-pid --=20 2.54.0 From nobody Mon May 25 05:12:29 2026 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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 966C148BD40 for ; Mon, 18 May 2026 16:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779122454; cv=none; b=ZgT1NM4sAu5pXk44LguUPhOF9nO66BRB9dNheITaKG3KagrQIU1tjp8++QtF8FcWK6tt5WJnrhEM00iO1DT2qEREPUm616W0zJxyz/IKi/1vXpTQuVBDTUbzGmXfSmbN8cqaa4vFLm+q983X6OG9tpCPZ05p53FryHwi30oeCI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779122454; c=relaxed/simple; bh=TmJGcAWVQo5UOmOu/tga5NoZgiH9iADZIX64dMCrfWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gJ2ivrcjPk1g1AYo1GxEffg1J5jIeAl2sWcI9TXB/DX918E+MDj1RzsOkHlcwi0rNN0SSNvBttDeccN3A8xrEPpL8Ay6aj8rBWAA1cBLkiSM4keFd1bPkoz995+G5HJMZ0CMilOg/XbGue+zrL5K7BxYSGVA/lVSfMBDetAmW0Q= 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=HI1dDOuO; arc=none smtp.client-ip=209.85.160.47 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="HI1dDOuO" Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-439a7e828b1so3096091fac.1 for ; Mon, 18 May 2026 09:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779122451; x=1779727251; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m9rzbyO0L/UEGnlo5xdTOZwQ03g+59F1TZtYxaJ1Kbk=; b=HI1dDOuO9iM29lQ/IF/PhDwjl+HWxNrkpb1TeC6mQM/cub5Nk+TBDQ81jNhbWJDjjt X8MLLqFG/QPKkc2E/un+0TqR4wVGLU+rAXG3brdMfV3Aqft1jP+gAL931UkPdoWympeM C20WWZbM8UL7XM7YtVTU5Ynr24vkwxuij7FepEjlyuO+c53mKzewewQLl1ErOVei7GDp zEo3BITmnZ8cNoYVeVHJG08F/rLh+u1Mn1oCTcM115fhY8MtwIF58t+Nbkmh00vjkizz tEABTbJqhrHcSQkFpGxDwiZvZfLuK5yIbDqEq+fUcZql5jzs51kW3Fy2PZKdkKZNor/J 68Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779122451; x=1779727251; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=m9rzbyO0L/UEGnlo5xdTOZwQ03g+59F1TZtYxaJ1Kbk=; b=PdnNGJ28FOIA2UDQQaQ6rBodYCol+5T06jvGUq4+2FbVIYjSiHAZn5ZuSTdm5z34v9 pLIrjOvzX0ds+fAfDcav+pChsh0t/WU1Saq773BXAPvbs2f2/q6WwXgyqeeYRc8ZjBuX U6I7iMNBmc8wDKxYGh61N2kAG4eEovtdC+fBLp8et/+mfwpgF/RatTm4soJpv+8Bc6Jb 3teRg6kKKGMIBT8aVKTHeJ+Q5UkXMxY9zC9WPVzXN/Hqx4o1nsDmgFaSPny+1/6Ouhhi 7FySLxpbzsRvQLtNneG/MVONNI6cw2MuaAR05gf3hcGm8dvQh/ekMQkUPy+x7rQGgrX/ qS8A== X-Forwarded-Encrypted: i=1; AFNElJ8i6AlKKegKeC2pM1kBNZHN5VlNDfZlexootMP8Lqvi/SggqzD5vl7U4pWupRfMb4Abj9RskbBqf3EQke0=@vger.kernel.org X-Gm-Message-State: AOJu0YwOQj8zlntYedymu/G58MxmZe3QZ9c0Bid87GCU34hx2kjfOKWi k/EA2x/BicTdYL+/fNhzXRixcQnhqV/+p4xJDrA7ca+cy8vd9S4pAf/6 X-Gm-Gg: Acq92OH5HBr4JfrWiMct4DMayJ8YNMxdCz1TSc3Y8PgbYbyYqcvn0PPKL2UET5scrTu hlzDM7EXFkZF4d7C67/eeTDdDt5ECksnguBbX3c3XGxhC6O5ly4Lmg5XYT5fuGCD45adrbMXQU1 KOvVvTDhCwNxn2+uWTA5bZ/IP7bNokpj5AV4o3cHqlMNYtCfZnxYLDK1+vxxcdWww5W2hTcMar0 R5jXH2C8/4XoinWPV7aK29KCD8SFcJvS20ukpu6s77riTX++LErK1GyL2XVweP8DspMwLihO2TU l70jieWkw0dZhDsoJllvv7gDgZ65NHT0bZOColkzGLBHDBP3IQ0lWYZgtYo4JTQJ5KRlEZf6bnX JQ1CKXGyJu2fmbxAPtYR/eLkrdPNCC8MEDQiIAtKxsjXaCGYXhkwWsB9pij/sLT8FS9WGe6e3Pe YCVlTv+zhxWVUGHCbcFiTA9Z2BOw== X-Received: by 2002:a05:6870:e0c7:b0:42f:eaec:414f with SMTP id 586e51a60fabf-43a2ddebacemr8597301fac.19.1779122451466; Mon, 18 May 2026 09:40:51 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-43a94fc2cdbsm4593877fac.6.2026.05.18.09.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 09:40:51 -0700 (PDT) From: Minxi Hou To: netdev@vger.kernel.org Cc: donald.hunter@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, aconole@redhat.com, linux-kernel@vger.kernel.org, Minxi Hou Subject: [PATCH v2 2/2] tools: ynl: add unicast notification receive support Date: Tue, 19 May 2026 00:40:28 +0800 Message-ID: <20260518164029.439928-3-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260518164029.439928-1-houminxi@gmail.com> References: <20260518164029.439928-1-houminxi@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add ntf_listen() method to YnlFamily for binding the netlink socket without joining a multicast group. This enables receiving unicast notifications through the existing poll_ntf/check_ntf path. The OVS packet family sends MISS and ACTION upcalls via genlmsg_unicast() to a per-vport PID rather than through a multicast group. The existing ntf_subscribe() couples bind() with setsockopt(ADD_MEMBERSHIP), which does not fit the unicast case. ntf_listen() provides the bind-only alternative. Signed-off-by: Minxi Hou Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/lib/ynl.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py index f63c6f828735..04743a79a7a3 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -680,6 +680,7 @@ class YnlFamily(SpecFamily): Notification API: =20 ynl.ntf_subscribe(mcast_name) -- join a multicast group + ynl.ntf_listen() -- bind socket for unicast notifi= cations ynl.check_ntf() -- drain pending notifications ynl.poll_ntf(duration=3DNone) -- yield notifications =20 @@ -748,6 +749,10 @@ class YnlFamily(SpecFamily): self.sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_ADD_MEMB= ERSHIP, mcast_id) =20 + def ntf_listen(self): + """Bind socket for receiving unicast notifications.""" + self.sock.bind((0, 0)) + def set_recv_dbg(self, enabled): self._recv_dbg =3D enabled =20 --=20 2.54.0