diff mbox series

[net] devlink: Fix length of eswitch inline-mode

Message ID 20240310164547.35219-1-witu@nvidia.com (mailing list archive)
State Accepted
Commit 8f4cd89bf10607de08231d6d91a73dd63336808e
Delegated to: Netdev Maintainers
Headers show
Series [net] devlink: Fix length of eswitch inline-mode | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; GEN HAS DIFF 1 file changed, 3 insertions(+), 3 deletions(-);
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 958 this patch: 958
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 2 blamed authors not CCed: jacob.e.keller@intel.com kuba@kernel.org; 5 maintainers not CCed: edumazet@google.com kuba@kernel.org swarupkotikalapudi@gmail.com jacob.e.keller@intel.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 973 this patch: 973
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 974 this patch: 974
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest warning net-next-2024-03-11--21-00 (tests: 883)

Commit Message

William Tu March 10, 2024, 4:45 p.m. UTC
Set eswitch inline-mode to be u8, not u16. Otherwise, errors below

$ devlink dev eswitch set pci/0000:08:00.0 mode switchdev \
  inline-mode network
    Error: Attribute failed policy validation.
    kernel answers: Numerical result out of rang
    netlink: 'devlink': attribute type 26 has an invalid length.

Fixes: f2f9dd164db0 ("netlink: specs: devlink: add the remaining command to generate complete split_ops")
Signed-off-by: William Tu <witu@nvidia.com>
---
Or we can fix the iproute2 to use u16?
---
 Documentation/netlink/specs/devlink.yaml | 2 +-
 net/devlink/netlink_gen.c                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Jiri Pirko March 11, 2024, 8:34 a.m. UTC | #1
Sun, Mar 10, 2024 at 05:45:47PM CET, witu@nvidia.com wrote:
>Set eswitch inline-mode to be u8, not u16. Otherwise, errors below
>
>$ devlink dev eswitch set pci/0000:08:00.0 mode switchdev \
>  inline-mode network
>    Error: Attribute failed policy validation.
>    kernel answers: Numerical result out of rang
>    netlink: 'devlink': attribute type 26 has an invalid length.
>
>Fixes: f2f9dd164db0 ("netlink: specs: devlink: add the remaining command to generate complete split_ops")

Oops. I wonder if I messed anything else.

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

Thanks!


>Signed-off-by: William Tu <witu@nvidia.com>
>---
>Or we can fix the iproute2 to use u16?

Nope, this is UAPI.
Simon Horman March 11, 2024, 9:19 a.m. UTC | #2
On Sun, Mar 10, 2024 at 06:45:47PM +0200, William Tu wrote:
> Set eswitch inline-mode to be u8, not u16. Otherwise, errors below
> 
> $ devlink dev eswitch set pci/0000:08:00.0 mode switchdev \
>   inline-mode network
>     Error: Attribute failed policy validation.
>     kernel answers: Numerical result out of rang
>     netlink: 'devlink': attribute type 26 has an invalid length.
> 
> Fixes: f2f9dd164db0 ("netlink: specs: devlink: add the remaining command to generate complete split_ops")
> Signed-off-by: William Tu <witu@nvidia.com>
> ---
> Or we can fix the iproute2 to use u16?

My understanding is that it was u8, prior to changes moving the
code to use specs, so I think that fixing the kernel to once again use u8
is appropriate.

Reviewed-by: Simon Horman <horms@kernel.org>

...
patchwork-bot+netdevbpf@kernel.org March 11, 2024, 11 p.m. UTC | #3
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sun, 10 Mar 2024 18:45:47 +0200 you wrote:
> Set eswitch inline-mode to be u8, not u16. Otherwise, errors below
> 
> $ devlink dev eswitch set pci/0000:08:00.0 mode switchdev \
>   inline-mode network
>     Error: Attribute failed policy validation.
>     kernel answers: Numerical result out of rang
>     netlink: 'devlink': attribute type 26 has an invalid length.
> 
> [...]

Here is the summary with links:
  - [net] devlink: Fix length of eswitch inline-mode
    https://git.kernel.org/netdev/net/c/8f4cd89bf106

You are awesome, thank you!
diff mbox series

Patch

diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
index cf6eaa0da821..09fbb4c03fc8 100644
--- a/Documentation/netlink/specs/devlink.yaml
+++ b/Documentation/netlink/specs/devlink.yaml
@@ -290,7 +290,7 @@  attribute-sets:
         enum: eswitch-mode
       -
         name: eswitch-inline-mode
-        type: u16
+        type: u8
         enum: eswitch-inline-mode
       -
         name: dpipe-tables
diff --git a/net/devlink/netlink_gen.c b/net/devlink/netlink_gen.c
index c81cf2dd154f..f9786d51f68f 100644
--- a/net/devlink/netlink_gen.c
+++ b/net/devlink/netlink_gen.c
@@ -198,7 +198,7 @@  static const struct nla_policy devlink_eswitch_set_nl_policy[DEVLINK_ATTR_ESWITC
 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
 	[DEVLINK_ATTR_ESWITCH_MODE] = NLA_POLICY_MAX(NLA_U16, 1),
-	[DEVLINK_ATTR_ESWITCH_INLINE_MODE] = NLA_POLICY_MAX(NLA_U16, 3),
+	[DEVLINK_ATTR_ESWITCH_INLINE_MODE] = NLA_POLICY_MAX(NLA_U8, 3),
 	[DEVLINK_ATTR_ESWITCH_ENCAP_MODE] = NLA_POLICY_MAX(NLA_U8, 1),
 };