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 5C3E6A00C3; Wed, 7 Dec 2022 03:18:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D2B3342D21; Wed, 7 Dec 2022 03:18:24 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2091.outbound.protection.outlook.com [40.107.223.91]) by mails.dpdk.org (Postfix) with ESMTP id B099942D21 for ; Wed, 7 Dec 2022 03:18:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0JXjKbWSYebE9ghEqIG1DV380rGQ5VwdxLeelb3e1OelSEN1pvknRzYYDhLBzYQz0zK1WGZip0BguSE0K6jBhJk1zQTmr8g0L8Ij9th/E5qq/jsumy8U4FsqGc0QvL1lwEGml38k7CPxhj4PDB/NrxneUoNGcYRFAWkHhKi/bzusCYwioF8QurPMj3tUg/+VOo0b4+PBnQnIUffdWaGbiSUXVYOaZx9RTW5Qgc0nTXaDn30IXM0U/nD5YOzuTWHyDnk+A4DJ4ZJGuEQ2NjnIC7AanStsWvQ7FLvk3aZqN4U5C2XQKsbBf9UMHhEaj7oPoQdWUjBPmRVffveWxfBQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o6BoluGXXKiq6IVG+dKQcqYRFmK9jb2W0Q88z6ADA8Q=; b=VKo0dX4gKEelIWCWRBAE51RKAy6QYrKylN7aEzBHn4dBAAQvs4jF1Ell2BICVY5cs35Qgy6tH1oIiZ1471fHwjF9MdLBvixoj4aaDemo8WMyJcuB3sSLxcbwtza0N18nsvR7sGKC7GH2FsG8t7wUibVB8sqKwOFjpaDBtmD4rAziirqEsR8Sh2ZMFVQeetNnvgz2J2OVeOaZ6/nRUT+GcmPz+fROObu28inStSudhWODK0MWV67HHgX0+aOp/hIXvWB9ODEsAjt2KQICaDJibSURNzfxDHCqTzg795Uup3LaWj56nFrxOMY0DnaOM9t7ffe7nQ11bYcT2G+fwTap/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o6BoluGXXKiq6IVG+dKQcqYRFmK9jb2W0Q88z6ADA8Q=; b=jJCIFTModK8qG3dxiff6EXzIklPvH8+n1YuG/T/fZkLRCmkuSLZ8/TiZFgvcs2D+Q8zx1LKHULeZmyAszIsPBT/kDmCFHS4WccA7A5zc/F+/GaogZJaqf6yIRQtEJm+dTI/lqNfp6ezJns2ThhCpSPi8mfFxR5v6EyKlYr9hs9M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CH0PR13MB4603.namprd13.prod.outlook.com (2603:10b6:610:c3::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Wed, 7 Dec 2022 02:18:21 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::5122:8c31:51f3:4ee7]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::5122:8c31:51f3:4ee7%4]) with mapi id 15.20.5880.014; Wed, 7 Dec 2022 02:18:21 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Jin Liu , Peng Zhang , Chaoyong He Subject: [PATCH 3/6] net/nfp: add meter policy options Date: Wed, 7 Dec 2022 10:17:45 +0800 Message-Id: <20221207021748.40143-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20221207021748.40143-1-chaoyong.he@corigine.com> References: <20221207021748.40143-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO6P265CA0021.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ff::14) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH0PR13MB4603:EE_ X-MS-Office365-Filtering-Correlation-Id: d0947526-6fe5-4e4f-a1af-08dad7f94f63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V7x8xEXwJZcxn3QH1+NsLwjfET4Hvsy2qoBDm1kjXhSSJL/8GbhaEmZRiBqN1bh0ATf6EucT1/jC3Qq0QZAfN86YXzAqJlE0PRH5ok94fiOdIHcwJ6lDzHqogOQF+Jb+jH1RXt6+zacsC3vpSUfx3WppLGY7Lb7tyjOXlRCem5xLni5+Q9tCouMGJcLjO58+4SiLUvtJjtUT+kToqwXPmT7/3QHU6ST2r/4V1Jaw5XWCDXb0XeJO2vQfbj1+iok3W0L7iytZJPvTxgTTo2XaLhCy70wqHJnvMLs3J1DTsKbpCMFMI1muszHN7zgqN+FPggU2vWPLKERqy1SGOBUfJfDGA8Jy92iNCmKIWvkK0HqsG1XIHAYddyGTD/espcGjzx72ebzSZYFmbCVg2TrPcV17szb91Ag68itELurPCo+1/j7CdqZC6NCJbfugKlquRVsSPJz+ZzrJaG7Vtw3V+N+MprwExpRvwVtufTZHN6z/kLZnoQaeWqiYxK59l5JK9S6qsVF8Z7TDxEibtNayefD3sv1dJt93hJgrjqUNPWMpDirgy4UNHjhBml3FcKOcwRVZfHeumbT+Cbu5gcN4ZToeu774AGsgeWOw7NEsE9lsCDgWIp9mXnjd4bsGDAYiFBoord6WX9T61l89K/4uyVKjYmyWSt8IDGz0HsWItyb/RAu6E0Nbn0kBgvCSIXDbuxatKr5AsDpAfEaE0qhowqcCkKYYXbqYO2mdGwZeTRhbY6Ycvf8K0pDhzd3PQfbx X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(396003)(39840400004)(366004)(376002)(346002)(451199015)(107886003)(6486002)(6506007)(6666004)(66556008)(52116002)(6916009)(54906003)(66476007)(86362001)(66946007)(478600001)(316002)(8676002)(4326008)(26005)(6512007)(2906002)(1076003)(186003)(38100700002)(38350700002)(2616005)(41300700001)(44832011)(8936002)(83380400001)(66574015)(5660300002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OHNwbWFhSWRZWnFnWXJkYi9iTXRkeWJsTjcwalZDOEpvdTBSQmVubk9HTi9O?= =?utf-8?B?MU5Gck1CNlloRUo2a24wcmxiV1VOUXlFTTRnWkJHQUpxWWVjQmQycTJ1WWpI?= =?utf-8?B?dUJmMjdiSTJ6ZXpPZ1lmaEdlamIwUTRWRTVUUEN6UUxyVjhySEdob0tRemRJ?= =?utf-8?B?K011TzVacjVEcGYrclNKMjVLcnBPNGxxSkIwWXBUaWtqVGYwZlA5V1AyY1pF?= =?utf-8?B?NWs2NVYvZTJpbHpZTUszNzMzRFN6cW1GaHZ5YVFrNHBXamRuRjhvSGtvRmNQ?= =?utf-8?B?MmluY2dEU0pUdG1lUHd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B?ejB0d0lGVUVnMmNwZDhGTlZVZmJNTnVkNE1VSDRUQ3Z1VElkVDJneU9uRGt5?= =?utf-8?B?UUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0947526-6fe5-4e4f-a1af-08dad7f94f63 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2022 02:18:20.9010 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7CWeUYQ7Q53eiafCuPIunGHg6vL8HGxMxU2Pnw8FVYt+41zWx8YCjQ/7rVsF6hqipfd1cZ9N9G68kkVvFIIOP9WTu37gSR2tNm/GlszCAS0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR13MB4603 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: Jin Liu Add support for meter policy options, include add a new policy and delete a exist policy, the meter policy indicate that action to be performed for messages of different colors. Signed-off-by: Jin Liu Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_mtr.c | 179 ++++++++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_mtr.h | 18 ++++ 2 files changed, 197 insertions(+) diff --git a/drivers/net/nfp/nfp_mtr.c b/drivers/net/nfp/nfp_mtr.c index 50efb56879..c8caf97262 100644 --- a/drivers/net/nfp/nfp_mtr.c +++ b/drivers/net/nfp/nfp_mtr.c @@ -371,10 +371,182 @@ nfp_mtr_profile_delete(struct rte_eth_dev *dev, return 0; } +static struct nfp_mtr_policy * +nfp_mtr_policy_search(struct nfp_mtr_priv *priv, uint32_t mtr_policy_id) +{ + struct nfp_mtr_policy *mtr_policy; + + LIST_FOREACH(mtr_policy, &priv->policies, next) + if (mtr_policy->policy_id == mtr_policy_id) + break; + + return mtr_policy; +} + +static int +nfp_mtr_policy_validate(uint32_t mtr_policy_id, + struct rte_mtr_meter_policy_params *policy, + struct rte_mtr_error *error) +{ + const struct rte_flow_action *action; + + /* Policy must not be NULL */ + if (policy == NULL) { + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_POLICY, + NULL, "Meter policy is null."); + } + + /* Meter policy ID must be valid. */ + if (mtr_policy_id >= NFP_MAX_POLICY_CNT) { + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_POLICY_ID, + NULL, "Meter policy id not valid."); + } + + /* Check green action + * Actions equal NULL means end action + */ + action = policy->actions[RTE_COLOR_GREEN]; + if (action != NULL && action->type != RTE_FLOW_ACTION_TYPE_VOID) { + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_POLICY, + NULL, "Green action must be void or end"); + } + + /* Check yellow action + * Actions equal NULL means end action + */ + action = policy->actions[RTE_COLOR_YELLOW]; + if (action != NULL && action->type != RTE_FLOW_ACTION_TYPE_VOID) { + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_POLICY, + NULL, "Yellow action must be void or end"); + } + + /* Check red action */ + action = policy->actions[RTE_COLOR_RED]; + if (action == NULL || action->type != RTE_FLOW_ACTION_TYPE_DROP) { + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_POLICY, + NULL, "Red action must be drop"); + } + + return 0; +} + +/** + * Callback to add MTR policy. + * + * @param[in] dev + * Pointer to Ethernet device. + * @param[in] mtr_policy_id + * Meter policy id. + * @param[in] policy + * Pointer to meter policy detail. + * @param[out] error + * Pointer to the error structure. + * + * @return + * 0 on success, a negative value otherwise and rte_errno is set. + */ +static int +nfp_mtr_policy_add(struct rte_eth_dev *dev, + uint32_t mtr_policy_id, + struct rte_mtr_meter_policy_params *policy, + struct rte_mtr_error *error) +{ + int ret; + struct nfp_mtr_priv *priv; + struct nfp_mtr_policy *mtr_policy; + struct nfp_flower_representor *representor; + + representor = dev->data->dev_private; + priv = representor->app_fw_flower->mtr_priv; + + /* Check if mtr policy id exist */ + mtr_policy = nfp_mtr_policy_search(priv, mtr_policy_id); + if (mtr_policy != NULL) { + return -rte_mtr_error_set(error, EEXIST, + RTE_MTR_ERROR_TYPE_METER_POLICY_ID, + NULL, "Meter policy already exist"); + } + + /* Check input params */ + ret = nfp_mtr_policy_validate(mtr_policy_id, policy, error); + if (ret != 0) + return ret; + + /* Meter policy memory alloc */ + mtr_policy = rte_zmalloc(NULL, sizeof(struct nfp_mtr_policy), 0); + if (mtr_policy == NULL) { + return -rte_mtr_error_set(error, ENOMEM, + RTE_MTR_ERROR_TYPE_UNSPECIFIED, + NULL, "Meter policy alloc failed"); + } + + mtr_policy->policy_id = mtr_policy_id; + rte_memcpy(&mtr_policy->policy, policy, + sizeof(struct rte_mtr_meter_policy_params)); + + /* Insert policy into policy list */ + LIST_INSERT_HEAD(&priv->policies, mtr_policy, next); + + return 0; +} + +/** + * Callback to delete MTR policy. + * + * @param[in] dev + * Pointer to Ethernet device. + * @param[in] mtr_policy_id + * Meter policy id. + * @param[out] error + * Pointer to the error structure. + * + * @return + * 0 on success, a negative value otherwise and rte_errno is set. + */ +static int +nfp_mtr_policy_delete(struct rte_eth_dev *dev, + uint32_t mtr_policy_id, + struct rte_mtr_error *error) +{ + struct nfp_mtr_priv *priv; + struct nfp_mtr_policy *mtr_policy; + struct nfp_flower_representor *representor; + + representor = dev->data->dev_private; + priv = representor->app_fw_flower->mtr_priv; + + /* Check if mtr policy id exist */ + mtr_policy = nfp_mtr_policy_search(priv, mtr_policy_id); + if (mtr_policy == NULL) { + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_POLICY_ID, + NULL, "Request meter policy not exist"); + } + + if (mtr_policy->ref_cnt > 0) { + return -rte_mtr_error_set(error, EBUSY, + RTE_MTR_ERROR_TYPE_METER_POLICY, + NULL, "Request mtr policy is been used"); + } + + /* Remove profile from profile list */ + LIST_REMOVE(mtr_policy, next); + rte_free(mtr_policy); + + return 0; +} + static const struct rte_mtr_ops nfp_mtr_ops = { .capabilities_get = nfp_mtr_cap_get, .meter_profile_add = nfp_mtr_profile_add, .meter_profile_delete = nfp_mtr_profile_delete, + .meter_policy_add = nfp_mtr_policy_add, + .meter_policy_delete = nfp_mtr_policy_delete, }; int @@ -406,6 +578,7 @@ nfp_mtr_priv_init(struct nfp_pf_dev *pf_dev) app_fw_flower->mtr_priv = priv; LIST_INIT(&priv->profiles); + LIST_INIT(&priv->policies); return 0; } @@ -414,6 +587,7 @@ void nfp_mtr_priv_uninit(struct nfp_pf_dev *pf_dev) { struct nfp_mtr_priv *priv; + struct nfp_mtr_policy *mtr_policy; struct nfp_mtr_profile *mtr_profile; struct nfp_app_fw_flower *app_fw_flower; @@ -425,5 +599,10 @@ nfp_mtr_priv_uninit(struct nfp_pf_dev *pf_dev) rte_free(mtr_profile); } + LIST_FOREACH(mtr_policy, &priv->policies, next) { + LIST_REMOVE(mtr_policy, next); + rte_free(mtr_policy); + } + rte_free(priv); } diff --git a/drivers/net/nfp/nfp_mtr.h b/drivers/net/nfp/nfp_mtr.h index 05919c2bde..4fea0cf926 100644 --- a/drivers/net/nfp/nfp_mtr.h +++ b/drivers/net/nfp/nfp_mtr.h @@ -6,6 +6,8 @@ #ifndef __NFP_MTR_H__ #define __NFP_MTR_H__ +#include + /** * The max meter count is determined by firmware. * The max count is 65536 defined by OF_METER_COUNT. @@ -79,12 +81,28 @@ struct nfp_mtr_profile { bool in_use; }; +/** + * Struct nfp_mtr_policy - meter policy information + * @next: next meter policy object + * @policy_id: meter policy id + * @ref_cnt: reference count by meter + * @policy: RTE_FLOW policy information + */ +struct nfp_mtr_policy { + LIST_ENTRY(nfp_mtr_policy) next; + uint32_t policy_id; + uint32_t ref_cnt; + struct rte_mtr_meter_policy_params policy; +}; + /** * Struct nfp_mtr_priv - meter private data * @profiles: the head node of profile list + * @policies: the head node of policy list */ struct nfp_mtr_priv { LIST_HEAD(, nfp_mtr_profile) profiles; + LIST_HEAD(, nfp_mtr_policy) policies; }; int nfp_net_mtr_ops_get(struct rte_eth_dev *dev, void *arg); -- 2.29.3