IB/{rdmavt, hfi1, qib}: Self determine driver name

Currently the HFI and QIB drivers allow the IB core to assign a unit
number to the driver name string.

If multiple devices exist in a system, there is a possibility that the
device unit number and the IB core number will be mismatched.

Fix by using the driver defined unit number to generate the device
name.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Michael J. Ruhl
2017-12-18 19:56:37 -08:00
committed by Doug Ledford
parent 437ff786e2
commit 5084c8ff21
5 changed files with 17 additions and 4 deletions

View File

@@ -419,6 +419,19 @@ struct rvt_dev_info {
};
/**
* rvt_set_ibdev_name - Craft an IB device name from client info
* @rdi: pointer to the client rvt_dev_info structure
* @name: client specific name
* @unit: client specific unit number.
*/
static inline void rvt_set_ibdev_name(struct rvt_dev_info *rdi,
const char *fmt, const char *name,
const int unit)
{
snprintf(rdi->ibdev.name, sizeof(rdi->ibdev.name), fmt, name, unit);
}
static inline struct rvt_pd *ibpd_to_rvtpd(struct ib_pd *ibpd)
{
return container_of(ibpd, struct rvt_pd, ibpd);