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 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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); -- 2.25.1