From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CC9FB42F90; Mon, 31 Jul 2023 04:56:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F27840A89; Mon, 31 Jul 2023 04:56:18 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 53DE240150; Mon, 31 Jul 2023 04:56:17 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36UNSUMx022028; Sun, 30 Jul 2023 19:56:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=dy82h/+HUXJxq1Q/bdAGTmocj52I5FpvC2I/fOVdkAE=; b=KeRyTBRyNATXRg9dwy2XQtcIxqEQ/31UaWv2OrKLrcNQ0hhI3Xc3AEJaRVB4lOnBZ2cv HdR/VctVkt7pJN2y7Vgm+gMlqd2Etc1zRfKy65GU1payYamw+DkIc51B+WPF+lfY/3fg F3+hJhcVWlkmuQ7hHDwvCvDa72D2P35qxh59N5Na5l0zL+f1uxyHrEYOSnoZpLTaPyW1 Lik/46gaa3KEaR0DCp2NgzWq0jgcyKO+pPj/1qEr6EsOZlynx/E5kxmM78l9CJZQuC2y /PmIGSdy4Q5AwtOQY8h0GsRgsBiNEXze1ZObl5UKAUMj7re296GWLHOH5BgthOhpv+Mm IA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3s504nm1h6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 30 Jul 2023 19:56:16 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 30 Jul 2023 19:56:14 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 30 Jul 2023 19:56:14 -0700 Received: from satheeshpaullabpc.. (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id D737B3F70B9; Sun, 30 Jul 2023 19:56:11 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Satheesh Paul , Subject: [dpdk-dev] [PATCH ] common/cnxk: fix setting default flow action Date: Mon, 31 Jul 2023 08:26:07 +0530 Message-ID: <20230731025607.3928423-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: jv83Eeeg2R6Ha7Z4RS0eHHY56MYPIlxB X-Proofpoint-GUID: jv83Eeeg2R6Ha7Z4RS0eHHY56MYPIlxB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_10,2023-07-26_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Satheesh Paul 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: a07f7ced436def ("common/cnxk: add NPC init and fini") Cc: stable@dpdk.org Signed-off-by: Satheesh Paul Reviewed-by: Kiran Kumar K --- drivers/common/cnxk/hw/nix.h | 1 + drivers/common/cnxk/roc_npc.c | 17 ++++++++++------- drivers/common/cnxk/roc_npc_mcam_dump.c | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h index 26dcda680e..d2c80f3c74 100644 --- a/drivers/common/cnxk/hw/nix.h +++ b/drivers/common/cnxk/hw/nix.h @@ -619,6 +619,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) diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c index 848086c8de..586bc55791 100644 --- a/drivers/common/cnxk/roc_npc.c +++ b/drivers/common/cnxk/roc_npc.c @@ -726,11 +726,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) { @@ -741,8 +745,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 diff --git a/drivers/common/cnxk/roc_npc_mcam_dump.c b/drivers/common/cnxk/roc_npc_mcam_dump.c index 01c4212567..ebd2dd69c2 100644 --- a/drivers/common/cnxk/roc_npc_mcam_dump.c +++ b/drivers/common/cnxk/roc_npc_mcam_dump.c @@ -496,6 +496,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; -- 2.39.2