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 B357DA0517; Wed, 10 Jun 2020 11:34:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50EEE4CBD; Wed, 10 Jun 2020 11:33:16 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60047.outbound.protection.outlook.com [40.107.6.47]) by dpdk.org (Postfix) with ESMTP id EFD592E8F for ; Wed, 10 Jun 2020 11:33:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxsKE02Pg5AmVce2Df1NGZ1wwKcW3gRgD9Wg7t+L1Wsozr5GOijmotDifCSagFogsX0ZWHIJdDsVHYm8LJnSW9TU4w7j4iQmP5HGqXyyWhTlWV9TJdhHx7Q4EXJ+Mqwo2KBPMxgRrZZOqFhQoRn48HsfFMCbxEzEknXx5nhJpJTtdfcjDC+D3gVnquANF1fOdfhogI7ReX2vnNY86dcEtDgHIv3bJhFKGbUuL69zaveyuVEo5OVh2gtCUWm7J58alTY3XrNuDp8kg6HX3BG1Hu2QfcmW+U1kqCZM68dLi6/Hu0gL8YybsV1AN9mj3nPPLWIDAzbvrBTmnTjSfNPxWw== 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=RcXCmDEt0N1PnqFRkiDfpFXn+6Zf1MA+jvnunGd8Vss=; b=YRQppklIa2wsnKodtOf/n6yZaVilY2N+jwK+bqFP/eUlJeLSEVFo9h4FBIsL2wxCV1gkp2jYvUzHbqxo2FdpiRQ7slxwsXatUuHDgGBxUOekTeW7n92nWsQ81q/9URgZOlYkOUTx4JSuGxhhdZ26kj9cXRzVCmv5lVtLO8Dn7MvLuneXKXczc2adYBvePYXGIFWy65hUsCdvwacVGBHK0FmDPqksDAZ/hGuqPNBXbfnAeWWSLtDY0+CT4uyFF3EGjEJ7xpDJ3u8yefwVa76QPH3zbqIr4TfoqsiEkk0Q/mmLOR51N+UFCENvqpkka2mK1BqdHGUPTj+3KZ9A/AAYgA== 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=RcXCmDEt0N1PnqFRkiDfpFXn+6Zf1MA+jvnunGd8Vss=; b=rDn0Zjq2nzNm5X8liVhcGLIFjD9fFmhp/easuY75Vfr/sL8z7qIGslED9NiIgvMbROZSDfThJ2k/lDDMVg7aTdCs7VrCjORRGeFqabqvIYDMQ5ZvmrdwMly6isjTUPWXnvQ9f2Ve9YN1XqY+ZDsnnhC6DUv2zkKv85hf6gphJjI= 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 AM0PR05MB4545.eurprd05.prod.outlook.com (2603:10a6:208:b9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20; Wed, 10 Jun 2020 09:33: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.023; Wed, 10 Jun 2020 09:33:12 +0000 From: Ophir Munk To: dev@dpdk.org, Matan Azrad , Raslan Darawsheh Cc: Ophir Munk Date: Wed, 10 Jun 2020 09:32:32 +0000 Message-Id: <20200610093233.23902-8-ophirmu@mellanox.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20200610093233.23902-1-ophirmu@mellanox.com> References: <20200610093233.23902-1-ophirmu@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: MRXP264CA0003.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::15) 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 MRXP264CA0003.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Wed, 10 Jun 2020 09:33:11 +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: 75373ac2-7a51-49bc-61c5-08d80d214b17 X-MS-TrafficTypeDiagnostic: AM0PR05MB4545: 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:1360; X-Forefront-PRVS: 0430FA5CB7 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3+VACwMbjnbndFlXkEkyRqCBmp+WY/tcbRiqjmzlwgMNcWp2lre2ijVzfOb2IridyDSMsHEeTajHicMkbXgyvFxToGuFN6F+13kAaVCekNA09ahNBQZskl3/vaMwUw/XeL3G3tearxzqjJ8S8kMkH3jCERpQQY30mcm5tluphthyXJgarvnBO88V/eon8/SO1hmW/EySCDLnzOm8Kmw0+2dwtNQc2gsNT9uHJtcrjejhm3v71B6cOQbt7nt53e4whXmQPlDkhPSFwJ4QE3znQGxU1dvHc1BtuODvNqDZsl+zzyjLRt6ofKBjO0NYCjAtjElGi1LfJCUECdUeFKhzJw== 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)(346002)(376002)(39860400002)(396003)(366004)(136003)(6666004)(478600001)(26005)(186003)(8676002)(5660300002)(8886007)(66476007)(66556008)(36756003)(66946007)(2906002)(956004)(2616005)(55016002)(52116002)(7696005)(8936002)(6636002)(110136005)(1076003)(16526019)(83380400001)(316002)(86362001)(107886003)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 19IDoj1pSqQBVzYZzMUEfQ1ZmSJBQaPSEy24IM7WUYGbF3sPoa0WWl97E2zvqrJysolarcVxMKQh1FW3FiqB/Tsrwfe1ndfOA98F9xMtNjq13hpKI6YZSK5rQdGA6fdIMDACElCJ/kWiJ13GgmzJDHuHfmXmvoF3A6t8MZzAtWQNRN94utrU2LpRjMc5sU/vYVn/3Bb/O8dPebpjHUBkzZfjoy7X59MV47C5lmGRLC2pySxeVaayQA70iJPGt0ctox7CN5Jg5YYaRt+LqXOUjUMWOaZxnP70C2dJFop6sK8I/8TvbJJdWnZDGhf3ONYnjfePj7PoDHcHtiLwZB70tM237Vv5JETqB8We4vzKVo3f3XWshZU+HlXPFPlYde2ZNEXR7Jdz+qvYDa6lpeNS87qpu1nwSIg71+qTVRa6HtOFKsChiF8Zm12DIQOtO/GcL8CtkgLZwh/mDZwoD5MA/SrSc/tTAW7YsOzLQD9egwYjaAGkQ8tX6UaYDfcre6V1 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75373ac2-7a51-49bc-61c5-08d80d214b17 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2020 09:33:12.0319 (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: xD1Ht+hcHuvUuqABggXYa0ahVHBLFsSwGGhE+OTZ/ccy4C5sMPwGj37l9nJlxcawsshI5t3Gxt/3oayqM3afbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4545 Subject: [dpdk-dev] [PATCH v1 7/8] common/mlx5: exclude OS dependency in devx commands 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" Shared function mlx5_devx_cmd_mkey_create() reads the OS pagesize by calling a Linux API: 'sysconf(_SC_PAGESIZE)'. Wrap this call with a shared API 'mlx5_os_get_page_size()' which contains the specific OS implementation. Signed-off-by: Ophir Munk --- drivers/common/mlx5/linux/mlx5_common_os.c | 12 ++++++++++++ drivers/common/mlx5/mlx5_common.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index 4e04d70..1b71347 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -125,6 +125,18 @@ mlx5_translate_port_name(const char *port_name_in, port_info_out->name_type = MLX5_PHYS_PORT_NAME_TYPE_UNKNOWN; } +/** + * Get OS page size + * + * @return + * OS pagesize + */ +size_t +mlx5_os_get_page_size(void) +{ + return sysconf(_SC_PAGESIZE); +} + #ifdef MLX5_GLUE /** diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 8e679c6..77f10e6 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -213,6 +213,7 @@ __rte_internal void mlx5_translate_port_name(const char *port_name_in, struct mlx5_switch_info *port_info_out); void mlx5_glue_constructor(void); +size_t mlx5_os_get_page_size(void); extern uint8_t haswell_broadwell_cpu; diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 091a825..ccba1c1 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -158,7 +158,7 @@ mlx5_devx_cmd_mkey_create(void *ctx, return NULL; } memset(in, 0, in_size_dw * 4); - pgsize = sysconf(_SC_PAGESIZE); + pgsize = mlx5_os_get_page_size(); MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY); mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry); if (klm_num > 0) { -- 2.8.4