47 #include <linux/types.h>
48 #include <linux/list.h>
56 #include <linux/net.h>
59 #include <linux/slab.h>
60 #include <linux/module.h>
64 #include <asm/uaccess.h>
71 #include <scsi/scsi.h>
80 static unsigned int iscsi_max_lun = 512;
91 MODULE_PARM_DESC(debug_level,
"Enable debug tracing if > 0 (default:disabled)");
105 if (datalen > rx_data_len || (datalen + 4) < rx_data_len) {
106 iser_err(
"wrong datalen %d (hdr), %d (IB)\n",
107 datalen, rx_data_len);
112 if (datalen != rx_data_len)
113 iser_dbg(
"aligned datalen (%d) hdr, %d (IB)\n",
114 datalen, rx_data_len);
133 task->
hdr_max =
sizeof(iser_task->
desc.iscsi_header);
145 dma_addr = ib_dma_map_single(device->
ib_device, (
void *)tx_desc,
147 if (ib_dma_mapping_error(device->
ib_device, dma_addr))
153 tx_desc->
tx_sg[0].lkey = device->
mr->lkey;
197 iser_dbg(
"mtask xmit [cid %d itt 0x%x]\n", conn->
id, task->
itt);
211 iscsi_iser_task_xmit_unsol_data(
struct iscsi_conn *conn,
219 while (iscsi_task_has_unsol_data(task)) {
221 iser_dbg(
"Sending data-out: itt 0x%x, data count %d\n",
229 goto iscsi_iser_task_xmit_unsol_data_exit;
232 iser_dbg(
"Need to send %d more as data-out PDUs\n",
236 iscsi_iser_task_xmit_unsol_data_exit:
248 return iscsi_iser_mtask_xmit(conn, task);
251 BUG_ON(scsi_bufflen(task->
sc) == 0);
253 iser_dbg(
"cmd [itt %x total %d imm %d unsol_data %d\n",
254 task->
itt, scsi_bufflen(task->
sc),
258 iser_dbg(
"ctask xmit [cid %d itt 0x%x]\n",
259 conn->
id, task->
itt);
265 goto iscsi_iser_task_xmit_exit;
270 if (iscsi_task_has_unsol_data(task))
271 error = iscsi_iser_task_xmit_unsol_data(conn, task);
273 iscsi_iser_task_xmit_exit:
277 static void iscsi_iser_cleanup_task(
struct iscsi_task *task)
328 struct iser_conn *ib_conn = iser_conn->
ib_conn;
349 struct iser_conn *ib_conn;
362 (
unsigned long long)transport_eph);
373 iser_err(
"binding iscsi/iser conn %p %p to ib_conn %p\n",
387 struct iser_conn *ib_conn = iser_conn->
ib_conn;
421 struct iser_conn *ib_conn;
426 shost->
transportt = iscsi_iser_scsi_transport;
427 shost->
max_lun = iscsi_max_lun;
440 ep ? ib_conn->
device->ib_device->dma_device :
NULL))
453 session = cls_session->
dd_data;
476 sscanf(buf,
"%d", &value);
483 sscanf(buf,
"%d", &value);
490 sscanf(buf,
"%d", &value);
497 sscanf(buf,
"%d", &value);
525 strcpy(stats->custom[0].desc,
"qp_tx_queue_full");
526 stats->custom[0].value = 0;
527 strcpy(stats->custom[1].desc,
"fmr_map_not_avail");
528 stats->custom[1].value = 0; ;
529 strcpy(stats->custom[2].desc,
"eh_abort_cnt");
531 strcpy(stats->custom[3].desc,
"fmr_unalign_cnt");
538 struct iser_conn *ib_conn = ep->
dd_data;
544 if (!ib_conn || !ib_conn->
cma_id)
548 &ib_conn->
cma_id->route.addr.dst_addr,
563 struct iser_conn *ib_conn;
585 struct iser_conn *ib_conn;
599 iser_err(
"ib conn %p rc = %d\n", ib_conn, rc);
612 struct iser_conn *ib_conn;
632 switch (param_type) {
685 .name =
"iSCSI Initiator over iSER, v." DRV_VER,
696 .proc_name =
"iscsi_iser",
705 .create_session = iscsi_iser_session_create,
706 .destroy_session = iscsi_iser_session_destroy,
708 .create_conn = iscsi_iser_conn_create,
709 .bind_conn = iscsi_iser_conn_bind,
710 .destroy_conn = iscsi_iser_conn_destroy,
711 .attr_is_visible = iser_attr_is_visible,
712 .set_param = iscsi_iser_set_param,
714 .get_ep_param = iscsi_iser_get_ep_param,
717 .stop_conn = iscsi_iser_conn_stop,
723 .get_stats = iscsi_iser_conn_get_stats,
724 .init_task = iscsi_iser_task_init,
725 .xmit_task = iscsi_iser_task_xmit,
726 .cleanup_task = iscsi_iser_cleanup_task,
727 .alloc_pdu = iscsi_iser_pdu_alloc,
731 .ep_connect = iscsi_iser_ep_connect,
732 .ep_poll = iscsi_iser_ep_poll,
733 .ep_disconnect = iscsi_iser_ep_disconnect
736 static int __init iser_init(
void)
740 iser_dbg(
"Starting iSER datamover...\n");
742 if (iscsi_max_lun < 1) {
753 if (
ig.desc_cache == NULL)
758 INIT_LIST_HEAD(&
ig.device_list);
760 INIT_LIST_HEAD(&
ig.connlist);
763 &iscsi_iser_transport);
764 if (!iscsi_iser_scsi_transport) {
765 iser_err(
"iscsi_register_transport failed\n");
767 goto register_transport_failure;
772 register_transport_failure:
778 static void __exit iser_exit(
void)
780 iser_dbg(
"Removing iSER datamover...\n");