1 /** 2 * Copyright (C) 2005 - 2009 ServerEngines 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License version 2 7 * as published by the Free Software Foundation. The full GNU General 8 * Public License is included in this distribution in the file called COPYING. 9 * 10 * Written by: Jayamohan Kallickal (jayamohank@serverengines.com) 11 * 12 * Contact Information: 13 * linux-drivers@serverengines.com 14 * 15 * ServerEngines 16 * 209 N. Fair Oaks Ave 17 * Sunnyvale, CA 94085 18 * 19 */ 20 21 #include <scsi/libiscsi.h> 22 #include <scsi/scsi_transport_iscsi.h> 23 #include <scsi/scsi_transport.h> 24 #include <scsi/scsi_cmnd.h> 25 #include <scsi/scsi_device.h> 26 #include <scsi/scsi_host.h> 27 #include <scsi/scsi.h> 28 29 #include "be_iscsi.h" 30 31 extern struct iscsi_transport beiscsi_iscsi_transport; 32 33 /** 34 * beiscsi_session_create - creates a new iscsi session 35 * @cmds_max: max commands supported 36 * @qdepth: max queue depth supported 37 * @initial_cmdsn: initial iscsi CMDSN 38 */ 39 struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep, 40 u16 cmds_max, 41 u16 qdepth, 42 u32 initial_cmdsn) 43 { 44 struct Scsi_Host *shost; 45 struct beiscsi_endpoint *beiscsi_ep; 46 struct iscsi_cls_session *cls_session; 47 struct beiscsi_hba *phba; 48 struct iscsi_session *sess; 49 struct beiscsi_session *beiscsi_sess; 50 struct beiscsi_io_task *io_task; 51 52 SE_DEBUG(DBG_LVL_8, "In beiscsi_session_create\n"); 53 54 if (!ep) { 55 SE_DEBUG(DBG_LVL_1, "beiscsi_session_create: invalid ep \n"); 56 return NULL; 57 } 58 beiscsi_ep = ep->dd_data; 59 phba = beiscsi_ep->phba; 60 shost = phba->shost; 61 if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) { 62 shost_printk(KERN_ERR, shost, "Cannot handle %d cmds." 63 "Max cmds per session supported is %d. Using %d. " 64 "\n", cmds_max, 65 beiscsi_ep->phba->params.wrbs_per_cxn, 66 beiscsi_ep->phba->params.wrbs_per_cxn); 67 cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn; 68 } 69 70 cls_session = iscsi_session_setup(&beiscsi_iscsi_transport, 71 shost, cmds_max, 72 sizeof(*beiscsi_sess), 73 sizeof(*io_task), 74 initial_cmdsn, ISCSI_MAX_TARGET); 75 if (!cls_session) 76 return NULL; 77 sess = cls_session->dd_data; 78 beiscsi_sess = sess->dd_data; 79 beiscsi_sess->bhs_pool = pci_pool_create("beiscsi_bhs_pool", 80 phba->pcidev, 81 sizeof(struct be_cmd_bhs), 82 64, 0); 83 if (!beiscsi_sess->bhs_pool) 84 goto destroy_sess; 85 86 return cls_session; 87 destroy_sess: 88 iscsi_session_teardown(cls_session); 89 return NULL; 90 } 91 92 /** 93 * beiscsi_session_destroy - destroys iscsi session 94 * @cls_session: pointer to iscsi cls session 95 * 96 * Destroys iSCSI session instance and releases 97 * resources allocated for it. 98 */ 99 void beiscsi_session_destroy(struct iscsi_cls_session *cls_session) 100 { 101 struct iscsi_session *sess = cls_session->dd_data; 102 struct beiscsi_session *beiscsi_sess = sess->dd_data; 103 104 pci_pool_destroy(beiscsi_sess->bhs_pool); 105 iscsi_session_teardown(cls_session); 106 } 107 108 /** 109 * beiscsi_conn_create - create an instance of iscsi connection 110 * @cls_session: ptr to iscsi_cls_session 111 * @cid: iscsi cid 112 */ 113 struct iscsi_cls_conn * 114 beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid) 115 { 116 struct beiscsi_hba *phba; 117 struct Scsi_Host *shost; 118 struct iscsi_cls_conn *cls_conn; 119 struct beiscsi_conn *beiscsi_conn; 120 struct iscsi_conn *conn; 121 struct iscsi_session *sess; 122 struct beiscsi_session *beiscsi_sess; 123 124 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create ,cid" 125 "from iscsi layer=%d\n", cid); 126 shost = iscsi_session_to_shost(cls_session); 127 phba = iscsi_host_priv(shost); 128 129 cls_conn = iscsi_conn_setup(cls_session, sizeof(*beiscsi_conn), cid); 130 if (!cls_conn) 131 return NULL; 132 133 conn = cls_conn->dd_data; 134 beiscsi_conn = conn->dd_data; 135 beiscsi_conn->ep = NULL; 136 beiscsi_conn->phba = phba; 137 beiscsi_conn->conn = conn; 138 sess = cls_session->dd_data; 139 beiscsi_sess = sess->dd_data; 140 beiscsi_conn->beiscsi_sess = beiscsi_sess; 141 return cls_conn; 142 } 143 144 /** 145 * beiscsi_bindconn_cid - Bind the beiscsi_conn with phba connection table 146 * @beiscsi_conn: The pointer to beiscsi_conn structure 147 * @phba: The phba instance 148 * @cid: The cid to free 149 */ 150 static int beiscsi_bindconn_cid(struct beiscsi_hba *phba, 151 struct beiscsi_conn *beiscsi_conn, 152 unsigned int cid) 153 { 154 if (phba->conn_table[cid]) { 155 SE_DEBUG(DBG_LVL_1, 156 "Connection table already occupied. Detected clash\n"); 157 return -EINVAL; 158 } else { 159 SE_DEBUG(DBG_LVL_8, "phba->conn_table[%d]=%p(beiscsi_conn) \n", 160 cid, beiscsi_conn); 161 phba->conn_table[cid] = beiscsi_conn; 162 } 163 return 0; 164 } 165 166 /** 167 * beiscsi_conn_bind - Binds iscsi session/connection with TCP connection 168 * @cls_session: pointer to iscsi cls session 169 * @cls_conn: pointer to iscsi cls conn 170 * @transport_fd: EP handle(64 bit) 171 * 172 * This function binds the TCP Conn with iSCSI Connection and Session. 173 */ 174 int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, 175 struct iscsi_cls_conn *cls_conn, 176 u64 transport_fd, int is_leading) 177 { 178 struct iscsi_conn *conn = cls_conn->dd_data; 179 struct beiscsi_conn *beiscsi_conn = conn->dd_data; 180 struct Scsi_Host *shost = 181 (struct Scsi_Host *)iscsi_session_to_shost(cls_session); 182 struct beiscsi_hba *phba = (struct beiscsi_hba *)iscsi_host_priv(shost); 183 struct beiscsi_endpoint *beiscsi_ep; 184 struct iscsi_endpoint *ep; 185 186 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_bind\n"); 187 ep = iscsi_lookup_endpoint(transport_fd); 188 if (!ep) 189 return -EINVAL; 190 191 beiscsi_ep = ep->dd_data; 192 193 if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) 194 return -EINVAL; 195 196 if (beiscsi_ep->phba != phba) { 197 SE_DEBUG(DBG_LVL_8, 198 "beiscsi_ep->hba=%p not equal to phba=%p \n", 199 beiscsi_ep->phba, phba); 200 return -EEXIST; 201 } 202 203 beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid; 204 beiscsi_conn->ep = beiscsi_ep; 205 beiscsi_ep->conn = beiscsi_conn; 206 SE_DEBUG(DBG_LVL_8, "beiscsi_conn=%p conn=%p ep_cid=%d \n", 207 beiscsi_conn, conn, beiscsi_ep->ep_cid); 208 return beiscsi_bindconn_cid(phba, beiscsi_conn, beiscsi_ep->ep_cid); 209 } 210 211 /** 212 * beiscsi_conn_get_param - get the iscsi parameter 213 * @cls_conn: pointer to iscsi cls conn 214 * @param: parameter type identifier 215 * @buf: buffer pointer 216 * 217 * returns iscsi parameter 218 */ 219 int beiscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 220 enum iscsi_param param, char *buf) 221 { 222 struct beiscsi_endpoint *beiscsi_ep; 223 struct iscsi_conn *conn = cls_conn->dd_data; 224 struct beiscsi_conn *beiscsi_conn = conn->dd_data; 225 int len = 0; 226 227 beiscsi_ep = beiscsi_conn->ep; 228 if (!beiscsi_ep) { 229 SE_DEBUG(DBG_LVL_1, 230 "In beiscsi_conn_get_param , no beiscsi_ep\n"); 231 return -1; 232 } 233 234 switch (param) { 235 case ISCSI_PARAM_CONN_PORT: 236 len = sprintf(buf, "%hu\n", beiscsi_ep->dst_tcpport); 237 break; 238 case ISCSI_PARAM_CONN_ADDRESS: 239 if (beiscsi_ep->ip_type == BE2_IPV4) 240 len = sprintf(buf, "%pI4\n", &beiscsi_ep->dst_addr); 241 else 242 len = sprintf(buf, "%pI6\n", &beiscsi_ep->dst6_addr); 243 break; 244 default: 245 return iscsi_conn_get_param(cls_conn, param, buf); 246 } 247 return len; 248 } 249 250 int beiscsi_set_param(struct iscsi_cls_conn *cls_conn, 251 enum iscsi_param param, char *buf, int buflen) 252 { 253 struct iscsi_conn *conn = cls_conn->dd_data; 254 struct iscsi_session *session = conn->session; 255 int ret; 256 257 ret = iscsi_set_param(cls_conn, param, buf, buflen); 258 if (ret) 259 return ret; 260 /* 261 * If userspace tried to set the value to higher than we can 262 * support override here. 263 */ 264 switch (param) { 265 case ISCSI_PARAM_FIRST_BURST: 266 if (session->first_burst > 8192) 267 session->first_burst = 8192; 268 break; 269 case ISCSI_PARAM_MAX_RECV_DLENGTH: 270 if (conn->max_recv_dlength > 65536) 271 conn->max_recv_dlength = 65536; 272 break; 273 case ISCSI_PARAM_MAX_BURST: 274 if (session->first_burst > 262144) 275 session->first_burst = 262144; 276 break; 277 default: 278 return 0; 279 } 280 281 return 0; 282 } 283 284 /** 285 * beiscsi_get_host_param - get the iscsi parameter 286 * @shost: pointer to scsi_host structure 287 * @param: parameter type identifier 288 * @buf: buffer pointer 289 * 290 * returns host parameter 291 */ 292 int beiscsi_get_host_param(struct Scsi_Host *shost, 293 enum iscsi_host_param param, char *buf) 294 { 295 struct beiscsi_hba *phba = (struct beiscsi_hba *)iscsi_host_priv(shost); 296 int len = 0; 297 298 switch (param) { 299 case ISCSI_HOST_PARAM_HWADDRESS: 300 be_cmd_get_mac_addr(phba, phba->mac_address); 301 len = sysfs_format_mac(buf, phba->mac_address, ETH_ALEN); 302 break; 303 default: 304 return iscsi_host_get_param(shost, param, buf); 305 } 306 return len; 307 } 308 309 /** 310 * beiscsi_conn_get_stats - get the iscsi stats 311 * @cls_conn: pointer to iscsi cls conn 312 * @stats: pointer to iscsi_stats structure 313 * 314 * returns iscsi stats 315 */ 316 void beiscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn, 317 struct iscsi_stats *stats) 318 { 319 struct iscsi_conn *conn = cls_conn->dd_data; 320 321 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_get_stats\n"); 322 stats->txdata_octets = conn->txdata_octets; 323 stats->rxdata_octets = conn->rxdata_octets; 324 stats->dataout_pdus = conn->dataout_pdus_cnt; 325 stats->scsirsp_pdus = conn->scsirsp_pdus_cnt; 326 stats->scsicmd_pdus = conn->scsicmd_pdus_cnt; 327 stats->datain_pdus = conn->datain_pdus_cnt; 328 stats->tmfrsp_pdus = conn->tmfrsp_pdus_cnt; 329 stats->tmfcmd_pdus = conn->tmfcmd_pdus_cnt; 330 stats->r2t_pdus = conn->r2t_pdus_cnt; 331 stats->digest_err = 0; 332 stats->timeout_err = 0; 333 stats->custom_length = 0; 334 strcpy(stats->custom[0].desc, "eh_abort_cnt"); 335 stats->custom[0].value = conn->eh_abort_cnt; 336 } 337 338 /** 339 * beiscsi_set_params_for_offld - get the parameters for offload 340 * @beiscsi_conn: pointer to beiscsi_conn 341 * @params: pointer to offload_params structure 342 */ 343 static void beiscsi_set_params_for_offld(struct beiscsi_conn *beiscsi_conn, 344 struct beiscsi_offload_params *params) 345 { 346 struct iscsi_conn *conn = beiscsi_conn->conn; 347 struct iscsi_session *session = conn->session; 348 349 AMAP_SET_BITS(struct amap_beiscsi_offload_params, max_burst_length, 350 params, session->max_burst); 351 AMAP_SET_BITS(struct amap_beiscsi_offload_params, 352 max_send_data_segment_length, params, 353 conn->max_xmit_dlength); 354 AMAP_SET_BITS(struct amap_beiscsi_offload_params, first_burst_length, 355 params, session->first_burst); 356 AMAP_SET_BITS(struct amap_beiscsi_offload_params, erl, params, 357 session->erl); 358 AMAP_SET_BITS(struct amap_beiscsi_offload_params, dde, params, 359 conn->datadgst_en); 360 AMAP_SET_BITS(struct amap_beiscsi_offload_params, hde, params, 361 conn->hdrdgst_en); 362 AMAP_SET_BITS(struct amap_beiscsi_offload_params, ir2t, params, 363 session->initial_r2t_en); 364 AMAP_SET_BITS(struct amap_beiscsi_offload_params, imd, params, 365 session->imm_data_en); 366 AMAP_SET_BITS(struct amap_beiscsi_offload_params, exp_statsn, params, 367 (conn->exp_statsn - 1)); 368 } 369 370 /** 371 * beiscsi_conn_start - offload of session to chip 372 * @cls_conn: pointer to beiscsi_conn 373 */ 374 int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn) 375 { 376 struct iscsi_conn *conn = cls_conn->dd_data; 377 struct beiscsi_conn *beiscsi_conn = conn->dd_data; 378 struct beiscsi_endpoint *beiscsi_ep; 379 struct beiscsi_offload_params params; 380 381 memset(¶ms, 0, sizeof(struct beiscsi_offload_params)); 382 beiscsi_ep = beiscsi_conn->ep; 383 if (!beiscsi_ep) 384 SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start , no beiscsi_ep\n"); 385 386 beiscsi_conn->login_in_progress = 0; 387 beiscsi_set_params_for_offld(beiscsi_conn, ¶ms); 388 beiscsi_offload_connection(beiscsi_conn, ¶ms); 389 iscsi_conn_start(cls_conn); 390 return 0; 391 } 392 393 /** 394 * beiscsi_get_cid - Allocate a cid 395 * @phba: The phba instance 396 */ 397 static int beiscsi_get_cid(struct beiscsi_hba *phba) 398 { 399 unsigned short cid = 0xFFFF; 400 401 if (!phba->avlbl_cids) 402 return cid; 403 404 cid = phba->cid_array[phba->cid_alloc++]; 405 if (phba->cid_alloc == phba->params.cxns_per_ctrl) 406 phba->cid_alloc = 0; 407 phba->avlbl_cids--; 408 return cid; 409 } 410 411 /** 412 * beiscsi_open_conn - Ask FW to open a TCP connection 413 * @ep: endpoint to be used 414 * @src_addr: The source IP address 415 * @dst_addr: The Destination IP address 416 * 417 * Asks the FW to open a TCP connection 418 */ 419 static int beiscsi_open_conn(struct iscsi_endpoint *ep, 420 struct sockaddr *src_addr, 421 struct sockaddr *dst_addr, int non_blocking) 422 { 423 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 424 struct beiscsi_hba *phba = beiscsi_ep->phba; 425 int ret = -1; 426 427 beiscsi_ep->ep_cid = beiscsi_get_cid(phba); 428 if (beiscsi_ep->ep_cid == 0xFFFF) { 429 SE_DEBUG(DBG_LVL_1, "No free cid available\n"); 430 return ret; 431 } 432 SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn, ep_cid=%d ", 433 beiscsi_ep->ep_cid); 434 phba->ep_array[beiscsi_ep->ep_cid] = ep; 435 if (beiscsi_ep->ep_cid > 436 (phba->fw_config.iscsi_cid_start + phba->params.cxns_per_ctrl)) { 437 SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n"); 438 return ret; 439 } 440 441 beiscsi_ep->cid_vld = 0; 442 return mgmt_open_connection(phba, dst_addr, beiscsi_ep); 443 } 444 445 /** 446 * beiscsi_put_cid - Free the cid 447 * @phba: The phba for which the cid is being freed 448 * @cid: The cid to free 449 */ 450 static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid) 451 { 452 phba->avlbl_cids++; 453 phba->cid_array[phba->cid_free++] = cid; 454 if (phba->cid_free == phba->params.cxns_per_ctrl) 455 phba->cid_free = 0; 456 } 457 458 /** 459 * beiscsi_free_ep - free endpoint 460 * @ep: pointer to iscsi endpoint structure 461 */ 462 static void beiscsi_free_ep(struct iscsi_endpoint *ep) 463 { 464 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 465 struct beiscsi_hba *phba = beiscsi_ep->phba; 466 467 beiscsi_put_cid(phba, beiscsi_ep->ep_cid); 468 beiscsi_ep->phba = NULL; 469 iscsi_destroy_endpoint(ep); 470 } 471 472 /** 473 * beiscsi_ep_connect - Ask chip to create TCP Conn 474 * @scsi_host: Pointer to scsi_host structure 475 * @dst_addr: The IP address of Target 476 * @non_blocking: blocking or non-blocking call 477 * 478 * This routines first asks chip to create a connection and then allocates an EP 479 */ 480 struct iscsi_endpoint * 481 beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, 482 int non_blocking) 483 { 484 struct beiscsi_hba *phba; 485 struct beiscsi_endpoint *beiscsi_ep; 486 struct iscsi_endpoint *ep; 487 int ret; 488 489 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_connect \n"); 490 if (shost) 491 phba = iscsi_host_priv(shost); 492 else { 493 ret = -ENXIO; 494 SE_DEBUG(DBG_LVL_1, "shost is NULL \n"); 495 return ERR_PTR(ret); 496 } 497 498 if (phba->state) { 499 ret = -EBUSY; 500 SE_DEBUG(DBG_LVL_1, "The Adapet state is Not UP \n"); 501 return ERR_PTR(ret); 502 } 503 504 ep = iscsi_create_endpoint(sizeof(struct beiscsi_endpoint)); 505 if (!ep) { 506 ret = -ENOMEM; 507 return ERR_PTR(ret); 508 } 509 510 beiscsi_ep = ep->dd_data; 511 beiscsi_ep->phba = phba; 512 513 if (beiscsi_open_conn(ep, NULL, dst_addr, non_blocking)) { 514 SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n"); 515 ret = -ENOMEM; 516 goto free_ep; 517 } 518 519 return ep; 520 521 free_ep: 522 beiscsi_free_ep(ep); 523 return ERR_PTR(ret); 524 } 525 526 /** 527 * beiscsi_ep_poll - Poll to see if connection is established 528 * @ep: endpoint to be used 529 * @timeout_ms: timeout specified in millisecs 530 * 531 * Poll to see if TCP connection established 532 */ 533 int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) 534 { 535 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 536 537 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_poll\n"); 538 if (beiscsi_ep->cid_vld == 1) 539 return 1; 540 else 541 return 0; 542 } 543 544 /** 545 * beiscsi_close_conn - Upload the connection 546 * @ep: The iscsi endpoint 547 * @flag: The type of connection closure 548 */ 549 static int beiscsi_close_conn(struct iscsi_endpoint *ep, int flag) 550 { 551 int ret = 0; 552 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 553 struct beiscsi_hba *phba = beiscsi_ep->phba; 554 555 if (MGMT_STATUS_SUCCESS != 556 mgmt_upload_connection(phba, beiscsi_ep->ep_cid, 557 CONNECTION_UPLOAD_GRACEFUL)) { 558 SE_DEBUG(DBG_LVL_8, "upload failed for cid 0x%x", 559 beiscsi_ep->ep_cid); 560 ret = -1; 561 } 562 563 return ret; 564 } 565 566 /** 567 * beiscsi_ep_disconnect - Tears down the TCP connection 568 * @ep: endpoint to be used 569 * 570 * Tears down the TCP connection 571 */ 572 void beiscsi_ep_disconnect(struct iscsi_endpoint *ep) 573 { 574 struct beiscsi_conn *beiscsi_conn; 575 struct beiscsi_endpoint *beiscsi_ep; 576 struct beiscsi_hba *phba; 577 int flag = 0; 578 579 beiscsi_ep = ep->dd_data; 580 phba = beiscsi_ep->phba; 581 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect\n"); 582 583 if (beiscsi_ep->conn) { 584 beiscsi_conn = beiscsi_ep->conn; 585 iscsi_suspend_queue(beiscsi_conn->conn); 586 beiscsi_close_conn(ep, flag); 587 } 588 589 beiscsi_free_ep(ep); 590 } 591 592 /** 593 * beiscsi_unbind_conn_to_cid - Unbind the beiscsi_conn from phba conn table 594 * @phba: The phba instance 595 * @cid: The cid to free 596 */ 597 static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba, 598 unsigned int cid) 599 { 600 if (phba->conn_table[cid]) 601 phba->conn_table[cid] = NULL; 602 else { 603 SE_DEBUG(DBG_LVL_8, "Connection table Not occupied. \n"); 604 return -EINVAL; 605 } 606 return 0; 607 } 608 609 /** 610 * beiscsi_conn_stop - Invalidate and stop the connection 611 * @cls_conn: pointer to get iscsi_conn 612 * @flag: The type of connection closure 613 */ 614 void beiscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) 615 { 616 struct iscsi_conn *conn = cls_conn->dd_data; 617 struct beiscsi_conn *beiscsi_conn = conn->dd_data; 618 struct beiscsi_endpoint *beiscsi_ep; 619 struct iscsi_session *session = conn->session; 620 struct Scsi_Host *shost = iscsi_session_to_shost(session->cls_session); 621 struct beiscsi_hba *phba = iscsi_host_priv(shost); 622 unsigned int status; 623 unsigned short savecfg_flag = CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH; 624 625 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_stop\n"); 626 beiscsi_ep = beiscsi_conn->ep; 627 if (!beiscsi_ep) { 628 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_stop , no beiscsi_ep\n"); 629 return; 630 } 631 status = mgmt_invalidate_connection(phba, beiscsi_ep, 632 beiscsi_ep->ep_cid, 1, 633 savecfg_flag); 634 if (status != MGMT_STATUS_SUCCESS) { 635 SE_DEBUG(DBG_LVL_1, 636 "mgmt_invalidate_connection Failed for cid=%d \n", 637 beiscsi_ep->ep_cid); 638 } 639 beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid); 640 iscsi_conn_stop(cls_conn, flag); 641 } 642