32 #include <linux/module.h>
43 #define DRV_VERSION "1.1"
50 static void open_rnic_dev(
struct t3cdev *);
51 static void close_rnic_dev(
struct t3cdev *);
52 static void iwch_event_handler(
struct t3cdev *,
u32,
u32);
57 .remove = close_rnic_dev,
60 .event_handler = iwch_event_handler
66 static int disable_qp_db(
int id,
void *
p,
void *
data)
70 cxio_disable_wq_db(&qhp->
wq);
74 static int enable_qp_db(
int id,
void *
p,
void *
data)
79 ring_doorbell(qhp->
rhp->rdev.ctrl_qp.doorbell, qhp->
wq.qpid);
80 cxio_enable_wq_db(&qhp->
wq);
84 static void disable_dbs(
struct iwch_dev *rnicp)
86 spin_lock_irq(&rnicp->
lock);
88 spin_unlock_irq(&rnicp->
lock);
91 static void enable_dbs(
struct iwch_dev *rnicp,
int ring_db)
93 spin_lock_irq(&rnicp->
lock);
95 (
void *)(
unsigned long)ring_db);
96 spin_unlock_irq(&rnicp->
lock);
103 enable_dbs(rnicp, 1);
106 static void rnic_init(
struct iwch_dev *rnicp)
108 PDBG(
"%s iwch_dev %p\n", __func__, rnicp);
121 rnicp->
attr.max_mem_regs = cxio_num_stags(&rnicp->
rdev);
126 rnicp->
attr.can_resize_wq = 0;
127 rnicp->
attr.max_rdma_reads_per_qp = 8;
128 rnicp->
attr.max_rdma_read_resources =
129 rnicp->
attr.max_rdma_reads_per_qp * rnicp->
attr.max_qps;
130 rnicp->
attr.max_rdma_read_qp_depth = 8;
131 rnicp->
attr.max_rdma_read_depth =
132 rnicp->
attr.max_rdma_read_qp_depth * rnicp->
attr.max_qps;
133 rnicp->
attr.rq_overflow_handled = 0;
134 rnicp->
attr.can_modify_ird = 0;
135 rnicp->
attr.can_modify_ord = 0;
136 rnicp->
attr.max_mem_windows = rnicp->
attr.max_mem_regs - 1;
137 rnicp->
attr.stag0_value = 1;
138 rnicp->
attr.zbva_support = 1;
139 rnicp->
attr.local_invalidate_fence = 1;
140 rnicp->
attr.cq_overflow_detection = 1;
144 static void open_rnic_dev(
struct t3cdev *tdev)
148 PDBG(
"%s t3cdev %p\n", __func__, tdev);
156 rnicp->
rdev.ulp = rnicp;
157 rnicp->
rdev.t3cdev_p = tdev;
175 close_rnic_dev(tdev);
178 pci_name(rnicp->
rdev.rnic_info.pdev));
182 static void close_rnic_dev(
struct t3cdev *tdev)
185 PDBG(
"%s t3cdev %p\n", __func__, tdev);
188 if (dev->
rdev.t3cdev_p == tdev) {
210 u32 portnum = port_id + 1;
215 rnicp = rdev_to_iwch_dev(rdev);
239 enable_dbs(rnicp, 1);
243 unsigned long delay = 1000;
260 event.device = &rnicp->
ibdev;
261 event.element.port_num = portnum;
268 static int __init iwch_init_module(
void)
283 static void __exit iwch_exit_module(
void)