aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_iscsi.c
diff options
context:
space:
mode:
authorJohn Soni Jose <sony.john-n@emulex.com>2012-08-20 13:30:18 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 12:59:27 -0400
commit99bc5d55c06cbf9ac2d8ab7fb8348c4abce5fbaf (patch)
treefbee8df63f7a62916e93fcbae5f3e0cc9d103735 /drivers/scsi/be2iscsi/be_iscsi.c
parent9aef4200ee25636edd77b022f996b6f5870ce567 (diff)
[SCSI] be2iscsi: Added Logging mechanism for the driver.
Added new log level mechanism for different events. These log levels can be set at driver load time/run time. The log level is set for each Scsi_host. Fixed few multi-line print warning to get over the new checkpatch.pl warnings on multi-line strings. Signed-off-by: John Soni Jose <sony.john-n@emulex.com> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_iscsi.c')
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c261
1 files changed, 171 insertions, 90 deletions
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 43f35034585d..41b1fb70dd3b 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
@@ -335,8 +353,9 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
335 ret = beiscsi_set_static_ip(shost, iface_param, 353 ret = beiscsi_set_static_ip(shost, iface_param,
336 data, dt_len); 354 data, dt_len);
337 else 355 else
338 shost_printk(KERN_ERR, shost, "Invalid BOOTPROTO: %d\n", 356 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
339 iface_param->value[0]); 357 "BS_%d : Invalid BOOTPROTO: %d\n",
358 iface_param->value[0]);
340 break; 359 break;
341 case ISCSI_NET_PARAM_IFACE_ENABLE: 360 case ISCSI_NET_PARAM_IFACE_ENABLE:
342 if (iface_param->value[0] == ISCSI_IFACE_ENABLE) 361 if (iface_param->value[0] == ISCSI_IFACE_ENABLE)
@@ -350,8 +369,9 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
350 data, dt_len); 369 data, dt_len);
351 break; 370 break;
352 default: 371 default:
353 shost_printk(KERN_ERR, shost, "Param %d not supported\n", 372 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
354 iface_param->param); 373 "BS_%d : Param %d not supported\n",
374 iface_param->param);
355 } 375 }
356 376
357 return ret; 377 return ret;
@@ -379,8 +399,9 @@ beiscsi_set_ipv6(struct Scsi_Host *shost,
379 ISCSI_BOOTPROTO_STATIC); 399 ISCSI_BOOTPROTO_STATIC);
380 break; 400 break;
381 default: 401 default:
382 shost_printk(KERN_ERR, shost, "Param %d not supported\n", 402 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
383 iface_param->param); 403 "BS_%d : Param %d not supported\n",
404 iface_param->param);
384 } 405 }
385 406
386 return ret; 407 return ret;
@@ -390,6 +411,7 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
390 void *data, uint32_t dt_len) 411 void *data, uint32_t dt_len)
391{ 412{
392 struct iscsi_iface_param_info *iface_param = NULL; 413 struct iscsi_iface_param_info *iface_param = NULL;
414 struct beiscsi_hba *phba = iscsi_host_priv(shost);
393 struct nlattr *attrib; 415 struct nlattr *attrib;
394 uint32_t rm_len = dt_len; 416 uint32_t rm_len = dt_len;
395 int ret = 0 ; 417 int ret = 0 ;
@@ -404,9 +426,11 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
404 * BE2ISCSI only supports 1 interface 426 * BE2ISCSI only supports 1 interface
405 */ 427 */
406 if (iface_param->iface_num) { 428 if (iface_param->iface_num) {
407 shost_printk(KERN_ERR, shost, "Invalid iface_num %d." 429 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
408 "Only iface_num 0 is supported.\n", 430 "BS_%d : Invalid iface_num %d."
409 iface_param->iface_num); 431 "Only iface_num 0 is supported.\n",
432 iface_param->iface_num);
433
410 return -EINVAL; 434 return -EINVAL;
411 } 435 }
412 436
@@ -420,9 +444,9 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
420 data, dt_len); 444 data, dt_len);
421 break; 445 break;
422 default: 446 default:
423 shost_printk(KERN_ERR, shost, 447 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
424 "Invalid iface type :%d passed\n", 448 "BS_%d : Invalid iface type :%d passed\n",
425 iface_param->iface_type); 449 iface_param->iface_type);
426 break; 450 break;
427 } 451 }
428 452
@@ -518,7 +542,10 @@ int beiscsi_ep_get_param(struct iscsi_endpoint *ep,
518 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 542 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
519 int len = 0; 543 int len = 0;
520 544
521 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_get_param, param= %d\n", param); 545 beiscsi_log(beiscsi_ep->phba, KERN_INFO,
546 BEISCSI_LOG_CONFIG,
547 "BS_%d : In beiscsi_ep_get_param,"
548 " param= %d\n", param);
522 549
523 switch (param) { 550 switch (param) {
524 case ISCSI_PARAM_CONN_PORT: 551 case ISCSI_PARAM_CONN_PORT:
@@ -541,9 +568,14 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
541{ 568{
542 struct iscsi_conn *conn = cls_conn->dd_data; 569 struct iscsi_conn *conn = cls_conn->dd_data;
543 struct iscsi_session *session = conn->session; 570 struct iscsi_session *session = conn->session;
571 struct beiscsi_hba *phba = NULL;
544 int ret; 572 int ret;
545 573
546 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_set_param, param= %d\n", param); 574 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
575 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
576 "BS_%d : In beiscsi_conn_set_param,"
577 " param= %d\n", param);
578
547 ret = iscsi_set_param(cls_conn, param, buf, buflen); 579 ret = iscsi_set_param(cls_conn, param, buf, buflen);
548 if (ret) 580 if (ret)
549 return ret; 581 return ret;
@@ -593,7 +625,9 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
593 625
594 tag = be_cmd_get_initname(phba); 626 tag = be_cmd_get_initname(phba);
595 if (!tag) { 627 if (!tag) {
596 SE_DEBUG(DBG_LVL_1, "Getting Initiator Name Failed\n"); 628 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
629 "BS_%d : Getting Initiator Name Failed\n");
630
597 return -EBUSY; 631 return -EBUSY;
598 } else 632 } else
599 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 633 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -604,9 +638,12 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
604 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 638 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
605 639
606 if (status || extd_status) { 640 if (status || extd_status) {
607 SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with " 641 beiscsi_log(phba, KERN_ERR,
608 "status = %d extd_status = %d\n", 642 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
609 status, extd_status); 643 "BS_%d : MailBox Command Failed with "
644 "status = %d extd_status = %d\n",
645 status, extd_status);
646
610 free_mcc_tag(&phba->ctrl, tag); 647 free_mcc_tag(&phba->ctrl, tag);
611 return -EAGAIN; 648 return -EAGAIN;
612 } 649 }
@@ -650,7 +687,9 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
650 687
651 tag = be_cmd_get_port_speed(phba); 688 tag = be_cmd_get_port_speed(phba);
652 if (!tag) { 689 if (!tag) {
653 SE_DEBUG(DBG_LVL_1, "Getting Port Speed Failed\n"); 690 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
691 "BS_%d : Getting Port Speed Failed\n");
692
654 return -EBUSY; 693 return -EBUSY;
655 } else 694 } else
656 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 695 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -661,9 +700,12 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
661 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 700 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
662 701
663 if (status || extd_status) { 702 if (status || extd_status) {
664 SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with " 703 beiscsi_log(phba, KERN_ERR,
665 "status = %d extd_status = %d\n", 704 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
666 status, extd_status); 705 "BS_%d : MailBox Command Failed with "
706 "status = %d extd_status = %d\n",
707 status, extd_status);
708
667 free_mcc_tag(&phba->ctrl, tag); 709 free_mcc_tag(&phba->ctrl, tag);
668 return -EAGAIN; 710 return -EAGAIN;
669 } 711 }
@@ -704,20 +746,24 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
704 struct beiscsi_hba *phba = iscsi_host_priv(shost); 746 struct beiscsi_hba *phba = iscsi_host_priv(shost);
705 int status = 0; 747 int status = 0;
706 748
707 SE_DEBUG(DBG_LVL_8, "In beiscsi_get_host_param, param= %d\n", param); 749 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
750 "BS_%d : In beiscsi_get_host_param,"
751 " param= %d\n", param);
752
708 switch (param) { 753 switch (param) {
709 case ISCSI_HOST_PARAM_HWADDRESS: 754 case ISCSI_HOST_PARAM_HWADDRESS:
710 status = beiscsi_get_macaddr(buf, phba); 755 status = beiscsi_get_macaddr(buf, phba);
711 if (status < 0) { 756 if (status < 0) {
712 SE_DEBUG(DBG_LVL_1, "beiscsi_get_macaddr Failed\n"); 757 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
758 "BS_%d : beiscsi_get_macaddr Failed\n");
713 return status; 759 return status;
714 } 760 }
715 break; 761 break;
716 case ISCSI_HOST_PARAM_INITIATOR_NAME: 762 case ISCSI_HOST_PARAM_INITIATOR_NAME:
717 status = beiscsi_get_initname(buf, phba); 763 status = beiscsi_get_initname(buf, phba);
718 if (status < 0) { 764 if (status < 0) {
719 SE_DEBUG(DBG_LVL_1, 765 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
720 "Retreiving Initiator Name Failed\n"); 766 "BS_%d : Retreiving Initiator Name Failed\n");
721 return status; 767 return status;
722 } 768 }
723 break; 769 break;
@@ -728,8 +774,8 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
728 case ISCSI_HOST_PARAM_PORT_SPEED: 774 case ISCSI_HOST_PARAM_PORT_SPEED:
729 status = beiscsi_get_port_speed(shost); 775 status = beiscsi_get_port_speed(shost);
730 if (status) { 776 if (status) {
731 SE_DEBUG(DBG_LVL_1, 777 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
732 "Retreiving Port Speed Failed\n"); 778 "BS_%d : Retreiving Port Speed Failed\n");
733 return status; 779 return status;
734 } 780 }
735 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost)); 781 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost));
@@ -768,8 +814,12 @@ void beiscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn,
768 struct iscsi_stats *stats) 814 struct iscsi_stats *stats)
769{ 815{
770 struct iscsi_conn *conn = cls_conn->dd_data; 816 struct iscsi_conn *conn = cls_conn->dd_data;
817 struct beiscsi_hba *phba = NULL;
818
819 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
820 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
821 "BS_%d : In beiscsi_conn_get_stats\n");
771 822
772 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_get_stats\n");
773 stats->txdata_octets = conn->txdata_octets; 823 stats->txdata_octets = conn->txdata_octets;
774 stats->rxdata_octets = conn->rxdata_octets; 824 stats->rxdata_octets = conn->rxdata_octets;
775 stats->dataout_pdus = conn->dataout_pdus_cnt; 825 stats->dataout_pdus = conn->dataout_pdus_cnt;
@@ -829,11 +879,16 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
829 struct beiscsi_endpoint *beiscsi_ep; 879 struct beiscsi_endpoint *beiscsi_ep;
830 struct beiscsi_offload_params params; 880 struct beiscsi_offload_params params;
831 881
832 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_start\n"); 882 beiscsi_log(beiscsi_conn->phba, KERN_INFO,
883 BEISCSI_LOG_CONFIG,
884 "BS_%d : In beiscsi_conn_start\n");
885
833 memset(&params, 0, sizeof(struct beiscsi_offload_params)); 886 memset(&params, 0, sizeof(struct beiscsi_offload_params));
834 beiscsi_ep = beiscsi_conn->ep; 887 beiscsi_ep = beiscsi_conn->ep;
835 if (!beiscsi_ep) 888 if (!beiscsi_ep)
836 SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start , no beiscsi_ep\n"); 889 beiscsi_log(beiscsi_conn->phba, KERN_ERR,
890 BEISCSI_LOG_CONFIG,
891 "BS_%d : In beiscsi_conn_start , no beiscsi_ep\n");
837 892
838 beiscsi_conn->login_in_progress = 0; 893 beiscsi_conn->login_in_progress = 0;
839 beiscsi_set_params_for_offld(beiscsi_conn, &params); 894 beiscsi_set_params_for_offld(beiscsi_conn, &params);
@@ -907,19 +962,27 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
907 unsigned int tag, wrb_num; 962 unsigned int tag, wrb_num;
908 int ret = -ENOMEM; 963 int ret = -ENOMEM;
909 964
910 SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn\n"); 965 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
966 "BS_%d : In beiscsi_open_conn\n");
967
911 beiscsi_ep->ep_cid = beiscsi_get_cid(phba); 968 beiscsi_ep->ep_cid = beiscsi_get_cid(phba);
912 if (beiscsi_ep->ep_cid == 0xFFFF) { 969 if (beiscsi_ep->ep_cid == 0xFFFF) {
913 SE_DEBUG(DBG_LVL_1, "No free cid available\n"); 970 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
971 "BS_%d : No free cid available\n");
914 return ret; 972 return ret;
915 } 973 }
916 SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn, ep_cid=%d\n", 974
917 beiscsi_ep->ep_cid); 975 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
976 "BS_%d : In beiscsi_open_conn, ep_cid=%d\n",
977 beiscsi_ep->ep_cid);
978
918 phba->ep_array[beiscsi_ep->ep_cid - 979 phba->ep_array[beiscsi_ep->ep_cid -
919 phba->fw_config.iscsi_cid_start] = ep; 980 phba->fw_config.iscsi_cid_start] = ep;
920 if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start + 981 if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start +
921 phba->params.cxns_per_ctrl * 2)) { 982 phba->params.cxns_per_ctrl * 2)) {
922 SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n"); 983
984 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
985 "BS_%d : Failed in allocate iscsi cid\n");
923 goto free_ep; 986 goto free_ep;
924 } 987 }
925 988
@@ -928,9 +991,11 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
928 sizeof(struct tcp_connect_and_offload_in), 991 sizeof(struct tcp_connect_and_offload_in),
929 &nonemb_cmd.dma); 992 &nonemb_cmd.dma);
930 if (nonemb_cmd.va == NULL) { 993 if (nonemb_cmd.va == NULL) {
931 SE_DEBUG(DBG_LVL_1, 994
932 "Failed to allocate memory for mgmt_open_connection" 995 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
933 "\n"); 996 "BS_%d : Failed to allocate memory for"
997 " mgmt_open_connection\n");
998
934 beiscsi_put_cid(phba, beiscsi_ep->ep_cid); 999 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
935 return -ENOMEM; 1000 return -ENOMEM;
936 } 1001 }
@@ -938,9 +1003,10 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
938 memset(nonemb_cmd.va, 0, nonemb_cmd.size); 1003 memset(nonemb_cmd.va, 0, nonemb_cmd.size);
939 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd); 1004 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
940 if (!tag) { 1005 if (!tag) {
941 SE_DEBUG(DBG_LVL_1, 1006 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
942 "mgmt_open_connection Failed for cid=%d\n", 1007 "BS_%d : mgmt_open_connection Failed for cid=%d\n",
943 beiscsi_ep->ep_cid); 1008 beiscsi_ep->ep_cid);
1009
944 beiscsi_put_cid(phba, beiscsi_ep->ep_cid); 1010 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
945 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1011 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
946 nonemb_cmd.va, nonemb_cmd.dma); 1012 nonemb_cmd.va, nonemb_cmd.dma);
@@ -953,9 +1019,12 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
953 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 1019 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
954 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 1020 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
955 if (status || extd_status) { 1021 if (status || extd_status) {
956 SE_DEBUG(DBG_LVL_1, "mgmt_open_connection Failed" 1022 beiscsi_log(phba, KERN_ERR,
957 " status = %d extd_status = %d\n", 1023 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
958 status, extd_status); 1024 "BS_%d : mgmt_open_connection Failed"
1025 " status = %d extd_status = %d\n",
1026 status, extd_status);
1027
959 free_mcc_tag(&phba->ctrl, tag); 1028 free_mcc_tag(&phba->ctrl, tag);
960 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1029 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
961 nonemb_cmd.va, nonemb_cmd.dma); 1030 nonemb_cmd.va, nonemb_cmd.dma);
@@ -968,7 +1037,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
968 beiscsi_ep = ep->dd_data; 1037 beiscsi_ep = ep->dd_data;
969 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle; 1038 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
970 beiscsi_ep->cid_vld = 1; 1039 beiscsi_ep->cid_vld = 1;
971 SE_DEBUG(DBG_LVL_8, "mgmt_open_connection Success\n"); 1040 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1041 "BS_%d : mgmt_open_connection Success\n");
972 } 1042 }
973 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1043 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
974 nonemb_cmd.va, nonemb_cmd.dma); 1044 nonemb_cmd.va, nonemb_cmd.dma);
@@ -996,18 +1066,19 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
996 struct iscsi_endpoint *ep; 1066 struct iscsi_endpoint *ep;
997 int ret; 1067 int ret;
998 1068
999 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_connect\n");
1000 if (shost) 1069 if (shost)
1001 phba = iscsi_host_priv(shost); 1070 phba = iscsi_host_priv(shost);
1002 else { 1071 else {
1003 ret = -ENXIO; 1072 ret = -ENXIO;
1004 SE_DEBUG(DBG_LVL_1, "shost is NULL\n"); 1073 printk(KERN_ERR
1074 "beiscsi_ep_connect shost is NULL\n");
1005 return ERR_PTR(ret); 1075 return ERR_PTR(ret);
1006 } 1076 }
1007 1077
1008 if (phba->state != BE_ADAPTER_UP) { 1078 if (phba->state != BE_ADAPTER_UP) {
1009 ret = -EBUSY; 1079 ret = -EBUSY;
1010 SE_DEBUG(DBG_LVL_1, "The Adapter state is Not UP\n"); 1080 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1081 "BS_%d : The Adapter state is Not UP\n");
1011 return ERR_PTR(ret); 1082 return ERR_PTR(ret);
1012 } 1083 }
1013 1084
@@ -1022,7 +1093,8 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
1022 beiscsi_ep->openiscsi_ep = ep; 1093 beiscsi_ep->openiscsi_ep = ep;
1023 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking); 1094 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking);
1024 if (ret) { 1095 if (ret) {
1025 SE_DEBUG(DBG_LVL_1, "Failed in beiscsi_open_conn\n"); 1096 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1097 "BS_%d : Failed in beiscsi_open_conn\n");
1026 goto free_ep; 1098 goto free_ep;
1027 } 1099 }
1028 1100
@@ -1044,7 +1116,9 @@ int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
1044{ 1116{
1045 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 1117 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1046 1118
1047 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_poll\n"); 1119 beiscsi_log(beiscsi_ep->phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1120 "BS_%d : In beiscsi_ep_poll\n");
1121
1048 if (beiscsi_ep->cid_vld == 1) 1122 if (beiscsi_ep->cid_vld == 1)
1049 return 1; 1123 return 1;
1050 else 1124 else
@@ -1064,8 +1138,10 @@ static int beiscsi_close_conn(struct beiscsi_endpoint *beiscsi_ep, int flag)
1064 1138
1065 tag = mgmt_upload_connection(phba, beiscsi_ep->ep_cid, flag); 1139 tag = mgmt_upload_connection(phba, beiscsi_ep->ep_cid, flag);
1066 if (!tag) { 1140 if (!tag) {
1067 SE_DEBUG(DBG_LVL_8, "upload failed for cid 0x%x\n", 1141 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1068 beiscsi_ep->ep_cid); 1142 "BS_%d : upload failed for cid 0x%x\n",
1143 beiscsi_ep->ep_cid);
1144
1069 ret = -EAGAIN; 1145 ret = -EAGAIN;
1070 } else { 1146 } else {
1071 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1147 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -1086,7 +1162,8 @@ static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba,
1086 if (phba->conn_table[cid]) 1162 if (phba->conn_table[cid])
1087 phba->conn_table[cid] = NULL; 1163 phba->conn_table[cid] = NULL;
1088 else { 1164 else {
1089 SE_DEBUG(DBG_LVL_8, "Connection table Not occupied.\n"); 1165 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1166 "BS_%d : Connection table Not occupied.\n");
1090 return -EINVAL; 1167 return -EINVAL;
1091 } 1168 }
1092 return 0; 1169 return 0;
@@ -1108,27 +1185,31 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
1108 1185
1109 beiscsi_ep = ep->dd_data; 1186 beiscsi_ep = ep->dd_data;
1110 phba = beiscsi_ep->phba; 1187 phba = beiscsi_ep->phba;
1111 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect for ep_cid = %d\n", 1188 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1112 beiscsi_ep->ep_cid); 1189 "BS_%d : In beiscsi_ep_disconnect for ep_cid = %d\n",
1190 beiscsi_ep->ep_cid);
1113 1191
1114 if (!beiscsi_ep->conn) { 1192 if (!beiscsi_ep->conn) {
1115 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect, no " 1193 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1116 "beiscsi_ep\n"); 1194 "BS_%d : In beiscsi_ep_disconnect, no "
1195 "beiscsi_ep\n");
1117 return; 1196 return;
1118 } 1197 }
1119 beiscsi_conn = beiscsi_ep->conn; 1198 beiscsi_conn = beiscsi_ep->conn;
1120 iscsi_suspend_queue(beiscsi_conn->conn); 1199 iscsi_suspend_queue(beiscsi_conn->conn);
1121 1200
1122 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect ep_cid = %d\n", 1201 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1123 beiscsi_ep->ep_cid); 1202 "BS_%d : In beiscsi_ep_disconnect ep_cid = %d\n",
1203 beiscsi_ep->ep_cid);
1124 1204
1125 tag = mgmt_invalidate_connection(phba, beiscsi_ep, 1205 tag = mgmt_invalidate_connection(phba, beiscsi_ep,
1126 beiscsi_ep->ep_cid, 1, 1206 beiscsi_ep->ep_cid, 1,
1127 savecfg_flag); 1207 savecfg_flag);
1128 if (!tag) { 1208 if (!tag) {
1129 SE_DEBUG(DBG_LVL_1, 1209 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1130 "mgmt_invalidate_connection Failed for cid=%d\n", 1210 "BS_%d : mgmt_invalidate_connection"
1131 beiscsi_ep->ep_cid); 1211 " Failed for cid=%d\n",
1212 beiscsi_ep->ep_cid);
1132 } else { 1213 } else {
1133 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1214 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
1134 phba->ctrl.mcc_numtag[tag]); 1215 phba->ctrl.mcc_numtag[tag]);