From patchwork Thu Dec 22 01:39:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 121242 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9500EA034C; Thu, 22 Dec 2022 02:39:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DC5C40A7F; Thu, 22 Dec 2022 02:39:18 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4206140698 for ; Thu, 22 Dec 2022 02:39:16 +0100 (CET) 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 2BM1UjKH018330; Wed, 21 Dec 2022 17:39:11 -0800 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=Ft0MVHpXJ+A/794uVpwLE905uPs7NmjqPChpCIYlU7c=; b=Z/cVL8OLOJNqgYlAP0pNooYAhfrRxNrH4ex4rGKq1G14ROBJtU4uvz+JpJDrK++mtfYQ IHDTd/G+81QkAPfToioo6W4l+iXDi4hF9xyjP7c28PipcK9dWIHi8A4vmlJRKcfDdcCA 7rQOdQMZ/3H6ZE8FvBB/NX4OvkVRyMVzZKnJD1t+vxwiZ3mzegjYCHh/GO2WeElRjWMP +HGMbKCGubCuWKrxVfcMtOURpgBz0mjNa7eY6yuURuzKFY0DxvGtoMoKlLpJhI1j8v+I sQpK6uU3OPmpGg2PVJr1j4hKfDb5RM/lISNhkaNY9JP5h8YDRZjjQWkS0aLZAwLQ+nmE SQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mm79c1vv9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 17:39:11 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 21 Dec 2022 17:39:10 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Wed, 21 Dec 2022 17:39:10 -0800 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id D97C63F705D; Wed, 21 Dec 2022 17:39:07 -0800 (PST) From: Rakesh Kudurumalla To: Ori Kam , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko CC: , , Rakesh Kudurumalla Subject: [PATCH 1/3] lib: dpdk spec to skip red for ingress policer Date: Thu, 22 Dec 2022 07:09:02 +0530 Message-ID: <20221222013904.692922-1-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Kis9in6kOxFna-J8oUV8b5u4oQGL_Act X-Proofpoint-GUID: Kis9in6kOxFna-J8oUV8b5u4oQGL_Act X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-21_14,2022-12-21_01,2022-06-22_01 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 Dropping of packets based on RED can be skipped with meter action, when RED is configured using rte_eth_cman_config_set() Signed-off-by: Rakesh Kudurumalla --- lib/ethdev/rte_flow.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index b60987db4b..d72374a0b8 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2203,6 +2203,16 @@ enum rte_flow_action_type { */ RTE_FLOW_ACTION_TYPE_DROP, + /** + * Skip packet drops base on RED + * + * Dropping of packets is based on RED when RED is configured + * uing rte_eth_cman_config_set(). RED drop can be skipped + * with this action + * + */ + RTE_FLOW_ACTION_TYPE_SKIP_RED, + /** * Enables counters for this flow rule. * From patchwork Thu Dec 22 01:39:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 121243 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6DC2EA034C; Thu, 22 Dec 2022 02:39:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E5074282D; Thu, 22 Dec 2022 02:39:20 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E10C3410D3 for ; Thu, 22 Dec 2022 02:39:18 +0100 (CET) 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 2BM1IX8u019997; Wed, 21 Dec 2022 17:39:17 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=XQnW9HIyTfEfOL5J0U93lOfg+ZvO2bBXSkICLv1pGhc=; b=SI9Om9BxjG3nCVEgBKvp5ZG3WKcZBzSasTInOdrYtPXw7E8u5qST7vC8+MYVTv3ezWhe tNbRGStssFrtuB0FYCXNIckh3ADhvUZvwTdeHN107AcuHytVo5XmSYnKiP9YMJVvWYVP ZPg9QIr3JIsxEtX/xY7yVBpdgYumX+V+7i6hLj3JDFLxVaT+Awbl5e5l6xqR0IDQSm/q p3K7xA2Q7vAK3mvi2HXkG1wrVgWjCa1Qq9GeDEZtFQg3mwfVSv1e4Ah162rOhgel7UpN 6GZLfudZgxZ8XxS5oC5f3wTA7/fcxVPg/+YEyyoN9lSaJYY0ZZKIjyFXoIJoGGAcU5Vs Jg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mm79c1vvm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 17:39:17 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 21 Dec 2022 17:39:15 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Wed, 21 Dec 2022 17:39:15 -0800 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id 7FA5A3F7060; Wed, 21 Dec 2022 17:39:13 -0800 (PST) From: Rakesh Kudurumalla To: Ori Kam , Aman Singh , "Yuying Zhang" CC: , , Rakesh Kudurumalla Subject: [PATCH 2/3] app/testpmd: add skip red for testpmd Date: Thu, 22 Dec 2022 07:09:03 +0530 Message-ID: <20221222013904.692922-2-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221222013904.692922-1-rkudurumalla@marvell.com> References: <20221222013904.692922-1-rkudurumalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: RNXMGQAUhIeRI9okjMH8QhMWoOvwKTAW X-Proofpoint-GUID: RNXMGQAUhIeRI9okjMH8QhMWoOvwKTAW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-21_14,2022-12-21_01,2022-06-22_01 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 added support for testpmd application to accept skip_red action while configuring policy action Signed-off-by: Rakesh Kudurumalla --- app/test-pmd/cmdline_flow.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 88108498e0..a1094bf00f 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -472,6 +472,7 @@ enum index { ACTION_END, ACTION_VOID, ACTION_PASSTHRU, + ACTION_SKIP_RED, ACTION_JUMP, ACTION_JUMP_GROUP, ACTION_MARK, @@ -1825,6 +1826,7 @@ static const enum index next_action[] = { ACTION_END, ACTION_VOID, ACTION_PASSTHRU, + ACTION_SKIP_RED, ACTION_JUMP, ACTION_MARK, ACTION_FLAG, @@ -5159,6 +5161,13 @@ static const struct token token_list[] = { .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), .call = parse_vc, }, + [ACTION_SKIP_RED] = { + .name = "skip_red", + .help = "disable dropping of packets based on RED", + .priv = PRIV_ACTION(SKIP_RED, 0), + .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), + .call = parse_vc, + }, [ACTION_JUMP] = { .name = "jump", .help = "redirect traffic to a given group", From patchwork Thu Dec 22 01:39:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 121244 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45167A034C; Thu, 22 Dec 2022 02:39:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37BA5410D3; Thu, 22 Dec 2022 02:39:32 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 53B3F40698 for ; Thu, 22 Dec 2022 02:39:30 +0100 (CET) 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 2BM1E0Zl018294; Wed, 21 Dec 2022 17:39:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=NO60uSGILPcfR+PFCbkboXn32gj8HzwvM+Gr909/jco=; b=WF0Ctytdho1UyQGxUBrhNjicQaXeAMCtObF3TJbfoUKNtS6pSMlQArTdzj9cgTh29SIn NvJVz8J729yKceI4b/RhkN6qV8p21ahXkrbZGhK2iMAayOIZoWtfd+cJtOjdGvVrfYMg kFB6u+rkJ1mbaX5ihpSOaOjK6QPj1Ms/1phfNh0nEZQvmJFbejn4hGBDzsu5tL5J48vz G0GaFXCPdAT76oAtsCChX7Zvg22Yh2Pt6iXBVXmUmSPdYHvXibNM9jzbuhnlcpbfQWul YTL2/lKdA+ymjLgL3oxCWZgc73dHLz3fdAmiN54aYX9YDxicDH4j1vBp618Pj0sJProx xQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mm79c1vvt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 17:39:28 -0800 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.42; Wed, 21 Dec 2022 17:39:19 -0800 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.42 via Frontend Transport; Wed, 21 Dec 2022 17:39:19 -0800 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id 067D55B697C; Wed, 21 Dec 2022 17:39:16 -0800 (PST) From: Rakesh Kudurumalla To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH 3/3] net/cnxk: skip red drop for ingress policer Date: Thu, 22 Dec 2022 07:09:04 +0530 Message-ID: <20221222013904.692922-3-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221222013904.692922-1-rkudurumalla@marvell.com> References: <20221222013904.692922-1-rkudurumalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 0q2uHw1zTT-pUP5DkAKMN2Po-iWw_Xev X-Proofpoint-GUID: 0q2uHw1zTT-pUP5DkAKMN2Po-iWw_Xev X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-21_14,2022-12-21_01,2022-06-22_01 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 Dropping of packets is based on action configured to meter.If both skip_red and drop actions are configured then tail dropping in invoked else if only drop action is configured then RED drop is invoked.This action is supported only when RED is configured using rte_eth_cman_config_set() Signed-off-by: Rakesh Kudurumalla --- drivers/net/cnxk/cnxk_ethdev.h | 1 + drivers/net/cnxk/cnxk_ethdev_mtr.c | 50 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index 651ef45ea8..4fe4aa320b 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -222,6 +222,7 @@ struct policy_actions { uint16_t queue; uint32_t mtr_id; struct action_rss *rss_desc; + bool skip_red; }; }; diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c index 0fa18f01c7..ff8fa35428 100644 --- a/drivers/net/cnxk/cnxk_ethdev_mtr.c +++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c @@ -359,6 +359,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev, if (action->type == RTE_FLOW_ACTION_TYPE_VOID) supported[i] = true; + if (action->type == RTE_FLOW_ACTION_TYPE_SKIP_RED) + supported[i] = true; + if (!supported[i]) return update_mtr_err(i, error, true); } @@ -398,6 +401,10 @@ cnxk_fill_policy_actions(struct cnxk_mtr_policy_node *fmp, fmp->actions[i].action_fate = action->type; } + + if (action->type == + RTE_FLOW_ACTION_TYPE_SKIP_RED) + fmp->actions[i].skip_red = true; } } } @@ -1307,6 +1314,45 @@ nix_mtr_config_map(struct cnxk_meter_node *mtr, struct roc_nix_bpf_cfg *cfg) cfg->action[ROC_NIX_BPF_COLOR_RED] = ROC_NIX_BPF_ACTION_DROP; } +static void +nix_mtr_config_red(struct cnxk_meter_node *mtr, struct roc_nix_rq *rq, + struct roc_nix_bpf_cfg *cfg) +{ + struct cnxk_mtr_policy_node *policy = mtr->policy; + + if ((rq->red_pass && rq->red_pass >= rq->red_drop) || + (rq->spb_red_pass && rq->spb_red_pass >= rq->spb_red_drop) || + (rq->xqe_red_pass && rq->xqe_red_pass >= rq->xqe_red_drop)) { + if (policy->actions[RTE_COLOR_GREEN].action_fate == + RTE_FLOW_ACTION_TYPE_DROP) { + if (policy->actions[RTE_COLOR_GREEN].skip_red) + cfg->action[ROC_NIX_BPF_COLOR_GREEN] = + ROC_NIX_BPF_ACTION_DROP; + else + cfg->action[ROC_NIX_BPF_COLOR_GREEN] = + ROC_NIX_BPF_ACTION_RED; + } + if (policy->actions[RTE_COLOR_YELLOW].action_fate == + RTE_FLOW_ACTION_TYPE_DROP) { + if (policy->actions[RTE_COLOR_YELLOW].skip_red) + cfg->action[ROC_NIX_BPF_COLOR_YELLOW] = + ROC_NIX_BPF_ACTION_DROP; + else + cfg->action[ROC_NIX_BPF_COLOR_YELLOW] = + ROC_NIX_BPF_ACTION_RED; + } + if (policy->actions[RTE_COLOR_RED].action_fate == + RTE_FLOW_ACTION_TYPE_DROP) { + if (policy->actions[RTE_COLOR_RED].skip_red) + cfg->action[ROC_NIX_BPF_COLOR_RED] = + ROC_NIX_BPF_ACTION_DROP; + else + cfg->action[ROC_NIX_BPF_COLOR_RED] = + ROC_NIX_BPF_ACTION_RED; + } + } +} + static void nix_precolor_table_map(struct cnxk_meter_node *mtr, struct roc_nix_bpf_precolor *tbl, @@ -1484,6 +1530,10 @@ nix_mtr_configure(struct rte_eth_dev *eth_dev, uint32_t id) if (!mtr[i]->is_used) { memset(&cfg, 0, sizeof(struct roc_nix_bpf_cfg)); nix_mtr_config_map(mtr[i], &cfg); + for (j = 0; j < mtr[i]->rq_num; j++) { + rq = &dev->rqs[mtr[i]->rq_id[j]]; + nix_mtr_config_red(mtr[i], rq, &cfg); + } rc = roc_nix_bpf_config(nix, mtr[i]->bpf_id, lvl_map[mtr[i]->level], &cfg);