🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5697

Re: [PATCH net-next v3 2/2] netlink: specs: add ovs datapath and vport set operations

#5697
From: Jakub Kicinski
Date: Tue, 20 Oct 2026 20:24
169 lines
13282 bytes
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
netlink: specs: add ovs datapath and vport set operations

This adds the SET operation (cmd value 4) to the ovs_datapath and
ovs_vport YNL specs, so YNL clients can modify an existing datapath or
vport. It also adds the uns-admin-perm flag to the new, del and set
operations of both families, matching GENL_UNS_ADMIN_PERM in the kernel.

> diff --git a/Documentation/netlink/specs/ovs_datapath.yaml b/Documentation/netlink/specs/ovs_datapath.yaml
> index f7b3671991e6..9c33d6a2f05d 100644
> --- a/Documentation/netlink/specs/ovs_datapath.yaml
> +++ b/Documentation/netlink/specs/ovs_datapath.yaml

[ ... ]

> @@ -149,10 +150,27 @@ operations:

[ ... ]

> +    -
> +      name: set
> +      doc: |
> +        Modify an existing OVS data path. The kernel treats a missing
> +        user-features attribute as zero and clears the previously set
> +        features.
> +      value: 4
> +      attribute-set: datapath
> +      flags: [uns-admin-perm]
> +      do:
> +        request:
> +          attributes:
> +            - name
> +            - user-features
> +            - masks-cache-size
> +            - per-cpu-pids

[Severity: Low]
Should this doc also say that per-cpu-pids only takes effect when the
same request sets OVS_DP_F_DISPATCH_UPCALL_PER_CPU in user-features?

From ovs_dp_change() in net/openvswitch/datapath.c:

	u32 user_features = 0, old_features = dp->user_features;
	...
	dp->user_features = user_features;

	if (dp->user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU &&
	    a[OVS_DP_ATTR_PER_CPU_PIDS]) {
		/* Upcall Netlink Port IDs have been updated */
		err = ovs_dp_set_upcall_portids(dp,
						a[OVS_DP_ATTR_PER_CPU_PIDS]);

A SET request with only name and per-cpu-pids, or with user-features that
lack that flag, still succeeds. The pids are dropped without an error, and
per-CPU upcall dispatch is turned off too.

The kernel behaves this way without this patch. The new op doc describes
the related user-features quirk but not this one.

[Severity: Low]
This is a pre-existing issue and was not introduced by this patch. Neither
of the new set ops describes the notification the kernel sends.

ovs_dp_cmd_set() and ovs_vport_cmd_set() both build a full object message
with cmd OVS_DP_CMD_SET / OVS_VPORT_CMD_SET and multicast it:

net/openvswitch/datapath.c:ovs_vport_cmd_set() {
    ...
	err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info),
				      info->snd_portid, info->snd_seq, 0,
				      OVS_VPORT_CMD_SET, GFP_KERNEL);
	BUG_ON(err < 0);

	ovs_unlock();
	ovs_notify(&dp_vport_genl_family, reply, info);
    ...
}

The set ops in the specs have only a do request, with no reply and no
notify. C codegen therefore generates no parser for these cmd 4 messages.
The existing new and del ops in both specs have the same gap, although
their handlers also send notifications.

The patch does help Python YNL here. handle_ntf() looks up the op with
rsp_by_value[cmd], so cmd 4 notifications can now be decoded with the op's
attribute set.

Could these notifications be described in the specs, either here or in a
follow-up?

> diff --git a/Documentation/netlink/specs/ovs_vport.yaml b/Documentation/netlink/specs/ovs_vport.yaml
> index fa975f8821b6..63a0a41a1199 100644
> --- a/Documentation/netlink/specs/ovs_vport.yaml
> +++ b/Documentation/netlink/specs/ovs_vport.yaml

[ ... ]

> @@ -165,6 +167,19 @@ operations:
>              - netnsid
>              - upcall-stats
>        dump: *vport-get-op
> +    -
> +      name: set
> +      doc: Modify an existing OVS vport
> +      value: 4
> +      attribute-set: vport
> +      flags: [uns-admin-perm]
> +      do:
> +        request:
> +          attributes:
> +            - name

[Severity: Low]
Should port-no be listed here too?

ovs_vport_cmd_set() finds its target with lookup_vport(). That function
accepts either OVS_VPORT_ATTR_NAME or OVS_VPORT_ATTR_PORT_NO, using the
dp_ifindex from the fixed header:

net/openvswitch/datapath.c:lookup_vport() {
    ...
	} else if (a[OVS_VPORT_ATTR_PORT_NO]) {
		u32 port_no = nla_get_u32(a[OVS_VPORT_ATTR_PORT_NO]);
		...
		dp = get_dp(net, ovs_header->dp_ifindex);
		...
		vport = ovs_vport_ovsl_rcu(dp, port_no);
    ...
}

The del op in this spec already lists port-no. YNL C codegen only
generates setters for the attributes an op lists. So the generated
ovs_vport_set_req has no port_no setter, and a C client can only pick the
vport by name. Python YNL is not affected because it encodes from the
whole attribute set.

> +            - type
> +            - options

[Severity: Low]
Is options meant to be listed for set? ovs_vport_cmd_set() rejects every
request that carries it:

	if (a[OVS_VPORT_ATTR_OPTIONS]) {
		/* There are no vport types that support legacy options. */
		err = -EOPNOTSUPP;
		goto exit_unlock_free;
	}

vport_policy also marks OVS_VPORT_ATTR_OPTIONS as "/* Unused. */". Any
request built with the generated options setters for this op will fail
with EOPNOTSUPP.

type is similar. The kernel only checks it for equality and cannot change
it:

	if (a[OVS_VPORT_ATTR_TYPE] &&
	    nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) {
		err = -EINVAL;

The commit message says "The kernel rejects a type change and rejects
options". The spec, with its doc "Modify an existing OVS vport", says
neither.

Could options be dropped from this request, or could the doc mention
these limits?
Technical Details
Message-ID: <20261020202442.1012753-1-kuba@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349551-linux-kernel-netdev=dewy.ru
References: <20261015024132.698658-3-houminxi@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349551-linux-kernel-netdev=dewy.ru
From: kuba@kernel.org (Jakub Kicinski)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 2/2] netlink: specs: add ovs datapath and vport set operations
Date: Tue, 20 Oct 2026 13:24:42 -0700
Organization: Usenet Network
Message-ID: <20261020202442.1012753-1-kuba@kernel.org>
References: <20261015024132.698658-3-houminxi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3951665"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NO09IwxM+3HXM0tI+9X7DToaLDY= sha256:c51B7baWte/w1T2ehUYe9roDcvkuOKsR0fT9EZ6zvtU=
	sha1:lNPHfsr5K1NG7DPyR3R9E/1c84E= sha256:srudV6E47qpKVG+0RjBRj9gYlvSiXZ2WOV8VZMazars=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 36D06110E37; Tue, 20 Oct 2026 23:30:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.729
X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id qOUbtRCyM_iF;
	Tue, 20 Oct 2026 23:30:44 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349551-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 5DFC9110E33; Tue, 20 Oct 2026 23:30:36 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 0EE072CF5A; Tue, 20 Oct 2026 20:24:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792527884;
	b=m4vaGAsgXfuU7sPiFQWJ/9sNmB6np1Fx5L51gbF2nbr9j1Ctfem1TrMt1LkdavfmaYv/
	 51ddzuoXn438FvLdQm/4QRrPLlwxNJZZQls+XAcCjeHcI7E4CsVMnsHv22zKhRjtty5y2
	 k8ifPzGWJ+JmpK0x71P+gO+8UP1p1E6WqAKQhidMB8qWfWJ3IAKCK18Fxi4gfS+NcswhD
	 /rqsuiYhRSW6aJjikQK0iXc2sSEp5mRFR9sY+LbeLs9Uj+EIVk8LcIfleNUFdtuk5IeDi
	 sFAV9H465RqYedeQ1POU5q2i4HKiTk9M4Pl1MAgrxZ+BgY3DfQgbjKx9n4MHtSEDzrQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792527884;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=s3oS6tKV9PMu84CKn1ldvKSagsp1saZxNsRcHfBGkEs=;
	b=3ewnqlipP6NcZph+oiBfYBJ5OSFBdCemRcw3PubBlYMhT5UWJQJc5onwkd4oET2asEGI
	 8n1Ftg9G2Y90ZZRBmN0MmgA3V0U1WlaG6VzJifwK5miNXthEgNE7QU74m4VktsJmjXzsE
	 Jbc+ARHSteJzAtf8JJ9cHdMo9IhBhvp2pFT0oiPwP92cT4ygeBdE4a8MoShOyj5Q3o3I4
	 P/a3mgUg5KX6snDYazNScervOP7qoNOZNqnyp5xldYc1+6ejIUYPuyjiNAA2a737EMamw
	 U5y82zJ7FIudAp0dPKjHZn+J7JNME3yhm3jxi0G1KzF+LP1bTiRn5txyOKBfnBXNEFg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Tq/JhqMM";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id D9B29606A319;
	Tue, 20 Oct 2026 20:24:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Tq/JhqMM
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792527884;
	b=3uk2WtrbCCLngawVjkDHAOeN0boekXEP/Zr5iSOILaKTKse3nHhpaMOqScQkNPJ+7KIA
	 //RuMI6IVCokg/pQjszgJ9DlhxAybuNJiT168gNlje1wcYIJZqi7Tqwb38t2wmjU99Onc
	 FjPJPQhS61NkRlazlyfnNoQfOS2Vs+qi6XU/gdkZi/WzqF/HLyxER5B5Cd6nNGIwoWyBQ
	 /PzA97L70MpNNfJcyu+xM7idXuizjIidIjsKyhXB0baEwQ4kZoWocD+ZH4UN4sjW23kHd
	 1MnNWB0Qwvkun/8hS+rfNRBw5l1dG5nsDevXwHjLehZt4nxpEfSNH3IVbM388iV/wMQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792527884;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Transfer-Encoding;
	bh=s3oS6tKV9PMu84CKn1ldvKSagsp1saZxNsRcHfBGkEs=;
	b=uzQUjsSzy/z6Cjb8/BQoXZYHSIZ0oEaXI8yxcPRt6QpYAbuGDeljDSGLj7PgAbxAEArc
	 xdEvTFYWq8YAqrJyjxyF3PDNzcAydoFTqNIf3FduzZadiMc1Gfj9fXqbQJPfzMpiTr6wo
	 BS6Ssq5NnGBm1ar8RJyXQbpfJ6O0Uf2k5X1FhUSAjDmqnKNLC6nS5x7t1PZ2BjTPXoFd/
	 LZKMg0RddWunZCjnwvQ/F+rGh1kcysB4e3ZgfsyXlDFTvPtocUzLRcNcFCRpl8MT2VLd4
	 xFMRhGOMzsGGURmHQ907M/QmfGpkBLNSUjjSbppWi81U2cLvv5M27PMbfecJJCD5RxQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Tq/JhqMM";
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAF8F606A320
	for <netdev@vger.kernel.org>; Tue, 20 Oct 2026 20:24:43 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E9551F000CA;
	Tue, 20 Oct 2026 20:24:43 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792527883;
	bh=s3oS6tKV9PMu84CKn1ldvKSagsp1saZxNsRcHfBGkEs=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=Tq/JhqMMcI0abETR/oX6p6phzzCXLTgWsSkfmbLFIVRQsAK7zyqX4iHXIWcZw6ZUn
	 vvpDxpBvICrd/2z3omBNHg2PKjNBc5YuDHzOgX7hbp4f0WlKHBtSGWoMPhjGaGlazK
	 lmHPPLPfyOh48DGPRSqqeaRw00e1EoRRVNzgCmJi+AjOtpgKK4vUhHnkqZhLMqJhj6
	 NhJtxpmUEST/devTTsxeMO4yIe+4YhL2LIQJTs+zOhb7erzzCxW3DUD5k36smeG3W0
	 2pQDwkYvjoqgH2soio+QDCrKqweR0vtZPp1aizTxG+MwPCRjckjLZRgM8UouiZtYGv
	 LkxcAHZ4XdHyg==
X-Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org,
	donald.hunter@gmail.com,
	davem@davemloft.net,
	edumazet@google.com,
	pabeni@redhat.com,
	horms@kernel.org
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <20261015024132.698658-3-houminxi@gmail.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list