Skip to content

Commit

Permalink
common/cnxk: fix VLAN check for inner header
Browse files Browse the repository at this point in the history
[ upstream commit 4f52aafa5901e653e536eb3126b818d78d7be1bc ]

Adding the has vlan check in inner headers i.e in LF layer. If
has_vlan is 0 it should be masked out while installing flow rule.

Fixes: c34ea71 ("common/cnxk: add NPC parsing API")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
  • Loading branch information
Harman Kalra authored and bluca committed Mar 7, 2024
1 parent 079911f commit 3294358
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/common/cnxk/roc_npc_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ npc_parse_lf(struct npc_parse_state *pst)
{
const struct roc_npc_item_info *pattern, *last_pattern;
char hw_mask[NPC_MAX_EXTRACT_HW_LEN];
const struct roc_npc_flow_item_eth *eth_item;
struct npc_parse_item_info info;
int lid, lt, lflags;
int nr_vlans = 0;
Expand All @@ -1035,10 +1036,12 @@ npc_parse_lf(struct npc_parse_state *pst)
lt = NPC_LT_LF_TU_ETHER;
lflags = 0;

eth_item = pst->pattern->spec;

/* No match support for vlan tags */
info.def_mask = NULL;
info.hw_mask = NULL;
info.len = pst->pattern->size;
info.len = sizeof(eth_item->hdr);
info.spec = NULL;
info.mask = NULL;
info.hw_hdr_len = 0;
Expand Down Expand Up @@ -1069,12 +1072,15 @@ npc_parse_lf(struct npc_parse_state *pst)
}

info.hw_mask = &hw_mask;
info.len = pst->pattern->size;
info.len = sizeof(eth_item->hdr);
info.hw_hdr_len = 0;
npc_get_hw_supp_mask(pst, &info, lid, lt);
info.spec = NULL;
info.mask = NULL;

if (eth_item && eth_item->has_vlan)
pst->set_vlan_ltype_mask = true;

rc = npc_parse_item_basic(pst->pattern, &info);
if (rc != 0)
return rc;
Expand Down

0 comments on commit 3294358

Please sign in to comment.