1 // SPDX-License-Identifier: GPL-2.0-only
3 * This file is part of the Emulex Linux Device Driver for Enterprise iSCSI
4 * Host Bus Adapters. Refer to the README file included with this package
5 * for driver version and adapter compatibility.
7 * Copyright (c) 2018 Broadcom. All Rights Reserved.
8 * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
10 * Contact Information:
11 * linux-drivers@broadcom.com
14 #include <scsi/libiscsi.h>
15 #include <scsi/scsi_transport_iscsi.h>
16 #include <scsi/scsi_transport.h>
17 #include <scsi/scsi_cmnd.h>
18 #include <scsi/scsi_device.h>
19 #include <scsi/scsi_host.h>
20 #include <scsi/scsi_netlink.h>
21 #include <net/netlink.h>
22 #include <scsi/scsi.h>
26 extern struct iscsi_transport beiscsi_iscsi_transport;
29 * beiscsi_session_create - creates a new iscsi session
30 * @ep: pointer to iscsi ep
31 * @cmds_max: max commands supported
32 * @qdepth: max queue depth supported
33 * @initial_cmdsn: initial iscsi CMDSN
35 struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
40 struct Scsi_Host *shost;
41 struct beiscsi_endpoint *beiscsi_ep;
42 struct iscsi_cls_session *cls_session;
43 struct beiscsi_hba *phba;
44 struct iscsi_session *sess;
45 struct beiscsi_session *beiscsi_sess;
46 struct beiscsi_io_task *io_task;
50 pr_err("beiscsi_session_create: invalid ep\n");
53 beiscsi_ep = ep->dd_data;
54 phba = beiscsi_ep->phba;
56 if (!beiscsi_hba_is_online(phba)) {
57 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
58 "BS_%d : HBA in error 0x%lx\n", phba->state);
62 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
63 "BS_%d : In beiscsi_session_create\n");
64 if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) {
65 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
66 "BS_%d : Cannot handle %d cmds."
67 "Max cmds per session supported is %d. Using %d."
69 beiscsi_ep->phba->params.wrbs_per_cxn,
70 beiscsi_ep->phba->params.wrbs_per_cxn);
72 cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn;
76 cls_session = iscsi_session_setup(&beiscsi_iscsi_transport,
78 sizeof(*beiscsi_sess),
80 initial_cmdsn, ISCSI_MAX_TARGET);
83 sess = cls_session->dd_data;
84 beiscsi_sess = sess->dd_data;
85 beiscsi_sess->bhs_pool = dma_pool_create("beiscsi_bhs_pool",
87 sizeof(struct be_cmd_bhs),
89 if (!beiscsi_sess->bhs_pool)
94 iscsi_session_teardown(cls_session);
99 * beiscsi_session_destroy - destroys iscsi session
100 * @cls_session: pointer to iscsi cls session
102 * Destroys iSCSI session instance and releases
103 * resources allocated for it.
105 void beiscsi_session_destroy(struct iscsi_cls_session *cls_session)
107 struct iscsi_session *sess = cls_session->dd_data;
108 struct beiscsi_session *beiscsi_sess = sess->dd_data;
110 printk(KERN_INFO "In beiscsi_session_destroy\n");
111 dma_pool_destroy(beiscsi_sess->bhs_pool);
112 iscsi_session_teardown(cls_session);
116 * beiscsi_session_fail(): Closing session with appropriate error
117 * @cls_session: ptr to session
119 void beiscsi_session_fail(struct iscsi_cls_session *cls_session)
121 iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
126 * beiscsi_conn_create - create an instance of iscsi connection
127 * @cls_session: ptr to iscsi_cls_session
130 struct iscsi_cls_conn *
131 beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
133 struct beiscsi_hba *phba;
134 struct Scsi_Host *shost;
135 struct iscsi_cls_conn *cls_conn;
136 struct beiscsi_conn *beiscsi_conn;
137 struct iscsi_conn *conn;
138 struct iscsi_session *sess;
139 struct beiscsi_session *beiscsi_sess;
141 shost = iscsi_session_to_shost(cls_session);
142 phba = iscsi_host_priv(shost);
144 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
145 "BS_%d : In beiscsi_conn_create ,cid"
146 "from iscsi layer=%d\n", cid);
148 cls_conn = iscsi_conn_setup(cls_session, sizeof(*beiscsi_conn), cid);
152 conn = cls_conn->dd_data;
153 beiscsi_conn = conn->dd_data;
154 beiscsi_conn->ep = NULL;
155 beiscsi_conn->phba = phba;
156 beiscsi_conn->conn = conn;
157 sess = cls_session->dd_data;
158 beiscsi_sess = sess->dd_data;
159 beiscsi_conn->beiscsi_sess = beiscsi_sess;
164 * beiscsi_conn_bind - Binds iscsi session/connection with TCP connection
165 * @cls_session: pointer to iscsi cls session
166 * @cls_conn: pointer to iscsi cls conn
167 * @transport_fd: EP handle(64 bit)
168 * @is_leading: indicate if this is the session leading connection (MCS)
170 * This function binds the TCP Conn with iSCSI Connection and Session.
172 int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
173 struct iscsi_cls_conn *cls_conn,
174 u64 transport_fd, int is_leading)
176 struct iscsi_conn *conn = cls_conn->dd_data;
177 struct beiscsi_conn *beiscsi_conn = conn->dd_data;
178 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
179 struct beiscsi_hba *phba = iscsi_host_priv(shost);
180 struct hwi_controller *phwi_ctrlr = phba->phwi_ctrlr;
181 struct hwi_wrb_context *pwrb_context;
182 struct beiscsi_endpoint *beiscsi_ep;
183 struct iscsi_endpoint *ep;
187 ep = iscsi_lookup_endpoint(transport_fd);
191 beiscsi_ep = ep->dd_data;
193 if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) {
198 if (beiscsi_ep->phba != phba) {
199 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
200 "BS_%d : beiscsi_ep->hba=%p not equal to phba=%p\n",
201 beiscsi_ep->phba, phba);
205 cri_index = BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid);
206 if (phba->conn_table[cri_index]) {
207 if (beiscsi_conn != phba->conn_table[cri_index] ||
208 beiscsi_ep != phba->conn_table[cri_index]->ep) {
209 __beiscsi_log(phba, KERN_ERR,
210 "BS_%d : conn_table not empty at %u: cid %u conn %p:%p\n",
214 phba->conn_table[cri_index]);
220 beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid;
221 beiscsi_conn->ep = beiscsi_ep;
222 beiscsi_ep->conn = beiscsi_conn;
224 * Each connection is associated with a WRBQ kept in wrb_context.
225 * Store doorbell offset for transmit path.
227 pwrb_context = &phwi_ctrlr->wrb_context[cri_index];
228 beiscsi_conn->doorbell_offset = pwrb_context->doorbell_offset;
229 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
230 "BS_%d : cid %d phba->conn_table[%u]=%p\n",
231 beiscsi_ep->ep_cid, cri_index, beiscsi_conn);
232 phba->conn_table[cri_index] = beiscsi_conn;
235 iscsi_put_endpoint(ep);
239 static int beiscsi_iface_create_ipv4(struct beiscsi_hba *phba)
241 if (phba->ipv4_iface)
244 phba->ipv4_iface = iscsi_create_iface(phba->shost,
245 &beiscsi_iscsi_transport,
246 ISCSI_IFACE_TYPE_IPV4,
248 if (!phba->ipv4_iface) {
249 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
251 "create default IPv4 address.\n");
258 static int beiscsi_iface_create_ipv6(struct beiscsi_hba *phba)
260 if (phba->ipv6_iface)
263 phba->ipv6_iface = iscsi_create_iface(phba->shost,
264 &beiscsi_iscsi_transport,
265 ISCSI_IFACE_TYPE_IPV6,
267 if (!phba->ipv6_iface) {
268 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
270 "create default IPv6 address.\n");
277 void beiscsi_iface_create_default(struct beiscsi_hba *phba)
279 struct be_cmd_get_if_info_resp *if_info;
281 if (!beiscsi_if_get_info(phba, BEISCSI_IP_TYPE_V4, &if_info)) {
282 beiscsi_iface_create_ipv4(phba);
286 if (!beiscsi_if_get_info(phba, BEISCSI_IP_TYPE_V6, &if_info)) {
287 beiscsi_iface_create_ipv6(phba);
292 void beiscsi_iface_destroy_default(struct beiscsi_hba *phba)
294 if (phba->ipv6_iface) {
295 iscsi_destroy_iface(phba->ipv6_iface);
296 phba->ipv6_iface = NULL;
298 if (phba->ipv4_iface) {
299 iscsi_destroy_iface(phba->ipv4_iface);
300 phba->ipv4_iface = NULL;
305 * beiscsi_iface_config_vlan()- Set the VLAN TAG
306 * @shost: Scsi Host for the driver instance
307 * @iface_param: Interface paramters
309 * Set the VLAN TAG for the adapter or disable
314 * Failure: Non-Zero Value
317 beiscsi_iface_config_vlan(struct Scsi_Host *shost,
318 struct iscsi_iface_param_info *iface_param)
320 struct beiscsi_hba *phba = iscsi_host_priv(shost);
323 switch (iface_param->param) {
324 case ISCSI_NET_PARAM_VLAN_ENABLED:
326 if (iface_param->value[0] != ISCSI_VLAN_ENABLE)
327 ret = beiscsi_if_set_vlan(phba, BEISCSI_VLAN_DISABLE);
329 case ISCSI_NET_PARAM_VLAN_TAG:
330 ret = beiscsi_if_set_vlan(phba,
331 *((uint16_t *)iface_param->value));
339 beiscsi_iface_config_ipv4(struct Scsi_Host *shost,
340 struct iscsi_iface_param_info *info,
341 void *data, uint32_t dt_len)
343 struct beiscsi_hba *phba = iscsi_host_priv(shost);
344 u8 *ip = NULL, *subnet = NULL, *gw;
348 /* Check the param */
349 switch (info->param) {
350 case ISCSI_NET_PARAM_IFACE_ENABLE:
351 if (info->value[0] == ISCSI_IFACE_ENABLE)
352 ret = beiscsi_iface_create_ipv4(phba);
354 iscsi_destroy_iface(phba->ipv4_iface);
355 phba->ipv4_iface = NULL;
358 case ISCSI_NET_PARAM_IPV4_GW:
360 ret = beiscsi_if_set_gw(phba, BEISCSI_IP_TYPE_V4, gw);
362 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
363 if (info->value[0] == ISCSI_BOOTPROTO_DHCP)
364 ret = beiscsi_if_en_dhcp(phba, BEISCSI_IP_TYPE_V4);
365 else if (info->value[0] == ISCSI_BOOTPROTO_STATIC)
366 /* release DHCP IP address */
367 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V4,
370 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
371 "BS_%d : Invalid BOOTPROTO: %d\n",
374 case ISCSI_NET_PARAM_IPV4_ADDR:
376 nla = nla_find(data, dt_len, ISCSI_NET_PARAM_IPV4_SUBNET);
378 info = nla_data(nla);
379 subnet = info->value;
381 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V4,
384 case ISCSI_NET_PARAM_IPV4_SUBNET:
386 * OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR ioctl needs IP
387 * and subnet both. Find IP to be applied for this subnet.
389 subnet = info->value;
390 nla = nla_find(data, dt_len, ISCSI_NET_PARAM_IPV4_ADDR);
392 info = nla_data(nla);
395 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V4,
404 beiscsi_iface_config_ipv6(struct Scsi_Host *shost,
405 struct iscsi_iface_param_info *iface_param,
406 void *data, uint32_t dt_len)
408 struct beiscsi_hba *phba = iscsi_host_priv(shost);
411 switch (iface_param->param) {
412 case ISCSI_NET_PARAM_IFACE_ENABLE:
413 if (iface_param->value[0] == ISCSI_IFACE_ENABLE)
414 ret = beiscsi_iface_create_ipv6(phba);
416 iscsi_destroy_iface(phba->ipv6_iface);
417 phba->ipv6_iface = NULL;
420 case ISCSI_NET_PARAM_IPV6_ADDR:
421 ret = beiscsi_if_en_static(phba, BEISCSI_IP_TYPE_V6,
422 iface_param->value, NULL);
429 int beiscsi_iface_set_param(struct Scsi_Host *shost,
430 void *data, uint32_t dt_len)
432 struct iscsi_iface_param_info *iface_param = NULL;
433 struct beiscsi_hba *phba = iscsi_host_priv(shost);
434 struct nlattr *attrib;
435 uint32_t rm_len = dt_len;
438 if (!beiscsi_hba_is_online(phba)) {
439 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
440 "BS_%d : HBA in error 0x%lx\n", phba->state);
444 /* update interface_handle */
445 ret = beiscsi_if_get_handle(phba);
447 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
448 "BS_%d : Getting Interface Handle Failed\n");
452 nla_for_each_attr(attrib, data, dt_len, rm_len) {
453 iface_param = nla_data(attrib);
455 if (iface_param->param_type != ISCSI_NET_PARAM)
459 * BE2ISCSI only supports 1 interface
461 if (iface_param->iface_num) {
462 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
463 "BS_%d : Invalid iface_num %d."
464 "Only iface_num 0 is supported.\n",
465 iface_param->iface_num);
470 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
471 "BS_%d : %s.0 set param %d",
472 (iface_param->iface_type == ISCSI_IFACE_TYPE_IPV4) ?
473 "ipv4" : "ipv6", iface_param->param);
476 switch (iface_param->param) {
477 case ISCSI_NET_PARAM_VLAN_ENABLED:
478 case ISCSI_NET_PARAM_VLAN_TAG:
479 ret = beiscsi_iface_config_vlan(shost, iface_param);
482 switch (iface_param->iface_type) {
483 case ISCSI_IFACE_TYPE_IPV4:
484 ret = beiscsi_iface_config_ipv4(shost,
488 case ISCSI_IFACE_TYPE_IPV6:
489 ret = beiscsi_iface_config_ipv6(shost,
497 __beiscsi_log(phba, KERN_ERR,
498 "BS_%d : %s.0 set param %d not permitted",
499 (iface_param->iface_type ==
500 ISCSI_IFACE_TYPE_IPV4) ? "ipv4" : "ipv6",
511 static int __beiscsi_iface_get_param(struct beiscsi_hba *phba,
512 struct iscsi_iface *iface,
513 int param, char *buf)
515 struct be_cmd_get_if_info_resp *if_info;
516 int len, ip_type = BEISCSI_IP_TYPE_V4;
518 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6)
519 ip_type = BEISCSI_IP_TYPE_V6;
521 len = beiscsi_if_get_info(phba, ip_type, &if_info);
526 case ISCSI_NET_PARAM_IPV4_ADDR:
527 len = sprintf(buf, "%pI4\n", if_info->ip_addr.addr);
529 case ISCSI_NET_PARAM_IPV6_ADDR:
530 len = sprintf(buf, "%pI6\n", if_info->ip_addr.addr);
532 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
533 if (!if_info->dhcp_state)
534 len = sprintf(buf, "static\n");
536 len = sprintf(buf, "dhcp\n");
538 case ISCSI_NET_PARAM_IPV4_SUBNET:
539 len = sprintf(buf, "%pI4\n", if_info->ip_addr.subnet_mask);
541 case ISCSI_NET_PARAM_VLAN_ENABLED:
542 len = sprintf(buf, "%s\n",
543 (if_info->vlan_priority == BEISCSI_VLAN_DISABLE) ?
544 "disable" : "enable");
546 case ISCSI_NET_PARAM_VLAN_ID:
547 if (if_info->vlan_priority == BEISCSI_VLAN_DISABLE)
550 len = sprintf(buf, "%d\n",
551 (if_info->vlan_priority &
554 case ISCSI_NET_PARAM_VLAN_PRIORITY:
555 if (if_info->vlan_priority == BEISCSI_VLAN_DISABLE)
558 len = sprintf(buf, "%d\n",
559 ((if_info->vlan_priority >> 13) &
560 ISCSI_MAX_VLAN_PRIORITY));
570 int beiscsi_iface_get_param(struct iscsi_iface *iface,
571 enum iscsi_param_type param_type,
572 int param, char *buf)
574 struct Scsi_Host *shost = iscsi_iface_to_shost(iface);
575 struct beiscsi_hba *phba = iscsi_host_priv(shost);
576 struct be_cmd_get_def_gateway_resp gateway;
579 if (param_type != ISCSI_NET_PARAM)
581 if (!beiscsi_hba_is_online(phba)) {
582 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
583 "BS_%d : HBA in error 0x%lx\n", phba->state);
588 case ISCSI_NET_PARAM_IPV4_ADDR:
589 case ISCSI_NET_PARAM_IPV4_SUBNET:
590 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
591 case ISCSI_NET_PARAM_IPV6_ADDR:
592 case ISCSI_NET_PARAM_VLAN_ENABLED:
593 case ISCSI_NET_PARAM_VLAN_ID:
594 case ISCSI_NET_PARAM_VLAN_PRIORITY:
595 len = __beiscsi_iface_get_param(phba, iface, param, buf);
597 case ISCSI_NET_PARAM_IFACE_ENABLE:
598 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
599 len = sprintf(buf, "%s\n",
600 phba->ipv4_iface ? "enable" : "disable");
601 else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6)
602 len = sprintf(buf, "%s\n",
603 phba->ipv6_iface ? "enable" : "disable");
605 case ISCSI_NET_PARAM_IPV4_GW:
606 memset(&gateway, 0, sizeof(gateway));
607 len = beiscsi_if_get_gw(phba, BEISCSI_IP_TYPE_V4, &gateway);
609 len = sprintf(buf, "%pI4\n", &gateway.ip_addr.addr);
617 * beiscsi_ep_get_param - get the iscsi parameter
618 * @ep: pointer to iscsi ep
619 * @param: parameter type identifier
620 * @buf: buffer pointer
622 * returns iscsi parameter
624 int beiscsi_ep_get_param(struct iscsi_endpoint *ep,
625 enum iscsi_param param, char *buf)
627 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
630 beiscsi_log(beiscsi_ep->phba, KERN_INFO,
632 "BS_%d : In beiscsi_ep_get_param,"
633 " param= %d\n", param);
636 case ISCSI_PARAM_CONN_PORT:
637 len = sprintf(buf, "%hu\n", beiscsi_ep->dst_tcpport);
639 case ISCSI_PARAM_CONN_ADDRESS:
640 if (beiscsi_ep->ip_type == BEISCSI_IP_TYPE_V4)
641 len = sprintf(buf, "%pI4\n", &beiscsi_ep->dst_addr);
643 len = sprintf(buf, "%pI6\n", &beiscsi_ep->dst6_addr);
651 int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
652 enum iscsi_param param, char *buf, int buflen)
654 struct iscsi_conn *conn = cls_conn->dd_data;
655 struct iscsi_session *session = conn->session;
656 struct beiscsi_hba *phba = NULL;
659 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
660 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
661 "BS_%d : In beiscsi_conn_set_param,"
662 " param= %d\n", param);
664 ret = iscsi_set_param(cls_conn, param, buf, buflen);
668 * If userspace tried to set the value to higher than we can
669 * support override here.
672 case ISCSI_PARAM_FIRST_BURST:
673 if (session->first_burst > 8192)
674 session->first_burst = 8192;
676 case ISCSI_PARAM_MAX_RECV_DLENGTH:
677 if (conn->max_recv_dlength > 65536)
678 conn->max_recv_dlength = 65536;
680 case ISCSI_PARAM_MAX_BURST:
681 if (session->max_burst > 262144)
682 session->max_burst = 262144;
684 case ISCSI_PARAM_MAX_XMIT_DLENGTH:
685 if (conn->max_xmit_dlength > 65536)
686 conn->max_xmit_dlength = 65536;
696 * beiscsi_get_port_state - Get the Port State
697 * @shost : pointer to scsi_host structure
700 static void beiscsi_get_port_state(struct Scsi_Host *shost)
702 struct beiscsi_hba *phba = iscsi_host_priv(shost);
703 struct iscsi_cls_host *ihost = shost->shost_data;
705 ihost->port_state = test_bit(BEISCSI_HBA_LINK_UP, &phba->state) ?
706 ISCSI_PORT_STATE_UP : ISCSI_PORT_STATE_DOWN;
710 * beiscsi_get_port_speed - Get the Port Speed from Adapter
711 * @shost : pointer to scsi_host structure
714 static void beiscsi_get_port_speed(struct Scsi_Host *shost)
716 struct beiscsi_hba *phba = iscsi_host_priv(shost);
717 struct iscsi_cls_host *ihost = shost->shost_data;
719 switch (phba->port_speed) {
720 case BE2ISCSI_LINK_SPEED_10MBPS:
721 ihost->port_speed = ISCSI_PORT_SPEED_10MBPS;
723 case BE2ISCSI_LINK_SPEED_100MBPS:
724 ihost->port_speed = ISCSI_PORT_SPEED_100MBPS;
726 case BE2ISCSI_LINK_SPEED_1GBPS:
727 ihost->port_speed = ISCSI_PORT_SPEED_1GBPS;
729 case BE2ISCSI_LINK_SPEED_10GBPS:
730 ihost->port_speed = ISCSI_PORT_SPEED_10GBPS;
732 case BE2ISCSI_LINK_SPEED_25GBPS:
733 ihost->port_speed = ISCSI_PORT_SPEED_25GBPS;
735 case BE2ISCSI_LINK_SPEED_40GBPS:
736 ihost->port_speed = ISCSI_PORT_SPEED_40GBPS;
739 ihost->port_speed = ISCSI_PORT_SPEED_UNKNOWN;
744 * beiscsi_get_host_param - get the iscsi parameter
745 * @shost: pointer to scsi_host structure
746 * @param: parameter type identifier
747 * @buf: buffer pointer
750 int beiscsi_get_host_param(struct Scsi_Host *shost,
751 enum iscsi_host_param param, char *buf)
753 struct beiscsi_hba *phba = iscsi_host_priv(shost);
756 if (!beiscsi_hba_is_online(phba)) {
757 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
758 "BS_%d : HBA in error 0x%lx\n", phba->state);
761 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
762 "BS_%d : In beiscsi_get_host_param, param = %d\n", param);
765 case ISCSI_HOST_PARAM_HWADDRESS:
766 status = beiscsi_get_macaddr(buf, phba);
768 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
769 "BS_%d : beiscsi_get_macaddr Failed\n");
773 case ISCSI_HOST_PARAM_INITIATOR_NAME:
774 /* try fetching user configured name first */
775 status = beiscsi_get_initiator_name(phba, buf, true);
777 status = beiscsi_get_initiator_name(phba, buf, false);
779 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
780 "BS_%d : Retrieving Initiator Name Failed\n");
785 case ISCSI_HOST_PARAM_PORT_STATE:
786 beiscsi_get_port_state(shost);
787 status = sprintf(buf, "%s\n", iscsi_get_port_state_name(shost));
789 case ISCSI_HOST_PARAM_PORT_SPEED:
790 beiscsi_get_port_speed(shost);
791 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost));
794 return iscsi_host_get_param(shost, param, buf);
799 int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba)
801 struct be_cmd_get_nic_conf_resp resp;
804 if (phba->mac_addr_set)
805 return sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
807 memset(&resp, 0, sizeof(resp));
808 rc = mgmt_get_nic_conf(phba, &resp);
812 phba->mac_addr_set = true;
813 memcpy(phba->mac_address, resp.mac_address, ETH_ALEN);
814 return sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
818 * beiscsi_conn_get_stats - get the iscsi stats
819 * @cls_conn: pointer to iscsi cls conn
820 * @stats: pointer to iscsi_stats structure
822 * returns iscsi stats
824 void beiscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn,
825 struct iscsi_stats *stats)
827 struct iscsi_conn *conn = cls_conn->dd_data;
828 struct beiscsi_hba *phba = NULL;
830 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
831 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
832 "BS_%d : In beiscsi_conn_get_stats\n");
834 stats->txdata_octets = conn->txdata_octets;
835 stats->rxdata_octets = conn->rxdata_octets;
836 stats->dataout_pdus = conn->dataout_pdus_cnt;
837 stats->scsirsp_pdus = conn->scsirsp_pdus_cnt;
838 stats->scsicmd_pdus = conn->scsicmd_pdus_cnt;
839 stats->datain_pdus = conn->datain_pdus_cnt;
840 stats->tmfrsp_pdus = conn->tmfrsp_pdus_cnt;
841 stats->tmfcmd_pdus = conn->tmfcmd_pdus_cnt;
842 stats->r2t_pdus = conn->r2t_pdus_cnt;
843 stats->digest_err = 0;
844 stats->timeout_err = 0;
845 stats->custom_length = 1;
846 strcpy(stats->custom[0].desc, "eh_abort_cnt");
847 stats->custom[0].value = conn->eh_abort_cnt;
851 * beiscsi_set_params_for_offld - get the parameters for offload
852 * @beiscsi_conn: pointer to beiscsi_conn
853 * @params: pointer to offload_params structure
855 static void beiscsi_set_params_for_offld(struct beiscsi_conn *beiscsi_conn,
856 struct beiscsi_offload_params *params)
858 struct iscsi_conn *conn = beiscsi_conn->conn;
859 struct iscsi_session *session = conn->session;
861 AMAP_SET_BITS(struct amap_beiscsi_offload_params, max_burst_length,
862 params, session->max_burst);
863 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
864 max_send_data_segment_length, params,
865 conn->max_xmit_dlength);
866 AMAP_SET_BITS(struct amap_beiscsi_offload_params, first_burst_length,
867 params, session->first_burst);
868 AMAP_SET_BITS(struct amap_beiscsi_offload_params, erl, params,
870 AMAP_SET_BITS(struct amap_beiscsi_offload_params, dde, params,
872 AMAP_SET_BITS(struct amap_beiscsi_offload_params, hde, params,
874 AMAP_SET_BITS(struct amap_beiscsi_offload_params, ir2t, params,
875 session->initial_r2t_en);
876 AMAP_SET_BITS(struct amap_beiscsi_offload_params, imd, params,
877 session->imm_data_en);
878 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
879 data_seq_inorder, params,
880 session->dataseq_inorder_en);
881 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
882 pdu_seq_inorder, params,
883 session->pdu_inorder_en);
884 AMAP_SET_BITS(struct amap_beiscsi_offload_params, max_r2t, params,
886 AMAP_SET_BITS(struct amap_beiscsi_offload_params, exp_statsn, params,
887 (conn->exp_statsn - 1));
888 AMAP_SET_BITS(struct amap_beiscsi_offload_params,
889 max_recv_data_segment_length, params,
890 conn->max_recv_dlength);
895 * beiscsi_conn_start - offload of session to chip
896 * @cls_conn: pointer to beiscsi_conn
898 int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
900 struct iscsi_conn *conn = cls_conn->dd_data;
901 struct beiscsi_conn *beiscsi_conn = conn->dd_data;
902 struct beiscsi_endpoint *beiscsi_ep;
903 struct beiscsi_offload_params params;
904 struct beiscsi_hba *phba;
906 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
908 if (!beiscsi_hba_is_online(phba)) {
909 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
910 "BS_%d : HBA in error 0x%lx\n", phba->state);
913 beiscsi_log(beiscsi_conn->phba, KERN_INFO, BEISCSI_LOG_CONFIG,
914 "BS_%d : In beiscsi_conn_start\n");
916 memset(¶ms, 0, sizeof(struct beiscsi_offload_params));
917 beiscsi_ep = beiscsi_conn->ep;
919 beiscsi_log(beiscsi_conn->phba, KERN_ERR,
921 "BS_%d : In beiscsi_conn_start , no beiscsi_ep\n");
923 beiscsi_conn->login_in_progress = 0;
924 beiscsi_set_params_for_offld(beiscsi_conn, ¶ms);
925 beiscsi_offload_connection(beiscsi_conn, ¶ms);
926 iscsi_conn_start(cls_conn);
931 * beiscsi_get_cid - Allocate a cid
932 * @phba: The phba instance
934 static int beiscsi_get_cid(struct beiscsi_hba *phba)
936 uint16_t cid_avlbl_ulp0, cid_avlbl_ulp1;
937 unsigned short cid, cid_from_ulp;
938 struct ulp_cid_info *cid_info;
940 /* Find the ULP which has more CID available */
941 cid_avlbl_ulp0 = (phba->cid_array_info[BEISCSI_ULP0]) ?
942 BEISCSI_ULP0_AVLBL_CID(phba) : 0;
943 cid_avlbl_ulp1 = (phba->cid_array_info[BEISCSI_ULP1]) ?
944 BEISCSI_ULP1_AVLBL_CID(phba) : 0;
945 cid_from_ulp = (cid_avlbl_ulp0 > cid_avlbl_ulp1) ?
946 BEISCSI_ULP0 : BEISCSI_ULP1;
948 * If iSCSI protocol is loaded only on ULP 0, and when cid_avlbl_ulp
949 * is ZERO for both, ULP 1 is returned.
950 * Check if ULP is loaded before getting new CID.
952 if (!test_bit(cid_from_ulp, (void *)&phba->fw_config.ulp_supported))
953 return BE_INVALID_CID;
955 cid_info = phba->cid_array_info[cid_from_ulp];
956 cid = cid_info->cid_array[cid_info->cid_alloc];
957 if (!cid_info->avlbl_cids || cid == BE_INVALID_CID) {
958 __beiscsi_log(phba, KERN_ERR,
959 "BS_%d : failed to get cid: available %u:%u\n",
960 cid_info->avlbl_cids, cid_info->cid_free);
961 return BE_INVALID_CID;
964 cid_info->cid_array[cid_info->cid_alloc++] = BE_INVALID_CID;
965 if (cid_info->cid_alloc == BEISCSI_GET_CID_COUNT(phba, cid_from_ulp))
966 cid_info->cid_alloc = 0;
967 cid_info->avlbl_cids--;
972 * beiscsi_put_cid - Free the cid
973 * @phba: The phba for which the cid is being freed
974 * @cid: The cid to free
976 static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid)
978 uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
979 struct hwi_wrb_context *pwrb_context;
980 struct hwi_controller *phwi_ctrlr;
981 struct ulp_cid_info *cid_info;
982 uint16_t cid_post_ulp;
984 phwi_ctrlr = phba->phwi_ctrlr;
985 pwrb_context = &phwi_ctrlr->wrb_context[cri_index];
986 cid_post_ulp = pwrb_context->ulp_num;
988 cid_info = phba->cid_array_info[cid_post_ulp];
989 /* fill only in empty slot */
990 if (cid_info->cid_array[cid_info->cid_free] != BE_INVALID_CID) {
991 __beiscsi_log(phba, KERN_ERR,
992 "BS_%d : failed to put cid %u: available %u:%u\n",
993 cid, cid_info->avlbl_cids, cid_info->cid_free);
996 cid_info->cid_array[cid_info->cid_free++] = cid;
997 if (cid_info->cid_free == BEISCSI_GET_CID_COUNT(phba, cid_post_ulp))
998 cid_info->cid_free = 0;
999 cid_info->avlbl_cids++;
1003 * beiscsi_free_ep - free endpoint
1004 * @beiscsi_ep: pointer to device endpoint struct
1006 static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep)
1008 struct beiscsi_hba *phba = beiscsi_ep->phba;
1009 struct beiscsi_conn *beiscsi_conn;
1011 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
1012 beiscsi_ep->phba = NULL;
1013 /* clear this to track freeing in beiscsi_ep_disconnect */
1014 phba->ep_array[BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid)] = NULL;
1017 * Check if any connection resource allocated by driver
1018 * is to be freed.This case occurs when target redirection
1019 * or connection retry is done.
1021 if (!beiscsi_ep->conn)
1024 beiscsi_conn = beiscsi_ep->conn;
1026 * Break ep->conn link here so that completions after
1029 beiscsi_ep->conn = NULL;
1030 if (beiscsi_conn->login_in_progress) {
1031 beiscsi_free_mgmt_task_handles(beiscsi_conn,
1032 beiscsi_conn->task);
1033 beiscsi_conn->login_in_progress = 0;
1038 * beiscsi_open_conn - Ask FW to open a TCP connection
1039 * @ep: pointer to device endpoint struct
1040 * @src_addr: The source IP address
1041 * @dst_addr: The Destination IP address
1042 * @non_blocking: blocking or non-blocking call
1044 * Asks the FW to open a TCP connection
1046 static int beiscsi_open_conn(struct iscsi_endpoint *ep,
1047 struct sockaddr *src_addr,
1048 struct sockaddr *dst_addr, int non_blocking)
1050 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1051 struct beiscsi_hba *phba = beiscsi_ep->phba;
1052 struct tcp_connect_and_offload_out *ptcpcnct_out;
1053 struct be_dma_mem nonemb_cmd;
1054 unsigned int tag, req_memsize;
1057 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1058 "BS_%d : In beiscsi_open_conn\n");
1060 beiscsi_ep->ep_cid = beiscsi_get_cid(phba);
1061 if (beiscsi_ep->ep_cid == BE_INVALID_CID) {
1062 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1063 "BS_%d : No free cid available\n");
1067 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1068 "BS_%d : In beiscsi_open_conn, ep_cid=%d\n",
1069 beiscsi_ep->ep_cid);
1071 phba->ep_array[BE_GET_CRI_FROM_CID
1072 (beiscsi_ep->ep_cid)] = ep;
1074 beiscsi_ep->cid_vld = 0;
1076 if (is_chip_be2_be3r(phba))
1077 req_memsize = sizeof(struct tcp_connect_and_offload_in);
1079 req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);
1081 nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
1083 &nonemb_cmd.dma, GFP_KERNEL);
1084 if (nonemb_cmd.va == NULL) {
1086 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1087 "BS_%d : Failed to allocate memory for"
1088 " mgmt_open_connection\n");
1090 beiscsi_free_ep(beiscsi_ep);
1093 nonemb_cmd.size = req_memsize;
1094 memset(nonemb_cmd.va, 0, nonemb_cmd.size);
1095 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
1097 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1098 "BS_%d : mgmt_open_connection Failed for cid=%d\n",
1099 beiscsi_ep->ep_cid);
1101 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
1102 nonemb_cmd.va, nonemb_cmd.dma);
1103 beiscsi_free_ep(beiscsi_ep);
1107 ret = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
1109 beiscsi_log(phba, KERN_ERR,
1110 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
1111 "BS_%d : mgmt_open_connection Failed");
1114 dma_free_coherent(&phba->ctrl.pdev->dev,
1115 nonemb_cmd.size, nonemb_cmd.va,
1118 beiscsi_free_ep(beiscsi_ep);
1122 ptcpcnct_out = (struct tcp_connect_and_offload_out *)nonemb_cmd.va;
1123 beiscsi_ep = ep->dd_data;
1124 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
1125 beiscsi_ep->cid_vld = 1;
1126 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1127 "BS_%d : mgmt_open_connection Success\n");
1129 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
1130 nonemb_cmd.va, nonemb_cmd.dma);
1135 * beiscsi_ep_connect - Ask chip to create TCP Conn
1136 * @shost: Pointer to scsi_host structure
1137 * @dst_addr: The IP address of Target
1138 * @non_blocking: blocking or non-blocking call
1140 * This routines first asks chip to create a connection and then allocates an EP
1142 struct iscsi_endpoint *
1143 beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
1146 struct beiscsi_hba *phba;
1147 struct beiscsi_endpoint *beiscsi_ep;
1148 struct iscsi_endpoint *ep;
1153 pr_err("beiscsi_ep_connect shost is NULL\n");
1154 return ERR_PTR(ret);
1157 phba = iscsi_host_priv(shost);
1158 if (!beiscsi_hba_is_online(phba)) {
1160 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1161 "BS_%d : HBA in error 0x%lx\n", phba->state);
1162 return ERR_PTR(ret);
1164 if (!test_bit(BEISCSI_HBA_LINK_UP, &phba->state)) {
1166 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
1167 "BS_%d : The Adapter Port state is Down!!!\n");
1168 return ERR_PTR(ret);
1171 ep = iscsi_create_endpoint(sizeof(struct beiscsi_endpoint));
1174 return ERR_PTR(ret);
1177 beiscsi_ep = ep->dd_data;
1178 beiscsi_ep->phba = phba;
1179 beiscsi_ep->openiscsi_ep = ep;
1180 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking);
1182 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1183 "BS_%d : Failed in beiscsi_open_conn\n");
1190 iscsi_destroy_endpoint(ep);
1191 return ERR_PTR(ret);
1195 * beiscsi_ep_poll - Poll to see if connection is established
1196 * @ep: endpoint to be used
1197 * @timeout_ms: timeout specified in millisecs
1199 * Poll to see if TCP connection established
1201 int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
1203 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1205 beiscsi_log(beiscsi_ep->phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1206 "BS_%d : In beiscsi_ep_poll\n");
1208 if (beiscsi_ep->cid_vld == 1)
1215 * beiscsi_flush_cq()- Flush the CQ created.
1216 * @phba: ptr device priv structure.
1218 * Before the connection resource are freed flush
1219 * all the CQ enteries
1221 static void beiscsi_flush_cq(struct beiscsi_hba *phba)
1224 struct be_eq_obj *pbe_eq;
1225 struct hwi_controller *phwi_ctrlr;
1226 struct hwi_context_memory *phwi_context;
1228 phwi_ctrlr = phba->phwi_ctrlr;
1229 phwi_context = phwi_ctrlr->phwi_ctxt;
1231 for (i = 0; i < phba->num_cpus; i++) {
1232 pbe_eq = &phwi_context->be_eq[i];
1233 irq_poll_disable(&pbe_eq->iopoll);
1234 beiscsi_process_cq(pbe_eq, BE2_MAX_NUM_CQ_PROC);
1235 irq_poll_enable(&pbe_eq->iopoll);
1240 * beiscsi_conn_close - Invalidate and upload connection
1241 * @beiscsi_ep: pointer to device endpoint struct
1243 * Returns 0 on success, -1 on failure.
1245 static int beiscsi_conn_close(struct beiscsi_endpoint *beiscsi_ep)
1247 struct beiscsi_hba *phba = beiscsi_ep->phba;
1248 unsigned int tag, attempts;
1252 * Without successfully invalidating and uploading connection
1253 * driver can't reuse the CID so attempt more than once.
1256 while (attempts++ < 3) {
1257 tag = beiscsi_invalidate_cxn(phba, beiscsi_ep);
1259 ret = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
1262 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1263 "BS_%d : invalidate conn failed cid %d\n",
1264 beiscsi_ep->ep_cid);
1268 /* wait for all completions to arrive, then process them */
1270 /* flush CQ entries */
1271 beiscsi_flush_cq(phba);
1277 while (attempts++ < 3) {
1278 tag = beiscsi_upload_cxn(phba, beiscsi_ep);
1280 ret = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
1283 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1284 "BS_%d : upload conn failed cid %d\n",
1285 beiscsi_ep->ep_cid);
1295 * beiscsi_ep_disconnect - Tears down the TCP connection
1296 * @ep: endpoint to be used
1298 * Tears down the TCP connection
1300 void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
1302 struct beiscsi_endpoint *beiscsi_ep;
1303 struct beiscsi_hba *phba;
1306 beiscsi_ep = ep->dd_data;
1307 phba = beiscsi_ep->phba;
1308 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1309 "BS_%d : In beiscsi_ep_disconnect for ep_cid = %u\n",
1310 beiscsi_ep->ep_cid);
1312 cri_index = BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid);
1313 if (!phba->ep_array[cri_index]) {
1314 __beiscsi_log(phba, KERN_ERR,
1315 "BS_%d : ep_array at %u cid %u empty\n",
1317 beiscsi_ep->ep_cid);
1321 if (!beiscsi_hba_is_online(phba)) {
1322 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1323 "BS_%d : HBA in error 0x%lx\n", phba->state);
1326 * Make CID available even if close fails.
1327 * If not freed, FW might fail open using the CID.
1329 if (beiscsi_conn_close(beiscsi_ep) < 0)
1330 __beiscsi_log(phba, KERN_ERR,
1331 "BS_%d : close conn failed cid %d\n",
1332 beiscsi_ep->ep_cid);
1335 beiscsi_free_ep(beiscsi_ep);
1336 if (!phba->conn_table[cri_index])
1337 __beiscsi_log(phba, KERN_ERR,
1338 "BS_%d : conn_table empty at %u: cid %u\n",
1339 cri_index, beiscsi_ep->ep_cid);
1340 phba->conn_table[cri_index] = NULL;
1341 iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
1344 umode_t beiscsi_attr_is_visible(int param_type, int param)
1346 switch (param_type) {
1347 case ISCSI_NET_PARAM:
1349 case ISCSI_NET_PARAM_IFACE_ENABLE:
1350 case ISCSI_NET_PARAM_IPV4_ADDR:
1351 case ISCSI_NET_PARAM_IPV4_SUBNET:
1352 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
1353 case ISCSI_NET_PARAM_IPV4_GW:
1354 case ISCSI_NET_PARAM_IPV6_ADDR:
1355 case ISCSI_NET_PARAM_VLAN_ID:
1356 case ISCSI_NET_PARAM_VLAN_PRIORITY:
1357 case ISCSI_NET_PARAM_VLAN_ENABLED:
1362 case ISCSI_HOST_PARAM:
1364 case ISCSI_HOST_PARAM_HWADDRESS:
1365 case ISCSI_HOST_PARAM_INITIATOR_NAME:
1366 case ISCSI_HOST_PARAM_PORT_STATE:
1367 case ISCSI_HOST_PARAM_PORT_SPEED:
1374 case ISCSI_PARAM_MAX_RECV_DLENGTH:
1375 case ISCSI_PARAM_MAX_XMIT_DLENGTH:
1376 case ISCSI_PARAM_HDRDGST_EN:
1377 case ISCSI_PARAM_DATADGST_EN:
1378 case ISCSI_PARAM_CONN_ADDRESS:
1379 case ISCSI_PARAM_CONN_PORT:
1380 case ISCSI_PARAM_EXP_STATSN:
1381 case ISCSI_PARAM_PERSISTENT_ADDRESS:
1382 case ISCSI_PARAM_PERSISTENT_PORT:
1383 case ISCSI_PARAM_PING_TMO:
1384 case ISCSI_PARAM_RECV_TMO:
1385 case ISCSI_PARAM_INITIAL_R2T_EN:
1386 case ISCSI_PARAM_MAX_R2T:
1387 case ISCSI_PARAM_IMM_DATA_EN:
1388 case ISCSI_PARAM_FIRST_BURST:
1389 case ISCSI_PARAM_MAX_BURST:
1390 case ISCSI_PARAM_PDU_INORDER_EN:
1391 case ISCSI_PARAM_DATASEQ_INORDER_EN:
1392 case ISCSI_PARAM_ERL:
1393 case ISCSI_PARAM_TARGET_NAME:
1394 case ISCSI_PARAM_TPGT:
1395 case ISCSI_PARAM_USERNAME:
1396 case ISCSI_PARAM_PASSWORD:
1397 case ISCSI_PARAM_USERNAME_IN:
1398 case ISCSI_PARAM_PASSWORD_IN:
1399 case ISCSI_PARAM_FAST_ABORT:
1400 case ISCSI_PARAM_ABORT_TMO:
1401 case ISCSI_PARAM_LU_RESET_TMO:
1402 case ISCSI_PARAM_IFACE_NAME:
1403 case ISCSI_PARAM_INITIATOR_NAME: