Skip to content

Commit

Permalink
RDMA: Lift ibdev_to_node from rds to common code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and jgunthorpe committed Nov 12, 2020
1 parent 2af2946 commit 8ecfca6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 13 additions & 0 deletions include/rdma/ib_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -4549,6 +4549,19 @@ static inline struct ib_device *rdma_device_to_ibdev(struct device *device)
return coredev->owner;
}

/**
* ibdev_to_node - return the NUMA node for a given ib_device
* @dev: device to get the NUMA node for.
*/
static inline int ibdev_to_node(struct ib_device *ibdev)
{
struct device *parent = ibdev->dev.parent;

if (!parent)
return NUMA_NO_NODE;
return dev_to_node(parent);
}

/**
* rdma_device_to_drv_device - Helper macro to reach back to driver's
* ib_device holder structure from device pointer.
Expand Down
7 changes: 0 additions & 7 deletions net/rds/ib.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,6 @@ struct rds_ib_device {
int *vector_load;
};

static inline int ibdev_to_node(struct ib_device *ibdev)
{
struct device *parent;

parent = ibdev->dev.parent;
return parent ? dev_to_node(parent) : NUMA_NO_NODE;
}
#define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev)

/* bits for i_ack_flags */
Expand Down

0 comments on commit 8ecfca6

Please sign in to comment.