From: Minxi Hou <houminxi@gmail.com>
To: netdev@vger.kernel.org
Cc: Donald Hunter <donald.hunter@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>
Subject: [PATCH net-next v5 1/2] netlink: specs: add ovs_flow del and set operations
Date: Tue, 3 Nov 2026 13:33:18 -0500 [thread overview]
Message-ID: <20261103183319.2730567-2-houminxi@gmail.com> (raw)
In-Reply-To: <20261103183319.2730567-1-houminxi@gmail.com>
The ovs_flow spec described get and new only, so a YNL client could not
delete or modify a flow. Both commands have been in the kernel since the
family was added: del flushes the data path when a request carries
neither a key nor a ufid, and set looks a flow up by key or by ufid.
List the attributes each command reads. new reads ufid-flags and probe as
well as the key, so those go in its request list. new, del and set need
CAP_NET_ADMIN.
A dump reads ufid-flags and nothing else. It shared the get request list,
which let a client send a key and a ufid the kernel ignores, so give it a
request list of its own. The reply stays the same as for get.
probe was binary while the kernel policy is NLA_FLAG. A YNL client leaves
out a false flag, where it sent an empty binary attribute before.
The key and the actions docs called those attributes always present in
notifications. A flow identified by a ufid sends neither when the request
asked for it to be left out, and a get reply follows the same rule. A
dump also leaves the actions out when they do not fit in the message.
The key doc said a key is required for every request except a dump. The
kernel accepts a ufid with no key, but a get and a set need one of the two,
and a set that replaces the actions needs a key. A new request needs a key,
including one that finds an existing flow and replaces its actions, and a
del that carries neither flushes the data path. The ufid doc says a dump
ignores that attribute.
Fix the same sentences in the uapi header. The spec text was copied from
there, and the two descriptions disagreed once this patch changed the
spec.
Signed-off-by: Minxi Hou <houminxi@gmail.com>
---
Documentation/netlink/specs/ovs_flow.yaml | 76 +++++++++++++++++++----
include/uapi/linux/openvswitch.h | 17 +++--
2 files changed, 75 insertions(+), 18 deletions(-)
diff --git a/Documentation/netlink/specs/ovs_flow.yaml b/Documentation/netlink/specs/ovs_flow.yaml
index 951837b72e1d..bbfa2c1b7466 100644
--- a/Documentation/netlink/specs/ovs_flow.yaml
+++ b/Documentation/netlink/specs/ovs_flow.yaml
@@ -383,19 +383,27 @@ attribute-sets:
type: nest
nested-attributes: key-attrs
doc: |
- Nested attributes specifying the flow key. Always present in
- notifications. Required for all requests (except dumps).
+ Nested attributes specifying the flow key. Present in replies and
+ notifications, except for a flow identified by a ufid when the
+ request asked for the key to be left out. A get, set or del may
+ carry a ufid instead of a key; a get and a set need one of the
+ two, and a set that replaces the actions needs a key. A new
+ request needs a key, including one that finds an existing flow and
+ replaces its actions. A dump reads neither the key nor the ufid. A
+ del that carries neither flushes the data path.
-
name: actions
type: nest
nested-attributes: action-attrs
doc: |
Nested attributes specifying the actions to take for packets that
- match the key. Always present in notifications. Required for
- OVS_FLOW_CMD_NEW requests, optional for OVS_FLOW_CMD_SET requests. An
- OVS_FLOW_CMD_SET without OVS_FLOW_ATTR_ACTIONS will not modify the
- actions. To clear the actions, an OVS_FLOW_ATTR_ACTIONS without any
- nested attributes must be given.
+ match the key. Present in replies and notifications, except when
+ the request asked for the actions to be left out, and in a dump
+ when they do not fit in the message. Required for
+ OVS_FLOW_CMD_NEW requests, optional for OVS_FLOW_CMD_SET requests.
+ An OVS_FLOW_CMD_SET without OVS_FLOW_ATTR_ACTIONS will not modify
+ the actions. To clear the actions, an OVS_FLOW_ATTR_ACTIONS
+ without any nested attributes must be given.
-
name: stats
type: binary
@@ -438,7 +446,7 @@ attribute-sets:
are exact match bits.
-
name: probe
- type: binary
+ type: flag
doc: |
Flow operation is a feature probe, error logging should be suppressed.
-
@@ -448,8 +456,8 @@ attribute-sets:
A value between 1-16 octets specifying a unique identifier for the
flow. Causes the flow to be indexed by this value rather than the
value of the OVS_FLOW_ATTR_KEY attribute. Optional for all
- requests. Present in notifications if the flow was created with this
- attribute.
+ requests. Present in notifications if the flow was created with
+ this attribute. Ignored in a dump.
display-hint: uuid
-
name: ufid-flags
@@ -969,25 +977,31 @@ operations:
doc: Get / dump OVS flow configuration and state
value: 3
attribute-set: flow-attrs
- do: &flow-get-op
+ do:
request:
attributes:
- key
- ufid
- ufid-flags
- reply:
+ - probe
+ reply: &flow-get-reply
attributes:
- key
- ufid
- mask
- stats
- actions
- dump: *flow-get-op
+ dump:
+ request:
+ attributes:
+ - ufid-flags
+ reply: *flow-get-reply
-
name: new
doc: Create OVS flow configuration in a data path
value: 1
attribute-set: flow-attrs
+ flags: [uns-admin-perm]
do:
request:
attributes:
@@ -995,6 +1009,42 @@ operations:
- ufid
- mask
- actions
+ - ufid-flags
+ - probe
+ -
+ name: del
+ doc: |
+ Delete one flow, or every flow in the data path. A request with
+ neither a key nor a ufid flushes the data path.
+ value: 2
+ attribute-set: flow-attrs
+ flags: [uns-admin-perm]
+ do:
+ request:
+ attributes:
+ - key
+ - ufid
+ - ufid-flags
+ - probe
+ -
+ name: set
+ doc: |
+ Modify an existing flow. The kernel rejects the request with
+ -EINVAL when it carries neither a key nor a ufid. Replacing the
+ actions also needs a key: a ufid on its own is not enough.
+ value: 4
+ attribute-set: flow-attrs
+ flags: [uns-admin-perm]
+ do:
+ request:
+ attributes:
+ - key
+ - ufid
+ - mask
+ - actions
+ - ufid-flags
+ - clear
+ - probe
mcast-groups:
list:
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 440825e65837..318209873e26 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -624,11 +624,18 @@ struct ovs_nsh_key_md1 {
/**
* enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
* @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
- * key. Always present in notifications. Required for all requests (except
- * dumps).
+ * key. Present in replies and notifications, except for a flow identified
+ * by a ufid when the request asked for the key to be left out. A get, set
+ * or del may carry a ufid instead of a key; a get and a set need one of the
+ * two, and a set that replaces the actions needs a key. A new request needs
+ * a key, including one that finds an existing flow and replaces its
+ * actions. A dump reads neither of the two, and a del carrying neither
+ * flushes the data path.
* @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
- * the actions to take for packets that match the key. Always present in
- * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
+ * the actions to take for packets that match the key. Present in replies
+ * and notifications, except when the request asked for the actions to be
+ * left out, and in a dump when they do not fit in the message. Required
+ * for %OVS_FLOW_CMD_NEW requests, optional for
* %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without
* %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions,
* an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given.
@@ -657,7 +664,7 @@ struct ovs_nsh_key_md1 {
* identifier for the flow. Causes the flow to be indexed by this value rather
* than the value of the %OVS_FLOW_ATTR_KEY attribute. Optional for all
* requests. Present in notifications if the flow was created with this
- * attribute.
+ * attribute. Ignored in a dump.
* @OVS_FLOW_ATTR_UFID_FLAGS: A 32-bit value of OR'd %OVS_UFID_F_*
* flags that provide alternative semantics for flow installation and
* retrieval. Optional for all requests.
--
2.56.0
next prev parent reply other threads:[~2026-11-03 18:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 18:33 [PATCH net-next v5 0/2] netlink: specs: fill in the missing ovs operations Minxi Hou
2026-11-03 18:33 ` Minxi Hou [this message]
2026-11-03 18:33 ` [PATCH net-next v5 2/2] netlink: specs: add ovs datapath and vport set operations Minxi Hou
2026-11-04 17:26 ` [PATCH net-next v5 0/2] netlink: specs: fill in the missing ovs operations Minxi Hou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103183319.2730567-2-houminxi@gmail.com \
--to=houminxi@gmail.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox