mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
IB/rdmavt: Initialize and teardown of qpn table
Add table init as well as teardown for handling qpn maps. Drivers can still provide this functionality by setting the QP_INIT_DRIVER bit. Reviewed-by: Ira Weiny <[email protected]> Reviewed-by: Mike Marciniszyn <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
This commit is contained in:
parent
b4e64397da
commit
0acb0cc7ec
5 changed files with 263 additions and 13 deletions
|
|
@ -172,7 +172,13 @@ struct rvt_driver_params {
|
|||
* For instance special module parameters. Goes here.
|
||||
*/
|
||||
unsigned int lkey_table_size;
|
||||
unsigned int qp_table_size;
|
||||
int qpn_start;
|
||||
int qpn_inc;
|
||||
int qpn_res_start;
|
||||
int qpn_res_end;
|
||||
int nports;
|
||||
u8 qos_shift;
|
||||
};
|
||||
|
||||
/* Protection domain */
|
||||
|
|
@ -205,6 +211,7 @@ struct rvt_driver_provided {
|
|||
int (*port_callback)(struct ib_device *, u8, struct kobject *);
|
||||
const char * (*get_card_name)(struct rvt_dev_info *rdi);
|
||||
struct pci_dev * (*get_pci_dev)(struct rvt_dev_info *rdi);
|
||||
void (*free_all_qps)(struct rvt_dev_info *rdi);
|
||||
|
||||
/*--------------------*/
|
||||
/* Optional functions */
|
||||
|
|
@ -245,6 +252,8 @@ struct rvt_dev_info {
|
|||
|
||||
int flags;
|
||||
struct rvt_ibport **ports;
|
||||
|
||||
struct rvt_qp_ibdev *qp_dev;
|
||||
};
|
||||
|
||||
static inline struct rvt_pd *ibpd_to_rvtpd(struct ib_pd *ibpd)
|
||||
|
|
|
|||
|
|
@ -259,4 +259,37 @@ struct rvt_srq {
|
|||
u32 limit;
|
||||
};
|
||||
|
||||
#define RVT_QPN_MAX BIT(24)
|
||||
#define RVT_QPNMAP_ENTRIES (RVT_QPN_MAX / PAGE_SIZE / BITS_PER_BYTE)
|
||||
#define RVT_BITS_PER_PAGE (PAGE_SIZE * BITS_PER_BYTE)
|
||||
#define RVT_BITS_PER_PAGE_MASK (RVT_BITS_PER_PAGE - 1)
|
||||
|
||||
/*
|
||||
* QPN-map pages start out as NULL, they get allocated upon
|
||||
* first use and are never deallocated. This way,
|
||||
* large bitmaps are not allocated unless large numbers of QPs are used.
|
||||
*/
|
||||
struct rvt_qpn_map {
|
||||
void *page;
|
||||
};
|
||||
|
||||
struct rvt_qpn_table {
|
||||
spinlock_t lock; /* protect changes to the qp table */
|
||||
unsigned flags; /* flags for QP0/1 allocated for each port */
|
||||
u32 last; /* last QP number allocated */
|
||||
u32 nmaps; /* size of the map table */
|
||||
u16 limit;
|
||||
u8 incr;
|
||||
/* bit map of free QP numbers other than 0/1 */
|
||||
struct rvt_qpn_map map[RVT_QPNMAP_ENTRIES];
|
||||
};
|
||||
|
||||
struct rvt_qp_ibdev {
|
||||
u32 qp_table_size;
|
||||
u32 qp_table_bits;
|
||||
struct rvt_qp __rcu **qp_table;
|
||||
spinlock_t qpt_lock; /* qptable lock */
|
||||
struct rvt_qpn_table qpn_table;
|
||||
};
|
||||
|
||||
#endif /* DEF_RDMAVT_INCQP_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue