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 6BED0A0C50; Wed, 21 Jul 2021 10:54:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3011B410EE; Wed, 21 Jul 2021 10:54:49 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2071.outbound.protection.outlook.com [40.107.94.71]) by mails.dpdk.org (Postfix) with ESMTP id 3DA7D40E64 for ; Wed, 21 Jul 2021 10:54:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXZq5ZZU1qS8VJkW9tupKaxVNMNYxgXns+MdnUzemeah89fFdEk8pAsZE+ZXR3U3m8Bg0juHHtXVkKaOl+rM8ndIwCTbTC5l6SlSghhrKE+F8Joq9zezG2KSNCYW9Xl+mWsos5F4IJhIlF6ClPjkQAqsBZHkxrkb7oxh2LFEHPMwg/M+Ip1LrSMOYbjcbrCKRbbKcXu94TKX/kyWgm75sA6u4A2mEjag3XZGTm1Rda4csUNcu2JC2WHZtdIeBJD+SW51D7BtheAbw7YKpsGaB1zLUKaTQil4W4P9iZMShmZxCYEw7AhIKM+qPaBCEG4zsuqzoUuj8L02IACXS+c5cw== 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-SenderADCheck; bh=VHnS1Qd0Vq9yINUgBwx7mAYMS6KMEExdwAwMpFUlJco=; b=KTs1KxXcEv1w/ghVmdKx3HHX3I+WlW/XK860D78i/zRq7Ubz5RQAEMAkasFUiBSjEVEO7cN2m8W7Ilm92s+bTP4UzZy3EXNFm1Sb/jG0FdE/sDe6lCZa3Aa6RkAjxYloZMAKWWbTkgVvzcA3SQzjLEOjbTdMOFgkbV52WLlQ3bJasZUFtwwxqQImMspT7SN265Jbv99VirHatx6d6sLWmSJomda7PpnSPZtJOhLRwy6cM8/G7Ik2OXv3t7jPo++KcfscM+7b2suNU8ehHDk95SucWP3nDBDGuvlNznQ1ZUXWL+gN6GdO5n051aa0YvEoI9LxA3KKdhocIeICcZK6Qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VHnS1Qd0Vq9yINUgBwx7mAYMS6KMEExdwAwMpFUlJco=; b=M/H9k1L/qeIt7cyln3PB0XTc5h+4gjxrwyhgVYKt3XucP/ktwZuqpDpgDNR2WLOfrDD3WmWr9F35MlMcmBW1xAFvmhXYGf9VITRb08HVZfAUB/BatP661K9V9N2BeAi6wneoWPFOZaB9Pm+w6Z6PtsFBm5NTrnz4vK88wmvWt+jWoBU51B08uTkcWKXxb4H9CWMP22Apb7BvuRapv09lnp9IWUQMGDRJrhyxCgDobYPgQurTPi7CTvSpMQU3+WTV6EL5kt6FYDumxpI3JJwPCobELuydfswJqMX63OAVtgQz2h4/B/Ft1JIkXkdwcMmMKD13DjlqxAT15QakfbfDoA== Received: from MWHPR13CA0012.namprd13.prod.outlook.com (2603:10b6:300:16::22) by DM6PR12MB2748.namprd12.prod.outlook.com (2603:10b6:5:43::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Wed, 21 Jul 2021 08:54:43 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:300:16:cafe::50) by MWHPR13CA0012.outlook.office365.com (2603:10b6:300:16::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.10 via Frontend Transport; Wed, 21 Jul 2021 08:54:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 08:54:43 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jul 2021 08:54:40 +0000 From: Bing Zhao To: , CC: , , , , , Date: Wed, 21 Jul 2021 11:54:16 +0300 Message-ID: <20210721085421.13111-3-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210721085421.13111-1-bingz@nvidia.com> References: <20210705155756.21443-1-bingz@nvidia.com> <20210721085421.13111-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8bab0715-593f-4f7d-c791-08d94c252f03 X-MS-TrafficTypeDiagnostic: DM6PR12MB2748: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AToo4NMDRi8ZxXxnfax6Q0DVys5Xx8nZdhaXGwHI6yVlPMXfVC06AWe0sWMebgLsbp4q1K0y/dJF2enGasPB5RnjYIbHwGxXCA48amgZwFpm3mne//vibLED/TLPbhId5HVfUSQ4px3VQ9wcXZecT76LIhpp28ePBg+J4915n5s4C8R8VC1caYE2fW99niz3cENNMx6Prz9hHQHKj7Ic6uip2h8PDcOm03RcmRBKlqhnuLxMJKhIIdOC3f4OFV440lTmNv8/FkSoRmpKMnOvZtpjbirJNtdHuOV9MXyNwAJROTzjdfkIQ1FxU5k0uZvE+/0dpuIpZubdrnNjMlFkKMHfHvyKIoe/y9qIDIQE/geCiYRHWNuT7Uyz0u8hQIqOV4Zou5Bks+1YFWzstHzLGsSOGw6cljg+Xbe0BUhdY/abIuLMv9LAmtaLdU+ainUnF4w+GXocpWaPUeJ2LXOgD6h0Db6jaauMIzJrU270e/Uu15T37+PS3xAvDKVa8DZDa+BOkTqu/+Gf3xSab8ZZATPIu8uZEQeWNLB4+erMJwHCjNntuebwVYG9Smll5gxWdoIep/STHklEJOUmwFLVuv7F8hrl7xGgqmgVURmd8nuxv7278zPYOtGr9EwiD8/LKP1bEck5l66Ga6xBlqgaqWYdnt4U6h+lfugu6omdE5suvs9o+7ENrR+/uqI7iHJL5T9weU6AvA6OqndGVx6oiNJ1//afrOo/9fL/VUnykG+SgBshFwZyjBDtOej25i3AkfwbI9c1bClRbbIolt72Wg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(396003)(136003)(346002)(39860400002)(36840700001)(46966006)(356005)(4326008)(26005)(36906005)(7636003)(478600001)(336012)(2616005)(316002)(7696005)(1076003)(110136005)(8676002)(426003)(6666004)(54906003)(36756003)(82310400003)(966005)(36860700001)(16526019)(6286002)(186003)(82740400003)(70586007)(2906002)(107886003)(6636002)(5660300002)(55016002)(70206006)(8936002)(83380400001)(86362001)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 08:54:43.4904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bab0715-593f-4f7d-c791-08d94c252f03 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2748 Subject: [dpdk-dev] [PATCH v3 2/7] net/mlx5: enable meter bucket overflow for yellow color 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 Sender: "dev" To support the meter policy for yellow action, the prerequisite is that the hardware needs to support the EBS, as defined in the RFC2697. https://datatracker.ietf.org/doc/html/rfc2697 Then some of the packets can be marked as yellow if the tokens of C bucket is not enough but enough in E bucket. The color could be used for the further steering of the packets. In the current implementation EBS and overflow were ignored when creating a meter profile. With this commit, if EBS is set by the application, the generation of yellow color will be enabled in the hardware for flow rules steering of packets. Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5_flow_aso.c | 4 ++++ drivers/net/mlx5/mlx5_flow_meter.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 64631ffc29..23e22e560a 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -747,6 +747,10 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq, wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm = RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) | (MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET)); + /* Only needed for RFC2697. */ + if (fm->profile->srtcm_prm.ebs_eir) + wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm |= + RTE_BE32(1 << ASO_DSEG_BO_OFFSET); sq->head++; sq->pi += 2;/* Each WQE contains 2 WQEBB's. */ rte_io_wmb(); diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index 78eb2a60f9..73eba0dabd 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -319,9 +319,9 @@ mlx5_flow_meter_param_fill(struct mlx5_flow_meter_profile *fmp, cbs_man = man; cbs_exp = exp; srtcm->cbs_cir = rte_cpu_to_be_32(cbs_exp << ASO_DSEG_CBS_EXP_OFFSET | - cbs_man << ASO_DSEG_CBS_MAN_OFFSET | - cir_exp << ASO_DSEG_CIR_EXP_OFFSET | - cir_man); + cbs_man << ASO_DSEG_CBS_MAN_OFFSET | + cir_exp << ASO_DSEG_CIR_EXP_OFFSET | + cir_man); mlx5_flow_meter_xbs_man_exp_calc(ebs, &man, &exp); /* Check if ebs mantissa is too large. */ if (exp > ASO_DSEG_EXP_MASK) @@ -332,7 +332,7 @@ mlx5_flow_meter_param_fill(struct mlx5_flow_meter_profile *fmp, ebs_man = man; ebs_exp = exp; srtcm->ebs_eir = rte_cpu_to_be_32(ebs_exp << ASO_DSEG_EBS_EXP_OFFSET | - ebs_man << ASO_DSEG_EBS_MAN_OFFSET); + ebs_man << ASO_DSEG_EBS_MAN_OFFSET); return 0; } @@ -421,7 +421,7 @@ mlx5_flow_meter_profile_add(struct rte_eth_dev *dev, return ret; /* Meter profile memory allocation. */ fmp = mlx5_malloc(MLX5_MEM_ZERO, sizeof(struct mlx5_flow_meter_profile), - RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY); + RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY); if (fmp == NULL) return -rte_mtr_error_set(error, ENOMEM, RTE_MTR_ERROR_TYPE_UNSPECIFIED, -- 2.27.0