From nobody Mon May 25 01:57:39 2026 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (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 975CB3164C5 for ; Tue, 19 May 2026 10:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779186739; cv=none; b=QbkUY/yZ2SgBmIBOpEY217o+2AmAlvCzL75ZJVuXa2DLKGRXivNNF+3/Uu3ytRpJD4ofzNTO0UjsutVwKTmkLAO0duGl9RV9NWqwyHBeWKn7LzUCVsRieX5JYnmvd+1+DfX3xCMnOyNvqhTl5NYtH8ARCQ9ORnMj0MMR3rkUjug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779186739; c=relaxed/simple; bh=7pMSZzV/jTSFnIX340yNJSYzNFJz2VQlwCR0R9Wtz38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hb5u0RE+Ep1V3MEfp9LXYvexu6CyZKbUMRb9btPpiWbkXGEWps1GI099NW9xrDZ/SHRRMnprPhUUIbfdBJfYm8NEe/UA6kktrFG96wT3yVEgewc8DGBDndsoxm7Gwr9+HvXGcC03L2lx6Kl63MpxaYcIbGwl84p+YifDaunM7zw= 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=fyJIjxeD; arc=none smtp.client-ip=209.85.167.171 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="fyJIjxeD" Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-479e6bc357eso1178304b6e.2 for ; Tue, 19 May 2026 03:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779186736; x=1779791536; 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=7cbDegg0JqhGywTNxkPjolkEASCiwR9fy2G9O6JnL4M=; b=fyJIjxeDaDZjbbKhvVXaK6gtL7/SRgOpfYCIrQU8ogfz8tAgHtY+AUVaMWYi8Ym4nK 5lFl/rvFZDIcs0Uliy+jH+n+pRN+3LAqrXyC68AHbBun50fP6mmcC+k4OfIyLSSxZcRx fXeqp7bB45xcDoDR60qvGX6m1H58zO9v5IaBwqZCP7/ZqPIJ6MviPxyIe1NU48Hi8byS cFtsN709wva86j7rFTvPNCpaKfRUAJg7Wn6fOxYi0AxtFoWZoxsxjXLIYy9LJUnApd/Q 5f+8UVJkTczkYaB5E+JC37qX8XyG8nwwwXZT988rsNdooVea98NIMvdCGax/qxjpXvCq XMMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779186736; x=1779791536; 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=7cbDegg0JqhGywTNxkPjolkEASCiwR9fy2G9O6JnL4M=; b=mjbCFVrhmXzOM6NP9oBgZF1stKO71pMCr7U8Q6N4TZDkLbsP7aNLYgsnvSL3EtMwf4 cnxSTn4ICUt/WrUQgLo8p9ke9TAHGrHbTuo6G2fMJX3OV41y82Ky5JJ/cQp3HsekDrnV Fpbl8KHfvvsg1reBSnD6+/HlrVfJe5DRh+HqBnMG/DnvxWL1gmKFSOWG4x53+FQvtAVC 9MCmkI8TzeOq+SpuWvCOyaqQdzag3CUj/udnUIVIlG5lfZEOs39HwSvin9C5zg/wnhdu QoUkf2dtAYUhB8xHZ0Cad6P50HTFnNf/X5dRxzERkgkV8gpb6OyJsiKCRYiXuTgwoS/P XKFA== X-Forwarded-Encrypted: i=1; AFNElJ+po5t6T/hkT/QVXiLfEbNXoU6wAYHfeenXU1rNbDEnadnZ+5kTD4D1+BwyI2iM+60X04LWfeXEiaRC2LE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/ZvbyOPOf189sat5Pw/2gVB0A6JIrzZ3+42FLFvJmRc0LAH/Q Nt3usGK6MNxUHL6a/mGx75HwBoZfFxrZvQqLtajjO+DfvM6OXdpLcl4N X-Gm-Gg: Acq92OFuS1thS3I9Cb+Mrkv0LPzqORLUjhxXbBJpAl9l7m3nQEGO63ffryOopBMNi/K fchP0obyqcuVhKa45IigmMdhPTXOLnTQ/AGcXO7h9WNxMZyySGVYi2f7ms4VhynxZzBP4puTTlj GC2bATzMixvoAMxmqvJusWKLOimOOnIPpitAUXP0KBMTR62mMOdY7fYWf/ip/ZbGKe+WLxKS4q/ Yk1F4fJF7JabWAbePtUuMkFCdoetZpf1Vx2MAm3Lml67CghqDfw5zb0r0fCUdGomM4xH8AxSTOt 3XrfamL6XbdJFJMeC/D7ljaXjsU0cyDmrhnkeIY41CDUi/OJX+p+RJ7qN+Uosbmttam/gkDBHVs fW7WCrUYJKPQGRk2li7CRjhub2l6bd4ipisLR/bqpF9tkzd5Jh0zDMQtyJwEnWr8GB7ZoTKjst5 S4+8Um2D7xQFX6kEk= X-Received: by 2002:a05:6808:1705:b0:468:6a2:897 with SMTP id 5614622812f47-482e55c9d18mr10749014b6e.6.1779186736433; Tue, 19 May 2026 03:32:16 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 5614622812f47-482ee389243sm6360969b6e.6.2026.05.19.03.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2026 03:32:15 -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 net-next v3 1/2] netlink: specs: add OVS packet family specification Date: Tue, 19 May 2026 18:31:52 +0800 Message-ID: <20260519103153.968549-2-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260519103153.968549-1-houminxi@gmail.com> References: <20260519103153.968549-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 --- 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..e4c5f24b3b01 --- /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 01:57:39 2026 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (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 B67F531F988 for ; Tue, 19 May 2026 10:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779186748; cv=none; b=J16liSctL2DNOIJhQAEEtTcumD3mtsvLv+5fRPWvnFmpq2hJbRnB5p507Rvmp9/W0YhiITbc1LtiQRUGbG7VUBuPmnCNbDMx52F0jj+SUOAfNIk7reACm0odYTllMQxwpgXqpczYJvqJ+hxIMH3xH1mug/SaWRNnibZ77ioNKZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779186748; c=relaxed/simple; bh=TmJGcAWVQo5UOmOu/tga5NoZgiH9iADZIX64dMCrfWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nEWngHHcx/SHwdOnA9W0f/O6hMmkmM8kFV1RhJLCP2K2MsczcFdZsLPFH5wgATdTmahP2CI2+ZQBYnv4dkz5qYiYynquhHPyMvrmr1vpP04i9u2Ixtufhs9U9kue/zF1ncXGPUvjKmWn8IpkXolxVDzdm4aTypSMpqrTZm9voF4= 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=ToDkYu5d; arc=none smtp.client-ip=209.85.167.170 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="ToDkYu5d" Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-4824b15c19eso2996893b6e.2 for ; Tue, 19 May 2026 03:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779186746; x=1779791546; 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=ToDkYu5dOPfWU6vVcNn+dV/yo8VLTrrww0wXsrb4pOMRRqF73Agg9Pw2bA2InCygWD PlEwTNpEWaSOoVZgQIy4Aq7J+nvi7D6I/Do2obzWQpe7kiWSMZHCfTMWL11FspTY7kts kNQ17doTjXqocmr9K/fl75PdRwAfO2i9vBWeoWjwMN+LY7U5K4wfnhsEI37xU+JGXI46 lL86A5RhJ3DnzNRvD5+NiR/xWBHnxjqUYurhdA7gC/hwW6ym1U4mAf2CkTKO63MDt4jx +n/4vC2GakgkKZGUS2j4qZZWvGnIazqi1KQ1X58Po63rOFWUEdyI7pcQEIOVY4CcqVvn 9a3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779186746; x=1779791546; 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=W93ZfRSbGhR+18dNm6RMNxdSVuhN/JJp2yO9yOaDcT00DUKuKuxLLpzNLUzokMRqJ1 cwB2U09sq6DGsgFatnjyTVX/gv+dTTCpkqNFjJkAcKFKPHz0OLO2KGAZO1+xH0QXYxns Dlu7V0h5fnNdi0qoKGkXPyr08ljGEO6q1Hq1AGfbwWk9cBh2ipDUMecW3jN9KzN3fk9Z 3pvjg7Blw+D2Kj948fgnHb0BXCrlI95iJW95sbhKD9E0NV3fkCt40lRR74Oundzoxs2U iV/jN8ViyvdaT8h999tfyUCdZ2T5BvVpD0hK+4E5fNY+Mey275CSuyOLvS+44YmkFwf/ FwSg== X-Forwarded-Encrypted: i=1; AFNElJ8wFn+nxjdnuC5Y1n4nV0RWtOhD4Qh7KQszU430xRTU2kCXEBEumqM+zVrobKMlM1Wt52vqbiHR6CLLYsE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7I2LDIr2rEB50pDS7UaV0QosHwT0waSrljoDmX1i2f/7yv7es in2PIMpHVUUR5VawOXZ1WVS1gugDq9UFaXfMvBULWeFMab1v3Vh7b648 X-Gm-Gg: Acq92OE/7n0WuH7BXEPizXRPUCA2yGgA3SThZG3W3hsHao87nEDpqNaVY3tySmrn6Ec kXtj/czva8ydrC7HNDNL6jjD/pBdFaEDh+HGCcldWTgVxuUblri8OxZv594xqASjdF7potZkxqD y3JlSAcd++Dn/FBxnFJS9XjAQj+8c+244f9Jn0vI4U+7hFU38hFgsZCwBqwPhpeTZVG/1JJeoAP UnoCpkPLYiMafb1ORU+fxJEFANxPlSQA0ZYtt6lelAqUubG1nthx9061xzBCP+TmqBC/finN7in vzZKRiskfHr7scRk1uGsgfvviNwww7ycjJqyOv6XL6FonGrbeLd2eOtdYmESOkyc0RUzxf2Oi+G 7TbYMl+2imOUj38Qei1zCvFsV+ARI32yrVf3Oe69o2vSuZZzskPa0S1kdFB8Lfv+8CovmSMQIQf YaW8TAUzhNLGpJ+BU= X-Received: by 2002:a05:6808:1482:b0:479:d467:1a26 with SMTP id 5614622812f47-482e5bb9669mr12107718b6e.43.1779186745684; Tue, 19 May 2026 03:32:25 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 5614622812f47-482ee389243sm6360969b6e.6.2026.05.19.03.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2026 03:32:24 -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 net-next v3 2/2] tools: ynl: add unicast notification receive support Date: Tue, 19 May 2026 18:31:53 +0800 Message-ID: <20260519103153.968549-3-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260519103153.968549-1-houminxi@gmail.com> References: <20260519103153.968549-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 --- 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