aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-12-31 07:35:57 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-12-31 07:35:57 -0500
commit2ca1a615835d9f4990f42102ab1f2ef434e7e89c (patch)
tree726cf3d5f29a6c66c44e4bd68e7ebed2fd83d059 /drivers/infiniband
parente12f0102ac81d660c9f801d0a0e10ccf4537a9de (diff)
parent6a94cb73064c952255336cc57731904174b2c58f (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: arch/x86/kernel/io_apic.c
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/Kconfig1
-rw-r--r--drivers/infiniband/core/addr.c47
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c2
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c48
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c5
5 files changed, 69 insertions, 34 deletions
diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index a5dc78ae62d4..dd0db67bf8d7 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -37,6 +37,7 @@ config INFINIBAND_USER_MEM
37config INFINIBAND_ADDR_TRANS 37config INFINIBAND_ADDR_TRANS
38 bool 38 bool
39 depends on INET 39 depends on INET
40 depends on !(INFINIBAND = y && IPV6 = m)
40 default y 41 default y
41 42
42source "drivers/infiniband/hw/mthca/Kconfig" 43source "drivers/infiniband/hw/mthca/Kconfig"
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index d98b05b28262..ce511d8748ce 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -128,6 +128,8 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
128 ret = rdma_copy_addr(dev_addr, dev, NULL); 128 ret = rdma_copy_addr(dev_addr, dev, NULL);
129 dev_put(dev); 129 dev_put(dev);
130 break; 130 break;
131
132#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
131 case AF_INET6: 133 case AF_INET6:
132 for_each_netdev(&init_net, dev) { 134 for_each_netdev(&init_net, dev) {
133 if (ipv6_chk_addr(&init_net, 135 if (ipv6_chk_addr(&init_net,
@@ -138,8 +140,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
138 } 140 }
139 } 141 }
140 break; 142 break;
141 default: 143#endif
142 break;
143 } 144 }
144 return ret; 145 return ret;
145} 146}
@@ -179,10 +180,11 @@ static void addr_send_arp(struct sockaddr *dst_in)
179{ 180{
180 struct rtable *rt; 181 struct rtable *rt;
181 struct flowi fl; 182 struct flowi fl;
182 struct dst_entry *dst;
183 183
184 memset(&fl, 0, sizeof fl); 184 memset(&fl, 0, sizeof fl);
185 if (dst_in->sa_family == AF_INET) { 185
186 switch (dst_in->sa_family) {
187 case AF_INET:
186 fl.nl_u.ip4_u.daddr = 188 fl.nl_u.ip4_u.daddr =
187 ((struct sockaddr_in *) dst_in)->sin_addr.s_addr; 189 ((struct sockaddr_in *) dst_in)->sin_addr.s_addr;
188 190
@@ -191,8 +193,13 @@ static void addr_send_arp(struct sockaddr *dst_in)
191 193
192 neigh_event_send(rt->u.dst.neighbour, NULL); 194 neigh_event_send(rt->u.dst.neighbour, NULL);
193 ip_rt_put(rt); 195 ip_rt_put(rt);
196 break;
197
198#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
199 case AF_INET6:
200 {
201 struct dst_entry *dst;
194 202
195 } else {
196 fl.nl_u.ip6_u.daddr = 203 fl.nl_u.ip6_u.daddr =
197 ((struct sockaddr_in6 *) dst_in)->sin6_addr; 204 ((struct sockaddr_in6 *) dst_in)->sin6_addr;
198 205
@@ -202,6 +209,9 @@ static void addr_send_arp(struct sockaddr *dst_in)
202 209
203 neigh_event_send(dst->neighbour, NULL); 210 neigh_event_send(dst->neighbour, NULL);
204 dst_release(dst); 211 dst_release(dst);
212 break;
213 }
214#endif
205 } 215 }
206} 216}
207 217
@@ -254,6 +264,7 @@ out:
254 return ret; 264 return ret;
255} 265}
256 266
267#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
257static int addr6_resolve_remote(struct sockaddr_in6 *src_in, 268static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
258 struct sockaddr_in6 *dst_in, 269 struct sockaddr_in6 *dst_in,
259 struct rdma_dev_addr *addr) 270 struct rdma_dev_addr *addr)
@@ -282,6 +293,14 @@ static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
282 dst_release(dst); 293 dst_release(dst);
283 return ret; 294 return ret;
284} 295}
296#else
297static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
298 struct sockaddr_in6 *dst_in,
299 struct rdma_dev_addr *addr)
300{
301 return -EADDRNOTAVAIL;
302}
303#endif
285 304
286static int addr_resolve_remote(struct sockaddr *src_in, 305static int addr_resolve_remote(struct sockaddr *src_in,
287 struct sockaddr *dst_in, 306 struct sockaddr *dst_in,
@@ -340,7 +359,9 @@ static int addr_resolve_local(struct sockaddr *src_in,
340 struct net_device *dev; 359 struct net_device *dev;
341 int ret; 360 int ret;
342 361
343 if (dst_in->sa_family == AF_INET) { 362 switch (dst_in->sa_family) {
363 case AF_INET:
364 {
344 __be32 src_ip = ((struct sockaddr_in *) src_in)->sin_addr.s_addr; 365 __be32 src_ip = ((struct sockaddr_in *) src_in)->sin_addr.s_addr;
345 __be32 dst_ip = ((struct sockaddr_in *) dst_in)->sin_addr.s_addr; 366 __be32 dst_ip = ((struct sockaddr_in *) dst_in)->sin_addr.s_addr;
346 367
@@ -362,7 +383,12 @@ static int addr_resolve_local(struct sockaddr *src_in,
362 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN); 383 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
363 } 384 }
364 dev_put(dev); 385 dev_put(dev);
365 } else { 386 break;
387 }
388
389#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
390 case AF_INET6:
391 {
366 struct in6_addr *a; 392 struct in6_addr *a;
367 393
368 for_each_netdev(&init_net, dev) 394 for_each_netdev(&init_net, dev)
@@ -390,6 +416,13 @@ static int addr_resolve_local(struct sockaddr *src_in,
390 if (!ret) 416 if (!ret)
391 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN); 417 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
392 } 418 }
419 break;
420 }
421#endif
422
423 default:
424 ret = -EADDRNOTAVAIL;
425 break;
393 } 426 }
394 427
395 return ret; 428 return ret;
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 8415ecce5c4c..a3c5af1d7ec0 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -699,7 +699,7 @@ repoll:
699 } 699 }
700 700
701 wc->slid = be16_to_cpu(cqe->rlid); 701 wc->slid = be16_to_cpu(cqe->rlid);
702 wc->sl = be16_to_cpu(cqe->sl_vid >> 12); 702 wc->sl = be16_to_cpu(cqe->sl_vid) >> 12;
703 g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); 703 g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn);
704 wc->src_qp = g_mlpath_rqpn & 0xffffff; 704 wc->src_qp = g_mlpath_rqpn & 0xffffff;
705 wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; 705 wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 1e5b6446231d..12876392516e 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -119,6 +119,14 @@ error:
119 iscsi_conn_failure(conn, rc); 119 iscsi_conn_failure(conn, rc);
120} 120}
121 121
122static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
123{
124 struct iscsi_iser_task *iser_task = task->dd_data;
125
126 task->hdr = (struct iscsi_hdr *)&iser_task->desc.iscsi_header;
127 task->hdr_max = sizeof(iser_task->desc.iscsi_header);
128 return 0;
129}
122 130
123/** 131/**
124 * iscsi_iser_task_init - Initialize task 132 * iscsi_iser_task_init - Initialize task
@@ -180,25 +188,26 @@ static int
180iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn, 188iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn,
181 struct iscsi_task *task) 189 struct iscsi_task *task)
182{ 190{
183 struct iscsi_data hdr; 191 struct iscsi_r2t_info *r2t = &task->unsol_r2t;
192 struct iscsi_data hdr;
184 int error = 0; 193 int error = 0;
185 194
186 /* Send data-out PDUs while there's still unsolicited data to send */ 195 /* Send data-out PDUs while there's still unsolicited data to send */
187 while (task->unsol_count > 0) { 196 while (iscsi_task_has_unsol_data(task)) {
188 iscsi_prep_unsolicit_data_pdu(task, &hdr); 197 iscsi_prep_data_out_pdu(task, r2t, &hdr);
189 debug_scsi("Sending data-out: itt 0x%x, data count %d\n", 198 debug_scsi("Sending data-out: itt 0x%x, data count %d\n",
190 hdr.itt, task->data_count); 199 hdr.itt, r2t->data_count);
191 200
192 /* the buffer description has been passed with the command */ 201 /* the buffer description has been passed with the command */
193 /* Send the command */ 202 /* Send the command */
194 error = iser_send_data_out(conn, task, &hdr); 203 error = iser_send_data_out(conn, task, &hdr);
195 if (error) { 204 if (error) {
196 task->unsol_datasn--; 205 r2t->datasn--;
197 goto iscsi_iser_task_xmit_unsol_data_exit; 206 goto iscsi_iser_task_xmit_unsol_data_exit;
198 } 207 }
199 task->unsol_count -= task->data_count; 208 r2t->sent += r2t->data_count;
200 debug_scsi("Need to send %d more as data-out PDUs\n", 209 debug_scsi("Need to send %d more as data-out PDUs\n",
201 task->unsol_count); 210 r2t->data_length - r2t->sent);
202 } 211 }
203 212
204iscsi_iser_task_xmit_unsol_data_exit: 213iscsi_iser_task_xmit_unsol_data_exit:
@@ -220,7 +229,7 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
220 229
221 debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", 230 debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n",
222 task->itt, scsi_bufflen(task->sc), 231 task->itt, scsi_bufflen(task->sc),
223 task->imm_count, task->unsol_count); 232 task->imm_count, task->unsol_r2t.data_length);
224 } 233 }
225 234
226 debug_scsi("task deq [cid %d itt 0x%x]\n", 235 debug_scsi("task deq [cid %d itt 0x%x]\n",
@@ -235,7 +244,7 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
235 } 244 }
236 245
237 /* Send unsolicited data-out PDU(s) if necessary */ 246 /* Send unsolicited data-out PDU(s) if necessary */
238 if (task->unsol_count) 247 if (iscsi_task_has_unsol_data(task))
239 error = iscsi_iser_task_xmit_unsol_data(conn, task); 248 error = iscsi_iser_task_xmit_unsol_data(conn, task);
240 249
241 iscsi_iser_task_xmit_exit: 250 iscsi_iser_task_xmit_exit:
@@ -244,13 +253,15 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
244 return error; 253 return error;
245} 254}
246 255
247static void 256static void iscsi_iser_cleanup_task(struct iscsi_task *task)
248iscsi_iser_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task)
249{ 257{
250 struct iscsi_iser_task *iser_task = task->dd_data; 258 struct iscsi_iser_task *iser_task = task->dd_data;
251 259
252 /* mgmt tasks do not need special cleanup */ 260 /*
253 if (!task->sc) 261 * mgmt tasks do not need special cleanup and we do not
262 * allocate anything in the init task callout
263 */
264 if (!task->sc || task->state == ISCSI_TASK_PENDING)
254 return; 265 return;
255 266
256 if (iser_task->status == ISER_TASK_STATUS_STARTED) { 267 if (iser_task->status == ISER_TASK_STATUS_STARTED) {
@@ -391,9 +402,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
391 struct iscsi_cls_session *cls_session; 402 struct iscsi_cls_session *cls_session;
392 struct iscsi_session *session; 403 struct iscsi_session *session;
393 struct Scsi_Host *shost; 404 struct Scsi_Host *shost;
394 int i;
395 struct iscsi_task *task;
396 struct iscsi_iser_task *iser_task;
397 struct iser_conn *ib_conn; 405 struct iser_conn *ib_conn;
398 406
399 shost = iscsi_host_alloc(&iscsi_iser_sht, 0, ISCSI_MAX_CMD_PER_LUN); 407 shost = iscsi_host_alloc(&iscsi_iser_sht, 0, ISCSI_MAX_CMD_PER_LUN);
@@ -430,13 +438,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
430 session = cls_session->dd_data; 438 session = cls_session->dd_data;
431 439
432 shost->can_queue = session->scsi_cmds_max; 440 shost->can_queue = session->scsi_cmds_max;
433 /* libiscsi setup itts, data and pool so just set desc fields */
434 for (i = 0; i < session->cmds_max; i++) {
435 task = session->cmds[i];
436 iser_task = task->dd_data;
437 task->hdr = (struct iscsi_cmd *)&iser_task->desc.iscsi_header;
438 task->hdr_max = sizeof(iser_task->desc.iscsi_header);
439 }
440 return cls_session; 441 return cls_session;
441 442
442remove_host: 443remove_host:
@@ -652,6 +653,7 @@ static struct iscsi_transport iscsi_iser_transport = {
652 .init_task = iscsi_iser_task_init, 653 .init_task = iscsi_iser_task_init,
653 .xmit_task = iscsi_iser_task_xmit, 654 .xmit_task = iscsi_iser_task_xmit,
654 .cleanup_task = iscsi_iser_cleanup_task, 655 .cleanup_task = iscsi_iser_cleanup_task,
656 .alloc_pdu = iscsi_iser_pdu_alloc,
655 /* recovery */ 657 /* recovery */
656 .session_recovery_timedout = iscsi_session_recovery_timedout, 658 .session_recovery_timedout = iscsi_session_recovery_timedout,
657 659
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index ed1aff21b7ea..e209cb8dd948 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -353,8 +353,7 @@ int iser_send_command(struct iscsi_conn *conn,
353 unsigned long edtl; 353 unsigned long edtl;
354 int err = 0; 354 int err = 0;
355 struct iser_data_buf *data_buf; 355 struct iser_data_buf *data_buf;
356 356 struct iscsi_cmd *hdr = (struct iscsi_cmd *)task->hdr;
357 struct iscsi_cmd *hdr = task->hdr;
358 struct scsi_cmnd *sc = task->sc; 357 struct scsi_cmnd *sc = task->sc;
359 358
360 if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) { 359 if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) {
@@ -393,7 +392,7 @@ int iser_send_command(struct iscsi_conn *conn,
393 err = iser_prepare_write_cmd(task, 392 err = iser_prepare_write_cmd(task,
394 task->imm_count, 393 task->imm_count,
395 task->imm_count + 394 task->imm_count +
396 task->unsol_count, 395 task->unsol_r2t.data_length,
397 edtl); 396 edtl);
398 if (err) 397 if (err)
399 goto send_command_error; 398 goto send_command_error;