H A D | bnx2i_iscsi.c | 384 struct bnx2i_endpoint *bnx2i_ep; bnx2i_alloc_ep() local 387 ep = iscsi_create_endpoint(sizeof(*bnx2i_ep)); bnx2i_alloc_ep() 393 bnx2i_ep = ep->dd_data; bnx2i_alloc_ep() 394 bnx2i_ep->cls_ep = ep; bnx2i_alloc_ep() 395 INIT_LIST_HEAD(&bnx2i_ep->link); bnx2i_alloc_ep() 396 bnx2i_ep->state = EP_STATE_IDLE; bnx2i_alloc_ep() 397 bnx2i_ep->ep_iscsi_cid = (u16) -1; bnx2i_alloc_ep() 398 bnx2i_ep->hba = hba; bnx2i_alloc_ep() 399 bnx2i_ep->hba_age = hba->age; bnx2i_alloc_ep() 403 bnx2i_ep->ec_shift += 1; bnx2i_alloc_ep() 406 init_waitqueue_head(&bnx2i_ep->ofld_wait); bnx2i_alloc_ep() 417 struct bnx2i_endpoint *bnx2i_ep = ep->dd_data; bnx2i_free_ep() local 421 bnx2i_ep->state = EP_STATE_IDLE; bnx2i_free_ep() 422 bnx2i_ep->hba->ofld_conns_active--; bnx2i_free_ep() 424 if (bnx2i_ep->ep_iscsi_cid != (u16) -1) bnx2i_free_ep() 425 bnx2i_free_iscsi_cid(bnx2i_ep->hba, bnx2i_ep->ep_iscsi_cid); bnx2i_free_ep() 427 if (bnx2i_ep->conn) { bnx2i_free_ep() 428 bnx2i_ep->conn->ep = NULL; bnx2i_free_ep() 429 bnx2i_ep->conn = NULL; bnx2i_free_ep() 432 bnx2i_ep->hba = NULL; bnx2i_free_ep() 1292 struct bnx2i_endpoint *bnx2i_ep; bnx2i_session_create() local 1299 bnx2i_ep = ep->dd_data; bnx2i_session_create() 1300 shost = bnx2i_ep->hba->shost; bnx2i_session_create() 1413 struct bnx2i_endpoint *bnx2i_ep; bnx2i_conn_bind() local 1427 bnx2i_ep = ep->dd_data; bnx2i_conn_bind() 1428 if ((bnx2i_ep->state == EP_STATE_TCP_FIN_RCVD) || bnx2i_conn_bind() 1429 (bnx2i_ep->state == EP_STATE_TCP_RST_RCVD)) bnx2i_conn_bind() 1436 if (bnx2i_ep->hba != hba) { bnx2i_conn_bind() 1441 bnx2i_ep, bnx2i_ep->hba->netdev->name); bnx2i_conn_bind() 1447 bnx2i_ep->conn = bnx2i_conn; bnx2i_conn_bind() 1448 bnx2i_conn->ep = bnx2i_ep; bnx2i_conn_bind() 1449 bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid; bnx2i_conn_bind() 1450 bnx2i_conn->fw_cid = bnx2i_ep->ep_cid; bnx2i_conn_bind() 1453 bnx2i_ep->ep_iscsi_cid); bnx2i_conn_bind() 1458 if (test_bit(BNX2I_NX2_DEV_57710, &bnx2i_ep->hba->cnic_dev_type)) bnx2i_conn_bind() 1522 struct bnx2i_endpoint *bnx2i_ep = ep->dd_data; bnx2i_ep_get_param() local 1523 struct bnx2i_hba *hba = bnx2i_ep->hba; bnx2i_ep_get_param() 1532 if (bnx2i_ep->cm_sk) bnx2i_ep_get_param() 1533 len = sprintf(buf, "%hu\n", bnx2i_ep->cm_sk->dst_port); bnx2i_ep_get_param() 1538 if (bnx2i_ep->cm_sk) bnx2i_ep_get_param() 1539 len = sprintf(buf, "%pI4\n", &bnx2i_ep->cm_sk->dst_ip); bnx2i_ep_get_param() 1573 struct bnx2i_endpoint *bnx2i_ep; bnx2i_host_get_param() local 1576 bnx2i_ep = list_first_entry(active_list, bnx2i_host_get_param() 1579 csk = bnx2i_ep->cm_sk; bnx2i_host_get_param() 1778 struct bnx2i_endpoint *bnx2i_ep; bnx2i_ep_connect() local 1811 bnx2i_ep = ep->dd_data; bnx2i_ep_connect() 1813 atomic_set(&bnx2i_ep->num_active_cmds, 0); bnx2i_ep_connect() 1822 bnx2i_ep->hba_age = hba->age; bnx2i_ep_connect() 1824 rc = bnx2i_alloc_qp_resc(hba, bnx2i_ep); bnx2i_ep_connect() 1832 bnx2i_ep->ep_iscsi_cid = (u16)iscsi_cid; bnx2i_ep_connect() 1833 bnx2i_ep->state = EP_STATE_OFLD_START; bnx2i_ep_connect() 1834 bnx2i_ep_ofld_list_add(hba, bnx2i_ep); bnx2i_ep_connect() 1836 init_timer(&bnx2i_ep->ofld_timer); bnx2i_ep_connect() 1837 bnx2i_ep->ofld_timer.expires = 2 * HZ + jiffies; bnx2i_ep_connect() 1838 bnx2i_ep->ofld_timer.function = bnx2i_ep_ofld_timer; bnx2i_ep_connect() 1839 bnx2i_ep->ofld_timer.data = (unsigned long) bnx2i_ep; bnx2i_ep_connect() 1840 add_timer(&bnx2i_ep->ofld_timer); bnx2i_ep_connect() 1842 if (bnx2i_send_conn_ofld_req(hba, bnx2i_ep)) { bnx2i_ep_connect() 1843 if (bnx2i_ep->state == EP_STATE_OFLD_FAILED_CID_BUSY) { bnx2i_ep_connect() 1845 hba->netdev->name, bnx2i_ep->ep_iscsi_cid); bnx2i_ep_connect() 1851 bnx2i_ep_ofld_list_del(hba, bnx2i_ep); bnx2i_ep_connect() 1856 wait_event_interruptible(bnx2i_ep->ofld_wait, bnx2i_ep_connect() 1857 bnx2i_ep->state != EP_STATE_OFLD_START); bnx2i_ep_connect() 1861 del_timer_sync(&bnx2i_ep->ofld_timer); bnx2i_ep_connect() 1863 bnx2i_ep_ofld_list_del(hba, bnx2i_ep); bnx2i_ep_connect() 1865 if (bnx2i_ep->state != EP_STATE_OFLD_COMPL) { bnx2i_ep_connect() 1866 if (bnx2i_ep->state == EP_STATE_OFLD_FAILED_CID_BUSY) { bnx2i_ep_connect() 1868 hba->netdev->name, bnx2i_ep->ep_iscsi_cid); bnx2i_ep_connect() 1875 rc = cnic->cm_create(cnic, CNIC_ULP_ISCSI, bnx2i_ep->ep_cid, bnx2i_ep_connect() 1876 iscsi_cid, &bnx2i_ep->cm_sk, bnx2i_ep); bnx2i_ep_connect() 1883 bnx2i_ep->cm_sk->rcv_buf = 256 * 1024; bnx2i_ep_connect() 1884 bnx2i_ep->cm_sk->snd_buf = 256 * 1024; bnx2i_ep_connect() 1885 clear_bit(SK_TCP_TIMESTAMP, &bnx2i_ep->cm_sk->tcp_flags); bnx2i_ep_connect() 1898 bnx2i_ep->timestamp = jiffies; bnx2i_ep_connect() 1899 bnx2i_ep->state = EP_STATE_CONNECT_START; bnx2i_ep_connect() 1904 rc = cnic->cm_connect(bnx2i_ep->cm_sk, &saddr); bnx2i_ep_connect() 1908 bnx2i_ep_active_list_add(hba, bnx2i_ep); bnx2i_ep_connect() 1910 if (bnx2i_map_ep_dbell_regs(bnx2i_ep)) bnx2i_ep_connect() 1917 bnx2i_ep_active_list_del(hba, bnx2i_ep); bnx2i_ep_connect() 1919 if (bnx2i_tear_down_conn(hba, bnx2i_ep)) { bnx2i_ep_connect() 1924 bnx2i_free_qp_resc(hba, bnx2i_ep); bnx2i_ep_connect() 1943 struct bnx2i_endpoint *bnx2i_ep; bnx2i_ep_poll() local 1946 bnx2i_ep = ep->dd_data; bnx2i_ep_poll() 1947 if ((bnx2i_ep->state == EP_STATE_IDLE) || bnx2i_ep_poll() 1948 (bnx2i_ep->state == EP_STATE_CONNECT_FAILED) || bnx2i_ep_poll() 1949 (bnx2i_ep->state == EP_STATE_OFLD_FAILED)) bnx2i_ep_poll() 1951 if (bnx2i_ep->state == EP_STATE_CONNECT_COMPL) bnx2i_ep_poll() 1954 rc = wait_event_interruptible_timeout(bnx2i_ep->ofld_wait, bnx2i_ep_poll() 1955 ((bnx2i_ep->state == bnx2i_ep_poll() 1957 (bnx2i_ep->state == bnx2i_ep_poll() 1959 (bnx2i_ep->state == bnx2i_ep_poll() 1962 if (bnx2i_ep->state == EP_STATE_OFLD_FAILED) bnx2i_ep_poll() 1980 static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) bnx2i_ep_tcp_conn_active() argument 1985 if (test_bit(BNX2I_NX2_DEV_57710, &bnx2i_ep->hba->cnic_dev_type)) bnx2i_ep_tcp_conn_active() 1988 switch (bnx2i_ep->state) { bnx2i_ep_tcp_conn_active() 2025 int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) bnx2i_hw_ep_disconnect() argument 2027 struct bnx2i_hba *hba = bnx2i_ep->hba; bnx2i_hw_ep_disconnect() 2042 if (bnx2i_ep->state == EP_STATE_IDLE || bnx2i_hw_ep_disconnect() 2043 bnx2i_ep->state == EP_STATE_DISCONN_TIMEDOUT) bnx2i_hw_ep_disconnect() 2046 if (!bnx2i_ep_tcp_conn_active(bnx2i_ep)) bnx2i_hw_ep_disconnect() 2049 if (bnx2i_ep->conn) { bnx2i_hw_ep_disconnect() 2050 conn = bnx2i_ep->conn->cls_conn->dd_data; bnx2i_hw_ep_disconnect() 2054 init_timer(&bnx2i_ep->ofld_timer); bnx2i_hw_ep_disconnect() 2055 bnx2i_ep->ofld_timer.expires = hba->conn_teardown_tmo + jiffies; bnx2i_hw_ep_disconnect() 2056 bnx2i_ep->ofld_timer.function = bnx2i_ep_ofld_timer; bnx2i_hw_ep_disconnect() 2057 bnx2i_ep->ofld_timer.data = (unsigned long) bnx2i_ep; bnx2i_hw_ep_disconnect() 2058 add_timer(&bnx2i_ep->ofld_timer); bnx2i_hw_ep_disconnect() 2065 if (bnx2i_ep->state != EP_STATE_TCP_FIN_RCVD) { bnx2i_hw_ep_disconnect() 2067 if (bnx2i_ep->state == EP_STATE_LOGOUT_SENT) { bnx2i_hw_ep_disconnect() 2072 bnx2i_ep->hba->netdev->name); bnx2i_hw_ep_disconnect() 2073 } else if (bnx2i_ep->state == bnx2i_hw_ep_disconnect() 2083 bnx2i_ep->state = EP_STATE_DISCONN_START; bnx2i_hw_ep_disconnect() 2086 close_ret = cnic->cm_close(bnx2i_ep->cm_sk); bnx2i_hw_ep_disconnect() 2088 close_ret = cnic->cm_abort(bnx2i_ep->cm_sk); bnx2i_hw_ep_disconnect() 2092 bnx2i_ep->hba->netdev->name, close, close_ret); bnx2i_hw_ep_disconnect() 2095 wait_event_interruptible(bnx2i_ep->ofld_wait, bnx2i_hw_ep_disconnect() 2096 bnx2i_ep->state != EP_STATE_DISCONN_START); bnx2i_hw_ep_disconnect() 2100 del_timer_sync(&bnx2i_ep->ofld_timer); bnx2i_hw_ep_disconnect() 2103 bnx2i_ep_active_list_del(hba, bnx2i_ep); bnx2i_hw_ep_disconnect() 2104 if (bnx2i_tear_down_conn(hba, bnx2i_ep)) bnx2i_hw_ep_disconnect() 2107 bnx2i_ep->state = EP_STATE_IDLE; bnx2i_hw_ep_disconnect() 2120 struct bnx2i_endpoint *bnx2i_ep; bnx2i_ep_disconnect() local 2125 bnx2i_ep = ep->dd_data; bnx2i_ep_disconnect() 2131 while ((bnx2i_ep->state == EP_STATE_CONNECT_START) && bnx2i_ep_disconnect() 2132 !time_after(jiffies, bnx2i_ep->timestamp + (12 * HZ))) bnx2i_ep_disconnect() 2135 if (bnx2i_ep->conn) { bnx2i_ep_disconnect() 2136 bnx2i_conn = bnx2i_ep->conn; bnx2i_ep_disconnect() 2140 hba = bnx2i_ep->hba; bnx2i_ep_disconnect() 2144 if (bnx2i_ep->state == EP_STATE_DISCONN_TIMEDOUT) bnx2i_ep_disconnect() 2147 if (bnx2i_ep->state == EP_STATE_IDLE) bnx2i_ep_disconnect() 2151 (bnx2i_ep->hba_age != hba->age)) { bnx2i_ep_disconnect() 2152 bnx2i_ep_active_list_del(hba, bnx2i_ep); bnx2i_ep_disconnect() 2157 if (bnx2i_hw_ep_disconnect(bnx2i_ep)) { bnx2i_ep_disconnect() 2162 bnx2i_free_qp_resc(hba, bnx2i_ep); bnx2i_ep_disconnect()
|