]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nfp: flower: add support for tunnel offload without key ID
authorBaowen Zheng <baowen.zheng@corigine.com>
Fri, 29 Jul 2022 09:16:41 +0000 (11:16 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 1 Aug 2022 19:02:47 +0000 (12:02 -0700)
Currently nfp driver will reject to offload tunnel key action without
tunnel key ID which means tunnel ID is 0. But it is a normal case for tc
flower since user can setup a tunnel with tunnel ID is 0.

So we need to support this case to accept tunnel key action without
tunnel key ID.

Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20220729091641.354748-1-simon.horman@corigine.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/flower/action.c

index 3c7220a4603e56f630a3157e0398400044e954d7..2b383d92d7f573b450ed3e315af3f07de56c1921 100644 (file)
@@ -427,6 +427,12 @@ nfp_fl_set_tun(struct nfp_app *app, struct nfp_fl_set_tun *set_tun,
                return -EOPNOTSUPP;
        }
 
+       if (ip_tun->key.tun_flags & ~NFP_FL_SUPPORTED_UDP_TUN_FLAGS) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "unsupported offload: loaded firmware does not support tunnel flag offload");
+               return -EOPNOTSUPP;
+       }
+
        set_tun->head.jump_id = NFP_FL_ACTION_OPCODE_SET_TUNNEL;
        set_tun->head.len_lw = act_size >> NFP_FL_LW_SIZ;
 
@@ -436,7 +442,8 @@ nfp_fl_set_tun(struct nfp_app *app, struct nfp_fl_set_tun *set_tun,
                FIELD_PREP(NFP_FL_PRE_TUN_INDEX, pretun_idx);
 
        set_tun->tun_type_index = cpu_to_be32(tmp_set_ip_tun_type_index);
-       set_tun->tun_id = ip_tun->key.tun_id;
+       if (ip_tun->key.tun_flags & NFP_FL_TUNNEL_KEY)
+               set_tun->tun_id = ip_tun->key.tun_id;
 
        if (ip_tun->key.ttl) {
                set_tun->ttl = ip_tun->key.ttl;
@@ -479,12 +486,6 @@ nfp_fl_set_tun(struct nfp_app *app, struct nfp_fl_set_tun *set_tun,
        }
 
        set_tun->tos = ip_tun->key.tos;
-
-       if (!(ip_tun->key.tun_flags & NFP_FL_TUNNEL_KEY) ||
-           ip_tun->key.tun_flags & ~NFP_FL_SUPPORTED_UDP_TUN_FLAGS) {
-               NL_SET_ERR_MSG_MOD(extack, "unsupported offload: loaded firmware does not support tunnel flag offload");
-               return -EOPNOTSUPP;
-       }
        set_tun->tun_flags = ip_tun->key.tun_flags;
 
        if (tun_type == NFP_FL_TUNNEL_GENEVE) {