Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfp: flower: add support for tunnel offload without key ID

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>

authored by

Baowen Zheng and committed by
Jakub Kicinski
45490ce2 f157cfa3

+8 -7
+8 -7
drivers/net/ethernet/netronome/nfp/flower/action.c
··· 427 427 return -EOPNOTSUPP; 428 428 } 429 429 430 + if (ip_tun->key.tun_flags & ~NFP_FL_SUPPORTED_UDP_TUN_FLAGS) { 431 + NL_SET_ERR_MSG_MOD(extack, 432 + "unsupported offload: loaded firmware does not support tunnel flag offload"); 433 + return -EOPNOTSUPP; 434 + } 435 + 430 436 set_tun->head.jump_id = NFP_FL_ACTION_OPCODE_SET_TUNNEL; 431 437 set_tun->head.len_lw = act_size >> NFP_FL_LW_SIZ; 432 438 ··· 442 436 FIELD_PREP(NFP_FL_PRE_TUN_INDEX, pretun_idx); 443 437 444 438 set_tun->tun_type_index = cpu_to_be32(tmp_set_ip_tun_type_index); 445 - set_tun->tun_id = ip_tun->key.tun_id; 439 + if (ip_tun->key.tun_flags & NFP_FL_TUNNEL_KEY) 440 + set_tun->tun_id = ip_tun->key.tun_id; 446 441 447 442 if (ip_tun->key.ttl) { 448 443 set_tun->ttl = ip_tun->key.ttl; ··· 486 479 } 487 480 488 481 set_tun->tos = ip_tun->key.tos; 489 - 490 - if (!(ip_tun->key.tun_flags & NFP_FL_TUNNEL_KEY) || 491 - ip_tun->key.tun_flags & ~NFP_FL_SUPPORTED_UDP_TUN_FLAGS) { 492 - NL_SET_ERR_MSG_MOD(extack, "unsupported offload: loaded firmware does not support tunnel flag offload"); 493 - return -EOPNOTSUPP; 494 - } 495 482 set_tun->tun_flags = ip_tun->key.tun_flags; 496 483 497 484 if (tun_type == NFP_FL_TUNNEL_GENEVE) {