staging/rdma/hfi1: Add rdmavt support to hfi1
Subsystems (3)
cover staging/rdma/hfi1: Add rdmavt support to hfi1
This series adds rdmavt support to hfi1. More specifically it removes code duplication from hfi1 and uses the common rdmavt version. There are still a few more patches to go after this but this is a large chunk of the work and most of these patches have previously been submitted as RFC, first to staging, and then to linux-rdma. The 3 patches from Harish and the one from Ira are new vs the RFC.
The series will apply on the rdmavt series "clean ups, mad agents, and query_qp".
---
Dennis Dalessandro (27):
staging/rdma/hfi1: Begin to use rdmavt for verbs staging/rdma/hfi1: Add basic rdmavt capability flags for hfi1 staging/rdma/hfi1: Use rdmavt protection domain staging/rdma/hfi1: Remove MR data structures from hfi1 staging/rdma/hfi1: Remove driver specific members from hfi1 qp type staging/rdma/hfi1: Add device specific info prints staging/rdma/hfi1: Use correct rdmavt header files after move. staging/rdma/hfi1: Use address handle in rdmavt and remove from hfi1 staging/rdma/hfi1: Implement hfi1 support for AH notification staging/rdma/hfi1: Remove hfi1 MR and hfi1 specific qp type staging/rdma/hfi1: Remove srq from hfi1 staging/rdma/hfi1: Remove ibport and use rdmavt version staging/rdma/hfi1: Remove mmap from hfi1 staging/rdma/hfi1: Use rdmavt pkey verbs function staging/rdma/hfi1: Use rdmavt send flags and recv flags staging/rdma/hfi1: Remove qpdev and qpn table from hfi1 staging/rdma/hfi1: Remove create_qp functionality staging/rdma/hfi1: Remove CQ data structures and functions from hfi1 staging/rdma/hfi1: Clean up return handling staging/rdma/hfi1: Use rdmavt version of post_send staging/rdma/hfi1: Remove multicast verbs functions staging/rdma/hfi1: Remove modify queue pair from hfi1 staging/rdma/hfi1: Remove destroy qp verb staging/rdma/hfi1: Remove post_recv and use rdmavt version staging/rdma/hfi1: Clean up register device staging/rdma/hfi1: Use rdmavt device allocation function staging/rdma/hfi1: Remove create and free mad agents
Harish Chegondi (3):
staging/rdma/hfi1: Remove user context allocation and de-alloction functions staging/rdma/hfi1: Remove query_device function staging/rdma/hfi1: Remove hfi1_query_qp function
Ira Weiny (1):
staging/rdma/hfi1: Consolidate dma ops for hfi1
drivers/infiniband/sw/rdmavt/cq.c | 4 drivers/infiniband/sw/rdmavt/qp.c | 7 drivers/staging/rdma/hfi1/Kconfig | 2 drivers/staging/rdma/hfi1/Makefile | 6 drivers/staging/rdma/hfi1/chip.c | 36 - drivers/staging/rdma/hfi1/common.h | 3 drivers/staging/rdma/hfi1/cq.c | 558 ------------ drivers/staging/rdma/hfi1/diag.c | 13 drivers/staging/rdma/hfi1/driver.c | 66 + drivers/staging/rdma/hfi1/hfi.h | 31 - drivers/staging/rdma/hfi1/init.c | 18 drivers/staging/rdma/hfi1/intr.c | 2 drivers/staging/rdma/hfi1/keys.c | 356 -------- drivers/staging/rdma/hfi1/mad.c | 218 ++--- drivers/staging/rdma/hfi1/mmap.c | 192 ---- drivers/staging/rdma/hfi1/mr.c | 473 ---------- drivers/staging/rdma/hfi1/pio.c | 12 drivers/staging/rdma/hfi1/qp.c | 1456 +++++-------------------------- drivers/staging/rdma/hfi1/qp.h | 165 +--- drivers/staging/rdma/hfi1/rc.c | 385 ++++---- drivers/staging/rdma/hfi1/ruc.c | 230 +++-- drivers/staging/rdma/hfi1/sdma.h | 8 drivers/staging/rdma/hfi1/srq.c | 62 + drivers/staging/rdma/hfi1/sysfs.c | 18 drivers/staging/rdma/hfi1/trace.c | 2 drivers/staging/rdma/hfi1/trace.h | 51 - drivers/staging/rdma/hfi1/uc.c | 67 + drivers/staging/rdma/hfi1/ud.c | 148 ++- drivers/staging/rdma/hfi1/verbs.c | 1007 +++++---------------- drivers/staging/rdma/hfi1/verbs.h | 731 +--------------- drivers/staging/rdma/hfi1/verbs_mcast.c | 385 -------- 31 files changed, 1251 insertions(+), 5461 deletions(-) delete mode 100644 drivers/staging/rdma/hfi1/cq.c delete mode 100644 drivers/staging/rdma/hfi1/keys.c delete mode 100644 drivers/staging/rdma/hfi1/mmap.c delete mode 100644 drivers/staging/rdma/hfi1/mr.c delete mode 100644 drivers/staging/rdma/hfi1/verbs_mcast.c
Signature · 5 lines
-Denny -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20160119223610.32765.10571.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org
PATCH 1/31 staging/rdma/hfi1: 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 hfi1.
--- drivers/staging/rdma/hfi1/Kconfig | 2 +- drivers/staging/rdma/hfi1/chip.c | 2 +- drivers/staging/rdma/hfi1/diag.c | 2 +- drivers/staging/rdma/hfi1/hfi.h | 3 +-- drivers/staging/rdma/hfi1/init.c | 5 +++-- drivers/staging/rdma/hfi1/intr.c | 2 +- drivers/staging/rdma/hfi1/mad.c | 5 +++-- drivers/staging/rdma/hfi1/qp.c | 4 ++-- drivers/staging/rdma/hfi1/sysfs.c | 18 +++++++++--------- drivers/staging/rdma/hfi1/verbs.c | 15 ++++++++++----- drivers/staging/rdma/hfi1/verbs.h | 8 ++++++-- 11 files changed, 38 insertions(+), 28 deletions(-)
drivers/staging/rdma/hfi1/Kconfig +1 -1
@@ -1,6 +1,6 @@ config INFINIBAND_HFI1 tristate "Intel OPA Gen1 support" - depends on X86_64 + depends on X86_64 && INFINIBAND_RDMAVT select MMU_NOTIFIER default m ---help---
drivers/staging/rdma/hfi1/chip.c +1 -1
@@ -9925,7 +9925,7 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)sdma_all_running (dd);/* Signal the IB layer that the port has went active */ - event.device = &dd->verbs_dev.ibdev; + event.device = &dd->verbs_dev.rdi.ibdev; event.element.port_num = ppd->port; event.event =IB_EVENT_PORT_ACTIVE ; }
drivers/staging/rdma/hfi1/diag.c +1 -1
@@ -860,7 +860,7 @@ static ssize_t hfi1_snoop_write(struct file *fp, const char __user *data, vl = sc4; }else { sl = (byte_two >>4 ) &0xf ; - ibp =to_iport (&dd->verbs_dev.ibdev,1 ); + ibp =to_iport (&dd->verbs_dev.rdi.ibdev,1 ); sc5 = ibp->sl_to_sc[sl]; vl =sc_to_vlt (dd, sc5);if (vl != sc4) {
drivers/staging/rdma/hfi1/hfi.h +1 -2
@@ -65,8 +65,7 @@#include <linux/cdev.h> #include <linux/delay.h> #include <linux/kthread.h> -#include <linux/mmu_notifier.h> -#include <linux/rbtree.h> +#include <rdma/rdma_vt.h> #include "chip_registers.h" #include "common.h"
drivers/staging/rdma/hfi1/init.c +3 -2
@@ -56,6 +56,7 @@#include <linux/module.h> #include <linux/printk.h> #include <linux/hrtimer.h> +#include <rdma/rdma_vt.h> #include "hfi.h" #include "device.h"
@@ -983,7 +984,7 @@ void hfi1_free_devdata(struct hfi1_devdata *dd)rcu_barrier ();/* wait for rcu callbacks to complete */ free_percpu (dd->int_counter);free_percpu (dd->rcv_limit); -ib_dealloc_device (&dd->verbs_dev.ibdev); +ib_dealloc_device (&dd->verbs_dev.rdi.ibdev); }/*
@@ -1079,7 +1080,7 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra) bail:if (!list_empty (&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); }
drivers/staging/rdma/hfi1/intr.c +1 -1
@@ -98,7 +98,7 @@ static void signal_ib_event(struct hfi1_pportdata *ppd, enum ib_event_type ev)*/ if (!(dd->flags &HFI1_INITTED ))return ; - event.device = &dd->verbs_dev.ibdev; + event.device = &dd->verbs_dev.rdi.ibdev; event.element.port_num = ppd->port; event.event = ev;ib_dispatch_event (&event);
drivers/staging/rdma/hfi1/mad.c +3 -2
@@ -1388,7 +1388,7 @@ static int set_pkeys(struct hfi1_devdata *dd, u8 port, u16 *pkeys) (void )hfi1_set_ib_cfg (ppd,HFI1_IB_CFG_PKEYS ,0 ); event.event =IB_EVENT_PKEY_CHANGE ; - event.device = &dd->verbs_dev.ibdev; + event.device = &dd->verbs_dev.rdi.ibdev; event.element.port_num = port;ib_dispatch_event (&event); }
@@ -4171,7 +4171,8 @@ int hfi1_create_agents(struct hfi1_ibdev *dev)for (p =0 ; p < dd->num_pports; p++) { 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 ,NULL ,0 );if (IS_ERR (agent)) {
drivers/staging/rdma/hfi1/qp.c +2 -2
@@ -1570,7 +1570,7 @@ struct qp_iter *qp_iter_init(struct hfi1_ibdev *dev)return NULL ; iter->dev = dev; - iter->specials = dev->ibdev.phys_port_cnt *2 ; + iter->specials = dev->rdi.ibdev.phys_port_cnt *2 ;if (qp_iter_next (iter)) {kfree (iter);return NULL ;
@@ -1610,7 +1610,7 @@ int qp_iter_next(struct qp_iter *iter)struct hfi1_ibport *ibp;int pidx; - pidx = n % dev->ibdev.phys_port_cnt; + pidx = n % dev->rdi.ibdev.phys_port_cnt; ppd = &dd_from_dev (dev)->pport[pidx]; ibp = &ppd->ibport_data;
drivers/staging/rdma/hfi1/sysfs.c +9 -9
@@ -446,7 +446,7 @@ static ssize_t show_rev(struct device *device, struct device_attribute *attr, char *buf) {struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);return sprintf (buf,"%x\n" ,dd_from_dev (dev)->minrev); }
@@ -455,7 +455,7 @@ static ssize_t show_hfi(struct device *device, struct device_attribute *attr, char *buf) {struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);struct hfi1_devdata *dd =dd_from_dev (dev);int ret;
@@ -470,7 +470,7 @@ static ssize_t show_boardversion(struct device *device, struct device_attribute *attr, char *buf) { struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);struct hfi1_devdata *dd =dd_from_dev (dev);/* The string printed here is already newline-terminated. */
@@ -482,7 +482,7 @@ static ssize_t show_nctxts(struct device *device, struct device_attribute *attr, char *buf) { struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);struct hfi1_devdata *dd =dd_from_dev (dev);/*
@@ -500,7 +500,7 @@ static ssize_t show_nfreectxts(struct device *device, struct device_attribute *attr, char *buf) { struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);struct hfi1_devdata *dd =dd_from_dev (dev);/* Return the number of free user ports (contexts) available. */
@@ -511,7 +511,7 @@ static ssize_t show_serial(struct device *device, struct device_attribute *attr, char *buf) { struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);struct hfi1_devdata *dd =dd_from_dev (dev);return scnprintf (buf,PAGE_SIZE ,"%s" , dd->serial);
@@ -523,7 +523,7 @@ static ssize_t store_chip_reset(struct device *device, size_t count) {struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);struct hfi1_devdata *dd =dd_from_dev (dev);int ret;
@@ -552,7 +552,7 @@ static ssize_t show_tempsense(struct device *device, struct device_attribute *attr, char *buf) { struct hfi1_ibdev *dev = - container_of(device, struct hfi1_ibdev, ibdev.dev); + container_of(device, struct hfi1_ibdev, rdi.ibdev.dev);struct hfi1_devdata *dd =dd_from_dev (dev);struct hfi1_temp temp;int ret;
@@ -700,7 +700,7 @@ bail:*/ int hfi1_verbs_register_sysfs (struct hfi1_devdata *dd) { -struct ib_device *dev = &dd->verbs_dev.ibdev; +struct ib_device *dev = &dd->verbs_dev.rdi.ibdev;int i, ret;for (i =0 ; i <ARRAY_SIZE (hfi1_attributes); ++i) {
drivers/staging/rdma/hfi1/verbs.c +10 -5
@@ -1903,7 +1903,7 @@ static void verbs_txreq_kmem_cache_ctor(void *obj)int hfi1_register_ib_device (struct hfi1_devdata *dd) {struct hfi1_ibdev *dev = &dd->verbs_dev; -struct ib_device *ibdev = &dev->ibdev; +struct ib_device *ibdev = &dev->rdi.ibdev;struct hfi1_pportdata *ppd = dd->pport;unsigned i, lk_tab_size;int ret;
@@ -2069,7 +2069,13 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)strncpy (ibdev->node_desc,init_utsname ()->nodename,sizeof (ibdev->node_desc)); - ret =ib_register_device (ibdev, hfi1_create_port_files); +/* +* Fill in rvt info object. +*/ + dd->verbs_dev.rdi.driver_f.port_callback = hfi1_create_port_files; + dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds; + + ret =rvt_register_device (&dd->verbs_dev.rdi);if (ret) goto err_reg;
@@ -2086,7 +2092,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) err_class:hfi1_free_agents (dev); err_agents: -ib_unregister_device (ibdev); +rvt_unregister_device (&dd->verbs_dev.rdi); err_reg: err_verbs_txreq:kmem_cache_destroy (dev->verbs_txreq_cache);
@@ -2102,13 +2108,12 @@ bail:void hfi1_unregister_ib_device (struct hfi1_devdata *dd) {struct hfi1_ibdev *dev = &dd->verbs_dev; -struct ib_device *ibdev = &dev->ibdev;hfi1_verbs_unregister_sysfs (dd);hfi1_free_agents (dev); -ib_unregister_device (ibdev); +rvt_unregister_device (&dd->verbs_dev.rdi);if (!list_empty (&dev->txwait))dd_dev_err (dd,"txwait list not empty!\n" );
drivers/staging/rdma/hfi1/verbs.h +6 -2
@@ -62,6 +62,7 @@#include <rdma/ib_pack.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_mad.h> +#include <rdma/rdma_vt.h> struct hfi1_ctxtdata ;struct hfi1_pportdata ;
@@ -749,7 +750,7 @@ struct hfi1_ibport {struct hfi1_qp_ibdev ;struct hfi1_ibdev { -struct ib_device ibdev; +struct rvt_dev_info rdi;/* Must be first */ struct list_head pending_mmaps;spinlock_t mmap_offset_lock;/* protect mmap_offset */ u32 mmap_offset;
@@ -843,7 +844,10 @@ static inline struct hfi1_qp *to_iqp(struct ib_qp *ibqp)static inline struct hfi1_ibdev *to_idev (struct ib_device *ibdev) { - return container_of(ibdev, struct hfi1_ibdev, ibdev); +struct rvt_dev_info *rdi; + + rdi = container_of(ibdev, struct rvt_dev_info, ibdev); + return container_of(rdi, struct hfi1_ibdev, rdi); }/*
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/31 staging/rdma/hfi1: Add basic rdmavt capability flags for hfi1
In reply to a message not in the archiveMost functionality is still being done in the driver, set flags so that rdmavt will let hfi1 continue to handle mr, qp, and cq init.
--- drivers/staging/rdma/hfi1/verbs.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +3 -0
@@ -2074,6 +2074,9 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)*/ dd->verbs_dev.rdi.driver_f.port_callback = hfi1_create_port_files; dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_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)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/31 staging/rdma/hfi1: Consolidate dma ops for hfi1
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Remove the dma.c file from hfi1 in favor of using that which is present in rdmavt.
--- drivers/staging/rdma/hfi1/Makefile | 2 +- drivers/staging/rdma/hfi1/verbs.c | 2 +- drivers/staging/rdma/hfi1/verbs.h | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rdma/hfi1/Makefile +1 -1
@@ -7,7 +7,7 @@ # obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o -hfi1-y := chip.o cq.o device.o diag.o dma.o driver.o efivar.o eprom.o file_ops.o firmware.o \ +hfi1-y := chip.o cq.o device.o diag.o driver.o efivar.o eprom.o file_ops.o firmware.o \ init.o intr.o keys.o mad.o mmap.o mr.o pcie.o pio.o pio_copy.o \ qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \ uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs_mcast.o verbs.o
drivers/staging/rdma/hfi1/verbs.c +1 -1
@@ -2063,7 +2063,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->detach_mcast = hfi1_multicast_detach; ibdev->process_mad = hfi1_process_mad; ibdev->mmap = hfi1_mmap; - ibdev->dma_ops = &hfi1_dma_mapping_ops; + ibdev->dma_ops =NULL ; ibdev->get_port_immutable = port_immutable; strncpy(ibdev->node_desc, init_utsname()->nodename,
drivers/staging/rdma/hfi1/verbs.h +0 -2
@@ -1151,6 +1151,4 @@ extern unsigned int hfi1_max_srq_wrs;extern const u32 ib_hfi1_rnr_table[]; -extern struct ib_dma_mapping_ops hfi1_dma_mapping_ops; -#endif /* HFI1_VERBS_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/31 staging/rdma/hfi1: Use rdmavt protection domain
In reply to a message not in the archiveRemove protection domain from hfi1 and use rdmavt's version.
--- drivers/staging/rdma/hfi1/keys.c | 4 +- drivers/staging/rdma/hfi1/mr.c | 2 + drivers/staging/rdma/hfi1/ruc.c | 4 +- drivers/staging/rdma/hfi1/verbs.c | 67 +++---------------------------------- drivers/staging/rdma/hfi1/verbs.h | 15 +------- 5 files changed, 12 insertions(+), 80 deletions(-)
drivers/staging/rdma/hfi1/keys.c +2 -2
@@ -176,7 +176,7 @@ out:* Check the IB SGE for validity and initialize our internal version * of it. */ -int hfi1_lkey_ok (struct hfi1_lkey_table *rkt,struct hfi1_pd *pd, +int hfi1_lkey_ok (struct hfi1_lkey_table *rkt,struct rvt_pd *pd,struct hfi1_sge *isge,struct ib_sge *sge,int acc) {struct hfi1_mregion *mr;
@@ -285,7 +285,7 @@ int hfi1_rkey_ok(struct hfi1_qp *qp, struct hfi1_sge *sge,*/ rcu_read_lock ();if (rkey ==0 ) { -struct hfi1_pd *pd =to_ipd (qp->ibqp.pd); +struct rvt_pd *pd =ibpd_to_rvtpd (qp->ibqp.pd);struct hfi1_ibdev *dev =to_idev (pd->ibpd.device);if (pd->user)
drivers/staging/rdma/hfi1/mr.c +1 -1
@@ -116,7 +116,7 @@ struct ib_mr *hfi1_get_dma_mr(struct ib_pd *pd, int acc)struct ib_mr *ret;int rval; -if (to_ipd (pd)->user) { +if (ibpd_to_rvtpd (pd)->user) { ret =ERR_PTR (-EPERM ); goto bail; }
drivers/staging/rdma/hfi1/ruc.c +2 -2
@@ -102,11 +102,11 @@ static int init_sge(struct hfi1_qp *qp, struct hfi1_rwqe *wqe)int i, j, ret;struct ib_wc wc;struct hfi1_lkey_table *rkt; -struct hfi1_pd *pd; +struct rvt_pd *pd;struct hfi1_sge_state *ss; rkt = &to_idev (qp->ibqp.device)->lk_table; - pd =to_ipd (qp->ibqp.srq ? qp->ibqp.srq->pd : qp->ibqp.pd); + pd =ibpd_to_rvtpd (qp->ibqp.srq ? qp->ibqp.srq->pd : qp->ibqp.pd); ss = &qp->r_sge; ss->sg_list = qp->r_sg_list; qp->r_len =0 ;
drivers/staging/rdma/hfi1/verbs.c +6 -61
103 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +1 -14
@@ -234,12 +234,6 @@ struct hfi1_mcast {int n_attached; }; -/* Protection domain */ -struct hfi1_pd { -struct ib_pd ibpd; -int user;/* non-zero if created from user space */ -}; -/* Address Handle */ struct hfi1_ah {struct ib_ah ibah;
@@ -776,8 +770,6 @@ struct hfi1_ibdev {u64 n_kmem_wait;u64 n_send_schedule; -u32 n_pds_allocated;/* number of PDs allocated for device */ -spinlock_t n_pds_lock;u32 n_ahs_allocated;/* number of AHs allocated for device */ spinlock_t n_ahs_lock;u32 n_cqs_allocated;/* number of CQs allocated for device */
@@ -817,11 +809,6 @@ static inline struct hfi1_mr *to_imr(struct ib_mr *ibmr) return container_of(ibmr, struct hfi1_mr, ibmr); } -static inline struct hfi1_pd *to_ipd (struct ib_pd *ibpd) -{ - return container_of(ibpd, struct hfi1_pd, ibpd); -} -static inline struct hfi1_ah *to_iah (struct ib_ah *ibah) { return container_of(ibah, struct hfi1_ah, ibah);
@@ -983,7 +970,7 @@ int hfi1_alloc_lkey(struct hfi1_mregion *mr, int dma_region);void hfi1_free_lkey (struct hfi1_mregion *mr); -int hfi1_lkey_ok (struct hfi1_lkey_table *rkt,struct hfi1_pd *pd, +int hfi1_lkey_ok (struct hfi1_lkey_table *rkt,struct rvt_pd *pd,struct hfi1_sge *isge,struct ib_sge *sge,int acc); int hfi1_rkey_ok(struct hfi1_qp *qp, struct hfi1_sge *sge,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/31 staging/rdma/hfi1: Remove MR data structures from hfi1
In reply to a message not in the archiveRemove MR data structures from hfi1 and use the version in rdmavt
--- drivers/staging/rdma/hfi1/keys.c | 30 +++++++++--------- drivers/staging/rdma/hfi1/mr.c | 20 ++++++------ drivers/staging/rdma/hfi1/ruc.c | 4 +- drivers/staging/rdma/hfi1/sdma.h | 2 + drivers/staging/rdma/hfi1/ud.c | 2 + drivers/staging/rdma/hfi1/verbs.c | 16 +++++---- drivers/staging/rdma/hfi1/verbs.h | 63 ++++++------------------------------- 7 files changed, 47 insertions(+), 90 deletions(-)
drivers/staging/rdma/hfi1/keys.c +15 -15
@@ -63,21 +63,21 @@* */ -int hfi1_alloc_lkey (struct hfi1_mregion *mr,int dma_region) +int hfi1_alloc_lkey (struct rvt_mregion *mr,int dma_region) {unsigned long flags;u32 r;u32 n;int ret =0 ;struct hfi1_ibdev *dev =to_idev (mr->pd->device); -struct hfi1_lkey_table *rkt = &dev->lk_table; +struct rvt_lkey_table *rkt = &dev->lk_table;hfi1_get_mr (mr);spin_lock_irqsave (&rkt->lock, flags);/* special case for dma_mr lkey == 0 */ if (dma_region) { -struct hfi1_mregion *tmr; +struct rvt_mregion *tmr; tmr =rcu_access_pointer (dev->dma_mr);if (!tmr) {
@@ -133,13 +133,13 @@ bail:* hfi1_free_lkey - free an lkey * @mr: mr to free from tables */ -void hfi1_free_lkey (struct hfi1_mregion *mr) +void hfi1_free_lkey (struct rvt_mregion *mr) {unsigned long flags;u32 lkey = mr->lkey;u32 r;struct hfi1_ibdev *dev =to_idev (mr->pd->device); -struct hfi1_lkey_table *rkt = &dev->lk_table; +struct rvt_lkey_table *rkt = &dev->lk_table;int freed =0 ;spin_lock_irqsave (&rkt->lock, flags);
@@ -176,10 +176,10 @@ out:* Check the IB SGE for validity and initialize our internal version * of it. */ -int hfi1_lkey_ok (struct hfi1_lkey_table *rkt,struct rvt_pd *pd, +int hfi1_lkey_ok (struct rvt_lkey_table *rkt,struct rvt_pd *pd,struct hfi1_sge *isge,struct ib_sge *sge,int acc) { -struct hfi1_mregion *mr; +struct rvt_mregion *mr;unsigned n, m;size_t off;
@@ -231,15 +231,15 @@ int hfi1_lkey_ok(struct hfi1_lkey_table *rkt, struct rvt_pd *pd, entries_spanned_by_off = off >> mr->page_shift; off -= (entries_spanned_by_off << mr->page_shift); - m = entries_spanned_by_off /HFI1_SEGSZ ; - n = entries_spanned_by_off %HFI1_SEGSZ ; + m = entries_spanned_by_off /RVT_SEGSZ ; + n = entries_spanned_by_off %RVT_SEGSZ ; }else { m =0 ; n =0 ;while (off >= mr->map[m]->segs[n].length) { off -= mr->map[m]->segs[n].length; n++; -if (n >=HFI1_SEGSZ ) { +if (n >=RVT_SEGSZ ) { m++; n =0 ; }
@@ -274,8 +274,8 @@ bail:int hfi1_rkey_ok (struct hfi1_qp *qp,struct hfi1_sge *sge,u32 len,u64 vaddr,u32 rkey,int acc) { -struct hfi1_lkey_table *rkt = &to_idev (qp->ibqp.device)->lk_table; -struct hfi1_mregion *mr; +struct rvt_lkey_table *rkt = &to_idev (qp->ibqp.device)->lk_table; +struct rvt_mregion *mr;unsigned n, m;size_t off;
@@ -328,15 +328,15 @@ int hfi1_rkey_ok(struct hfi1_qp *qp, struct hfi1_sge *sge, entries_spanned_by_off = off >> mr->page_shift; off -= (entries_spanned_by_off << mr->page_shift); - m = entries_spanned_by_off /HFI1_SEGSZ ; - n = entries_spanned_by_off %HFI1_SEGSZ ; + m = entries_spanned_by_off /RVT_SEGSZ ; + n = entries_spanned_by_off %RVT_SEGSZ ; }else { m =0 ; n =0 ;while (off >= mr->map[m]->segs[n].length) { off -= mr->map[m]->segs[n].length; n++; -if (n >=HFI1_SEGSZ ) { +if (n >=RVT_SEGSZ ) { m++; n =0 ; }
drivers/staging/rdma/hfi1/mr.c +10 -10
@@ -56,7 +56,7 @@/* Fast memory region */ struct hfi1_fmr {struct ib_fmr ibfmr; -struct hfi1_mregion mr;/* must be last */ +struct rvt_mregion mr;/* must be last */ };static inline struct hfi1_fmr *to_ifmr (struct ib_fmr *ibfmr)
@@ -64,13 +64,13 @@ static inline struct hfi1_fmr *to_ifmr(struct ib_fmr *ibfmr) return container_of(ibfmr, struct hfi1_fmr, ibfmr); } -static int init_mregion (struct hfi1_mregion *mr,struct ib_pd *pd, +static int init_mregion (struct rvt_mregion *mr,struct ib_pd *pd,int count) {int m, i =0 ;int rval =0 ; - m = (count +HFI1_SEGSZ -1 ) /HFI1_SEGSZ ; + m = (count +RVT_SEGSZ -1 ) /RVT_SEGSZ ;for (; i < m; i++) { mr->map[i] =kzalloc (sizeof (*mr->map[0 ]),GFP_KERNEL );if (!mr->map[i])
@@ -91,7 +91,7 @@ bail: goto out; } -static void deinit_mregion (struct hfi1_mregion *mr) +static void deinit_mregion (struct rvt_mregion *mr) {int i = mr->mapsz;
@@ -159,7 +159,7 @@ static struct hfi1_mr *alloc_mr(int count, struct ib_pd *pd)int m;/* Allocate struct plus pointers to first level page tables. */ - m = (count +HFI1_SEGSZ -1 ) /HFI1_SEGSZ ; + m = (count +RVT_SEGSZ -1 ) /RVT_SEGSZ ; mr =kzalloc (sizeof (*mr) + m *sizeof (mr->mr.map[0 ]),GFP_KERNEL );if (!mr) goto bail;
@@ -245,7 +245,7 @@ struct ib_mr *hfi1_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, mr->mr.map[m]->segs[n].vaddr = vaddr; mr->mr.map[m]->segs[n].length = umem->page_size; n++; -if (n ==HFI1_SEGSZ ) { +if (n ==RVT_SEGSZ ) { m++; n =0 ; }
@@ -333,7 +333,7 @@ struct ib_fmr *hfi1_alloc_fmr(struct ib_pd *pd, int mr_access_flags,int rval = -ENOMEM ;/* Allocate struct plus pointers to first level page tables. */ - m = (fmr_attr->max_pages +HFI1_SEGSZ -1 ) /HFI1_SEGSZ ; + m = (fmr_attr->max_pages +RVT_SEGSZ -1 ) /RVT_SEGSZ ; fmr =kzalloc (sizeof (*fmr) + m *sizeof (fmr->mr.map[0 ]),GFP_KERNEL );if (!fmr) goto bail;
@@ -385,7 +385,7 @@ int hfi1_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list, int list_len, u64 iova) {struct hfi1_fmr *fmr =to_ifmr (ibfmr); -struct hfi1_lkey_table *rkt; +struct rvt_lkey_table *rkt;unsigned long flags;int m, n, i;u32 ps;
@@ -410,7 +410,7 @@ int hfi1_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,for (i =0 ; i < list_len; i++) { fmr->mr.map[m]->segs[n].vaddr = (void *) page_list[i]; fmr->mr.map[m]->segs[n].length = ps; -if (++n ==HFI1_SEGSZ ) { +if (++n ==RVT_SEGSZ ) { m++; n =0 ; }
@@ -431,7 +431,7 @@ bail:int hfi1_unmap_fmr (struct list_head *fmr_list) {struct hfi1_fmr *fmr; -struct hfi1_lkey_table *rkt; +struct rvt_lkey_table *rkt;unsigned long flags;list_for_each_entry (fmr, fmr_list, ibfmr.list) {
drivers/staging/rdma/hfi1/ruc.c +2 -2
@@ -101,7 +101,7 @@ static int init_sge(struct hfi1_qp *qp, struct hfi1_rwqe *wqe) {int i, j, ret;struct ib_wc wc; -struct hfi1_lkey_table *rkt; +struct rvt_lkey_table *rkt;struct rvt_pd *pd;struct hfi1_sge_state *ss;
@@ -534,7 +534,7 @@ again:if (--sqp->s_sge.num_sge) *sge = *sqp->s_sge.sg_list++; }else if (sge->length ==0 && sge->mr->lkey) { -if (++sge->n >=HFI1_SEGSZ ) { +if (++sge->n >=RVT_SEGSZ ) {if (++sge->m >= sge->mr->mapsz)break ; sge->n =0 ;
drivers/staging/rdma/hfi1/sdma.h +1 -1
@@ -381,7 +381,7 @@ struct verbs_txreq {struct sdma_txreq txreq;struct hfi1_qp *qp;struct hfi1_swqe *wqe; -struct hfi1_mregion *mr; +struct rvt_mregion *mr;struct hfi1_sge_state *ss;struct sdma_engine *sde;u16 hdr_dwords;
drivers/staging/rdma/hfi1/ud.c +1 -1
@@ -210,7 +210,7 @@ static void ud_loopback(struct hfi1_qp *sqp, struct hfi1_swqe *swqe)if (--ssge.num_sge) *sge = *ssge.sg_list++; }else if (sge->length ==0 && sge->mr->lkey) { -if (++sge->n >=HFI1_SEGSZ ) { +if (++sge->n >=RVT_SEGSZ ) {if (++sge->m >= sge->mr->mapsz)break ; sge->n =0 ;
drivers/staging/rdma/hfi1/verbs.c +8 -8
@@ -300,7 +300,7 @@ void hfi1_copy_sge(if (--ss->num_sge) *sge = *ss->sg_list++; }else if (sge->length ==0 && sge->mr->lkey) { -if (++sge->n >=HFI1_SEGSZ ) { +if (++sge->n >=RVT_SEGSZ ) {if (++sge->m >= sge->mr->mapsz)break ; sge->n =0 ;
@@ -341,7 +341,7 @@ void hfi1_skip_sge(struct hfi1_sge_state *ss, u32 length, int release)if (--ss->num_sge) *sge = *ss->sg_list++; }else if (sge->length ==0 && sge->mr->lkey) { -if (++sge->n >=HFI1_SEGSZ ) { +if (++sge->n >=RVT_SEGSZ ) {if (++sge->m >= sge->mr->mapsz)break ; sge->n =0 ;
@@ -367,7 +367,7 @@ static int post_one_send(struct hfi1_qp *qp, struct ib_send_wr *wr)int i;int j;int acc; -struct hfi1_lkey_table *rkt; +struct rvt_lkey_table *rkt;struct rvt_pd *pd;struct hfi1_devdata *dd =dd_from_ibdev (qp->ibqp.device);struct hfi1_pportdata *ppd;
@@ -725,7 +725,7 @@ void update_sge(struct hfi1_sge_state *ss, u32 length)if (--ss->num_sge) *sge = *ss->sg_list++; }else if (sge->length ==0 && sge->mr->lkey) { -if (++sge->n >=HFI1_SEGSZ ) { +if (++sge->n >=RVT_SEGSZ ) {if (++sge->m >= sge->mr->mapsz)return ; sge->n =0 ;
@@ -1883,13 +1883,13 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)spin_lock_init (&dev->lk_table.lock); dev->lk_table.max =1 << hfi1_lkey_table_size;/* ensure generation is at least 4 bits (keys.c) */ -if (hfi1_lkey_table_size >MAX_LKEY_TABLE_BITS ) { +if (hfi1_lkey_table_size >RVT_MAX_LKEY_TABLE_BITS ) {dd_dev_warn (dd,"lkey bits %u too large, reduced to %u\n" , - hfi1_lkey_table_size,MAX_LKEY_TABLE_BITS ); - hfi1_lkey_table_size =MAX_LKEY_TABLE_BITS ; + hfi1_lkey_table_size,RVT_MAX_LKEY_TABLE_BITS ); + hfi1_lkey_table_size =RVT_MAX_LKEY_TABLE_BITS ; } lk_tab_size = dev->lk_table.max *sizeof (*dev->lk_table.table); - dev->lk_table.table = (struct hfi1_mregion __rcu **) + dev->lk_table.table = (struct rvt_mregion __rcu **)vmalloc (lk_tab_size);if (dev->lk_table.table ==NULL ) { ret = -ENOMEM ;
drivers/staging/rdma/hfi1/verbs.h +10 -53
119 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/31 staging/rdma/hfi1: Remove driver specific members from hfi1 qp type
In reply to a message not in the archiveIn preparation for moving the queue pair data structure to rdmavt the members of the driver specific queue pairs which are not common need to be pushed off to a private driver structure. This structure will be available in the queue pair once moved to rdmavt as a void pointer. This patch while not adding a lot of value in and of itself is a prerequisite to move the queue pair out of the drivers and into rdmavt.
The driver specific, private queue pair data structure should condense as more of the send side code moves to rdmavt.
--- drivers/staging/rdma/hfi1/diag.c | 3 + drivers/staging/rdma/hfi1/pio.c | 6 ++- drivers/staging/rdma/hfi1/qp.c | 78 ++++++++++++++++++++++++------------- drivers/staging/rdma/hfi1/qp.h | 15 ++++--- drivers/staging/rdma/hfi1/rc.c | 17 +++++--- drivers/staging/rdma/hfi1/ruc.c | 48 ++++++++++++----------- drivers/staging/rdma/hfi1/uc.c | 7 ++- drivers/staging/rdma/hfi1/ud.c | 37 +++++++++--------- drivers/staging/rdma/hfi1/verbs.c | 57 +++++++++++++++++---------- drivers/staging/rdma/hfi1/verbs.h | 30 +++++++++++--- 10 files changed, 182 insertions(+), 116 deletions(-)
drivers/staging/rdma/hfi1/diag.c +2 -1
@@ -1619,7 +1619,8 @@ int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,int snoop_send_pio_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps,u64 pbc) { -struct ahg_ib_header *ahdr = qp->s_hdr; +struct hfi1_qp_priv *priv = qp->priv; +struct ahg_ib_header *ahdr = priv->s_hdr;u32 hdrwords = qp->s_hdrwords;struct hfi1_sge_state *ss = qp->s_cur_sge;u32 len = qp->s_cur_size;
drivers/staging/rdma/hfi1/pio.c +4 -2
@@ -1528,6 +1528,7 @@ static void sc_piobufavail(struct send_context *sc)struct list_head *list;struct hfi1_qp *qps[PIO_WAIT_BATCH_SIZE ];struct hfi1_qp *qp; +struct hfi1_qp_priv *priv;unsigned long flags;unsigned i, n =0 ;
@@ -1547,8 +1548,9 @@ static void sc_piobufavail(struct send_context *sc)if (n ==ARRAY_SIZE (qps)) goto full; wait = list_first_entry(list, struct iowait, list); - qp = container_of(wait, struct hfi1_qp, s_iowait); -list_del_init (&qp->s_iowait.list); + qp =iowait_to_qp (wait); + priv = qp->priv; +list_del_init (&priv->s_iowait.list);/* refcount held until actual wake up */ qps[n++] = qp; }
drivers/staging/rdma/hfi1/qp.c +50 -28
245 lines not on this page · raw message
drivers/staging/rdma/hfi1/qp.h +9 -6
@@ -123,10 +123,12 @@ static inline struct hfi1_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp,*/ static inline void clear_ahg (struct hfi1_qp *qp) { - qp->s_hdr->ahgcount =0 ; +struct hfi1_qp_priv *priv = qp->priv; + + priv->s_hdr->ahgcount =0 ; qp->s_flags &= ~(HFI1_S_AHG_VALID |HFI1_S_AHG_CLEAR ); -if (qp->s_sde && qp->s_ahgidx >=0 ) -sdma_ahg_free (qp->s_sde, qp->s_ahgidx); +if (priv->s_sde && qp->s_ahgidx >=0 ) +sdma_ahg_free (priv->s_sde, qp->s_ahgidx); qp->s_ahgidx =-1 ; }
@@ -257,14 +259,15 @@ void qp_comm_est(struct hfi1_qp *qp);*/ static inline void _hfi1_schedule_send (struct hfi1_qp *qp) { +struct hfi1_qp_priv *priv = qp->priv;struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num);struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);struct hfi1_devdata *dd =dd_from_ibdev (qp->ibqp.device); -iowait_schedule (&qp->s_iowait, ppd->hfi1_wq, - qp->s_sde ? - qp->s_sde->cpu : +iowait_schedule (&priv->s_iowait, ppd->hfi1_wq, + priv->s_sde ? + priv->s_sde->cpu :cpumask_first (cpumask_of_node (dd->assigned_node_id))); }
drivers/staging/rdma/hfi1/rc.c +11 -6
@@ -259,6 +259,7 @@ bail:*/ int hfi1_make_rc_req (struct hfi1_qp *qp) { +struct hfi1_qp_priv *priv = qp->priv;struct hfi1_ibdev *dev =to_idev (qp->ibqp.device);struct hfi1_other_headers *ohdr;struct hfi1_sge_state *ss;
@@ -275,9 +276,9 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)int middle =0 ;int delta; - ohdr = &qp->s_hdr->ibh.u.oth; + ohdr = &priv->s_hdr->ibh.u.oth;if (qp->remote_ah_attr.ah_flags &IB_AH_GRH ) - ohdr = &qp->s_hdr->ibh.u.l.oth; + ohdr = &priv->s_hdr->ibh.u.l.oth;/* * The lock is needed to synchronize between the sending tasklet,
@@ -297,7 +298,7 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)if (qp->s_last == qp->s_head) goto bail;/* If DMAs are in progress, we can't flush immediately. */ -if (atomic_read (&qp->s_iowait.sdma_busy)) { +if (atomic_read (&priv->s_iowait.sdma_busy)) { qp->s_flags |=HFI1_S_WAIT_DMA ; goto bail; }
@@ -1620,7 +1621,9 @@ static inline void rc_defered_ack(struct hfi1_ctxtdata *rcd,static inline void rc_cancel_ack (struct hfi1_qp *qp) { - qp->r_adefered =0 ; +struct hfi1_qp_priv *priv = qp->priv; + + priv->r_adefered =0 ;if (list_empty (&qp->rspwait))return ;list_del_init (&qp->rspwait);
@@ -2347,11 +2350,13 @@ send_last: qp->r_nak_state =0 ;/* Send an ACK if requested or required. */ if (psn &IB_BTH_REQ_ACK ) { +struct hfi1_qp_priv *priv = qp->priv; +if (packet->numpkt ==0 ) {rc_cancel_ack (qp); goto send_ack; } -if (qp->r_adefered >=HFI1_PSN_CREDIT ) { +if (priv->r_adefered >=HFI1_PSN_CREDIT ) {rc_cancel_ack (qp); goto send_ack; }
@@ -2359,7 +2364,7 @@ send_last:rc_cancel_ack (qp); goto send_ack; } - qp->r_adefered++; + priv->r_adefered++;rc_defered_ack (rcd, qp); }return ;
drivers/staging/rdma/hfi1/ruc.c +25 -23
107 lines not on this page · raw message
drivers/staging/rdma/hfi1/uc.c +4 -3
@@ -63,6 +63,7 @@*/ int hfi1_make_uc_req (struct hfi1_qp *qp) { +struct hfi1_qp_priv *priv = qp->priv;struct hfi1_other_headers *ohdr;struct hfi1_swqe *wqe;unsigned long flags;
@@ -82,7 +83,7 @@ int hfi1_make_uc_req(struct hfi1_qp *qp)if (qp->s_last == qp->s_head) goto bail;/* If DMAs are in progress, we can't flush immediately. */ -if (atomic_read (&qp->s_iowait.sdma_busy)) { +if (atomic_read (&priv->s_iowait.sdma_busy)) { qp->s_flags |=HFI1_S_WAIT_DMA ; goto bail; }
@@ -92,9 +93,9 @@ int hfi1_make_uc_req(struct hfi1_qp *qp) goto done; } - ohdr = &qp->s_hdr->ibh.u.oth; + ohdr = &priv->s_hdr->ibh.u.oth;if (qp->remote_ah_attr.ah_flags &IB_AH_GRH ) - ohdr = &qp->s_hdr->ibh.u.l.oth; + ohdr = &priv->s_hdr->ibh.u.l.oth;/* Get the next send request. */ wqe =get_swqe_ptr (qp, qp->s_cur);
drivers/staging/rdma/hfi1/ud.c +19 -18
@@ -264,6 +264,7 @@ drop:*/ int hfi1_make_ud_req (struct hfi1_qp *qp) { +struct hfi1_qp_priv *priv = qp->priv;struct hfi1_other_headers *ohdr;struct ib_ah_attr *ah_attr;struct hfi1_pportdata *ppd;
@@ -288,7 +289,7 @@ int hfi1_make_ud_req(struct hfi1_qp *qp)if (qp->s_last == qp->s_head) goto bail;/* If DMAs are in progress, we can't flush immediately. */ -if (atomic_read (&qp->s_iowait.sdma_busy)) { +if (atomic_read (&priv->s_iowait.sdma_busy)) { qp->s_flags |=HFI1_S_WAIT_DMA ; goto bail; }
@@ -322,7 +323,7 @@ int hfi1_make_ud_req(struct hfi1_qp *qp)* Instead of waiting, we could queue a * zero length descriptor so we get a callback. */ -if (atomic_read (&qp->s_iowait.sdma_busy)) { +if (atomic_read (&priv->s_iowait.sdma_busy)) { qp->s_flags |=HFI1_S_WAIT_DMA ; goto bail; }
@@ -353,11 +354,11 @@ int hfi1_make_ud_req(struct hfi1_qp *qp)if (ah_attr->ah_flags &IB_AH_GRH ) {/* Header size in 32-bit words. */ - qp->s_hdrwords +=hfi1_make_grh (ibp, &qp->s_hdr->ibh.u.l.grh, + qp->s_hdrwords +=hfi1_make_grh (ibp, &priv->s_hdr->ibh.u.l.grh, &ah_attr->grh, qp->s_hdrwords, nwords); lrh0 =HFI1_LRH_GRH ; - ohdr = &qp->s_hdr->ibh.u.l.oth; + ohdr = &priv->s_hdr->ibh.u.l.oth;/* * Don't worry about sending to locally attached multicast * QPs. It is unspecified by the spec. what happens.
@@ -365,7 +366,7 @@ int hfi1_make_ud_req(struct hfi1_qp *qp) }else {/* Header size in 32-bit words. */ lrh0 =HFI1_LRH_BTH ; - ohdr = &qp->s_hdr->ibh.u.oth; + ohdr = &priv->s_hdr->ibh.u.oth; }if (wqe->wr.opcode ==IB_WR_SEND_WITH_IMM ) { qp->s_hdrwords++;
@@ -377,25 +378,25 @@ int hfi1_make_ud_req(struct hfi1_qp *qp) lrh0 |= (ah_attr->sl &0xf ) <<4 ;if (qp->ibqp.qp_type ==IB_QPT_SMI ) { lrh0 |=0xF000 ;/* Set VL (see ch. 13.5.3.1) */ - qp->s_sc =0xf ; + priv->s_sc =0xf ; }else { lrh0 |= (sc5 &0xf ) <<12 ; - qp->s_sc = sc5; + priv->s_sc = sc5; } - qp->s_sde =qp_to_sdma_engine (qp, qp->s_sc); - qp->s_hdr->ibh.lrh[0 ] =cpu_to_be16 (lrh0); - qp->s_hdr->ibh.lrh[1 ] =cpu_to_be16 (ah_attr->dlid);/* DEST LID */ - qp->s_hdr->ibh.lrh[2 ] = + priv->s_sde =qp_to_sdma_engine (qp, priv->s_sc); + priv->s_hdr->ibh.lrh[0 ] =cpu_to_be16 (lrh0); + priv->s_hdr->ibh.lrh[1 ] =cpu_to_be16 (ah_attr->dlid);/* DEST LID */ + priv->s_hdr->ibh.lrh[2 ] =cpu_to_be16 (qp->s_hdrwords + nwords +SIZE_OF_CRC );if (ah_attr->dlid ==be16_to_cpu (IB_LID_PERMISSIVE )) - qp->s_hdr->ibh.lrh[3 ] =IB_LID_PERMISSIVE ; + priv->s_hdr->ibh.lrh[3 ] =IB_LID_PERMISSIVE ;else { lid = ppd->lid;if (lid) { lid |= ah_attr->src_path_bits & ((1 << ppd->lmc) -1 ); - qp->s_hdr->ibh.lrh[3 ] =cpu_to_be16 (lid); + priv->s_hdr->ibh.lrh[3 ] =cpu_to_be16 (lid); }else - qp->s_hdr->ibh.lrh[3 ] =IB_LID_PERMISSIVE ; + priv->s_hdr->ibh.lrh[3 ] =IB_LID_PERMISSIVE ; }if (wqe->wr.send_flags &IB_SEND_SOLICITED ) bth0 |=IB_BTH_SOLICITED ;
@@ -415,10 +416,10 @@ int hfi1_make_ud_req(struct hfi1_qp *qp) qp->qkey : wqe->ud_wr.remote_qkey); ohdr->u.ud.deth[1 ] =cpu_to_be32 (qp->ibqp.qp_num);/* disarm any ahg */ - qp->s_hdr->ahgcount =0 ; - qp->s_hdr->ahgidx =0 ; - qp->s_hdr->tx_flags =0 ; - qp->s_hdr->sde =NULL ; + priv->s_hdr->ahgcount =0 ; + priv->s_hdr->ahgidx =0 ; + priv->s_hdr->tx_flags =0 ; + priv->s_hdr->sde =NULL ; done: ret =1 ;
drivers/staging/rdma/hfi1/verbs.c +35 -22
197 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +23 -7
@@ -387,6 +387,20 @@ struct hfi1_ack_entry { };/* +* hfi1 specific data structures that will be hidden from rvt after the queue +* pair is made common +*/ +struct hfi1_qp ; +struct hfi1_qp_priv { +struct ahg_ib_header *s_hdr;/* next packet header to send */ +struct sdma_engine *s_sde;/* current sde */ +u8 s_sc;/* SC[0..4] for next packet */ +u8 r_adefered;/* number of acks defered */ +struct iowait s_iowait; +struct hfi1_qp *owner; +}; + +/* * Variables prefixed with s_ are for the requester (sender). * Variables prefixed with r_ are for the responder (receiver). * Variables prefixed with ack_ are for responder replies.
@@ -396,16 +410,13 @@ struct hfi1_ack_entry {*/ struct hfi1_qp {struct ib_qp ibqp; +void *priv;/* read mostly fields above and below */ struct ib_ah_attr remote_ah_attr;struct ib_ah_attr alt_ah_attr;struct hfi1_qp __rcu *next;/* link list for QPN hash table */ struct hfi1_swqe *s_wq;/* send work queue */ struct hfi1_mmap_info *ip; -struct ahg_ib_header *s_hdr;/* next packet header to send */ -struct sdma_engine *s_sde;/* current sde */ -/* sc for UC/RC QPs - based on ah for UD */ -u8 s_sc;unsigned long timeout_jiffies;/* computed from timeout */ enum ib_mtu path_mtu;
@@ -453,7 +464,6 @@ struct hfi1_qp {u32 r_psn;/* expected rcv packet sequence number */ u32 r_msn;/* message sequence number */ -u8 r_adefered;/* number of acks defered */ u8 r_state;/* opcode of last packet received */ u8 r_flags;u8 r_head_ack_queue;/* index into s_ack_queue[] */
@@ -501,8 +511,6 @@ struct hfi1_qp {struct hfi1_sge_state s_ack_rdma_sge;struct timer_list s_timer; -struct iowait s_iowait; -struct hfi1_sge r_sg_list[0 ]/* verified SGEs */ ____cacheline_aligned_in_smp ; };
@@ -794,6 +802,14 @@ static inline struct hfi1_ibdev *to_idev(struct ib_device *ibdev) return container_of(rdi, struct hfi1_ibdev, rdi); } +static inline struct hfi1_qp *iowait_to_qp (struct iowait *s_iowait) +{ +struct hfi1_qp_priv *priv; + + priv = container_of(s_iowait, struct hfi1_qp_priv, s_iowait); +return priv->owner; +} +/* * Send if not busy or waiting for I/O and either * a RC response is pending or we can process send work requests.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/31 staging/rdma/hfi1: Add device specific info prints
In reply to a message not in the archiveImplement get_card_name and get_pci_dev helper functions for rdmavt for hfi1.
--- drivers/staging/rdma/hfi1/driver.c | 16 ++++++++++++++++ drivers/staging/rdma/hfi1/hfi.h | 2 ++ drivers/staging/rdma/hfi1/verbs.c | 2 ++ 3 files changed, 20 insertions(+), 0 deletions(-)
drivers/staging/rdma/hfi1/driver.c +16 -0
@@ -162,6 +162,22 @@ const char *get_unit_name(int unit)return iname; } +const char *get_card_name (struct rvt_dev_info *rdi) +{ + struct hfi1_ibdev *ibdev = container_of(rdi, struct hfi1_ibdev, rdi); +struct hfi1_devdata *dd =container_of (ibdev, + struct hfi1_devdata, verbs_dev); +return get_unit_name (dd->unit); +} + +struct pci_dev *get_pci_dev (struct rvt_dev_info *rdi) +{ + struct hfi1_ibdev *ibdev = container_of(rdi, struct hfi1_ibdev, rdi); +struct hfi1_devdata *dd =container_of (ibdev, + struct hfi1_devdata, verbs_dev); +return dd->pcidev; +} +/* * Return count of units with at least one port ACTIVE. */
drivers/staging/rdma/hfi1/hfi.h +2 -0
@@ -1660,6 +1660,8 @@ int get_platform_config_field(struct hfi1_devdata *dd, int table_index, int field_index, u32 *data, u32 len);const char *get_unit_name (int unit); +const char *get_card_name (struct rvt_dev_info *rdi); +struct pci_dev *get_pci_dev (struct rvt_dev_info *rdi);/* * Flush write combining store buffers (if present) and perform a write
drivers/staging/rdma/hfi1/verbs.c +2 -0
@@ -2031,6 +2031,8 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)* Fill in rvt info object. */ dd->verbs_dev.rdi.driver_f.port_callback = hfi1_create_port_files; + dd->verbs_dev.rdi.driver_f.get_card_name = get_card_name; + dd->verbs_dev.rdi.driver_f.get_pci_dev = get_pci_dev; dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds; dd->verbs_dev.rdi.flags = (RVT_FLAG_MR_INIT_DRIVER | RVT_FLAG_QP_INIT_DRIVER |
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/31 staging/rdma/hfi1: Use correct rdmavt header files after move.
In reply to a message not in the archiveRdmavt split the header files to be based on ibta object. This patch makes changes in hfi1 to account for the move.
--- drivers/staging/rdma/hfi1/driver.c | 3 ++- drivers/staging/rdma/hfi1/mad.c | 4 ++-- drivers/staging/rdma/hfi1/qp.c | 5 +++-- drivers/staging/rdma/hfi1/ud.c | 14 +++++++------- drivers/staging/rdma/hfi1/verbs.c | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-)
drivers/staging/rdma/hfi1/driver.c +2 -1
@@ -56,6 +56,7 @@#include <linux/vmalloc.h> #include <linux/module.h> #include <linux/prefetch.h> +#include <rdma/ib_verbs.h> #include "hfi.h" #include "trace.h"
@@ -316,7 +317,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,/* Get the destination QP number. */ qp_num =be32_to_cpu (ohdr->bth[1 ]) &HFI1_QPN_MASK ; -if (lid <HFI1_MULTICAST_LID_BASE ) { +if (lid <be16_to_cpu (IB_MULTICAST_LID_BASE )) {struct hfi1_qp *qp;unsigned long flags;
drivers/staging/rdma/hfi1/mad.c +2 -2
@@ -1097,7 +1097,7 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,/* Must be a valid unicast LID address. */ if ((lid ==0 && ls_old >IB_PORT_INIT ) || - lid >=HFI1_MULTICAST_LID_BASE ) { + lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) { smp->status |=IB_SMP_INVALID_FIELD ;pr_warn ("SubnSet(OPA_PortInfo) lid invalid 0x%x\n" , lid);
@@ -1130,7 +1130,7 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,/* Must be a valid unicast LID address. */ if ((smlid ==0 && ls_old >IB_PORT_INIT ) || - smlid >=HFI1_MULTICAST_LID_BASE ) { + smlid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) { smp->status |=IB_SMP_INVALID_FIELD ;pr_warn ("SubnSet(OPA_PortInfo) smlid invalid 0x%x\n" , smlid); }else if (smlid != ibp->sm_lid || msl != ibp->sm_sl) {
drivers/staging/rdma/hfi1/qp.c +3 -2
@@ -640,7 +640,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,if (attr_mask &IB_QP_AV ) {u8 sc; -if (attr->ah_attr.dlid >=HFI1_MULTICAST_LID_BASE ) +if (attr->ah_attr.dlid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) goto inval;if (hfi1_check_ah (qp->ibqp.device, &attr->ah_attr)) goto inval;
@@ -653,7 +653,8 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,if (attr_mask &IB_QP_ALT_PATH ) {u8 sc; -if (attr->alt_ah_attr.dlid >=HFI1_MULTICAST_LID_BASE ) +if (attr->alt_ah_attr.dlid >= +be16_to_cpu (IB_MULTICAST_LID_BASE )) goto inval;if (hfi1_check_ah (qp->ibqp.device, &attr->alt_ah_attr)) goto inval;
drivers/staging/rdma/hfi1/ud.c +7 -7
@@ -242,7 +242,7 @@ static void ud_loopback(struct hfi1_qp *sqp, struct hfi1_swqe *swqe) wc.slid = ppd->lid | (ah_attr->src_path_bits & ((1 << ppd->lmc) -1 ));/* Check for loopback when the port lid is not set */ if (wc.slid ==0 && sqp->ibqp.qp_type ==IB_QPT_GSI ) - wc.slid =HFI1_PERMISSIVE_LID ; + wc.slid =be16_to_cpu (IB_LID_PERMISSIVE ); wc.sl = ah_attr->sl; wc.dlid_path_bits = ah_attr->dlid & ((1 << ppd->lmc) -1 ); wc.port_num = qp->port_num;
@@ -310,11 +310,11 @@ int hfi1_make_ud_req(struct hfi1_qp *qp) ibp =to_iport (qp->ibqp.device, qp->port_num); ppd =ppd_from_ibp (ibp); ah_attr = &to_iah (wqe->ud_wr.ah)->attr; -if (ah_attr->dlid <HFI1_MULTICAST_LID_BASE || - ah_attr->dlid ==HFI1_PERMISSIVE_LID ) { +if (ah_attr->dlid <be16_to_cpu (IB_MULTICAST_LID_BASE ) || + ah_attr->dlid ==be16_to_cpu (IB_LID_PERMISSIVE )) { lid = ah_attr->dlid & ~((1 << ppd->lmc) -1 );if (unlikely (!loopback && (lid == ppd->lid || - (lid ==HFI1_PERMISSIVE_LID && + (lid ==be16_to_cpu (IB_LID_PERMISSIVE ) && qp->ibqp.qp_type ==IB_QPT_GSI )))) {/* * If DMAs are in progress, we can't generate
@@ -666,8 +666,8 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) qkey =be32_to_cpu (ohdr->u.ud.deth[0 ]); src_qp =be32_to_cpu (ohdr->u.ud.deth[1 ]) &HFI1_QPN_MASK ; dlid =be16_to_cpu (hdr->lrh[1 ]); - is_mcast = (dlid >HFI1_MULTICAST_LID_BASE ) && - (dlid !=HFI1_PERMISSIVE_LID ); + is_mcast = (dlid >be16_to_cpu (IB_MULTICAST_LID_BASE )) && + (dlid !=be16_to_cpu (IB_LID_PERMISSIVE )); bth1 =be32_to_cpu (ohdr->bth[1 ]);if (unlikely (bth1 &HFI1_BECN_SMASK )) {/*
@@ -874,7 +874,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)/* * Save the LMC lower bits if the destination LID is a unicast LID. */ - wc.dlid_path_bits = dlid >=HFI1_MULTICAST_LID_BASE ?0 : + wc.dlid_path_bits = dlid >=be16_to_cpu (IB_MULTICAST_LID_BASE ) ?0 : dlid & ((1 <<ppd_from_ibp (ibp)->lmc) -1 ); wc.port_num = qp->port_num;/* Signal completion event if the solicited bit is set. */
drivers/staging/rdma/hfi1/verbs.c +2 -2
@@ -646,8 +646,8 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)/* Get the destination QP number. */ qp_num =be32_to_cpu (packet->ohdr->bth[1 ]) &HFI1_QPN_MASK ; lid =be16_to_cpu (hdr->lrh[1 ]); -if (unlikely ((lid >=HFI1_MULTICAST_LID_BASE ) && - (lid !=HFI1_PERMISSIVE_LID ))) { +if (unlikely ((lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) && + (lid !=be16_to_cpu (IB_LID_PERMISSIVE )))) {struct hfi1_mcast *mcast;struct hfi1_mcast_qp *p;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/31 staging/rdma/hfi1: Use address handle in rdmavt and remove from hfi1
In reply to a message not in the archiveOriginal patch from Kamal Heib <kamalh-VPRAkNaXOzVWk0Htik3J/[email protected]>, split apart from original and modified to accomodate recent changes
in rdmavt.
Remove AH from hfi1 and use rdmavt version.
--- drivers/staging/rdma/hfi1/common.h | 2 - drivers/staging/rdma/hfi1/mad.c | 2 - drivers/staging/rdma/hfi1/qp.c | 6 +- drivers/staging/rdma/hfi1/ruc.c | 2 - drivers/staging/rdma/hfi1/ud.c | 4 + drivers/staging/rdma/hfi1/verbs.c | 131 ++---------------------------------- drivers/staging/rdma/hfi1/verbs.h | 20 +---- 7 files changed, 18 insertions(+), 149 deletions(-)
drivers/staging/rdma/hfi1/common.h +0 -2
@@ -341,7 +341,6 @@ struct hfi1_message_header {#define FULL_MGMT_P_KEY 0xFFFF#define DEFAULT_P_KEY LIM_MGMT_P_KEY -#define HFI1_PERMISSIVE_LID 0xFFFF#define HFI1_AETH_CREDIT_SHIFT 24#define HFI1_AETH_CREDIT_MASK 0x1F#define HFI1_AETH_CREDIT_INVAL 0x1F
@@ -353,7 +352,6 @@ struct hfi1_message_header {#define HFI1_BECN_SHIFT 30#define HFI1_BECN_MASK 1#define HFI1_BECN_SMASK BIT(HFI1_BECN_SHIFT) -#define HFI1_MULTICAST_LID_BASE 0xC000static inline __u64 rhf_to_cpu (const __le32 *rbuf) {
drivers/staging/rdma/hfi1/mad.c +1 -1
@@ -137,7 +137,7 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) ret =PTR_ERR (ah); else { send_buf->ah = ah; - ibp->sm_ah =to_iah (ah); + ibp->sm_ah =ibah_to_rvtah (ah); ret =0 ; } }else
drivers/staging/rdma/hfi1/qp.c +3 -3
@@ -424,7 +424,7 @@ static void clear_mr_refs(struct hfi1_qp *qp, int clr_sends)if (qp->ibqp.qp_type ==IB_QPT_UD || qp->ibqp.qp_type ==IB_QPT_SMI || qp->ibqp.qp_type ==IB_QPT_GSI ) -atomic_dec (&to_iah (wqe->ud_wr.ah)->refcount); +atomic_dec (&ibah_to_rvtah (wqe->ud_wr.ah)->refcount);if (++qp->s_last >= qp->s_size) qp->s_last =0 ; }
@@ -642,7 +642,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,if (attr->ah_attr.dlid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) goto inval; -if (hfi1_check_ah (qp->ibqp.device, &attr->ah_attr)) +if (rvt_check_ah (qp->ibqp.device, &attr->ah_attr)) goto inval; sc =ah_to_sc (ibqp->device, &attr->ah_attr); if (!qp_to_sdma_engine(qp, sc) &&
@@ -656,7 +656,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,if (attr->alt_ah_attr.dlid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) goto inval; -if (hfi1_check_ah (qp->ibqp.device, &attr->alt_ah_attr)) +if (rvt_check_ah (qp->ibqp.device, &attr->alt_ah_attr)) goto inval;if (attr->alt_pkey_index >=hfi1_get_npkeys (dd)) goto inval;
drivers/staging/rdma/hfi1/ruc.c +1 -1
@@ -893,7 +893,7 @@ void hfi1_send_complete(struct hfi1_qp *qp, struct hfi1_swqe *wqe,if (qp->ibqp.qp_type ==IB_QPT_UD || qp->ibqp.qp_type ==IB_QPT_SMI || qp->ibqp.qp_type ==IB_QPT_GSI ) -atomic_dec (&to_iah (wqe->ud_wr.ah)->refcount); +atomic_dec (&ibah_to_rvtah (wqe->ud_wr.ah)->refcount);/* See ch. 11.2.4.1 and 10.7.3.1 */ if (!(qp->s_flags & HFI1_S_SIGNAL_REQ_WR) ||
drivers/staging/rdma/hfi1/ud.c +2 -2
@@ -98,7 +98,7 @@ static void ud_loopback(struct hfi1_qp *sqp, struct hfi1_swqe *swqe) goto drop; } - ah_attr = &to_iah (swqe->ud_wr.ah)->attr; + ah_attr = &ibah_to_rvtah (swqe->ud_wr.ah)->attr; ppd =ppd_from_ibp (ibp);if (qp->ibqp.qp_num >1 ) {
@@ -309,7 +309,7 @@ int hfi1_make_ud_req(struct hfi1_qp *qp)/* Construct the header. */ ibp =to_iport (qp->ibqp.device, qp->port_num); ppd =ppd_from_ibp (ibp); - ah_attr = &to_iah (wqe->ud_wr.ah)->attr; + ah_attr = &ibah_to_rvtah (wqe->ud_wr.ah)->attr;if (ah_attr->dlid <be16_to_cpu (IB_MULTICAST_LID_BASE ) || ah_attr->dlid ==be16_to_cpu (IB_LID_PERMISSIVE )) { lid = ah_attr->dlid & ~((1 << ppd->lmc) -1 );
drivers/staging/rdma/hfi1/verbs.c +9 -122
180 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +2 -18
@@ -234,13 +234,6 @@ struct hfi1_mcast {int n_attached; }; -/* Address Handle */ -struct hfi1_ah { -struct ib_ah ibah; -struct ib_ah_attr attr; -atomic_t refcount; -}; -/* * This structure is used by hfi1_mmap() to validate an offset * when an mmap() request is made. The vm_area_struct then uses
@@ -652,8 +645,8 @@ static inline void inc_opstats(struct hfi1_ibport {struct hfi1_qp __rcu *qp[2 ];struct ib_mad_agent *send_agent;/* agent for SMI (traps) */ -struct hfi1_ah *sm_ah; -struct hfi1_ah *smi_ah; +struct rvt_ah *sm_ah; +struct rvt_ah *smi_ah;struct rb_root mcast_tree;spinlock_t lock;/* protect changes in this struct */
@@ -735,8 +728,6 @@ struct hfi1_ibdev {u64 n_kmem_wait;u64 n_send_schedule; -u32 n_ahs_allocated;/* number of AHs allocated for device */ -spinlock_t n_ahs_lock;u32 n_cqs_allocated;/* number of CQs allocated for device */ spinlock_t n_cqs_lock;u32 n_qps_allocated;/* number of QPs allocated for device */
@@ -774,11 +765,6 @@ static inline struct hfi1_mr *to_imr(struct ib_mr *ibmr) return container_of(ibmr, struct hfi1_mr, ibmr); } -static inline struct hfi1_ah *to_iah (struct ib_ah *ibah) -{ - return container_of(ibah, struct hfi1_ah, ibah); -} -static inline struct hfi1_cq *to_icq (struct ib_cq *ibcq) { return container_of(ibcq, struct hfi1_cq, ibcq);
@@ -925,8 +911,6 @@ void hfi1_rc_hdrerr(u8 ah_to_sc (struct ib_device *ibdev,struct ib_ah_attr *ah_attr); -int hfi1_check_ah (struct ib_device *ibdev,struct ib_ah_attr *ah_attr); -struct ib_ah *hfi1_create_qp0_ah (struct hfi1_ibport *ibp,u16 dlid);void hfi1_rc_rnr_retry (unsigned long arg);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/31 staging/rdma/hfi1: Implement hfi1 support for AH notification
In reply to a message not in the archiveFor OPA devices additional work is required to create an AH. This patch adds support to set the VL correctly.
--- drivers/staging/rdma/hfi1/verbs.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +24 -0
@@ -1630,6 +1630,29 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)return 0 ; } +static void hfi1_notify_new_ah (struct ib_device *ibdev, +struct ib_ah_attr *ah_attr, +struct rvt_ah *ah) +{ +struct hfi1_ibport *ibp; +struct hfi1_pportdata *ppd; +struct hfi1_devdata *dd; +u8 sc5; + +/* +* Do not trust reading anything from rvt_ah at this point as it is not +* done being setup. We can however modify things which we need to set. +*/ + + ibp =to_iport (ibdev, ah_attr->port_num); + ppd =ppd_from_ibp (ibp); + sc5 = ibp->sl_to_sc[ah->attr.sl]; + dd =dd_from_ppd (ppd); + ah->vl =sc_to_vlt (dd, sc5); +if (ah->vl < num_vls || ah->vl ==15 ) + ah->log_pmtu =ilog2 (dd->vld[ah->vl].mtu); +} +struct ib_ah *hfi1_create_qp0_ah (struct hfi1_ibport *ibp,u16 dlid) {struct ib_ah_attr attr;
@@ -1919,6 +1942,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) dd->verbs_dev.rdi.driver_f.get_card_name = get_card_name; dd->verbs_dev.rdi.driver_f.get_pci_dev = get_pci_dev; dd->verbs_dev.rdi.driver_f.check_ah = hfi1_check_ah; + dd->verbs_dev.rdi.driver_f.notify_new_ah = hfi1_notify_new_ah; dd->verbs_dev.rdi.dparms.props.max_ah = hfi1_max_ahs; dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds; dd->verbs_dev.rdi.flags = (RVT_FLAG_MR_INIT_DRIVER |
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/31 staging/rdma/hfi1: Remove hfi1 MR and hfi1 specific qp type
In reply to a message not in the archiveThis patch does the actual removal of the queue pair from the hfi1 driver along with a number of dependent data structures. These were moved to rvt.
It also removes the MR functions to use those in rdmavt.
These two pieces can not reasonably be split apart becuase they depend on each other.
--- drivers/staging/rdma/hfi1/Makefile | 2 drivers/staging/rdma/hfi1/cq.c | 2 drivers/staging/rdma/hfi1/diag.c | 8 - drivers/staging/rdma/hfi1/driver.c | 10 - drivers/staging/rdma/hfi1/hfi.h | 16 + drivers/staging/rdma/hfi1/keys.c | 356 ----------------------- drivers/staging/rdma/hfi1/mmap.c | 24 +- drivers/staging/rdma/hfi1/mr.c | 473 ------------------------------- drivers/staging/rdma/hfi1/pio.c | 4 drivers/staging/rdma/hfi1/qp.c | 88 +++--- drivers/staging/rdma/hfi1/qp.h | 33 +- drivers/staging/rdma/hfi1/rc.c | 116 ++++---- drivers/staging/rdma/hfi1/ruc.c | 75 ++--- drivers/staging/rdma/hfi1/sdma.h | 6 drivers/staging/rdma/hfi1/srq.c | 28 +- drivers/staging/rdma/hfi1/trace.h | 22 + drivers/staging/rdma/hfi1/uc.c | 10 - drivers/staging/rdma/hfi1/ud.c | 18 + drivers/staging/rdma/hfi1/verbs.c | 141 ++++----- drivers/staging/rdma/hfi1/verbs.h | 366 +++--------------------- drivers/staging/rdma/hfi1/verbs_mcast.c | 8 - 21 files changed, 337 insertions(+), 1469 deletions(-) delete mode 100644 drivers/staging/rdma/hfi1/keys.c delete mode 100644 drivers/staging/rdma/hfi1/mr.c
drivers/staging/rdma/hfi1/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o hfi1-y := chip.o cq.o device.o diag.o driver.o efivar.o eprom.o file_ops.o firmware.o \ - init.o intr.o keys.o mad.o mmap.o mr.o pcie.o pio.o pio_copy.o \ + init.o intr.o mad.o mmap.o pcie.o pio.o pio_copy.o \ qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \ uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs_mcast.o verbs.o hfi1-$(CONFIG_DEBUG_FS) += debugfs.o
drivers/staging/rdma/hfi1/cq.c +1 -1
@@ -479,7 +479,7 @@ int hfi1_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)if (cq->ip) {struct hfi1_ibdev *dev =to_idev (ibcq->device); -struct hfi1_mmap_info *ip = cq->ip; +struct rvt_mmap_info *ip = cq->ip;hfi1_update_mmap_info (dev, ip, sz, wc);
drivers/staging/rdma/hfi1/diag.c +4 -4
@@ -1603,7 +1603,7 @@ int snoop_recv_handler(struct hfi1_packet *packet)/* * Handle snooping and capturing packets when sdma is being used. */ -int snoop_send_dma_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +int snoop_send_dma_handler (struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc) {pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" );
@@ -1616,13 +1616,13 @@ int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,* bypass packets. The only way to send a bypass packet currently is to use the * diagpkt interface. When that interface is enable snoop/capture is not. */ -int snoop_send_pio_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +int snoop_send_pio_handler (struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc) {struct hfi1_qp_priv *priv = qp->priv;struct ahg_ib_header *ahdr = priv->s_hdr;u32 hdrwords = qp->s_hdrwords; -struct hfi1_sge_state *ss = qp->s_cur_sge; +struct rvt_sge_state *ss = qp->s_cur_sge;u32 len = qp->s_cur_size;u32 dwords = (len +3 ) >>2 ;u32 plen = hdrwords + dwords +2 ;/* includes pbc */
@@ -1630,7 +1630,7 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,struct snoop_packet *s_packet =NULL ;u32 *hdr = (u32 *)&ahdr->ibh;u32 length =0 ; -struct hfi1_sge_state temp_ss; +struct rvt_sge_state temp_ss;void *data =NULL ;void *data_start =NULL ;int ret;
drivers/staging/rdma/hfi1/driver.c +5 -5
@@ -318,7 +318,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,/* Get the destination QP number. */ qp_num =be32_to_cpu (ohdr->bth[1 ]) &HFI1_QPN_MASK ;if (lid <be16_to_cpu (IB_MULTICAST_LID_BASE )) { -struct hfi1_qp *qp; +struct rvt_qp *qp;unsigned long flags;rcu_read_lock ();
@@ -387,7 +387,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,* Only in pre-B0 h/w is the CNP_OPCODE handled * via this code path. */ -struct hfi1_qp *qp =NULL ; +struct rvt_qp *qp =NULL ;u32 lqpn, rqpn;u16 rlid;u8 svc_type, sl, sc5;
@@ -456,7 +456,7 @@ static void prescan_rxq(struct hfi1_packet *packet) {}#else /* !CONFIG_PRESCAN_RXQ */ static int prescan_receive_queue; -static void process_ecn (struct hfi1_qp *qp,struct hfi1_ib_header *hdr, +static void process_ecn (struct rvt_qp *qp,struct hfi1_ib_header *hdr,struct hfi1_other_headers *ohdr,u64 rhf,u32 bth1,struct ib_grh *grh) {
@@ -595,7 +595,7 @@ static void prescan_rxq(struct hfi1_packet *packet)struct hfi1_ibport *ibp = &rcd->ppd->ibport_data;__le32 *rhf_addr = (__le32 *) rcd->rcvhdrq + mdata.ps_head + dd->rhf_offset; -struct hfi1_qp *qp; +struct rvt_qp *qp;struct hfi1_ib_header *hdr;struct hfi1_other_headers *ohdr;struct ib_grh *grh =NULL ;
@@ -770,7 +770,7 @@ static inline void process_rcv_qp_work(struct hfi1_packet *packet) {struct hfi1_ctxtdata *rcd; -struct hfi1_qp *qp, *nqp; +struct rvt_qp *qp, *nqp; rcd = packet->rcd; rcd->head = packet->rhqoff;
drivers/staging/rdma/hfi1/hfi.h +8 -8
@@ -334,7 +334,7 @@ struct hfi1_packet {void *hdr;struct hfi1_ctxtdata *rcd;__le32 *rhf_addr; -struct hfi1_qp *qp; +struct rvt_qp *qp;struct hfi1_other_headers *ohdr;u64 rhf;u32 maxcnt;
@@ -374,7 +374,7 @@ struct hfi1_snoop_data {#define HFI1_PORT_SNOOP_MODE 1U#define HFI1_PORT_CAPTURE_MODE 2U -struct hfi1_sge_state ; +struct rvt_sge_state ;/* * Get/Set IB link-level config parameters for f_get/set_ib_cfg()
@@ -1091,9 +1091,9 @@ struct hfi1_devdata {* Handlers for outgoing data so that snoop/capture does not * have to have its hooks in the send path */ -int (*process_pio_send)(struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +int (*process_pio_send)(struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc); -int (*process_dma_send)(struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +int (*process_dma_send)(struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc);void (*pio_inline_send)(struct hfi1_devdata *dd,struct pio_buf *pbuf,u64 pbc,const void *from,size_t count);
@@ -1276,7 +1276,7 @@ static inline u32 egress_cycles(u32 len, u32 rate)void set_link_ipg (struct hfi1_pportdata *ppd);void process_becn (struct hfi1_pportdata *ppd,u8 sl,u16 rlid,u32 lqpn,u32 rqpn,u8 svc_type); -void return_cnp (struct hfi1_ibport *ibp,struct hfi1_qp *qp,u32 remote_qpn, +void return_cnp (struct hfi1_ibport *ibp,struct rvt_qp *qp,u32 remote_qpn,u32 pkey,u32 slid,u32 dlid,u8 sc5,const struct ib_grh *old_grh);
@@ -1468,9 +1468,9 @@ void reset_link_credits(struct hfi1_devdata *dd);void assign_remote_cm_au_table (struct hfi1_devdata *dd,u8 vcu);int snoop_recv_handler (struct hfi1_packet *packet); -int snoop_send_dma_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +int snoop_send_dma_handler (struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc); -int snoop_send_pio_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +int snoop_send_pio_handler (struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc);void snoop_inline_pio_send (struct hfi1_devdata *dd,struct pio_buf *pbuf,u64 pbc,const void *from,size_t count);
@@ -1682,7 +1682,7 @@ int process_receive_invalid(struct hfi1_packet *packet);extern rhf_rcv_function_ptr snoop_rhf_rcv_functions[8 ]; -void update_sge (struct hfi1_sge_state *ss,u32 length); +void update_sge (struct rvt_sge_state *ss,u32 length);/* global module parameter variables */ extern unsigned int hfi1_max_mtu;
drivers/staging/rdma/hfi1/keys.c deleted +0 -356
356 lines not on this page · raw message
drivers/staging/rdma/hfi1/mmap.c +12 -12
@@ -59,12 +59,12 @@/** * hfi1_release_mmap_info - free mmap info structure -* @ref: a pointer to the kref within struct hfi1_mmap_info +* @ref: a pointer to the kref within struct rvt_mmap_info */ void hfi1_release_mmap_info (struct kref *ref) { -struct hfi1_mmap_info *ip = - container_of(ref, struct hfi1_mmap_info, ref); +struct rvt_mmap_info *ip = + container_of(ref, struct rvt_mmap_info, ref);struct hfi1_ibdev *dev =to_idev (ip->context->device);spin_lock_irq (&dev->pending_lock);
@@ -81,14 +81,14 @@ void hfi1_release_mmap_info(struct kref *ref)*/ static void hfi1_vma_open (struct vm_area_struct *vma) { -struct hfi1_mmap_info *ip = vma->vm_private_data; +struct rvt_mmap_info *ip = vma->vm_private_data;kref_get (&ip->ref); }static void hfi1_vma_close (struct vm_area_struct *vma) { -struct hfi1_mmap_info *ip = vma->vm_private_data; +struct rvt_mmap_info *ip = vma->vm_private_data;kref_put (&ip->ref, hfi1_release_mmap_info); }
@@ -109,7 +109,7 @@ int hfi1_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)struct hfi1_ibdev *dev =to_idev (context->device);unsigned long offset = vma->vm_pgoff <<PAGE_SHIFT ;unsigned long size = vma->vm_end - vma->vm_start; -struct hfi1_mmap_info *ip, *pp; +struct rvt_mmap_info *ip, *pp;int ret = -EINVAL ;/*
@@ -146,11 +146,11 @@ done:/* * Allocate information for hfi1_mmap */ -struct hfi1_mmap_info *hfi1_create_mmap_info (struct hfi1_ibdev *dev, -u32 size, -struct ib_ucontext *context, -void *obj) { -struct hfi1_mmap_info *ip; +struct rvt_mmap_info *hfi1_create_mmap_info (struct hfi1_ibdev *dev, +u32 size, +struct ib_ucontext *context, +void *obj) { +struct rvt_mmap_info *ip; ip =kmalloc (sizeof (*ip),GFP_KERNEL );if (!ip)
@@ -175,7 +175,7 @@ bail:return ip; } -void hfi1_update_mmap_info (struct hfi1_ibdev *dev,struct hfi1_mmap_info *ip, +void hfi1_update_mmap_info (struct hfi1_ibdev *dev,struct rvt_mmap_info *ip,u32 size,void *obj) { size =PAGE_ALIGN (size);
drivers/staging/rdma/hfi1/mr.c deleted +0 -473
473 lines not on this page · raw message
drivers/staging/rdma/hfi1/pio.c +2 -2
@@ -1526,8 +1526,8 @@ static void sc_piobufavail(struct send_context *sc)struct hfi1_devdata *dd = sc->dd;struct hfi1_ibdev *dev = &dd->verbs_dev;struct list_head *list; -struct hfi1_qp *qps[PIO_WAIT_BATCH_SIZE ]; -struct hfi1_qp *qp; +struct rvt_qp *qps[PIO_WAIT_BATCH_SIZE ]; +struct rvt_qp *qp;struct hfi1_qp_priv *priv;unsigned long flags;unsigned i, n =0 ;
drivers/staging/rdma/hfi1/qp.c +44 -44
308 lines not on this page · raw message
drivers/staging/rdma/hfi1/qp.h +16 -17
@@ -80,7 +80,7 @@ struct hfi1_qpn_table {struct hfi1_qp_ibdev {u32 qp_table_size;u32 qp_table_bits; -struct hfi1_qp __rcu **qp_table; +struct rvt_qp __rcu **qp_table;spinlock_t qpt_lock;struct hfi1_qpn_table qpn_table; };
@@ -98,10 +98,10 @@ static inline u32 qpn_hash(struct hfi1_qp_ibdev *dev, u32 qpn)* The caller must hold the rcu_read_lock(), and keep the lock until * the returned qp is no longer in use. */ -static inline struct hfi1_qp *hfi1_lookup_qpn (struct hfi1_ibport *ibp, -u32 qpn)__must_hold (RCU ) +static inline struct rvt_qp *hfi1_lookup_qpn (struct hfi1_ibport *ibp, +u32 qpn)__must_hold (RCU ) { -struct hfi1_qp *qp =NULL ; +struct rvt_qp *qp =NULL ;if (unlikely (qpn <=1 )) { qp =rcu_dereference (ibp->qp[qpn]);
@@ -117,11 +117,10 @@ static inline struct hfi1_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp,return qp; } -/** -* clear_ahg - reset ahg status in qp -* @qp - qp pointer +/* +* free_ahg - clear ahg from QP */ -static inline void clear_ahg (struct hfi1_qp *qp) +static inline void clear_ahg (struct rvt_qp *qp) {struct hfi1_qp_priv *priv = qp->priv;
@@ -142,7 +141,7 @@ static inline void clear_ahg(struct hfi1_qp *qp)* The QP r_lock and s_lock should be held and interrupts disabled. * If we are already in error state, just return. */ -int hfi1_error_qp (struct hfi1_qp *qp,enum ib_wc_status err); +int hfi1_error_qp (struct rvt_qp *qp,enum ib_wc_status err);/** * hfi1_modify_qp - modify the attributes of a queue pair
@@ -165,7 +164,7 @@ int hfi1_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,* * Returns the AETH. */ -__be32 hfi1_compute_aeth (struct hfi1_qp *qp); +__be32 hfi1_compute_aeth (struct rvt_qp *qp);/** * hfi1_create_qp - create a queue pair for a device
@@ -198,7 +197,7 @@ int hfi1_destroy_qp(struct ib_qp *ibqp);* * The QP s_lock should be held. */ -void hfi1_get_credit (struct hfi1_qp *qp,u32 aeth); +void hfi1_get_credit (struct rvt_qp *qp,u32 aeth);/** * hfi1_qp_init - allocate QP tables
@@ -217,9 +216,9 @@ void hfi1_qp_exit(struct hfi1_ibdev *dev);* @qp: the QP * @flag: flag the qp on which the qp is stalled */ -void hfi1_qp_wakeup (struct hfi1_qp *qp,u32 flag); +void hfi1_qp_wakeup (struct rvt_qp *qp,u32 flag); -struct sdma_engine *qp_to_sdma_engine (struct hfi1_qp *qp,u8 sc5); +struct sdma_engine *qp_to_sdma_engine (struct rvt_qp *qp,u8 sc5);struct qp_iter ;
@@ -246,7 +245,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter);* qp_comm_est - handle trap with QP established * @qp: the QP */ -void qp_comm_est (struct hfi1_qp *qp); +void qp_comm_est (struct rvt_qp *qp);/** * _hfi1_schedule_send - schedule progress
@@ -257,7 +256,7 @@ void qp_comm_est(struct hfi1_qp *qp);* It is only used in the post send, which doesn't hold * the s_lock. */ -static inline void _hfi1_schedule_send (struct hfi1_qp *qp) +static inline void _hfi1_schedule_send (struct rvt_qp *qp) {struct hfi1_qp_priv *priv = qp->priv; struct hfi1_ibport *ibp =
@@ -278,12 +277,12 @@ static inline void _hfi1_schedule_send(struct hfi1_qp *qp)* This schedules qp progress and caller should hold * the s_lock. */ -static inline void hfi1_schedule_send (struct hfi1_qp *qp) +static inline void hfi1_schedule_send (struct rvt_qp *qp) {if (hfi1_send_ok (qp))_hfi1_schedule_send (qp); } -void hfi1_migrate_qp (struct hfi1_qp *qp); +void hfi1_migrate_qp (struct rvt_qp *qp);#endif /* _QP_H */
drivers/staging/rdma/hfi1/rc.c +58 -58
370 lines not on this page · raw message
drivers/staging/rdma/hfi1/ruc.c +37 -38
185 lines not on this page · raw message
drivers/staging/rdma/hfi1/sdma.h +3 -3
@@ -379,10 +379,10 @@ struct sdma_txreq {struct verbs_txreq {struct hfi1_pio_header phdr;struct sdma_txreq txreq; -struct hfi1_qp *qp; -struct hfi1_swqe *wqe; +struct rvt_qp *qp; +struct rvt_swqe *wqe;struct rvt_mregion *mr; -struct hfi1_sge_state *ss; +struct rvt_sge_state *ss;struct sdma_engine *sde;u16 hdr_dwords;u16 hdr_inx;
drivers/staging/rdma/hfi1/srq.c +14 -14
@@ -66,12 +66,12 @@ int hfi1_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr, struct ib_recv_wr **bad_wr) {struct hfi1_srq *srq =to_isrq (ibsrq); -struct hfi1_rwq *wq; +struct rvt_rwq *wq;unsigned long flags;int ret;for (; wr; wr = wr->next) { -struct hfi1_rwqe *wqe; +struct rvt_rwqe *wqe;u32 next;int i;
@@ -149,8 +149,8 @@ struct ib_srq *hfi1_create_srq(struct ib_pd *ibpd, srq->rq.size = srq_init_attr->attr.max_wr +1 ; srq->rq.max_sge = srq_init_attr->attr.max_sge; sz =sizeof (struct ib_sge ) * srq->rq.max_sge + -sizeof (struct hfi1_rwqe ); - srq->rq.wq =vmalloc_user (sizeof (struct hfi1_rwq ) + srq->rq.size * sz); +sizeof (struct rvt_rwqe ); + srq->rq.wq =vmalloc_user (sizeof (struct rvt_rwq ) + srq->rq.size * sz);if (!srq->rq.wq) { ret =ERR_PTR (-ENOMEM ); goto bail_srq;
@@ -162,7 +162,7 @@ struct ib_srq *hfi1_create_srq(struct ib_pd *ibpd,*/ if (udata && udata->outlen >=sizeof (__u64)) {int err; -u32 s =sizeof (struct hfi1_rwq ) + srq->rq.size * sz; +u32 s =sizeof (struct rvt_rwq ) + srq->rq.size * sz; srq->ip = hfi1_create_mmap_info(dev, s, ibpd->uobject->context,
@@ -230,12 +230,12 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, struct ib_udata *udata) {struct hfi1_srq *srq =to_isrq (ibsrq); -struct hfi1_rwq *wq; +struct rvt_rwq *wq;int ret =0 ;if (attr_mask &IB_SRQ_MAX_WR ) { -struct hfi1_rwq *owq; -struct hfi1_rwqe *p; +struct rvt_rwq *owq; +struct rvt_rwqe *p;u32 sz, size, n, head, tail;/* Check that the requested sizes are below the limits. */
@@ -246,10 +246,10 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, goto bail; } - sz =sizeof (struct hfi1_rwqe ) + + sz =sizeof (struct rvt_rwqe ) + srq->rq.max_sge *sizeof (struct ib_sge ); size = attr->max_wr +1 ; - wq =vmalloc_user (sizeof (struct hfi1_rwq ) + size * sz); + wq =vmalloc_user (sizeof (struct rvt_rwq ) + size * sz);if (!wq) { ret = -ENOMEM ; goto bail;
@@ -296,7 +296,7 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, n =0 ; p = wq->wq;while (tail != head) { -struct hfi1_rwqe *wqe; +struct rvt_rwqe *wqe;int i; wqe =get_rwqe_ptr (&srq->rq, tail);
@@ -305,7 +305,7 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,for (i =0 ; i < wqe->num_sge; i++) p->sg_list[i] = wqe->sg_list[i]; n++; - p = (struct hfi1_rwqe *)((char *)p + sz); + p = (struct rvt_rwqe *)((char *)p + sz);if (++tail >= srq->rq.size) tail =0 ; }
@@ -320,9 +320,9 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,vfree (owq);if (srq->ip) { -struct hfi1_mmap_info *ip = srq->ip; +struct rvt_mmap_info *ip = srq->ip;struct hfi1_ibdev *dev =to_idev (srq->ibsrq.device); -u32 s =sizeof (struct hfi1_rwq ) + size * sz; +u32 s =sizeof (struct rvt_rwq ) + size * sz;hfi1_update_mmap_info (dev, ip, s, wq);
drivers/staging/rdma/hfi1/trace.h +11 -11
@@ -332,7 +332,7 @@ TRACE_EVENT(hfi1_wantpiointr, ); DECLARE_EVENT_CLASS(hfi1_qpsleepwakeup_template, - TP_PROTO(struct hfi1_qp *qp, u32 flags), + TP_PROTO(struct rvt_qp *qp, u32 flags), TP_ARGS(qp, flags), TP_STRUCT__entry( DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device))
@@ -356,17 +356,17 @@ DECLARE_EVENT_CLASS(hfi1_qpsleepwakeup_template, );DEFINE_EVENT (hfi1_qpsleepwakeup_template, hfi1_qpwakeup, - TP_PROTO(struct hfi1_qp *qp, u32 flags), + TP_PROTO(struct rvt_qp *qp, u32 flags),TP_ARGS (qp, flags));DEFINE_EVENT (hfi1_qpsleepwakeup_template, hfi1_qpsleep, - TP_PROTO(struct hfi1_qp *qp, u32 flags), + TP_PROTO(struct rvt_qp *qp, u32 flags),TP_ARGS (qp, flags));#undef TRACE_SYSTEM#define TRACE_SYSTEM hfi1_qphash DECLARE_EVENT_CLASS(hfi1_qphash_template, - TP_PROTO(struct hfi1_qp *qp, u32 bucket), + TP_PROTO(struct rvt_qp *qp, u32 bucket), TP_ARGS(qp, bucket), TP_STRUCT__entry( DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device))
@@ -387,11 +387,11 @@ DECLARE_EVENT_CLASS(hfi1_qphash_template, );DEFINE_EVENT (hfi1_qphash_template, hfi1_qpinsert, - TP_PROTO(struct hfi1_qp *qp, u32 bucket), + TP_PROTO(struct rvt_qp *qp, u32 bucket),TP_ARGS (qp, bucket));DEFINE_EVENT (hfi1_qphash_template, hfi1_qpremove, - TP_PROTO(struct hfi1_qp *qp, u32 bucket), + TP_PROTO(struct rvt_qp *qp, u32 bucket),TP_ARGS (qp, bucket));#undef TRACE_SYSTEM
@@ -1292,7 +1292,7 @@ TRACE_EVENT(hfi1_sdma_state,#define TRACE_SYSTEM hfi1_rc DECLARE_EVENT_CLASS(hfi1_rc_template, - TP_PROTO(struct hfi1_qp *qp, u32 psn), + TP_PROTO(struct rvt_qp *qp, u32 psn), TP_ARGS(qp, psn), TP_STRUCT__entry( DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device))
@@ -1331,22 +1331,22 @@ DECLARE_EVENT_CLASS(hfi1_rc_template, );DEFINE_EVENT (hfi1_rc_template, hfi1_rc_sendcomplete, - TP_PROTO(struct hfi1_qp *qp, u32 psn), + TP_PROTO(struct rvt_qp *qp, u32 psn),TP_ARGS (qp, psn) );DEFINE_EVENT (hfi1_rc_template, hfi1_rc_ack, - TP_PROTO(struct hfi1_qp *qp, u32 psn), + TP_PROTO(struct rvt_qp *qp, u32 psn),TP_ARGS (qp, psn) );DEFINE_EVENT (hfi1_rc_template, hfi1_rc_timeout, - TP_PROTO(struct hfi1_qp *qp, u32 psn), + TP_PROTO(struct rvt_qp *qp, u32 psn),TP_ARGS (qp, psn) );DEFINE_EVENT (hfi1_rc_template, hfi1_rc_rcv_error, - TP_PROTO(struct hfi1_qp *qp, u32 psn), + TP_PROTO(struct rvt_qp *qp, u32 psn),TP_ARGS (qp, psn) );
drivers/staging/rdma/hfi1/uc.c +5 -5
@@ -61,11 +61,11 @@* * Return 1 if constructed; otherwise, return 0. */ -int hfi1_make_uc_req (struct hfi1_qp *qp) +int hfi1_make_uc_req (struct rvt_qp *qp) {struct hfi1_qp_priv *priv = qp->priv;struct hfi1_other_headers *ohdr; -struct hfi1_swqe *wqe; +struct rvt_swqe *wqe;unsigned long flags;u32 hwords =5 ;u32 bth0 =0 ;
@@ -267,7 +267,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)u32 rcv_flags = packet->rcv_flags;void *data = packet->ebuf;u32 tlen = packet->tlen; -struct hfi1_qp *qp = packet->qp; +struct rvt_qp *qp = packet->qp;struct hfi1_other_headers *ohdr = packet->ohdr;u32 bth0, opcode;u32 hdrsize = packet->hlen;
@@ -492,8 +492,8 @@ rdma_first:int ok;/* Check rkey */ - ok =hfi1_rkey_ok (qp, &qp->r_sge.sge, qp->r_len, - vaddr, rkey,IB_ACCESS_REMOTE_WRITE ); + ok =rvt_rkey_ok (qp, &qp->r_sge.sge, qp->r_len, + vaddr, rkey,IB_ACCESS_REMOTE_WRITE );if (unlikely (!ok)) goto drop; qp->r_sge.num_sge =1 ;
drivers/staging/rdma/hfi1/ud.c +9 -9
@@ -65,15 +65,15 @@* Note that the receive interrupt handler may be calling hfi1_ud_rcv() * while this is being called. */ -static void ud_loopback (struct hfi1_qp *sqp,struct hfi1_swqe *swqe) +static void ud_loopback (struct rvt_qp *sqp,struct rvt_swqe *swqe) {struct hfi1_ibport *ibp =to_iport (sqp->ibqp.device, sqp->port_num);struct hfi1_pportdata *ppd; -struct hfi1_qp *qp; +struct rvt_qp *qp;struct ib_ah_attr *ah_attr;unsigned long flags; -struct hfi1_sge_state ssge; -struct hfi1_sge *sge; +struct rvt_sge_state ssge; +struct rvt_sge *sge;struct ib_wc wc;u32 length;enum ib_qp_type sqptype, dqptype;
@@ -262,14 +262,14 @@ drop:* * Return 1 if constructed; otherwise, return 0. */ -int hfi1_make_ud_req (struct hfi1_qp *qp) +int hfi1_make_ud_req (struct rvt_qp *qp) {struct hfi1_qp_priv *priv = qp->priv;struct hfi1_other_headers *ohdr;struct ib_ah_attr *ah_attr;struct hfi1_pportdata *ppd;struct hfi1_ibport *ibp; -struct hfi1_swqe *wqe; +struct rvt_swqe *wqe;unsigned long flags;u32 nwords;u32 extra_bytes;
@@ -477,7 +477,7 @@ int hfi1_lookup_pkey_idx(struct hfi1_ibport *ibp, u16 pkey)return -1 ; } -void return_cnp (struct hfi1_ibport *ibp,struct hfi1_qp *qp,u32 remote_qpn, +void return_cnp (struct hfi1_ibport *ibp,struct rvt_qp *qp,u32 remote_qpn,u32 pkey,u32 slid,u32 dlid,u8 sc5,const struct ib_grh *old_grh) {
@@ -551,7 +551,7 @@ void return_cnp(struct hfi1_ibport *ibp, struct hfi1_qp *qp, u32 remote_qpn,* opa_smp_check() returns 0 if all checks succeed, 1 otherwise. */ static int opa_smp_check (struct hfi1_ibport *ibp,u16 pkey,u8 sc5, -struct hfi1_qp *qp,u16 slid,struct opa_smp *smp) +struct rvt_qp *qp,u16 slid,struct opa_smp *smp) {struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);
@@ -655,7 +655,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)u32 rcv_flags = packet->rcv_flags;void *data = packet->ebuf;u32 tlen = packet->tlen; -struct hfi1_qp *qp = packet->qp; +struct rvt_qp *qp = packet->qp;bool has_grh = rcv_flags &HFI1_HAS_GRH ;bool sc4_bit =has_sc4_bit (packet);u8 sc;
drivers/staging/rdma/hfi1/verbs.c +57 -84
400 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +46 -320
330 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs_mcast.c +4 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Part of the diff is not shown here. View the raw message.
PATCH 12/31 staging/rdma/hfi1: Remove srq from hfi1
In reply to a message not in the archiveSRQ data structure has been moved to rdmavt. Make use of it.
--- drivers/staging/rdma/hfi1/qp.c | 2 +- drivers/staging/rdma/hfi1/ruc.c | 4 ++-- drivers/staging/rdma/hfi1/srq.c | 10 +++++----- drivers/staging/rdma/hfi1/verbs.h | 13 ------------- 4 files changed, 8 insertions(+), 21 deletions(-)
drivers/staging/rdma/hfi1/qp.c +1 -1
@@ -1092,7 +1092,7 @@ struct ib_qp *hfi1_create_qp(struct ib_pd *ibpd, sz =sizeof (*qp); sg_list_sz =0 ;if (init_attr->srq) { -struct hfi1_srq *srq =to_isrq (init_attr->srq); +struct rvt_srq *srq =ibsrq_to_rvtsrq (init_attr->srq);if (srq->rq.max_sge >1 ) sg_list_sz = sizeof(*qp->r_sg_list) *
drivers/staging/rdma/hfi1/ruc.c +2 -2
@@ -159,14 +159,14 @@ int hfi1_get_rwqe(struct rvt_qp *qp, int wr_id_only)unsigned long flags;struct rvt_rq *rq;struct rvt_rwq *wq; -struct hfi1_srq *srq; +struct rvt_srq *srq;struct rvt_rwqe *wqe;void (*handler)(struct ib_event *,void *);u32 tail;int ret;if (qp->ibqp.srq) { - srq =to_isrq (qp->ibqp.srq); + srq =ibsrq_to_rvtsrq (qp->ibqp.srq); handler = srq->ibsrq.event_handler; rq = &srq->rq; }else {
drivers/staging/rdma/hfi1/srq.c +5 -5
@@ -65,7 +65,7 @@int hfi1_post_srq_receive (struct ib_srq *ibsrq,struct ib_recv_wr *wr,struct ib_recv_wr **bad_wr) { -struct hfi1_srq *srq =to_isrq (ibsrq); +struct rvt_srq *srq =ibsrq_to_rvtsrq (ibsrq);struct rvt_rwq *wq;unsigned long flags;int ret;
@@ -120,7 +120,7 @@ struct ib_srq *hfi1_create_srq(struct ib_pd *ibpd, struct ib_udata *udata) {struct hfi1_ibdev *dev =to_idev (ibpd->device); -struct hfi1_srq *srq; +struct rvt_srq *srq;u32 sz;struct ib_srq *ret;
@@ -229,7 +229,7 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,enum ib_srq_attr_mask attr_mask, struct ib_udata *udata) { - struct hfi1_srq *srq = to_isrq(ibsrq); + struct rvt_srq *srq = ibsrq_to_rvtsrq(ibsrq);struct rvt_rwq *wq;int ret =0 ;
@@ -367,7 +367,7 @@ bail:int hfi1_query_srq (struct ib_srq *ibsrq,struct ib_srq_attr *attr) { -struct hfi1_srq *srq =to_isrq (ibsrq); +struct rvt_srq *srq =ibsrq_to_rvtsrq (ibsrq); attr->max_wr = srq->rq.size -1 ; attr->max_sge = srq->rq.max_sge;
@@ -381,7 +381,7 @@ int hfi1_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)*/ int hfi1_destroy_srq (struct ib_srq *ibsrq) { -struct hfi1_srq *srq =to_isrq (ibsrq); +struct rvt_srq *srq =ibsrq_to_rvtsrq (ibsrq);struct hfi1_ibdev *dev =to_idev (ibsrq->device);spin_lock (&dev->n_srqs_lock);
drivers/staging/rdma/hfi1/verbs.h +0 -13
@@ -263,14 +263,6 @@ struct hfi1_cq {struct rvt_mmap_info *ip; }; -struct hfi1_srq { -struct ib_srq ibsrq; -struct rvt_rq rq; -struct rvt_mmap_info *ip; -/* send signal when number of RWQEs < limit */ -u32 limit; -}; -/* * hfi1 specific data structures that will be hidden from rvt after the queue * pair is made common
@@ -539,11 +531,6 @@ static inline struct hfi1_cq *to_icq(struct ib_cq *ibcq) return container_of(ibcq, struct hfi1_cq, ibcq); } -static inline struct hfi1_srq *to_isrq (struct ib_srq *ibsrq) -{ - return container_of(ibsrq, struct hfi1_srq, ibsrq); -} -static inline struct rvt_qp *to_iqp (struct ib_qp *ibqp) { return container_of(ibqp, struct rvt_qp, ibqp);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 13/31 staging/rdma/hfi1: Remove ibport and use rdmavt version
In reply to a message not in the archiveRemove most of the ibport members from hfi1 and use the rdmavt version. Also register the port with rdmavt.
--- drivers/staging/rdma/hfi1/chip.c | 34 +++---- drivers/staging/rdma/hfi1/driver.c | 2 drivers/staging/rdma/hfi1/hfi.h | 8 +- drivers/staging/rdma/hfi1/mad.c | 151 ++++++++++++++++--------------- drivers/staging/rdma/hfi1/qp.c | 23 ++--- drivers/staging/rdma/hfi1/qp.h | 2 drivers/staging/rdma/hfi1/rc.c | 32 +++---- drivers/staging/rdma/hfi1/ruc.c | 14 ++- drivers/staging/rdma/hfi1/uc.c | 2 drivers/staging/rdma/hfi1/ud.c | 16 ++- drivers/staging/rdma/hfi1/verbs.c | 61 +++++++------ drivers/staging/rdma/hfi1/verbs.h | 51 +--------- drivers/staging/rdma/hfi1/verbs_mcast.c | 28 +++--- 13 files changed, 197 insertions(+), 227 deletions(-)
drivers/staging/rdma/hfi1/chip.c +17 -17
@@ -3933,8 +3933,8 @@ static u64 access_sw_cpu_##cntr(const struct cntr_entry *entry, \ void *context, int vl, int mode, u64 data) \ { \ struct hfi1_pportdata *ppd = (struct hfi1_pportdata *)context; \ - return read_write_cpu(ppd->dd, &ppd->ibport_data.z_ ##cntr, \ - ppd->ibport_data.cntr, vl, \ + return read_write_cpu(ppd->dd, &ppd->ibport_data.rvp.z_ ##cntr, \ + ppd->ibport_data.rvp.cntr, vl, \ mode, data); \ }
@@ -3951,7 +3951,7 @@ static u64 access_ibp_##cntr(const struct cntr_entry *entry, \if (vl !=CNTR_INVALID_VL ) \return 0 ; \ \ - return read_write_sw(ppd->dd, &ppd->ibport_data.n_ ##cntr, \ + return read_write_sw(ppd->dd, &ppd->ibport_data.rvp.n_ ##cntr, \ mode, data); \ }
@@ -9239,14 +9239,14 @@ static inline int init_cpu_counters(struct hfi1_devdata *dd) ppd = (struct hfi1_pportdata *)(dd +1 );for (i =0 ; i < dd->num_pports; i++, ppd++) { - ppd->ibport_data.rc_acks =NULL ; - ppd->ibport_data.rc_qacks =NULL ; - ppd->ibport_data.rc_acks =alloc_percpu (u64); - ppd->ibport_data.rc_qacks =alloc_percpu (u64); - ppd->ibport_data.rc_delayed_comp =alloc_percpu (u64); -if ((ppd->ibport_data.rc_acks ==NULL ) || - (ppd->ibport_data.rc_delayed_comp ==NULL ) || - (ppd->ibport_data.rc_qacks ==NULL )) + ppd->ibport_data.rvp.rc_acks =NULL ; + ppd->ibport_data.rvp.rc_qacks =NULL ; + ppd->ibport_data.rvp.rc_acks =alloc_percpu (u64); + ppd->ibport_data.rvp.rc_qacks =alloc_percpu (u64); + ppd->ibport_data.rvp.rc_delayed_comp =alloc_percpu (u64); +if (!ppd->ibport_data.rvp.rc_acks || + !ppd->ibport_data.rvp.rc_delayed_comp || + !ppd->ibport_data.rvp.rc_qacks)return -ENOMEM ; }
@@ -11318,14 +11318,14 @@ static void free_cntrs(struct hfi1_devdata *dd)for (i =0 ; i < dd->num_pports; i++, ppd++) {kfree (ppd->cntrs);kfree (ppd->scntrs); -free_percpu (ppd->ibport_data.rc_acks); -free_percpu (ppd->ibport_data.rc_qacks); -free_percpu (ppd->ibport_data.rc_delayed_comp); +free_percpu (ppd->ibport_data.rvp.rc_acks); +free_percpu (ppd->ibport_data.rvp.rc_qacks); +free_percpu (ppd->ibport_data.rvp.rc_delayed_comp); ppd->cntrs =NULL ; ppd->scntrs =NULL ; - ppd->ibport_data.rc_acks =NULL ; - ppd->ibport_data.rc_qacks =NULL ; - ppd->ibport_data.rc_delayed_comp =NULL ; + ppd->ibport_data.rvp.rc_acks =NULL ; + ppd->ibport_data.rvp.rc_qacks =NULL ; + ppd->ibport_data.rvp.rc_delayed_comp =NULL ; }kfree (dd->portcntrnames); dd->portcntrnames =NULL ;
drivers/staging/rdma/hfi1/driver.c +1 -1
@@ -337,7 +337,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,/* Check for valid receive state. */ if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK )) { - ibp->n_pkt_drops++; + ibp->rvp.n_pkt_drops++; }switch (qp->ibqp.qp_type) {
drivers/staging/rdma/hfi1/hfi.h +4 -4
@@ -1855,10 +1855,10 @@ static inline void hfi1_reset_cpu_counters(struct hfi1_devdata *dd) ppd = (struct hfi1_pportdata *)(dd +1 );for (i =0 ; i < dd->num_pports; i++, ppd++) { - ppd->ibport_data.z_rc_acks = -get_all_cpu_total (ppd->ibport_data.rc_acks); - ppd->ibport_data.z_rc_qacks = -get_all_cpu_total (ppd->ibport_data.rc_qacks); + ppd->ibport_data.rvp.z_rc_acks = +get_all_cpu_total (ppd->ibport_data.rvp.rc_acks); + ppd->ibport_data.rvp.z_rc_qacks = +get_all_cpu_total (ppd->ibport_data.rvp.rc_qacks); } }
drivers/staging/rdma/hfi1/mad.c +77 -74
322 lines not on this page · raw message
drivers/staging/rdma/hfi1/qp.c +12 -11
@@ -238,7 +238,7 @@ static void insert_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp)spin_lock_irqsave (&dev->qp_dev->qpt_lock, flags);if (qp->ibqp.qp_num <=1 ) { -rcu_assign_pointer (ibp->qp[qp->ibqp.qp_num], qp); +rcu_assign_pointer (ibp->rvp.qp[qp->ibqp.qp_num], qp); }else {u32 n =qpn_hash (dev->qp_dev, qp->ibqp.qp_num);
@@ -263,12 +263,13 @@ static void remove_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp)spin_lock_irqsave (&dev->qp_dev->qpt_lock, flags); -if (rcu_dereference_protected (ibp->qp[0 ], +if (rcu_dereference_protected (ibp->rvp.qp[0 ], +lockdep_is_held ( + &dev->qp_dev->qpt_lock)) == qp) { +RCU_INIT_POINTER (ibp->rvp.qp[0 ],NULL ); + }else if (rcu_dereference_protected (ibp->rvp.qp[1 ],lockdep_is_held (&dev->qp_dev->qpt_lock)) == qp) { -RCU_INIT_POINTER (ibp->qp[0 ],NULL ); - }else if (rcu_dereference_protected (ibp->qp[1 ], -lockdep_is_held (&dev->qp_dev->qpt_lock)) == qp) { -RCU_INIT_POINTER (ibp->qp[1 ],NULL ); +RCU_INIT_POINTER (ibp->rvp.qp[1 ],NULL ); }else {struct rvt_qp *q;struct rvt_qp __rcu **qpp;
@@ -317,9 +318,9 @@ static unsigned free_all_qps(struct hfi1_devdata *dd)if (!hfi1_mcast_tree_empty (ibp)) qp_inuse++;rcu_read_lock (); -if (rcu_dereference (ibp->qp[0 ])) +if (rcu_dereference (ibp->rvp.qp[0 ])) qp_inuse++; -if (rcu_dereference (ibp->qp[1 ])) +if (rcu_dereference (ibp->rvp.qp[1 ])) qp_inuse++;rcu_read_unlock (); }
@@ -1467,7 +1468,7 @@ static int iowait_sleep(struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); - ibp->n_dmawait++; + ibp->rvp.n_dmawait++; qp->s_flags |=HFI1_S_WAIT_DMA_DESC ;list_add_tail (&priv->s_iowait.list, &sde->dmawait);trace_hfi1_qpsleep (qp,HFI1_S_WAIT_DMA_DESC );
@@ -1636,9 +1637,9 @@ int qp_iter_next(struct qp_iter *iter) ibp = &ppd->ibport_data;if (!(n &1 )) - qp =rcu_dereference (ibp->qp[0 ]); + qp =rcu_dereference (ibp->rvp.qp[0 ]);else - qp =rcu_dereference (ibp->qp[1 ]); + qp =rcu_dereference (ibp->rvp.qp[1 ]); }else { qp = rcu_dereference( dev->qp_dev->qp_table[
drivers/staging/rdma/hfi1/qp.h +1 -1
@@ -104,7 +104,7 @@ static inline struct rvt_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp,struct rvt_qp *qp =NULL ;if (unlikely (qpn <=1 )) { - qp =rcu_dereference (ibp->qp[qpn]); + qp =rcu_dereference (ibp->rvp.qp[qpn]); }else {struct hfi1_ibdev *dev = &ppd_from_ibp (ibp)->dd->verbs_dev;u32 n =qpn_hash (dev->qp_dev, qpn);
drivers/staging/rdma/hfi1/rc.c +16 -16
@@ -772,7 +772,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp,return ; queue_ack: -this_cpu_inc (*ibp->rc_qacks); +this_cpu_inc (*ibp->rvp.rc_qacks);spin_lock_irqsave (&qp->s_lock, flags); qp->s_flags |=HFI1_S_ACK_PENDING |HFI1_S_RESP_PENDING ; qp->s_nak_state = qp->r_nak_state;
@@ -900,9 +900,9 @@ static void restart_rc(struct rvt_qp *qp, u32 psn, int wait) ibp =to_iport (qp->ibqp.device, qp->port_num);if (wqe->wr.opcode ==IB_WR_RDMA_READ ) - ibp->n_rc_resends++; + ibp->rvp.n_rc_resends++;else - ibp->n_rc_resends +=delta_psn (qp->s_psn, psn); + ibp->rvp.n_rc_resends +=delta_psn (qp->s_psn, psn); qp->s_flags &= ~(HFI1_S_WAIT_FENCE | HFI1_S_WAIT_RDMAR | HFI1_S_WAIT_SSN_CREDIT | HFI1_S_WAIT_PSN |
@@ -925,7 +925,7 @@ static void rc_timeout(unsigned long arg)spin_lock (&qp->s_lock);if (qp->s_flags &HFI1_S_TIMER ) { ibp =to_iport (qp->ibqp.device, qp->port_num); - ibp->n_rc_timeouts++; + ibp->rvp.n_rc_timeouts++; qp->s_flags &= ~HFI1_S_TIMER ;del_timer (&qp->s_timer);trace_hfi1_rc_timeout (qp, qp->s_last_psn +1 );
@@ -1104,7 +1104,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, }else {struct hfi1_pportdata *ppd =ppd_from_ibp (ibp); -this_cpu_inc (*ibp->rc_delayed_comp); +this_cpu_inc (*ibp->rvp.rc_delayed_comp);/* * If send progress not running attempt to progress * SDMA queue.
@@ -1263,7 +1263,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,switch (aeth >>29 ) {case 0 :/* ACK */ -this_cpu_inc (*ibp->rc_acks); +this_cpu_inc (*ibp->rvp.rc_acks);if (qp->s_acked != qp->s_tail) {/* * We are expecting more ACKs so
@@ -1292,7 +1292,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, goto bail;case 1 :/* RNR NAK */ - ibp->n_rnr_naks++; + ibp->rvp.n_rnr_naks++;if (qp->s_acked == qp->s_tail) goto bail;if (qp->s_flags &HFI1_S_WAIT_RNR )
@@ -1307,7 +1307,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,/* The last valid PSN is the previous PSN. */ update_last_psn (qp, psn -1 ); - ibp->n_rc_resends +=delta_psn (qp->s_psn, psn); + ibp->rvp.n_rc_resends +=delta_psn (qp->s_psn, psn);reset_psn (qp, psn);
@@ -1328,7 +1328,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,switch ((aeth >>HFI1_AETH_CREDIT_SHIFT ) &HFI1_AETH_CREDIT_MASK ) {case 0 :/* PSN sequence error */ - ibp->n_seq_naks++; + ibp->rvp.n_seq_naks++;/* * Back up to the responder's expected PSN. * Note that we might get a NAK in the middle of an
@@ -1341,17 +1341,17 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,case 1 :/* Invalid Request */ status =IB_WC_REM_INV_REQ_ERR ; - ibp->n_other_naks++; + ibp->rvp.n_other_naks++; goto class_b;case 2 :/* Remote Access Error */ status =IB_WC_REM_ACCESS_ERR ; - ibp->n_other_naks++; + ibp->rvp.n_other_naks++; goto class_b;case 3 :/* Remote Operation Error */ status =IB_WC_REM_OP_ERR ; - ibp->n_other_naks++; + ibp->rvp.n_other_naks++; class_b:if (qp->s_last == qp->s_acked) {hfi1_send_complete (qp, wqe, status);
@@ -1402,7 +1402,7 @@ static void rdma_seq_err(struct rvt_qp *qp, struct hfi1_ibport *ibp, u32 psn, wqe =do_rc_completion (qp, wqe, ibp); } - ibp->n_rdma_seq++; + ibp->rvp.n_rdma_seq++; qp->r_flags |=HFI1_R_RDMAR_SEQ ;restart_rc (qp, qp->s_last_psn +1 ,0 );if (list_empty (&qp->rspwait)) {
@@ -1665,7 +1665,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,* Don't queue the NAK if we already sent one. */ if (!qp->r_nak_state) { - ibp->n_rc_seqnak++; + ibp->rvp.n_rc_seqnak++; qp->r_nak_state =IB_NAK_PSN_ERROR ;/* Use the expected PSN. */ qp->r_ack_psn = qp->r_psn;
@@ -1697,7 +1697,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,*/ e =NULL ; old_req =1 ; - ibp->n_rc_dupreq++; + ibp->rvp.n_rc_dupreq++;spin_lock_irqsave (&qp->s_lock, flags);
@@ -2433,7 +2433,7 @@ void hfi1_rc_hdrerr(if (opcode <IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST ) { diff =delta_psn (psn, qp->r_psn);if (!qp->r_nak_state && diff >=0 ) { - ibp->n_rc_seqnak++; + ibp->rvp.n_rc_seqnak++; qp->r_nak_state =IB_NAK_PSN_ERROR ;/* Use the expected PSN. */ qp->r_ack_psn = qp->r_psn;
drivers/staging/rdma/hfi1/ruc.c +8 -6
@@ -279,7 +279,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr,if (!(qp->alt_ah_attr.ah_flags &IB_AH_GRH )) goto err; guid =get_sguid (ibp, qp->alt_ah_attr.grh.sgid_index); -if (!gid_ok (&hdr->u.l.grh.dgid, ibp->gid_prefix, guid)) +if (!gid_ok (&hdr->u.l.grh.dgid, ibp->rvp.gid_prefix, + guid)) goto err; if (!gid_ok(&hdr->u.l.grh.sgid, qp->alt_ah_attr.grh.dgid.global.subnet_prefix,
@@ -312,7 +313,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr, goto err; guid =get_sguid (ibp, qp->remote_ah_attr.grh.sgid_index); -if (!gid_ok (&hdr->u.l.grh.dgid, ibp->gid_prefix, guid)) +if (!gid_ok (&hdr->u.l.grh.dgid, ibp->rvp.gid_prefix, + guid)) goto err; if (!gid_ok(&hdr->u.l.grh.sgid, qp->remote_ah_attr.grh.dgid.global.subnet_prefix,
@@ -413,7 +415,7 @@ again:if (!qp || !(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK ) || qp->ibqp.qp_type != sqp->ibqp.qp_type) { - ibp->n_pkt_drops++; + ibp->rvp.n_pkt_drops++;/* * For RC, the requester would timeout and retry so * shortcut the timeouts and just signal too many retries.
@@ -569,7 +571,7 @@ again: send_comp:spin_lock_irqsave (&sqp->s_lock, flags); - ibp->n_loop_pkts++; + ibp->rvp.n_loop_pkts++; flush_send: sqp->s_rnr_retry = sqp->s_rnr_retry_cnt;hfi1_send_complete (sqp, wqe, send_status);
@@ -579,7 +581,7 @@ rnr_nak:/* Handle RNR NAK */ if (qp->ibqp.qp_type ==IB_QPT_UC ) goto send_comp; - ibp->n_rnr_naks++; + ibp->rvp.n_rnr_naks++;/* * Note: we don't need the s_lock held since the BUSY flag * makes this single threaded.
@@ -665,7 +667,7 @@ u32 hfi1_make_grh(struct hfi1_ibport *ibp, struct ib_grh *hdr, hdr->next_hdr =IB_GRH_NEXT_HDR ; hdr->hop_limit = grh->hop_limit;/* The SGID is 32-bit aligned. */ - hdr->sgid.global.subnet_prefix = ibp->gid_prefix; + hdr->sgid.global.subnet_prefix = ibp->rvp.gid_prefix; hdr->sgid.global.interface_id = grh->sgid_index && grh->sgid_index <ARRAY_SIZE (ibp->guids) ? ibp->guids[grh->sgid_index - 1] :
drivers/staging/rdma/hfi1/uc.c +1 -1
@@ -579,7 +579,7 @@ rewind:set_bit (HFI1_R_REWIND_SGE , &qp->r_aflags); qp->r_sge.num_sge =0 ; drop: - ibp->n_pkt_drops++; + ibp->rvp.n_pkt_drops++;return ; op_err:
drivers/staging/rdma/hfi1/ud.c +8 -8
@@ -82,7 +82,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) qp =hfi1_lookup_qpn (ibp, swqe->ud_wr.remote_qpn);if (!qp) { - ibp->n_pkt_drops++; + ibp->rvp.n_pkt_drops++;rcu_read_unlock ();return ; }
@@ -94,7 +94,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)if (dqptype != sqptype || !(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK )) { - ibp->n_pkt_drops++; + ibp->rvp.n_pkt_drops++; goto drop; }
@@ -173,14 +173,14 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) }if (!ret) {if (qp->ibqp.qp_num ==0 ) - ibp->n_vl15_dropped++; + ibp->rvp.n_vl15_dropped++; goto bail_unlock; } }/* Silently drop packets which are too big. */ if (unlikely (wc.byte_len > qp->r_len)) { qp->r_flags |=HFI1_R_REUSE_SGE ; - ibp->n_pkt_drops++; + ibp->rvp.n_pkt_drops++; goto bail_unlock; }
@@ -249,7 +249,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)/* Signal completion event if the solicited bit is set. */ hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc, swqe->wr.send_flags &IB_SEND_SOLICITED ); - ibp->n_loop_pkts++; + ibp->rvp.n_loop_pkts++; bail_unlock:spin_unlock_irqrestore (&qp->r_lock, flags); drop:
@@ -608,7 +608,7 @@ static int opa_smp_check(struct hfi1_ibport *ibp, u16 pkey, u8 sc5,case IB_MGMT_METHOD_TRAP :case IB_MGMT_METHOD_GET_RESP :case IB_MGMT_METHOD_REPORT_RESP : -if (ibp->port_cap_flags &IB_PORT_SM ) +if (ibp->rvp.port_cap_flags &IB_PORT_SM )return 0 ;if (pkey ==FULL_MGMT_P_KEY ) { smp->status |=IB_SMP_UNSUP_METHOD ;
@@ -824,7 +824,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) }if (!ret) {if (qp->ibqp.qp_num ==0 ) - ibp->n_vl15_dropped++; + ibp->rvp.n_vl15_dropped++;return ; } }
@@ -884,5 +884,5 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)return ; drop: - ibp->n_pkt_drops++; + ibp->rvp.n_pkt_drops++; }
drivers/staging/rdma/hfi1/verbs.c +35 -26
136 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +3 -48
65 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs_mcast.c +14 -14
@@ -131,8 +131,8 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid)unsigned long flags;struct hfi1_mcast *mcast; -spin_lock_irqsave (&ibp->lock, flags); - n = ibp->mcast_tree.rb_node; +spin_lock_irqsave (&ibp->rvp.lock, flags); + n = ibp->rvp.mcast_tree.rb_node;while (n) {int ret;
@@ -146,11 +146,11 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid) n = n->rb_right; else {atomic_inc (&mcast->refcount); -spin_unlock_irqrestore (&ibp->lock, flags); +spin_unlock_irqrestore (&ibp->rvp.lock, flags); goto bail; } } -spin_unlock_irqrestore (&ibp->lock, flags); +spin_unlock_irqrestore (&ibp->rvp.lock, flags); mcast =NULL ;
@@ -170,11 +170,11 @@ bail:static int mcast_add (struct hfi1_ibdev *dev,struct hfi1_ibport *ibp,struct hfi1_mcast *mcast,struct hfi1_mcast_qp *mqp) { -struct rb_node **n = &ibp->mcast_tree.rb_node; +struct rb_node **n = &ibp->rvp.mcast_tree.rb_node;struct rb_node *pn =NULL ;int ret; -spin_lock_irq (&ibp->lock); +spin_lock_irq (&ibp->rvp.lock);while (*n) {struct hfi1_mcast *tmcast;
@@ -229,12 +229,12 @@ static int mcast_add(struct hfi1_ibdev *dev, struct hfi1_ibport *ibp,atomic_inc (&mcast->refcount);rb_link_node (&mcast->rb_node, pn, n); -rb_insert_color (&mcast->rb_node, &ibp->mcast_tree); +rb_insert_color (&mcast->rb_node, &ibp->rvp.mcast_tree); ret =0 ; bail: -spin_unlock_irq (&ibp->lock); +spin_unlock_irq (&ibp->rvp.lock);return ret; }
@@ -313,13 +313,13 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) goto bail; } -spin_lock_irq (&ibp->lock); +spin_lock_irq (&ibp->rvp.lock);/* Find the GID in the mcast table. */ - n = ibp->mcast_tree.rb_node; + n = ibp->rvp.mcast_tree.rb_node;while (1 ) {if (n ==NULL ) { -spin_unlock_irq (&ibp->lock); +spin_unlock_irq (&ibp->rvp.lock); ret = -EINVAL ; goto bail; }
@@ -348,13 +348,13 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)/* If this was the last attached QP, remove the GID too. */ if (list_empty (&mcast->qp_list)) { -rb_erase (&mcast->rb_node, &ibp->mcast_tree); +rb_erase (&mcast->rb_node, &ibp->rvp.mcast_tree); last =1 ; }break ; } -spin_unlock_irq (&ibp->lock); +spin_unlock_irq (&ibp->rvp.lock);if (p) {/*
@@ -381,5 +381,5 @@ bail:int hfi1_mcast_tree_empty (struct hfi1_ibport *ibp) { -return ibp->mcast_tree.rb_node ==NULL ; +return !ibp->rvp.mcast_tree.rb_node; }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 14/31 staging/rdma/hfi1: Remove mmap from hfi1
In reply to a message not in the archiveMmap data structure has already been moved to rdmavt and hfi1 supports it. Now that the mmap functionality has also been moved to rdmavt its time for hfi1 to use that as well.
--- drivers/staging/rdma/hfi1/Makefile | 2 drivers/staging/rdma/hfi1/cq.c | 18 ++- drivers/staging/rdma/hfi1/mmap.c | 192 ------------------------------------ drivers/staging/rdma/hfi1/qp.c | 12 +- drivers/staging/rdma/hfi1/srq.c | 20 ++-- drivers/staging/rdma/hfi1/verbs.c | 6 - drivers/staging/rdma/hfi1/verbs.h | 17 --- 7 files changed, 27 insertions(+), 240 deletions(-) delete mode 100644 drivers/staging/rdma/hfi1/mmap.c
drivers/staging/rdma/hfi1/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o hfi1-y := chip.o cq.o device.o diag.o driver.o efivar.o eprom.o file_ops.o firmware.o \ - init.o intr.o mad.o mmap.o pcie.o pio.o pio_copy.o \ + init.o intr.o mad.o pcie.o pio.o pio_copy.o \ qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \ uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs_mcast.o verbs.o hfi1-$(CONFIG_DEBUG_FS) += debugfs.o
drivers/staging/rdma/hfi1/cq.c +9 -9
@@ -277,7 +277,7 @@ struct ib_cq *hfi1_create_cq(if (udata && udata->outlen >=sizeof (__u64)) {int err; - cq->ip =hfi1_create_mmap_info (dev, sz, context, wc); + cq->ip =rvt_create_mmap_info (&dev->rdi, sz, context, wc);if (!cq->ip) { ret =ERR_PTR (-ENOMEM ); goto bail_wc;
@@ -303,9 +303,9 @@ struct ib_cq *hfi1_create_cq(spin_unlock (&dev->n_cqs_lock);if (cq->ip) { -spin_lock_irq (&dev->pending_lock); -list_add (&cq->ip->pending_mmaps, &dev->pending_mmaps); -spin_unlock_irq (&dev->pending_lock); +spin_lock_irq (&dev->rdi.pending_lock); +list_add (&cq->ip->pending_mmaps, &dev->rdi.pending_mmaps); +spin_unlock_irq (&dev->rdi.pending_lock); }/*
@@ -355,7 +355,7 @@ int hfi1_destroy_cq(struct ib_cq *ibcq) dev->n_cqs_allocated--;spin_unlock (&dev->n_cqs_lock);if (cq->ip) -kref_put (&cq->ip->ref, hfi1_release_mmap_info); +kref_put (&cq->ip->ref, rvt_release_mmap_info);else vfree (cq->queue);kfree (cq);
@@ -481,7 +481,7 @@ int hfi1_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)struct hfi1_ibdev *dev =to_idev (ibcq->device);struct rvt_mmap_info *ip = cq->ip; -hfi1_update_mmap_info (dev, ip, sz, wc); +rvt_update_mmap_info (&dev->rdi, ip, sz, wc);/* * Return the offset to mmap.
@@ -494,10 +494,10 @@ int hfi1_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) goto bail; } -spin_lock_irq (&dev->pending_lock); +spin_lock_irq (&dev->rdi.pending_lock);if (list_empty (&ip->pending_mmaps)) -list_add (&ip->pending_mmaps, &dev->pending_mmaps); -spin_unlock_irq (&dev->pending_lock); +list_add (&ip->pending_mmaps, &dev->rdi.pending_mmaps); +spin_unlock_irq (&dev->rdi.pending_lock); } ret =0 ;
drivers/staging/rdma/hfi1/mmap.c deleted +0 -192
192 lines not on this page · raw message
drivers/staging/rdma/hfi1/qp.c +6 -6
@@ -1195,7 +1195,7 @@ struct ib_qp *hfi1_create_qp(struct ib_pd *ibpd, }else {u32 s =sizeof (struct rvt_rwq ) + qp->r_rq.size * sz; - qp->ip =hfi1_create_mmap_info (dev, s, + qp->ip =rvt_create_mmap_info (&dev->rdi, s, ibpd->uobject->context, qp->r_rq.wq);if (!qp->ip) {
@@ -1223,9 +1223,9 @@ struct ib_qp *hfi1_create_qp(struct ib_pd *ibpd,spin_unlock (&dev->n_qps_lock);if (qp->ip) { -spin_lock_irq (&dev->pending_lock); -list_add (&qp->ip->pending_mmaps, &dev->pending_mmaps); -spin_unlock_irq (&dev->pending_lock); +spin_lock_irq (&dev->rdi.pending_lock); +list_add (&qp->ip->pending_mmaps, &dev->rdi.pending_mmaps); +spin_unlock_irq (&dev->rdi.pending_lock); } ret = &qp->ibqp;
@@ -1256,7 +1256,7 @@ struct ib_qp *hfi1_create_qp(struct ib_pd *ibpd, bail_ip:if (qp->ip) -kref_put (&qp->ip->ref, hfi1_release_mmap_info); +kref_put (&qp->ip->ref, rvt_release_mmap_info);else vfree (qp->r_rq.wq);free_qpn (&dev->qp_dev->qpn_table, qp->ibqp.qp_num);
@@ -1316,7 +1316,7 @@ int hfi1_destroy_qp(struct ib_qp *ibqp)spin_unlock (&dev->n_qps_lock);if (qp->ip) -kref_put (&qp->ip->ref, hfi1_release_mmap_info); +kref_put (&qp->ip->ref, rvt_release_mmap_info);else vfree (qp->r_rq.wq);vfree (qp->s_wq);
drivers/staging/rdma/hfi1/srq.c +10 -10
@@ -165,8 +165,8 @@ struct ib_srq *hfi1_create_srq(struct ib_pd *ibpd,u32 s =sizeof (struct rvt_rwq ) + srq->rq.size * sz; srq->ip = -hfi1_create_mmap_info (dev, s, ibpd->uobject->context, - srq->rq.wq); +rvt_create_mmap_info (&dev->rdi, s, ibpd->uobject->context, + srq->rq.wq);if (!srq->ip) { ret =ERR_PTR (-ENOMEM ); goto bail_wq;
@@ -200,9 +200,9 @@ struct ib_srq *hfi1_create_srq(struct ib_pd *ibpd,spin_unlock (&dev->n_srqs_lock);if (srq->ip) { -spin_lock_irq (&dev->pending_lock); -list_add (&srq->ip->pending_mmaps, &dev->pending_mmaps); -spin_unlock_irq (&dev->pending_lock); +spin_lock_irq (&dev->rdi.pending_lock); +list_add (&srq->ip->pending_mmaps, &dev->rdi.pending_mmaps); +spin_unlock_irq (&dev->rdi.pending_lock); } ret = &srq->ibsrq;
@@ -324,7 +324,7 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,struct hfi1_ibdev *dev =to_idev (srq->ibsrq.device);u32 s =sizeof (struct rvt_rwq ) + size * sz; -hfi1_update_mmap_info (dev, ip, s, wq); +rvt_update_mmap_info (&dev->rdi, ip, s, wq);/* * Return the offset to mmap.
@@ -341,11 +341,11 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,* Put user mapping info onto the pending list * unless it already is on the list. */ -spin_lock_irq (&dev->pending_lock); +spin_lock_irq (&dev->rdi.pending_lock);if (list_empty (&ip->pending_mmaps))list_add (&ip->pending_mmaps, - &dev->pending_mmaps); -spin_unlock_irq (&dev->pending_lock); + &dev->rdi.pending_mmaps); +spin_unlock_irq (&dev->rdi.pending_lock); } }else if (attr_mask &IB_SRQ_LIMIT ) {spin_lock_irq (&srq->rq.lock);
@@ -388,7 +388,7 @@ int hfi1_destroy_srq(struct ib_srq *ibsrq) dev->n_srqs_allocated--;spin_unlock (&dev->n_srqs_lock);if (srq->ip) -kref_put (&srq->ip->ref, hfi1_release_mmap_info); +kref_put (&srq->ip->ref, rvt_release_mmap_info);else vfree (srq->rq.wq);kfree (srq);
drivers/staging/rdma/hfi1/verbs.c +1 -5
@@ -1796,11 +1796,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) dev->mem_timer.function = mem_timer; dev->mem_timer.data = (unsigned long ) dev; -INIT_LIST_HEAD (&dev->pending_mmaps); -spin_lock_init (&dev->pending_lock);seqlock_init (&dev->iowait_lock); - dev->mmap_offset =PAGE_SIZE ; -spin_lock_init (&dev->mmap_offset_lock);INIT_LIST_HEAD (&dev->txwait);INIT_LIST_HEAD (&dev->memwait);
@@ -1906,7 +1902,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->attach_mcast = hfi1_multicast_attach; ibdev->detach_mcast = hfi1_multicast_detach; ibdev->process_mad = hfi1_process_mad; - ibdev->mmap = hfi1_mmap; + ibdev->mmap =NULL ; ibdev->dma_ops =NULL ; ibdev->get_port_immutable = port_immutable;
drivers/staging/rdma/hfi1/verbs.h +0 -17
@@ -426,9 +426,6 @@ struct hfi1_ibport {struct hfi1_qp_ibdev ;struct hfi1_ibdev {struct rvt_dev_info rdi;/* Must be first */ -struct list_head pending_mmaps; -spinlock_t mmap_offset_lock;/* protect mmap_offset */ -u32 mmap_offset;struct hfi1_qp_ibdev *qp_dev;
@@ -441,9 +438,6 @@ struct hfi1_ibdev {struct kmem_cache *verbs_txreq_cache;struct timer_list mem_timer; -/* other waiters */ -spinlock_t pending_lock; -u64 n_piowait;u64 n_txwait;u64 n_kmem_wait;
@@ -680,17 +674,6 @@ static inline void hfi1_put_ss(struct rvt_sge_state *ss) } } -void hfi1_release_mmap_info (struct kref *ref); - -struct rvt_mmap_info *hfi1_create_mmap_info (struct hfi1_ibdev *dev,u32 size, -struct ib_ucontext *context, -void *obj); - -void hfi1_update_mmap_info (struct hfi1_ibdev *dev,struct rvt_mmap_info *ip, -u32 size,void *obj); - -int hfi1_mmap (struct ib_ucontext *context,struct vm_area_struct *vma); -int hfi1_get_rwqe (struct rvt_qp *qp,int wr_id_only);void hfi1_migrate_qp (struct rvt_qp *qp);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 15/31 staging/rdma/hfi1: Use rdmavt pkey verbs function
In reply to a message not in the archiveNo need to keep providing the query pkey function. This is now being done in rdmavt. Remove support from hfi1. The allocation and maintenance of the list still resides in the driver.
--- drivers/staging/rdma/hfi1/verbs.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +1 -19
@@ -1679,24 +1679,6 @@ unsigned hfi1_get_npkeys(struct hfi1_devdata *dd)return ARRAY_SIZE (dd->pport[0 ].pkeys); } -static int query_pkey (struct ib_device *ibdev,u8 port,u16 index, -u16 *pkey) -{ -struct hfi1_devdata *dd =dd_from_ibdev (ibdev); -int ret; - -if (index >=hfi1_get_npkeys (dd)) { - ret = -EINVAL ; - goto bail; - } - - *pkey =hfi1_get_pkey (to_iport (ibdev, port), index); - ret =0 ; - -bail: -return ret; -} -/** * alloc_ucontext - allocate a ucontest * @ibdev: the infiniband device
@@ -1864,7 +1846,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->modify_device = modify_device; ibdev->query_port = query_port; ibdev->modify_port = modify_port; - ibdev->query_pkey = query_pkey; + ibdev->query_pkey =NULL ; ibdev->query_gid = query_gid; ibdev->alloc_ucontext = alloc_ucontext; ibdev->dealloc_ucontext = dealloc_ucontext;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 16/31 staging/rdma/hfi1: Remove user context allocation and de-alloction functions
In reply to a message not in the archiveFrom: Harish Chegondi <[email protected]>
IB user context alloc and dealloc functions have been added to rdmavt. This patch removes them from hfi1.
--- drivers/staging/rdma/hfi1/verbs.c | 44 ++----------------------------------- 1 files changed, 2 insertions(+), 42 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +2 -42
@@ -152,16 +152,6 @@ const int ib_hfi1_state_ops[IB_QPS_ERR + 1] = { HFI1_POST_SEND_OK | HFI1_FLUSH_SEND, }; -struct hfi1_ucontext { -struct ib_ucontext ibucontext; -}; - -static inline struct hfi1_ucontext *to_iucontext (struct ib_ucontext - *ibucontext) -{ - return container_of(ibucontext, struct hfi1_ucontext, ibucontext); -} -static inline void _hfi1_schedule_send (struct rvt_qp *qp);/*
@@ -1679,36 +1669,6 @@ unsigned hfi1_get_npkeys(struct hfi1_devdata *dd)return ARRAY_SIZE (dd->pport[0 ].pkeys); } -/** -* alloc_ucontext - allocate a ucontest -* @ibdev: the infiniband device -* @udata: not used by the driver -*/ - -static struct ib_ucontext *alloc_ucontext (struct ib_device *ibdev, -struct ib_udata *udata) -{ -struct hfi1_ucontext *context; -struct ib_ucontext *ret; - - context =kmalloc (sizeof (*context),GFP_KERNEL ); -if (!context) { - ret =ERR_PTR (-ENOMEM ); - goto bail; - } - - ret = &context->ibucontext; - -bail: -return ret; -} - -static int dealloc_ucontext (struct ib_ucontext *context) -{ -kfree (to_iucontext (context)); -return 0 ; -} -static void init_ibport (struct hfi1_pportdata *ppd) {struct hfi1_ibport *ibp = &ppd->ibport_data;
@@ -1848,8 +1808,8 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->modify_port = modify_port; ibdev->query_pkey =NULL ; ibdev->query_gid = query_gid; - ibdev->alloc_ucontext = alloc_ucontext; - ibdev->dealloc_ucontext = dealloc_ucontext; + ibdev->alloc_ucontext =NULL ; + ibdev->dealloc_ucontext =NULL ; ibdev->alloc_pd =NULL ; ibdev->dealloc_pd =NULL ; ibdev->create_ah =NULL ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 17/31 staging/rdma/hfi1: Use rdmavt send flags and recv flags
In reply to a message not in the archiveUse the definitions of the s_flags and r_flags which are now in rdmavt.
--- drivers/staging/rdma/hfi1/driver.c | 8 +- drivers/staging/rdma/hfi1/pio.c | 2 drivers/staging/rdma/hfi1/qp.c | 58 +++++++------- drivers/staging/rdma/hfi1/qp.h | 2 drivers/staging/rdma/hfi1/rc.c | 152 ++++++++++++++++++------------------ drivers/staging/rdma/hfi1/ruc.c | 30 ++++--- drivers/staging/rdma/hfi1/uc.c | 14 ++- drivers/staging/rdma/hfi1/ud.c | 22 +++-- drivers/staging/rdma/hfi1/verbs.c | 28 +++---- drivers/staging/rdma/hfi1/verbs.h | 85 +------------------- 10 files changed, 162 insertions(+), 239 deletions(-)
drivers/staging/rdma/hfi1/driver.c +4 -4
@@ -781,14 +781,14 @@ static inline void process_rcv_qp_work(struct hfi1_packet *packet)*/ list_for_each_entry_safe (qp, nqp, &rcd->qp_wait_list, rspwait) {list_del_init (&qp->rspwait); -if (qp->r_flags &HFI1_R_RSP_DEFERED_ACK ) { - qp->r_flags &= ~HFI1_R_RSP_DEFERED_ACK ; +if (qp->r_flags &RVT_R_RSP_NAK ) { + qp->r_flags &= ~RVT_R_RSP_NAK ;hfi1_send_rc_ack (rcd, qp,0 ); } -if (qp->r_flags &HFI1_R_RSP_SEND ) { +if (qp->r_flags &RVT_R_RSP_SEND ) {unsigned long flags; - qp->r_flags &= ~HFI1_R_RSP_SEND ; + qp->r_flags &= ~RVT_R_RSP_SEND ;spin_lock_irqsave (&qp->s_lock, flags);if (ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_OR_FLUSH_SEND )
drivers/staging/rdma/hfi1/pio.c +1 -1
@@ -1564,7 +1564,7 @@ full:write_sequnlock_irqrestore (&dev->iowait_lock, flags);for (i =0 ; i < n; i++) -hfi1_qp_wakeup (qps[i],HFI1_S_WAIT_PIO ); +hfi1_qp_wakeup (qps[i],RVT_S_WAIT_PIO ); }/* translate a send credit update to a bit code of reasons */
drivers/staging/rdma/hfi1/qp.c +29 -29
170 lines not on this page · raw message
drivers/staging/rdma/hfi1/qp.h +1 -1
@@ -125,7 +125,7 @@ static inline void clear_ahg(struct rvt_qp *qp)struct hfi1_qp_priv *priv = qp->priv; priv->s_hdr->ahgcount =0 ; - qp->s_flags &= ~(HFI1_S_AHG_VALID |HFI1_S_AHG_CLEAR ); + qp->s_flags &= ~(RVT_S_AHG_VALID |RVT_S_AHG_CLEAR );if (priv->s_sde && qp->s_ahgidx >=0 )sdma_ahg_free (priv->s_sde, qp->s_ahgidx); qp->s_ahgidx =-1 ;
drivers/staging/rdma/hfi1/rc.c +76 -76
437 lines not on this page · raw message
drivers/staging/rdma/hfi1/ruc.c +15 -15
@@ -208,7 +208,7 @@ int hfi1_get_rwqe(struct rvt_qp *qp, int wr_id_only) qp->r_wr_id = wqe->wr_id; ret =1 ; -set_bit (HFI1_R_WRID_VALID , &qp->r_aflags); +set_bit (RVT_R_WRID_VALID , &qp->r_aflags);if (handler) {u32 n;
@@ -382,11 +382,11 @@ static void ruc_loopback(struct rvt_qp *sqp)spin_lock_irqsave (&sqp->s_lock, flags);/* Return if we are already busy processing a work request. */ -if ((sqp->s_flags & (HFI1_S_BUSY |HFI1_S_ANY_WAIT )) || +if ((sqp->s_flags & (RVT_S_BUSY |RVT_S_ANY_WAIT )) || !(ib_hfi1_state_ops[sqp->state] &HFI1_PROCESS_OR_FLUSH_SEND )) goto unlock; - sqp->s_flags |=HFI1_S_BUSY ; + sqp->s_flags |=RVT_S_BUSY ; again:if (sqp->s_last == sqp->s_head)
@@ -550,7 +550,7 @@ again:if (release)hfi1_put_ss (&qp->r_sge); -if (!test_and_clear_bit (HFI1_R_WRID_VALID , &qp->r_aflags)) +if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags)) goto send_comp;if (wqe->wr.opcode ==IB_WR_RDMA_WRITE_WITH_IMM )
@@ -595,7 +595,7 @@ rnr_nak:spin_lock_irqsave (&sqp->s_lock, flags);if (!(ib_hfi1_state_ops[sqp->state] &HFI1_PROCESS_RECV_OK )) goto clr_busy; - sqp->s_flags |=HFI1_S_WAIT_RNR ; + sqp->s_flags |=RVT_S_WAIT_RNR ; sqp->s_timer.function = hfi1_rc_rnr_retry; sqp->s_timer.expires = jiffies +usecs_to_jiffies (ib_hfi1_rnr_table[qp->r_min_rnr_timer]);
@@ -625,7 +625,7 @@ serr:if (sqp->ibqp.qp_type ==IB_QPT_RC ) {int lastwqe =hfi1_error_qp (sqp,IB_WC_WR_FLUSH_ERR ); - sqp->s_flags &= ~HFI1_S_BUSY ; + sqp->s_flags &= ~RVT_S_BUSY ;spin_unlock_irqrestore (&sqp->s_lock, flags);if (lastwqe) {struct ib_event ev;
@@ -638,7 +638,7 @@ serr: goto done; } clr_busy: - sqp->s_flags &= ~HFI1_S_BUSY ; + sqp->s_flags &= ~RVT_S_BUSY ; unlock:spin_unlock_irqrestore (&sqp->s_lock, flags); done:
@@ -694,9 +694,9 @@ u32 hfi1_make_grh(struct hfi1_ibport *ibp, struct ib_grh *hdr,static inline void build_ahg (struct rvt_qp *qp,u32 npsn) {struct hfi1_qp_priv *priv = qp->priv; -if (unlikely (qp->s_flags &HFI1_S_AHG_CLEAR )) +if (unlikely (qp->s_flags &RVT_S_AHG_CLEAR ))clear_ahg (qp); -if (!(qp->s_flags &HFI1_S_AHG_VALID )) { +if (!(qp->s_flags &RVT_S_AHG_VALID )) {/* first middle that needs copy */ if (qp->s_ahgidx <0 ) qp->s_ahgidx =sdma_ahg_alloc (priv->s_sde);
@@ -706,7 +706,7 @@ static inline void build_ahg(struct rvt_qp *qp, u32 npsn)/* save to protect a change in another thread */ priv->s_hdr->sde = priv->s_sde; priv->s_hdr->ahgidx = qp->s_ahgidx; - qp->s_flags |=HFI1_S_AHG_VALID ; + qp->s_flags |=RVT_S_AHG_VALID ; } }else {/* subsequent middle after valid */
@@ -779,7 +779,7 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct hfi1_other_headers *ohdr,if (middle)build_ahg (qp, bth2);else - qp->s_flags &= ~HFI1_S_AHG_VALID ; + qp->s_flags &= ~RVT_S_AHG_VALID ; priv->s_hdr->ibh.lrh[0 ] =cpu_to_be16 (lrh0); priv->s_hdr->ibh.lrh[1 ] =cpu_to_be16 (qp->remote_ah_attr.dlid); priv->s_hdr->ibh.lrh[2] =
@@ -790,8 +790,8 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct hfi1_other_headers *ohdr, bth0 |= extra_bytes <<20 ; ohdr->bth[0 ] =cpu_to_be32 (bth0); bth1 = qp->remote_qpn; -if (qp->s_flags &HFI1_S_ECN ) { - qp->s_flags &= ~HFI1_S_ECN ; +if (qp->s_flags &RVT_S_ECN ) { + qp->s_flags &= ~RVT_S_ECN ;/* we recently received a FECN, so return a BECN */ bth1 |= (HFI1_BECN_MASK <<HFI1_BECN_SHIFT ); }
@@ -847,7 +847,7 @@ void hfi1_do_send(struct work_struct *work)return ; } - qp->s_flags |=HFI1_S_BUSY ; + qp->s_flags |=RVT_S_BUSY ;spin_unlock_irqrestore (&qp->s_lock, flags);
@@ -897,7 +897,7 @@ void hfi1_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe,atomic_dec (&ibah_to_rvtah (wqe->ud_wr.ah)->refcount);/* See ch. 11.2.4.1 and 10.7.3.1 */ -if (!(qp->s_flags &HFI1_S_SIGNAL_REQ_WR ) || +if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || (wqe->wr.send_flags &IB_SEND_SIGNALED ) || status !=IB_WC_SUCCESS ) {struct ib_wc wc;
drivers/staging/rdma/hfi1/uc.c +7 -7
@@ -84,7 +84,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp) goto bail;/* If DMAs are in progress, we can't flush immediately. */ if (atomic_read (&priv->s_iowait.sdma_busy)) { - qp->s_flags |=HFI1_S_WAIT_DMA ; + qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; }clear_ahg (qp);
@@ -241,7 +241,7 @@ done: goto unlock; bail: - qp->s_flags &= ~HFI1_S_BUSY ; + qp->s_flags &= ~RVT_S_BUSY ; unlock:spin_unlock_irqrestore (&qp->s_lock, flags);return ret;
@@ -332,7 +332,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) inv:if (qp->r_state ==OP (SEND_FIRST ) || qp->r_state ==OP (SEND_MIDDLE )) { -set_bit (HFI1_R_REWIND_SGE , &qp->r_aflags); +set_bit (RVT_R_REWIND_SGE , &qp->r_aflags); qp->r_sge.num_sge =0 ; }else hfi1_put_ss (&qp->r_sge);
@@ -382,7 +382,7 @@ inv: goto inv; } -if (qp->state ==IB_QPS_RTR && !(qp->r_flags &HFI1_R_COMM_EST )) +if (qp->state ==IB_QPS_RTR && !(qp->r_flags &RVT_R_COMM_EST ))qp_comm_est (qp);/* OK, process the packet. */
@@ -391,7 +391,7 @@ inv:case OP (SEND_ONLY ):case OP (SEND_ONLY_WITH_IMMEDIATE ): send_first: -if (test_and_clear_bit (HFI1_R_REWIND_SGE , &qp->r_aflags)) +if (test_and_clear_bit (RVT_R_REWIND_SGE , &qp->r_aflags)) qp->r_sge = qp->s_rdma_read_sge;else { ret =hfi1_get_rwqe (qp,0 );
@@ -536,7 +536,7 @@ rdma_last_imm: tlen -= (hdrsize + pad +4 );if (unlikely (tlen + qp->r_rcv_len != qp->r_len)) goto drop; -if (test_and_clear_bit (HFI1_R_REWIND_SGE , &qp->r_aflags)) +if (test_and_clear_bit (RVT_R_REWIND_SGE , &qp->r_aflags))hfi1_put_ss (&qp->s_rdma_read_sge);else { ret =hfi1_get_rwqe (qp,1 );
@@ -576,7 +576,7 @@ rdma_last:return ; rewind: -set_bit (HFI1_R_REWIND_SGE , &qp->r_aflags); +set_bit (RVT_R_REWIND_SGE , &qp->r_aflags); qp->r_sge.num_sge =0 ; drop: ibp->rvp.n_pkt_drops++;
drivers/staging/rdma/hfi1/ud.c +11 -11
@@ -161,8 +161,8 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)/* * Get the next work request entry to find where to put the data. */ -if (qp->r_flags &HFI1_R_REUSE_SGE ) - qp->r_flags &= ~HFI1_R_REUSE_SGE ; +if (qp->r_flags &RVT_R_REUSE_SGE ) + qp->r_flags &= ~RVT_R_REUSE_SGE ;else {int ret;
@@ -179,7 +179,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) }/* Silently drop packets which are too big. */ if (unlikely (wc.byte_len > qp->r_len)) { - qp->r_flags |=HFI1_R_REUSE_SGE ; + qp->r_flags |=RVT_R_REUSE_SGE ; ibp->rvp.n_pkt_drops++; goto bail_unlock; }
@@ -223,7 +223,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) length -= len; }hfi1_put_ss (&qp->r_sge); -if (!test_and_clear_bit (HFI1_R_WRID_VALID , &qp->r_aflags)) +if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags)) goto bail_unlock; wc.wr_id = qp->r_wr_id; wc.status =IB_WC_SUCCESS ;
@@ -290,7 +290,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp) goto bail;/* If DMAs are in progress, we can't flush immediately. */ if (atomic_read (&priv->s_iowait.sdma_busy)) { - qp->s_flags |=HFI1_S_WAIT_DMA ; + qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; } wqe =get_swqe_ptr (qp, qp->s_last);
@@ -324,7 +324,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp)* zero length descriptor so we get a callback. */ if (atomic_read (&priv->s_iowait.sdma_busy)) { - qp->s_flags |=HFI1_S_WAIT_DMA ; + qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; } qp->s_cur = next_cur;
@@ -426,7 +426,7 @@ done: goto unlock; bail: - qp->s_flags &= ~HFI1_S_BUSY ; + qp->s_flags &= ~RVT_S_BUSY ; unlock:spin_unlock_irqrestore (&qp->s_lock, flags);return ret;
@@ -812,8 +812,8 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)/* * Get the next work request entry to find where to put the data. */ -if (qp->r_flags &HFI1_R_REUSE_SGE ) - qp->r_flags &= ~HFI1_R_REUSE_SGE ; +if (qp->r_flags &RVT_R_REUSE_SGE ) + qp->r_flags &= ~RVT_R_REUSE_SGE ;else {int ret;
@@ -830,7 +830,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) }/* Silently drop packets which are too big. */ if (unlikely (wc.byte_len > qp->r_len)) { - qp->r_flags |=HFI1_R_REUSE_SGE ; + qp->r_flags |=RVT_R_REUSE_SGE ; goto drop; }if (has_grh) {
@@ -841,7 +841,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)hfi1_skip_sge (&qp->r_sge,sizeof (struct ib_grh ),1 );hfi1_copy_sge (&qp->r_sge, data, wc.byte_len -sizeof (struct ib_grh ),1 );hfi1_put_ss (&qp->r_sge); -if (!test_and_clear_bit (HFI1_R_WRID_VALID , &qp->r_aflags)) +if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags))return ; wc.wr_id = qp->r_wr_id; wc.status =IB_WC_SUCCESS ;
drivers/staging/rdma/hfi1/verbs.c +14 -14
@@ -702,7 +702,7 @@ static void mem_timer(unsigned long data)write_sequnlock_irqrestore (&dev->iowait_lock, flags);if (qp) -hfi1_qp_wakeup (qp,HFI1_S_WAIT_KMEM ); +hfi1_qp_wakeup (qp,RVT_S_WAIT_KMEM ); }void update_sge (struct rvt_sge_state *ss,u32 length)
@@ -740,12 +740,12 @@ static noinline struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,if (ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK &&list_empty (&priv->s_iowait.list)) { dev->n_txwait++; - qp->s_flags |=HFI1_S_WAIT_TX ; + qp->s_flags |=RVT_S_WAIT_TX ;list_add_tail (&priv->s_iowait.list, &dev->txwait); -trace_hfi1_qpsleep (qp,HFI1_S_WAIT_TX ); +trace_hfi1_qpsleep (qp,RVT_S_WAIT_TX );atomic_inc (&qp->refcount); } - qp->s_flags &= ~HFI1_S_BUSY ; + qp->s_flags &= ~RVT_S_BUSY ;write_sequnlock (&dev->iowait_lock);spin_unlock_irqrestore (&qp->s_lock, flags); tx =ERR_PTR (-EBUSY );
@@ -803,7 +803,7 @@ void hfi1_put_txreq(struct verbs_txreq *tx)list_del_init (&priv->s_iowait.list);/* refcount held until actual wake up */ write_sequnlock_irqrestore (&dev->iowait_lock, flags); -hfi1_qp_wakeup (qp,HFI1_S_WAIT_TX ); +hfi1_qp_wakeup (qp,RVT_S_WAIT_TX );break ; } }while (read_seqretry (&dev->iowait_lock, seq));
@@ -838,8 +838,8 @@ static void verbs_sdma_complete(* do the flush work until that QP's * sdma work has finished. */ -if (qp->s_flags &HFI1_S_WAIT_DMA ) { - qp->s_flags &= ~HFI1_S_WAIT_DMA ; +if (qp->s_flags &RVT_S_WAIT_DMA ) { + qp->s_flags &= ~RVT_S_WAIT_DMA ;hfi1_schedule_send (qp); } }
@@ -860,13 +860,13 @@ static int wait_kmem(struct hfi1_ibdev *dev, struct rvt_qp *qp)if (list_empty (&priv->s_iowait.list)) {if (list_empty (&dev->memwait))mod_timer (&dev->mem_timer, jiffies +1 ); - qp->s_flags |=HFI1_S_WAIT_KMEM ; + qp->s_flags |=RVT_S_WAIT_KMEM ;list_add_tail (&priv->s_iowait.list, &dev->memwait); -trace_hfi1_qpsleep (qp,HFI1_S_WAIT_KMEM ); +trace_hfi1_qpsleep (qp,RVT_S_WAIT_KMEM );atomic_inc (&qp->refcount); }write_sequnlock (&dev->iowait_lock); - qp->s_flags &= ~HFI1_S_BUSY ; + qp->s_flags &= ~RVT_S_BUSY ; ret = -EBUSY ; }spin_unlock_irqrestore (&qp->s_lock, flags);
@@ -1092,17 +1092,17 @@ static int no_bufs_available(struct rvt_qp *qp, struct send_context *sc)int was_empty; dev->n_piowait++; - qp->s_flags |=HFI1_S_WAIT_PIO ; + qp->s_flags |=RVT_S_WAIT_PIO ; was_empty =list_empty (&sc->piowait);list_add_tail (&priv->s_iowait.list, &sc->piowait); -trace_hfi1_qpsleep (qp,HFI1_S_WAIT_PIO ); +trace_hfi1_qpsleep (qp,RVT_S_WAIT_PIO );atomic_inc (&qp->refcount);/* counting: only call wantpiobuf_intr if first user */ if (was_empty)hfi1_sc_wantpiobuf_intr (sc,1 ); }write_sequnlock (&dev->iowait_lock); - qp->s_flags &= ~HFI1_S_BUSY ; + qp->s_flags &= ~RVT_S_BUSY ; ret = -EBUSY ; }spin_unlock_irqrestore (&qp->s_lock, flags);
@@ -1307,7 +1307,7 @@ bad:* @ps: the state of the packet to send * * Return zero if packet is sent or queued OK. -* Return non-zero and clear qp->s_flags HFI1_S_BUSY otherwise. +* Return non-zero and clear qp->s_flags RVT_S_BUSY otherwise. */ int hfi1_verbs_send (struct rvt_qp *qp,struct hfi1_pkt_state *ps) {
drivers/staging/rdma/hfi1/verbs.h +4 -81
103 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 18/31 staging/rdma/hfi1: Remove qpdev and qpn table from hfi1
In reply to a message not in the archiveAnother change on the way to removing queue pair functionality from hfi1. This patch removes the private queue pair structure and the table which holds the queue pair numbers in favor of using what is provided by rdmavt.
--- drivers/staging/rdma/hfi1/qp.c | 147 +++++++++++++++++++------------------ drivers/staging/rdma/hfi1/qp.h | 38 +--------- drivers/staging/rdma/hfi1/verbs.h | 3 - 3 files changed, 78 insertions(+), 110 deletions(-)
drivers/staging/rdma/hfi1/qp.c +74 -73
@@ -60,9 +60,6 @@#include "trace.h" #include "sdma.h" -#define BITS_PER_PAGE (PAGE_SIZE*BITS_PER_BYTE) -#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) -static unsigned int hfi1_qp_table_size =256 ;module_param_named (qp_table_size, hfi1_qp_table_size, uint,S_IRUGO );MODULE_PARM_DESC (qp_table_size,"QP table size" );
@@ -75,10 +72,10 @@ static int iowait_sleep( unsigned seq);static void iowait_wakeup (struct iowait *wait,int reason); -static inline unsigned mk_qpn (struct hfi1_qpn_table *qpt, -struct qpn_map *map,unsigned off) +static inline unsigned mk_qpn (struct rvt_qpn_table *qpt, +struct rvt_qpn_map *map,unsigned off) { -return (map - qpt->map) *BITS_PER_PAGE + off; +return (map - qpt->map) *RVT_BITS_PER_PAGE + off; }/*
@@ -118,7 +115,7 @@ static const u16 credit_table[31] = { 32768 /* 1E */ }; -static void get_map_page (struct hfi1_qpn_table *qpt,struct qpn_map *map) +static void get_map_page (struct rvt_qpn_table *qpt,struct rvt_qpn_map *map) {unsigned long page =get_zeroed_page (GFP_KERNEL );
@@ -138,11 +135,11 @@ static void get_map_page(struct hfi1_qpn_table *qpt, struct qpn_map *map)* Allocate the next available QPN or * zero/one for QP type IB_QPT_SMI/IB_QPT_GSI. */ -static int alloc_qpn (struct hfi1_devdata *dd,struct hfi1_qpn_table *qpt, +static int alloc_qpn (struct hfi1_devdata *dd,struct rvt_qpn_table *qpt,enum ib_qp_type type,u8 port) {u32 i, offset, max_scan, qpn; -struct qpn_map *map; +struct rvt_qpn_map *map;u32 ret;if (type ==IB_QPT_SMI || type ==IB_QPT_GSI ) {
@@ -160,11 +157,11 @@ static int alloc_qpn(struct hfi1_devdata *dd, struct hfi1_qpn_table *qpt, } qpn = qpt->last + qpt->incr; -if (qpn >=QPN_MAX ) +if (qpn >=RVT_QPN_MAX ) qpn = qpt->incr | ((qpt->last &1 ) ^1 );/* offset carries bit 0 */ - offset = qpn &BITS_PER_PAGE_MASK ; - map = &qpt->map[qpn /BITS_PER_PAGE ]; + offset = qpn &RVT_BITS_PER_PAGE_MASK ; + map = &qpt->map[qpn /RVT_BITS_PER_PAGE ]; max_scan = qpt->nmaps - !offset;for (i =0 ;;) {if (unlikely (!map->page)) {
@@ -180,18 +177,19 @@ static int alloc_qpn(struct hfi1_devdata *dd, struct hfi1_qpn_table *qpt, } offset += qpt->incr;/* -* This qpn might be bogus if offset >= BITS_PER_PAGE. -* That is OK. It gets re-assigned below +* This qpn might be bogus if offset >= +* RVT_BITS_PER_PAGE. That is OK. It gets re-assigned +* below */ qpn =mk_qpn (qpt, map, offset); - }while (offset <BITS_PER_PAGE && qpn <QPN_MAX ); + }while (offset <RVT_BITS_PER_PAGE && qpn <RVT_QPN_MAX );/* * In order to keep the number of pages allocated to a * minimum, we scan the all existing pages before increasing * the size of the bitmap table. */ if (++i > max_scan) { -if (qpt->nmaps ==QPNMAP_ENTRIES ) +if (qpt->nmaps ==RVT_QPNMAP_ENTRIES )break ; map = &qpt->map[qpt->nmaps++];/* start at incr with current bit 0 */
@@ -216,13 +214,13 @@ bail:return ret; } -static void free_qpn (struct hfi1_qpn_table *qpt,u32 qpn) +static void free_qpn (struct rvt_qpn_table *qpt,u32 qpn) { -struct qpn_map *map; +struct rvt_qpn_map *map; - map = qpt->map + qpn /BITS_PER_PAGE ; + map = qpt->map + qpn /RVT_BITS_PER_PAGE ;if (map->page) -clear_bit (qpn &BITS_PER_PAGE_MASK , map->page); +clear_bit (qpn &RVT_BITS_PER_PAGE_MASK , map->page); }/*
@@ -235,19 +233,19 @@ static void insert_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp)unsigned long flags;atomic_inc (&qp->refcount); -spin_lock_irqsave (&dev->qp_dev->qpt_lock, flags); +spin_lock_irqsave (&dev->rdi.qp_dev->qpt_lock, flags);if (qp->ibqp.qp_num <=1 ) {rcu_assign_pointer (ibp->rvp.qp[qp->ibqp.qp_num], qp); }else { -u32 n =qpn_hash (dev->qp_dev, qp->ibqp.qp_num); +u32 n =qpn_hash (dev->rdi.qp_dev, qp->ibqp.qp_num); - qp->next = dev->qp_dev->qp_table[n]; -rcu_assign_pointer (dev->qp_dev->qp_table[n], qp); + qp->next = dev->rdi.qp_dev->qp_table[n]; +rcu_assign_pointer (dev->rdi.qp_dev->qp_table[n], qp);trace_hfi1_qpinsert (qp, n); } -spin_unlock_irqrestore (&dev->qp_dev->qpt_lock, flags); +spin_unlock_irqrestore (&dev->rdi.qp_dev->qpt_lock, flags); }/*
@@ -257,40 +255,40 @@ static void insert_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp)static void remove_qp (struct hfi1_ibdev *dev,struct rvt_qp *qp) {struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); -u32 n =qpn_hash (dev->qp_dev, qp->ibqp.qp_num); +u32 n =qpn_hash (dev->rdi.qp_dev, qp->ibqp.qp_num);unsigned long flags;int removed =1 ; -spin_lock_irqsave (&dev->qp_dev->qpt_lock, flags); +spin_lock_irqsave (&dev->rdi.qp_dev->qpt_lock, flags);if (rcu_dereference_protected (ibp->rvp.qp[0 ],lockdep_is_held ( - &dev->qp_dev->qpt_lock)) == qp) { + &dev->rdi.qp_dev->qpt_lock)) == qp) {RCU_INIT_POINTER (ibp->rvp.qp[0 ],NULL ); }else if (rcu_dereference_protected (ibp->rvp.qp[1 ], -lockdep_is_held (&dev->qp_dev->qpt_lock)) == qp) { +lockdep_is_held (&dev->rdi.qp_dev->qpt_lock)) == qp) {RCU_INIT_POINTER (ibp->rvp.qp[1 ],NULL ); }else {struct rvt_qp *q;struct rvt_qp __rcu **qpp; removed =0 ; - qpp = &dev->qp_dev->qp_table[n]; + qpp = &dev->rdi.qp_dev->qp_table[n];for (; (q =rcu_dereference_protected (*qpp, -lockdep_is_held (&dev->qp_dev->qpt_lock))) +lockdep_is_held (&dev->rdi.qp_dev->qpt_lock))) !=NULL ; qpp = &q->next)if (q == qp) {RCU_INIT_POINTER (*qpp,rcu_dereference_protected (qp->next, -lockdep_is_held (&dev->qp_dev->qpt_lock))); +lockdep_is_held (&dev->rdi.qp_dev->qpt_lock))); removed =1 ;trace_hfi1_qpremove (qp, n);break ; } } -spin_unlock_irqrestore (&dev->qp_dev->qpt_lock, flags); +spin_unlock_irqrestore (&dev->rdi.qp_dev->qpt_lock, flags);if (removed) {synchronize_rcu ();if (atomic_dec_and_test (&qp->refcount))
@@ -311,6 +309,7 @@ static unsigned free_all_qps(struct hfi1_devdata *dd)unsigned long flags;struct rvt_qp *qp;unsigned n, qp_inuse =0 ; +spinlock_t *l;/* useless pointer to shutup checkpatch */ for (n =0 ; n < dd->num_pports; n++) {struct hfi1_ibport *ibp = &dd->pport[n].ibport_data;
@@ -325,19 +324,20 @@ static unsigned free_all_qps(struct hfi1_devdata *dd)rcu_read_unlock (); } -if (!dev->qp_dev) +if (!dev->rdi.qp_dev) goto bail; -spin_lock_irqsave (&dev->qp_dev->qpt_lock, flags); -for (n =0 ; n < dev->qp_dev->qp_table_size; n++) { - qp =rcu_dereference_protected (dev->qp_dev->qp_table[n], -lockdep_is_held (&dev->qp_dev->qpt_lock)); -RCU_INIT_POINTER (dev->qp_dev->qp_table[n],NULL ); +spin_lock_irqsave (&dev->rdi.qp_dev->qpt_lock, flags); +for (n =0 ; n < dev->rdi.qp_dev->qp_table_size; n++) { + l = &dev->rdi.qp_dev->qpt_lock; + qp =rcu_dereference_protected (dev->rdi.qp_dev->qp_table[n], +lockdep_is_held (l)); +RCU_INIT_POINTER (dev->rdi.qp_dev->qp_table[n],NULL );for (; qp; qp =rcu_dereference_protected (qp->next, -lockdep_is_held (&dev->qp_dev->qpt_lock))) +lockdep_is_held (l))) qp_inuse++; } -spin_unlock_irqrestore (&dev->qp_dev->qpt_lock, flags); +spin_unlock_irqrestore (&dev->rdi.qp_dev->qpt_lock, flags);synchronize_rcu (); bail:return qp_inuse;
@@ -1157,7 +1157,8 @@ struct ib_qp *hfi1_create_qp(struct ib_pd *ibpd, qp->s_flags =RVT_S_SIGNAL_REQ_WR ; dev =to_idev (ibpd->device); dd =dd_from_dev (dev); - err =alloc_qpn (dd, &dev->qp_dev->qpn_table, init_attr->qp_type, + err =alloc_qpn (dd, &dev->rdi.qp_dev->qpn_table, + init_attr->qp_type, init_attr->port_num);if (err <0 ) { ret =ERR_PTR (err);
@@ -1259,7 +1260,7 @@ bail_ip:kref_put (&qp->ip->ref, rvt_release_mmap_info); else vfree(qp->r_rq.wq); -free_qpn (&dev->qp_dev->qpn_table, qp->ibqp.qp_num); +free_qpn (&dev->rdi.qp_dev->qpn_table, qp->ibqp.qp_num); bail_qp:kfree (priv->s_hdr);kfree (priv);
@@ -1310,7 +1311,7 @@ int hfi1_destroy_qp(struct ib_qp *ibqp)spin_unlock_irq (&qp->r_lock);/* all user's cleaned up, mark it available */ -free_qpn (&dev->qp_dev->qpn_table, qp->ibqp.qp_num); +free_qpn (&dev->rdi.qp_dev->qpn_table, qp->ibqp.qp_num);spin_lock (&dev->n_qps_lock); dev->n_qps_allocated--;spin_unlock (&dev->n_qps_lock);
@@ -1330,10 +1331,10 @@ int hfi1_destroy_qp(struct ib_qp *ibqp)* init_qpn_table - initialize the QP number table for a device * @qpt: the QPN table */ -static int init_qpn_table (struct hfi1_devdata *dd,struct hfi1_qpn_table *qpt) +static int init_qpn_table (struct hfi1_devdata *dd,struct rvt_qpn_table *qpt) {u32 offset, qpn, i; -struct qpn_map *map; +struct rvt_qpn_map *map;int ret =0 ;spin_lock_init (&qpt->lock);
@@ -1343,9 +1344,9 @@ static int init_qpn_table(struct hfi1_devdata *dd, struct hfi1_qpn_table *qpt)/* insure we don't assign QPs from KDETH 64K window */ qpn = kdeth_qp <<16 ; - qpt->nmaps = qpn /BITS_PER_PAGE ; + qpt->nmaps = qpn /RVT_BITS_PER_PAGE ;/* This should always be zero */ - offset = qpn &BITS_PER_PAGE_MASK ; + offset = qpn &RVT_BITS_PER_PAGE_MASK ; map = &qpt->map[qpt->nmaps];dd_dev_info (dd,"Reserving QPNs for KDETH window from 0x%x to 0x%x\n" , qpn, qpn +65535 );
@@ -1359,7 +1360,7 @@ static int init_qpn_table(struct hfi1_devdata *dd, struct hfi1_qpn_table *qpt) }set_bit (offset, map->page); offset++; -if (offset ==BITS_PER_PAGE ) { +if (offset ==RVT_BITS_PER_PAGE ) {/* next page */ qpt->nmaps++; map++;
@@ -1373,7 +1374,7 @@ static int init_qpn_table(struct hfi1_devdata *dd, struct hfi1_qpn_table *qpt)* free_qpn_table - free the QP number table for a device * @qpt: the QPN table */ -static void free_qpn_table (struct hfi1_qpn_table *qpt) +static void free_qpn_table (struct rvt_qpn_table *qpt) {int i;
@@ -1505,31 +1506,31 @@ int hfi1_qp_init(struct hfi1_ibdev *dev)int ret = -ENOMEM ;/* allocate parent object */ - dev->qp_dev =kzalloc (sizeof (*dev->qp_dev),GFP_KERNEL ); -if (!dev->qp_dev) + dev->rdi.qp_dev =kzalloc (sizeof (*dev->rdi.qp_dev),GFP_KERNEL ); +if (!dev->rdi.qp_dev) goto nomem;/* allocate hash table */ - dev->qp_dev->qp_table_size = hfi1_qp_table_size; - dev->qp_dev->qp_table_bits =ilog2 (hfi1_qp_table_size); - dev->qp_dev->qp_table = -kmalloc (dev->qp_dev->qp_table_size * -sizeof (*dev->qp_dev->qp_table), + dev->rdi.qp_dev->qp_table_size = hfi1_qp_table_size; + dev->rdi.qp_dev->qp_table_bits =ilog2 (hfi1_qp_table_size); + dev->rdi.qp_dev->qp_table = +kmalloc (dev->rdi.qp_dev->qp_table_size * +sizeof (*dev->rdi.qp_dev->qp_table),GFP_KERNEL ); -if (!dev->qp_dev->qp_table) +if (!dev->rdi.qp_dev->qp_table) goto nomem; -for (i =0 ; i < dev->qp_dev->qp_table_size; i++) -RCU_INIT_POINTER (dev->qp_dev->qp_table[i],NULL ); -spin_lock_init (&dev->qp_dev->qpt_lock); +for (i =0 ; i < dev->rdi.qp_dev->qp_table_size; i++) +RCU_INIT_POINTER (dev->rdi.qp_dev->qp_table[i],NULL ); +spin_lock_init (&dev->rdi.qp_dev->qpt_lock);/* initialize qpn map */ - ret =init_qpn_table (dd, &dev->qp_dev->qpn_table); + ret =init_qpn_table (dd, &dev->rdi.qp_dev->qpn_table);if (ret) goto nomem;return ret; nomem: -if (dev->qp_dev) { -kfree (dev->qp_dev->qp_table); -free_qpn_table (&dev->qp_dev->qpn_table); -kfree (dev->qp_dev); +if (dev->rdi.qp_dev) { +kfree (dev->rdi.qp_dev->qp_table); +free_qpn_table (&dev->rdi.qp_dev->qpn_table); +kfree (dev->rdi.qp_dev); }return ret; }
@@ -1543,10 +1544,10 @@ void hfi1_qp_exit(struct hfi1_ibdev *dev)if (qps_inuse)dd_dev_err (dd,"QP memory leak! %u still in use\n" , qps_inuse); -if (dev->qp_dev) { -kfree (dev->qp_dev->qp_table); -free_qpn_table (&dev->qp_dev->qpn_table); -kfree (dev->qp_dev); +if (dev->rdi.qp_dev) { +kfree (dev->rdi.qp_dev->qp_table); +free_qpn_table (&dev->rdi.qp_dev->qpn_table); +kfree (dev->rdi.qp_dev); } }
@@ -1619,11 +1620,11 @@ int qp_iter_next(struct qp_iter *iter)* * n = 0..iter->specials is the special qp indices * -* n = iter->specials..dev->qp_dev->qp_table_size+iter->specials are +* n = iter->specials..dev->rdi.qp_dev->qp_table_size+iter->specials are * the potential hash bucket entries * */ -for (; n < dev->qp_dev->qp_table_size + iter->specials; n++) { +for (; n < dev->rdi.qp_dev->qp_table_size + iter->specials; n++) {if (pqp) { qp =rcu_dereference (pqp->next); }else {
@@ -1642,7 +1643,7 @@ int qp_iter_next(struct qp_iter *iter) qp =rcu_dereference (ibp->rvp.qp[1 ]); }else { qp =rcu_dereference ( - dev->qp_dev->qp_table[ + dev->rdi.qp_dev->qp_table[ (n - iter->specials)]); } }
drivers/staging/rdma/hfi1/qp.h +4 -34
@@ -51,41 +51,11 @@*/ #include <linux/hash.h> +#include <rdma/rdmavt_qp.h> #include "verbs.h" #include "sdma.h" -#define QPN_MAX BIT(24) -#define QPNMAP_ENTRIES (QPN_MAX / PAGE_SIZE / BITS_PER_BYTE) - -/* -* 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 qpn_map { -void *page; -}; - -struct hfi1_qpn_table { -spinlock_t lock;/* protect changes in this struct */ -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 qpn_map map[QPNMAP_ENTRIES ]; -}; - -struct hfi1_qp_ibdev { -u32 qp_table_size; -u32 qp_table_bits; -struct rvt_qp __rcu **qp_table; -spinlock_t qpt_lock; -struct hfi1_qpn_table qpn_table; -}; - -static inline u32 qpn_hash (struct hfi1_qp_ibdev *dev,u32 qpn) +static inline u32 qpn_hash (struct rvt_qp_ibdev *dev,u32 qpn) {return hash_32 (qpn, dev->qp_table_bits); }
@@ -107,9 +77,9 @@ static inline struct rvt_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp, qp =rcu_dereference (ibp->rvp.qp[qpn]); }else {struct hfi1_ibdev *dev = &ppd_from_ibp (ibp)->dd->verbs_dev; -u32 n =qpn_hash (dev->qp_dev, qpn); +u32 n =qpn_hash (dev->rdi.qp_dev, qpn); -for (qp =rcu_dereference (dev->qp_dev->qp_table[n]); qp; +for (qp =rcu_dereference (dev->rdi.qp_dev->qp_table[n]); qp; qp =rcu_dereference (qp->next))if (qp->ibqp.qp_num == qpn)break ;
drivers/staging/rdma/hfi1/verbs.h +0 -3
@@ -346,12 +346,9 @@ struct hfi1_ibport {u8 sc_to_sl[32 ]; }; -struct hfi1_qp_ibdev ;struct hfi1_ibdev {struct rvt_dev_info rdi;/* Must be first */ -struct hfi1_qp_ibdev *qp_dev; -/* QP numbers are shared by all IB ports */ /* protect wait lists */ seqlock_t iowait_lock;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 19/31 staging/rdma/hfi1: Remove create_qp functionality
In reply to a message not in the archiveRely on rdmavt to provide queue pair creation.
--- drivers/staging/rdma/hfi1/qp.c | 633 ++++--------------------------------- drivers/staging/rdma/hfi1/qp.h | 22 + drivers/staging/rdma/hfi1/verbs.c | 31 +- 3 files changed, 100 insertions(+), 586 deletions(-)
drivers/staging/rdma/hfi1/qp.c +70 -563
@@ -60,7 +60,7 @@#include "trace.h" #include "sdma.h" -static unsigned int hfi1_qp_table_size =256 ; +unsigned int hfi1_qp_table_size =256 ;module_param_named (qp_table_size, hfi1_qp_table_size, uint,S_IRUGO );MODULE_PARM_DESC (qp_table_size,"QP table size" );
@@ -115,105 +115,6 @@ static const u16 credit_table[31] = { 32768 /* 1E */ }; -static void get_map_page (struct rvt_qpn_table *qpt,struct rvt_qpn_map *map) -{ -unsigned long page =get_zeroed_page (GFP_KERNEL ); - -/* -* Free the page if someone raced with us installing it. -*/ - -spin_lock (&qpt->lock); -if (map->page) -free_page (page); -else - map->page = (void *)page; -spin_unlock (&qpt->lock); -} - -/* -* Allocate the next available QPN or -* zero/one for QP type IB_QPT_SMI/IB_QPT_GSI. -*/ -static int alloc_qpn (struct hfi1_devdata *dd,struct rvt_qpn_table *qpt, -enum ib_qp_type type,u8 port) -{ -u32 i, offset, max_scan, qpn; -struct rvt_qpn_map *map; -u32 ret; - -if (type ==IB_QPT_SMI || type ==IB_QPT_GSI ) { -unsigned n; - - ret = type ==IB_QPT_GSI ; - n =1 << (ret +2 * (port -1 )); -spin_lock (&qpt->lock); -if (qpt->flags & n) - ret = -EINVAL ; -else - qpt->flags |= n; -spin_unlock (&qpt->lock); - goto bail; - } - - qpn = qpt->last + qpt->incr; -if (qpn >=RVT_QPN_MAX ) - qpn = qpt->incr | ((qpt->last &1 ) ^1 ); -/* offset carries bit 0 */ - offset = qpn &RVT_BITS_PER_PAGE_MASK ; - map = &qpt->map[qpn /RVT_BITS_PER_PAGE ]; - max_scan = qpt->nmaps - !offset; -for (i =0 ;;) { -if (unlikely (!map->page)) { -get_map_page (qpt, map); -if (unlikely (!map->page)) -break ; - } -do { -if (!test_and_set_bit (offset, map->page)) { - qpt->last = qpn; - ret = qpn; - goto bail; - } - offset += qpt->incr; -/* -* This qpn might be bogus if offset >= -* RVT_BITS_PER_PAGE. That is OK. It gets re-assigned -* below -*/ - qpn =mk_qpn (qpt, map, offset); - }while (offset <RVT_BITS_PER_PAGE && qpn <RVT_QPN_MAX ); -/* -* In order to keep the number of pages allocated to a -* minimum, we scan the all existing pages before increasing -* the size of the bitmap table. -*/ -if (++i > max_scan) { -if (qpt->nmaps ==RVT_QPNMAP_ENTRIES ) -break ; - map = &qpt->map[qpt->nmaps++]; -/* start at incr with current bit 0 */ - offset = qpt->incr | (offset &1 ); - }else if (map < &qpt->map[qpt->nmaps]) { - ++map; -/* start at incr with current bit 0 */ - offset = qpt->incr | (offset &1 ); - }else { - map = &qpt->map[0 ]; -/* wrap to first map page, invert bit 0 */ - offset = qpt->incr | ((offset &1 ) ^1 ); - } -/* there can be no bits at shift and below */ -WARN_ON (offset & (dd->qos_shift -1 )); - qpn =mk_qpn (qpt, map, offset); - } - - ret = -ENOMEM ; - -bail: -return ret; -} -static void free_qpn (struct rvt_qpn_table *qpt,u32 qpn) {struct rvt_qpn_map *map;
@@ -296,113 +197,6 @@ static void remove_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp) } } -/** -* free_all_qps - check for QPs still in use -* @qpt: the QP table to empty -* -* There should not be any QPs still in use. -* Free memory for table. -*/ -static unsigned free_all_qps (struct hfi1_devdata *dd) -{ -struct hfi1_ibdev *dev = &dd->verbs_dev; -unsigned long flags; -struct rvt_qp *qp; -unsigned n, qp_inuse =0 ; -spinlock_t *l;/* useless pointer to shutup checkpatch */ - -for (n =0 ; n < dd->num_pports; n++) { -struct hfi1_ibport *ibp = &dd->pport[n].ibport_data; - -if (!hfi1_mcast_tree_empty (ibp)) - qp_inuse++; -rcu_read_lock (); -if (rcu_dereference (ibp->rvp.qp[0 ])) - qp_inuse++; -if (rcu_dereference (ibp->rvp.qp[1 ])) - qp_inuse++; -rcu_read_unlock (); - } - -if (!dev->rdi.qp_dev) - goto bail; -spin_lock_irqsave (&dev->rdi.qp_dev->qpt_lock, flags); -for (n =0 ; n < dev->rdi.qp_dev->qp_table_size; n++) { - l = &dev->rdi.qp_dev->qpt_lock; - qp =rcu_dereference_protected (dev->rdi.qp_dev->qp_table[n], -lockdep_is_held (l)); -RCU_INIT_POINTER (dev->rdi.qp_dev->qp_table[n],NULL ); - -for (; qp; qp =rcu_dereference_protected (qp->next, -lockdep_is_held (l))) - qp_inuse++; - } -spin_unlock_irqrestore (&dev->rdi.qp_dev->qpt_lock, flags); -synchronize_rcu (); -bail: -return qp_inuse; -} - -/** -* reset_qp - initialize the QP state to the reset state -* @qp: the QP to reset -* @type: the QP type -*/ -static void reset_qp (struct rvt_qp *qp,enum ib_qp_type type) -{ -struct hfi1_qp_priv *priv = qp->priv; - qp->remote_qpn =0 ; - qp->qkey =0 ; - qp->qp_access_flags =0 ; -iowait_init ( - &priv->s_iowait, -1 , - hfi1_do_send, - iowait_sleep, - iowait_wakeup); - qp->s_flags &=RVT_S_SIGNAL_REQ_WR ; - qp->s_hdrwords =0 ; - qp->s_wqe =NULL ; - qp->s_draining =0 ; - qp->s_next_psn =0 ; - qp->s_last_psn =0 ; - qp->s_sending_psn =0 ; - qp->s_sending_hpsn =0 ; - qp->s_psn =0 ; - qp->r_psn =0 ; - qp->r_msn =0 ; -if (type ==IB_QPT_RC ) { - qp->s_state =IB_OPCODE_RC_SEND_LAST ; - qp->r_state =IB_OPCODE_RC_SEND_LAST ; - }else { - qp->s_state =IB_OPCODE_UC_SEND_LAST ; - qp->r_state =IB_OPCODE_UC_SEND_LAST ; - } - qp->s_ack_state =IB_OPCODE_RC_ACKNOWLEDGE ; - qp->r_nak_state =0 ; - priv->r_adefered =0 ; - qp->r_aflags =0 ; - qp->r_flags =0 ; - qp->s_head =0 ; - qp->s_tail =0 ; - qp->s_cur =0 ; - qp->s_acked =0 ; - qp->s_last =0 ; - qp->s_ssn =1 ; - qp->s_lsn =0 ; -clear_ahg (qp); - qp->s_mig_state =IB_MIG_MIGRATED ; -memset (qp->s_ack_queue,0 ,sizeof (qp->s_ack_queue)); - qp->r_head_ack_queue =0 ; - qp->s_tail_ack_queue =0 ; - qp->s_num_rd_atomic =0 ; -if (qp->r_rq.wq) { - qp->r_rq.wq->head =0 ; - qp->r_rq.wq->tail =0 ; - } - qp->r_sge.num_sge =0 ; -} -static void clear_mr_refs (struct rvt_qp *qp,int clr_sends) {unsigned n;
@@ -756,7 +550,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,spin_lock (&qp->s_lock);clear_mr_refs (qp,1 );clear_ahg (qp); -reset_qp (qp, ibqp->qp_type); +rvt_reset_qp (&dev->rdi, qp, ibqp->qp_type); }break ;
@@ -1025,254 +819,6 @@ __be32 hfi1_compute_aeth(struct rvt_qp *qp) }/** -* hfi1_create_qp - create a queue pair for a device -* @ibpd: the protection domain who's device we create the queue pair for -* @init_attr: the attributes of the queue pair -* @udata: user data for libibverbs.so -* -* Returns the queue pair on success, otherwise returns an errno. -* -* Called by the ib_create_qp() core verbs function. -*/ -struct ib_qp *hfi1_create_qp (struct ib_pd *ibpd, -struct ib_qp_init_attr *init_attr, -struct ib_udata *udata) -{ -struct rvt_qp *qp; -struct hfi1_qp_priv *priv; -int err; -struct rvt_swqe *swq =NULL ; -struct hfi1_ibdev *dev; -struct hfi1_devdata *dd; -size_t sz; -size_t sg_list_sz; -struct ib_qp *ret; - -if (init_attr->cap.max_send_sge > hfi1_max_sges || - init_attr->cap.max_send_wr > hfi1_max_qp_wrs || - init_attr->create_flags) { - ret =ERR_PTR (-EINVAL ); - goto bail; - } - -/* Check receive queue parameters if no SRQ is specified. */ -if (!init_attr->srq) { -if (init_attr->cap.max_recv_sge > hfi1_max_sges || - init_attr->cap.max_recv_wr > hfi1_max_qp_wrs) { - ret =ERR_PTR (-EINVAL ); - goto bail; - } -if (init_attr->cap.max_send_sge + - init_attr->cap.max_send_wr + - init_attr->cap.max_recv_sge + - init_attr->cap.max_recv_wr ==0 ) { - ret =ERR_PTR (-EINVAL ); - goto bail; - } - } - -switch (init_attr->qp_type) { -case IB_QPT_SMI : -case IB_QPT_GSI : -if (init_attr->port_num ==0 || - init_attr->port_num > ibpd->device->phys_port_cnt) { - ret =ERR_PTR (-EINVAL ); - goto bail; - } -case IB_QPT_UC : -case IB_QPT_RC : -case IB_QPT_UD : - sz =sizeof (struct rvt_sge ) * - init_attr->cap.max_send_sge + -sizeof (struct rvt_swqe ); - swq =vmalloc ((init_attr->cap.max_send_wr +1 ) * sz); -if (swq ==NULL ) { - ret =ERR_PTR (-ENOMEM ); - goto bail; - } - sz =sizeof (*qp); - sg_list_sz =0 ; -if (init_attr->srq) { -struct rvt_srq *srq =ibsrq_to_rvtsrq (init_attr->srq); - -if (srq->rq.max_sge >1 ) - sg_list_sz =sizeof (*qp->r_sg_list) * - (srq->rq.max_sge -1 ); - }else if (init_attr->cap.max_recv_sge >1 ) - sg_list_sz =sizeof (*qp->r_sg_list) * - (init_attr->cap.max_recv_sge -1 ); - qp =kzalloc (sz + sg_list_sz,GFP_KERNEL ); -if (!qp) { - ret =ERR_PTR (-ENOMEM ); - goto bail_swq; - } -RCU_INIT_POINTER (qp->next,NULL ); - priv =kzalloc (sizeof (*priv),GFP_KERNEL ); -if (!priv) { - ret =ERR_PTR (-ENOMEM ); - goto bail_qp_priv; - } - priv->owner = qp; - priv->s_hdr =kzalloc (sizeof (*priv->s_hdr),GFP_KERNEL ); -if (!priv->s_hdr) { - ret =ERR_PTR (-ENOMEM ); - goto bail_qp; - } - qp->priv = priv; - qp->timeout_jiffies = -usecs_to_jiffies ((4096UL * (1UL << qp->timeout)) / -1000UL ); -if (init_attr->srq) - sz =0 ; -else { - qp->r_rq.size = init_attr->cap.max_recv_wr +1 ; - qp->r_rq.max_sge = init_attr->cap.max_recv_sge; - sz = (sizeof (struct ib_sge ) * qp->r_rq.max_sge) + -sizeof (struct rvt_rwqe ); - qp->r_rq.wq =vmalloc_user (sizeof (struct rvt_rwq ) + - qp->r_rq.size * sz); -if (!qp->r_rq.wq) { - ret =ERR_PTR (-ENOMEM ); - goto bail_qp; - } - } - -/* -* ib_create_qp() will initialize qp->ibqp -* except for qp->ibqp.qp_num. -*/ -spin_lock_init (&qp->r_lock); -spin_lock_init (&qp->s_lock); -spin_lock_init (&qp->r_rq.lock); -atomic_set (&qp->refcount,0 ); -init_waitqueue_head (&qp->wait); -init_timer (&qp->s_timer); - qp->s_timer.data = (unsigned long )qp; -INIT_LIST_HEAD (&qp->rspwait); - qp->state =IB_QPS_RESET ; - qp->s_wq = swq; - qp->s_size = init_attr->cap.max_send_wr +1 ; - qp->s_max_sge = init_attr->cap.max_send_sge; -if (init_attr->sq_sig_type ==IB_SIGNAL_REQ_WR ) - qp->s_flags =RVT_S_SIGNAL_REQ_WR ; - dev =to_idev (ibpd->device); - dd =dd_from_dev (dev); - err =alloc_qpn (dd, &dev->rdi.qp_dev->qpn_table, - init_attr->qp_type, - init_attr->port_num); -if (err <0 ) { - ret =ERR_PTR (err); -vfree (qp->r_rq.wq); - goto bail_qp; - } - qp->ibqp.qp_num = err; - qp->port_num = init_attr->port_num; -reset_qp (qp, init_attr->qp_type); - -break ; - -default : -/* Don't support raw QPs */ - ret =ERR_PTR (-ENOSYS ); - goto bail; - } - - init_attr->cap.max_inline_data =0 ; - -/* -* Return the address of the RWQ as the offset to mmap. -* See hfi1_mmap() for details. -*/ -if (udata && udata->outlen >=sizeof (__u64)) { -if (!qp->r_rq.wq) { -__u64 offset =0 ; - - err =ib_copy_to_udata (udata, &offset, -sizeof (offset)); -if (err) { - ret =ERR_PTR (err); - goto bail_ip; - } - }else { -u32 s =sizeof (struct rvt_rwq ) + qp->r_rq.size * sz; - - qp->ip =rvt_create_mmap_info (&dev->rdi, s, - ibpd->uobject->context, - qp->r_rq.wq); -if (!qp->ip) { - ret =ERR_PTR (-ENOMEM ); - goto bail_ip; - } - - err =ib_copy_to_udata (udata, &(qp->ip->offset), -sizeof (qp->ip->offset)); -if (err) { - ret =ERR_PTR (err); - goto bail_ip; - } - } - } - -spin_lock (&dev->n_qps_lock); -if (dev->n_qps_allocated == hfi1_max_qps) { -spin_unlock (&dev->n_qps_lock); - ret =ERR_PTR (-ENOMEM ); - goto bail_ip; - } - - dev->n_qps_allocated++; -spin_unlock (&dev->n_qps_lock); - -if (qp->ip) { -spin_lock_irq (&dev->rdi.pending_lock); -list_add (&qp->ip->pending_mmaps, &dev->rdi.pending_mmaps); -spin_unlock_irq (&dev->rdi.pending_lock); - } - - ret = &qp->ibqp; - -/* -* We have our QP and its good, now keep track of what types of opcodes -* can be processed on this QP. We do this by keeping track of what the -* 3 high order bits of the opcode are. -*/ -switch (init_attr->qp_type) { -case IB_QPT_SMI : -case IB_QPT_GSI : -case IB_QPT_UD : - qp->allowed_ops =IB_OPCODE_UD_SEND_ONLY &OPCODE_QP_MASK ; -break ; -case IB_QPT_RC : - qp->allowed_ops =IB_OPCODE_RC_SEND_ONLY &OPCODE_QP_MASK ; -break ; -case IB_QPT_UC : - qp->allowed_ops =IB_OPCODE_UC_SEND_ONLY &OPCODE_QP_MASK ; -break ; -default : - ret =ERR_PTR (-EINVAL ); - goto bail_ip; - } - - goto bail; - -bail_ip: -if (qp->ip) -kref_put (&qp->ip->ref, rvt_release_mmap_info); -else -vfree (qp->r_rq.wq); -free_qpn (&dev->rdi.qp_dev->qpn_table, qp->ibqp.qp_num); -bail_qp: -kfree (priv->s_hdr); -kfree (priv); -bail_qp_priv: -kfree (qp); -bail_swq: -vfree (swq); -bail: -return ret; -} - -/** * hfi1_destroy_qp - destroy a queue pair * @ibqp: the queue pair to destroy *
@@ -1328,61 +874,6 @@ int hfi1_destroy_qp(struct ib_qp *ibqp) }/** -* init_qpn_table - initialize the QP number table for a device -* @qpt: the QPN table -*/ -static int init_qpn_table (struct hfi1_devdata *dd,struct rvt_qpn_table *qpt) -{ -u32 offset, qpn, i; -struct rvt_qpn_map *map; -int ret =0 ; - -spin_lock_init (&qpt->lock); - - qpt->last =0 ; - qpt->incr =1 << dd->qos_shift; - -/* insure we don't assign QPs from KDETH 64K window */ - qpn = kdeth_qp <<16 ; - qpt->nmaps = qpn /RVT_BITS_PER_PAGE ; -/* This should always be zero */ - offset = qpn &RVT_BITS_PER_PAGE_MASK ; - map = &qpt->map[qpt->nmaps]; -dd_dev_info (dd,"Reserving QPNs for KDETH window from 0x%x to 0x%x\n" , - qpn, qpn +65535 ); -for (i =0 ; i <65536 ; i++) { -if (!map->page) { -get_map_page (qpt, map); -if (!map->page) { - ret = -ENOMEM ; -break ; - } - } -set_bit (offset, map->page); - offset++; -if (offset ==RVT_BITS_PER_PAGE ) { -/* next page */ - qpt->nmaps++; - map++; - offset =0 ; - } - } -return ret; -} - -/** -* free_qpn_table - free the QP number table for a device -* @qpt: the QPN table -*/ -static void free_qpn_table (struct rvt_qpn_table *qpt) -{ -int i; - -for (i =0 ; i <ARRAY_SIZE (qpt->map); i++) -free_page ((unsigned long ) qpt->map[i].page); -} - -/** * hfi1_get_credit - flush the send work queue of a QP * @qp: the qp who's send work queue to flush * @aeth: the Acknowledge Extended Transport Header
@@ -1499,58 +990,6 @@ static void iowait_wakeup(struct iowait *wait, int reason)hfi1_qp_wakeup (qp,RVT_S_WAIT_DMA_DESC ); } -int hfi1_qp_init (struct hfi1_ibdev *dev) -{ -struct hfi1_devdata *dd =dd_from_dev (dev); -int i; -int ret = -ENOMEM ; - -/* allocate parent object */ - dev->rdi.qp_dev =kzalloc (sizeof (*dev->rdi.qp_dev),GFP_KERNEL ); -if (!dev->rdi.qp_dev) - goto nomem; -/* allocate hash table */ - dev->rdi.qp_dev->qp_table_size = hfi1_qp_table_size; - dev->rdi.qp_dev->qp_table_bits =ilog2 (hfi1_qp_table_size); - dev->rdi.qp_dev->qp_table = -kmalloc (dev->rdi.qp_dev->qp_table_size * -sizeof (*dev->rdi.qp_dev->qp_table), -GFP_KERNEL ); -if (!dev->rdi.qp_dev->qp_table) - goto nomem; -for (i =0 ; i < dev->rdi.qp_dev->qp_table_size; i++) -RCU_INIT_POINTER (dev->rdi.qp_dev->qp_table[i],NULL ); -spin_lock_init (&dev->rdi.qp_dev->qpt_lock); -/* initialize qpn map */ - ret =init_qpn_table (dd, &dev->rdi.qp_dev->qpn_table); -if (ret) - goto nomem; -return ret; -nomem: -if (dev->rdi.qp_dev) { -kfree (dev->rdi.qp_dev->qp_table); -free_qpn_table (&dev->rdi.qp_dev->qpn_table); -kfree (dev->rdi.qp_dev); - } -return ret; -} - -void hfi1_qp_exit (struct hfi1_ibdev *dev) -{ -struct hfi1_devdata *dd =dd_from_dev (dev); -u32 qps_inuse; - - qps_inuse =free_all_qps (dd); -if (qps_inuse) -dd_dev_err (dd,"QP memory leak! %u still in use\n" , - qps_inuse); -if (dev->rdi.qp_dev) { -kfree (dev->rdi.qp_dev->qp_table); -free_qpn_table (&dev->rdi.qp_dev->qpn_table); -kfree (dev->rdi.qp_dev); - } -} -/** * * qp_to_sdma_engine - map a qp to a send engine
@@ -1724,6 +1163,74 @@ void qp_comm_est(struct rvt_qp *qp) } } +void *qp_priv_alloc (struct rvt_dev_info *rdi,struct rvt_qp *qp) +{ +struct hfi1_qp_priv *priv; + + priv =kzalloc (sizeof (*priv),GFP_KERNEL ); +if (!priv) +return ERR_PTR (-ENOMEM ); + + priv->owner = qp; + + priv->s_hdr =kzalloc (sizeof (*priv->s_hdr),GFP_KERNEL ); +if (!priv->s_hdr) { +kfree (priv); +return ERR_PTR (-ENOMEM ); + } + +return priv; +} + +void qp_priv_free (struct rvt_dev_info *rdi,struct rvt_qp *qp) +{ +struct hfi1_qp_priv *priv = qp->priv; + +kfree (priv->s_hdr); +kfree (priv); +} + +unsigned free_all_qps (struct rvt_dev_info *rdi) +{ +struct hfi1_ibdev *verbs_dev =container_of (rdi, + struct hfi1_ibdev, + rdi); +struct hfi1_devdata *dd =container_of (verbs_dev, + struct hfi1_devdata, + verbs_dev); +int n; +unsigned qp_inuse =0 ; + +for (n =0 ; n < dd->num_pports; n++) { +struct hfi1_ibport *ibp = &dd->pport[n].ibport_data; + +if (!hfi1_mcast_tree_empty (ibp)) + qp_inuse++; +rcu_read_lock (); +if (rcu_dereference (ibp->rvp.qp[0 ])) + qp_inuse++; +if (rcu_dereference (ibp->rvp.qp[1 ])) + qp_inuse++; +rcu_read_unlock (); + } + +return qp_inuse; +} + +void notify_qp_reset (struct rvt_qp *qp) +{ +struct hfi1_qp_priv *priv = qp->priv; + +iowait_init ( + &priv->s_iowait, +1 , + hfi1_do_send, + iowait_sleep, + iowait_wakeup); + priv->r_adefered =0 ; +clear_ahg (qp); +} +/* * Switch to alternate path. * The QP s_lock should be held and interrupts disabled.
drivers/staging/rdma/hfi1/qp.h +10 -12
@@ -55,6 +55,8 @@#include "verbs.h" #include "sdma.h" +extern unsigned int hfi1_qp_table_size; +static inline u32 qpn_hash (struct rvt_qp_ibdev *dev,u32 qpn) {return hash_32 (qpn, dev->qp_table_bits);
@@ -170,18 +172,6 @@ int hfi1_destroy_qp(struct ib_qp *ibqp);void hfi1_get_credit (struct rvt_qp *qp,u32 aeth);/** -* hfi1_qp_init - allocate QP tables -* @dev: a pointer to the hfi1_ibdev -*/ -int hfi1_qp_init (struct hfi1_ibdev *dev); - -/** -* hfi1_qp_exit - free the QP related structures -* @dev: a pointer to the hfi1_ibdev -*/ -void hfi1_qp_exit (struct hfi1_ibdev *dev); - -/** * hfi1_qp_wakeup - wake up on the indicated event * @qp: the QP * @flag: flag the qp on which the qp is stalled
@@ -255,4 +245,12 @@ static inline void hfi1_schedule_send(struct rvt_qp *qp)void hfi1_migrate_qp (struct rvt_qp *qp); +/* +* Functions provided by hfi1 driver for rdmavt to use +*/ +void *qp_priv_alloc (struct rvt_dev_info *rdi,struct rvt_qp *qp); +void qp_priv_free (struct rvt_dev_info *rdi,struct rvt_qp *qp); +unsigned free_all_qps (struct rvt_dev_info *rdi); +void notify_qp_reset (struct rvt_qp *qp); +#endif /* _QP_H */
drivers/staging/rdma/hfi1/verbs.c +20 -11
@@ -1720,11 +1720,6 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)u16 descq_cnt;char buf[TXREQ_NAME_LEN ]; - ret =hfi1_qp_init (dev); -if (ret) - goto err_qp_init; - -for (i =0 ; i < dd->num_pports; i++)init_ibport (ppd + i);
@@ -1820,7 +1815,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->modify_srq = hfi1_modify_srq; ibdev->query_srq = hfi1_query_srq; ibdev->destroy_srq = hfi1_destroy_srq; - ibdev->create_qp = hfi1_create_qp; + ibdev->create_qp =NULL ; ibdev->modify_qp = hfi1_modify_qp; ibdev->query_qp = hfi1_query_qp; ibdev->destroy_qp = hfi1_destroy_qp;
@@ -1861,8 +1856,25 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) dd->verbs_dev.rdi.driver_f.notify_new_ah = hfi1_notify_new_ah; dd->verbs_dev.rdi.dparms.props.max_ah = hfi1_max_ahs; dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds; - dd->verbs_dev.rdi.flags = (RVT_FLAG_QP_INIT_DRIVER | -RVT_FLAG_CQ_INIT_DRIVER ); + dd->verbs_dev.rdi.dparms.props.max_sge = hfi1_max_sges; + +/* queue pair */ + dd->verbs_dev.rdi.dparms.props.max_qp = hfi1_max_qps; + dd->verbs_dev.rdi.dparms.props.max_qp_wr = hfi1_max_qp_wrs; + dd->verbs_dev.rdi.dparms.qp_table_size = hfi1_qp_table_size; + dd->verbs_dev.rdi.dparms.qpn_start =0 ; + dd->verbs_dev.rdi.dparms.qpn_inc =1 ; + dd->verbs_dev.rdi.dparms.qos_shift = dd->qos_shift; + dd->verbs_dev.rdi.dparms.qpn_res_start = kdeth_qp <<16 ; + dd->verbs_dev.rdi.dparms.qpn_res_end = + dd->verbs_dev.rdi.dparms.qpn_res_start +65535 ; + dd->verbs_dev.rdi.driver_f.qp_priv_alloc = qp_priv_alloc; + dd->verbs_dev.rdi.driver_f.qp_priv_free = qp_priv_free; + dd->verbs_dev.rdi.driver_f.free_all_qps = free_all_qps; + dd->verbs_dev.rdi.driver_f.notify_qp_reset = notify_qp_reset; + +/* misc settings */ + dd->verbs_dev.rdi.flags =RVT_FLAG_CQ_INIT_DRIVER ; dd->verbs_dev.rdi.dparms.lkey_table_size = hfi1_lkey_table_size; dd->verbs_dev.rdi.dparms.nports = dd->num_pports; dd->verbs_dev.rdi.dparms.npkeys =hfi1_get_npkeys (dd);
@@ -1895,8 +1907,6 @@ err_agents: err_reg: err_verbs_txreq:kmem_cache_destroy (dev->verbs_txreq_cache); -hfi1_qp_exit (dev); -err_qp_init:dd_dev_err (dd,"cannot register verbs: %d!\n" , -ret); bail:return ret;
@@ -1917,7 +1927,6 @@ void hfi1_unregister_ib_device(struct hfi1_devdata *dd)if (!list_empty (&dev->memwait))dd_dev_err (dd,"memwait list not empty!\n" ); -hfi1_qp_exit (dev);del_timer_sync (&dev->mem_timer);kmem_cache_destroy (dev->verbs_txreq_cache); }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 20/31 staging/rdma/hfi1: Remove query_device function
In reply to a message not in the archiveFrom: Harish Chegondi <[email protected]>
Removed hfi1 query_device function to use rdmavt rvt_query_device function The rvt dev info device attributes still need to be filled in by the driver
--- drivers/staging/rdma/hfi1/verbs.c | 101 +++++++++++++++++-------------------- 1 files changed, 47 insertions(+), 54 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +47 -54
@@ -1362,55 +1362,49 @@ int hfi1_verbs_send(struct rvt_qp *qp, struct hfi1_pkt_state *ps)return ret; } -static int query_device (struct ib_device *ibdev, -struct ib_device_attr *props, -struct ib_udata *uhw) +/** +* hfi1_fill_device_attr - Fill in rvt dev info device attributes. +* @dd: the device data structure +*/ +static void hfi1_fill_device_attr (struct hfi1_devdata *dd) { -struct hfi1_devdata *dd =dd_from_ibdev (ibdev); -struct hfi1_ibdev *dev =to_idev (ibdev); - -if (uhw->inlen || uhw->outlen) -return -EINVAL ; -memset (props,0 ,sizeof (*props)); - - props->device_cap_flags =IB_DEVICE_BAD_PKEY_CNTR | -IB_DEVICE_BAD_QKEY_CNTR |IB_DEVICE_SHUTDOWN_PORT | -IB_DEVICE_SYS_IMAGE_GUID |IB_DEVICE_RC_RNR_NAK_GEN | -IB_DEVICE_PORT_ACTIVE_EVENT |IB_DEVICE_SRQ_RESIZE ; - - props->page_size_cap =PAGE_SIZE ; - props->vendor_id = - dd->oui1 <<16 | dd->oui2 <<8 | dd->oui3; - props->vendor_part_id = dd->pcidev->device; - props->hw_ver = dd->minrev; - props->sys_image_guid = ib_hfi1_sys_image_guid; - props->max_mr_size = ~0ULL ; - props->max_qp = hfi1_max_qps; - props->max_qp_wr = hfi1_max_qp_wrs; - props->max_sge = hfi1_max_sges; - props->max_sge_rd = hfi1_max_sges; - props->max_cq = hfi1_max_cqs; - props->max_ah = hfi1_max_ahs; - props->max_cqe = hfi1_max_cqes; - props->max_mr = dev->rdi.lkey_table.max; - props->max_fmr = dev->rdi.lkey_table.max; - props->max_map_per_fmr =32767 ; - props->max_pd = dev->rdi.dparms.props.max_pd; - props->max_qp_rd_atom =HFI1_MAX_RDMA_ATOMIC ; - props->max_qp_init_rd_atom =255 ; -/* props->max_res_rd_atom */ - props->max_srq = hfi1_max_srqs; - props->max_srq_wr = hfi1_max_srq_wrs; - props->max_srq_sge = hfi1_max_srq_sges; -/* props->local_ca_ack_delay */ - props->atomic_cap =IB_ATOMIC_GLOB ; - props->max_pkeys =hfi1_get_npkeys (dd); - props->max_mcast_grp = hfi1_max_mcast_grps; - props->max_mcast_qp_attach = hfi1_max_mcast_qp_attached; - props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * - props->max_mcast_grp; - -return 0 ; +struct rvt_dev_info *rdi = &dd->verbs_dev.rdi; + +memset (&rdi->dparms.props,0 ,sizeof (rdi->dparms.props)); + + rdi->dparms.props.device_cap_flags =IB_DEVICE_BAD_PKEY_CNTR | +IB_DEVICE_BAD_QKEY_CNTR |IB_DEVICE_SHUTDOWN_PORT | +IB_DEVICE_SYS_IMAGE_GUID |IB_DEVICE_RC_RNR_NAK_GEN | +IB_DEVICE_PORT_ACTIVE_EVENT |IB_DEVICE_SRQ_RESIZE ; + rdi->dparms.props.page_size_cap =PAGE_SIZE ; + rdi->dparms.props.vendor_id = dd->oui1 <<16 | dd->oui2 <<8 | dd->oui3; + rdi->dparms.props.vendor_part_id = dd->pcidev->device; + rdi->dparms.props.hw_ver = dd->minrev; + rdi->dparms.props.sys_image_guid = ib_hfi1_sys_image_guid; + rdi->dparms.props.max_mr_size = ~0ULL ; + rdi->dparms.props.max_qp = hfi1_max_qps; + rdi->dparms.props.max_qp_wr = hfi1_max_qp_wrs; + rdi->dparms.props.max_sge = hfi1_max_sges; + rdi->dparms.props.max_sge_rd = hfi1_max_sges; + rdi->dparms.props.max_cq = hfi1_max_cqs; + rdi->dparms.props.max_ah = hfi1_max_ahs; + rdi->dparms.props.max_cqe = hfi1_max_cqes; + rdi->dparms.props.max_mr = rdi->lkey_table.max; + rdi->dparms.props.max_fmr = rdi->lkey_table.max; + rdi->dparms.props.max_map_per_fmr =32767 ; + rdi->dparms.props.max_pd = hfi1_max_pds; + rdi->dparms.props.max_qp_rd_atom =HFI1_MAX_RDMA_ATOMIC ; + rdi->dparms.props.max_qp_init_rd_atom =255 ; + rdi->dparms.props.max_srq = hfi1_max_srqs; + rdi->dparms.props.max_srq_wr = hfi1_max_srq_wrs; + rdi->dparms.props.max_srq_sge = hfi1_max_srq_sges; + rdi->dparms.props.atomic_cap =IB_ATOMIC_GLOB ; + rdi->dparms.props.max_pkeys =hfi1_get_npkeys (dd); + rdi->dparms.props.max_mcast_grp = hfi1_max_mcast_grps; + rdi->dparms.props.max_mcast_qp_attach = hfi1_max_mcast_qp_attached; + rdi->dparms.props.max_total_mcast_qp_attach = + rdi->dparms.props.max_mcast_qp_attach * + rdi->dparms.props.max_mcast_grp; }static inline u16 opa_speed_to_ib (u16 in)
@@ -1797,7 +1791,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->phys_port_cnt = dd->num_pports; ibdev->num_comp_vectors =1 ; ibdev->dma_device = &dd->pcidev->dev; - ibdev->query_device = query_device; + ibdev->query_device =NULL ; ibdev->modify_device = modify_device; ibdev->query_port = query_port; ibdev->modify_port = modify_port;
@@ -1854,13 +1848,12 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) dd->verbs_dev.rdi.driver_f.get_pci_dev = get_pci_dev; dd->verbs_dev.rdi.driver_f.check_ah = hfi1_check_ah; dd->verbs_dev.rdi.driver_f.notify_new_ah = hfi1_notify_new_ah; - dd->verbs_dev.rdi.dparms.props.max_ah = hfi1_max_ahs; - dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds; - dd->verbs_dev.rdi.dparms.props.max_sge = hfi1_max_sges; +/* +* Fill in rvt info device attributes. +*/ +hfi1_fill_device_attr (dd);/* queue pair */ - dd->verbs_dev.rdi.dparms.props.max_qp = hfi1_max_qps; - dd->verbs_dev.rdi.dparms.props.max_qp_wr = hfi1_max_qp_wrs; dd->verbs_dev.rdi.dparms.qp_table_size = hfi1_qp_table_size; dd->verbs_dev.rdi.dparms.qpn_start =0 ; dd->verbs_dev.rdi.dparms.qpn_inc =1 ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 21/31 staging/rdma/hfi1: Remove CQ data structures and functions from hfi1
In reply to a message not in the archiveThe completion queue is not a complex data structure and it can be removed at the same time as its functions. Unlike the more complicated queue pair which was done in multiple patches. This single patch removes all traces of hfi1 specific completeion queues from the hfi1 driver.
--- drivers/staging/rdma/hfi1/Makefile | 2 drivers/staging/rdma/hfi1/cq.c | 558 ------------------------------------ drivers/staging/rdma/hfi1/hfi.h | 2 drivers/staging/rdma/hfi1/init.c | 2 drivers/staging/rdma/hfi1/qp.c | 4 drivers/staging/rdma/hfi1/rc.c | 8 - drivers/staging/rdma/hfi1/ruc.c | 10 - drivers/staging/rdma/hfi1/uc.c | 6 drivers/staging/rdma/hfi1/ud.c | 10 - drivers/staging/rdma/hfi1/verbs.c | 21 + drivers/staging/rdma/hfi1/verbs.h | 65 ---- 11 files changed, 34 insertions(+), 654 deletions(-) delete mode 100644 drivers/staging/rdma/hfi1/cq.c
drivers/staging/rdma/hfi1/Makefile +1 -1
@@ -7,7 +7,7 @@ # obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o -hfi1-y := chip.o cq.o device.o diag.o driver.o efivar.o eprom.o file_ops.o firmware.o \ +hfi1-y := chip.o device.o diag.o driver.o efivar.o eprom.o file_ops.o firmware.o \ init.o intr.o mad.o pcie.o pio.o pio_copy.o \ qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \ uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs_mcast.o verbs.o
drivers/staging/rdma/hfi1/cq.c deleted +0 -558
558 lines not on this page · raw message
drivers/staging/rdma/hfi1/hfi.h +0 -2
@@ -1009,8 +1009,6 @@ struct hfi1_devdata {u16 psxmitwait_check_rate;/* high volume overflow errors deferred to tasklet */ struct tasklet_struct error_tasklet; -/* per device cq worker */ -struct kthread_worker *worker;/* MSI-X information */ struct hfi1_msix_entry *msix_entries;
drivers/staging/rdma/hfi1/init.c +0 -2
@@ -765,7 +765,6 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit)/* enable chip even if we have an error, so we can debug cause */ enable_chip (dd); - ret =hfi1_cq_init (dd); done:/* * Set status even if port serdes is not initialized
@@ -1312,7 +1311,6 @@ static void cleanup_device_data(struct hfi1_devdata *dd)kfree (dd->boardname);vfree (dd->events);vfree (dd->status); -hfi1_cq_exit (dd); }/*
drivers/staging/rdma/hfi1/qp.c +2 -2
@@ -304,7 +304,7 @@ int hfi1_error_qp(struct rvt_qp *qp, enum ib_wc_status err)if (test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags)) { wc.wr_id = qp->r_wr_id; wc.status = err; -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc,1 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc,1 ); } wc.status =IB_WC_WR_FLUSH_ERR ;
@@ -327,7 +327,7 @@ int hfi1_error_qp(struct rvt_qp *qp, enum ib_wc_status err) wc.wr_id =get_rwqe_ptr (&qp->r_rq, tail)->wr_id;if (++tail >= qp->r_rq.size) tail =0 ; -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc,1 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc,1 ); } wq->tail = tail;
drivers/staging/rdma/hfi1/rc.c +4 -4
@@ -1040,7 +1040,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr) wc.opcode = ib_hfi1_wc_opcode[wqe->wr.opcode]; wc.byte_len = wqe->length; wc.qp = &qp->ibqp; -hfi1_cq_enter (to_icq (qp->ibqp.send_cq), &wc,0 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc,0 ); }if (++qp->s_last >= qp->s_size) qp->s_last =0 ;
@@ -1097,7 +1097,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, wc.opcode = ib_hfi1_wc_opcode[wqe->wr.opcode]; wc.byte_len = wqe->length; wc.qp = &qp->ibqp; -hfi1_cq_enter (to_icq (qp->ibqp.send_cq), &wc,0 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc,0 ); }if (++qp->s_last >= qp->s_size) qp->s_last =0 ;
@@ -2157,8 +2157,8 @@ send_last: wc.dlid_path_bits =0 ; wc.port_num =0 ;/* Signal completion event if the solicited bit is set. */ -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc, - (bth0 &IB_BTH_SOLICITED ) !=0 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, + (bth0 &IB_BTH_SOLICITED ) !=0 );break ;case OP (RDMA_WRITE_FIRST ):
drivers/staging/rdma/hfi1/ruc.c +5 -5
@@ -138,7 +138,7 @@ bad_lkey: wc.opcode =IB_WC_RECV ; wc.qp = &qp->ibqp;/* Signal solicited completion event. */ -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc,1 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc,1 ); ret =0 ; bail:return ret;
@@ -566,8 +566,8 @@ again: wc.sl = qp->remote_ah_attr.sl; wc.port_num =1 ;/* Signal completion event if the solicited bit is set. */ -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc, - wqe->wr.send_flags &IB_SEND_SOLICITED ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, + wqe->wr.send_flags &IB_SEND_SOLICITED ); send_comp:spin_lock_irqsave (&sqp->s_lock, flags);
@@ -909,8 +909,8 @@ void hfi1_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, wc.qp = &qp->ibqp;if (status ==IB_WC_SUCCESS ) wc.byte_len = wqe->length; -hfi1_cq_enter (to_icq (qp->ibqp.send_cq), &wc, - status !=IB_WC_SUCCESS ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc, + status !=IB_WC_SUCCESS ); } last = qp->s_last;
drivers/staging/rdma/hfi1/uc.c +3 -3
@@ -469,9 +469,9 @@ last_imm: wc.dlid_path_bits =0 ; wc.port_num =0 ;/* Signal completion event if the solicited bit is set. */ -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc, - (ohdr->bth[0 ] & -cpu_to_be32 (IB_BTH_SOLICITED )) !=0 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, + (ohdr->bth[0 ] & +cpu_to_be32 (IB_BTH_SOLICITED )) !=0 );break ;case OP (RDMA_WRITE_FIRST ):
drivers/staging/rdma/hfi1/ud.c +5 -5
@@ -247,8 +247,8 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) wc.dlid_path_bits = ah_attr->dlid & ((1 << ppd->lmc) -1 ); wc.port_num = qp->port_num;/* Signal completion event if the solicited bit is set. */ -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc, - swqe->wr.send_flags &IB_SEND_SOLICITED ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, + swqe->wr.send_flags &IB_SEND_SOLICITED ); ibp->rvp.n_loop_pkts++; bail_unlock:spin_unlock_irqrestore (&qp->r_lock, flags);
@@ -878,9 +878,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) dlid & ((1 <<ppd_from_ibp (ibp)->lmc) -1 ); wc.port_num = qp->port_num;/* Signal completion event if the solicited bit is set. */ -hfi1_cq_enter (to_icq (qp->ibqp.recv_cq), &wc, - (ohdr->bth[0 ] & -cpu_to_be32 (IB_BTH_SOLICITED )) !=0 ); +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, + (ohdr->bth[0 ] & +cpu_to_be32 (IB_BTH_SOLICITED )) !=0 );return ; drop:
drivers/staging/rdma/hfi1/verbs.c +13 -8
@@ -1719,7 +1719,6 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)/* Only need to initialize non-zero fields. */ -spin_lock_init (&dev->n_cqs_lock);spin_lock_init (&dev->n_qps_lock);spin_lock_init (&dev->n_srqs_lock);spin_lock_init (&dev->n_mcast_grps_lock);
@@ -1816,11 +1815,11 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->post_send = post_send; ibdev->post_recv = post_receive; ibdev->post_srq_recv = hfi1_post_srq_receive; - ibdev->create_cq = hfi1_create_cq; - ibdev->destroy_cq = hfi1_destroy_cq; - ibdev->resize_cq = hfi1_resize_cq; - ibdev->poll_cq = hfi1_poll_cq; - ibdev->req_notify_cq = hfi1_req_notify_cq; + ibdev->create_cq =NULL ; + ibdev->destroy_cq =NULL ; + ibdev->resize_cq =NULL ; + ibdev->poll_cq =NULL ; + ibdev->req_notify_cq =NULL ; ibdev->get_dma_mr =NULL ; ibdev->reg_user_mr =NULL ; ibdev->dereg_mr =NULL ;
@@ -1860,14 +1859,20 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) dd->verbs_dev.rdi.dparms.qos_shift = dd->qos_shift; dd->verbs_dev.rdi.dparms.qpn_res_start = kdeth_qp <<16 ; dd->verbs_dev.rdi.dparms.qpn_res_end = - dd->verbs_dev.rdi.dparms.qpn_res_start +65535 ; + dd->verbs_dev.rdi.dparms.qpn_res_start +65535 ; dd->verbs_dev.rdi.driver_f.qp_priv_alloc = qp_priv_alloc; dd->verbs_dev.rdi.driver_f.qp_priv_free = qp_priv_free; dd->verbs_dev.rdi.driver_f.free_all_qps = free_all_qps; dd->verbs_dev.rdi.driver_f.notify_qp_reset = notify_qp_reset; +/* completeion queue */ +snprintf (dd->verbs_dev.rdi.dparms.cq_name, +sizeof (dd->verbs_dev.rdi.dparms.cq_name), +"hfi1_cq%d" , dd->unit); + dd->verbs_dev.rdi.dparms.node = dd->assigned_node_id; +/* misc settings */ - dd->verbs_dev.rdi.flags =RVT_FLAG_CQ_INIT_DRIVER ; + dd->verbs_dev.rdi.flags =0 ;/* Let rdmavt handle it all */ dd->verbs_dev.rdi.dparms.lkey_table_size = hfi1_lkey_table_size; dd->verbs_dev.rdi.dparms.nports = dd->num_pports; dd->verbs_dev.rdi.dparms.npkeys =hfi1_get_npkeys (dd);
drivers/staging/rdma/hfi1/verbs.h +1 -64
101 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 22/31 staging/rdma/hfi1: Clean up return handling
In reply to a message not in the archiveReturn directly from rvt_resize_cq rather than use a goto/label.
--- drivers/infiniband/sw/rdmavt/cq.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rdmavt/cq.c +1 -3
@@ -432,7 +432,7 @@ int rvt_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) ret =ib_copy_to_udata (udata, &ip->offset,sizeof (ip->offset));if (ret) - goto bail; +return ret; }spin_lock_irq (&rdi->pending_lock);
@@ -447,9 +447,7 @@ bail_unlock:spin_unlock_irq (&cq->lock); bail_free:vfree (wc); -bail:return ret; - }/**
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 23/31 staging/rdma/hfi1: Use rdmavt version of post_send
In reply to a message not in the archiveThis patch removes the post_send and post_one_send from the hfi1 driver. The "posting" of sends will be done by rdmavt which will walk a WQE and queue work. This patch will still provide the capability to schedule that work as well as kick the progress. These are provided to the rdmavt layer.
--- drivers/staging/rdma/hfi1/driver.c | 8 + drivers/staging/rdma/hfi1/qp.c | 14 +- drivers/staging/rdma/hfi1/rc.c | 40 +++--- drivers/staging/rdma/hfi1/ruc.c | 28 +++- drivers/staging/rdma/hfi1/uc.c | 12 +- drivers/staging/rdma/hfi1/ud.c | 10 +- drivers/staging/rdma/hfi1/verbs.c | 201 +------------------------------ drivers/staging/rdma/hfi1/verbs.h | 35 +---- drivers/staging/rdma/hfi1/verbs_mcast.c | 4 - 9 files changed, 74 insertions(+), 278 deletions(-)
drivers/staging/rdma/hfi1/driver.c +4 -4
@@ -335,8 +335,8 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,spin_lock_irqsave (&qp->r_lock, flags);/* Check for valid receive state. */ -if (!(ib_hfi1_state_ops[qp->state] & -HFI1_PROCESS_RECV_OK )) { +if (!(ib_rvt_state_ops[qp->state] & +RVT_PROCESS_RECV_OK )) { ibp->rvp.n_pkt_drops++; }
@@ -790,8 +790,8 @@ static inline void process_rcv_qp_work(struct hfi1_packet *packet) qp->r_flags &= ~RVT_R_RSP_SEND ;spin_lock_irqsave (&qp->s_lock, flags); -if (ib_hfi1_state_ops[qp->state] & -HFI1_PROCESS_OR_FLUSH_SEND ) +if (ib_rvt_state_ops[qp->state] & +RVT_PROCESS_OR_FLUSH_SEND )hfi1_schedule_send (qp);spin_unlock_irqrestore (&qp->s_lock, flags); }
drivers/staging/rdma/hfi1/qp.c +7 -7
@@ -208,7 +208,7 @@ static void clear_mr_refs(struct rvt_qp *qp, int clr_sends)if (clr_sends) {while (qp->s_last != qp->s_head) { -struct rvt_swqe *wqe =get_swqe_ptr (qp, qp->s_last); +struct rvt_swqe *wqe =rvt_get_swqe_ptr (qp, qp->s_last);unsigned i;for (i =0 ; i < wqe->wr.num_sge; i++) {
@@ -411,7 +411,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { struct hfi1_ibdev *dev = to_idev(ibqp->device); -struct rvt_qp *qp =to_iqp (ibqp); +struct rvt_qp *qp =ibqp_to_rvtqp (ibqp);struct hfi1_qp_priv *priv = qp->priv;enum ib_qp_state cur_state, new_state;struct ib_event ev;
@@ -710,7 +710,7 @@ bail:int hfi1_query_qp (struct ib_qp *ibqp,struct ib_qp_attr *attr,int attr_mask,struct ib_qp_init_attr *init_attr) { -struct rvt_qp *qp =to_iqp (ibqp); +struct rvt_qp *qp =ibqp_to_rvtqp (ibqp); attr->qp_state = qp->state; attr->cur_qp_state = attr->qp_state;
@@ -829,7 +829,7 @@ __be32 hfi1_compute_aeth(struct rvt_qp *qp)*/ int hfi1_destroy_qp (struct ib_qp *ibqp) { -struct rvt_qp *qp =to_iqp (ibqp); +struct rvt_qp *qp =ibqp_to_rvtqp (ibqp);struct hfi1_ibdev *dev =to_idev (ibqp->device);struct hfi1_qp_priv *priv = qp->priv;
@@ -943,7 +943,7 @@ static int iowait_sleep( priv = qp->priv;spin_lock_irqsave (&qp->s_lock, flags); -if (ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK ) { +if (ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK ) {/* * If we couldn't queue the DMA request, save the info
@@ -1117,7 +1117,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter)struct sdma_engine *sde; sde =qp_to_sdma_engine (qp, priv->s_sc); - wqe =get_swqe_ptr (qp, qp->s_last); + wqe =rvt_get_swqe_ptr (qp, qp->s_last); seq_printf(s, "N %d %s QP%u R %u %s %u %u %u f=%x %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u) QP%u LID %x SL %u MTU %d %u %u %u SDE %p,%u\n", iter->n,
@@ -1224,7 +1224,7 @@ void notify_qp_reset(struct rvt_qp *qp)iowait_init ( &priv->s_iowait,1 , - hfi1_do_send, + _hfi1_do_send, iowait_sleep, iowait_wakeup); priv->r_adefered =0 ;
drivers/staging/rdma/hfi1/rc.c +20 -20
@@ -105,7 +105,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,int middle =0 ;/* Don't send an ACK if we aren't supposed to. */ -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK )) +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK )) goto bail;/* header size in 32-bit words LRH+BTH = (8+12)/4. */
@@ -291,8 +291,8 @@ int hfi1_make_rc_req(struct rvt_qp *qp) make_rc_ack(dev, qp, ohdr, pmtu)) goto done; -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_SEND_OK )) { -if (!(ib_hfi1_state_ops[qp->state] &HFI1_FLUSH_SEND )) +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_SEND_OK )) { +if (!(ib_rvt_state_ops[qp->state] &RVT_FLUSH_SEND )) goto bail;/* We are in the error state, flush the work request. */ if (qp->s_last == qp->s_head)
@@ -303,7 +303,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp) goto bail; }clear_ahg (qp); - wqe =get_swqe_ptr (qp, qp->s_last); + wqe =rvt_get_swqe_ptr (qp, qp->s_last);hfi1_send_complete (qp, wqe, qp->s_last != qp->s_acked ?IB_WC_SUCCESS :IB_WC_WR_FLUSH_ERR );/* will get called again */
@@ -323,10 +323,10 @@ int hfi1_make_rc_req(struct rvt_qp *qp) }/* Send a request. */ - wqe =get_swqe_ptr (qp, qp->s_cur); + wqe =rvt_get_swqe_ptr (qp, qp->s_cur);switch (qp->s_state) {default : -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_NEXT_SEND_OK )) +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_NEXT_SEND_OK )) goto bail;/* * Resend an old request or start a new one.
@@ -797,7 +797,7 @@ queue_ack:static void reset_psn (struct rvt_qp *qp,u32 psn) {u32 n = qp->s_acked; -struct rvt_swqe *wqe =get_swqe_ptr (qp, n); +struct rvt_swqe *wqe =rvt_get_swqe_ptr (qp, n);u32 opcode; qp->s_cur = n;
@@ -820,7 +820,7 @@ static void reset_psn(struct rvt_qp *qp, u32 psn) n =0 ;if (n == qp->s_tail)break ; - wqe =get_swqe_ptr (qp, n); + wqe =rvt_get_swqe_ptr (qp, n); diff =cmp_psn (psn, wqe->psn);if (diff <0 )break ;
@@ -882,7 +882,7 @@ done:*/ static void restart_rc (struct rvt_qp *qp,u32 psn,int wait) { -struct rvt_swqe *wqe =get_swqe_ptr (qp, qp->s_acked); +struct rvt_swqe *wqe =rvt_get_swqe_ptr (qp, qp->s_acked);struct hfi1_ibport *ibp;if (qp->s_retry ==0 ) {
@@ -964,7 +964,7 @@ static void reset_sending_psn(struct rvt_qp *qp, u32 psn)/* Find the work request corresponding to the given PSN. */ for (;;) { - wqe =get_swqe_ptr (qp, n); + wqe =rvt_get_swqe_ptr (qp, n);if (cmp_psn (psn, wqe->lpsn) <=0 ) {if (wqe->wr.opcode ==IB_WR_RDMA_READ ) qp->s_sending_psn = wqe->lpsn +1 ;
@@ -991,7 +991,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr)u32 opcode;u32 psn; -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_OR_FLUSH_SEND )) +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_OR_FLUSH_SEND ))return ;/* Find out where the BTH is */
@@ -1018,11 +1018,11 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr)if ((psn &IB_BTH_REQ_ACK ) && qp->s_acked != qp->s_tail && !(qp->s_flags & (RVT_S_TIMER |RVT_S_WAIT_RNR |RVT_S_WAIT_PSN )) && - (ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK )) + (ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK ))start_timer (qp);while (qp->s_last != qp->s_acked) { - wqe =get_swqe_ptr (qp, qp->s_last); + wqe =rvt_get_swqe_ptr (qp, qp->s_last);if (cmp_psn (wqe->lpsn, qp->s_sending_psn) >=0 &&cmp_psn (qp->s_sending_psn, qp->s_sending_hpsn) <=0 )break ;
@@ -1132,7 +1132,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp,if (++qp->s_cur >= qp->s_size) qp->s_cur =0 ; qp->s_acked = qp->s_cur; - wqe =get_swqe_ptr (qp, qp->s_cur); + wqe =rvt_get_swqe_ptr (qp, qp->s_cur);if (qp->s_acked != qp->s_tail) { qp->s_state =OP (SEND_LAST ); qp->s_psn = wqe->psn;
@@ -1142,7 +1142,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, qp->s_acked =0 ;if (qp->state ==IB_QPS_SQD && qp->s_acked == qp->s_cur) qp->s_draining =0 ; - wqe =get_swqe_ptr (qp, qp->s_acked); + wqe =rvt_get_swqe_ptr (qp, qp->s_acked); }return wqe; }
@@ -1183,7 +1183,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, ack_psn = psn;if (aeth >>29 ) ack_psn--; - wqe =get_swqe_ptr (qp, qp->s_acked); + wqe =rvt_get_swqe_ptr (qp, qp->s_acked); ibp =to_iport (qp->ibqp.device, qp->port_num);/*
@@ -1392,7 +1392,7 @@ static void rdma_seq_err(struct rvt_qp *qp, struct hfi1_ibport *ibp, u32 psn,del_timer (&qp->s_timer); } - wqe =get_swqe_ptr (qp, qp->s_acked); + wqe =rvt_get_swqe_ptr (qp, qp->s_acked);while (cmp_psn (psn, wqe->lpsn) >0 ) { if (wqe->wr.opcode == IB_WR_RDMA_READ ||
@@ -1474,7 +1474,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,if (unlikely (qp->s_acked == qp->s_tail)) goto ack_done; - wqe =get_swqe_ptr (qp, qp->s_acked); + wqe =rvt_get_swqe_ptr (qp, qp->s_acked); status =IB_WC_SUCCESS ;switch (opcode) {
@@ -1492,7 +1492,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,if (!do_rc_ack (qp, aeth, psn, opcode, val, rcd) || opcode !=OP (RDMA_READ_RESPONSE_FIRST )) goto ack_done; - wqe =get_swqe_ptr (qp, qp->s_acked); + wqe =rvt_get_swqe_ptr (qp, qp->s_acked);if (unlikely (wqe->wr.opcode !=IB_WR_RDMA_READ )) goto ack_op_err;/*
@@ -1557,7 +1557,7 @@ read_middle:* have to be careful to copy the data to the right * location. */ - wqe =get_swqe_ptr (qp, qp->s_acked); + wqe =rvt_get_swqe_ptr (qp, qp->s_acked); qp->s_rdma_read_len =restart_sge (&qp->s_rdma_read_sge, wqe, psn, pmtu); goto read_last;
drivers/staging/rdma/hfi1/ruc.c +17 -11
@@ -176,7 +176,7 @@ int hfi1_get_rwqe(struct rvt_qp *qp, int wr_id_only) }spin_lock_irqsave (&rq->lock, flags); -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK )) { +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK )) { ret =0 ; goto unlock; }
@@ -383,7 +383,7 @@ static void ruc_loopback(struct rvt_qp *sqp)/* Return if we are already busy processing a work request. */ if ((sqp->s_flags & (RVT_S_BUSY |RVT_S_ANY_WAIT )) || - !(ib_hfi1_state_ops[sqp->state] &HFI1_PROCESS_OR_FLUSH_SEND )) + !(ib_rvt_state_ops[sqp->state] &RVT_PROCESS_OR_FLUSH_SEND )) goto unlock; sqp->s_flags |=RVT_S_BUSY ;
@@ -391,11 +391,11 @@ static void ruc_loopback(struct rvt_qp *sqp) again:if (sqp->s_last == sqp->s_head) goto clr_busy; - wqe =get_swqe_ptr (sqp, sqp->s_last); + wqe =rvt_get_swqe_ptr (sqp, sqp->s_last);/* Return if it is not OK to start a new work request. */ -if (!(ib_hfi1_state_ops[sqp->state] &HFI1_PROCESS_NEXT_SEND_OK )) { -if (!(ib_hfi1_state_ops[sqp->state] &HFI1_FLUSH_SEND )) +if (!(ib_rvt_state_ops[sqp->state] &RVT_PROCESS_NEXT_SEND_OK )) { +if (!(ib_rvt_state_ops[sqp->state] &RVT_FLUSH_SEND )) goto clr_busy;/* We are in the error state, flush the work request. */ send_status =IB_WC_WR_FLUSH_ERR ;
@@ -413,7 +413,7 @@ again: }spin_unlock_irqrestore (&sqp->s_lock, flags); -if (!qp || !(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK ) || +if (!qp || !(ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK ) || qp->ibqp.qp_type != sqp->ibqp.qp_type) { ibp->rvp.n_pkt_drops++;/*
@@ -593,7 +593,7 @@ rnr_nak:if (sqp->s_rnr_retry_cnt <7 ) sqp->s_rnr_retry--;spin_lock_irqsave (&sqp->s_lock, flags); -if (!(ib_hfi1_state_ops[sqp->state] &HFI1_PROCESS_RECV_OK )) +if (!(ib_rvt_state_ops[sqp->state] &RVT_PROCESS_RECV_OK )) goto clr_busy; sqp->s_flags |=RVT_S_WAIT_RNR ; sqp->s_timer.function = hfi1_rc_rnr_retry;
@@ -802,6 +802,14 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct hfi1_other_headers *ohdr,/* when sending, force a reschedule every one of these periods */ #define SEND_RESCHED_TIMEOUT (5 * HZ)/* 5s in jiffies */ +void _hfi1_do_send (struct work_struct *work) +{ + struct iowait *wait = container_of(work, struct iowait, iowork); +struct rvt_qp *qp =iowait_to_qp (wait); + +hfi1_do_send (qp); +} +/** * hfi1_do_send - perform a send on a QP * @work: contains a pointer to the QP
@@ -810,10 +818,8 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct hfi1_other_headers *ohdr,* exhausted. Only allow one CPU to send a packet per QP (tasklet). * Otherwise, two threads could send packets out of order. */ -void hfi1_do_send (struct work_struct *work) +void hfi1_do_send (struct rvt_qp *qp) { - struct iowait *wait = container_of(work, struct iowait, iowork); -struct rvt_qp *qp =iowait_to_qp (wait);struct hfi1_pkt_state ps;int (*make_req)(struct rvt_qp *qp);unsigned long flags;
@@ -883,7 +889,7 @@ void hfi1_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe,u32 old_last, last;unsigned i; -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_OR_FLUSH_SEND )) +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_OR_FLUSH_SEND ))return ;for (i =0 ; i < wqe->wr.num_sge; i++) {
drivers/staging/rdma/hfi1/uc.c +6 -6
@@ -76,8 +76,8 @@ int hfi1_make_uc_req(struct rvt_qp *qp)spin_lock_irqsave (&qp->s_lock, flags); -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_SEND_OK )) { -if (!(ib_hfi1_state_ops[qp->state] &HFI1_FLUSH_SEND )) +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_SEND_OK )) { +if (!(ib_rvt_state_ops[qp->state] &RVT_FLUSH_SEND )) goto bail;/* We are in the error state, flush the work request. */ if (qp->s_last == qp->s_head)
@@ -88,7 +88,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp) goto bail; }clear_ahg (qp); - wqe =get_swqe_ptr (qp, qp->s_last); + wqe =rvt_get_swqe_ptr (qp, qp->s_last);hfi1_send_complete (qp, wqe,IB_WC_WR_FLUSH_ERR ); goto done; }
@@ -98,12 +98,12 @@ int hfi1_make_uc_req(struct rvt_qp *qp) ohdr = &priv->s_hdr->ibh.u.l.oth;/* Get the next send request. */ - wqe =get_swqe_ptr (qp, qp->s_cur); + wqe =rvt_get_swqe_ptr (qp, qp->s_cur); qp->s_wqe =NULL ;switch (qp->s_state) {default : -if (!(ib_hfi1_state_ops[qp->state] & -HFI1_PROCESS_NEXT_SEND_OK )) +if (!(ib_rvt_state_ops[qp->state] & +RVT_PROCESS_NEXT_SEND_OK )) goto bail;/* Check if send work queue is empty. */ if (qp->s_cur == qp->s_head) {
drivers/staging/rdma/hfi1/ud.c +5 -5
@@ -93,7 +93,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) IB_QPT_UD : qp->ibqp.qp_type;if (dqptype != sqptype || - !(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_RECV_OK )) { + !(ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK )) { ibp->rvp.n_pkt_drops++; goto drop; }
@@ -282,8 +282,8 @@ int hfi1_make_ud_req(struct rvt_qp *qp)spin_lock_irqsave (&qp->s_lock, flags); -if (!(ib_hfi1_state_ops[qp->state] &HFI1_PROCESS_NEXT_SEND_OK )) { -if (!(ib_hfi1_state_ops[qp->state] &HFI1_FLUSH_SEND )) +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_NEXT_SEND_OK )) { +if (!(ib_rvt_state_ops[qp->state] &RVT_FLUSH_SEND )) goto bail;/* We are in the error state, flush the work request. */ if (qp->s_last == qp->s_head)
@@ -293,7 +293,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp) qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; } - wqe =get_swqe_ptr (qp, qp->s_last); + wqe =rvt_get_swqe_ptr (qp, qp->s_last);hfi1_send_complete (qp, wqe,IB_WC_WR_FLUSH_ERR ); goto done; }
@@ -301,7 +301,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp)if (qp->s_cur == qp->s_head) goto bail; - wqe =get_swqe_ptr (qp, qp->s_cur); + wqe =rvt_get_swqe_ptr (qp, qp->s_cur); next_cur = qp->s_cur +1 ;if (next_cur >= qp->s_size) next_cur =0 ;
drivers/staging/rdma/hfi1/verbs.c +9 -192
260 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +4 -31
@@ -92,17 +92,6 @@ struct hfi1_packet;#define IB_NAK_REMOTE_OPERATIONAL_ERROR 0x63#define IB_NAK_INVALID_RD_REQUEST 0x64 -/* Flags for checking QP state (see ib_hfi1_state_ops[]) */ -#define HFI1_POST_SEND_OK 0x01 -#define HFI1_POST_RECV_OK 0x02 -#define HFI1_PROCESS_RECV_OK 0x04 -#define HFI1_PROCESS_SEND_OK 0x08 -#define HFI1_PROCESS_NEXT_SEND_OK 0x10 -#define HFI1_FLUSH_SEND 0x20 -#define HFI1_FLUSH_RECV 0x40 -#define HFI1_PROCESS_OR_FLUSH_SEND \ - (HFI1_PROCESS_SEND_OK | HFI1_FLUSH_SEND) -/* IB Performance Manager status values */ #define IB_PMA_SAMPLE_STATUS_DONE 0x00#define IB_PMA_SAMPLE_STATUS_STARTED 0x01
@@ -256,19 +245,6 @@ struct hfi1_pkt_state {#define HFI1_PSN_CREDIT 16/* -* Since struct rvt_swqe is not a fixed size, we can't simply index into -* struct hfi1_qp.s_wq. This function does the array index computation. -*/ -static inline struct rvt_swqe *get_swqe_ptr (struct rvt_qp *qp, -unsigned n) -{ -return (struct rvt_swqe *)((char *)qp->s_wq + - (sizeof (struct rvt_swqe ) + - qp->s_max_sge * -sizeof (struct rvt_sge )) * n); -} - -/* * Since struct rvt_rwqe is not a fixed size, we can't simply index into * struct rvt_rwq.wq. This function does the array index computation. */
@@ -359,11 +335,6 @@ struct hfi1_verbs_counters {u32 vl15_dropped; }; -static inline struct rvt_qp *to_iqp (struct ib_qp *ibqp) -{ - return container_of(ibqp, struct rvt_qp, ibqp); -} -static inline struct hfi1_ibdev *to_idev (struct ib_device *ibdev) {struct rvt_dev_info *rdi;
@@ -544,7 +515,9 @@ u32 hfi1_make_grh(struct hfi1_ibport *ibp, struct ib_grh *hdr,void hfi1_make_ruc_header (struct rvt_qp *qp,struct hfi1_other_headers *ohdr,u32 bth0,u32 bth2,int middle); -void hfi1_do_send (struct work_struct *work); +void _hfi1_do_send (struct work_struct *work); + +void hfi1_do_send (struct rvt_qp *qp);void hfi1_send_complete (struct rvt_qp *qp,struct rvt_swqe *wqe,enum ib_wc_status status);
@@ -577,7 +550,7 @@ extern const enum ib_wc_opcode ib_hfi1_wc_opcode[];extern const u8 hdr_len_by_opcode[]; -extern const int ib_hfi1_state_ops[]; +extern const int ib_rvt_state_ops[];extern __be64 ib_hfi1_sys_image_guid;/* in network order */
drivers/staging/rdma/hfi1/verbs_mcast.c +2 -2
@@ -241,7 +241,7 @@ bail:int hfi1_multicast_attach (struct ib_qp *ibqp,union ib_gid *gid,u16 lid) { -struct rvt_qp *qp =to_iqp (ibqp); +struct rvt_qp *qp =ibqp_to_rvtqp (ibqp);struct hfi1_ibdev *dev =to_idev (ibqp->device);struct hfi1_ibport *ibp;struct hfi1_mcast *mcast;
@@ -299,7 +299,7 @@ bail:int hfi1_multicast_detach (struct ib_qp *ibqp,union ib_gid *gid,u16 lid) { -struct rvt_qp *qp =to_iqp (ibqp); +struct rvt_qp *qp =ibqp_to_rvtqp (ibqp);struct hfi1_ibdev *dev =to_idev (ibqp->device);struct hfi1_ibport *ibp =to_iport (ibqp->device, qp->port_num);struct hfi1_mcast *mcast =NULL ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 24/31 staging/rdma/hfi1: Remove multicast verbs functions
In reply to a message not in the archiveMulticast is now supported by rdmavt. Remove the verbs multicast functions and use that.
--- drivers/staging/rdma/hfi1/Makefile | 2 drivers/staging/rdma/hfi1/qp.c | 2 drivers/staging/rdma/hfi1/verbs.c | 13 - drivers/staging/rdma/hfi1/verbs.h | 29 -- drivers/staging/rdma/hfi1/verbs_mcast.c | 385 ------------------------------- 5 files changed, 7 insertions(+), 424 deletions(-) delete mode 100644 drivers/staging/rdma/hfi1/verbs_mcast.c
drivers/staging/rdma/hfi1/Makefile +1 -1
@@ -10,7 +10,7 @@ obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o hfi1-y := chip.o device.o diag.o driver.o efivar.o eprom.o file_ops.o firmware.o \ init.o intr.o mad.o pcie.o pio.o pio_copy.o \ qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \ - uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs_mcast.o verbs.o + uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs.o hfi1-$(CONFIG_DEBUG_FS) += debugfs.o CFLAGS_trace.o = -I$(src)
drivers/staging/rdma/hfi1/qp.c +0 -2
@@ -1204,8 +1204,6 @@ unsigned free_all_qps(struct rvt_dev_info *rdi)for (n =0 ; n < dd->num_pports; n++) {struct hfi1_ibport *ibp = &dd->pport[n].ibport_data; -if (!hfi1_mcast_tree_empty (ibp)) - qp_inuse++;rcu_read_lock ();if (rcu_dereference (ibp->rvp.qp[0 ])) qp_inuse++;
drivers/staging/rdma/hfi1/verbs.c +6 -7
@@ -451,12 +451,12 @@ void hfi1_ib_rcv(struct hfi1_packet *packet) lid =be16_to_cpu (hdr->lrh[1 ]);if (unlikely ((lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) && (lid !=be16_to_cpu (IB_LID_PERMISSIVE )))) { -struct hfi1_mcast *mcast; -struct hfi1_mcast_qp *p; +struct rvt_mcast *mcast; +struct rvt_mcast_qp *p;if (lnh !=HFI1_LRH_GRH ) goto drop; - mcast =hfi1_mcast_find (ibp, &hdr->u.l.grh.dgid); + mcast =rvt_mcast_find (&ibp->rvp, &hdr->u.l.grh.dgid);if (mcast ==NULL ) goto drop;list_for_each_entry_rcu (p, &mcast->qp_list, list) {
@@ -467,7 +467,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)spin_unlock_irqrestore (&packet->qp->r_lock, flags); }/* -* Notify hfi1_multicast_detach() if it is waiting for us +* Notify rvt_multicast_detach() if it is waiting for us * to finish. */ if (atomic_dec_return (&mcast->refcount) <=1 )
@@ -1536,7 +1536,6 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)spin_lock_init (&dev->n_qps_lock);spin_lock_init (&dev->n_srqs_lock); -spin_lock_init (&dev->n_mcast_grps_lock);init_timer (&dev->mem_timer); dev->mem_timer.function = mem_timer; dev->mem_timer.data = (unsigned long ) dev;
@@ -1644,8 +1643,8 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->map_phys_fmr =NULL ; ibdev->unmap_fmr =NULL ; ibdev->dealloc_fmr =NULL ; - ibdev->attach_mcast = hfi1_multicast_attach; - ibdev->detach_mcast = hfi1_multicast_detach; + ibdev->attach_mcast =NULL ; + ibdev->detach_mcast =NULL ; ibdev->process_mad = hfi1_process_mad; ibdev->mmap =NULL ; ibdev->dma_ops =NULL ;
drivers/staging/rdma/hfi1/verbs.h +0 -29
@@ -201,25 +201,6 @@ struct tx_pio_header { }____cacheline_aligned ;/* -* There is one struct hfi1_mcast for each multicast GID. -* All attached QPs are then stored as a list of -* struct hfi1_mcast_qp. -*/ -struct hfi1_mcast_qp { -struct list_head list; -struct rvt_qp *qp; -}; - -struct hfi1_mcast { -struct rb_node rb_node; -union ib_gid mgid; -struct list_head qp_list; -wait_queue_head_t wait; -atomic_t refcount; -int n_attached; -}; - -/* * hfi1 specific data structures that will be hidden from rvt after the queue * pair is made common */
@@ -309,8 +290,6 @@ struct hfi1_ibdev {spinlock_t n_qps_lock;u32 n_srqs_allocated;/* number of SRQs allocated for device */ spinlock_t n_srqs_lock; -u32 n_mcast_grps_allocated;/* number of mcast groups allocated */ -spinlock_t n_mcast_grps_lock;#ifdef CONFIG_DEBUG_FS /* per HFI debugfs */ struct dentry *hfi1_ibdev_dbg;
@@ -434,14 +413,6 @@ static inline u32 delta_psn(u32 a, u32 b)return (((int )a - (int )b) <<PSN_SHIFT ) >>PSN_SHIFT ; } -struct hfi1_mcast *hfi1_mcast_find (struct hfi1_ibport *ibp,union ib_gid *mgid); - -int hfi1_multicast_attach (struct ib_qp *ibqp,union ib_gid *gid,u16 lid); - -int hfi1_multicast_detach (struct ib_qp *ibqp,union ib_gid *gid,u16 lid); - -int hfi1_mcast_tree_empty (struct hfi1_ibport *ibp); -struct verbs_txreq ;void hfi1_put_txreq (struct verbs_txreq *tx);
drivers/staging/rdma/hfi1/verbs_mcast.c deleted +0 -385
385 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 25/31 staging/rdma/hfi1: Remove modify queue pair from hfi1
In reply to a message not in the archiveIn addition to removing the modify queue pair verb from hfi1 we also remove ancillary functions which existed only for modify queue pair and are also already present in hfi1.
--- drivers/infiniband/sw/rdmavt/qp.c | 7 drivers/staging/rdma/hfi1/common.h | 1 drivers/staging/rdma/hfi1/driver.c | 19 + drivers/staging/rdma/hfi1/qp.c | 631 +++++++----------------------------- drivers/staging/rdma/hfi1/qp.h | 65 ---- drivers/staging/rdma/hfi1/rc.c | 24 + drivers/staging/rdma/hfi1/ruc.c | 17 + drivers/staging/rdma/hfi1/srq.c | 4 drivers/staging/rdma/hfi1/trace.c | 2 drivers/staging/rdma/hfi1/trace.h | 35 -- drivers/staging/rdma/hfi1/uc.c | 16 - drivers/staging/rdma/hfi1/ud.c | 15 - drivers/staging/rdma/hfi1/verbs.c | 24 + drivers/staging/rdma/hfi1/verbs.h | 31 -- 14 files changed, 205 insertions(+), 686 deletions(-)
drivers/infiniband/sw/rdmavt/qp.c +0 -7
@@ -1096,13 +1096,6 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, qp->remote_ah_attr = qp->alt_ah_attr; qp->port_num = qp->alt_ah_attr.port_num; qp->s_pkey_index = qp->s_alt_pkey_index; - -/* -* Ignored by drivers which do not support it. Not -* really worth creating a call back into the driver -* just to set a flag. -*/ - qp->s_flags |=RVT_S_AHG_CLEAR ; } }
drivers/staging/rdma/hfi1/common.h +0 -1
@@ -345,7 +345,6 @@ struct hfi1_message_header {#define HFI1_AETH_CREDIT_MASK 0x1F#define HFI1_AETH_CREDIT_INVAL 0x1F#define HFI1_MSN_MASK 0xFFFFFF -#define HFI1_QPN_MASK 0xFFFFFF#define HFI1_FECN_SHIFT 31#define HFI1_FECN_MASK 1#define HFI1_FECN_SMASK BIT(HFI1_FECN_SHIFT)
drivers/staging/rdma/hfi1/driver.c +11 -8
@@ -282,6 +282,8 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,u32 rte =rhf_rcv_type_err (packet->rhf);int lnh =be16_to_cpu (rhdr->lrh[0 ]) &3 ;struct hfi1_ibport *ibp = &ppd->ibport_data; +struct hfi1_devdata *dd = ppd->dd; +struct rvt_dev_info *rdi = &dd->verbs_dev.rdi;if (packet->rhf & (RHF_VCRC_ERR |RHF_ICRC_ERR ))return ;
@@ -316,13 +318,13 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, goto drop;/* Get the destination QP number. */ - qp_num =be32_to_cpu (ohdr->bth[1 ]) &HFI1_QPN_MASK ; + qp_num =be32_to_cpu (ohdr->bth[1 ]) &RVT_QPN_MASK ;if (lid <be16_to_cpu (IB_MULTICAST_LID_BASE )) {struct rvt_qp *qp;unsigned long flags;rcu_read_lock (); - qp =hfi1_lookup_qpn (ibp, qp_num); + qp =rvt_lookup_qpn (rdi, &ibp->rvp, qp_num);if (!qp) {rcu_read_unlock (); goto drop;
@@ -397,9 +399,9 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, sc5 |=0x10 ; sl = ibp->sc_to_sl[sc5]; - lqpn =be32_to_cpu (bth[1 ]) &HFI1_QPN_MASK ; + lqpn =be32_to_cpu (bth[1 ]) &RVT_QPN_MASK ;rcu_read_lock (); - qp =hfi1_lookup_qpn (ibp, lqpn); + qp =rvt_lookup_qpn (rdi, &ibp->rvp, lqpn);if (qp ==NULL ) {rcu_read_unlock (); goto drop;
@@ -470,7 +472,7 @@ static void process_ecn(struct rvt_qp *qp, struct hfi1_ib_header *hdr,case IB_QPT_GSI :case IB_QPT_UD : rlid =be16_to_cpu (hdr->lrh[3 ]); - rqpn =be32_to_cpu (ohdr->u.ud.deth[1 ]) &HFI1_QPN_MASK ; + rqpn =be32_to_cpu (ohdr->u.ud.deth[1 ]) &RVT_QPN_MASK ; svc_type =IB_CC_SVCTYPE_UD ;break ;case IB_QPT_UC :
@@ -500,7 +502,7 @@ static void process_ecn(struct rvt_qp *qp, struct hfi1_ib_header *hdr,if (bth1 &HFI1_BECN_SMASK ) {struct hfi1_pportdata *ppd =ppd_from_ibp (ibp); -u32 lqpn = bth1 &HFI1_QPN_MASK ; +u32 lqpn = bth1 &RVT_QPN_MASK ;u8 sl = ibp->sc_to_sl[sc5];process_becn (ppd, sl, rlid, lqpn, rqpn, svc_type);
@@ -599,6 +601,7 @@ static void prescan_rxq(struct hfi1_packet *packet)struct hfi1_ib_header *hdr;struct hfi1_other_headers *ohdr;struct ib_grh *grh =NULL ; +struct rvt_dev_info *rdi = &dd->verbs_dev.rdi;u64 rhf =rhf_to_cpu (rhf_addr);u32 etype =rhf_rcv_type (rhf), qpn, bth1;int is_ecn =0 ;
@@ -631,9 +634,9 @@ static void prescan_rxq(struct hfi1_packet *packet)if (!is_ecn) goto next; - qpn = bth1 &HFI1_QPN_MASK ; + qpn = bth1 &RVT_QPN_MASK ;rcu_read_lock (); - qp =hfi1_lookup_qpn (ibp, qpn); + qp =rvt_lookup_qpn (rdi, &ibp->rvp, qpn);if (qp ==NULL ) {rcu_read_unlock ();
drivers/staging/rdma/hfi1/qp.c +117 -514
697 lines not on this page · raw message
drivers/staging/rdma/hfi1/qp.h +8 -57
81 lines not on this page · raw message
drivers/staging/rdma/hfi1/rc.c +13 -11
@@ -49,6 +49,8 @@*/ #include <linux/io.h> +#include <rdma/rdma_vt.h> +#include <rdma/rdmavt_qp.h> #include "hfi.h" #include "qp.h"
@@ -891,7 +893,7 @@ static void restart_rc(struct rvt_qp *qp, u32 psn, int wait) qp->s_retry = qp->s_retry_cnt; }else if (qp->s_last == qp->s_acked) {hfi1_send_complete (qp, wqe,IB_WC_RETRY_EXC_ERR ); -hfi1_error_qp (qp,IB_WC_WR_FLUSH_ERR ); +rvt_error_qp (qp,IB_WC_WR_FLUSH_ERR );return ; }else /* need to handle delayed completion */ return ;
@@ -1355,7 +1357,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, class_b:if (qp->s_last == qp->s_acked) {hfi1_send_complete (qp, wqe, status); -hfi1_error_qp (qp,IB_WC_WR_FLUSH_ERR ); +rvt_error_qp (qp,IB_WC_WR_FLUSH_ERR ); }break ;
@@ -1601,7 +1603,7 @@ ack_len_err: ack_err:if (qp->s_last == qp->s_acked) {hfi1_send_complete (qp, wqe, status); -hfi1_error_qp (qp,IB_WC_WR_FLUSH_ERR ); +rvt_error_qp (qp,IB_WC_WR_FLUSH_ERR ); } ack_done:spin_unlock_irqrestore (&qp->s_lock, flags);
@@ -1832,7 +1834,7 @@ void hfi1_rc_error(struct rvt_qp *qp, enum ib_wc_status err)int lastwqe;spin_lock_irqsave (&qp->s_lock, flags); - lastwqe =hfi1_error_qp (qp, err); + lastwqe =rvt_error_qp (qp, err);spin_unlock_irqrestore (&qp->s_lock, flags);if (lastwqe) {
@@ -1873,8 +1875,8 @@ static void log_cca_event(struct hfi1_pportdata *ppd, u8 sl, u32 rlid, cc_event = &ppd->cc_events[ppd->cc_log_idx++];if (ppd->cc_log_idx ==OPA_CONG_LOG_ELEMS ) ppd->cc_log_idx =0 ; - cc_event->lqpn = lqpn &HFI1_QPN_MASK ; - cc_event->rqpn = rqpn &HFI1_QPN_MASK ; + cc_event->lqpn = lqpn &RVT_QPN_MASK ; + cc_event->rqpn = rqpn &RVT_QPN_MASK ; cc_event->sl = sl; cc_event->svc_type = svc_type; cc_event->rlid = rlid;
@@ -2063,7 +2065,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)/* OK, process the packet. */ switch (opcode) {case OP (SEND_FIRST ): - ret =hfi1_get_rwqe (qp,0 ); + ret =hfi1_rvt_get_rwqe (qp,0 );if (ret <0 ) goto nack_op_err;if (!ret)
@@ -2084,7 +2086,7 @@ send_middle:case OP (RDMA_WRITE_LAST_WITH_IMMEDIATE ):/* consume RWQE */ - ret =hfi1_get_rwqe (qp,1 ); + ret =hfi1_rvt_get_rwqe (qp,1 );if (ret <0 ) goto nack_op_err;if (!ret)
@@ -2093,7 +2095,7 @@ send_middle:case OP (SEND_ONLY ):case OP (SEND_ONLY_WITH_IMMEDIATE ): - ret =hfi1_get_rwqe (qp,0 ); + ret =hfi1_rvt_get_rwqe (qp,0 );if (ret <0 ) goto nack_op_err;if (!ret)
@@ -2125,7 +2127,7 @@ send_last:if (unlikely (wc.byte_len > qp->r_len)) goto nack_inv;hfi1_copy_sge (&qp->r_sge, data, tlen,1 ); -hfi1_put_ss (&qp->r_sge); +rvt_put_ss (&qp->r_sge); qp->r_msn++;if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags))break ;
@@ -2193,7 +2195,7 @@ send_last: goto send_middle; else if (opcode == OP(RDMA_WRITE_ONLY)) goto no_immediate_data; - ret = hfi1_get_rwqe(qp, 1); + ret = hfi1_rvt_get_rwqe(qp, 1);if (ret <0 ) goto nack_op_err;if (!ret)
drivers/staging/rdma/hfi1/ruc.c +9 -8
@@ -145,7 +145,7 @@ bail: }/** -* hfi1_get_rwqe - copy the next RWQE into the QP's RWQE +* hfi1_rvt_get_rwqe - copy the next RWQE into the QP's RWQE * @qp: the QP * @wr_id_only: update qp->r_wr_id only, not qp->r_sge *
@@ -154,7 +154,7 @@ bail:* * Can be called from interrupt level. */ -int hfi1_get_rwqe (struct rvt_qp *qp,int wr_id_only) +int hfi1_rvt_get_rwqe (struct rvt_qp *qp,int wr_id_only) {unsigned long flags;struct rvt_rq *rq;
@@ -192,7 +192,7 @@ int hfi1_get_rwqe(struct rvt_qp *qp, int wr_id_only) }/* Make sure entry is read after head index is read. */ smp_rmb (); - wqe =get_rwqe_ptr (rq, tail); + wqe =rvt_get_rwqe_ptr (rq, tail);/* * Even though we update the tail index in memory, the verbs * consumer is not supposed to post more entries until a
@@ -377,7 +377,8 @@ static void ruc_loopback(struct rvt_qp *sqp)* Note that we check the responder QP state after * checking the requester's state. */ - qp =hfi1_lookup_qpn (ibp, sqp->remote_qpn); + qp =rvt_lookup_qpn (ib_to_rvt (sqp->ibqp.device), &ibp->rvp, + sqp->remote_qpn);spin_lock_irqsave (&sqp->s_lock, flags);
@@ -441,7 +442,7 @@ again: wc.ex.imm_data = wqe->wr.ex.imm_data;/* FALLTHROUGH */ case IB_WR_SEND : - ret =hfi1_get_rwqe (qp,0 ); + ret =hfi1_rvt_get_rwqe (qp,0 );if (ret <0 ) goto op_err;if (!ret)
@@ -453,7 +454,7 @@ again: goto inv_err; wc.wc_flags =IB_WC_WITH_IMM ; wc.ex.imm_data = wqe->wr.ex.imm_data; - ret =hfi1_get_rwqe (qp,1 ); + ret =hfi1_rvt_get_rwqe (qp,1 );if (ret <0 ) goto op_err;if (!ret)
@@ -548,7 +549,7 @@ again: sqp->s_len -= len; }if (release) -hfi1_put_ss (&qp->r_sge); +rvt_put_ss (&qp->r_sge);if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags)) goto send_comp;
@@ -623,7 +624,7 @@ serr:spin_lock_irqsave (&sqp->s_lock, flags);hfi1_send_complete (sqp, wqe, send_status);if (sqp->ibqp.qp_type ==IB_QPT_RC ) { -int lastwqe =hfi1_error_qp (sqp,IB_WC_WR_FLUSH_ERR ); +int lastwqe =rvt_error_qp (sqp,IB_WC_WR_FLUSH_ERR ); sqp->s_flags &= ~RVT_S_BUSY ;spin_unlock_irqrestore (&sqp->s_lock, flags);
drivers/staging/rdma/hfi1/srq.c +2 -2
@@ -93,7 +93,7 @@ int hfi1_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr, goto bail; } - wqe =get_rwqe_ptr (&srq->rq, wq->head); + wqe =rvt_get_rwqe_ptr (&srq->rq, wq->head); wqe->wr_id = wr->wr_id; wqe->num_sge = wr->num_sge;for (i =0 ; i < wr->num_sge; i++)
@@ -299,7 +299,7 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,struct rvt_rwqe *wqe;int i; - wqe =get_rwqe_ptr (&srq->rq, tail); + wqe =rvt_get_rwqe_ptr (&srq->rq, tail); p->wr_id = wqe->wr_id; p->num_sge = wqe->num_sge;for (i =0 ; i < wqe->num_sge; i++)
drivers/staging/rdma/hfi1/trace.c +1 -1
@@ -166,7 +166,7 @@ const char *parse_everbs_hdrs(case OP (UD ,SEND_ONLY_WITH_IMMEDIATE ):trace_seq_printf (p,DETH_PRN ,be32_to_cpu (eh->ud.deth[0 ]), -be32_to_cpu (eh->ud.deth[1 ]) &HFI1_QPN_MASK ); +be32_to_cpu (eh->ud.deth[1 ]) &RVT_QPN_MASK );break ; }trace_seq_putc (p,0 );
drivers/staging/rdma/hfi1/trace.h +2 -33
@@ -364,37 +364,6 @@ DEFINE_EVENT(hfi1_qpsleepwakeup_template, hfi1_qpsleep, TP_ARGS(qp, flags));#undef TRACE_SYSTEM -#define TRACE_SYSTEM hfi1_qphash -DECLARE_EVENT_CLASS (hfi1_qphash_template, - TP_PROTO(struct rvt_qp *qp, u32 bucket), -TP_ARGS (qp, bucket), -TP_STRUCT__entry ( - DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device)) - __field(u32, qpn) -__field (u32, bucket) - ), -TP_fast_assign ( -DD_DEV_ASSIGN (dd_from_ibdev (qp->ibqp.device)) - __entry->qpn = qp->ibqp.qp_num; - __entry->bucket = bucket; - ), -TP_printk ( -"[%s] qpn 0x%x bucket %u" , -__get_str (dev), - __entry->qpn, - __entry->bucket - ) -); - -DEFINE_EVENT (hfi1_qphash_template, hfi1_qpinsert, - TP_PROTO(struct rvt_qp *qp, u32 bucket), -TP_ARGS (qp, bucket)); - -DEFINE_EVENT (hfi1_qphash_template, hfi1_qpremove, - TP_PROTO(struct rvt_qp *qp, u32 bucket), -TP_ARGS (qp, bucket)); - -#undef TRACE_SYSTEM#define TRACE_SYSTEM hfi1_ibhdrsu8 ibhdr_exhdr_len (struct hfi1_ib_header *hdr);
@@ -538,7 +507,7 @@ DECLARE_EVENT_CLASS(hfi1_ibhdr_template, (be32_to_cpu (ohdr->bth[1 ]) >>HFI1_BECN_SHIFT ) &HFI1_BECN_MASK ; __entry->qpn = -be32_to_cpu (ohdr->bth[1 ]) &HFI1_QPN_MASK ; +be32_to_cpu (ohdr->bth[1 ]) &RVT_QPN_MASK ; __entry->a = (be32_to_cpu (ohdr->bth[2 ]) >>31 ) &1 ;/* allow for larger PSN */
@@ -627,7 +596,7 @@ TRACE_EVENT(snoop_capture,DD_DEV_ASSIGN (dd); __entry->slid =be16_to_cpu (hdr->lrh[3 ]); __entry->dlid =be16_to_cpu (hdr->lrh[1 ]); - __entry->qpn =be32_to_cpu (ohdr->bth[1 ]) &HFI1_QPN_MASK ; + __entry->qpn =be32_to_cpu (ohdr->bth[1 ]) &RVT_QPN_MASK ; __entry->opcode = (be32_to_cpu (ohdr->bth[0 ]) >>24 ) &0xff ; __entry->sl = (u8)(be16_to_cpu (hdr->lrh[0 ]) >>4 ) &0xf ; __entry->pkey =be32_to_cpu (ohdr->bth[0 ]) &0xffff ;
drivers/staging/rdma/hfi1/uc.c +8 -8
@@ -292,7 +292,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)u16 rlid =be16_to_cpu (hdr->lrh[3 ]);u8 sl, sc5; - lqpn = bth1 &HFI1_QPN_MASK ; + lqpn = bth1 &RVT_QPN_MASK ; rqpn = qp->remote_qpn; sc5 = ibp->sl_to_sc[qp->remote_ah_attr.sl];
@@ -335,7 +335,7 @@ inv:set_bit (RVT_R_REWIND_SGE , &qp->r_aflags); qp->r_sge.num_sge =0 ; }else -hfi1_put_ss (&qp->r_sge); +rvt_put_ss (&qp->r_sge); qp->r_state =OP (SEND_LAST );switch (opcode) {case OP (SEND_FIRST ):
@@ -394,7 +394,7 @@ send_first:if (test_and_clear_bit (RVT_R_REWIND_SGE , &qp->r_aflags)) qp->r_sge = qp->s_rdma_read_sge;else { - ret =hfi1_get_rwqe (qp,0 ); + ret =hfi1_rvt_get_rwqe (qp,0 );if (ret <0 ) goto op_err;if (!ret)
@@ -444,7 +444,7 @@ send_last: goto rewind; wc.opcode =IB_WC_RECV ;hfi1_copy_sge (&qp->r_sge, data, tlen,0 ); -hfi1_put_ss (&qp->s_rdma_read_sge); +rvt_put_ss (&qp->s_rdma_read_sge); last_imm: wc.wr_id = qp->r_wr_id; wc.status =IB_WC_SUCCESS ;
@@ -537,9 +537,9 @@ rdma_last_imm:if (unlikely (tlen + qp->r_rcv_len != qp->r_len)) goto drop;if (test_and_clear_bit (RVT_R_REWIND_SGE , &qp->r_aflags)) -hfi1_put_ss (&qp->s_rdma_read_sge); +rvt_put_ss (&qp->s_rdma_read_sge);else { - ret =hfi1_get_rwqe (qp,1 ); + ret =hfi1_rvt_get_rwqe (qp,1 );if (ret <0 ) goto op_err;if (!ret)
@@ -548,7 +548,7 @@ rdma_last_imm: wc.byte_len = qp->r_len; wc.opcode =IB_WC_RECV_RDMA_WITH_IMM ;hfi1_copy_sge (&qp->r_sge, data, tlen,1 ); -hfi1_put_ss (&qp->r_sge); +rvt_put_ss (&qp->r_sge); goto last_imm;case OP (RDMA_WRITE_LAST ):
@@ -564,7 +564,7 @@ rdma_last:if (unlikely (tlen + qp->r_rcv_len != qp->r_len)) goto drop;hfi1_copy_sge (&qp->r_sge, data, tlen,1 ); -hfi1_put_ss (&qp->r_sge); +rvt_put_ss (&qp->r_sge);break ;default :
drivers/staging/rdma/hfi1/ud.c +8 -7
@@ -80,7 +80,8 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)rcu_read_lock (); - qp =hfi1_lookup_qpn (ibp, swqe->ud_wr.remote_qpn); + qp =rvt_lookup_qpn (ib_to_rvt (sqp->ibqp.device), &ibp->rvp, + swqe->ud_wr.remote_qpn);if (!qp) { ibp->rvp.n_pkt_drops++;rcu_read_unlock ();
@@ -166,7 +167,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)else {int ret; - ret =hfi1_get_rwqe (qp,0 ); + ret =hfi1_rvt_get_rwqe (qp,0 );if (ret <0 ) {hfi1_rc_error (qp,IB_WC_LOC_QP_OP_ERR ); goto bail_unlock;
@@ -222,7 +223,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) } length -= len; } -hfi1_put_ss (&qp->r_sge); +rvt_put_ss (&qp->r_sge);if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags)) goto bail_unlock; wc.wr_id = qp->r_wr_id;
@@ -664,7 +665,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)struct ib_grh *grh =NULL ; qkey =be32_to_cpu (ohdr->u.ud.deth[0 ]); - src_qp =be32_to_cpu (ohdr->u.ud.deth[1 ]) &HFI1_QPN_MASK ; + src_qp =be32_to_cpu (ohdr->u.ud.deth[1 ]) &RVT_QPN_MASK ; dlid =be16_to_cpu (hdr->lrh[1 ]); is_mcast = (dlid >be16_to_cpu (IB_MULTICAST_LID_BASE )) && (dlid !=be16_to_cpu (IB_LID_PERMISSIVE ));
@@ -675,7 +676,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)* error path. */ struct hfi1_pportdata *ppd =ppd_from_ibp (ibp); -u32 lqpn =be32_to_cpu (ohdr->bth[1 ]) &HFI1_QPN_MASK ; +u32 lqpn =be32_to_cpu (ohdr->bth[1 ]) &RVT_QPN_MASK ;u8 sl, sc5; sc5 = (be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ;
@@ -817,7 +818,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)else {int ret; - ret =hfi1_get_rwqe (qp,0 ); + ret =hfi1_rvt_get_rwqe (qp,0 );if (ret <0 ) {hfi1_rc_error (qp,IB_WC_LOC_QP_OP_ERR );return ;
@@ -840,7 +841,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) }else hfi1_skip_sge (&qp->r_sge,sizeof (struct ib_grh ),1 );hfi1_copy_sge (&qp->r_sge, data, wc.byte_len -sizeof (struct ib_grh ),1 ); -hfi1_put_ss (&qp->r_sge); +rvt_put_ss (&qp->r_sge);if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags))return ; wc.wr_id = qp->r_wr_id;
drivers/staging/rdma/hfi1/verbs.c +19 -5
@@ -368,7 +368,7 @@ static int post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, goto bail; } - wqe =get_rwqe_ptr (&qp->r_rq, wq->head); + wqe =rvt_get_rwqe_ptr (&qp->r_rq, wq->head); wqe->wr_id = wr->wr_id; wqe->num_sge = wr->num_sge;for (i =0 ; i < wr->num_sge; i++)
@@ -418,6 +418,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)u32 tlen = packet->tlen;struct hfi1_pportdata *ppd = rcd->ppd;struct hfi1_ibport *ibp = &ppd->ibport_data; +struct rvt_dev_info *rdi = &ppd->dd->verbs_dev.rdi;unsigned long flags;u32 qp_num;int lnh;
@@ -447,7 +448,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)inc_opstats (tlen, &rcd->opstats->stats[opcode]);/* Get the destination QP number. */ - qp_num =be32_to_cpu (packet->ohdr->bth[1 ]) &HFI1_QPN_MASK ; + qp_num =be32_to_cpu (packet->ohdr->bth[1 ]) &RVT_QPN_MASK ; lid =be16_to_cpu (hdr->lrh[1 ]);if (unlikely ((lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) && (lid !=be16_to_cpu (IB_LID_PERMISSIVE )))) {
@@ -474,7 +475,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)wake_up (&mcast->wait); }else {rcu_read_lock (); - packet->qp =hfi1_lookup_qpn (ibp, qp_num); + packet->qp =rvt_lookup_qpn (rdi, &ibp->rvp, qp_num);if (!packet->qp) {rcu_read_unlock (); goto drop;
@@ -1534,7 +1535,6 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)/* Only need to initialize non-zero fields. */ -spin_lock_init (&dev->n_qps_lock);spin_lock_init (&dev->n_srqs_lock);init_timer (&dev->mem_timer); dev->mem_timer.function = mem_timer;
@@ -1623,7 +1623,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->query_srq = hfi1_query_srq; ibdev->destroy_srq = hfi1_destroy_srq; ibdev->create_qp =NULL ; - ibdev->modify_qp = hfi1_modify_qp; + ibdev->modify_qp =NULL ; ibdev->query_qp = hfi1_query_qp; ibdev->destroy_qp = hfi1_destroy_qp; ibdev->post_send =NULL ;
@@ -1674,12 +1674,26 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) dd->verbs_dev.rdi.dparms.qpn_res_start = kdeth_qp <<16 ; dd->verbs_dev.rdi.dparms.qpn_res_end = dd->verbs_dev.rdi.dparms.qpn_res_start +65535 ; + dd->verbs_dev.rdi.dparms.max_rdma_atomic =HFI1_MAX_RDMA_ATOMIC ; + dd->verbs_dev.rdi.dparms.psn_mask =PSN_MASK ; + dd->verbs_dev.rdi.dparms.psn_shift =PSN_SHIFT ; + dd->verbs_dev.rdi.dparms.psn_modify_mask =PSN_MODIFY_MASK ; dd->verbs_dev.rdi.driver_f.qp_priv_alloc = qp_priv_alloc; dd->verbs_dev.rdi.driver_f.qp_priv_free = qp_priv_free; dd->verbs_dev.rdi.driver_f.free_all_qps = free_all_qps; dd->verbs_dev.rdi.driver_f.notify_qp_reset = notify_qp_reset; dd->verbs_dev.rdi.driver_f.do_send = hfi1_do_send; dd->verbs_dev.rdi.driver_f.schedule_send = hfi1_schedule_send; + dd->verbs_dev.rdi.driver_f.get_pmtu_from_attr = get_pmtu_from_attr; + dd->verbs_dev.rdi.driver_f.notify_error_qp = notify_error_qp; + dd->verbs_dev.rdi.driver_f.flush_qp_waiters = flush_qp_waiters; + dd->verbs_dev.rdi.driver_f.stop_send_queue = stop_send_queue; + dd->verbs_dev.rdi.driver_f.quiesce_qp = quiesce_qp; + dd->verbs_dev.rdi.driver_f.notify_error_qp = notify_error_qp; + dd->verbs_dev.rdi.driver_f.mtu_from_qp = mtu_from_qp; + dd->verbs_dev.rdi.driver_f.mtu_to_path_mtu = mtu_to_path_mtu; + dd->verbs_dev.rdi.driver_f.check_modify_qp = hfi1_check_modify_qp; + dd->verbs_dev.rdi.driver_f.modify_qp = hfi1_modify_qp;/* completeion queue */ snprintf(dd->verbs_dev.rdi.dparms.cq_name,
drivers/staging/rdma/hfi1/verbs.h +7 -24
@@ -225,18 +225,6 @@ struct hfi1_pkt_state {#define HFI1_PSN_CREDIT 16 -/* -* Since struct rvt_rwqe is not a fixed size, we can't simply index into -* struct rvt_rwq.wq. This function does the array index computation. -*/ -static inline struct rvt_rwqe *get_rwqe_ptr (struct rvt_rq *rq,unsigned n) -{ -return (struct rvt_rwqe *) - ((char *) rq->wq->wq + - (sizeof (struct rvt_rwqe ) + - rq->max_sge *sizeof (struct ib_sge )) * n); -} -struct hfi1_opcode_stats {u64 n_packets;/* number of packets */ u64 n_bytes;/* total number of bytes */
@@ -286,8 +274,6 @@ struct hfi1_ibdev {u64 n_kmem_wait;u64 n_send_schedule; -u32 n_qps_allocated;/* number of QPs allocated for device */ -spinlock_t n_qps_lock;u32 n_srqs_allocated;/* number of SRQs allocated for device */ spinlock_t n_srqs_lock;#ifdef CONFIG_DEBUG_FS
@@ -464,19 +450,16 @@ int hfi1_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr);int hfi1_destroy_srq (struct ib_srq *ibsrq); -static inline void hfi1_put_ss (struct rvt_sge_state *ss) -{ -while (ss->num_sge) { -rvt_put_mr (ss->sge.mr); -if (--ss->num_sge) - ss->sge = *ss->sg_list++; - } -} - -int hfi1_get_rwqe (struct rvt_qp *qp,int wr_id_only); +int hfi1_rvt_get_rwqe (struct rvt_qp *qp,int wr_id_only);void hfi1_migrate_qp (struct rvt_qp *qp); +int hfi1_check_modify_qp (struct rvt_qp *qp,struct ib_qp_attr *attr, +int attr_mask,struct ib_udata *udata); + +void hfi1_modify_qp (struct rvt_qp *qp,struct ib_qp_attr *attr, +int attr_mask,struct ib_udata *udata); +int hfi1_ruc_check_hdr (struct hfi1_ibport *ibp,struct hfi1_ib_header *hdr,int has_grh,struct rvt_qp *qp,u32 bth0);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 26/31 staging/rdma/hfi1: Remove destroy qp verb
In reply to a message not in the archiveThis removes the destroy qp verbs in favor of using rdmavt.
--- drivers/staging/rdma/hfi1/qp.c | 53 ------------------------------------- drivers/staging/rdma/hfi1/qp.h | 11 -------- drivers/staging/rdma/hfi1/verbs.c | 2 + 3 files changed, 1 insertions(+), 65 deletions(-)
drivers/staging/rdma/hfi1/qp.c +0 -53
@@ -332,59 +332,6 @@ __be32 hfi1_compute_aeth(struct rvt_qp *qp) }/** -* hfi1_destroy_qp - destroy a queue pair -* @ibqp: the queue pair to destroy -* -* Returns 0 on success. -* -* Note that this can be called while the QP is actively sending or -* receiving! -*/ -int hfi1_destroy_qp (struct ib_qp *ibqp) -{ -struct rvt_qp *qp =ibqp_to_rvtqp (ibqp); -struct hfi1_ibdev *dev =to_idev (ibqp->device); -struct hfi1_qp_priv *priv = qp->priv; - -/* Make sure HW and driver activity is stopped. */ -spin_lock_irq (&qp->r_lock); -spin_lock (&qp->s_lock); -if (qp->state !=IB_QPS_RESET ) { - qp->state =IB_QPS_RESET ; -flush_iowait (qp); - qp->s_flags &= ~(RVT_S_TIMER |RVT_S_ANY_WAIT ); -spin_unlock (&qp->s_lock); -spin_unlock_irq (&qp->r_lock); -cancel_work_sync (&priv->s_iowait.iowork); -del_timer_sync (&qp->s_timer); -iowait_sdma_drain (&priv->s_iowait); -flush_tx_list (qp); -rvt_remove_qp (ib_to_rvt (ibqp->device), qp); -wait_event (qp->wait, !atomic_read (&qp->refcount)); -spin_lock_irq (&qp->r_lock); -spin_lock (&qp->s_lock); -rvt_clear_mr_refs (qp,1 ); -clear_ahg (qp); - } -spin_unlock (&qp->s_lock); -spin_unlock_irq (&qp->r_lock); - -/* all user's cleaned up, mark it available */ -rvt_free_qpn (&dev->rdi.qp_dev->qpn_table, qp->ibqp.qp_num); -rvt_dec_qp_cnt (&dev->rdi); - -if (qp->ip) -kref_put (&qp->ip->ref, rvt_release_mmap_info); -else -vfree (qp->r_rq.wq); -vfree (qp->s_wq); -kfree (priv->s_hdr); -kfree (priv); -kfree (qp); -return 0 ; -} - -/** * hfi1_get_credit - flush the send work queue of a QP * @qp: the qp who's send work queue to flush * @aeth: the Acknowledge Extended Transport Header
drivers/staging/rdma/hfi1/qp.h +0 -11
@@ -96,17 +96,6 @@ struct ib_qp *hfi1_create_qp(struct ib_pd *ibpd,struct ib_qp_init_attr *init_attr, struct ib_udata *udata);/** -* hfi1_destroy_qp - destroy a queue pair -* @ibqp: the queue pair to destroy -* -* Returns 0 on success. -* -* Note that this can be called while the QP is actively sending or -* receiving! -*/ -int hfi1_destroy_qp (struct ib_qp *ibqp); - -/** * hfi1_get_credit - flush the send work queue of a QP * @qp: the qp who's send work queue to flush * @aeth: the Acknowledge Extended Transport Header
drivers/staging/rdma/hfi1/verbs.c +1 -1
@@ -1625,7 +1625,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->create_qp =NULL ; ibdev->modify_qp =NULL ; ibdev->query_qp = hfi1_query_qp; - ibdev->destroy_qp = hfi1_destroy_qp; + ibdev->destroy_qp =NULL ; ibdev->post_send =NULL ; ibdev->post_recv = post_receive; ibdev->post_srq_recv = hfi1_post_srq_receive;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 27/31 staging/rdma/hfi1: Remove post_recv and use rdmavt version
In reply to a message not in the archiveThis patch removes the simple post recv function in favor of using rdmavt. The packet receive processing still lives in the driver though.
--- drivers/staging/rdma/hfi1/verbs.c | 63 +------------------------------------ 1 files changed, 1 insertions(+), 62 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +1 -62
@@ -323,67 +323,6 @@ void hfi1_skip_sge(struct rvt_sge_state *ss, u32 length, int release) } } -/** -* post_receive - post a receive on a QP -* @ibqp: the QP to post the receive on -* @wr: the WR to post -* @bad_wr: the first bad WR is put here -* -* This may be called from interrupt context. -*/ -static int post_receive (struct ib_qp *ibqp,struct ib_recv_wr *wr, -struct ib_recv_wr **bad_wr) -{ -struct rvt_qp *qp =ibqp_to_rvtqp (ibqp); -struct rvt_rwq *wq = qp->r_rq.wq; -unsigned long flags; -int ret; - -/* Check that state is OK to post receive. */ -if (!(ib_rvt_state_ops[qp->state] &RVT_POST_RECV_OK ) || !wq) { - *bad_wr = wr; - ret = -EINVAL ; - goto bail; - } - -for (; wr; wr = wr->next) { -struct rvt_rwqe *wqe; -u32 next; -int i; - -if ((unsigned ) wr->num_sge > qp->r_rq.max_sge) { - *bad_wr = wr; - ret = -EINVAL ; - goto bail; - } - -spin_lock_irqsave (&qp->r_rq.lock, flags); - next = wq->head +1 ; -if (next >= qp->r_rq.size) - next =0 ; -if (next == wq->tail) { -spin_unlock_irqrestore (&qp->r_rq.lock, flags); - *bad_wr = wr; - ret = -ENOMEM ; - goto bail; - } - - wqe =rvt_get_rwqe_ptr (&qp->r_rq, wq->head); - wqe->wr_id = wr->wr_id; - wqe->num_sge = wr->num_sge; -for (i =0 ; i < wr->num_sge; i++) - wqe->sg_list[i] = wr->sg_list[i]; -/* Make sure queue entry is written before the head index. */ -smp_wmb (); - wq->head = next; -spin_unlock_irqrestore (&qp->r_rq.lock, flags); - } - ret =0 ; - -bail: -return ret; -} -/* * Make sure the QP is ready and able to accept the given opcode. */
@@ -1627,7 +1566,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->query_qp = hfi1_query_qp; ibdev->destroy_qp =NULL ; ibdev->post_send =NULL ; - ibdev->post_recv = post_receive; + ibdev->post_recv =NULL ; ibdev->post_srq_recv = hfi1_post_srq_receive; ibdev->create_cq =NULL ; ibdev->destroy_cq =NULL ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 28/31 staging/rdma/hfi1: Clean up register device
In reply to a message not in the archiveNow that rdmavt has solidified in its design we can clean up the driver specific register device functions. This handles hfi1.
--- drivers/staging/rdma/hfi1/verbs.c | 69 +------------------------------------ 1 files changed, 2 insertions(+), 67 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +2 -67
@@ -1507,86 +1507,21 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)strlcpy (ibdev->name + lcpysz,"_%d" ,IB_DEVICE_NAME_MAX - lcpysz); ibdev->owner =THIS_MODULE ; ibdev->node_guid =cpu_to_be64 (ppd->guid); - ibdev->uverbs_abi_ver =HFI1_UVERBS_ABI_VERSION ; - ibdev->uverbs_cmd_mask = - (1ull <<IB_USER_VERBS_CMD_GET_CONTEXT ) | - (1ull <<IB_USER_VERBS_CMD_QUERY_DEVICE ) | - (1ull <<IB_USER_VERBS_CMD_QUERY_PORT ) | - (1ull <<IB_USER_VERBS_CMD_ALLOC_PD ) | - (1ull <<IB_USER_VERBS_CMD_DEALLOC_PD ) | - (1ull <<IB_USER_VERBS_CMD_CREATE_AH ) | - (1ull <<IB_USER_VERBS_CMD_MODIFY_AH ) | - (1ull <<IB_USER_VERBS_CMD_QUERY_AH ) | - (1ull <<IB_USER_VERBS_CMD_DESTROY_AH ) | - (1ull <<IB_USER_VERBS_CMD_REG_MR ) | - (1ull <<IB_USER_VERBS_CMD_DEREG_MR ) | - (1ull <<IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL ) | - (1ull <<IB_USER_VERBS_CMD_CREATE_CQ ) | - (1ull <<IB_USER_VERBS_CMD_RESIZE_CQ ) | - (1ull <<IB_USER_VERBS_CMD_DESTROY_CQ ) | - (1ull <<IB_USER_VERBS_CMD_POLL_CQ ) | - (1ull <<IB_USER_VERBS_CMD_REQ_NOTIFY_CQ ) | - (1ull <<IB_USER_VERBS_CMD_CREATE_QP ) | - (1ull <<IB_USER_VERBS_CMD_QUERY_QP ) | - (1ull <<IB_USER_VERBS_CMD_MODIFY_QP ) | - (1ull <<IB_USER_VERBS_CMD_DESTROY_QP ) | - (1ull <<IB_USER_VERBS_CMD_POST_SEND ) | - (1ull <<IB_USER_VERBS_CMD_POST_RECV ) | - (1ull <<IB_USER_VERBS_CMD_ATTACH_MCAST ) | - (1ull <<IB_USER_VERBS_CMD_DETACH_MCAST ) | - (1ull <<IB_USER_VERBS_CMD_CREATE_SRQ ) | - (1ull <<IB_USER_VERBS_CMD_MODIFY_SRQ ) | - (1ull <<IB_USER_VERBS_CMD_QUERY_SRQ ) | - (1ull <<IB_USER_VERBS_CMD_DESTROY_SRQ ) | - (1ull <<IB_USER_VERBS_CMD_POST_SRQ_RECV ); - ibdev->node_type =RDMA_NODE_IB_CA ; ibdev->phys_port_cnt = dd->num_pports; - ibdev->num_comp_vectors =1 ; ibdev->dma_device = &dd->pcidev->dev; - ibdev->query_device =NULL ; ibdev->modify_device = modify_device; ibdev->query_port = query_port; ibdev->modify_port = modify_port; - ibdev->query_pkey =NULL ; ibdev->query_gid = query_gid; - ibdev->alloc_ucontext =NULL ; - ibdev->dealloc_ucontext =NULL ; - ibdev->alloc_pd =NULL ; - ibdev->dealloc_pd =NULL ; - ibdev->create_ah =NULL ; - ibdev->destroy_ah =NULL ; - ibdev->modify_ah =NULL ; - ibdev->query_ah =NULL ; ibdev->create_srq = hfi1_create_srq; ibdev->modify_srq = hfi1_modify_srq; ibdev->query_srq = hfi1_query_srq; ibdev->destroy_srq = hfi1_destroy_srq; - ibdev->create_qp =NULL ; - ibdev->modify_qp =NULL ; ibdev->query_qp = hfi1_query_qp; - ibdev->destroy_qp =NULL ; - ibdev->post_send =NULL ; - ibdev->post_recv =NULL ; ibdev->post_srq_recv = hfi1_post_srq_receive; - ibdev->create_cq =NULL ; - ibdev->destroy_cq =NULL ; - ibdev->resize_cq =NULL ; - ibdev->poll_cq =NULL ; - ibdev->req_notify_cq =NULL ; - ibdev->get_dma_mr =NULL ; - ibdev->reg_user_mr =NULL ; - ibdev->dereg_mr =NULL ; - ibdev->alloc_mr =NULL ; - ibdev->map_mr_sg =NULL ; - ibdev->alloc_fmr =NULL ; - ibdev->map_phys_fmr =NULL ; - ibdev->unmap_fmr =NULL ; - ibdev->dealloc_fmr =NULL ; - ibdev->attach_mcast =NULL ; - ibdev->detach_mcast =NULL ; + +/* keep process mad in the driver */ ibdev->process_mad = hfi1_process_mad; - ibdev->mmap =NULL ; - ibdev->dma_ops =NULL ; ibdev->get_port_immutable = port_immutable; strncpy(ibdev->node_desc, init_utsname()->nodename,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 29/31 staging/rdma/hfi1: Use rdmavt device allocation function
In reply to a message not in the archiveNo longer do drivers need to call into the IB core to allocate the verbs device. Use the functionality provided by rdmavt.
--- drivers/staging/rdma/hfi1/init.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/staging/rdma/hfi1/init.c +7 -4
@@ -998,13 +998,16 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra) {unsigned long flags;struct hfi1_devdata *dd; -int ret; +int ret, nports; + +/* extra is * number of ports */ + nports = extra /sizeof (struct hfi1_pportdata ); - dd = (struct hfi1_devdata *)ib_alloc_device (sizeof (*dd) + extra); + dd = (struct hfi1_devdata *)rvt_alloc_device (sizeof (*dd) + extra, + nports);if (!dd)return ERR_PTR (-ENOMEM ); -/* extra is * number of ports */ - dd->num_pports = extra /sizeof (struct hfi1_pportdata ); + dd->num_pports = nports; dd->pport = (struct hfi1_pportdata *)(dd +1 );INIT_LIST_HEAD (&dd->list);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 30/31 staging/rdma/hfi1: Remove create and free mad agents
In reply to a message not in the archiveGet rid of create and free mad agent from the driver and use rdmavt version.
--- drivers/staging/rdma/hfi1/mad.c | 76 +++---------------------------------- drivers/staging/rdma/hfi1/verbs.c | 14 +------ drivers/staging/rdma/hfi1/verbs.h | 4 -- 3 files changed, 8 insertions(+), 86 deletions(-)
drivers/staging/rdma/hfi1/mad.c +6 -70
@@ -129,7 +129,7 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)memcpy (smp->route.lid.data, data, len);spin_lock_irqsave (&ibp->rvp.lock, flags); -if (!ibp->sm_ah) { +if (!ibp->rvp.sm_ah) {if (ibp->rvp.sm_lid !=be16_to_cpu (IB_LID_PERMISSIVE )) {struct ib_ah *ah;
@@ -138,13 +138,13 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) ret =PTR_ERR (ah); else { send_buf->ah = ah; - ibp->sm_ah =ibah_to_rvtah (ah); + ibp->rvp.sm_ah =ibah_to_rvtah (ah); ret =0 ; } }else ret = -EINVAL ; }else { - send_buf->ah = &ibp->sm_ah->ibah; + send_buf->ah = &ibp->rvp.sm_ah->ibah; ret =0 ; }spin_unlock_irqrestore (&ibp->rvp.lock, flags);
@@ -1138,11 +1138,11 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, }else if (smlid != ibp->rvp.sm_lid || msl != ibp->rvp.sm_sl) {pr_warn ("SubnSet(OPA_PortInfo) smlid 0x%x\n" , smlid);spin_lock_irqsave (&ibp->rvp.lock, flags); -if (ibp->sm_ah) { +if (ibp->rvp.sm_ah) {if (smlid != ibp->rvp.sm_lid) - ibp->sm_ah->attr.dlid = smlid; + ibp->rvp.sm_ah->attr.dlid = smlid;if (msl != ibp->rvp.sm_sl) - ibp->sm_ah->attr.sl = msl; + ibp->rvp.sm_ah->attr.sl = msl; }spin_unlock_irqrestore (&ibp->rvp.lock, flags);if (smlid != ibp->rvp.sm_lid)
@@ -4157,67 +4157,3 @@ int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u8 port,return IB_MAD_RESULT_FAILURE ; } - -static void send_handler (struct ib_mad_agent *agent, -struct ib_mad_send_wc *mad_send_wc) -{ -ib_free_send_mad (mad_send_wc->send_buf); -} - -int hfi1_create_agents (struct hfi1_ibdev *dev) -{ -struct hfi1_devdata *dd =dd_from_dev (dev); -struct ib_mad_agent *agent; -struct hfi1_ibport *ibp; -int p; -int ret; - -for (p =0 ; p < dd->num_pports; p++) { - ibp = &dd->pport[p].ibport_data; - agent =ib_register_mad_agent (&dev->rdi.ibdev, p +1 , -IB_QPT_SMI , -NULL ,0 , send_handler, -NULL ,NULL ,0 ); -if (IS_ERR (agent)) { - ret =PTR_ERR (agent); - goto err; - } - - ibp->rvp.send_agent = agent; - } - -return 0 ; - -err: -for (p =0 ; p < dd->num_pports; p++) { - ibp = &dd->pport[p].ibport_data; -if (ibp->rvp.send_agent) { - agent = ibp->rvp.send_agent; - ibp->rvp.send_agent =NULL ; -ib_unregister_mad_agent (agent); - } - } - -return ret; -} - -void hfi1_free_agents (struct hfi1_ibdev *dev) -{ -struct hfi1_devdata *dd =dd_from_dev (dev); -struct ib_mad_agent *agent; -struct hfi1_ibport *ibp; -int p; - -for (p =0 ; p < dd->num_pports; p++) { - ibp = &dd->pport[p].ibport_data; -if (ibp->rvp.send_agent) { - agent = ibp->rvp.send_agent; - ibp->rvp.send_agent =NULL ; -ib_unregister_mad_agent (agent); - } -if (ibp->sm_ah) { -ib_destroy_ah (&ibp->sm_ah->ibah); - ibp->sm_ah =NULL ; - } - } -}
drivers/staging/rdma/hfi1/verbs.c +2 -12
@@ -1590,27 +1590,19 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ret =rvt_register_device (&dd->verbs_dev.rdi);if (ret) - goto err_reg; - - ret =hfi1_create_agents (dev); -if (ret) - goto err_agents; + goto err_verbs_txreq; ret =hfi1_verbs_register_sysfs (dd);if (ret) goto err_class; - goto bail; +return ret; err_class: -hfi1_free_agents (dev); -err_agents:rvt_unregister_device (&dd->verbs_dev.rdi); -err_reg: err_verbs_txreq:kmem_cache_destroy (dev->verbs_txreq_cache);dd_dev_err (dd,"cannot register verbs: %d!\n" , -ret); -bail:return ret; }
@@ -1620,8 +1612,6 @@ void hfi1_unregister_ib_device(struct hfi1_devdata *dd)hfi1_verbs_unregister_sysfs (dd); -hfi1_free_agents (dev); -rvt_unregister_device (&dd->verbs_dev.rdi);if (!list_empty (&dev->txwait))
drivers/staging/rdma/hfi1/verbs.h +0 -4
@@ -247,8 +247,6 @@ static inline void inc_opstats(struct hfi1_ibport {struct rvt_qp __rcu *qp[2 ];struct rvt_ibport rvp; -struct rvt_ah *sm_ah; -struct rvt_ah *smi_ah;__be64 guids[HFI1_GUIDS_PER_PORT -1 ];/* writable GUIDs */
@@ -340,8 +338,6 @@ int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u8 port, const struct ib_mad_hdr *in_mad, size_t in_mad_size, struct ib_mad_hdr *out_mad, size_t *out_mad_size, u16 *out_mad_pkey_index); -int hfi1_create_agents (struct hfi1_ibdev *dev); -void hfi1_free_agents (struct hfi1_ibdev *dev);/* * The PSN_MASK and PSN_SHIFT allow for
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 31/31 staging/rdma/hfi1: Remove hfi1_query_qp function
In reply to a message not in the archiveFrom: Harish Chegondi <[email protected]>
Rely on rvt_query_qp function defined in rdmavt
--- drivers/staging/rdma/hfi1/qp.c | 50 ------------------------------------- drivers/staging/rdma/hfi1/qp.h | 3 -- drivers/staging/rdma/hfi1/verbs.c | 1 - 3 files changed, 0 insertions(+), 54 deletions(-)
drivers/staging/rdma/hfi1/qp.c +0 -50
@@ -220,56 +220,6 @@ void hfi1_modify_qp(struct rvt_qp *qp, struct ib_qp_attr *attr, } } -int hfi1_query_qp (struct ib_qp *ibqp,struct ib_qp_attr *attr, -int attr_mask,struct ib_qp_init_attr *init_attr) -{ -struct rvt_qp *qp =ibqp_to_rvtqp (ibqp); - - attr->qp_state = qp->state; - attr->cur_qp_state = attr->qp_state; - attr->path_mtu = qp->path_mtu; - attr->path_mig_state = qp->s_mig_state; - attr->qkey = qp->qkey; - attr->rq_psn =mask_psn (qp->r_psn); - attr->sq_psn =mask_psn (qp->s_next_psn); - attr->dest_qp_num = qp->remote_qpn; - attr->qp_access_flags = qp->qp_access_flags; - attr->cap.max_send_wr = qp->s_size -1 ; - attr->cap.max_recv_wr = qp->ibqp.srq ?0 : qp->r_rq.size -1 ; - attr->cap.max_send_sge = qp->s_max_sge; - attr->cap.max_recv_sge = qp->r_rq.max_sge; - attr->cap.max_inline_data =0 ; - attr->ah_attr = qp->remote_ah_attr; - attr->alt_ah_attr = qp->alt_ah_attr; - attr->pkey_index = qp->s_pkey_index; - attr->alt_pkey_index = qp->s_alt_pkey_index; - attr->en_sqd_async_notify =0 ; - attr->sq_draining = qp->s_draining; - attr->max_rd_atomic = qp->s_max_rd_atomic; - attr->max_dest_rd_atomic = qp->r_max_rd_atomic; - attr->min_rnr_timer = qp->r_min_rnr_timer; - attr->port_num = qp->port_num; - attr->timeout = qp->timeout; - attr->retry_cnt = qp->s_retry_cnt; - attr->rnr_retry = qp->s_rnr_retry_cnt; - attr->alt_port_num = qp->alt_ah_attr.port_num; - attr->alt_timeout = qp->alt_timeout; - - init_attr->event_handler = qp->ibqp.event_handler; - init_attr->qp_context = qp->ibqp.qp_context; - init_attr->send_cq = qp->ibqp.send_cq; - init_attr->recv_cq = qp->ibqp.recv_cq; - init_attr->srq = qp->ibqp.srq; - init_attr->cap = attr->cap; -if (qp->s_flags &RVT_S_SIGNAL_REQ_WR ) - init_attr->sq_sig_type =IB_SIGNAL_REQ_WR ; -else - init_attr->sq_sig_type =IB_SIGNAL_ALL_WR ; - init_attr->qp_type = qp->ibqp.qp_type; - init_attr->port_num = qp->port_num; -return 0 ; -} -/** * hfi1_compute_aeth - compute the AETH (syndrome + MSN) * @qp: the queue pair to compute the AETH for
drivers/staging/rdma/hfi1/qp.h +0 -3
@@ -71,9 +71,6 @@ static inline void clear_ahg(struct rvt_qp *qp) qp->s_ahgidx =-1 ; } -int hfi1_query_qp (struct ib_qp *ibqp,struct ib_qp_attr *attr, -int attr_mask,struct ib_qp_init_attr *init_attr); -/** * hfi1_compute_aeth - compute the AETH (syndrome + MSN) * @qp: the queue pair to compute the AETH for
drivers/staging/rdma/hfi1/verbs.c +0 -1
@@ -1517,7 +1517,6 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->modify_srq = hfi1_modify_srq; ibdev->query_srq = hfi1_query_srq; ibdev->destroy_srq = hfi1_destroy_srq; - ibdev->query_qp = hfi1_query_qp; ibdev->post_srq_recv = hfi1_post_srq_receive;/* keep process mad in the driver */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html