Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aec57787 authored by Dennis Dalessandro's avatar Dennis Dalessandro Committed by Doug Ledford
Browse files

IB/rdmavt: Move driver helper functions to a common structure



Drivers are going to need to provide multiple functions for rdmavt to
call in to. We already have one, so go ahead and push this into a
data structure designated for driver supplied functions.

Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent ca889e8a
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -280,8 +280,12 @@ int rvt_register_device(struct rvt_dev_info *rdi)
	spin_lock_init(&rdi->n_pds_lock);
	spin_lock_init(&rdi->n_pds_lock);
	rdi->n_pds_allocated = 0;
	rdi->n_pds_allocated = 0;


	/* Validate that drivers have provided the right functions */
	if (!rdi->driver_f.port_callback)
		return -EINVAL;

	/* We are now good to announce we exist */
	/* We are now good to announce we exist */
	return ib_register_device(&rdi->ibdev, rdi->port_callback);
	return ib_register_device(&rdi->ibdev, rdi->driver_f.port_callback);
}
}
EXPORT_SYMBOL(rvt_register_device);
EXPORT_SYMBOL(rvt_register_device);


+15 −7
Original line number Original line Diff line number Diff line
@@ -383,6 +383,19 @@ struct rvt_driver_params {
	 */
	 */
};
};


/*
 * Functions that drivers are required to support
 */
struct rvt_driver_provided {
	/*
	 * The work to create port files in /sys/class Infiniband is different
	 * depending on the driver. This should not be extracted away and
	 * instead drivers are responsible for setting the correct callback for
	 * this.
	 */
	int (*port_callback)(struct ib_device *, u8, struct kobject *);
};

/* Protection domain */
/* Protection domain */
struct rvt_pd {
struct rvt_pd {
	struct ib_pd ibpd;
	struct ib_pd ibpd;
@@ -407,13 +420,8 @@ struct rvt_dev_info {


	/* PKey Table goes here */
	/* PKey Table goes here */


	/*
	/* Driver specific helper functions */
	 * The work to create port files in /sys/class Infiniband is different
	struct rvt_driver_provided driver_f;
	 * depending on the driver. This should not be extracted away and
	 * instead drivers are responsible for setting the correct callback for
	 * this.
	 */
	int (*port_callback)(struct ib_device *, u8, struct kobject *);


	/* Internal use */
	/* Internal use */
	int n_pds_allocated;
	int n_pds_allocated;