2 * This file is part of the Emulex Linux Device Driver for Enterprise iSCSI
3 * Host Bus Adapters. Refer to the README file included with this package
4 * for driver version and adapter compatibility.
6 * Copyright (c) 2018 Broadcom. All Rights Reserved.
7 * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of version 2 of the GNU General Public License as published
11 * by the Free Software Foundation.
13 * Contact Information:
14 * linux-drivers@broadcom.com
18 #include <scsi/libiscsi.h>
19 #include <scsi/scsi_transport_iscsi.h>
20 #include <scsi/scsi_transport.h>
21 #include <scsi/scsi_cmnd.h>
22 #include <scsi/scsi_device.h>
23 #include <scsi/scsi_host.h>
24 #include <scsi/scsi_netlink.h>
25 #include <net/netlink.h>
26 #include <scsi/scsi.h>
30 extern struct iscsi_transport beiscsi_iscsi_transport;
33 * beiscsi_session_create - creates a new iscsi session
34 * @cmds_max: max commands supported
35 * @qdepth: max queue depth supported
36 * @initial_cmdsn: initial iscsi CMDSN
38 struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
43 struct Scsi_Host *shost;
44 struct beiscsi_endpoint *beiscsi_ep;
45 struct iscsi_cls_session *cls_session;
46 struct beiscsi_hba *phba;
47 struct iscsi_session *sess;
48 struct beiscsi_session *beiscsi_sess;
49 struct beiscsi_io_task *io_task;
53 pr_err("beiscsi_session_create: invalid ep\n");
56 beiscsi_ep = ep->dd_data;
57 phba = beiscsi_ep->phba;
59 if (!beiscsi_hba_is_online(phba)) {
60 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
61 "BS_%d : HBA in error 0x%lx\n", phba->state);
65 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
66 "BS_%d : In beiscsi_session_create\n");
67 if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) {
68 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
69 "BS_%d : Cannot handle %d cmds."
70 "Max cmds per session supported is %d. Using %d."
72 beiscsi_ep->phba->params.wrbs_per_cxn,
73 beiscsi_ep->phba->params.wrbs_per_cxn);
75 cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn;
79 cls_session = iscsi_session_setup(&beiscsi_iscsi_transport,
81 sizeof(*beiscsi_sess),
83 initial_cmdsn, ISCSI_MAX_TARGET);
86 sess = cls_session->dd_data;
87 beiscsi_sess = sess->dd_data;
88 beiscsi_sess->bhs_pool = dma_pool_create("beiscsi_bhs_pool",
90 sizeof(struct be_cmd_bhs),
92 if (!beiscsi_sess->bhs_pool)
97 iscsi_session_teardown(cls_session);
102 * beiscsi_session_destroy - destroys iscsi session
103 * @cls_session: pointer to iscsi cls session
105 * Destroys iSCSI session instance and releases
106 * resources allocated for it.
108 void beiscsi_session_destroy(struct iscsi_cls_session *cls_session)
110 struct iscsi_session *sess = cls_session->dd_data;
111 struct beiscsi_session *beiscsi_sess = sess->dd_data;
113 printk(KERN_INFO "In beiscsi_session_destroy\n");
114 dma_pool_destroy(beiscsi_sess->bhs_pool);
115 iscsi_session_teardown(cls_session);
119 * beiscsi_session_fail(): Closing session with appropriate error
120 * @cls_session: ptr to session
122 void beiscsi_session_fail(struct iscsi_cls_session *cls_session)
124 iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
129 * beiscsi_conn_create - create an instance of iscsi connection
130 * @cls_session: ptr to iscsi_cls_session
133 struct iscsi_cls_conn *
134 beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
136 struct beiscsi_hba *phba;
137 struct Scsi_Host *shost;
138 struct iscsi_cls_conn *cls_conn;
139 struct beiscsi_conn *beiscsi_conn;
140 struct iscsi_conn *conn;
141 struct iscsi_session *sess;
142 struct beiscsi_session *beiscsi_sess;
144 shost = iscsi_session_to_shost(cls_session);
145 phba = iscsi_host_priv(shost);
147 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
148 "BS_%d : In beiscsi_conn_create ,cid"
149 "from iscsi layer=%d\n", cid);
151 cls_conn = iscsi_conn_setup(cls_session, sizeof(*beiscsi_conn), cid);
155 conn = cls_conn->dd_data;
156 beiscsi_conn = conn->dd_data;
157 beiscsi_conn->ep = NULL;
158 beiscsi_conn->phba = phba;
159 beiscsi_conn->conn = conn;
160 sess = cls_session->dd_data;
161 beiscsi_sess = sess->dd_data;
162 beiscsi_conn->beiscsi_sess = beiscsi_sess;
167 * beiscsi_conn_bind - Binds iscsi session/connection with TCP connection
168 * @cls_session: pointer to iscsi cls session
169 * @cls_conn: pointer to iscsi cls conn
170 * @transport_fd: EP handle(64 bit)
172 * This function binds the TCP Conn with iSCSI Connection and Session.
174 int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
175 struct iscsi_cls_conn *cls_conn,
176 u64 transport_fd, int is_leading)
178 struct iscsi_conn *conn = cls_conn->dd_data;
179 struct beiscsi_conn *beiscsi_conn = conn->dd_data;
180 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
181 struct beiscsi_hba *phba = iscsi_host_priv(shost);
182 struct hwi_controller *phwi_ctrlr = phba->phwi_ctrlr;
183 struct hwi_wrb_context *pwrb_context;
184 struct beiscsi_endpoint *beiscsi_ep;
185 struct iscsi_endpoint *ep;
188 ep = iscsi_lookup_endpoint(transport_fd);
192 beiscsi_ep = ep->dd_data;
194 if (iscsi_conn_bind(cls_session, cls_conn, is_leading))
197 if (beiscsi_ep->phba != phba) {
198 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
199 "BS_%d : beiscsi_ep->hba=%p not equal to phba=%p\n",
200 beiscsi_ep->phba, phba);
204 cri_index = BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid);
205 if (phba->conn_table[cri_index]) {
206 if (beiscsi_conn != phba->conn_table[cri_index] ||
207 beiscsi_ep != phba->conn_table[cri_index]->ep) {
208 __beiscsi_log(phba, KERN_ERR,
209 "BS_%d : conn_table not empty at %u: cid %u conn %p:%p\n",
213 phba->conn_table[cri_index]);
218 beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid;
219 beiscsi_conn->ep = beiscsi_ep;
220 beiscsi_ep->conn = beiscsi_conn;
222 * Each connection is associated with a WRBQ kept in wrb_context.
223 * Store doorbell offset for transmit path.
225 pwrb_context = &phwi_ctrlr->wrb_context[cri_index];
226 beiscsi_conn->doorbell_offset = pwrb_context->doorbell_offset;
227 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
228 "BS_%d : cid %d phba->conn_table[%u]=%p\n",
229 beiscsi_ep->ep_cid, cri_index, beiscsi_conn);
230 phba->conn_table[cri_index] = beiscsi_conn;
234 static int beiscsi_iface_create_ipv4(struct beiscsi_hba *phba)
236 if (phba->ipv4_iface)
239 phba->ipv4_iface = iscsi_create_iface(phba->shost,
240 &beiscsi_iscsi_transport,
241 ISCSI_IFACE_TYPE_IPV4,
243 if (!phba->ipv4_iface) {
244 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
246 "create default IPv4 address.\n");
253 static int beiscsi_iface_create_ipv6(struct beiscsi_hba *phba)
255 if (phba->ipv6_iface)
258 phba->ipv6_iface = iscsi_create_iface(phba->shost,
259 &beiscsi_iscsi_transport,
260 ISCSI_IFACE_TYPE_IPV6,
262 if (!phba->ipv6_iface) {
263 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
265 "create default IPv6 address.\n");
272 void beiscsi_iface_create_default(struct beiscsi_hba *phba)
274 struct be_cmd_get_if_info_resp *if_info;
276 if (!beiscsi_if_get_info(phba, BEISCSI_IP_TYPE_V4, &if_info)) {
277 beiscsi_iface_create_ipv4(phba);
281 if (!beiscsi_if_get_info(phba, BEISCSI_IP_TYPE_V6, &if_info)) {
282 beiscsi_iface_create_ipv6(phba);
287 void beiscsi_iface_destroy_default(struct beiscsi_hba *phba)
289 if (phba->ipv6_iface) {
290 iscsi_destroy_iface(phba->ipv6_iface);
291 phba->ipv6_iface = NULL;
293 if (phba->ipv4_iface) {
294 iscsi_destroy_iface(phba->ipv4_iface);
295 phba->ipv4_iface = NULL;
300 * beiscsi_set_vlan_tag()- Set the VLAN TAG
301 * @shost: Scsi Host for the driver instance
302 * @iface_param: Interface paramters
304 * Set the VLAN TAG for the adapter or disable
309 * Failure: Non-Zero Value
312 beiscsi_iface_config_vlan(struct Scsi_Host *shost,
313 struct iscsi_iface_param_info *iface_param)
315 struct beiscsi_hba *phba = iscsi_host_priv(shost);
318 switch (iface_param->param) {
319 case ISCSI_NET_PARAM_VLAN_ENABLED:
321 if (iface_param->value[0] != ISCSI_VLAN_ENABLE)
322 ret = beiscsi_if_set_vlan(phba, BEISCSI_VLAN_DISABLE);
324 case ISCSI_NET_PARAM_VLAN_TAG:
325 ret = beiscsi_if_set_vlan(phba,
326 *((uint16_t *)iface_param->value));
334 beiscsi_iface_config_ipv4(struct Scsi_Host *shost,
335 struct iscsi_iface_param_info *info,
336 void *data, uint32_t dt_len)
338 struct beiscsi_hba *phba = iscsi_host_priv(shost);
339 u8 *ip = NULL, *subnet = NULL, *gw;
343 /* Check the param */
344 switch (info->param) {
345 case ISCSI_NET_PARAM_IFACE_ENABLE:
346 if (info->value[0] == ISCSI_IFACE_ENABLE)
347 ret = beiscsi_iface_create_ipv4(phba);
349 iscsi_destroy_iface(phba->ipv4_iface);
350 phba->ipv4_iface = NULL;
353 case ISCSI_NET_PARAM_IPV4_GW:
355 ret = beiscsi_if_set_gw(phba, BEISCSI_IP_TYPE_V4, gw);
357 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
358 if (info->value[0] == ISCSI_BOOTPROTO_DHCP)
359 ret = beiscsi_if_en_dhcp(phba, BEISCSI_IP_TYPE_V4);
360 else if (info->value[0] == ISCSI_BOOTPROTO_STATIC)
361 /* release DHCP IP address */
362 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V4,
365 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
366 "BS_%d : Invalid BOOTPROTO: %d\n",
369 case ISCSI_NET_PARAM_IPV4_ADDR:
371 nla = nla_find(data, dt_len, ISCSI_NET_PARAM_IPV4_SUBNET);
373 info = nla_data(nla);
374 subnet = info->value;
376 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V4,
379 case ISCSI_NET_PARAM_IPV4_SUBNET:
381 * OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR ioctl needs IP
382 * and subnet both. Find IP to be applied for this subnet.
384 subnet = info->value;
385 nla = nla_find(data, dt_len, ISCSI_NET_PARAM_IPV4_ADDR);
387 info = nla_data(nla);
390 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V4,
399 beiscsi_iface_config_ipv6(struct Scsi_Host *shost,
400 struct iscsi_iface_param_info *iface_param,
401 void *data, uint32_t dt_len)
403 struct beiscsi_hba *phba = iscsi_host_priv(shost);
406 switch (iface_param->param) {
407 case ISCSI_NET_PARAM_IFACE_ENABLE:
408 if (iface_param->value[0] == ISCSI_IFACE_ENABLE)
409 ret = beiscsi_iface_create_ipv6(phba);
411 iscsi_destroy_iface(phba->ipv6_iface);
412 phba->ipv6_iface = NULL;
415 case ISCSI_NET_PARAM_IPV6_ADDR:
416 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V6,
417 iface_param->value, NULL);
424 int beiscsi_iface_set_param(struct Scsi_Host *shost,
425 void *data, uint32_t dt_len)
427 struct iscsi_iface_param_info *iface_param = NULL;
428 struct beiscsi_hba *phba = iscsi_host_priv(shost);
429 struct nlattr *attrib;
430 uint32_t rm_len = dt_len;
433 if (!beiscsi_hba_is_online(phba)) {
434 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
435 "BS_%d : HBA in error 0x%lx\n", phba->state);
439 /* update interface_handle */
440 ret = beiscsi_if_get_handle(phba);
442 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
443 "BS_%d : Getting Interface Handle Failed\n");
447 nla_for_each_attr(attrib, data, dt_len, rm_len) {
448 /* ignore nla_type as it is never used */
449 if (nla_len(attrib) < sizeof(*iface_param))
452 iface_param = nla_data(attrib);
454 if (iface_param->param_type != ISCSI_NET_PARAM)
458 * BE2ISCSI only supports 1 interface
460 if (iface_param->iface_num) {
461 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
462 "BS_%d : Invalid iface_num %d."
463 "Only iface_num 0 is supported.\n",
464 iface_param->iface_num);
469 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
470 "BS_%d : %s.0 set param %d",
471 (iface_param->iface_type == ISCSI_IFACE_TYPE_IPV4) ?
472 "ipv4" : "ipv6", iface_param->param);
475 switch (iface_param->param) {
476 case ISCSI_NET_PARAM_VLAN_ENABLED:
477 case ISCSI_NET_PARAM_VLAN_TAG:
478 ret = beiscsi_iface_config_vlan(shost, iface_param);
481 switch (iface_param->iface_type) {
482 case ISCSI_IFACE_TYPE_IPV4:
483 ret = beiscsi_iface_config_ipv4(shost,
487 case ISCSI_IFACE_TYPE_IPV6:
488 ret = beiscsi_iface_config_ipv6(shost,
496 __beiscsi_log(phba, KERN_ERR,
497 "BS_%d : %s.0 set param %d not permitted",
498 (iface_param->iface_type ==
499 ISCSI_IFACE_TYPE_IPV4) ? "ipv4" : "ipv6",
510 static int __beiscsi_iface_get_param(struct beiscsi_hba *phba,
511 struct iscsi_iface *iface,
512 int param, char *buf)
514 struct be_cmd_get_if_info_resp *if_info;
515 int len, ip_type = BEISCSI_IP_TYPE_V4;
517 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6)
518 ip_type = BEISCSI_IP_TYPE_V6;
520 len = beiscsi_if_get_info(phba, ip_type, &if_info);
525 case ISCSI_NET_PARAM_IPV4_ADDR:
526 len = sprintf(buf, "%pI4\n", if_info->ip_addr.addr);
528 case ISCSI_NET_PARAM_IPV6_ADDR:
529 len = sprintf(buf, "%pI6\n", if_info->ip_addr.addr);
531 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
532 if (!if_info->dhcp_state)
533 len = sprintf(buf, "static\n");
535 len = sprintf(buf, "dhcp\n");
537 case ISCSI_NET_PARAM_IPV4_SUBNET:
538 len = sprintf(buf, "%pI4\n", if_info->ip_addr.subnet_mask);
540 case ISCSI_NET_PARAM_VLAN_ENABLED:
541 len = sprintf(buf, "%s\n",
542 (if_info->vlan_priority == BEISCSI_VLAN_DISABLE) ?
543 "disable" : "enable");
545 case ISCSI_NET_PARAM_VLAN_ID:
546 if (if_info->vlan_priority == BEISCSI_VLAN_DISABLE)
549 len = sprintf(buf, "%d\n",
550 (if_info->vlan_priority &
553 case ISCSI_NET_PARAM_VLAN_PRIORITY:
554 if (if_info->vlan_priority == BEISCSI_VLAN_DISABLE)
557 len = sprintf(buf, "%d\n",
558 ((if_info->vlan_priority >> 13) &
559 ISCSI_MAX_VLAN_PRIORITY));
569 int beiscsi_iface_get_param(struct iscsi_iface *iface,
570 enum iscsi_param_type param_type,
571 int param, char *buf)
573 struct Scsi_Host *shost = iscsi_iface_to_shost(iface);
574 struct beiscsi_hba *phba = iscsi_host_priv(shost);
575 struct be_cmd_get_def_gateway_resp gateway;
578 if (param_type != ISCSI_NET_PARAM)
580 if (!beiscsi_hba_is_online(phba)) {
581 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
582 "BS_%d : HBA in error 0x%lx\n", phba->state);
587 case ISCSI_NET_PARAM_IPV4_ADDR:
588 case ISCSI_NET_PARAM_IPV4_SUBNET:
589 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
590 case ISCSI_NET_PARAM_IPV6_ADDR:
591 case ISCSI_NET_PARAM_VLAN_ENABLED:
592 case ISCSI_NET_PARAM_VLAN_ID:
593 case ISCSI_NET_PARAM_VLAN_PRIORITY:
594 len = __beiscsi_iface_get_param(phba, iface, param, buf);
596 case ISCSI_NET_PARAM_IFACE_ENABLE:
597 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
598 len = sprintf(buf, "%s\n",
599 phba->ipv4_iface ? "enable" : "disable");
600 else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6)
601 len = sprintf(buf, "%s\n",
602 phba->ipv6_iface ? "enable" : "disable");
604 case ISCSI_NET_PARAM_IPV4_GW:
605 memset(&gateway, 0, sizeof(gateway));
606 len = beiscsi_if_get_gw(phba, BEISCSI_IP_TYPE_V4, &gateway);
608 len = sprintf(buf, "%pI4\n", &gateway.ip_addr.addr);
616 * beiscsi_ep_get_param - get the iscsi parameter
617 * @ep: pointer to iscsi ep
618 * @param: parameter type identifier
619 * @buf: buffer pointer
621 * returns iscsi parameter
623 int beiscsi_ep_get_param(struct iscsi_endpoint *ep,
624 enum iscsi_param param, char *buf)
626 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
629 beiscsi_log(beiscsi_ep->phba, KERN_INFO,
631 "BS_%d : In beiscsi_ep_get_param,"
632 " param= %d\n", param);
635 case ISCSI_PARAM_CONN_PORT:
636 len = sprintf(buf, "%hu\n", beiscsi_ep->dst_tcpport);
638 case ISCSI_PARAM_CONN_ADDRESS:
639 if (beiscsi_ep->ip_type == BEISCSI_IP_TYPE_V4)
640 len = sprintf(buf, "%pI4\n", &beiscsi_ep->dst_addr);
642 len = sprintf(buf, "%pI6\n", &beiscsi_ep->dst6_addr);
650 int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
651 enum iscsi_param param, char *buf, int buflen)
653 struct iscsi_conn *conn = cls_conn->dd_data;
654 struct iscsi_session *session = conn->session;
655 struct beiscsi_hba *phba = NULL;
658 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
659 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
660 "BS_%d : In beiscsi_conn_set_param,"
661 " param= %d\n", param);
663 ret = iscsi_set_param(cls_conn, param, buf, buflen);
667 * If userspace tried to set the value to higher than we can
668 * support override here.
671 case ISCSI_PARAM_FIRST_BURST:
672 if (session->first_burst > 8192)
673 session->first_burst = 8192;
675 case ISCSI_PARAM_MAX_RECV_DLENGTH:
676 if (conn->max_recv_dlength > 65536)
677 conn->max_recv_dlength = 65536;
679 case ISCSI_PARAM_MAX_BURST:
680 if (session->max_burst > 262144)
681 session->max_burst = 262144;
683 case ISCSI_PARAM_MAX_XMIT_DLENGTH:
684 if (conn->max_xmit_dlength > 65536)
685 conn->max_xmit_dlength = 65536;
694 * beiscsi_get_port_state - Get the Port State
695 * @shost : pointer to scsi_host structure
698 static void beiscsi_get_port_state(struct Scsi_Host *shost)
700 struct beiscsi_hba *phba = iscsi_host_priv(shost);
701 struct iscsi_cls_host *ihost = shost->shost_data;
703 ihost->port_state = test_bit(BEISCSI_HBA_LINK_UP, &phba->state) ?
704 ISCSI_PORT_STATE_UP : ISCSI_PORT_STATE_DOWN;
708 * beiscsi_get_port_speed - Get the Port Speed from Adapter
709 * @shost : pointer to scsi_host structure
712 static void beiscsi_get_port_speed(struct Scsi_Host *shost)
714 struct beiscsi_hba *phba = iscsi_host_priv(shost);
715 struct iscsi_cls_host *ihost = shost->shost_data;
717 switch (phba->port_speed) {
718 case BE2ISCSI_LINK_SPEED_10MBPS:
719 ihost->port_speed = ISCSI_PORT_SPEED_10MBPS;
721 case BE2ISCSI_LINK_SPEED_100MBPS:
722 ihost->port_speed = ISCSI_PORT_SPEED_100MBPS;
724 case BE2ISCSI_LINK_SPEED_1GBPS:
725 ihost->port_speed = ISCSI_PORT_SPEED_1GBPS;
727 case BE2ISCSI_LINK_SPEED_10GBPS:
728 ihost->port_speed = ISCSI_PORT_SPEED_10GBPS;
730 case BE2ISCSI_LINK_SPEED_25GBPS:
731 ihost->port_speed = ISCSI_PORT_SPEED_25GBPS;
733 case BE2ISCSI_LINK_SPEED_40GBPS:
734 ihost->port_speed = ISCSI_PORT_SPEED_40GBPS;
737 ihost->port_speed = ISCSI_PORT_SPEED_UNKNOWN;
742 * beiscsi_get_host_param - get the iscsi parameter
743 * @shost: pointer to scsi_host structure
744 * @param: parameter type identifier
745 * @buf: buffer pointer
748 int beiscsi_get_host_param(struct Scsi_Host *shost,
749 enum iscsi_host_param param, char *buf)
751 struct beiscsi_hba *phba = iscsi_host_priv(shost);
754 if (!beiscsi_hba_is_online(phba)) {
755 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
756 "BS_%d : HBA in error 0x%lx\n", phba->state);
759 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
760 "BS_%d : In beiscsi_get_host_param, param = %d\n", param);
763 case ISCSI_HOST_PARAM_HWADDRESS:
764 status = beiscsi_get_macaddr(buf, phba);
766 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
767 "BS_%d : beiscsi_get_macaddr Failed\n");
771 case ISCSI_HOST_PARAM_INITIATOR_NAME:
772 /* try fetching user configured name first */
773 status = beiscsi_get_initiator_name(phba, buf, true);
775 status = beiscsi_get_initiator_name(phba, buf, false);
777 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
778 "BS_%d : Retreiving Initiator Name Failed\n");
783 case ISCSI_HOST_PARAM_PORT_STATE:
784 beiscsi_get_port_state(shost);
785 status = sprintf(buf, "%s\n", iscsi_get_port_state_name(shost));
787 case ISCSI_HOST_PARAM_PORT_SPEED:
788 beiscsi_get_port_speed(shost);
789 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost));
792 return iscsi_host_get_param(shost, param, buf);
797 int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba)
799 struct be_cmd_get_nic_conf_resp resp;
802 if (phba->mac_addr_set)
803 return sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
805 memset(&resp, 0, sizeof(resp));
806 rc = mgmt_get_nic_conf(phba, &resp);
810 phba->mac_addr_set = true;
811 memcpy(phba->mac_address, resp.mac_address, ETH_ALEN);
812 return sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
816 * beiscsi_conn_get_stats - get the iscsi stats
817 * @cls_conn: pointer to iscsi cls conn
818 * @stats: pointer to iscsi_stats structure
820 * returns iscsi stats
822 void beiscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn,
823 struct iscsi_stats *stats)
825 struct iscsi_conn *conn = cls_conn->dd_data;
826 struct beiscsi_hba *phba = NULL;
828 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
829 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
830 "BS_%d : In beiscsi_conn_get_stats\n");
832 stats->txdata_octets = conn->txdata_octets;
833 stats->rxdata_octets = conn->rxdata_octets;
834 stats->dataout_pdus = conn->dataout_pdus_cnt;
835 stats->scsirsp_pdus = conn->scsirsp_pdus_cnt;
836 stats->scsicmd_pdus = conn->scsicmd_pdus_cnt;
837 stats->datain_pdus = conn->datain_pdus_cnt;
838 stats->tmfrsp_pdus = conn->tmfrsp_pdus_cnt;
839 stats->tmfcmd_pdus = conn->tmfcmd_pdus_cnt;
840 stats->r2t_pdus = conn->r2t_pdus_cnt;
841 stats->digest_err = 0;
842 stats->timeout_err = 0;
843 stats->custom_length = 1;
844 strcpy(stats->custom[0].desc, "eh_abort_cnt");
845 stats->custom[0].value = conn->eh_abort_cnt;
849 * beiscsi_set_params_for_offld - get the parameters for offload
850 * @beiscsi_conn: pointer to beiscsi_conn
851 * @params: pointer to offload_params structure
853 static void beiscsi_set_params_for_offld(struct beiscsi_conn *beiscsi_conn,
854 struct beiscsi_offload_params *params)
856 struct iscsi_conn *conn = beiscsi_conn->conn;
857 struct iscsi_session *session = conn->session;
859 AMAP_SET_BITS(struct amap_beiscsi_offload_params, max_burst_length,
860 params, session->max_burst);
861 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
862 max_send_data_segment_length, params,
863 conn->max_xmit_dlength);
864 AMAP_SET_BITS(struct amap_beiscsi_offload_params, first_burst_length,
865 params, session->first_burst);
866 AMAP_SET_BITS(struct amap_beiscsi_offload_params, erl, params,
868 AMAP_SET_BITS(struct amap_beiscsi_offload_params, dde, params,
870 AMAP_SET_BITS(struct amap_beiscsi_offload_params, hde, params,
872 AMAP_SET_BITS(struct amap_beiscsi_offload_params, ir2t, params,
873 session->initial_r2t_en);
874 AMAP_SET_BITS(struct amap_beiscsi_offload_params, imd, params,
875 session->imm_data_en);
876 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
877 data_seq_inorder, params,
878 session->dataseq_inorder_en);
879 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
880 pdu_seq_inorder, params,
881 session->pdu_inorder_en);
882 AMAP_SET_BITS(struct amap_beiscsi_offload_params, max_r2t, params,
884 AMAP_SET_BITS(struct amap_beiscsi_offload_params, exp_statsn, params,
885 (conn->exp_statsn - 1));
886 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
887 max_recv_data_segment_length, params,
888 conn->max_recv_dlength);
893 * beiscsi_conn_start - offload of session to chip
894 * @cls_conn: pointer to beiscsi_conn
896 int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
898 struct iscsi_conn *conn = cls_conn->dd_data;
899 struct beiscsi_conn *beiscsi_conn = conn->dd_data;
900 struct beiscsi_endpoint *beiscsi_ep;
901 struct beiscsi_offload_params params;
902 struct beiscsi_hba *phba;
904 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
906 if (!beiscsi_hba_is_online(phba)) {
907 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
908 "BS_%d : HBA in error 0x%lx\n", phba->state);
911 beiscsi_log(beiscsi_conn->phba, KERN_INFO, BEISCSI_LOG_CONFIG,
912 "BS_%d : In beiscsi_conn_start\n");
914 memset(¶ms, 0, sizeof(struct beiscsi_offload_params));
915 beiscsi_ep = beiscsi_conn->ep;
917 beiscsi_log(beiscsi_conn->phba, KERN_ERR,
919 "BS_%d : In beiscsi_conn_start , no beiscsi_ep\n");
921 beiscsi_conn->login_in_progress = 0;
922 beiscsi_set_params_for_offld(beiscsi_conn, ¶ms);
923 beiscsi_offload_connection(beiscsi_conn, ¶ms);
924 iscsi_conn_start(cls_conn);
929 * beiscsi_get_cid - Allocate a cid
930 * @phba: The phba instance
932 static int beiscsi_get_cid(struct beiscsi_hba *phba)
934 uint16_t cid_avlbl_ulp0, cid_avlbl_ulp1;
935 unsigned short cid, cid_from_ulp;
936 struct ulp_cid_info *cid_info;
938 /* Find the ULP which has more CID available */
939 cid_avlbl_ulp0 = (phba->cid_array_info[BEISCSI_ULP0]) ?
940 BEISCSI_ULP0_AVLBL_CID(phba) : 0;
941 cid_avlbl_ulp1 = (phba->cid_array_info[BEISCSI_ULP1]) ?
942 BEISCSI_ULP1_AVLBL_CID(phba) : 0;
943 cid_from_ulp = (cid_avlbl_ulp0 > cid_avlbl_ulp1) ?
944 BEISCSI_ULP0 : BEISCSI_ULP1;
946 * If iSCSI protocol is loaded only on ULP 0, and when cid_avlbl_ulp
947 * is ZERO for both, ULP 1 is returned.
948 * Check if ULP is loaded before getting new CID.
950 if (!test_bit(cid_from_ulp, (void *)&phba->fw_config.ulp_supported))
951 return BE_INVALID_CID;
953 cid_info = phba->cid_array_info[cid_from_ulp];
954 cid = cid_info->cid_array[cid_info->cid_alloc];
955 if (!cid_info->avlbl_cids || cid == BE_INVALID_CID) {
956 __beiscsi_log(phba, KERN_ERR,
957 "BS_%d : failed to get cid: available %u:%u\n",
958 cid_info->avlbl_cids, cid_info->cid_free);
959 return BE_INVALID_CID;
962 cid_info->cid_array[cid_info->cid_alloc++] = BE_INVALID_CID;
963 if (cid_info->cid_alloc == BEISCSI_GET_CID_COUNT(phba, cid_from_ulp))
964 cid_info->cid_alloc = 0;
965 cid_info->avlbl_cids--;
970 * beiscsi_put_cid - Free the cid
971 * @phba: The phba for which the cid is being freed
972 * @cid: The cid to free
974 static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid)
976 uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
977 struct hwi_wrb_context *pwrb_context;
978 struct hwi_controller *phwi_ctrlr;
979 struct ulp_cid_info *cid_info;
980 uint16_t cid_post_ulp;
982 phwi_ctrlr = phba->phwi_ctrlr;
983 pwrb_context = &phwi_ctrlr->wrb_context[cri_index];
984 cid_post_ulp = pwrb_context->ulp_num;
986 cid_info = phba->cid_array_info[cid_post_ulp];
987 /* fill only in empty slot */
988 if (cid_info->cid_array[cid_info->cid_free] != BE_INVALID_CID) {
989 __beiscsi_log(phba, KERN_ERR,
990 "BS_%d : failed to put cid %u: available %u:%u\n",
991 cid, cid_info->avlbl_cids, cid_info->cid_free);
994 cid_info->cid_array[cid_info->cid_free++] = cid;
995 if (cid_info->cid_free == BEISCSI_GET_CID_COUNT(phba, cid_post_ulp))
996 cid_info->cid_free = 0;
997 cid_info->avlbl_cids++;
1001 * beiscsi_free_ep - free endpoint
1002 * @ep: pointer to iscsi endpoint structure
1004 static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep)
1006 struct beiscsi_hba *phba = beiscsi_ep->phba;
1007 struct beiscsi_conn *beiscsi_conn;
1009 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
1010 beiscsi_ep->phba = NULL;
1011 /* clear this to track freeing in beiscsi_ep_disconnect */
1012 phba->ep_array[BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid)] = NULL;
1015 * Check if any connection resource allocated by driver
1016 * is to be freed.This case occurs when target redirection
1017 * or connection retry is done.
1019 if (!beiscsi_ep->conn)
1022 beiscsi_conn = beiscsi_ep->conn;
1024 * Break ep->conn link here so that completions after
1027 beiscsi_ep->conn = NULL;
1028 if (beiscsi_conn->login_in_progress) {
1029 beiscsi_free_mgmt_task_handles(beiscsi_conn,
1030 beiscsi_conn->task);
1031 beiscsi_conn->login_in_progress = 0;
1036 * beiscsi_open_conn - Ask FW to open a TCP connection
1037 * @ep: endpoint to be used
1038 * @src_addr: The source IP address
1039 * @dst_addr: The Destination IP address
1041 * Asks the FW to open a TCP connection
1043 static int beiscsi_open_conn(struct iscsi_endpoint *ep,
1044 struct sockaddr *src_addr,
1045 struct sockaddr *dst_addr, int non_blocking)
1047 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1048 struct beiscsi_hba *phba = beiscsi_ep->phba;
1049 struct tcp_connect_and_offload_out *ptcpcnct_out;
1050 struct be_dma_mem nonemb_cmd;
1051 unsigned int tag, req_memsize;
1054 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1055 "BS_%d : In beiscsi_open_conn\n");
1057 beiscsi_ep->ep_cid = beiscsi_get_cid(phba);
1058 if (beiscsi_ep->ep_cid == BE_INVALID_CID) {
1059 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1060 "BS_%d : No free cid available\n");
1064 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1065 "BS_%d : In beiscsi_open_conn, ep_cid=%d\n",
1066 beiscsi_ep->ep_cid);
1068 phba->ep_array[BE_GET_CRI_FROM_CID
1069 (beiscsi_ep->ep_cid)] = ep;
1071 beiscsi_ep->cid_vld = 0;
1073 if (is_chip_be2_be3r(phba))
1074 req_memsize = sizeof(struct tcp_connect_and_offload_in);
1076 req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);
1078 nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
1081 if (nonemb_cmd.va == NULL) {
1083 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1084 "BS_%d : Failed to allocate memory for"
1085 " mgmt_open_connection\n");
1087 beiscsi_free_ep(beiscsi_ep);
1090 nonemb_cmd.size = req_memsize;
1091 memset(nonemb_cmd.va, 0, nonemb_cmd.size);
1092 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
1094 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1095 "BS_%d : mgmt_open_connection Failed for cid=%d\n",
1096 beiscsi_ep->ep_cid);
1098 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1099 nonemb_cmd.va, nonemb_cmd.dma);
1100 beiscsi_free_ep(beiscsi_ep);
1104 ret = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
1106 beiscsi_log(phba, KERN_ERR,
1107 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
1108 "BS_%d : mgmt_open_connection Failed");
1111 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1112 nonemb_cmd.va, nonemb_cmd.dma);
1114 beiscsi_free_ep(beiscsi_ep);
1118 ptcpcnct_out = (struct tcp_connect_and_offload_out *)nonemb_cmd.va;
1119 beiscsi_ep = ep->dd_data;
1120 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
1121 beiscsi_ep->cid_vld = 1;
1122 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1123 "BS_%d : mgmt_open_connection Success\n");
1125 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1126 nonemb_cmd.va, nonemb_cmd.dma);
1131 * beiscsi_ep_connect - Ask chip to create TCP Conn
1132 * @scsi_host: Pointer to scsi_host structure
1133 * @dst_addr: The IP address of Target
1134 * @non_blocking: blocking or non-blocking call
1136 * This routines first asks chip to create a connection and then allocates an EP
1138 struct iscsi_endpoint *
1139 beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
1142 struct beiscsi_hba *phba;
1143 struct beiscsi_endpoint *beiscsi_ep;
1144 struct iscsi_endpoint *ep;
1149 pr_err("beiscsi_ep_connect shost is NULL\n");
1150 return ERR_PTR(ret);
1153 phba = iscsi_host_priv(shost);
1154 if (!beiscsi_hba_is_online(phba)) {
1156 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1157 "BS_%d : HBA in error 0x%lx\n", phba->state);
1158 return ERR_PTR(ret);
1160 if (!test_bit(BEISCSI_HBA_LINK_UP, &phba->state)) {
1162 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
1163 "BS_%d : The Adapter Port state is Down!!!\n");
1164 return ERR_PTR(ret);
1167 ep = iscsi_create_endpoint(sizeof(struct beiscsi_endpoint));
1170 return ERR_PTR(ret);
1173 beiscsi_ep = ep->dd_data;
1174 beiscsi_ep->phba = phba;
1175 beiscsi_ep->openiscsi_ep = ep;
1176 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking);
1178 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1179 "BS_%d : Failed in beiscsi_open_conn\n");
1186 iscsi_destroy_endpoint(ep);
1187 return ERR_PTR(ret);
1191 * beiscsi_ep_poll - Poll to see if connection is established
1192 * @ep: endpoint to be used
1193 * @timeout_ms: timeout specified in millisecs
1195 * Poll to see if TCP connection established
1197 int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
1199 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1201 beiscsi_log(beiscsi_ep->phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1202 "BS_%d : In beiscsi_ep_poll\n");
1204 if (beiscsi_ep->cid_vld == 1)
1211 * beiscsi_flush_cq()- Flush the CQ created.
1212 * @phba: ptr device priv structure.
1214 * Before the connection resource are freed flush
1215 * all the CQ enteries
1217 static void beiscsi_flush_cq(struct beiscsi_hba *phba)
1220 struct be_eq_obj *pbe_eq;
1221 struct hwi_controller *phwi_ctrlr;
1222 struct hwi_context_memory *phwi_context;
1224 phwi_ctrlr = phba->phwi_ctrlr;
1225 phwi_context = phwi_ctrlr->phwi_ctxt;
1227 for (i = 0; i < phba->num_cpus; i++) {
1228 pbe_eq = &phwi_context->be_eq[i];
1229 irq_poll_disable(&pbe_eq->iopoll);
1230 beiscsi_process_cq(pbe_eq, BE2_MAX_NUM_CQ_PROC);
1231 irq_poll_enable(&pbe_eq->iopoll);
1236 * beiscsi_conn_close - Invalidate and upload connection
1237 * @ep: The iscsi endpoint
1239 * Returns 0 on success, -1 on failure.
1241 static int beiscsi_conn_close(struct beiscsi_endpoint *beiscsi_ep)
1243 struct beiscsi_hba *phba = beiscsi_ep->phba;
1244 unsigned int tag, attempts;
1248 * Without successfully invalidating and uploading connection
1249 * driver can't reuse the CID so attempt more than once.
1252 while (attempts++ < 3) {
1253 tag = beiscsi_invalidate_cxn(phba, beiscsi_ep);
1255 ret = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
1258 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1259 "BS_%d : invalidate conn failed cid %d\n",
1260 beiscsi_ep->ep_cid);
1264 /* wait for all completions to arrive, then process them */
1266 /* flush CQ entries */
1267 beiscsi_flush_cq(phba);
1273 while (attempts++ < 3) {
1274 tag = beiscsi_upload_cxn(phba, beiscsi_ep);
1276 ret = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
1279 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1280 "BS_%d : upload conn failed cid %d\n",
1281 beiscsi_ep->ep_cid);
1291 * beiscsi_ep_disconnect - Tears down the TCP connection
1292 * @ep: endpoint to be used
1294 * Tears down the TCP connection
1296 void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
1298 struct beiscsi_endpoint *beiscsi_ep;
1299 struct beiscsi_conn *beiscsi_conn;
1300 struct beiscsi_hba *phba;
1303 beiscsi_ep = ep->dd_data;
1304 phba = beiscsi_ep->phba;
1305 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1306 "BS_%d : In beiscsi_ep_disconnect for ep_cid = %u\n",
1307 beiscsi_ep->ep_cid);
1309 cri_index = BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid);
1310 if (!phba->ep_array[cri_index]) {
1311 __beiscsi_log(phba, KERN_ERR,
1312 "BS_%d : ep_array at %u cid %u empty\n",
1314 beiscsi_ep->ep_cid);
1318 if (beiscsi_ep->conn) {
1319 beiscsi_conn = beiscsi_ep->conn;
1320 iscsi_suspend_queue(beiscsi_conn->conn);
1323 if (!beiscsi_hba_is_online(phba)) {
1324 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1325 "BS_%d : HBA in error 0x%lx\n", phba->state);
1328 * Make CID available even if close fails.
1329 * If not freed, FW might fail open using the CID.
1331 if (beiscsi_conn_close(beiscsi_ep) < 0)
1332 __beiscsi_log(phba, KERN_ERR,
1333 "BS_%d : close conn failed cid %d\n",
1334 beiscsi_ep->ep_cid);
1337 beiscsi_free_ep(beiscsi_ep);
1338 if (!phba->conn_table[cri_index])
1339 __beiscsi_log(phba, KERN_ERR,
1340 "BS_%d : conn_table empty at %u: cid %u\n",
1341 cri_index, beiscsi_ep->ep_cid);
1342 phba->conn_table[cri_index] = NULL;
1343 iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
1346 umode_t beiscsi_attr_is_visible(int param_type, int param)
1348 switch (param_type) {
1349 case ISCSI_NET_PARAM:
1351 case ISCSI_NET_PARAM_IFACE_ENABLE:
1352 case ISCSI_NET_PARAM_IPV4_ADDR:
1353 case ISCSI_NET_PARAM_IPV4_SUBNET:
1354 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
1355 case ISCSI_NET_PARAM_IPV4_GW:
1356 case ISCSI_NET_PARAM_IPV6_ADDR:
1357 case ISCSI_NET_PARAM_VLAN_ID:
1358 case ISCSI_NET_PARAM_VLAN_PRIORITY:
1359 case ISCSI_NET_PARAM_VLAN_ENABLED:
1364 case ISCSI_HOST_PARAM:
1366 case ISCSI_HOST_PARAM_HWADDRESS:
1367 case ISCSI_HOST_PARAM_INITIATOR_NAME:
1368 case ISCSI_HOST_PARAM_PORT_STATE:
1369 case ISCSI_HOST_PARAM_PORT_SPEED:
1376 case ISCSI_PARAM_MAX_RECV_DLENGTH:
1377 case ISCSI_PARAM_MAX_XMIT_DLENGTH:
1378 case ISCSI_PARAM_HDRDGST_EN:
1379 case ISCSI_PARAM_DATADGST_EN:
1380 case ISCSI_PARAM_CONN_ADDRESS:
1381 case ISCSI_PARAM_CONN_PORT:
1382 case ISCSI_PARAM_EXP_STATSN:
1383 case ISCSI_PARAM_PERSISTENT_ADDRESS:
1384 case ISCSI_PARAM_PERSISTENT_PORT:
1385 case ISCSI_PARAM_PING_TMO:
1386 case ISCSI_PARAM_RECV_TMO:
1387 case ISCSI_PARAM_INITIAL_R2T_EN:
1388 case ISCSI_PARAM_MAX_R2T:
1389 case ISCSI_PARAM_IMM_DATA_EN:
1390 case ISCSI_PARAM_FIRST_BURST:
1391 case ISCSI_PARAM_MAX_BURST:
1392 case ISCSI_PARAM_PDU_INORDER_EN:
1393 case ISCSI_PARAM_DATASEQ_INORDER_EN:
1394 case ISCSI_PARAM_ERL:
1395 case ISCSI_PARAM_TARGET_NAME:
1396 case ISCSI_PARAM_TPGT:
1397 case ISCSI_PARAM_USERNAME:
1398 case ISCSI_PARAM_PASSWORD:
1399 case ISCSI_PARAM_USERNAME_IN:
1400 case ISCSI_PARAM_PASSWORD_IN:
1401 case ISCSI_PARAM_FAST_ABORT:
1402 case ISCSI_PARAM_ABORT_TMO:
1403 case ISCSI_PARAM_LU_RESET_TMO:
1404 case ISCSI_PARAM_IFACE_NAME:
1405 case ISCSI_PARAM_INITIATOR_NAME: