From nobody Sun May 24 22:35:57 2026 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.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 0D4EF368282 for ; Thu, 21 May 2026 02:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779330039; cv=none; b=WfO5BGUZqND1hp5R61M511OSkIp0P3PCYKbhvck85gZN/YY5qciKZ3Mg8jyqa/6LytyU9EoUKrg3mPvNJoC/uNd6BZTRCjwwASvC4l7+/Rpm2cY/IpJF/kv3QGxDvQMomQRN4u3TvjyuTkEI9g0lTn5WLgsTh/HXO1r6r6Mn8oI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779330039; c=relaxed/simple; bh=7pMSZzV/jTSFnIX340yNJSYzNFJz2VQlwCR0R9Wtz38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JhRfmxQzdhzCFYCNfBUgn4UL55b7K6glqqLQrauEar0egr0BzzXNTTqYiwwxMYeArIp9bHfoD/fX9OSN9OfY4a/ZKyVjhlyR8efcVRzvUMkoppauCJuGUy9DkDDQcpzoo7fFyu2RmgT+Erm3wNUzvDXNpORO3EPHrEc7bIv/xe8= 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=qxfjOqHh; arc=none smtp.client-ip=209.85.210.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="qxfjOqHh" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-7e568ab0bc5so6295032a34.0 for ; Wed, 20 May 2026 19:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779330025; x=1779934825; 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=qxfjOqHhX076VmM3QRuZd9U7v1aaOmZJfhavZO65KYnuv+gQQjdLKf3DgPLYaUYFe/ Sw/9jCVJOIJ6UrpJyjVja+5saKyxaFVjWoWI8HuHCGiusm0xQt/1YeNEhyZhw19hBWAF DDAvRSYV7wQc8LrmZFanFhLPezGnvRZHDXy1ZvAmWv1CB6ilylM3Z0BSBXunlIVkIEZi ky7o3JtSXVrZk82f51YWif9ZZ2WoFp82R4n0jp944whJieAGMGdJr+jqMmwLYIHbkQgY bFUVoGZy7srYrYdkprQkpJ3hazkHltLIxriGjVbhqqLj8En/sXZcCVorLbDYdhao7A9a MSTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779330025; x=1779934825; 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=NpAwl0TeDFAt5wgW2TvIW9MpfMvT5LE3XVf+f0xwzGvaXr556IrrwDlioBV8duRkqX /BjRpNczAa90Npe971VWVvGSPNv85JgQIg5fU9EsADQeZesbt0HTM2VZnyKOFDwMvqzi yZtUlw/Z58vvHPj2wyd33NYi8qOpNmGwRe/5+8RoabiSMeS+wPV16f3O/sqa5O2Fzzc1 J9jRUfrMHv2rZ1x3BRYyFaGYsgqORhqYUStV7ECG82NbSgBNVumUXHKCfubWPEONJ5LY lxxWMftelzVb7HmqYjmxFhe4FHT8JT9dlb6xPOK2rtZBv9DvTYvVxcRzkdTRNJTsh4fP cLMg== X-Forwarded-Encrypted: i=1; AFNElJ8RE3PRKlBnaHYZCPSXWoFcXWRaZVEopg+J5PEZNR3RmG2gIJJ/YcswpNth/AVQhESOJH4eTFo1KVjuo6Q=@vger.kernel.org X-Gm-Message-State: AOJu0YweZpjdMcSv7hHfP2FxtFi6aYXb6nD6HUtTibiYLdGwTp6s2FFN jdHiUG1XZHtbUK72FYuUzbm5s38SjdYGwp2ZviFv+ET6eATdAMIPKpfz X-Gm-Gg: Acq92OEDL17xS6em/nBQVOaFCLxfAO9SY70ehRUnp/utyWqgr2Jp4DYfcDEuWuXOZBb nGu0Mf8XF3VEd0cVj8qns5TmWL22ZoQ2thubGAXSBDyedgG5xhZ08SOtoiKfAEvrkGqdKbLyxdb haQr/nMyQCAwMGb7bdRBuOS0eZT676KI0YMu/jRqTtYOvo32vD8VGI511QFcUlGc0jfvNMp2si5 cJ6PrP59+nFgWdWWLGEZeftuFQrGrTs2jWDup3idky7oaQWC2DIt7+eJVPmtUL/ngUbANxrvr0f 3leXQrvEkMhmo3ceja2m/mKWL5T8PWIlCKbID8017VrrGpOJI/QsK9IADQhaRdRdGGCtmJM682L 3A6WWydSEUfEOsExun7OeMomMLFsaIiEuoG65Y8KAVUcw6GDw8C61XfarcT7l97SIzfYJsrZxdm dIumv3ct7XvekWias= X-Received: by 2002:a9d:6a50:0:b0:7de:cf3f:1b3d with SMTP id 46e09a7af769-7e5ea37d7c9mr441931a34.7.1779330025298; Wed, 20 May 2026 19:20:25 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e55b7c6b38sm13791720a34.2.2026.05.20.19.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 19:20: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 v4 1/2] netlink: specs: add OVS packet family specification Date: Thu, 21 May 2026 10:20:01 +0800 Message-ID: <20260521022002.879334-2-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260521022002.879334-1-houminxi@gmail.com> References: <20260521022002.879334-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 Sun May 24 22:35:57 2026 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (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 7C697367299 for ; Thu, 21 May 2026 02:20:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779330056; cv=none; b=O/nMaoWo7CxzaD3Lb2uZij9hqjcM2U7CPVsHExGv8433w/9c0V5mC4K4VAvhfP037eVVDmJLtL5o/ZBSfZvntk4ByiwyGhJuXv/Y5MZp8Ejcx/3Khb6Em7HKdJrmem7teEhpJqnS+fjegIhRbcYHiypR8+k9Yp3F/izLH2lxM0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779330056; c=relaxed/simple; bh=7gkdh/lnQTTuxx6/JFj8kOO5YpwKC2TFQ5qQwabdOKM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LD6RiW6KZqfvJ+hL6QeS6mXr71XFu2sT+lUaB3l9E8J3d0+hj4Si3V5K5V/CaP/7zwV3nNBpBA48jA0kpiQa0xupY/WqBvyxmIw1BJTXXx6pNKFSIWTBrngqCLFgjvbOryFfFWxYQFRqGphnEQATYfxcXqrg6BWQhMww+LIqN14= 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=Q72sCya5; arc=none smtp.client-ip=209.85.210.43 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="Q72sCya5" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7e5c85b47c6so2325059a34.0 for ; Wed, 20 May 2026 19:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779330030; x=1779934830; 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=VD6WSICs4pvbiObFP2CkxZsFp4/ZZorDEVJ/W/n+3iQ=; b=Q72sCya5xDFFU6D8EtDNrSh6IH+0xFUNbu6FNIQbdPqQsTRJC4reOSZBI/XnDJ4Slh 9n02l8rg9y16pYhvWW+XoofKtwctsNxTzSRUun4O3o3X7vdYyAo1eVS0y0xECctska1H 19DBBGAwDhnW2uRwCHgRQeCmV0PcjsFzau9XB/B4+dZr2tNRnW2MPrWxFbkX85Nn+JlR QZwy9X+Exz6/lVHKgmBKHC/98UOkAeIfNoVROr7FRfKqwFR1N1CZWmEvb0t+NzTFJdw8 dEA2GaS+j4nY00bItUHt/1uOAMbtWnd0C6WBMMyEPWsUsdw8yuzSNf2698t4osoZuArR Tz0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779330030; x=1779934830; 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=VD6WSICs4pvbiObFP2CkxZsFp4/ZZorDEVJ/W/n+3iQ=; b=nvCbYdEL0dICEYPxuquwOIuWgxeQ4dXAiB7qz6vAFrDI4c3vCfqwoH1AUthqOCblg6 +NZSEVk40uOntzQMH1QVFdR9UQeuMFQ6QhVGa11FgCrvBL6b/i4Vio8dOEKqOgxNNph9 bbv3U01O8jrZW922icl8nu/F48tWDyuWASRcyoOD0L4tzvDyipHQ8BXnWpEdH4lUXkpE ntX47fPY6+tqscpdIRRN9QP6IiH/temWHj4b/ci7M9yOjwix+k16U57gllqOGdPX4tP5 RCdeK8rqfTQiKF6649YvXP7sqzQ/2UJMRAnIGb1UWtvcOWYLEEytiWAZ2PPP+R+ZcftP qGhA== X-Forwarded-Encrypted: i=1; AFNElJ+FX5hgRntS3C2fTWSvG+InYG+KazGsZpyp3GPSL+bTzYZQEps/SD/E/Rm7oMhxZTsdg2JWpOXWmMNr+jo=@vger.kernel.org X-Gm-Message-State: AOJu0YxWUXw1mPHGLeR/ZXJpQ6Ujy5B7bqbX7X7Dryrn6dB7HsPr1dlX axd7Dkp8aZwyLX18cbI36ugnfy4E3QuZUZDA5SgiLvSAcjQE01exezr9 X-Gm-Gg: Acq92OGUzo/v08+zIZP1hYtctwmvQTtPawG6s4XkzhJobC4Q93tB2ZyTHsNY4CSkquX mhKhSr82wY1UnQrwsk/uXRZQCP8hVaXwAH12ZSffxMf9z5q0tXWPmZ3PUHBYjszX6291puVsSh8 JWQgsttMrj+pWjzAfbDrKxkbMJrSrnRCGj14EaQsHN5wVAk6EQm00SpAO6xQMe9CCMhyovKr8Vv 9h6HzXSAPklppNpIXXkfxPzwUdAZU9hxenQUUy8YNX8lkGT+z9HPhwrnEqcFNcP1Oo5FYwk9hzg fXabhrFb4v+4gjb+BXKCWbOloBvblCidq/pt0n5XurSUDTAGGWHhH/GHqcAIZ9QzfduCf7hPFkx 5622ic21yFHVXbEaZZXrE4s6qrGt74l1okop6tpTkmLooqX4edeTmBt4xB0Q1pWMrym5e8EzDpR JjwPtrKIgxJb+9WVPf+zD9A4kI8A== X-Received: by 2002:a05:6830:2654:b0:7dc:d601:a69 with SMTP id 46e09a7af769-7e5ec5c461cmr395491a34.20.1779330030212; Wed, 20 May 2026 19:20:30 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e55b7c6b38sm13791720a34.2.2026.05.20.19.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 19:20:29 -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 v4 2/2] tools: ynl: add unicast notification receive support Date: Thu, 21 May 2026 10:20:02 +0800 Message-ID: <20260521022002.879334-3-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260521022002.879334-1-houminxi@gmail.com> References: <20260521022002.879334-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_bind() 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_bind() provides the bind-only alternative, with the address defaulting to (0, 0) but exposed as an explicit argument. 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..3cf6fa96347f 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_bind(addr=3D(0, 0)) -- bind socket for unicast noti= fications 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_bind(self, addr=3D(0, 0)): + """Bind socket for receiving unicast notifications.""" + self.sock.bind(addr) + def set_recv_dbg(self, enabled): self._recv_dbg =3D enabled =20 --=20 2.54.0