aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_iscsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/be2iscsi/be_iscsi.c')
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c355
1 files changed, 255 insertions, 100 deletions
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 43f35034585d..aedb0d9a9dae 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -50,21 +50,27 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
50 struct beiscsi_session *beiscsi_sess; 50 struct beiscsi_session *beiscsi_sess;
51 struct beiscsi_io_task *io_task; 51 struct beiscsi_io_task *io_task;
52 52
53 SE_DEBUG(DBG_LVL_8, "In beiscsi_session_create\n");
54 53
55 if (!ep) { 54 if (!ep) {
56 SE_DEBUG(DBG_LVL_1, "beiscsi_session_create: invalid ep\n"); 55 printk(KERN_ERR
56 "beiscsi_session_create: invalid ep\n");
57 return NULL; 57 return NULL;
58 } 58 }
59 beiscsi_ep = ep->dd_data; 59 beiscsi_ep = ep->dd_data;
60 phba = beiscsi_ep->phba; 60 phba = beiscsi_ep->phba;
61 shost = phba->shost; 61 shost = phba->shost;
62
63 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
64 "BS_%d : In beiscsi_session_create\n");
65
62 if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) { 66 if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) {
63 shost_printk(KERN_ERR, shost, "Cannot handle %d cmds." 67 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
64 "Max cmds per session supported is %d. Using %d. " 68 "BS_%d : Cannot handle %d cmds."
65 "\n", cmds_max, 69 "Max cmds per session supported is %d. Using %d."
66 beiscsi_ep->phba->params.wrbs_per_cxn, 70 "\n", cmds_max,
67 beiscsi_ep->phba->params.wrbs_per_cxn); 71 beiscsi_ep->phba->params.wrbs_per_cxn,
72 beiscsi_ep->phba->params.wrbs_per_cxn);
73
68 cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn; 74 cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn;
69 } 75 }
70 76
@@ -102,7 +108,7 @@ void beiscsi_session_destroy(struct iscsi_cls_session *cls_session)
102 struct iscsi_session *sess = cls_session->dd_data; 108 struct iscsi_session *sess = cls_session->dd_data;
103 struct beiscsi_session *beiscsi_sess = sess->dd_data; 109 struct beiscsi_session *beiscsi_sess = sess->dd_data;
104 110
105 SE_DEBUG(DBG_LVL_8, "In beiscsi_session_destroy\n"); 111 printk(KERN_INFO "In beiscsi_session_destroy\n");
106 pci_pool_destroy(beiscsi_sess->bhs_pool); 112 pci_pool_destroy(beiscsi_sess->bhs_pool);
107 iscsi_session_teardown(cls_session); 113 iscsi_session_teardown(cls_session);
108} 114}
@@ -123,11 +129,13 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
123 struct iscsi_session *sess; 129 struct iscsi_session *sess;
124 struct beiscsi_session *beiscsi_sess; 130 struct beiscsi_session *beiscsi_sess;
125 131
126 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create ,cid"
127 "from iscsi layer=%d\n", cid);
128 shost = iscsi_session_to_shost(cls_session); 132 shost = iscsi_session_to_shost(cls_session);
129 phba = iscsi_host_priv(shost); 133 phba = iscsi_host_priv(shost);
130 134
135 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
136 "BS_%d : In beiscsi_conn_create ,cid"
137 "from iscsi layer=%d\n", cid);
138
131 cls_conn = iscsi_conn_setup(cls_session, sizeof(*beiscsi_conn), cid); 139 cls_conn = iscsi_conn_setup(cls_session, sizeof(*beiscsi_conn), cid);
132 if (!cls_conn) 140 if (!cls_conn)
133 return NULL; 141 return NULL;
@@ -154,12 +162,15 @@ static int beiscsi_bindconn_cid(struct beiscsi_hba *phba,
154 unsigned int cid) 162 unsigned int cid)
155{ 163{
156 if (phba->conn_table[cid]) { 164 if (phba->conn_table[cid]) {
157 SE_DEBUG(DBG_LVL_1, 165 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
158 "Connection table already occupied. Detected clash\n"); 166 "BS_%d : Connection table already occupied. Detected clash\n");
167
159 return -EINVAL; 168 return -EINVAL;
160 } else { 169 } else {
161 SE_DEBUG(DBG_LVL_8, "phba->conn_table[%d]=%p(beiscsi_conn)\n", 170 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
162 cid, beiscsi_conn); 171 "BS_%d : phba->conn_table[%d]=%p(beiscsi_conn)\n",
172 cid, beiscsi_conn);
173
163 phba->conn_table[cid] = beiscsi_conn; 174 phba->conn_table[cid] = beiscsi_conn;
164 } 175 }
165 return 0; 176 return 0;
@@ -184,7 +195,6 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
184 struct beiscsi_endpoint *beiscsi_ep; 195 struct beiscsi_endpoint *beiscsi_ep;
185 struct iscsi_endpoint *ep; 196 struct iscsi_endpoint *ep;
186 197
187 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_bind\n");
188 ep = iscsi_lookup_endpoint(transport_fd); 198 ep = iscsi_lookup_endpoint(transport_fd);
189 if (!ep) 199 if (!ep)
190 return -EINVAL; 200 return -EINVAL;
@@ -195,17 +205,21 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
195 return -EINVAL; 205 return -EINVAL;
196 206
197 if (beiscsi_ep->phba != phba) { 207 if (beiscsi_ep->phba != phba) {
198 SE_DEBUG(DBG_LVL_8, 208 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
199 "beiscsi_ep->hba=%p not equal to phba=%p\n", 209 "BS_%d : beiscsi_ep->hba=%p not equal to phba=%p\n",
200 beiscsi_ep->phba, phba); 210 beiscsi_ep->phba, phba);
211
201 return -EEXIST; 212 return -EEXIST;
202 } 213 }
203 214
204 beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid; 215 beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid;
205 beiscsi_conn->ep = beiscsi_ep; 216 beiscsi_conn->ep = beiscsi_ep;
206 beiscsi_ep->conn = beiscsi_conn; 217 beiscsi_ep->conn = beiscsi_conn;
207 SE_DEBUG(DBG_LVL_8, "beiscsi_conn=%p conn=%p ep_cid=%d\n", 218
208 beiscsi_conn, conn, beiscsi_ep->ep_cid); 219 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
220 "BS_%d : beiscsi_conn=%p conn=%p ep_cid=%d\n",
221 beiscsi_conn, conn, beiscsi_ep->ep_cid);
222
209 return beiscsi_bindconn_cid(phba, beiscsi_conn, beiscsi_ep->ep_cid); 223 return beiscsi_bindconn_cid(phba, beiscsi_conn, beiscsi_ep->ep_cid);
210} 224}
211 225
@@ -219,8 +233,9 @@ static int beiscsi_create_ipv4_iface(struct beiscsi_hba *phba)
219 ISCSI_IFACE_TYPE_IPV4, 233 ISCSI_IFACE_TYPE_IPV4,
220 0, 0); 234 0, 0);
221 if (!phba->ipv4_iface) { 235 if (!phba->ipv4_iface) {
222 shost_printk(KERN_ERR, phba->shost, "Could not " 236 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
223 "create default IPv4 address.\n"); 237 "BS_%d : Could not "
238 "create default IPv4 address.\n");
224 return -ENODEV; 239 return -ENODEV;
225 } 240 }
226 241
@@ -237,8 +252,9 @@ static int beiscsi_create_ipv6_iface(struct beiscsi_hba *phba)
237 ISCSI_IFACE_TYPE_IPV6, 252 ISCSI_IFACE_TYPE_IPV6,
238 0, 0); 253 0, 0);
239 if (!phba->ipv6_iface) { 254 if (!phba->ipv6_iface) {
240 shost_printk(KERN_ERR, phba->shost, "Could not " 255 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
241 "create default IPv6 address.\n"); 256 "BS_%d : Could not "
257 "create default IPv6 address.\n");
242 return -ENODEV; 258 return -ENODEV;
243 } 259 }
244 260
@@ -299,12 +315,14 @@ beiscsi_set_static_ip(struct Scsi_Host *shost,
299 iface_ip = nla_data(nla); 315 iface_ip = nla_data(nla);
300 break; 316 break;
301 default: 317 default:
302 shost_printk(KERN_ERR, shost, "Unsupported param %d\n", 318 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
303 iface_param->param); 319 "BS_%d : Unsupported param %d\n",
320 iface_param->param);
304 } 321 }
305 322
306 if (!iface_ip || !iface_subnet) { 323 if (!iface_ip || !iface_subnet) {
307 shost_printk(KERN_ERR, shost, "IP and Subnet Mask required\n"); 324 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
325 "BS_%d : IP and Subnet Mask required\n");
308 return -EINVAL; 326 return -EINVAL;
309 } 327 }
310 328
@@ -314,6 +332,51 @@ beiscsi_set_static_ip(struct Scsi_Host *shost,
314 return ret; 332 return ret;
315} 333}
316 334
335/**
336 * beiscsi_set_vlan_tag()- Set the VLAN TAG
337 * @shost: Scsi Host for the driver instance
338 * @iface_param: Interface paramters
339 *
340 * Set the VLAN TAG for the adapter or disable
341 * the VLAN config
342 *
343 * returns
344 * Success: 0
345 * Failure: Non-Zero Value
346 **/
347static int
348beiscsi_set_vlan_tag(struct Scsi_Host *shost,
349 struct iscsi_iface_param_info *iface_param)
350{
351 struct beiscsi_hba *phba = iscsi_host_priv(shost);
352 int ret = 0;
353
354 /* Get the Interface Handle */
355 if (mgmt_get_all_if_id(phba)) {
356 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
357 "BS_%d : Getting Interface Handle Failed\n");
358 return -EIO;
359 }
360
361 switch (iface_param->param) {
362 case ISCSI_NET_PARAM_VLAN_ENABLED:
363 if (iface_param->value[0] != ISCSI_VLAN_ENABLE)
364 ret = mgmt_set_vlan(phba, BEISCSI_VLAN_DISABLE);
365 break;
366 case ISCSI_NET_PARAM_VLAN_TAG:
367 ret = mgmt_set_vlan(phba,
368 *((uint16_t *)iface_param->value));
369 break;
370 default:
371 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
372 "BS_%d : Unkown Param Type : %d\n",
373 iface_param->param);
374 return -ENOSYS;
375 }
376 return ret;
377}
378
379
317static int 380static int
318beiscsi_set_ipv4(struct Scsi_Host *shost, 381beiscsi_set_ipv4(struct Scsi_Host *shost,
319 struct iscsi_iface_param_info *iface_param, 382 struct iscsi_iface_param_info *iface_param,
@@ -335,8 +398,9 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
335 ret = beiscsi_set_static_ip(shost, iface_param, 398 ret = beiscsi_set_static_ip(shost, iface_param,
336 data, dt_len); 399 data, dt_len);
337 else 400 else
338 shost_printk(KERN_ERR, shost, "Invalid BOOTPROTO: %d\n", 401 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
339 iface_param->value[0]); 402 "BS_%d : Invalid BOOTPROTO: %d\n",
403 iface_param->value[0]);
340 break; 404 break;
341 case ISCSI_NET_PARAM_IFACE_ENABLE: 405 case ISCSI_NET_PARAM_IFACE_ENABLE:
342 if (iface_param->value[0] == ISCSI_IFACE_ENABLE) 406 if (iface_param->value[0] == ISCSI_IFACE_ENABLE)
@@ -349,9 +413,14 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
349 ret = beiscsi_set_static_ip(shost, iface_param, 413 ret = beiscsi_set_static_ip(shost, iface_param,
350 data, dt_len); 414 data, dt_len);
351 break; 415 break;
416 case ISCSI_NET_PARAM_VLAN_ENABLED:
417 case ISCSI_NET_PARAM_VLAN_TAG:
418 ret = beiscsi_set_vlan_tag(shost, iface_param);
419 break;
352 default: 420 default:
353 shost_printk(KERN_ERR, shost, "Param %d not supported\n", 421 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
354 iface_param->param); 422 "BS_%d : Param %d not supported\n",
423 iface_param->param);
355 } 424 }
356 425
357 return ret; 426 return ret;
@@ -379,8 +448,9 @@ beiscsi_set_ipv6(struct Scsi_Host *shost,
379 ISCSI_BOOTPROTO_STATIC); 448 ISCSI_BOOTPROTO_STATIC);
380 break; 449 break;
381 default: 450 default:
382 shost_printk(KERN_ERR, shost, "Param %d not supported\n", 451 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
383 iface_param->param); 452 "BS_%d : Param %d not supported\n",
453 iface_param->param);
384 } 454 }
385 455
386 return ret; 456 return ret;
@@ -390,6 +460,7 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
390 void *data, uint32_t dt_len) 460 void *data, uint32_t dt_len)
391{ 461{
392 struct iscsi_iface_param_info *iface_param = NULL; 462 struct iscsi_iface_param_info *iface_param = NULL;
463 struct beiscsi_hba *phba = iscsi_host_priv(shost);
393 struct nlattr *attrib; 464 struct nlattr *attrib;
394 uint32_t rm_len = dt_len; 465 uint32_t rm_len = dt_len;
395 int ret = 0 ; 466 int ret = 0 ;
@@ -404,9 +475,11 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
404 * BE2ISCSI only supports 1 interface 475 * BE2ISCSI only supports 1 interface
405 */ 476 */
406 if (iface_param->iface_num) { 477 if (iface_param->iface_num) {
407 shost_printk(KERN_ERR, shost, "Invalid iface_num %d." 478 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
408 "Only iface_num 0 is supported.\n", 479 "BS_%d : Invalid iface_num %d."
409 iface_param->iface_num); 480 "Only iface_num 0 is supported.\n",
481 iface_param->iface_num);
482
410 return -EINVAL; 483 return -EINVAL;
411 } 484 }
412 485
@@ -420,9 +493,9 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
420 data, dt_len); 493 data, dt_len);
421 break; 494 break;
422 default: 495 default:
423 shost_printk(KERN_ERR, shost, 496 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
424 "Invalid iface type :%d passed\n", 497 "BS_%d : Invalid iface type :%d passed\n",
425 iface_param->iface_type); 498 iface_param->iface_type);
426 break; 499 break;
427 } 500 }
428 501
@@ -465,6 +538,27 @@ static int be2iscsi_get_if_param(struct beiscsi_hba *phba,
465 case ISCSI_NET_PARAM_IPV4_SUBNET: 538 case ISCSI_NET_PARAM_IPV4_SUBNET:
466 len = sprintf(buf, "%pI4\n", &if_info.ip_addr.subnet_mask); 539 len = sprintf(buf, "%pI4\n", &if_info.ip_addr.subnet_mask);
467 break; 540 break;
541 case ISCSI_NET_PARAM_VLAN_ENABLED:
542 len = sprintf(buf, "%s\n",
543 (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
544 ? "Disabled" : "Enabled");
545 break;
546 case ISCSI_NET_PARAM_VLAN_ID:
547 if (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
548 return -EINVAL;
549 else
550 len = sprintf(buf, "%d\n",
551 (if_info.vlan_priority &
552 ISCSI_MAX_VLAN_ID));
553 break;
554 case ISCSI_NET_PARAM_VLAN_PRIORITY:
555 if (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
556 return -EINVAL;
557 else
558 len = sprintf(buf, "%d\n",
559 ((if_info.vlan_priority >> 13) &
560 ISCSI_MAX_VLAN_PRIORITY));
561 break;
468 default: 562 default:
469 WARN_ON(1); 563 WARN_ON(1);
470 } 564 }
@@ -486,6 +580,9 @@ int be2iscsi_iface_get_param(struct iscsi_iface *iface,
486 case ISCSI_NET_PARAM_IPV4_SUBNET: 580 case ISCSI_NET_PARAM_IPV4_SUBNET:
487 case ISCSI_NET_PARAM_IPV4_BOOTPROTO: 581 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
488 case ISCSI_NET_PARAM_IPV6_ADDR: 582 case ISCSI_NET_PARAM_IPV6_ADDR:
583 case ISCSI_NET_PARAM_VLAN_ENABLED:
584 case ISCSI_NET_PARAM_VLAN_ID:
585 case ISCSI_NET_PARAM_VLAN_PRIORITY:
489 len = be2iscsi_get_if_param(phba, iface, param, buf); 586 len = be2iscsi_get_if_param(phba, iface, param, buf);
490 break; 587 break;
491 case ISCSI_NET_PARAM_IFACE_ENABLE: 588 case ISCSI_NET_PARAM_IFACE_ENABLE:
@@ -518,7 +615,10 @@ int beiscsi_ep_get_param(struct iscsi_endpoint *ep,
518 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 615 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
519 int len = 0; 616 int len = 0;
520 617
521 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_get_param, param= %d\n", param); 618 beiscsi_log(beiscsi_ep->phba, KERN_INFO,
619 BEISCSI_LOG_CONFIG,
620 "BS_%d : In beiscsi_ep_get_param,"
621 " param= %d\n", param);
522 622
523 switch (param) { 623 switch (param) {
524 case ISCSI_PARAM_CONN_PORT: 624 case ISCSI_PARAM_CONN_PORT:
@@ -541,9 +641,14 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
541{ 641{
542 struct iscsi_conn *conn = cls_conn->dd_data; 642 struct iscsi_conn *conn = cls_conn->dd_data;
543 struct iscsi_session *session = conn->session; 643 struct iscsi_session *session = conn->session;
644 struct beiscsi_hba *phba = NULL;
544 int ret; 645 int ret;
545 646
546 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_set_param, param= %d\n", param); 647 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
648 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
649 "BS_%d : In beiscsi_conn_set_param,"
650 " param= %d\n", param);
651
547 ret = iscsi_set_param(cls_conn, param, buf, buflen); 652 ret = iscsi_set_param(cls_conn, param, buf, buflen);
548 if (ret) 653 if (ret)
549 return ret; 654 return ret;
@@ -593,7 +698,9 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
593 698
594 tag = be_cmd_get_initname(phba); 699 tag = be_cmd_get_initname(phba);
595 if (!tag) { 700 if (!tag) {
596 SE_DEBUG(DBG_LVL_1, "Getting Initiator Name Failed\n"); 701 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
702 "BS_%d : Getting Initiator Name Failed\n");
703
597 return -EBUSY; 704 return -EBUSY;
598 } else 705 } else
599 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 706 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -604,9 +711,12 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
604 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 711 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
605 712
606 if (status || extd_status) { 713 if (status || extd_status) {
607 SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with " 714 beiscsi_log(phba, KERN_ERR,
608 "status = %d extd_status = %d\n", 715 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
609 status, extd_status); 716 "BS_%d : MailBox Command Failed with "
717 "status = %d extd_status = %d\n",
718 status, extd_status);
719
610 free_mcc_tag(&phba->ctrl, tag); 720 free_mcc_tag(&phba->ctrl, tag);
611 return -EAGAIN; 721 return -EAGAIN;
612 } 722 }
@@ -650,7 +760,9 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
650 760
651 tag = be_cmd_get_port_speed(phba); 761 tag = be_cmd_get_port_speed(phba);
652 if (!tag) { 762 if (!tag) {
653 SE_DEBUG(DBG_LVL_1, "Getting Port Speed Failed\n"); 763 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
764 "BS_%d : Getting Port Speed Failed\n");
765
654 return -EBUSY; 766 return -EBUSY;
655 } else 767 } else
656 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 768 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -661,9 +773,12 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
661 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 773 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
662 774
663 if (status || extd_status) { 775 if (status || extd_status) {
664 SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with " 776 beiscsi_log(phba, KERN_ERR,
665 "status = %d extd_status = %d\n", 777 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
666 status, extd_status); 778 "BS_%d : MailBox Command Failed with "
779 "status = %d extd_status = %d\n",
780 status, extd_status);
781
667 free_mcc_tag(&phba->ctrl, tag); 782 free_mcc_tag(&phba->ctrl, tag);
668 return -EAGAIN; 783 return -EAGAIN;
669 } 784 }
@@ -704,20 +819,24 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
704 struct beiscsi_hba *phba = iscsi_host_priv(shost); 819 struct beiscsi_hba *phba = iscsi_host_priv(shost);
705 int status = 0; 820 int status = 0;
706 821
707 SE_DEBUG(DBG_LVL_8, "In beiscsi_get_host_param, param= %d\n", param); 822 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
823 "BS_%d : In beiscsi_get_host_param,"
824 " param= %d\n", param);
825
708 switch (param) { 826 switch (param) {
709 case ISCSI_HOST_PARAM_HWADDRESS: 827 case ISCSI_HOST_PARAM_HWADDRESS:
710 status = beiscsi_get_macaddr(buf, phba); 828 status = beiscsi_get_macaddr(buf, phba);
711 if (status < 0) { 829 if (status < 0) {
712 SE_DEBUG(DBG_LVL_1, "beiscsi_get_macaddr Failed\n"); 830 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
831 "BS_%d : beiscsi_get_macaddr Failed\n");
713 return status; 832 return status;
714 } 833 }
715 break; 834 break;
716 case ISCSI_HOST_PARAM_INITIATOR_NAME: 835 case ISCSI_HOST_PARAM_INITIATOR_NAME:
717 status = beiscsi_get_initname(buf, phba); 836 status = beiscsi_get_initname(buf, phba);
718 if (status < 0) { 837 if (status < 0) {
719 SE_DEBUG(DBG_LVL_1, 838 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
720 "Retreiving Initiator Name Failed\n"); 839 "BS_%d : Retreiving Initiator Name Failed\n");
721 return status; 840 return status;
722 } 841 }
723 break; 842 break;
@@ -728,8 +847,8 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
728 case ISCSI_HOST_PARAM_PORT_SPEED: 847 case ISCSI_HOST_PARAM_PORT_SPEED:
729 status = beiscsi_get_port_speed(shost); 848 status = beiscsi_get_port_speed(shost);
730 if (status) { 849 if (status) {
731 SE_DEBUG(DBG_LVL_1, 850 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
732 "Retreiving Port Speed Failed\n"); 851 "BS_%d : Retreiving Port Speed Failed\n");
733 return status; 852 return status;
734 } 853 }
735 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost)); 854 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost));
@@ -746,7 +865,7 @@ int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba)
746 int rc; 865 int rc;
747 866
748 if (strlen(phba->mac_address)) 867 if (strlen(phba->mac_address))
749 return strlcpy(buf, phba->mac_address, PAGE_SIZE); 868 return sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
750 869
751 memset(&resp, 0, sizeof(resp)); 870 memset(&resp, 0, sizeof(resp));
752 rc = mgmt_get_nic_conf(phba, &resp); 871 rc = mgmt_get_nic_conf(phba, &resp);
@@ -768,8 +887,12 @@ void beiscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn,
768 struct iscsi_stats *stats) 887 struct iscsi_stats *stats)
769{ 888{
770 struct iscsi_conn *conn = cls_conn->dd_data; 889 struct iscsi_conn *conn = cls_conn->dd_data;
890 struct beiscsi_hba *phba = NULL;
891
892 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
893 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
894 "BS_%d : In beiscsi_conn_get_stats\n");
771 895
772 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_get_stats\n");
773 stats->txdata_octets = conn->txdata_octets; 896 stats->txdata_octets = conn->txdata_octets;
774 stats->rxdata_octets = conn->rxdata_octets; 897 stats->rxdata_octets = conn->rxdata_octets;
775 stats->dataout_pdus = conn->dataout_pdus_cnt; 898 stats->dataout_pdus = conn->dataout_pdus_cnt;
@@ -829,11 +952,16 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
829 struct beiscsi_endpoint *beiscsi_ep; 952 struct beiscsi_endpoint *beiscsi_ep;
830 struct beiscsi_offload_params params; 953 struct beiscsi_offload_params params;
831 954
832 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_start\n"); 955 beiscsi_log(beiscsi_conn->phba, KERN_INFO,
956 BEISCSI_LOG_CONFIG,
957 "BS_%d : In beiscsi_conn_start\n");
958
833 memset(&params, 0, sizeof(struct beiscsi_offload_params)); 959 memset(&params, 0, sizeof(struct beiscsi_offload_params));
834 beiscsi_ep = beiscsi_conn->ep; 960 beiscsi_ep = beiscsi_conn->ep;
835 if (!beiscsi_ep) 961 if (!beiscsi_ep)
836 SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start , no beiscsi_ep\n"); 962 beiscsi_log(beiscsi_conn->phba, KERN_ERR,
963 BEISCSI_LOG_CONFIG,
964 "BS_%d : In beiscsi_conn_start , no beiscsi_ep\n");
837 965
838 beiscsi_conn->login_in_progress = 0; 966 beiscsi_conn->login_in_progress = 0;
839 beiscsi_set_params_for_offld(beiscsi_conn, &params); 967 beiscsi_set_params_for_offld(beiscsi_conn, &params);
@@ -907,19 +1035,27 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
907 unsigned int tag, wrb_num; 1035 unsigned int tag, wrb_num;
908 int ret = -ENOMEM; 1036 int ret = -ENOMEM;
909 1037
910 SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn\n"); 1038 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1039 "BS_%d : In beiscsi_open_conn\n");
1040
911 beiscsi_ep->ep_cid = beiscsi_get_cid(phba); 1041 beiscsi_ep->ep_cid = beiscsi_get_cid(phba);
912 if (beiscsi_ep->ep_cid == 0xFFFF) { 1042 if (beiscsi_ep->ep_cid == 0xFFFF) {
913 SE_DEBUG(DBG_LVL_1, "No free cid available\n"); 1043 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1044 "BS_%d : No free cid available\n");
914 return ret; 1045 return ret;
915 } 1046 }
916 SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn, ep_cid=%d\n", 1047
917 beiscsi_ep->ep_cid); 1048 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1049 "BS_%d : In beiscsi_open_conn, ep_cid=%d\n",
1050 beiscsi_ep->ep_cid);
1051
918 phba->ep_array[beiscsi_ep->ep_cid - 1052 phba->ep_array[beiscsi_ep->ep_cid -
919 phba->fw_config.iscsi_cid_start] = ep; 1053 phba->fw_config.iscsi_cid_start] = ep;
920 if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start + 1054 if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start +
921 phba->params.cxns_per_ctrl * 2)) { 1055 phba->params.cxns_per_ctrl * 2)) {
922 SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n"); 1056
1057 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1058 "BS_%d : Failed in allocate iscsi cid\n");
923 goto free_ep; 1059 goto free_ep;
924 } 1060 }
925 1061
@@ -928,9 +1064,11 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
928 sizeof(struct tcp_connect_and_offload_in), 1064 sizeof(struct tcp_connect_and_offload_in),
929 &nonemb_cmd.dma); 1065 &nonemb_cmd.dma);
930 if (nonemb_cmd.va == NULL) { 1066 if (nonemb_cmd.va == NULL) {
931 SE_DEBUG(DBG_LVL_1, 1067
932 "Failed to allocate memory for mgmt_open_connection" 1068 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
933 "\n"); 1069 "BS_%d : Failed to allocate memory for"
1070 " mgmt_open_connection\n");
1071
934 beiscsi_put_cid(phba, beiscsi_ep->ep_cid); 1072 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
935 return -ENOMEM; 1073 return -ENOMEM;
936 } 1074 }
@@ -938,9 +1076,10 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
938 memset(nonemb_cmd.va, 0, nonemb_cmd.size); 1076 memset(nonemb_cmd.va, 0, nonemb_cmd.size);
939 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd); 1077 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
940 if (!tag) { 1078 if (!tag) {
941 SE_DEBUG(DBG_LVL_1, 1079 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
942 "mgmt_open_connection Failed for cid=%d\n", 1080 "BS_%d : mgmt_open_connection Failed for cid=%d\n",
943 beiscsi_ep->ep_cid); 1081 beiscsi_ep->ep_cid);
1082
944 beiscsi_put_cid(phba, beiscsi_ep->ep_cid); 1083 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
945 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1084 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
946 nonemb_cmd.va, nonemb_cmd.dma); 1085 nonemb_cmd.va, nonemb_cmd.dma);
@@ -953,9 +1092,12 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
953 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 1092 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
954 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 1093 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
955 if (status || extd_status) { 1094 if (status || extd_status) {
956 SE_DEBUG(DBG_LVL_1, "mgmt_open_connection Failed" 1095 beiscsi_log(phba, KERN_ERR,
957 " status = %d extd_status = %d\n", 1096 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
958 status, extd_status); 1097 "BS_%d : mgmt_open_connection Failed"
1098 " status = %d extd_status = %d\n",
1099 status, extd_status);
1100
959 free_mcc_tag(&phba->ctrl, tag); 1101 free_mcc_tag(&phba->ctrl, tag);
960 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1102 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
961 nonemb_cmd.va, nonemb_cmd.dma); 1103 nonemb_cmd.va, nonemb_cmd.dma);
@@ -968,7 +1110,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
968 beiscsi_ep = ep->dd_data; 1110 beiscsi_ep = ep->dd_data;
969 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle; 1111 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
970 beiscsi_ep->cid_vld = 1; 1112 beiscsi_ep->cid_vld = 1;
971 SE_DEBUG(DBG_LVL_8, "mgmt_open_connection Success\n"); 1113 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1114 "BS_%d : mgmt_open_connection Success\n");
972 } 1115 }
973 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1116 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
974 nonemb_cmd.va, nonemb_cmd.dma); 1117 nonemb_cmd.va, nonemb_cmd.dma);
@@ -996,18 +1139,19 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
996 struct iscsi_endpoint *ep; 1139 struct iscsi_endpoint *ep;
997 int ret; 1140 int ret;
998 1141
999 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_connect\n");
1000 if (shost) 1142 if (shost)
1001 phba = iscsi_host_priv(shost); 1143 phba = iscsi_host_priv(shost);
1002 else { 1144 else {
1003 ret = -ENXIO; 1145 ret = -ENXIO;
1004 SE_DEBUG(DBG_LVL_1, "shost is NULL\n"); 1146 printk(KERN_ERR
1147 "beiscsi_ep_connect shost is NULL\n");
1005 return ERR_PTR(ret); 1148 return ERR_PTR(ret);
1006 } 1149 }
1007 1150
1008 if (phba->state != BE_ADAPTER_UP) { 1151 if (phba->state != BE_ADAPTER_UP) {
1009 ret = -EBUSY; 1152 ret = -EBUSY;
1010 SE_DEBUG(DBG_LVL_1, "The Adapter state is Not UP\n"); 1153 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1154 "BS_%d : The Adapter state is Not UP\n");
1011 return ERR_PTR(ret); 1155 return ERR_PTR(ret);
1012 } 1156 }
1013 1157
@@ -1022,7 +1166,8 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
1022 beiscsi_ep->openiscsi_ep = ep; 1166 beiscsi_ep->openiscsi_ep = ep;
1023 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking); 1167 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking);
1024 if (ret) { 1168 if (ret) {
1025 SE_DEBUG(DBG_LVL_1, "Failed in beiscsi_open_conn\n"); 1169 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1170 "BS_%d : Failed in beiscsi_open_conn\n");
1026 goto free_ep; 1171 goto free_ep;
1027 } 1172 }
1028 1173
@@ -1044,7 +1189,9 @@ int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
1044{ 1189{
1045 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 1190 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1046 1191
1047 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_poll\n"); 1192 beiscsi_log(beiscsi_ep->phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1193 "BS_%d : In beiscsi_ep_poll\n");
1194
1048 if (beiscsi_ep->cid_vld == 1) 1195 if (beiscsi_ep->cid_vld == 1)
1049 return 1; 1196 return 1;
1050 else 1197 else
@@ -1064,8 +1211,10 @@ static int beiscsi_close_conn(struct beiscsi_endpoint *beiscsi_ep, int flag)
1064 1211
1065 tag = mgmt_upload_connection(phba, beiscsi_ep->ep_cid, flag); 1212 tag = mgmt_upload_connection(phba, beiscsi_ep->ep_cid, flag);
1066 if (!tag) { 1213 if (!tag) {
1067 SE_DEBUG(DBG_LVL_8, "upload failed for cid 0x%x\n", 1214 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1068 beiscsi_ep->ep_cid); 1215 "BS_%d : upload failed for cid 0x%x\n",
1216 beiscsi_ep->ep_cid);
1217
1069 ret = -EAGAIN; 1218 ret = -EAGAIN;
1070 } else { 1219 } else {
1071 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1220 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -1086,7 +1235,8 @@ static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba,
1086 if (phba->conn_table[cid]) 1235 if (phba->conn_table[cid])
1087 phba->conn_table[cid] = NULL; 1236 phba->conn_table[cid] = NULL;
1088 else { 1237 else {
1089 SE_DEBUG(DBG_LVL_8, "Connection table Not occupied.\n"); 1238 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1239 "BS_%d : Connection table Not occupied.\n");
1090 return -EINVAL; 1240 return -EINVAL;
1091 } 1241 }
1092 return 0; 1242 return 0;
@@ -1104,38 +1254,40 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
1104 struct beiscsi_endpoint *beiscsi_ep; 1254 struct beiscsi_endpoint *beiscsi_ep;
1105 struct beiscsi_hba *phba; 1255 struct beiscsi_hba *phba;
1106 unsigned int tag; 1256 unsigned int tag;
1257 uint8_t mgmt_invalidate_flag, tcp_upload_flag;
1107 unsigned short savecfg_flag = CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH; 1258 unsigned short savecfg_flag = CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH;
1108 1259
1109 beiscsi_ep = ep->dd_data; 1260 beiscsi_ep = ep->dd_data;
1110 phba = beiscsi_ep->phba; 1261 phba = beiscsi_ep->phba;
1111 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect for ep_cid = %d\n", 1262 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1112 beiscsi_ep->ep_cid); 1263 "BS_%d : In beiscsi_ep_disconnect for ep_cid = %d\n",
1113 1264 beiscsi_ep->ep_cid);
1114 if (!beiscsi_ep->conn) { 1265
1115 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect, no " 1266 if (beiscsi_ep->conn) {
1116 "beiscsi_ep\n"); 1267 beiscsi_conn = beiscsi_ep->conn;
1117 return; 1268 iscsi_suspend_queue(beiscsi_conn->conn);
1269 mgmt_invalidate_flag = ~BEISCSI_NO_RST_ISSUE;
1270 tcp_upload_flag = CONNECTION_UPLOAD_GRACEFUL;
1271 } else {
1272 mgmt_invalidate_flag = BEISCSI_NO_RST_ISSUE;
1273 tcp_upload_flag = CONNECTION_UPLOAD_ABORT;
1118 } 1274 }
1119 beiscsi_conn = beiscsi_ep->conn;
1120 iscsi_suspend_queue(beiscsi_conn->conn);
1121
1122 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect ep_cid = %d\n",
1123 beiscsi_ep->ep_cid);
1124 1275
1125 tag = mgmt_invalidate_connection(phba, beiscsi_ep, 1276 tag = mgmt_invalidate_connection(phba, beiscsi_ep,
1126 beiscsi_ep->ep_cid, 1, 1277 beiscsi_ep->ep_cid,
1127 savecfg_flag); 1278 mgmt_invalidate_flag,
1279 savecfg_flag);
1128 if (!tag) { 1280 if (!tag) {
1129 SE_DEBUG(DBG_LVL_1, 1281 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1130 "mgmt_invalidate_connection Failed for cid=%d\n", 1282 "BS_%d : mgmt_invalidate_connection Failed for cid=%d\n",
1131 beiscsi_ep->ep_cid); 1283 beiscsi_ep->ep_cid);
1132 } else { 1284 } else {
1133 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1285 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
1134 phba->ctrl.mcc_numtag[tag]); 1286 phba->ctrl.mcc_numtag[tag]);
1135 free_mcc_tag(&phba->ctrl, tag); 1287 free_mcc_tag(&phba->ctrl, tag);
1136 } 1288 }
1137 1289
1138 beiscsi_close_conn(beiscsi_ep, CONNECTION_UPLOAD_GRACEFUL); 1290 beiscsi_close_conn(beiscsi_ep, tcp_upload_flag);
1139 beiscsi_free_ep(beiscsi_ep); 1291 beiscsi_free_ep(beiscsi_ep);
1140 beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid); 1292 beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid);
1141 iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep); 1293 iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
@@ -1152,6 +1304,9 @@ umode_t be2iscsi_attr_is_visible(int param_type, int param)
1152 case ISCSI_NET_PARAM_IPV4_BOOTPROTO: 1304 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
1153 case ISCSI_NET_PARAM_IPV4_GW: 1305 case ISCSI_NET_PARAM_IPV4_GW:
1154 case ISCSI_NET_PARAM_IPV6_ADDR: 1306 case ISCSI_NET_PARAM_IPV6_ADDR:
1307 case ISCSI_NET_PARAM_VLAN_ID:
1308 case ISCSI_NET_PARAM_VLAN_PRIORITY:
1309 case ISCSI_NET_PARAM_VLAN_ENABLED:
1155 return S_IRUGO; 1310 return S_IRUGO;
1156 default: 1311 default:
1157 return 0; 1312 return 0;