From nobody Sun May 24 20:33:19 2026 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 02689357D0B for ; Fri, 22 May 2026 17:42:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779471738; cv=none; b=kQP6+N/mcgYBa0LP7MZrjc6rjO4fRReGXKLOekEqcKuEQJmicW0Qy26ih9umWCgrHsyZtOi/30GXgxRquYGXXQbpdhxJKGzKdn3/hW8l8FxGKq8IjfHzouwqHrMYfZT8Jv/SKoMmWOPynX/ROCwib+LArw7oswfXpC8L2dSmkOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779471738; c=relaxed/simple; bh=7pMSZzV/jTSFnIX340yNJSYzNFJz2VQlwCR0R9Wtz38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EG8gVFwMuu2XmDm67Qfy0CusHK1hXq1GVE84Lk6URnEb+35FeoF6M+v+iM0Y7JRkVQTdM8CMWcprgFkYIbxtk7KmqhSRjsrRjrcMgKk6Uvpe1+3/jCcAxANc0qJlXazAyYO+JbCG49NvLcyGUbQZPE7oEKIw7IVw1gmSYI7u7n4= 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=Jx+HjXPc; arc=none smtp.client-ip=209.85.210.53 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="Jx+HjXPc" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-7dcdaf06498so5121165a34.2 for ; Fri, 22 May 2026 10:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779471736; x=1780076536; 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=Jx+HjXPcNA0UsQR2FyVgTCEUDVFOFh1QdTUtu3KbtYYStgDEUcP+6uZxMUIRrfv/5k IMpMclVKH/CN7SYkhRLSYLrH1xtCFGPnKK/t6W6wZO0MIo2v2nxpMQbcTt7vjxM0njc+ k+Q8DHl+cKg/PQInr6jRGwNlfchmlMqkxB5CzrvswvZHDkR1FUrqQx71hfAXWchu63dg gkB9ESUMPunTPtlPNE9xKQQxYCYuSo2wBds0Y25yYT3e22saiBC5/tP9ssVuKNY8E0wQ 94QyYDkdMYz/xLH2YadXteeejStJqjjANZSRrcI0UO8MyJEyo054bcAndWQ/8hC+Q2tW EijA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779471736; x=1780076536; 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=Dmcvrraa5fbEy4Q0h0hTjXrOFV+SmOa/Mb7UpNGSe78xKABxeJyyH1xIXoaDeHe10v C5Mr/aeSnp4KjmKJhlr1dUuP7L2FXSdwYdi8vieYYWKgS8y6azmE+PUgLW7sxq89+UL9 CwPzThrcTd37A2JLSqxAhiCFEcyNdI2vLf7j0FsEZuz1+byeRuI0sDADXG+BGjIkjpeI LFY+4ZABFPl+STkVaa8Z9h1Y6LEmuiyOXDR97wtRS+9W0Z9+SWYXDUllZvm2qlvGwaOI 2nuoJ8sXT39zQh8qkyDwNYTkByLaAnJQjJX//5n/oGnW79OfbiX2rXkapk3hy0g9bHW9 no6A== X-Forwarded-Encrypted: i=1; AFNElJ/LV6imuHhixAALEjXr9diMyu0+ru8VvblleMsnfO+jwriAcaDTJI7vpEVI4hJSXC4w320B93x2ay0apo0=@vger.kernel.org X-Gm-Message-State: AOJu0YwTefpgv6iiRMf16bRB+e0MawiEH3MX9m0F+H7uuz3Pr9OWIaLe ZwnSI4zG1xsPgbtg2RuueGDi7Uq+waMLt0gBHMjb4y53tC/Po2ZV+RZL X-Gm-Gg: Acq92OE5gHOgMKuXt3fZBPCjKG7Srcri6LRgWV1itzWlTpeuk8BZv8UZvQP9KSO04j1 q/70a4hsIkRYCF6ETQKwYl/nxRLjaih3OOXJUhtDWCL3+wQij52568/y2egZw8NW9jHUEsxSpJD zmvah50gId+T9fxhQxsWVHb++SGHI2E7woeyVtbsV7mA9HP9DbZm1GjsOT7GbHBTuA1PeWkh+0u LTy4NDRn1oFdTHi/WnwhwhwwLrJr4nTGNvQrBS84quRMxJCUy2PfheYa+Bdgf4L/ta4/Xd/84tx t6vAHrlsglydNxPzBeVROV+JFkyAeJmKm416UeuB3xaq4ONgy2k6J6ZtSOeYqg2hd/DAXf/LRmm zQH8MSmcIFf0EzdOxZWAXRYQtZ2M5se9j/WZG1BUbrtIFVe5JkiGyU9LWGoCx0T8dJ2eWSakT+s dvec7QvHBCazRXI6I= X-Received: by 2002:a05:6820:222a:b0:696:233b:20ef with SMTP id 006d021491bc7-69d7ead8123mr2277780eaf.1.1779471735900; Fri, 22 May 2026 10:42:15 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-43b635d26b5sm2287249fac.6.2026.05.22.10.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 10:42:14 -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 v5 1/2] netlink: specs: add OVS packet family specification Date: Sat, 23 May 2026 01:41:53 +0800 Message-ID: <20260522174154.720293-2-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260522174154.720293-1-houminxi@gmail.com> References: <20260522174154.720293-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 20:33:19 2026 Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) (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 B6BAE368277 for ; Fri, 22 May 2026 17:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779471744; cv=none; b=fDygPicZsbrOllfm1M0me1843UpjENV+rHw0szGZpgKuZZx6QoOBjmtEQlSWlwICApNlmMC/qjuKLmuL5mshUtwK3PF11H0d0AG/DiD9XpsTdQuuwvgXpQPLyC8naznKwCm/hBMJK3parS1ZwOQWkSJHcYmNVN+AqUFMBhrZ2+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779471744; c=relaxed/simple; bh=LJw/uzRCeFuBErAPsv2kbea4idSDnIAJ4odAjP9OlwU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KCTlHpkxLTaoAxm79aHKs5zkEoR9Bi762WAqnA72DhT09GBtPckPIaJ9w6xUasWr8GcM+Aqxj4TZKpbdpoWqJvlrwPLFRMkBKicTXrOCk7FQqW/fBn6lDcH60m7x9+4NUx7guPxPwSHWRgtWr0YKomjZhjam6eNVtmkOMiOU8FE= 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=n19aScrf; arc=none smtp.client-ip=209.85.161.45 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="n19aScrf" Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-6967fd0416bso3848204eaf.3 for ; Fri, 22 May 2026 10:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779471741; x=1780076541; 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=Chiz5lJEDuUWdjYfXfKI5L1x2C+h2MwB4LLjlr8EAQE=; b=n19aScrfrwKBOqr2wwbzTxtWNfXq4ZXyZRbpkh5vGJDByVoG+JimQtyo3oolMLUNG4 f3hMUhjva+YRyCXqWFEgMSTch3Qsar3ZPw/ezHhzjClBKgDZ3Ez4dZk3HF4xjhSZMQZ7 YMp7eSs55jXYT5vT5BlXz1zBdRs0loG/zUwX3NuhMHuuaSfnLfcX+iixZ6oIRMQ+FjY/ V7PWyfm6nkLocQbnYsmTYCsQQg1EGx2wwVmHM+DZrJYqbLq8LTT6MnprY0M9tlCzwLDM l9mCWksCgNMoud12EzjKGXwGZ9LZrYQNnAjJRSiCVC0RlTmu/XH16SCPndcc0Wc5mVg8 zaZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779471741; x=1780076541; 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=Chiz5lJEDuUWdjYfXfKI5L1x2C+h2MwB4LLjlr8EAQE=; b=julbo6xeQEcPq3At8wJvMEomdWledY5AjNRhCs4mt6zrHBY8vumYMQTXTy18IRAT/S 1DDDTRycla/w6qBtFBOlLJux2QMvcMdjbtVPABf7mZ7H1CqRgnhUHIEAOIshJ1lj9NDj JIgwcyfM/cVhcemxqc3A4qsS2j7AQ0mFypHE5S/fvYQVWrAuNt7AhW00g0tqaku+0efK Vk1N64jJyNJpYFSgwZShFTL4CtLkBErziRG55/co0eVCPZhKo9ao7F54nX+8lvaPg2g1 9sfkk+2ezTfL9EHtVsDeZHLrJCqVvlT6BhZAxX1B1YsiKzvODGHpE8OrTQeySv9unGLj iugw== X-Forwarded-Encrypted: i=1; AFNElJ+tn5X3IhZv91RnFypBmQFToTsaPCuDdAL7G/7Gzf3bIyGwPE5V/u0F8y8uVKq0m4V4ruqmGvVOrdRac8g=@vger.kernel.org X-Gm-Message-State: AOJu0YxYZKEZAd2YM7zFszgYn0HjfRgAH3Z7pGHAjez7wd6CQxt01TtP 3wrIdxugTalyxDh45K4R70GdRNSlmEpalV+rqylBGGmB4uecfXqp/sC1 X-Gm-Gg: Acq92OHatIXHyq43ON1Jx1as0k0mYL5a3dpcysm6TjGbGsiA39BBpU+gDYsijVZijgR X12uHdL3i0cLm/PVekA2eJbwDsJ16PIG4ikmx1iTqwgXjXS6378rL8QO6aXYrY3mwOnAtQ/N4JV ZBe8qxEXfA3sfcbzqtPGAgEK8FIGag9El+C4rVdMsvdpzAYst77zsaUh0yt/VHTn4xKoekBeEDt HcF6wmMqUZc7wWlFCJvvvdjmpmUGo/l1yVZf6PgttGrkcPPGAq9q3I5f2T7RL3z8Lx1TQfZx+vu m6R9kG9GLPB/56wWPquEcXyGTg7Ez5e2oHBMpCQxDrjSkZoe2mH7CV3nlnY4HUU+8cLMfjkWDME xTnmvZ+NI2j452flWqeaynN9Ahb7Qw+boI3Qyv4gmqc/j0I/QRZMfPZwU8H6zwINGd7ESmMiLVC S0p3Hl7HbAg1q4Npe437iIH6JmEg== X-Received: by 2002:a05:6820:174b:b0:699:900d:7caf with SMTP id 006d021491bc7-69d7ec7c028mr2001014eaf.47.1779471740694; Fri, 22 May 2026 10:42:20 -0700 (PDT) Received: from houminxi ([72.244.37.221]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-43b635d26b5sm2287249fac.6.2026.05.22.10.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 10:42:19 -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 v5 2/2] tools: ynl: add unicast notification receive support Date: Sat, 23 May 2026 01:41:54 +0800 Message-ID: <20260522174154.720293-3-houminxi@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260522174154.720293-1-houminxi@gmail.com> References: <20260522174154.720293-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 010aac0c6c67..092d132edec1 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -682,6 +682,7 @@ class YnlFamily(SpecFamily): =20 ynl.ntf_subscribe(mcast_name) -- join a multicast group ynl.ntf_listen_all_nsid() -- listen on all netns + 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 @@ -767,6 +768,10 @@ class YnlFamily(SpecFamily): return None return None =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