Skip to content

Commit b036db8

Browse files
Dennis Dalessandrodledford
authored andcommitted
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: Ira Weiny <[email protected]> Reviewed-by: Mike Marciniszyn <[email protected]> Reviewed-by: Harish Chegondi <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent f3d01bb commit b036db8

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

drivers/infiniband/sw/rdmavt/ah.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ int rvt_check_ah(struct ib_device *ibdev,
8383
!(ah_attr->ah_flags & IB_AH_GRH))
8484
return -EINVAL;
8585
}
86-
if (rdi->driver_f.check_ah(ibdev, ah_attr))
87-
return -EINVAL;
86+
if (rdi->driver_f.check_ah)
87+
return rdi->driver_f.check_ah(ibdev, ah_attr);
8888
return 0;
8989
}
9090
EXPORT_SYMBOL(rvt_check_ah);
@@ -123,6 +123,9 @@ struct ib_ah *rvt_create_ah(struct ib_pd *pd,
123123
ah->attr = *ah_attr;
124124
atomic_set(&ah->refcount, 0);
125125

126+
if (dev->driver_f.notify_new_ah)
127+
dev->driver_f.notify_new_ah(pd->device, ah_attr, ah);
128+
126129
return &ah->ibah;
127130
}
128131

include/rdma/rdma_vt.h

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,21 @@ struct rvt_driver_params {
467467
int nports;
468468
};
469469

470-
/*
471-
* Functions that drivers are required to support
472-
*/
470+
/* Protection domain */
471+
struct rvt_pd {
472+
struct ib_pd ibpd;
473+
int user; /* non-zero if created from user space */
474+
};
475+
476+
/* Address handle */
477+
struct rvt_ah {
478+
struct ib_ah ibah;
479+
struct ib_ah_attr attr;
480+
atomic_t refcount;
481+
u8 vl;
482+
u8 log_pmtu;
483+
};
484+
473485
struct rvt_dev_info;
474486
struct rvt_driver_provided {
475487
/*
@@ -478,23 +490,20 @@ struct rvt_driver_provided {
478490
* instead drivers are responsible for setting the correct callback for
479491
* this.
480492
*/
493+
494+
/* -------------------*/
495+
/* Required functions */
496+
/* -------------------*/
481497
int (*port_callback)(struct ib_device *, u8, struct kobject *);
482498
const char * (*get_card_name)(struct rvt_dev_info *rdi);
483499
struct pci_dev * (*get_pci_dev)(struct rvt_dev_info *rdi);
484-
int (*check_ah)(struct ib_device *, struct ib_ah_attr *);
485-
};
486500

487-
/* Protection domain */
488-
struct rvt_pd {
489-
struct ib_pd ibpd;
490-
int user; /* non-zero if created from user space */
491-
};
492-
493-
/* Address handle */
494-
struct rvt_ah {
495-
struct ib_ah ibah;
496-
struct ib_ah_attr attr;
497-
atomic_t refcount;
501+
/*--------------------*/
502+
/* Optional functions */
503+
/*--------------------*/
504+
int (*check_ah)(struct ib_device *, struct ib_ah_attr *);
505+
void (*notify_new_ah)(struct ib_device *, struct ib_ah_attr *,
506+
struct rvt_ah *);
498507
};
499508

500509
struct rvt_dev_info {

0 commit comments

Comments
 (0)