[openib-general] Re: Re: [PATCH] RFC Verbs: add support for transport specific verbs
Sean Hefty
sean.hefty at intel.com
Tue Feb 28 16:23:14 PST 2006
Here's a version that just embeds the structures, rather than creating a union.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
After we decide on which approach to use, we can determine if other calls
should be separated out, such as query_pkey. Roland/Hal, do you have a particular
preference?
Index: include/rdma/ib_verbs.h
===================================================================
--- include/rdma/ib_verbs.h (revision 5532)
+++ include/rdma/ib_verbs.h (working copy)
@@ -824,6 +824,16 @@ struct ib_cache {
struct ib_gid_cache **gid_cache;
};
+struct ib_ops {
+ int (*process_mad)(struct ib_device *device,
+ int process_mad_flags,
+ u8 port_num,
+ struct ib_wc *in_wc,
+ struct ib_grh *in_grh,
+ struct ib_mad *in_mad,
+ struct ib_mad *out_mad);
+};
+
struct ib_device {
struct device *dma_device;
@@ -954,13 +964,8 @@ struct ib_device {
int (*detach_mcast)(struct ib_qp *qp,
union ib_gid *gid,
u16 lid);
- int (*process_mad)(struct ib_device *device,
- int process_mad_flags,
- u8 port_num,
- struct ib_wc *in_wc,
- struct ib_grh *in_grh,
- struct ib_mad *in_mad,
- struct ib_mad *out_mad);
+
+ struct ib_ops ibop;
struct module *owner;
struct class_device class_dev;
Index: core/mad.c
===================================================================
--- core/mad.c (revision 5533)
+++ core/mad.c (working copy)
@@ -704,9 +704,9 @@ static int handle_outgoing_dr_smp(struct
send_wr->wr.ud.port_num, &mad_wc);
/* No GRH for DR SMP */
- ret = device->process_mad(device, 0, port_num, &mad_wc, NULL,
- (struct ib_mad *)smp,
- (struct ib_mad *)&mad_priv->mad);
+ ret = device->ibop.process_mad(device, 0, port_num, &mad_wc, NULL,
+ (struct ib_mad *) smp,
+ (struct ib_mad *) &mad_priv->mad);
switch (ret)
{
case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY:
@@ -1835,7 +1835,7 @@ static void ib_mad_recv_done_handler(str
local:
/* Give driver "right of first refusal" on incoming MAD */
- if (port_priv->device->process_mad) {
+ if (port_priv->device->ibop.process_mad) {
int ret;
if (!response) {
@@ -1847,11 +1847,11 @@ local:
goto out;
}
- ret = port_priv->device->process_mad(port_priv->device, 0,
- port_priv->port_num,
- wc, &recv->grh,
- &recv->mad.mad,
- &response->mad.mad);
+ ret = port_priv->device->ibop.process_mad(port_priv->device, 0,
+ port_priv->port_num,
+ wc, &recv->grh,
+ &recv->mad.mad,
+ &response->mad.mad);
if (ret & IB_MAD_RESULT_SUCCESS) {
if (ret & IB_MAD_RESULT_CONSUMED)
goto out;
Index: core/sysfs.c
===================================================================
--- core/sysfs.c (revision 5532)
+++ core/sysfs.c (working copy)
@@ -311,7 +311,7 @@ static ssize_t show_pma_counter(struct i
struct ib_mad *out_mad = NULL;
ssize_t ret;
- if (!p->ibdev->process_mad)
+ if (!p->ibdev->ibop.process_mad)
return sprintf(buf, "N/A (no PMA)\n");
in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
@@ -329,7 +329,7 @@ static ssize_t show_pma_counter(struct i
in_mad->data[41] = p->port_num; /* PortSelect field */
- if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY,
+ if ((p->ibdev->ibop.process_mad(p->ibdev, IB_MAD_IGNORE_MKEY,
p->port_num, NULL, NULL, in_mad, out_mad) &
(IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) !=
(IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) {
Index: core/smi.h
===================================================================
--- core/smi.h (revision 5532)
+++ core/smi.h (working copy)
@@ -58,7 +58,7 @@ static inline int smi_check_local_smp(st
{
/* C14-9:3 -- We're at the end of the DR segment of path */
/* C14-9:4 -- Hop Pointer = Hop Count + 1 -> give to SMA/SM */
- return ((device->process_mad &&
+ return ((device->ibop.process_mad &&
!ib_get_smp_direction(smp) &&
(smp->hop_ptr == smp->hop_cnt + 1)));
}
Index: hw/ipath/ipath_verbs.c
===================================================================
--- hw/ipath/ipath_verbs.c (revision 5532)
+++ hw/ipath/ipath_verbs.c (working copy)
@@ -5949,7 +5949,7 @@ static int ipath_register_ib_device(cons
dev->dealloc_fmr = ipath_dealloc_fmr;
dev->attach_mcast = ipath_multicast_attach;
dev->detach_mcast = ipath_multicast_detach;
- dev->process_mad = ipath_process_mad;
+ dev->ibop.process_mad = ipath_process_mad;
ret = ib_register_device(dev);
if (ret)
Index: hw/mthca/mthca_provider.c
===================================================================
--- hw/mthca/mthca_provider.c (revision 5532)
+++ hw/mthca/mthca_provider.c (working copy)
@@ -1329,7 +1329,7 @@ int mthca_register_device(struct mthca_d
dev->ib_dev.attach_mcast = mthca_multicast_attach;
dev->ib_dev.detach_mcast = mthca_multicast_detach;
- dev->ib_dev.process_mad = mthca_process_mad;
+ dev->ib_dev.ibop.process_mad = mthca_process_mad;
if (mthca_is_memfree(dev)) {
dev->ib_dev.req_notify_cq = mthca_arbel_arm_cq;
More information about the general
mailing list