2005-04-01 18:51:32

by Roland Dreier

[permalink] [raw]
Subject: [PATCH][1/6] IB: Keep MAD work completion valid

From: Sean Hefty <[email protected]>

Replace the *wc field in ib_mad_recv_wc from pointing to a structure
on the stack to one allocated with the received MAD buffer. This
allows a client to access the *wc field after their receive completion
handler has returned.

Signed-off-by: Sean Hefty <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>


--- linux-export.orig/drivers/infiniband/core/mad.c 2005-03-31 19:07:01.000000000 -0800
+++ linux-export/drivers/infiniband/core/mad.c 2005-04-01 10:08:54.939957801 -0800
@@ -1600,7 +1600,8 @@
DMA_FROM_DEVICE);

/* Setup MAD receive work completion from "normal" work completion */
- recv->header.recv_wc.wc = wc;
+ recv->header.wc = *wc;
+ recv->header.recv_wc.wc = &recv->header.wc;
recv->header.recv_wc.mad_len = sizeof(struct ib_mad);
recv->header.recv_wc.recv_buf.mad = &recv->mad.mad;
recv->header.recv_wc.recv_buf.grh = &recv->grh;
--- linux-export.orig/drivers/infiniband/core/mad_priv.h 2005-03-31 19:07:14.000000000 -0800
+++ linux-export/drivers/infiniband/core/mad_priv.h 2005-04-01 10:08:54.961953027 -0800
@@ -69,6 +69,7 @@
struct ib_mad_private_header {
struct ib_mad_list_head mad_list;
struct ib_mad_recv_wc recv_wc;
+ struct ib_wc wc;
DECLARE_PCI_UNMAP_ADDR(mapping)
} __attribute__ ((packed));



2005-04-01 18:28:55

by Roland Dreier

[permalink] [raw]
Subject: [PATCH][3/6] IB: Fix FMR pool crash

Mask bits correctly from jhash result in ib_fmr_hash() so that the
computed bucket index is within our hash table. This fixes an SDP
crash.

Signed-off-by: Roland Dreier <[email protected]>


--- linux-export.orig/drivers/infiniband/core/fmr_pool.c 2005-03-31 19:07:05.000000000 -0800
+++ linux-export/drivers/infiniband/core/fmr_pool.c 2005-04-01 10:08:58.240241456 -0800
@@ -103,9 +103,8 @@

static inline u32 ib_fmr_hash(u64 first_page)
{
- return jhash_2words((u32) first_page,
- (u32) (first_page >> 32),
- 0);
+ return jhash_2words((u32) first_page, (u32) (first_page >> 32), 0) &
+ (IB_FMR_HASH_SIZE - 1);
}

/* Caller must hold pool_lock */

2005-04-01 18:28:54

by Roland Dreier

[permalink] [raw]
Subject: [PATCH][4/6] IB: Trivial FMR printk cleanup

From: Libor Michalek <[email protected]>

Add missing newline in printk.

Signed-off-by: Libor Michalek <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>


--- linux-export.orig/drivers/infiniband/core/fmr_pool.c 2005-04-01 10:08:58.240241456 -0800
+++ linux-export/drivers/infiniband/core/fmr_pool.c 2005-04-01 10:08:59.539959345 -0800
@@ -442,7 +442,7 @@
list_add(&fmr->list, &pool->free_list);
spin_unlock_irqrestore(&pool->pool_lock, flags);

- printk(KERN_WARNING "fmr_map returns %d",
+ printk(KERN_WARNING "fmr_map returns %d\n",
result);

return ERR_PTR(result);

2005-04-01 18:28:53

by Roland Dreier

[permalink] [raw]
Subject: [PATCH][5/6] IB: Fix user MAD registrations with class 0

Fix handling of MAD agent registrations with mgmt_class == 0. In this
case ib_umad should pass a NULL registration request to the MAD core
rather than a request with mgmt_class set to 0.

Signed-off-by: Roland Dreier <[email protected]>


--- linux-export.orig/drivers/infiniband/core/user_mad.c 2005-03-31 19:06:42.000000000 -0800
+++ linux-export/drivers/infiniband/core/user_mad.c 2005-04-01 10:09:01.250588043 -0800
@@ -389,15 +389,17 @@
goto out;

found:
- req.mgmt_class = ureq.mgmt_class;
- req.mgmt_class_version = ureq.mgmt_class_version;
- memcpy(req.method_mask, ureq.method_mask, sizeof req.method_mask);
- memcpy(req.oui, ureq.oui, sizeof req.oui);
+ if (ureq.mgmt_class) {
+ req.mgmt_class = ureq.mgmt_class;
+ req.mgmt_class_version = ureq.mgmt_class_version;
+ memcpy(req.method_mask, ureq.method_mask, sizeof req.method_mask);
+ memcpy(req.oui, ureq.oui, sizeof req.oui);
+ }

agent = ib_register_mad_agent(file->port->ib_dev, file->port->port_num,
ureq.qpn ? IB_QPT_GSI : IB_QPT_SMI,
- &req, 0, send_handler, recv_handler,
- file);
+ ureq.mgmt_class ? &req : NULL,
+ 0, send_handler, recv_handler, file);
if (IS_ERR(agent)) {
ret = PTR_ERR(agent);
goto out;

2005-04-01 18:28:53

by Roland Dreier

[permalink] [raw]
Subject: [PATCH][6/6] IB: Remove incorrect comments

From: Hal Rosenstock <[email protected]>

Eliminate unneeded and misleading comments

Signed-off-by: Hal Rosenstock <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>


--- linux-export.orig/drivers/infiniband/core/agent.c 2005-03-31 19:06:48.000000000 -0800
+++ linux-export/drivers/infiniband/core/agent.c 2005-04-01 10:09:02.621290525 -0800
@@ -129,7 +129,6 @@
goto out;
agent_send_wr->mad = mad_priv;

- /* PCI mapping */
gather_list.addr = dma_map_single(mad_agent->device->dma_device,
&mad_priv->mad,
sizeof(mad_priv->mad),
@@ -261,7 +260,6 @@
list_del(&agent_send_wr->send_list);
spin_unlock_irqrestore(&port_priv->send_list_lock, flags);

- /* Unmap PCI */
dma_unmap_single(mad_agent->device->dma_device,
pci_unmap_addr(agent_send_wr, mapping),
sizeof(agent_send_wr->mad->mad),
--- linux-export.orig/drivers/infiniband/core/mad.c 2005-04-01 10:08:56.473624910 -0800
+++ linux-export/drivers/infiniband/core/mad.c 2005-04-01 10:09:02.768258624 -0800
@@ -2283,7 +2283,6 @@
/* Remove from posted receive MAD list */
list_del(&mad_list->list);

- /* Undo PCI mapping */
dma_unmap_single(qp_info->port_priv->device->dma_device,
pci_unmap_addr(&recv->header, mapping),
sizeof(struct ib_mad_private) -

2005-04-01 18:51:31

by Roland Dreier

[permalink] [raw]
Subject: [PATCH][2/6] IB: remove unneeded includes

From: Hal Rosenstock <[email protected]>

Eliminate no longer needed include files

Signed-off-by: Hal Rosenstock <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>


--- linux-export.orig/drivers/infiniband/core/mad.c 2005-04-01 10:08:54.939957801 -0800
+++ linux-export/drivers/infiniband/core/mad.c 2005-04-01 10:08:56.473624910 -0800
@@ -33,9 +33,6 @@
*/

#include <linux/dma-mapping.h>
-#include <linux/interrupt.h>
-
-#include <ib_mad.h>

#include "mad_priv.h"
#include "smi.h"