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 B1DD4A0C46; Sun, 18 Jul 2021 19:19:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 503BE4118E; Sun, 18 Jul 2021 19:19:02 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2045.outbound.protection.outlook.com [40.107.96.45]) by mails.dpdk.org (Postfix) with ESMTP id 89596410E6 for ; Sun, 18 Jul 2021 19:18:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eeqlT2hfdVPyG4H39oVON5nWiQFNsCHq2xPbP9+UYdVV4s5r21RKrXFVPbzqd8vD+MNiYFBbw1Vc7lpC9hrj7qs/LoOGLsNWVBx2rSwuaVPplNXxV4JQ02igGCD1BWIWsj/XrBiWpfbMokyC5s6LaWLXgaSuVp9D/iGR/2+AI1zbEMY7e5G/XHwsxMoiixw8L01DYlzgkIRlW44OifYtm21LfZ0ZFnGoQiTzSHMClUPfN4eovMKYneIxshivUynlprgIHhkfFijqyRw5f5hK2mMjn2XKYhE3hwCbfJiJpZBACo9GOEh2DeYIKYtGe6wdJmjeReEonA/bcmgQLD3iWw== 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=g12YismhYwt4oThG5Ar0Tt+CUGc62crmpM2qKmMuEm98f/ZNXOaNl7jV/nFGtwtIFTjzHWBRtx6gkIreWJviP21ifQlnayar2bm/za51k5nm0YXWRmDysodHnlDUCjj3rElxvuOSzrRltbbeQgdokI52Fj38nm5XG7kdb/kggX+veFztqoPAy8XHNNwCKfqsPA01RrwqDw7nUFFHIfrtaEIivHxJD9m4EqGLRBa+YBZH0AWlFjI1omzE95KQqpYKKokPZV0Mwc10l09MMw3RrRrasP9a6OvKs4gu31xQwR42iFJjt7KFS4DidIvwsD/tQZ+TMIqjC48TnrzuKSSIlA== 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=jb4Fo/nQzLyNpWqrlYY0PI33kxvxZpF29SyqXyndNrfLP3T/yBC4bMJT07Uau2M7UlrR53nxjtzBXYEjQ7fTFySJgUfsY5tVNiRfpx7roW9k7JsPOggGaME8seTO8i7uoxY0t7/vfB4NCzW5DOe207RYDCcsigyI18P4Jh01jPxDE4IC/X2zcOrI6WlyDbhZLdj6cHpHazZeFKNa6EQJGLjfoQd+HgQXh2+ih6m+jZxrFg9kCZB7uP/ZtklyTPsuEJ/5MoCl13qZVqB1wFfoLsZV9G1jMWH4ttkGcD+jNBplpRm9gIK6ISzgx9/Q0ozf96LzTOf5hpSMZETJkFfikg== Received: from BN9PR03CA0254.namprd03.prod.outlook.com (2603:10b6:408:ff::19) by BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Sun, 18 Jul 2021 17:18:57 +0000 Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ff:cafe::c9) by BN9PR03CA0254.outlook.office365.com (2603:10b6:408:ff::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23 via Frontend Transport; Sun, 18 Jul 2021 17:18:57 +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 BN8NAM11FT040.mail.protection.outlook.com (10.13.177.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4331.21 via Frontend Transport; Sun, 18 Jul 2021 17:18:57 +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; Sun, 18 Jul 2021 17:18:54 +0000 From: Bing Zhao To: , CC: , , , , , Date: Sun, 18 Jul 2021 20:18:12 +0300 Message-ID: <20210718171817.23822-3-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210718171817.23822-1-bingz@nvidia.com> References: <20210705155756.21443-1-bingz@nvidia.com> <20210718171817.23822-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2600ef11-42c1-4a0a-e49d-08d94a1020a7 X-MS-TrafficTypeDiagnostic: BL0PR12MB2484: 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: u6OJ83EO1PoXcBbsH922psxZHF32r+diJ9BtStClzlKYgnKC7EBQ4scpubD3eFcHXye3uZcM3TiqFKPtqM4aDTIr6GYNmi6MT68w7PPSEEpihPbB59V0wroB7R1hjkwhDGk0OZ7np6pgfcbjdxmhgAVrw5PkmM0LpRt+cheM9pTlLLGCVewe7LiA1CfrosNeStK0ieEemY1hSoDshCvo6Lqn4SHKWMLj1wvD9frMMyymp4yHOeXC2JjXQ0EAT5MA+xBfjk93Wzwx/b4ggcW9IgKMhwYrrRNmiVB4zMThc9TWKWzE1mwRIyAO0psqmSjZMvIoSylmoO2vNs5JE0WVltzf2z7JWIRmtqe5CklciiUUyRWPsGO4vDmZkMxyxhyRc1HUd7Qex2w+KldNam/NgkyRh0JV/J9zw9wQAnej5ktIJcY8FKbuaEXhKug0Geo5bdFZw9blxkfTccGarMetVOgBOiD9m6+L4Ewy+HBubMcg8/n6ddYvjLUecOCQK/H98yoRiKwEJ7lhv8yZFHSA/95V70cfm1PKece6oDVwoDKHR6ake+sUwC82NLguUuQEN09LYIDqfboKJqg7BVTgTw254LqlijnbHQezT7LqLEB2PRCZDihOWLqzB7Nsu0a3ElaKfmi1rl41ndyDDuys0QntpfH/A1JaCjLNEEGbFROUKFu4D2xx5SolR4ewX0bKsZtzOKsjHsDkSKP3IibKqTowuK2TeI63nUlAlPi6OsWPHG28LqWZQAmBIcdcL+6NvMFGEdwbd5E7wQgaGaUq59IKBFQlwAKOl4/zYoqZGkzQX5lC0eyf4GVXJj3NBNYd 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)(346002)(396003)(39860400002)(136003)(376002)(36840700001)(46966006)(107886003)(5660300002)(55016002)(426003)(4326008)(2616005)(86362001)(83380400001)(336012)(82740400003)(82310400003)(34020700004)(6286002)(1076003)(47076005)(2906002)(478600001)(70586007)(6636002)(54906003)(36756003)(36860700001)(26005)(110136005)(7696005)(356005)(36906005)(316002)(966005)(8676002)(186003)(16526019)(70206006)(8936002)(6666004)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2021 17:18:57.5213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2600ef11-42c1-4a0a-e49d-08d94a1020a7 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: BN8NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2484 Subject: [dpdk-dev] [PATCH v2 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