]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5e: replace EINVAL in mlx5e_flower_parse_meta()
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 19 Apr 2020 12:12:35 +0000 (14:12 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 29 May 2020 20:07:54 +0000 (13:07 -0700)
The drivers reports EINVAL to userspace through netlink on invalid meta
match. This is confusing since EINVAL is usually reserved for malformed
netlink messages. Replace it by more meaningful codes.

Fixes: acf4ff9eeffd ("net/mlx5e: Add mlx5e_flower_parse_meta support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

index 6e7b2ce29d411069aa3c761a8d78f24ad8032763..10f705761666b43f5e7941f12ce57449dd66e52f 100644 (file)
@@ -2068,7 +2068,7 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev,
        flow_rule_match_meta(rule, &match);
        if (match.mask->ingress_ifindex != 0xFFFFFFFF) {
                NL_SET_ERR_MSG_MOD(extack, "Unsupported ingress ifindex mask");
-               return -EINVAL;
+               return -EOPNOTSUPP;
        }
 
        ingress_dev = __dev_get_by_index(dev_net(filter_dev),
@@ -2076,13 +2076,13 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev,
        if (!ingress_dev) {
                NL_SET_ERR_MSG_MOD(extack,
                                   "Can't find the ingress port to match on");
-               return -EINVAL;
+               return -ENOENT;
        }
 
        if (ingress_dev != filter_dev) {
                NL_SET_ERR_MSG_MOD(extack,
                                   "Can't match on the ingress filter port");
-               return -EINVAL;
+               return -EOPNOTSUPP;
        }
 
        return 0;