Commit a0b84334 authored by Etienne van der Linde's avatar Etienne van der Linde Committed by Jakub Kicinski

nfp: flower: restructure flow-key for gre+vlan combination

Swap around the GRE and VLAN parts in the flow-key offloaded by
the driver to fit in with other tunnel types and the firmware.
Without this change used cases with GRE+VLAN on the outer header
does not get offloaded as the flow-key mismatches what the
firmware expect.

Fixes: 0d630f58 ("nfp: flower: add support to offload QinQ match")
Fixes: 5a2b9304 ("nfp: flower-ct: compile match sections of flow_payload")
Signed-off-by: default avatarEtienne van der Linde <etienne.vanderlinde@corigine.com>
Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
Signed-off-by: default avatarYinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 03d5005f
...@@ -507,6 +507,11 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map) ...@@ -507,6 +507,11 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map)
key_size += sizeof(struct nfp_flower_ipv6); key_size += sizeof(struct nfp_flower_ipv6);
} }
if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_QINQ) {
map[FLOW_PAY_QINQ] = key_size;
key_size += sizeof(struct nfp_flower_vlan);
}
if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GRE) { if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GRE) {
map[FLOW_PAY_GRE] = key_size; map[FLOW_PAY_GRE] = key_size;
if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6)
...@@ -515,11 +520,6 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map) ...@@ -515,11 +520,6 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map)
key_size += sizeof(struct nfp_flower_ipv4_gre_tun); key_size += sizeof(struct nfp_flower_ipv4_gre_tun);
} }
if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_QINQ) {
map[FLOW_PAY_QINQ] = key_size;
key_size += sizeof(struct nfp_flower_vlan);
}
if ((in_key_ls.key_layer & NFP_FLOWER_LAYER_VXLAN) || if ((in_key_ls.key_layer & NFP_FLOWER_LAYER_VXLAN) ||
(in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GENEVE)) { (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GENEVE)) {
map[FLOW_PAY_UDP_TUN] = key_size; map[FLOW_PAY_UDP_TUN] = key_size;
...@@ -758,6 +758,17 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry) ...@@ -758,6 +758,17 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry)
} }
} }
if (NFP_FLOWER_LAYER2_QINQ & key_layer.key_layer_two) {
offset = key_map[FLOW_PAY_QINQ];
key = kdata + offset;
msk = mdata + offset;
for (i = 0; i < _CT_TYPE_MAX; i++) {
nfp_flower_compile_vlan((struct nfp_flower_vlan *)key,
(struct nfp_flower_vlan *)msk,
rules[i]);
}
}
if (key_layer.key_layer_two & NFP_FLOWER_LAYER2_GRE) { if (key_layer.key_layer_two & NFP_FLOWER_LAYER2_GRE) {
offset = key_map[FLOW_PAY_GRE]; offset = key_map[FLOW_PAY_GRE];
key = kdata + offset; key = kdata + offset;
...@@ -798,17 +809,6 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry) ...@@ -798,17 +809,6 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry)
} }
} }
if (NFP_FLOWER_LAYER2_QINQ & key_layer.key_layer_two) {
offset = key_map[FLOW_PAY_QINQ];
key = kdata + offset;
msk = mdata + offset;
for (i = 0; i < _CT_TYPE_MAX; i++) {
nfp_flower_compile_vlan((struct nfp_flower_vlan *)key,
(struct nfp_flower_vlan *)msk,
rules[i]);
}
}
if (key_layer.key_layer & NFP_FLOWER_LAYER_VXLAN || if (key_layer.key_layer & NFP_FLOWER_LAYER_VXLAN ||
key_layer.key_layer_two & NFP_FLOWER_LAYER2_GENEVE) { key_layer.key_layer_two & NFP_FLOWER_LAYER2_GENEVE) {
offset = key_map[FLOW_PAY_UDP_TUN]; offset = key_map[FLOW_PAY_UDP_TUN];
......
...@@ -625,6 +625,14 @@ int nfp_flower_compile_flow_match(struct nfp_app *app, ...@@ -625,6 +625,14 @@ int nfp_flower_compile_flow_match(struct nfp_app *app,
msk += sizeof(struct nfp_flower_ipv6); msk += sizeof(struct nfp_flower_ipv6);
} }
if (NFP_FLOWER_LAYER2_QINQ & key_ls->key_layer_two) {
nfp_flower_compile_vlan((struct nfp_flower_vlan *)ext,
(struct nfp_flower_vlan *)msk,
rule);
ext += sizeof(struct nfp_flower_vlan);
msk += sizeof(struct nfp_flower_vlan);
}
if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_GRE) { if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_GRE) {
if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) { if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) {
struct nfp_flower_ipv6_gre_tun *gre_match; struct nfp_flower_ipv6_gre_tun *gre_match;
...@@ -660,14 +668,6 @@ int nfp_flower_compile_flow_match(struct nfp_app *app, ...@@ -660,14 +668,6 @@ int nfp_flower_compile_flow_match(struct nfp_app *app,
} }
} }
if (NFP_FLOWER_LAYER2_QINQ & key_ls->key_layer_two) {
nfp_flower_compile_vlan((struct nfp_flower_vlan *)ext,
(struct nfp_flower_vlan *)msk,
rule);
ext += sizeof(struct nfp_flower_vlan);
msk += sizeof(struct nfp_flower_vlan);
}
if (key_ls->key_layer & NFP_FLOWER_LAYER_VXLAN || if (key_ls->key_layer & NFP_FLOWER_LAYER_VXLAN ||
key_ls->key_layer_two & NFP_FLOWER_LAYER2_GENEVE) { key_ls->key_layer_two & NFP_FLOWER_LAYER2_GENEVE) {
if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) { if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment