nfp: fill splittable of devlink_port_attrs correctly
authorDiana Wang <na.wang@corigine.com>
Thu, 17 Nov 2022 15:37:43 +0000 (16:37 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 19 Nov 2022 03:41:20 +0000 (19:41 -0800)
The error is reflected in that it shows wrong splittable status of
port when executing "devlink port show".
The reason which leads the error is that the assigned operation of
splittable is just a simple negation operation of split and it does
not consider port lanes quantity. A splittable port should have
several lanes that can be split(lanes quantity > 1).
If without the judgement, it will show wrong message for some
firmware, such as 2x25G, 2x10G.

Fixes: a0f49b548652 ("devlink: Add a new devlink port split ability attribute and pass to netlink")
Signed-off-by: Diana Wang <na.wang@corigine.com>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_devlink.c

index 405786c..cb08d7b 100644 (file)
@@ -341,7 +341,7 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)
                return ret;
 
        attrs.split = eth_port.is_split;
-       attrs.splittable = !attrs.split;
+       attrs.splittable = eth_port.port_lanes > 1 && !attrs.split;
        attrs.lanes = eth_port.port_lanes;
        attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
        attrs.phys.port_number = eth_port.label_port;