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 6C2FBA0350; Mon, 28 Feb 2022 11:01:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3554F41168; Mon, 28 Feb 2022 11:01:55 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) by mails.dpdk.org (Postfix) with ESMTP id DDB7441157; Mon, 28 Feb 2022 11:01:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hgz6m/coweTpBvUpmxpuS4lXnNw+yxeJMD9PxOkEDppIzjWHE99scCd7K0nhyDTuB6M6f39gMg11Qlrwl/eyWnbAIaGBbF9HtwrsN4f0LgDQuIVhrGzIOy27hz9Xhube2YMuyqJPdvc4ezUMNc9spP0N3QsUPbOmNxQVHlY2LuR03QffSBi63jC8hG//YogxqCjeXQBP64e1Yha9yRKlm/q6mWPlAG6g+Bc/EBo9+H7qGkGI5Ep2MK+wyD/S25MvobL19h9O3Uug3Pe0Dk0uRDTxDvmeQSUet7cbzMzP3wGgoRZKn3lsJiisLZ/I8nX1tWgtybvXYHiFt5WPAho8kg== 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=Fmscqu555vYtrq8G4RvAjTSKTGAx/qXXpdeyyR+q6lE=; b=CfzOuGdZGWhTI3KroZzLhrHwl60J8GpX3AB5Dg66PUI6tSACTKckrzQMUctAR8fP2pkJCbrZHDVwmHTtvD1kSJot/csxWe0tHpVGi2tlgUH08lhfI8BSD9L6oYYKLrkApPjVzp9Ed/L01SCc2hJBTJtjdDk9gBdO5nGLhMM18P+hbeBQrSjDltVyqUToTFHxuLFsY5H+PpWwQqmnY2t5gjgaZZyEukEf1Jm2LRasAdxcy1L3qy9IEs7dAsTeBAqCZR+424XbpBwdUij2qiC/Xn1Bvve1rFqQgWmBDtoS1nacTNuTNx37Mxmr/kW5Hi+V5X6++6OY8hoQPhFYtm0EXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=Fmscqu555vYtrq8G4RvAjTSKTGAx/qXXpdeyyR+q6lE=; b=SDXipXnONg3rnSH44WMw2q8dyyETORV/mZYbKdiXn8a80TOsS5vWior0Mjgr3L16uovcoqNnf1sAR87Nuoj3v3nOgFJeslkLCAnxpJOSYFE3lzGaQ1tVIsP6Xy3wQg8uRYk9ynM8xwWkzYY4TgiD2GleWgwzaT2hKsaAhdw4SQQiQLqTegqHCw15E0OkHtUMjVKSNN3pf6eTBbG+fIyoqDMCM40+xgwz+JrbjTyEEMth3xd6/1Ro5aneKTQHCBFVEV/4CzxJSkPa8jeIHuupDk9Or2sTvlscheDiw9SVVdXj8PbwAMKC2Ebk3CQ6ZZNMDoft3gI30CvCEhQISjL7RA== Received: from BN9PR03CA0601.namprd03.prod.outlook.com (2603:10b6:408:106::6) by DM5PR1201MB0012.namprd12.prod.outlook.com (2603:10b6:3:e7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Mon, 28 Feb 2022 10:01:49 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::72) by BN9PR03CA0601.outlook.office365.com (2603:10b6:408:106::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21 via Frontend Transport; Mon, 28 Feb 2022 10:01:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 10:01:48 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 28 Feb 2022 10:01:41 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Mon, 28 Feb 2022 02:01:38 -0800 From: Gregory Etelson To: CC: , , , , Viacheslav Ovsiienko Subject: [PATCH] net/mlx5: fix flex item flow handle size Date: Mon, 28 Feb 2022 12:01:24 +0200 Message-ID: <20220228100124.7514-1-getelson@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4983747-36a0-4a2c-1716-08d9faa155dd X-MS-TrafficTypeDiagnostic: DM5PR1201MB0012:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /+O/mcHVFyrNS+LdXrKdQbjw2es3VuNy2XRp16LFr1PZks7B4g1w8UxAwDtQB1r+aEwRVWAsxYXbhddxRt2NX9rE+02TyzV7gL1OnKqXcIUDCeelm73PVe+851gBVRJUQIopI49IFd/4mEWIyt7ve3PrGejZPoZEp1ir1vFUv1vLP/rpoeLFeR5MCCDTnvQEwgeP4TuyVmmo+6TLVHLNiu++/GJ7vVTLNmkvI37Deef2/hKKOyVJtlGkim5l7B8diAtrXqLPcxoXin95egShpwdPKtQU1p1605E1eEatMH6QWDO0vlggx19eAtltI2IQkEFFbzGwv+gbCK7pWJGsMayNfSJiTG3fkOtcmTHbkKYE8s17tyy1aLGa9+5xr4tA8iOP1ozkI1ujIGdgRm3jhQi8YkX6l3QL6YDi45JVjlO9B6DXxTYQScaIm0pob5i0E7MIJbnFK7zLJjlWxGd341fZCnGbqRthayjKuqE7qdoV0/DjU1PlMt+cq40qhDFcn3GLZ4ebflM8jndgbrK8kXJJ9l/k/KL4NYU48+jluKU0XDYXLqvsSz+GvlB4m1VIg/gRRsvysWrBPdfqX8K9h3iRR1H0KyXTqZ4mhmSwBh+VT7toWJRRU1gE1lAXc5cei3LBFzvCEfCKQGvZU9j0fr2sJlHn0wRh+/hZfWU5jlVJZoOviQFEM3nktTsLASmnVlikMuPyKz057Ql+ixVmZg== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(336012)(426003)(7696005)(83380400001)(2906002)(40460700003)(316002)(6666004)(81166007)(86362001)(8936002)(356005)(508600001)(5660300002)(82310400004)(16526019)(6286002)(186003)(2616005)(26005)(107886003)(55016003)(6916009)(54906003)(1076003)(36860700001)(36756003)(47076005)(450100002)(8676002)(70586007)(70206006)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2022 10:01:48.5148 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4983747-36a0-4a2c-1716-08d9faa155dd X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0012 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 Reduce flex item flow handle size from 32 bits to 8 bits for each flow. The patch will save memory in setups with millions of flows. Cc: stable@dpdk.org Fixes: a23e9b6e3ee9 ("net/mlx5: handle flex item in flows") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index e510921a3f..484ce5791e 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -700,7 +700,6 @@ struct mlx5_flow_handle { uint32_t split_flow_id:27; /**< Sub flow unique match flow id. */ uint32_t is_meter_flow_id:1; /**< Indicate if flow_id is for meter. */ uint32_t fate_action:3; /**< Fate action type. */ - uint32_t flex_item; /**< referenced Flex Item bitmask. */ union { uint32_t rix_hrxq; /**< Hash Rx queue object index. */ uint32_t rix_jump; /**< Index to the jump action resource. */ @@ -716,6 +715,7 @@ struct mlx5_flow_handle { #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) struct mlx5_flow_handle_dv dvh; #endif + uint8_t flex_item; /**< referenced Flex Item bitmask. */ } __rte_packed; /* diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2191ce6e58..fc4bcef6fb 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -10276,7 +10276,7 @@ flow_dv_translate_item_flex(struct rte_eth_dev *dev, void *matcher, void *key, /* Don't count both inner and outer flex items in one rule. */ if (mlx5_flex_acquire_index(dev, spec->handle, true) != index) MLX5_ASSERT(false); - dev_flow->handle->flex_item |= RTE_BIT32(index); + dev_flow->handle->flex_item |= (uint8_t)RTE_BIT32(index); } mlx5_flex_flow_translate_item(dev, matcher, key, item, is_inner); } @@ -14627,7 +14627,7 @@ flow_dv_destroy(struct rte_eth_dev *dev, struct rte_flow *flow) int index = rte_bsf32(dev_handle->flex_item); mlx5_flex_release_index(dev, index); - dev_handle->flex_item &= ~RTE_BIT32(index); + dev_handle->flex_item &= ~(uint8_t)RTE_BIT32(index); } if (dev_handle->dvh.matcher) flow_dv_matcher_release(dev, dev_handle); -- 2.34.1