Commit 2dc05ab5 authored by Dennis Dalessandro's avatar Dennis Dalessandro Committed by Doug Ledford

IB/qib: Begin to use rdmavt for verbs

This patch begins to make use of rdmavt by registering with it and
providing access to the header files. This is just the beginning of
rdmavt support in qib.

Most functionality is still being done in the driver, set flags so that
rdmavt will let qib continue to handle mr, qp, and cq init.
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 38ce2c6f
config INFINIBAND_QIB config INFINIBAND_QIB
tristate "Intel PCIe HCA support" tristate "Intel PCIe HCA support"
depends on 64BIT depends on 64BIT && INFINIBAND_RDMAVT
---help--- ---help---
This is a low-level driver for Intel PCIe QLE InfiniBand host This is a low-level driver for Intel PCIe QLE InfiniBand host
channel adapters. This driver does not support the Intel channel adapters. This driver does not support the Intel
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <rdma/rdma_vt.h>
#include "qib_common.h" #include "qib_common.h"
#include "qib_verbs.h" #include "qib_verbs.h"
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#ifdef CONFIG_INFINIBAND_QIB_DCA #ifdef CONFIG_INFINIBAND_QIB_DCA
#include <linux/dca.h> #include <linux/dca.h>
#endif #endif
#include <rdma/rdma_vt.h>
#include "qib.h" #include "qib.h"
#include "qib_common.h" #include "qib_common.h"
...@@ -1081,7 +1082,7 @@ void qib_free_devdata(struct qib_devdata *dd) ...@@ -1081,7 +1082,7 @@ void qib_free_devdata(struct qib_devdata *dd)
qib_dbg_ibdev_exit(&dd->verbs_dev); qib_dbg_ibdev_exit(&dd->verbs_dev);
#endif #endif
free_percpu(dd->int_counter); free_percpu(dd->int_counter);
ib_dealloc_device(&dd->verbs_dev.ibdev); ib_dealloc_device(&dd->verbs_dev.rdi.ibdev);
} }
u64 qib_int_counter(struct qib_devdata *dd) u64 qib_int_counter(struct qib_devdata *dd)
...@@ -1171,7 +1172,7 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) ...@@ -1171,7 +1172,7 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
bail: bail:
if (!list_empty(&dd->list)) if (!list_empty(&dd->list))
list_del_init(&dd->list); list_del_init(&dd->list);
ib_dealloc_device(&dd->verbs_dev.ibdev); ib_dealloc_device(&dd->verbs_dev.rdi.ibdev);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
...@@ -74,7 +74,7 @@ static void signal_ib_event(struct qib_pportdata *ppd, enum ib_event_type ev) ...@@ -74,7 +74,7 @@ static void signal_ib_event(struct qib_pportdata *ppd, enum ib_event_type ev)
struct ib_event event; struct ib_event event;
struct qib_devdata *dd = ppd->dd; struct qib_devdata *dd = ppd->dd;
event.device = &dd->verbs_dev.ibdev; event.device = &dd->verbs_dev.rdi.ibdev;
event.element.port_num = ppd->port; event.element.port_num = ppd->port;
event.event = ev; event.event = ev;
ib_dispatch_event(&event); ib_dispatch_event(&event);
......
...@@ -1028,7 +1028,7 @@ static int set_pkeys(struct qib_devdata *dd, u8 port, u16 *pkeys) ...@@ -1028,7 +1028,7 @@ static int set_pkeys(struct qib_devdata *dd, u8 port, u16 *pkeys)
(void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PKEYS, 0); (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PKEYS, 0);
event.event = IB_EVENT_PKEY_CHANGE; event.event = IB_EVENT_PKEY_CHANGE;
event.device = &dd->verbs_dev.ibdev; event.device = &dd->verbs_dev.rdi.ibdev;
event.element.port_num = port; event.element.port_num = port;
ib_dispatch_event(&event); ib_dispatch_event(&event);
} }
...@@ -2483,7 +2483,8 @@ int qib_create_agents(struct qib_ibdev *dev) ...@@ -2483,7 +2483,8 @@ int qib_create_agents(struct qib_ibdev *dev)
for (p = 0; p < dd->num_pports; p++) { for (p = 0; p < dd->num_pports; p++) {
ibp = &dd->pport[p].ibport_data; ibp = &dd->pport[p].ibport_data;
agent = ib_register_mad_agent(&dev->ibdev, p + 1, IB_QPT_SMI, agent = ib_register_mad_agent(&dev->rdi.ibdev, p + 1,
IB_QPT_SMI,
NULL, 0, send_handler, NULL, 0, send_handler,
NULL, NULL, 0); NULL, NULL, 0);
if (IS_ERR(agent)) { if (IS_ERR(agent)) {
......
...@@ -502,7 +502,7 @@ static ssize_t show_rev(struct device *device, struct device_attribute *attr, ...@@ -502,7 +502,7 @@ static ssize_t show_rev(struct device *device, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
return sprintf(buf, "%x\n", dd_from_dev(dev)->minrev); return sprintf(buf, "%x\n", dd_from_dev(dev)->minrev);
} }
...@@ -511,7 +511,7 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr, ...@@ -511,7 +511,7 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
int ret; int ret;
...@@ -533,7 +533,7 @@ static ssize_t show_boardversion(struct device *device, ...@@ -533,7 +533,7 @@ static ssize_t show_boardversion(struct device *device,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
/* The string printed here is already newline-terminated. */ /* The string printed here is already newline-terminated. */
...@@ -545,7 +545,7 @@ static ssize_t show_localbus_info(struct device *device, ...@@ -545,7 +545,7 @@ static ssize_t show_localbus_info(struct device *device,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
/* The string printed here is already newline-terminated. */ /* The string printed here is already newline-terminated. */
...@@ -557,7 +557,7 @@ static ssize_t show_nctxts(struct device *device, ...@@ -557,7 +557,7 @@ static ssize_t show_nctxts(struct device *device,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
/* Return the number of user ports (contexts) available. */ /* Return the number of user ports (contexts) available. */
...@@ -572,7 +572,7 @@ static ssize_t show_nfreectxts(struct device *device, ...@@ -572,7 +572,7 @@ static ssize_t show_nfreectxts(struct device *device,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
/* Return the number of free user ports (contexts) available. */ /* Return the number of free user ports (contexts) available. */
...@@ -583,7 +583,7 @@ static ssize_t show_serial(struct device *device, ...@@ -583,7 +583,7 @@ static ssize_t show_serial(struct device *device,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
buf[sizeof(dd->serial)] = '\0'; buf[sizeof(dd->serial)] = '\0';
...@@ -597,7 +597,7 @@ static ssize_t store_chip_reset(struct device *device, ...@@ -597,7 +597,7 @@ static ssize_t store_chip_reset(struct device *device,
size_t count) size_t count)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
int ret; int ret;
...@@ -618,7 +618,7 @@ static ssize_t show_tempsense(struct device *device, ...@@ -618,7 +618,7 @@ static ssize_t show_tempsense(struct device *device,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct qib_ibdev *dev = struct qib_ibdev *dev =
container_of(device, struct qib_ibdev, ibdev.dev); container_of(device, struct qib_ibdev, rdi.ibdev.dev);
struct qib_devdata *dd = dd_from_dev(dev); struct qib_devdata *dd = dd_from_dev(dev);
int ret; int ret;
int idx; int idx;
...@@ -778,7 +778,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num, ...@@ -778,7 +778,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,
*/ */
int qib_verbs_register_sysfs(struct qib_devdata *dd) int qib_verbs_register_sysfs(struct qib_devdata *dd)
{ {
struct ib_device *dev = &dd->verbs_dev.ibdev; struct ib_device *dev = &dd->verbs_dev.rdi.ibdev;
int i, ret; int i, ret;
for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i) { for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i) {
......
...@@ -2091,7 +2091,7 @@ static int qib_port_immutable(struct ib_device *ibdev, u8 port_num, ...@@ -2091,7 +2091,7 @@ static int qib_port_immutable(struct ib_device *ibdev, u8 port_num,
int qib_register_ib_device(struct qib_devdata *dd) int qib_register_ib_device(struct qib_devdata *dd)
{ {
struct qib_ibdev *dev = &dd->verbs_dev; struct qib_ibdev *dev = &dd->verbs_dev;
struct ib_device *ibdev = &dev->ibdev; struct ib_device *ibdev = &dev->rdi.ibdev;
struct qib_pportdata *ppd = dd->pport; struct qib_pportdata *ppd = dd->pport;
unsigned i, lk_tab_size; unsigned i, lk_tab_size;
int ret; int ret;
...@@ -2279,7 +2279,17 @@ int qib_register_ib_device(struct qib_devdata *dd) ...@@ -2279,7 +2279,17 @@ int qib_register_ib_device(struct qib_devdata *dd)
snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), snprintf(ibdev->node_desc, sizeof(ibdev->node_desc),
"Intel Infiniband HCA %s", init_utsname()->nodename); "Intel Infiniband HCA %s", init_utsname()->nodename);
ret = ib_register_device(ibdev, qib_create_port_files); /*
* Fill in rvt info object.
*/
dd->verbs_dev.rdi.driver_f.port_callback = qib_create_port_files;
dd->verbs_dev.rdi.dparms.props.max_pd = ib_qib_max_pds;
dd->verbs_dev.rdi.flags = (RVT_FLAG_MR_INIT_DRIVER |
RVT_FLAG_QP_INIT_DRIVER |
RVT_FLAG_CQ_INIT_DRIVER);
ret = rvt_register_device(&dd->verbs_dev.rdi);
if (ret) if (ret)
goto err_reg; goto err_reg;
...@@ -2296,7 +2306,7 @@ int qib_register_ib_device(struct qib_devdata *dd) ...@@ -2296,7 +2306,7 @@ int qib_register_ib_device(struct qib_devdata *dd)
err_class: err_class:
qib_free_agents(dev); qib_free_agents(dev);
err_agents: err_agents:
ib_unregister_device(ibdev); rvt_unregister_device(&dd->verbs_dev.rdi);
err_reg: err_reg:
err_tx: err_tx:
while (!list_empty(&dev->txreq_free)) { while (!list_empty(&dev->txreq_free)) {
...@@ -2325,7 +2335,6 @@ int qib_register_ib_device(struct qib_devdata *dd) ...@@ -2325,7 +2335,6 @@ int qib_register_ib_device(struct qib_devdata *dd)
void qib_unregister_ib_device(struct qib_devdata *dd) void qib_unregister_ib_device(struct qib_devdata *dd)
{ {
struct qib_ibdev *dev = &dd->verbs_dev; struct qib_ibdev *dev = &dd->verbs_dev;
struct ib_device *ibdev = &dev->ibdev;
u32 qps_inuse; u32 qps_inuse;
unsigned lk_tab_size; unsigned lk_tab_size;
...@@ -2333,7 +2342,7 @@ void qib_unregister_ib_device(struct qib_devdata *dd) ...@@ -2333,7 +2342,7 @@ void qib_unregister_ib_device(struct qib_devdata *dd)
qib_free_agents(dev); qib_free_agents(dev);
ib_unregister_device(ibdev); rvt_unregister_device(&dd->verbs_dev.rdi);
if (!list_empty(&dev->piowait)) if (!list_empty(&dev->piowait))
qib_dev_err(dd, "piowait list not empty!\n"); qib_dev_err(dd, "piowait list not empty!\n");
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <rdma/ib_pack.h> #include <rdma/ib_pack.h>
#include <rdma/ib_user_verbs.h> #include <rdma/ib_user_verbs.h>
#include <rdma/rdma_vt.h>
struct qib_ctxtdata; struct qib_ctxtdata;
struct qib_pportdata; struct qib_pportdata;
...@@ -752,7 +753,7 @@ struct qib_ibport { ...@@ -752,7 +753,7 @@ struct qib_ibport {
struct qib_ibdev { struct qib_ibdev {
struct ib_device ibdev; struct rvt_dev_info rdi;
struct list_head pending_mmaps; struct list_head pending_mmaps;
spinlock_t mmap_offset_lock; /* protect mmap_offset */ spinlock_t mmap_offset_lock; /* protect mmap_offset */
u32 mmap_offset; u32 mmap_offset;
...@@ -845,7 +846,10 @@ static inline struct qib_qp *to_iqp(struct ib_qp *ibqp) ...@@ -845,7 +846,10 @@ static inline struct qib_qp *to_iqp(struct ib_qp *ibqp)
static inline struct qib_ibdev *to_idev(struct ib_device *ibdev) static inline struct qib_ibdev *to_idev(struct ib_device *ibdev)
{ {
return container_of(ibdev, struct qib_ibdev, ibdev); struct rvt_dev_info *rdi;
rdi = container_of(ibdev, struct rvt_dev_info, ibdev);
return container_of(rdi, struct qib_ibdev, rdi);
} }
/* /*
......
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