net: sched: cls: Fix offloading when ingress dev is vxlan
authorPaul Blakey <paulb@mellanox.com>
Tue, 5 Jun 2018 08:04:03 +0000 (11:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jun 2018 14:29:58 +0000 (10:29 -0400)
When using a vxlan device as the ingress dev, we count it as a
"no offload dev", so when such a rule comes and err stop is true,
we fail early and don't try the egdev route which can offload it
through the egress device.

Fix that by not calling the block offload if one of the devices
attached to it is not offload capable, but make sure egress on such case
is capable instead.

Fixes: caa7260156eb ("net: sched: keep track of offloaded filters [..]")
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_api.c

index cdc3c87c53e62d4db4bb18fa5f59d7889b9866cb..29fb4d68a144eb0a16b8ae0415ba83217a25df03 100644 (file)
@@ -807,10 +807,6 @@ static int tcf_block_cb_call(struct tcf_block *block, enum tc_setup_type type,
        int ok_count = 0;
        int err;
 
-       /* Make sure all netdevs sharing this block are offload-capable. */
-       if (block->nooffloaddevcnt && err_stop)
-               return -EOPNOTSUPP;
-
        list_for_each_entry(block_cb, &block->cb_list, list) {
                err = block_cb->cb(type, type_data, block_cb->cb_priv);
                if (err) {
@@ -1729,21 +1725,31 @@ static int tc_exts_setup_cb_egdev_call(struct tcf_exts *exts,
 int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts,
                     enum tc_setup_type type, void *type_data, bool err_stop)
 {
-       int ok_count;
+       int ok_count = 0;
        int ret;
 
-       ret = tcf_block_cb_call(block, type, type_data, err_stop);
-       if (ret < 0)
-               return ret;
-       ok_count = ret;
+       if (!block->nooffloaddevcnt) {
+               ret = tcf_block_cb_call(block, type, type_data, err_stop);
+               if (ret < 0)
+                       return ret;
+               ok_count = ret;
+       }
 
        if (!exts || ok_count)
-               return ok_count;
+               goto skip_egress;
+
        ret = tc_exts_setup_cb_egdev_call(exts, type, type_data, err_stop);
        if (ret < 0)
                return ret;
        ok_count += ret;
 
+skip_egress:
+       /* if one of the netdevs sharing this block are not offload-capable
+        * make sure we succeeded in egress instead.
+        */
+       if (block->nooffloaddevcnt && !ok_count && err_stop)
+               return -EOPNOTSUPP;
+
        return ok_count;
 }
 EXPORT_SYMBOL(tc_setup_cb_call);