Skip to content

Commit 225d207

Browse files
Christoph Hellwiggregkh
authored andcommitted
RDMA: Lift ibdev_to_node from rds to common code
commit 8ecfca6 upstream. Lift the ibdev_to_node from rds to common code and document it. Link: https://lore.kernel.org/r/20201106181941.1878556-4-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Cc: Krishnamraju Eraparaju <krishna2@chelsio.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 77344e1 commit 225d207

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎include/rdma/ib_verbs.h‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4642,6 +4642,19 @@ static inline struct ib_device *rdma_device_to_ibdev(struct device *device)
46424642
return coredev->owner;
46434643
}
46444644

4645+
/**
4646+
* ibdev_to_node - return the NUMA node for a given ib_device
4647+
* @dev: device to get the NUMA node for.
4648+
*/
4649+
static inline int ibdev_to_node(struct ib_device *ibdev)
4650+
{
4651+
struct device *parent = ibdev->dev.parent;
4652+
4653+
if (!parent)
4654+
return NUMA_NO_NODE;
4655+
return dev_to_node(parent);
4656+
}
4657+
46454658
/**
46464659
* rdma_device_to_drv_device - Helper macro to reach back to driver's
46474660
* ib_device holder structure from device pointer.

‎net/rds/ib.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,6 @@ struct rds_ib_device {
264264
int *vector_load;
265265
};
266266

267-
static inline int ibdev_to_node(struct ib_device *ibdev)
268-
{
269-
struct device *parent;
270-
271-
parent = ibdev->dev.parent;
272-
return parent ? dev_to_node(parent) : NUMA_NO_NODE;
273-
}
274267
#define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev)
275268

276269
/* bits for i_ack_flags */

0 commit comments

Comments
 (0)