From nobody Mon May 25 06:41:33 2026 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 DFA3936AF6 for ; Sun, 17 May 2026 08:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779006863; cv=none; b=KNE634iTUhckSXabvZluVSq92raCmGkInUNvV19kQQA3w1dbbYw3boQ+VBCX431gCtIjdh/uYRUslEzaCOH5a7YeKxp1QVzcCNjFh8xcIigZGX3Qz/K5lkcur1/gedQFEJgKPbswqEWD3jBBCDfm1iJU8E5mqH1k38nJ+8Awck0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779006863; c=relaxed/simple; bh=feLLfQFvpoIClWFfZ2Qy7Vj9jKgNx4+zS4dEVQfjxm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UvelTknAZkVV+DvK/N9HIu4REu/H8t4xT9cZco/GD36U1q6AcwinDJ4m3EVRtXGhBxat5OSunpXAivHtSB5/jOcEmGyW3dxb2IAhsHdIK6BqOn64ahsq78HylRWeKNMmFC7+ebNttBrm0gslYvsx1WlBQn9GbwJKMQefaYGwlgY= 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=cytnjjUS; arc=none smtp.client-ip=209.85.167.175 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="cytnjjUS" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-47c35be02fdso406555b6e.3 for ; Sun, 17 May 2026 01:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779006861; x=1779611661; 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=SeQkqDrAPMYn0zYuhzYdu377fHXEuEM6zjwZuagDHgQ=; b=cytnjjUSyuvVimvJfns9Vm9BOHOOdLMU7BAQ2VPWiQhlVatdZVbfO7y+9KVaefuykJ Wg1xGjeUvazdQiEmNUohd/i3mUwxLkPYTtUcZuTK0I1oUqoBMOjEm6GD5n0Tjymm7IC6 rMpH5DuLTd4Q49TVZKNWzR6o7hlucv1nzc+Be6KdIQoUvnTDt2Fah5Om00vnFd3fE0j0 eS7JjVLmsNMU9lvItA2ffVXmHwrrWn6zmn7hC0E+78TUhxIdVnOEgf8polOXCGue1NxR Z9BP4hsNw+ZQgfSqZsdXJg6vvYaEfuHXiQ4T/Tx0uigA3IdBzhPB79gtpgipKscyv0HL 30Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779006861; x=1779611661; 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=SeQkqDrAPMYn0zYuhzYdu377fHXEuEM6zjwZuagDHgQ=; b=qg5SQvj9OLsQ/vidvX5M6+uItlr9rSqQTDDJfTyfyhk9gyLzV7nKjWIann20/1xSmb R8G3XjXp7Ku/WmI4DbN4wu3gK2AyF1eEQYdsHrzxxSQKiLnpf6PVBgT3/SugzefnXzti EmgwrrGzEmDwM8IivnzBeTMGrEiPM4S4ZXanOjAuSz9TP/gMNTmLaU5eeFdwDDeeC6zt 0e451ujmQqY6TPWikHN7PbZp+JXjCku/1+ez67YjHDSL6zCoI6SZyR/dWLAVfgdUNEO3 cQitOEGBjQOnvLph9/kAXLU0KuIeUy3JEiUPhWZ/xTZMyBTu8wpiPc9UhzEOBnyvwspF sayg== X-Forwarded-Encrypted: i=1; AFNElJ/Twprw7k3k+3DPOwEHObbTsC8seDVW5z9xinMtAf4MDz+WAUhGZwoICXEv1eCQF9T9jinza5iLt6exsyo=@vger.kernel.org X-Gm-Message-State: AOJu0YybeSeusDCh63pdU079ERcVbDnPSpT/+qw3509wxTE6eu+zQ/SJ 3n405SuvsYOemhW5ElvbgalCOCtMumfLt6oQFxZLA5Zq99mfFlwLCUJj X-Gm-Gg: Acq92OHedLgHSVQhm1jPQiHORtMcdCNZswT4m70eOH3ETga/BFWUMJvbMCGqa0jebz3 Gm8N61IeNRDSxPyRJBc7+T8zWTR1ZsJJv6bIPRFIN/hu1HIEhwPQ7OWGXyDW5dBrQ6WREiQUrD8 qmZqBqH8qCc7xNYcSuL15K3JXOPVkRpCHsSTE7r+/XhEsu2Mm4g4usmLKi/3uUwSXV3ivP9GEUd FBHeM4u+ICeUnosb+BfL+fyyv0Y1FGuxL78iy1WbCY+e0e3mnzgNjXujdf54abZFACyhRk7phjW qc2K6mmKenogb2Zbzrkgy96OIyHlshhOyoKPcrQ2+gBklokKokwSTMCFVEWGZqDEyc+WgGBRZ+l gpvFBeMe/lGaQJln1R0a8GK+GudnNA+Bdg3SHj9IqPWnqgoZkzT3umZybY1USBlKDC7HCArEkLh vGIyXgbC1iU3jw9jo= X-Received: by 2002:a05:6808:e412:b0:467:ee:7a2f with SMTP id 5614622812f47-482e577d4f5mr5216362b6e.28.1779006860619; Sun, 17 May 2026 01:34:20 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e55bbd0bd6sm5345191a34.13.2026.05.17.01.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2026 01:34:19 -0700 (PDT) From: Minxi Hou To: netdev@vger.kernel.org Cc: Donald Hunter , Jakub Kicinski , "David S . Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Aaron Conole , linux-kernel@vger.kernel.org, Minxi Hou Subject: [PATCH 1/2] netlink: specs: add OVS packet family specification Date: Sun, 17 May 2026 16:33:57 +0800 Message-ID: <20260517083358.2088599-2-houminxi@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260517083358.2088599-1-houminxi@gmail.com> References: <20260517083358.2088599-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 | 138 ++++++++++++++++++++ 1 file changed, 138 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..7ef14b68df4e --- /dev/null +++ b/Documentation/netlink/specs/ovs_packet.yaml @@ -0,0 +1,138 @@ +# 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-attrs + 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: + - 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: + - packet + - key + - userdata + - actions + - egress-tun-key + - mru + - len + - hash + - + 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.53.0 From nobody Mon May 25 06:41:33 2026 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 B653E3469F6 for ; Sun, 17 May 2026 08:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779006871; cv=none; b=W6NMYPy1LzRsozRZ7LIUGl6UFBA9+CLapxbn9CHn7zxo5DGmK+g1tOsb9U/vw2Q8jOB4aaXH+ll9nWzDA4el/DqyutZWE0UguBIelYK1Ytr+rLR67gDForY0turzMjWcPhhPnjsJ73nuH3eFHLqmn5bcZFUsOTbhqT0DngsAOBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779006871; c=relaxed/simple; bh=tNu1q+k3kNpMkU+h1HzMzpn06Pa3jAV0Kk3zKRy+wQ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hg4XKjh8fQd9ymGZL91DmFqjtZTWLMl7+cgbTm3iwyarFsHuYIyAd9HkRVs5wEaGtYQkCc0rYPCfiQ6W4wKlham55AQc64GfmEhwnuuqkNi79UiDJFqA0MIB+kkSk/AYYfEIBVV43tDq8V6f66YXzIKCI/Jeq5UFg//m3OXhUmw= 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=gqF4JxpN; arc=none smtp.client-ip=209.85.210.49 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="gqF4JxpN" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-7dbcb467f2bso1367593a34.3 for ; Sun, 17 May 2026 01:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779006866; x=1779611666; 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=EQ7T24h6C2KWf71uTZiV7KRUU4xs5Ab9gDHIZEPT4Og=; b=gqF4JxpN36FjilYHp0SjM6NYMkiXSw89XN9OVqWr30PVMqx/w/Y2ymiQ7hFGl8TsIq Gmjm4HtLzR54WDdTDFdpLizIKX83b5HxRl6Sxz0f7h1/fAlVe+wWPMkz+8UMoAiEktIe Wu91znXqkErvKj/dTN7/fHyPoeQsP95Bh7nOSaUTniEAH/+gZdj0+8B8Qt05+D/pFpDq +tnxYnqAEORqVHZbHB0hWiz7FmQBynLdSDGYF14mjaY18hBbZDIRI8qgmIpUJhqyFjYA hw00JV5IX3F80cFPzpjRXjURtP3S7pLwD9/dVR/kGgRT/ZHUsRWjfQM8yiB5tuRH1uDj IniA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779006866; x=1779611666; 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=EQ7T24h6C2KWf71uTZiV7KRUU4xs5Ab9gDHIZEPT4Og=; b=JUT6+TMsgSP+6IV8DbFXFrh5NM9hkIjPcUVM1MPxC553ArcVHErwCMU5/n4nW61cVb Oz5da1ymeG12vftDadZysw8nda5okEPVqV62AJF+Ar8poCKaIvXBjVe8+fGlCOSwF+xX 3QKrXNTjG13SbJZgtcoxHQJ0+C+MfrZBbdVrse6/XIOFyQadaB4uoAkAfOIr0t8hq8Dg gBJfXRvlODGcdUdsVUWvofa8Erltykk3nZuvLwnOipzTv7/t3aHYrH+6iU5JKJ2j7zMC NsY0F1Eu8YepqMxsYF1eua7AjyOOeinSdz7ci8cqyL0DfGl5m7AMlUd6g8t+kht5wpWT tmBg== X-Forwarded-Encrypted: i=1; AFNElJ8q/vXwEchJSbMOO8wCdHxXVZWERFBs90PYSuo54zeht5uA5Bt3HyVdADyRaMZWwsoa6n1ebJmhlwuGwfA=@vger.kernel.org X-Gm-Message-State: AOJu0YxMZtQS640Rhgtx//sHgrEtCd/EW04u1e1zudK49RTtyFqZFdSl Khy6d+RxDaUjMOuUFOSUprXBzmrQvKM6qAmoyxklmvKN6ZO9zHIxFkUA X-Gm-Gg: Acq92OFJsAZlgUKWmfgI5YxFmtsvPTG5I2uPkTHJC0fpp8g/j1fEvEvpnRNfAT+FXQK Pd746ZsJdG6e6jGYY2rWu5GQz4M8V72aWhmEbzn2ZV/EjJFdBuT0TvRx9AmqOSK0aXF/XsKeMzB 7v6bcw5ThOmQyFODhHkdSQICr3u1FApu8IKJSJv7Kp5kVnoFMF+zE6tnkuIzq2ZCuwOQFs6Ik/y CS3NbP7XvFEHNsONrwg0D5NNLNf7Jxa6y/ZeJHLfmIEIAClF78zJflVkkjrOKJ3DANnyKt/pRvX JzZ2NF0WsKN0wncN8eoHSmP+cI+nmTYFJlNtEXRC8Z954XKuK69qHdX33ivAxyaDaKEEbvgguUh 3eyVrqAZrds9VYiHsojnmzfDRO273jwHaipYqoSRYmuThwOHJa3sclTH98hVlmWCQ3vjeN+zwmw UwN56cFvTzE0JokA1mh9b86/SLRQ== X-Received: by 2002:a05:6830:2801:b0:7dc:cd0b:58bc with SMTP id 46e09a7af769-7e4ea04a33fmr7512068a34.7.1779006866584; Sun, 17 May 2026 01:34:26 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e55bbd0bd6sm5345191a34.13.2026.05.17.01.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2026 01:34:25 -0700 (PDT) From: Minxi Hou To: netdev@vger.kernel.org Cc: Donald Hunter , Jakub Kicinski , "David S . Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Aaron Conole , linux-kernel@vger.kernel.org, Minxi Hou Subject: [PATCH 2/2] tools: ynl: add unicast notification receive support Date: Sun, 17 May 2026 16:33:58 +0800 Message-ID: <20260517083358.2088599-3-houminxi@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260517083358.2088599-1-houminxi@gmail.com> References: <20260517083358.2088599-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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py index f63c6f828735..8f526c683f99 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -748,6 +748,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.53.0