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 6183EA0C51; Tue, 13 Jul 2021 15:16:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE2E841263; Tue, 13 Jul 2021 15:16:05 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2046.outbound.protection.outlook.com [40.107.220.46]) by mails.dpdk.org (Postfix) with ESMTP id EAA60406FF for ; Tue, 13 Jul 2021 15:16:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jXBUwgc6yQqtLXTUv00ovXysH8ZA+yO8FTriRt0zNnvq3Ijk9WRMTVjPHnKsSiVR8EVaahXU6zYS6ehPqEDu0GD4LDUUhbHtvJ2Vuin3tJDkp0M+lpvJ4SkPCSvuANby1IUK7bPWOMhJGoP0MDSHnWXTei2PxzDk8Pm2iW2NsDtmgYCb1myGidDDcmBPLCQ6A47JDvPwTT15BPltILMiR/kjYWcj6uCTILoDiGVrKbq15846qP2KRe7ejvbSAxFTr4VHFiutg+0drpwLOPBrd3ZFbzO8pTJWc6drZGjpkB0oTmCVZB4/sN/uvjlpYsyrOM33LomZwIG32L575nx4OA== 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=FCh9S5zFEPt/bVutG4mMx8MTYc17NL0UOAGMgwM9pwo=; b=HYEj6fDLqVNAqUu6BOBHctcUg9vuVrH1Hxav+d2v2yQYjUyXtgsIruUUutAft3qRZl7xVcj1sUGfMm1bo6RMCN+YyDAj0uElonPE9wzRKqPb6Vzh6vNca+mWh5zO1qP6hhHNkL+k2vx8Ir8PNGzbiXYfjzelhhLQ1pgO/yOzhDkOEWRPVA3LBZh+wP9RzALbRrl3y9egcGz1zdApfTCG6kWCrIC4FmjpzVMiltF0aRPzWhj5G7dEibEYYebE/oe+dVolUhNppytEk4AVhnTXMguvVxBBZzm6TobMqZnq9dm2rO5fIiBoGQxbKu8H57Z3IBzMeijAnEM0qdk0bGE0Kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none 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=FCh9S5zFEPt/bVutG4mMx8MTYc17NL0UOAGMgwM9pwo=; b=onIqHMv/sMahRlrw3xOalbV5JzL3/0fixH+4BIz5+agG60pt6tA/AIS5/V3xJbmZWKvLXnEDdgHcxwhI5XQv+TUOsBNZ6mw3wueVYewnv40IyS++veYBF/lKMgvIU1PhRsV09FuT/MTVidoXHBxlfpT3du9k1IwR4quwA8IUohn5lLzQr/d1yE2kIoNMwvf+gRF0se1oWnSiDni9i4tZtBQ3lmMnL9tnh3sCHBCg9rellRLj6+U3RXWwhz+RZ4+twFzGm7Xl/QMRb4/as8kC7CZkU9oyKc7ADV0bUvPAzcYZYX5DEubYZAfppX9G594cxUExVhgtAV392Fyzbxex7Q== Received: from MWHPR21CA0028.namprd21.prod.outlook.com (2603:10b6:300:129::14) by MN2PR12MB2896.namprd12.prod.outlook.com (2603:10b6:208:ab::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.23; Tue, 13 Jul 2021 13:15:57 +0000 Received: from CO1NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:300:129:cafe::fc) by MWHPR21CA0028.outlook.office365.com (2603:10b6:300:129::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.2 via Frontend Transport; Tue, 13 Jul 2021 13:15:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 CO1NAM11FT011.mail.protection.outlook.com (10.13.175.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4308.20 via Frontend Transport; Tue, 13 Jul 2021 13:15:56 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 13:15:38 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: Thomas Monjalon , , , Matan Azrad , Shahaf Shuler Date: Tue, 13 Jul 2021 21:14:25 +0800 Message-ID: <20210713131437.30170-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616040935.311733-2-xuemingl@nvidia.com> References: <20210616040935.311733-2-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] 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: 969e369f-741b-4cfd-3285-08d9460059fa X-MS-TrafficTypeDiagnostic: MN2PR12MB2896: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t8uLHvGEMVbiNP0TXM4pF0+ZyJ4mukUd4Nwh671T/OZIPBaP8Ot1jrAk++pYHE4/5NEKsAFzrdWW5CHuLTyNw1xkUr79GshsfD9RDFhEK3kKp6mVC7irVTsK7qAwo+TgGsRFv8jc/lmRy9NoyGFvDEpyXb/h9drNwdyKHQV1/XulepZW44qPpgQUlVGWMNKRWbHapkJk3GWxQJkhbmhYtN9hh/jtReO4pX0dIa5ixhwrdail1+DyX/XWzZB+TlH8kqY9rMVW7GCBV7i/sbpkNu1/nB/iJIq5OKkcBRXsewpzWD3oQ3DZorcncqDIHJtuyACO5PuS9/urRQ8k/R3vF2oomUihUfAG/w8uaE18jBOGz/117ReI4cZ7pLan6E/E0thJvKvxg+zlaK11Xyw1KFdiu4HAjt0CozBiV+orSdlvIXkNuoGqij6f0gxXpH7xemN8eePZa4+LFKGly3TwLwp6vCuYrAukklKLYG15EFlICpMyNVytI3bYUeHpuruzyxlE66pzoW8CAN754L/0YOhIgnSLbxxLWrQi41iCLQ/21miTymbmB/eozpOUDbVDddiF1YwYuzjOv2xZ0fwsCMGEYetxnVa48QC9fkYRcfwwdEm5Dmr53qFE9nVzh5J1OnFJ0s2zpFVDYKkL+lhmGfhA30GJbUgRvk1zH0LeR1UMZA8N0+mdFOxV0bKbKr234LI4Lfug3MhmXNt17JGTZzBrH654NevhlYtSQQ2PxaY= 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)(136003)(376002)(39860400002)(396003)(346002)(46966006)(36840700001)(86362001)(5660300002)(186003)(70586007)(70206006)(36860700001)(34020700004)(7696005)(54906003)(47076005)(36756003)(26005)(16526019)(82310400003)(83380400001)(356005)(7636003)(36906005)(37006003)(6286002)(55016002)(478600001)(6666004)(6862004)(8676002)(107886003)(4326008)(426003)(336012)(8936002)(316002)(1076003)(2906002)(6636002)(82740400003)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 13:15:56.9051 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 969e369f-741b-4cfd-3285-08d9460059fa 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: CO1NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2896 Subject: [dpdk-dev] [PATCH v2 02/14] common/mlx5: move description of PCI sysfs functions 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" From: Thomas Monjalon The Linux-specific functions mlx5_get_pci_addr() and mlx5_get_ifname_sysfs() are better described in the .h file. The requirement for using mlx5_get_pci_addr() is explicit: the node /device must exist in the provided sysfs path. Signed-off-by: Thomas Monjalon --- drivers/common/mlx5/linux/mlx5_common_os.c | 22 ------------------ drivers/common/mlx5/mlx5_common.h | 26 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index 78a9723075..337e9df8cb 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -23,17 +23,6 @@ const struct mlx5_glue *mlx5_glue; #endif -/** - * Get PCI information by sysfs device path. - * - * @param dev_path - * Pointer to device sysfs folder name. - * @param[out] pci_addr - * PCI bus address output buffer. - * - * @return - * 0 on success, a negative errno value otherwise and rte_errno is set. - */ int mlx5_dev_to_pci_addr(const char *dev_path, struct rte_pci_addr *pci_addr) @@ -159,17 +148,6 @@ mlx5_translate_port_name(const char *port_name_in, port_info_out->name_type = MLX5_PHYS_PORT_NAME_TYPE_UNKNOWN; } -/** - * Get kernel interface name from IB device path. - * - * @param[in] ibdev_path - * Pointer to IB device path. - * @param[out] ifname - * Interface name output buffer. - * - * @return - * 0 on success, a negative errno value otherwise and rte_errno is set. - */ int mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname) { diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index a2a69ebf5e..b83fdc204d 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -204,8 +204,34 @@ check_cqe(volatile struct mlx5_cqe *cqe, const uint16_t cqes_n, return MLX5_CQE_STATUS_SW_OWN; } +/* + * Get PCI address from sysfs of a PCI-related device. + * + * @param[in] dev_path + * The sysfs path should not point to the direct plain PCI device. + * Instead, the node "/device/" is used to access the real device. + * @param[out] pci_addr + * Parsed PCI address. + * + * @return + * - 0 on success. + * - Negative value and rte_errno is set otherwise. + */ __rte_internal int mlx5_dev_to_pci_addr(const char *dev_path, struct rte_pci_addr *pci_addr); + +/* + * Get kernel network interface name from sysfs IB device path. + * + * @param[in] ibdev_path + * The sysfs path to IB device. + * @param[out] ifname + * Interface name output of size IF_NAMESIZE. + * + * @return + * - 0 on success. + * - Negative value and rte_errno is set otherwise. + */ __rte_internal int mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname); -- 2.25.1