From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CBFA6A04A4; Wed, 3 Jun 2020 17:07:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3AA961D5B3; Wed, 3 Jun 2020 17:06:18 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2075.outbound.protection.outlook.com [40.107.20.75]) by dpdk.org (Postfix) with ESMTP id 86BB81D57F for ; Wed, 3 Jun 2020 17:06:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q54aQOj4EV9IbILjS8G5ej/GCpNzmjs6nryC6Zs8da5ICjwqPNRJWMvq7VxVsHVH28Z/Gr5ARo+Lr0iSBPrFn9RPaXEPWORyBfFU6RJ65LIUx6xK/Go+gVPQNEOfGVeVBHS2PUK9fg/YdkKx8+msBHE1jPRKREovhVAQ2TifJY5Tg58HXRQFsHWE/BA/9ddZ/KqImCGhZCDIX6Xk4jpP3itwRHSnkoQ0MXCscoM1OXYI9pmwbevLF9EU8YNKizoo/03rOwlTxW1V/7AfsR4g3nGb0AAu8Nc1/PAAzPVv2rMnhlKbZ3c8LKhx96Vj4LRtoIlWvovKpJWP3pzMvmhw7g== 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=dPRCSI7YitN82Hhu76su0B51eSXuhmGck777KaN3PHs=; b=GN86mIBJVE1J4lOl+UTgAataKT2Esb4YAvVQx6o5N5bqT+dzdvfKeM7ijK1vFpw4GxshxDxcfuz6oChB9kQZGG5+GMK0JXwSNBh2iTSrIyLsmnn7z0ReM1VyM2+SJDwgYink90Ug6VCrexRkKhCv2hudZiMU2rVV6ZZ8mL6wnrmZzYPjYBjetOoTFzVWamvvxWVgMPzMauRfVEa80Xw5SNk02tlyv6gCsjNdx5b08EL4LWFWXXKaXuZLL4GQfHdVufPU8LDh2xF/l9+A6xiyIHjoMmygqxdgRpAeRtYQ3qQXfWbJ2IbkhCrxJ5fZkn22kABOBvlITdcOwuG+edQVCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dPRCSI7YitN82Hhu76su0B51eSXuhmGck777KaN3PHs=; b=smjVf00NY+tASpaJzz5NbfWOTnGDJHsHPz7V3UMgfTXDT6J/f/kBrw7w7HbFq2vx7JdgAavOBdjskfyxqs/GCUhoqCD9a6g+9MHID+eIF6LPan8C1sR541sdJdhhpiGzsglSXBxTvi6BrwmCjBMoj5304Y0HCUYbi9UpkctKVLQ= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB4209.eurprd05.prod.outlook.com (2603:10a6:208:61::22) by AM0PR05MB5235.eurprd05.prod.outlook.com (2603:10a6:208:f5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Wed, 3 Jun 2020 15:06:12 +0000 Received: from AM0PR05MB4209.eurprd05.prod.outlook.com ([fe80::1068:89a9:41d3:b14a]) by AM0PR05MB4209.eurprd05.prod.outlook.com ([fe80::1068:89a9:41d3:b14a%3]) with mapi id 15.20.3066.018; Wed, 3 Jun 2020 15:06:12 +0000 From: Ophir Munk To: dev@dpdk.org, Matan Azrad , Raslan Darawsheh Cc: Ophir Munk Date: Wed, 3 Jun 2020 15:05:59 +0000 Message-Id: <20200603150602.4686-6-ophirmu@mellanox.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20200603150602.4686-1-ophirmu@mellanox.com> References: <20200603150602.4686-1-ophirmu@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: AM4PR0302CA0033.eurprd03.prod.outlook.com (2603:10a6:205:2::46) To AM0PR05MB4209.eurprd05.prod.outlook.com (2603:10a6:208:61::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by AM4PR0302CA0033.eurprd03.prod.outlook.com (2603:10a6:205:2::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.19 via Frontend Transport; Wed, 3 Jun 2020 15:06:12 +0000 X-Mailer: git-send-email 2.8.4 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 974a18ce-7d3f-4d5c-c9d6-08d807cfa7aa X-MS-TrafficTypeDiagnostic: AM0PR05MB5235: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-Forefront-PRVS: 04238CD941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SFwmzJVTwH5hZweJGXgpaAg+xwjcx8Oqmjo8MX9Ai5+yDInrvQLtCVHUhCP/9SFJ7x9N4cYRk+iYUoDjO06oeYjjsskxbOOvE2iXzSBYhdHC2LD43gkNka29+FBMhUYw517H47OV2IdX+fRlgDt+10dCyJTg5jkmS1RBpEVW90PJ7ZzeaaOs/IUwHpj1luwBWSYGdsDQPSdshOphycbf7lRc7gZtYqmYmVMDoJP3XO65t+nGlYkX8LCXxSDr1FeGBHMAJqSpcxFy1+xrLzOzSP7G7KduOMNBkvhpj5a2QR6+6+rtmI2BLtit6ucCn62SaP1PGLSVLPTz5nlfX21Onw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB4209.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(26005)(4326008)(186003)(478600001)(316002)(8676002)(16526019)(8886007)(6666004)(2906002)(66476007)(8936002)(66946007)(956004)(66556008)(2616005)(55016002)(107886003)(86362001)(83380400001)(36756003)(6636002)(7696005)(5660300002)(1076003)(52116002)(110136005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8Vis45RpWxTkQtiRgqfi2wvtkRabhUEDdprFCjGzJ4c4FUfyA61IexQF8h6iN7Zz4NcGYdSgVKURJI8a+U/Z8HbNowAiGJvph0/sh9e9IcZVNESM9aFxKlXWt2Ot9YnqzRPZuJHgbnRNcokCv1U+6JemZgx8VzUosvBZbU+SMcuA/Sr3c+x5cck6ta/Bsb5eHCQqVM4rDs3qCO5j+EP+D0GdOYrvFLAfg5IeqDDuuC729K9B9VhLD8sHQ/bbUjPujWAefWNNsGYwxTkYydpGQbTXtcmyr5Ajba6p5ow5rawtV+OBnAsl4Y9+rY7ntJHWb5Hf0mlUy2NAEErGMyb6O6StorZe1FkGDZlGAtV/+VR1Pofat/ulCEBPvjEV2v1M3dEZ+kT9Z3Vj74AjLonORjmgUXFQjQZyRYTRdJZlPrvwpCkS7Ci1TOosoFBpF/QE8k/3yat9NafF7IBngLsehdkPG8zrpMwUNoaect44bS20+oW9iWct+ewAB9MjqUQ3 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 974a18ce-7d3f-4d5c-c9d6-08d807cfa7aa X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2020 15:06:12.7846 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q+DTMyosVubOPZt/1VtyIkFSDVv2nvervaKyZ13b9qt9HlTwsVFwUDV5H9Qs0J8HlDsnoaP+ig6gyKWfCCIqrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5235 Subject: [dpdk-dev] [PATCH v1 5/8] net/mlx5: remove umem field dependency on dv X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" umem field is used in several structs. Its type 'struct mlx5dv_devx_umem *' is changed to 'void *'. This change will allow non-Linux OS compilations. Signed-off-by: Ophir Munk Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 18 ++++++++++++++++++ drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 5 +++-- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- drivers/net/mlx5/mlx5_rxq.c | 2 +- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 85dcf49..7d60683 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -87,6 +87,24 @@ mlx5_os_get_ctx_device_path(void *ctx) } /** + * Get umem id. Given a pointer to umem object of type + * 'struct mlx5dv_devx_umem *' - return its id. + * + * @param[in] umem + * Pointer to umem object. + * + * @return + * The umem id if umem is valid, 0 otherwise. + */ +uint32_t +mlx5_os_get_umem_id(void *umem) +{ + if (!umem) + return 0; + return ((struct mlx5dv_devx_umem *)umem)->umem_id; +} + +/** * Get mlx5 device attributes. The glue function query_device_ex() is called * with out parameter of type 'struct ibv_device_attr_ex *'. Then fill in mlx5 * device attributes from the glue out parameter. diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 0fa8742..4f7b4d3 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2298,7 +2298,7 @@ mlx5_release_dbr(struct rte_eth_dev *dev, uint32_t umem_id, uint64_t offset) LIST_FOREACH(page, &priv->dbrpgs, next) /* Find the page this address belongs to. */ - if (page->umem->umem_id == umem_id) + if (mlx5_os_get_umem_id(page->umem) == umem_id) break; if (!page) return -EINVAL; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 478ebef..ec4ba87 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -384,7 +384,7 @@ struct mlx5_counter_stats_mem_mng { LIST_ENTRY(mlx5_counter_stats_mem_mng) next; struct mlx5_counter_stats_raw *raws; struct mlx5_devx_obj *dm; - struct mlx5dv_devx_umem *umem; + void *umem; }; /* Raw memory structure for the counter statistics values of a pool. */ @@ -490,7 +490,7 @@ struct mlx5_devx_dbr_page { /* Door-bell records, must be first member in structure. */ uint8_t dbrs[MLX5_DBR_PAGE_SIZE]; LIST_ENTRY(mlx5_devx_dbr_page) next; /* Pointer to the next element. */ - struct mlx5dv_devx_umem *umem; + void *umem; uint32_t dbr_count; /* Number of door-bell records in use. */ /* 1 bit marks matching door-bell is in use. */ uint64_t dbr_bitmap[MLX5_DBR_BITMAP_SIZE]; @@ -878,6 +878,7 @@ void mlx5_flow_meter_detach(struct mlx5_flow_meter *fm); /* mlx5_os.c */ const char *mlx5_os_get_ctx_device_name(void *ctx); const char *mlx5_os_get_ctx_device_path(void *ctx); +uint32_t mlx5_os_get_umem_id(void *umem); int mlx5_os_get_dev_attr(void *ctx, struct mlx5_dev_attr *dev_attr); #endif /* RTE_PMD_MLX5_H_ */ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4dec57d..81f5bd4 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4130,7 +4130,7 @@ flow_dv_create_counter_stat_mem_mng(struct rte_eth_dev *dev, int raws_n) } mkey_attr.addr = (uintptr_t)mem; mkey_attr.size = size; - mkey_attr.umem_id = mem_mng->umem->umem_id; + mkey_attr.umem_id = mlx5_os_get_umem_id(mem_mng->umem); mkey_attr.pd = sh->pdn; mkey_attr.log_entity_size = 0; mkey_attr.pg_access = 0; diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index f018553..78046fd 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1417,7 +1417,7 @@ mlx5_rxq_obj_new(struct rte_eth_dev *dev, uint16_t idx, if (dbr_offset < 0) goto error; rxq_ctrl->dbr_offset = dbr_offset; - rxq_ctrl->dbr_umem_id = dbr_page->umem->umem_id; + rxq_ctrl->dbr_umem_id = mlx5_os_get_umem_id(dbr_page->umem); rxq_ctrl->dbr_umem_id_valid = 1; rxq_data->rq_db = (uint32_t *)((uintptr_t)dbr_page->dbrs + (uintptr_t)rxq_ctrl->dbr_offset); -- 2.8.4