Skip to content

Commit

Permalink
common/cnxk: fix default flow action setting
Browse files Browse the repository at this point in the history
[ upstream commit b1f677d4386f7d9ad26a71615c00a2bdcb125c5e ]

For MCAM rules with PF/VF action, the PF's default rule action is
is copied and overwritten over the user provided action. Fixing this
by setting default action only if no other action (like queue) is
specified by user.

Fixes: a07f7ce ("common/cnxk: add NPC init and fini")

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
  • Loading branch information
satheeshpaul authored and kevintraynor committed Oct 31, 2023
1 parent 77810d0 commit b2da49e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions drivers/common/cnxk/hw/nix.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@
#define NIX_RX_ACTIONOP_RSS (0x4ull)
#define NIX_RX_ACTIONOP_PF_FUNC_DROP (0x5ull)
#define NIX_RX_ACTIONOP_MIRROR (0x6ull)
#define NIX_RX_ACTIONOP_DEFAULT (0xfull)

#define NIX_RX_VTAGACTION_VTAG0_RELPTR (0x0ull)
#define NIX_RX_VTAGACTION_VTAG1_RELPTR (0x4ull)
Expand Down
17 changes: 10 additions & 7 deletions drivers/common/cnxk/roc_npc.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,15 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
if (req_act == ROC_NPC_ACTION_TYPE_VLAN_STRIP) {
/* Only VLAN action is provided */
flow->npc_action = NIX_RX_ACTIONOP_UCAST;
} else if (req_act &
(ROC_NPC_ACTION_TYPE_PF | ROC_NPC_ACTION_TYPE_VF)) {
flow->npc_action = NIX_RX_ACTIONOP_UCAST;
if (req_act & ROC_NPC_ACTION_TYPE_QUEUE)
flow->npc_action |= (uint64_t)rq << 20;
} else if (req_act & (ROC_NPC_ACTION_TYPE_PF | ROC_NPC_ACTION_TYPE_VF)) {
/* Check if any other action is set */
if ((req_act == ROC_NPC_ACTION_TYPE_PF) || (req_act == ROC_NPC_ACTION_TYPE_VF)) {
flow->npc_action = NIX_RX_ACTIONOP_DEFAULT;
} else {
flow->npc_action = NIX_RX_ACTIONOP_UCAST;
if (req_act & ROC_NPC_ACTION_TYPE_QUEUE)
flow->npc_action |= (uint64_t)rq << 20;
}
} else if (req_act & ROC_NPC_ACTION_TYPE_DROP) {
flow->npc_action = NIX_RX_ACTIONOP_DROP;
} else if (req_act & ROC_NPC_ACTION_TYPE_QUEUE) {
Expand All @@ -531,8 +535,7 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
} else if (req_act & ROC_NPC_ACTION_TYPE_SEC) {
flow->npc_action = NIX_RX_ACTIONOP_UCAST_IPSEC;
flow->npc_action |= (uint64_t)rq << 20;
} else if (req_act &
(ROC_NPC_ACTION_TYPE_FLAG | ROC_NPC_ACTION_TYPE_MARK)) {
} else if (req_act & (ROC_NPC_ACTION_TYPE_FLAG | ROC_NPC_ACTION_TYPE_MARK)) {
flow->npc_action = NIX_RX_ACTIONOP_UCAST;
} else if (req_act & ROC_NPC_ACTION_TYPE_COUNT) {
/* Keep ROC_NPC_ACTION_TYPE_COUNT_ACT always at the end
Expand Down
4 changes: 4 additions & 0 deletions drivers/common/cnxk/roc_npc_mcam_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ npc_flow_dump_rx_action(FILE *file, uint64_t npc_action)
plt_strlcpy(index_name, "Multicast/mirror table index",
NPC_MAX_FIELD_NAME_SIZE);
break;
case NIX_RX_ACTIONOP_DEFAULT:
fprintf(file, "NIX_RX_ACTIONOP_DEFAULT (%" PRIu64 ")\n",
(uint64_t)NIX_RX_ACTIONOP_DEFAULT);
break;
default:
plt_err("Unknown NIX_RX_ACTIONOP found");
return;
Expand Down

0 comments on commit b2da49e

Please sign in to comment.