]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nfp: abm: provide more precise info about offload parameter validation
authorJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 9 Nov 2018 03:50:36 +0000 (19:50 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Nov 2018 04:48:01 +0000 (20:48 -0800)
Improve log messages printed when RED can't be offloaded because
of Qdisc parameters.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/abm/qdisc.c

index f36da95827ee9a74a1998632389f75ecda068d46..04b91cc12434a3348d33a145142cf9ca86c8f1c0 100644 (file)
@@ -72,6 +72,26 @@ nfp_abm_red_destroy(struct net_device *netdev, struct nfp_abm_link *alink,
        }
 }
 
+static bool
+nfp_abm_red_check_params(struct nfp_abm_link *alink,
+                        struct tc_red_qopt_offload *opt)
+{
+       struct nfp_cpp *cpp = alink->abm->app->cpp;
+
+       if (!opt->set.is_ecn) {
+               nfp_warn(cpp, "RED offload failed - drop is not supported (ECN option required) (p:%08x h:%08x)\n",
+                        opt->parent, opt->handle);
+               return false;
+       }
+       if (opt->set.min != opt->set.max) {
+               nfp_warn(cpp, "RED offload failed - unsupported min/max parameters (p:%08x h:%08x)\n",
+                        opt->parent, opt->handle);
+               return false;
+       }
+
+       return true;
+}
+
 static int
 nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink,
                    struct tc_red_qopt_offload *opt)
@@ -82,9 +102,7 @@ nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink,
        i = nfp_abm_red_find(alink, opt);
        existing = i >= 0;
 
-       if (opt->set.min != opt->set.max || !opt->set.is_ecn) {
-               nfp_warn(alink->abm->app->cpp,
-                        "RED offload failed - unsupported parameters\n");
+       if (!nfp_abm_red_check_params(alink, opt)) {
                err = -EINVAL;
                goto err_destroy;
        }