aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/agent.c')
-rw-r--r--drivers/infiniband/core/agent.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c
index ecd1a3057c61..db2633e4aae6 100644
--- a/drivers/infiniband/core/agent.c
+++ b/drivers/infiniband/core/agent.c
@@ -3,7 +3,7 @@
3 * Copyright (c) 2004, 2005 Infinicon Corporation. All rights reserved. 3 * Copyright (c) 2004, 2005 Infinicon Corporation. All rights reserved.
4 * Copyright (c) 2004, 2005 Intel Corporation. All rights reserved. 4 * Copyright (c) 2004, 2005 Intel Corporation. All rights reserved.
5 * Copyright (c) 2004, 2005 Topspin Corporation. All rights reserved. 5 * Copyright (c) 2004, 2005 Topspin Corporation. All rights reserved.
6 * Copyright (c) 2004, 2005 Voltaire Corporation. All rights reserved. 6 * Copyright (c) 2004-2007 Voltaire Corporation. All rights reserved.
7 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. 7 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
8 * 8 *
9 * This software is available to you under a choice of one of two 9 * This software is available to you under a choice of one of two
@@ -34,7 +34,6 @@
34 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 * SOFTWARE. 35 * SOFTWARE.
36 * 36 *
37 * $Id: agent.c 1389 2004-12-27 22:56:47Z roland $
38 */ 37 */
39 38
40#include <linux/slab.h> 39#include <linux/slab.h>
@@ -42,6 +41,7 @@
42 41
43#include "agent.h" 42#include "agent.h"
44#include "smi.h" 43#include "smi.h"
44#include "mad_priv.h"
45 45
46#define SPFX "ib_agent: " 46#define SPFX "ib_agent: "
47 47
@@ -87,8 +87,13 @@ int agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
87 struct ib_mad_send_buf *send_buf; 87 struct ib_mad_send_buf *send_buf;
88 struct ib_ah *ah; 88 struct ib_ah *ah;
89 int ret; 89 int ret;
90 struct ib_mad_send_wr_private *mad_send_wr;
91
92 if (device->node_type == RDMA_NODE_IB_SWITCH)
93 port_priv = ib_get_agent_port(device, 0);
94 else
95 port_priv = ib_get_agent_port(device, port_num);
90 96
91 port_priv = ib_get_agent_port(device, port_num);
92 if (!port_priv) { 97 if (!port_priv) {
93 printk(KERN_ERR SPFX "Unable to find port agent\n"); 98 printk(KERN_ERR SPFX "Unable to find port agent\n");
94 return -ENODEV; 99 return -ENODEV;
@@ -113,6 +118,14 @@ int agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
113 118
114 memcpy(send_buf->mad, mad, sizeof *mad); 119 memcpy(send_buf->mad, mad, sizeof *mad);
115 send_buf->ah = ah; 120 send_buf->ah = ah;
121
122 if (device->node_type == RDMA_NODE_IB_SWITCH) {
123 mad_send_wr = container_of(send_buf,
124 struct ib_mad_send_wr_private,
125 send_buf);
126 mad_send_wr->send_wr.wr.ud.port_num = port_num;
127 }
128
116 if ((ret = ib_post_send_mad(send_buf, NULL))) { 129 if ((ret = ib_post_send_mad(send_buf, NULL))) {
117 printk(KERN_ERR SPFX "ib_post_send_mad error:%d\n", ret); 130 printk(KERN_ERR SPFX "ib_post_send_mad error:%d\n", ret);
118 goto err2; 131 goto err2;