Lines Matching refs:qedi

17 int qedi_recover_all_conns(struct qedi_ctx *qedi)  in qedi_recover_all_conns()  argument
22 for (i = 0; i < qedi->max_active_conns; i++) { in qedi_recover_all_conns()
23 qedi_conn = qedi_get_conn_from_id(qedi, i); in qedi_recover_all_conns()
27 qedi_start_conn_recovery(qedi, qedi_conn); in qedi_recover_all_conns()
36 struct qedi_ctx *qedi; in qedi_eh_host_reset() local
38 qedi = iscsi_host_priv(shost); in qedi_eh_host_reset()
40 return qedi_recover_all_conns(qedi); in qedi_eh_host_reset()
64 static void qedi_conn_free_login_resources(struct qedi_ctx *qedi, in qedi_conn_free_login_resources() argument
68 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE, in qedi_conn_free_login_resources()
75 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE, in qedi_conn_free_login_resources()
82 dma_free_coherent(&qedi->pdev->dev, in qedi_conn_free_login_resources()
90 dma_free_coherent(&qedi->pdev->dev, in qedi_conn_free_login_resources()
98 static int qedi_conn_alloc_login_resources(struct qedi_ctx *qedi, in qedi_conn_alloc_login_resources() argument
102 dma_alloc_coherent(&qedi->pdev->dev, in qedi_conn_alloc_login_resources()
113 dma_alloc_coherent(&qedi->pdev->dev, in qedi_conn_alloc_login_resources()
124 dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE, in qedi_conn_alloc_login_resources()
130 dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE, in qedi_conn_alloc_login_resources()
136 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SESS, in qedi_conn_alloc_login_resources()
142 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE, in qedi_conn_alloc_login_resources()
148 dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN, in qedi_conn_alloc_login_resources()
153 dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN, in qedi_conn_alloc_login_resources()
163 static void qedi_destroy_cmd_pool(struct qedi_ctx *qedi, in qedi_destroy_cmd_pool() argument
173 dma_free_coherent(&qedi->pdev->dev, in qedi_destroy_cmd_pool()
180 dma_free_coherent(&qedi->pdev->dev, in qedi_destroy_cmd_pool()
187 static int qedi_alloc_sget(struct qedi_ctx *qedi, struct iscsi_session *session, in qedi_alloc_sget() argument
193 io->sge_tbl = dma_alloc_coherent(&qedi->pdev->dev, in qedi_alloc_sget()
207 static int qedi_setup_cmd_pool(struct qedi_ctx *qedi, in qedi_setup_cmd_pool() argument
219 if (qedi_alloc_sget(qedi, session, cmd)) in qedi_setup_cmd_pool()
222 cmd->sense_buffer = dma_alloc_coherent(&qedi->pdev->dev, in qedi_setup_cmd_pool()
233 qedi_destroy_cmd_pool(qedi, session); in qedi_setup_cmd_pool()
243 struct qedi_ctx *qedi; in qedi_session_create() local
250 shost = qedi_ep->qedi->shost; in qedi_session_create()
251 qedi = iscsi_host_priv(shost); in qedi_session_create()
253 if (cmds_max > qedi->max_sqes) in qedi_session_create()
254 cmds_max = qedi->max_sqes; in qedi_session_create()
262 QEDI_ERR(&qedi->dbg_ctx, in qedi_session_create()
267 if (qedi_setup_cmd_pool(qedi, cls_session->dd_data)) { in qedi_session_create()
268 QEDI_ERR(&qedi->dbg_ctx, in qedi_session_create()
284 struct qedi_ctx *qedi = iscsi_host_priv(shost); in qedi_session_destroy() local
286 qedi_destroy_cmd_pool(qedi, session); in qedi_session_destroy()
294 struct qedi_ctx *qedi = iscsi_host_priv(shost); in qedi_conn_create() local
302 QEDI_ERR(&qedi->dbg_ctx, in qedi_conn_create()
311 qedi_conn->qedi = qedi; in qedi_conn_create()
317 if (qedi_conn_alloc_login_resources(qedi, qedi_conn)) { in qedi_conn_create()
337 set_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); in qedi_mark_device_missing()
347 clear_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); in qedi_mark_device_available()
351 static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi, in qedi_bind_conn_to_iscsi_cid() argument
356 if (qedi->cid_que.conn_cid_tbl[iscsi_cid]) { in qedi_bind_conn_to_iscsi_cid()
363 qedi->cid_que.conn_cid_tbl[iscsi_cid] = qedi_conn; in qedi_bind_conn_to_iscsi_cid()
367 struct qedi_conn *qedi_get_conn_from_id(struct qedi_ctx *qedi, u32 iscsi_cid) in qedi_get_conn_from_id() argument
369 if (!qedi->cid_que.conn_cid_tbl) { in qedi_get_conn_from_id()
370 QEDI_ERR(&qedi->dbg_ctx, "missing conn<->cid table\n"); in qedi_get_conn_from_id()
373 } else if (iscsi_cid >= qedi->max_active_conns) { in qedi_get_conn_from_id()
374 QEDI_ERR(&qedi->dbg_ctx, "wrong cid #%d\n", iscsi_cid); in qedi_get_conn_from_id()
377 return qedi->cid_que.conn_cid_tbl[iscsi_cid]; in qedi_get_conn_from_id()
387 struct qedi_ctx *qedi = iscsi_host_priv(shost); in qedi_conn_bind() local
417 if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) { in qedi_conn_bind()
431 static int qedi_iscsi_update_conn(struct qedi_ctx *qedi, in qedi_iscsi_update_conn() argument
444 QEDI_ERR(&qedi->dbg_ctx, "memory alloc failed\n"); in qedi_iscsi_update_conn()
471 rval = qedi_ops->update_conn(qedi->cdev, qedi_ep->handle, in qedi_iscsi_update_conn()
475 QEDI_ERR(&qedi->dbg_ctx, "Could not update connection\n"); in qedi_iscsi_update_conn()
503 struct qedi_ctx *qedi = qedi_ep->qedi; in qedi_iscsi_offload_conn() local
509 QEDI_ERR(&qedi->dbg_ctx, in qedi_iscsi_offload_conn()
522 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN, in qedi_iscsi_offload_conn()
532 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN, in qedi_iscsi_offload_conn()
549 conn_info->default_cq = (qedi_ep->fw_cid % qedi->num_queues); in qedi_iscsi_offload_conn()
576 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, in qedi_iscsi_offload_conn()
591 rval = qedi_ops->common->db_recovery_add(qedi->cdev, in qedi_iscsi_offload_conn()
601 rval = qedi_ops->offload_conn(qedi->cdev, qedi_ep->handle, conn_info); in qedi_iscsi_offload_conn()
604 rval = qedi_ops->common->db_recovery_del(qedi->cdev, in qedi_iscsi_offload_conn()
608 QEDI_ERR(&qedi->dbg_ctx, "offload_conn returned %d, ep=%p\n", in qedi_iscsi_offload_conn()
620 struct qedi_ctx *qedi; in qedi_conn_start() local
623 qedi = qedi_conn->qedi; in qedi_conn_start()
625 rval = qedi_iscsi_update_conn(qedi, qedi_conn); in qedi_conn_start()
655 struct qedi_ctx *qedi; in qedi_conn_destroy() local
658 qedi = iscsi_host_priv(shost); in qedi_conn_destroy()
660 qedi_conn_free_login_resources(qedi, qedi_conn); in qedi_conn_destroy()
693 struct qedi_ctx *qedi; in qedi_host_get_param() local
696 qedi = iscsi_host_priv(shost); in qedi_host_get_param()
700 len = sysfs_format_mac(buf, qedi->mac, 6); in qedi_host_get_param()
706 if (qedi->ip_type == TCP_IPV4) in qedi_host_get_param()
707 len = sprintf(buf, "%pI4\n", qedi->src_ip); in qedi_host_get_param()
709 len = sprintf(buf, "%pI6\n", qedi->src_ip); in qedi_host_get_param()
724 struct qedi_ctx *qedi; in qedi_conn_get_stats() local
727 qedi = iscsi_host_priv(shost); in qedi_conn_get_stats()
728 qedi_ops->get_stats(qedi->cdev, &iscsi_stats); in qedi_conn_get_stats()
841 if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) in qedi_task_xmit()
844 if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags)) in qedi_task_xmit()
866 struct qedi_ctx *qedi; in qedi_ep_connect() local
889 qedi = iscsi_host_priv(shost); in qedi_ep_connect()
891 if (test_bit(QEDI_IN_OFFLINE, &qedi->flags) || in qedi_ep_connect()
892 test_bit(QEDI_IN_RECOVERY, &qedi->flags)) { in qedi_ep_connect()
897 if (atomic_read(&qedi->link_state) != QEDI_LINK_UP) { in qedi_ep_connect()
898 QEDI_WARN(&qedi->dbg_ctx, "qedi link down\n"); in qedi_ep_connect()
904 QEDI_ERR(&qedi->dbg_ctx, "endpoint create fail\n"); in qedi_ep_connect()
912 qedi_ep->qedi = qedi; in qedi_ep_connect()
920 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN, in qedi_ep_connect()
929 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN, in qedi_ep_connect()
933 QEDI_ERR(&qedi->dbg_ctx, "Invalid endpoint\n"); in qedi_ep_connect()
936 ret = qedi_alloc_sq(qedi, qedi_ep); in qedi_ep_connect()
940 ret = qedi_ops->acquire_conn(qedi->cdev, &qedi_ep->handle, in qedi_ep_connect()
944 QEDI_ERR(&qedi->dbg_ctx, "Could not acquire connection\n"); in qedi_ep_connect()
955 qedi->ep_tbl[iscsi_cid] = qedi_ep; in qedi_ep_connect()
963 path_req.pmtu = qedi->ll2_mtu; in qedi_ep_connect()
964 qedi_ep->pmtu = qedi->ll2_mtu; in qedi_ep_connect()
978 QEDI_ERR(&qedi->dbg_ctx, in qedi_ep_connect()
984 atomic_inc(&qedi->num_offloads); in qedi_ep_connect()
988 qedi->ep_tbl[iscsi_cid] = NULL; in qedi_ep_connect()
989 tmp = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle); in qedi_ep_connect()
991 QEDI_WARN(&qedi->dbg_ctx, "release_conn returned %d\n", in qedi_ep_connect()
994 qedi_free_sq(qedi, qedi_ep); in qedi_ep_connect()
1049 struct qedi_ctx *qedi; in qedi_ep_disconnect() local
1056 qedi = qedi_ep->qedi; in qedi_ep_disconnect()
1068 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, in qedi_ep_disconnect()
1082 if (test_bit(QEDI_IN_RECOVERY, &qedi->flags)) { in qedi_ep_disconnect()
1084 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, in qedi_ep_disconnect()
1089 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, in qedi_ep_disconnect()
1110 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, in qedi_ep_disconnect()
1124 qedi_clearsq(qedi, qedi_conn, NULL); in qedi_ep_disconnect()
1131 wait_delay += qedi->pf_params.iscsi_pf_params.two_msl_timer; in qedi_ep_disconnect()
1135 if (test_bit(QEDI_IN_SHUTDOWN, &qedi->flags) || in qedi_ep_disconnect()
1136 test_bit(QEDI_IN_RECOVERY, &qedi->flags)) in qedi_ep_disconnect()
1140 ret = qedi_ops->common->db_recovery_del(qedi->cdev, in qedi_ep_disconnect()
1144 ret = qedi_ops->destroy_conn(qedi->cdev, qedi_ep->handle, abrt_conn); in qedi_ep_disconnect()
1146 QEDI_WARN(&qedi->dbg_ctx, in qedi_ep_disconnect()
1155 QEDI_WARN(&qedi->dbg_ctx, in qedi_ep_disconnect()
1162 ret = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle); in qedi_ep_disconnect()
1164 QEDI_WARN(&qedi->dbg_ctx, in qedi_ep_disconnect()
1169 qedi->ep_tbl[qedi_ep->iscsi_cid] = NULL; in qedi_ep_disconnect()
1170 qedi->cid_que.conn_cid_tbl[qedi_ep->iscsi_cid] = NULL; in qedi_ep_disconnect()
1171 qedi_free_id(&qedi->lcl_port_tbl, qedi_ep->src_port); in qedi_ep_disconnect()
1172 qedi_free_sq(qedi, qedi_ep); in qedi_ep_disconnect()
1178 qedi_ep->qedi = NULL; in qedi_ep_disconnect()
1179 atomic_dec(&qedi->num_offloads); in qedi_ep_disconnect()
1184 static int qedi_data_avail(struct qedi_ctx *qedi, u16 vlanid) in qedi_data_avail() argument
1186 struct qed_dev *cdev = qedi->cdev; in qedi_data_avail()
1193 udev = qedi->udev; in qedi_data_avail()
1195 QEDI_ERR(&qedi->dbg_ctx, "udev is NULL.\n"); in qedi_data_avail()
1201 QEDI_ERR(&qedi->dbg_ctx, "uctlr is NULL.\n"); in qedi_data_avail()
1207 QEDI_ERR(&qedi->dbg_ctx, "Invalid len %u\n", len); in qedi_data_avail()
1213 QEDI_ERR(&qedi->dbg_ctx, "alloc_skb failed\n"); in qedi_data_avail()
1226 QEDI_ERR(&qedi->dbg_ctx, "ll2 start_xmit returned %d\n", in qedi_data_avail()
1241 struct qedi_ctx *qedi; in qedi_offload_work() local
1245 qedi = qedi_ep->qedi; in qedi_offload_work()
1249 QEDI_ERR(&qedi->dbg_ctx, in qedi_offload_work()
1262 QEDI_ERR(&qedi->dbg_ctx, in qedi_offload_work()
1270 struct qedi_ctx *qedi; in qedi_set_path() local
1289 qedi = iscsi_host_priv(shost); in qedi_set_path()
1291 ret = qedi_data_avail(qedi, path_data->vlan_id); in qedi_set_path()
1296 if (iscsi_cid >= qedi->max_active_conns) { in qedi_set_path()
1300 qedi_ep = qedi->ep_tbl[iscsi_cid]; in qedi_set_path()
1301 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, in qedi_set_path()
1309 QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n"); in qedi_set_path()
1315 ether_addr_copy(&qedi_ep->src_mac[0], &qedi->mac[0]); in qedi_set_path()
1320 qedi_ep->pmtu = qedi->ll2_mtu; in qedi_set_path()
1321 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, in qedi_set_path()
1326 if (path_data->pmtu != qedi->ll2_mtu) { in qedi_set_path()
1333 qedi_reset_host_mtu(qedi, path_data->pmtu); in qedi_set_path()
1334 qedi_ep->pmtu = qedi->ll2_mtu; in qedi_set_path()
1340 if (qedi_alloc_id(&qedi->lcl_port_tbl, port_id)) in qedi_set_path()
1347 port_id = qedi_alloc_new_id(&qedi->lcl_port_tbl); in qedi_set_path()
1349 QEDI_ERR(&qedi->dbg_ctx, in qedi_set_path()
1362 memcpy(&qedi->src_ip[0], &path_data->src.v4_addr, in qedi_set_path()
1364 qedi->ip_type = TCP_IPV4; in qedi_set_path()
1366 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN, in qedi_set_path()
1373 memcpy(&qedi->src_ip[0], &path_data->src.v6_addr, in qedi_set_path()
1375 qedi->ip_type = TCP_IPV6; in qedi_set_path()
1377 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN, in qedi_set_path()
1384 queue_work(qedi->offload_thread, &qedi_ep->offload_work); in qedi_set_path()
1501 void qedi_start_conn_recovery(struct qedi_ctx *qedi, in qedi_start_conn_recovery() argument
1514 QEDI_ERR(&qedi->dbg_ctx, in qedi_start_conn_recovery()
1651 struct qedi_ctx *qedi; in qedi_process_iscsi_error() local
1667 qedi = ep->qedi; in qedi_process_iscsi_error()
1669 QEDI_ERR(&qedi->dbg_ctx, "async event iscsi error:0x%x\n", in qedi_process_iscsi_error()
1691 qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn); in qedi_process_iscsi_error()
1706 QEDI_ERR(&ep->qedi->dbg_ctx, "async event TCP error:0x%x\n", in qedi_process_tcp_error()
1709 qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn); in qedi_process_tcp_error()