Commit b036db83 authored by Dennis Dalessandro's avatar Dennis Dalessandro Committed by Doug Ledford

IB/rdmavt: Add driver notification for new AH

Drivers may need to do some work once an address handle has been
created. Add a driver function for this purpose.
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarHarish Chegondi <harish.chegondi@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent f3d01bbc
...@@ -83,8 +83,8 @@ int rvt_check_ah(struct ib_device *ibdev, ...@@ -83,8 +83,8 @@ int rvt_check_ah(struct ib_device *ibdev,
!(ah_attr->ah_flags & IB_AH_GRH)) !(ah_attr->ah_flags & IB_AH_GRH))
return -EINVAL; return -EINVAL;
} }
if (rdi->driver_f.check_ah(ibdev, ah_attr)) if (rdi->driver_f.check_ah)
return -EINVAL; return rdi->driver_f.check_ah(ibdev, ah_attr);
return 0; return 0;
} }
EXPORT_SYMBOL(rvt_check_ah); EXPORT_SYMBOL(rvt_check_ah);
...@@ -123,6 +123,9 @@ struct ib_ah *rvt_create_ah(struct ib_pd *pd, ...@@ -123,6 +123,9 @@ struct ib_ah *rvt_create_ah(struct ib_pd *pd,
ah->attr = *ah_attr; ah->attr = *ah_attr;
atomic_set(&ah->refcount, 0); atomic_set(&ah->refcount, 0);
if (dev->driver_f.notify_new_ah)
dev->driver_f.notify_new_ah(pd->device, ah_attr, ah);
return &ah->ibah; return &ah->ibah;
} }
......
...@@ -467,9 +467,21 @@ struct rvt_driver_params { ...@@ -467,9 +467,21 @@ struct rvt_driver_params {
int nports; int nports;
}; };
/* /* Protection domain */
* Functions that drivers are required to support struct rvt_pd {
*/ struct ib_pd ibpd;
int user; /* non-zero if created from user space */
};
/* Address handle */
struct rvt_ah {
struct ib_ah ibah;
struct ib_ah_attr attr;
atomic_t refcount;
u8 vl;
u8 log_pmtu;
};
struct rvt_dev_info; struct rvt_dev_info;
struct rvt_driver_provided { struct rvt_driver_provided {
/* /*
...@@ -478,23 +490,20 @@ struct rvt_driver_provided { ...@@ -478,23 +490,20 @@ struct rvt_driver_provided {
* instead drivers are responsible for setting the correct callback for * instead drivers are responsible for setting the correct callback for
* this. * this.
*/ */
/* -------------------*/
/* Required functions */
/* -------------------*/
int (*port_callback)(struct ib_device *, u8, struct kobject *); int (*port_callback)(struct ib_device *, u8, struct kobject *);
const char * (*get_card_name)(struct rvt_dev_info *rdi); const char * (*get_card_name)(struct rvt_dev_info *rdi);
struct pci_dev * (*get_pci_dev)(struct rvt_dev_info *rdi); struct pci_dev * (*get_pci_dev)(struct rvt_dev_info *rdi);
int (*check_ah)(struct ib_device *, struct ib_ah_attr *);
};
/* Protection domain */ /*--------------------*/
struct rvt_pd { /* Optional functions */
struct ib_pd ibpd; /*--------------------*/
int user; /* non-zero if created from user space */ int (*check_ah)(struct ib_device *, struct ib_ah_attr *);
}; void (*notify_new_ah)(struct ib_device *, struct ib_ah_attr *,
struct rvt_ah *);
/* Address handle */
struct rvt_ah {
struct ib_ah ibah;
struct ib_ah_attr attr;
atomic_t refcount;
}; };
struct rvt_dev_info { struct rvt_dev_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment