Lines Matching defs:qedi
13 #include "qedi.h"
17 int qedi_recover_all_conns(struct qedi_ctx *qedi)
22 for (i = 0; i < qedi->max_active_conns; i++) {
23 qedi_conn = qedi_get_conn_from_id(qedi, i);
27 qedi_start_conn_recovery(qedi, qedi_conn);
36 struct qedi_ctx *qedi;
38 qedi = iscsi_host_priv(shost);
40 return qedi_recover_all_conns(qedi);
64 static void qedi_conn_free_login_resources(struct qedi_ctx *qedi,
68 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
75 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
82 dma_free_coherent(&qedi->pdev->dev,
90 dma_free_coherent(&qedi->pdev->dev,
98 static int qedi_conn_alloc_login_resources(struct qedi_ctx *qedi,
102 dma_alloc_coherent(&qedi->pdev->dev,
113 dma_alloc_coherent(&qedi->pdev->dev,
124 dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
130 dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
136 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SESS,
142 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
148 dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN,
153 dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN,
163 static void qedi_destroy_cmd_pool(struct qedi_ctx *qedi,
173 dma_free_coherent(&qedi->pdev->dev,
180 dma_free_coherent(&qedi->pdev->dev,
187 static int qedi_alloc_sget(struct qedi_ctx *qedi, struct iscsi_session *session,
193 io->sge_tbl = dma_alloc_coherent(&qedi->pdev->dev,
207 static int qedi_setup_cmd_pool(struct qedi_ctx *qedi,
219 if (qedi_alloc_sget(qedi, session, cmd))
222 cmd->sense_buffer = dma_alloc_coherent(&qedi->pdev->dev,
233 qedi_destroy_cmd_pool(qedi, session);
243 struct qedi_ctx *qedi;
250 shost = qedi_ep->qedi->shost;
251 qedi = iscsi_host_priv(shost);
253 if (cmds_max > qedi->max_sqes)
254 cmds_max = qedi->max_sqes;
262 QEDI_ERR(&qedi->dbg_ctx,
267 if (qedi_setup_cmd_pool(qedi, cls_session->dd_data)) {
268 QEDI_ERR(&qedi->dbg_ctx,
284 struct qedi_ctx *qedi = iscsi_host_priv(shost);
286 qedi_destroy_cmd_pool(qedi, session);
294 struct qedi_ctx *qedi = iscsi_host_priv(shost);
302 QEDI_ERR(&qedi->dbg_ctx,
311 qedi_conn->qedi = qedi;
317 if (qedi_conn_alloc_login_resources(qedi, qedi_conn)) {
337 set_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags);
347 clear_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags);
351 static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi,
356 if (qedi->cid_que.conn_cid_tbl[iscsi_cid]) {
363 qedi->cid_que.conn_cid_tbl[iscsi_cid] = qedi_conn;
367 struct qedi_conn *qedi_get_conn_from_id(struct qedi_ctx *qedi, u32 iscsi_cid)
369 if (!qedi->cid_que.conn_cid_tbl) {
370 QEDI_ERR(&qedi->dbg_ctx, "missing conn<->cid table\n");
373 } else if (iscsi_cid >= qedi->max_active_conns) {
374 QEDI_ERR(&qedi->dbg_ctx, "wrong cid #%d\n", iscsi_cid);
377 return qedi->cid_que.conn_cid_tbl[iscsi_cid];
387 struct qedi_ctx *qedi = iscsi_host_priv(shost);
417 if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) {
431 static int qedi_iscsi_update_conn(struct qedi_ctx *qedi,
444 QEDI_ERR(&qedi->dbg_ctx, "memory alloc failed\n");
471 rval = qedi_ops->update_conn(qedi->cdev, qedi_ep->handle,
475 QEDI_ERR(&qedi->dbg_ctx, "Could not update connection\n");
502 struct qedi_ctx *qedi = qedi_ep->qedi;
509 QEDI_ERR(&qedi->dbg_ctx,
522 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
532 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
549 conn_info->default_cq = (qedi_ep->fw_cid % qedi->num_queues);
576 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
580 rval = qedi_ops->offload_conn(qedi->cdev, qedi_ep->handle, conn_info);
582 QEDI_ERR(&qedi->dbg_ctx, "offload_conn returned %d, ep=%p\n",
593 struct qedi_ctx *qedi;
596 qedi = qedi_conn->qedi;
598 rval = qedi_iscsi_update_conn(qedi, qedi_conn);
624 struct qedi_ctx *qedi;
627 qedi = iscsi_host_priv(shost);
629 qedi_conn_free_login_resources(qedi, qedi_conn);
662 struct qedi_ctx *qedi;
665 qedi = iscsi_host_priv(shost);
669 len = sysfs_format_mac(buf, qedi->mac, 6);
675 if (qedi->ip_type == TCP_IPV4)
676 len = sprintf(buf, "%pI4\n", qedi->src_ip);
678 len = sprintf(buf, "%pI6\n", qedi->src_ip);
693 struct qedi_ctx *qedi;
696 qedi = iscsi_host_priv(shost);
697 qedi_ops->get_stats(qedi->cdev, &iscsi_stats);
810 if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags))
813 if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags))
835 struct qedi_ctx *qedi;
839 qedi = qedi_ep->qedi;
843 QEDI_ERR(&qedi->dbg_ctx,
856 QEDI_ERR(&qedi->dbg_ctx,
866 struct qedi_ctx *qedi;
889 qedi = iscsi_host_priv(shost);
891 if (test_bit(QEDI_IN_OFFLINE, &qedi->flags) ||
892 test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
897 if (atomic_read(&qedi->link_state) != QEDI_LINK_UP) {
898 QEDI_WARN(&qedi->dbg_ctx, "qedi link down\n");
904 QEDI_ERR(&qedi->dbg_ctx, "endpoint create fail\n");
913 qedi_ep->qedi = qedi;
921 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
930 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
934 QEDI_ERR(&qedi->dbg_ctx, "Invalid endpoint\n");
937 ret = qedi_alloc_sq(qedi, qedi_ep);
941 ret = qedi_ops->acquire_conn(qedi->cdev, &qedi_ep->handle,
945 QEDI_ERR(&qedi->dbg_ctx, "Could not acquire connection\n");
956 qedi->ep_tbl[iscsi_cid] = qedi_ep;
964 path_req.pmtu = qedi->ll2_mtu;
965 qedi_ep->pmtu = qedi->ll2_mtu;
979 QEDI_ERR(&qedi->dbg_ctx,
985 atomic_inc(&qedi->num_offloads);
989 qedi->ep_tbl[iscsi_cid] = NULL;
990 tmp = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle);
992 QEDI_WARN(&qedi->dbg_ctx, "release_conn returned %d\n",
995 qedi_free_sq(qedi, qedi_ep);
1051 struct qedi_ctx *qedi;
1059 qedi = qedi_ep->qedi;
1080 if (test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
1082 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1087 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1108 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1122 qedi_clearsq(qedi, qedi_conn, NULL);
1129 wait_delay += qedi->pf_params.iscsi_pf_params.two_msl_timer;
1133 if (test_bit(QEDI_IN_SHUTDOWN, &qedi->flags) ||
1134 test_bit(QEDI_IN_RECOVERY, &qedi->flags))
1137 ret = qedi_ops->destroy_conn(qedi->cdev, qedi_ep->handle, abrt_conn);
1139 QEDI_WARN(&qedi->dbg_ctx,
1148 QEDI_WARN(&qedi->dbg_ctx,
1155 ret = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle);
1157 QEDI_WARN(&qedi->dbg_ctx,
1162 qedi->ep_tbl[qedi_ep->iscsi_cid] = NULL;
1163 qedi->cid_que.conn_cid_tbl[qedi_ep->iscsi_cid] = NULL;
1164 qedi_free_id(&qedi->lcl_port_tbl, qedi_ep->src_port);
1165 qedi_free_sq(qedi, qedi_ep);
1171 qedi_ep->qedi = NULL;
1172 atomic_dec(&qedi->num_offloads);
1177 static int qedi_data_avail(struct qedi_ctx *qedi, u16 vlanid)
1179 struct qed_dev *cdev = qedi->cdev;
1186 udev = qedi->udev;
1188 QEDI_ERR(&qedi->dbg_ctx, "udev is NULL.\n");
1194 QEDI_ERR(&qedi->dbg_ctx, "uctlr is NULL.\n");
1200 QEDI_ERR(&qedi->dbg_ctx, "Invalid len %u\n", len);
1206 QEDI_ERR(&qedi->dbg_ctx, "alloc_skb failed\n");
1219 QEDI_ERR(&qedi->dbg_ctx, "ll2 start_xmit returned %d\n",
1232 struct qedi_ctx *qedi;
1244 if (strcmp(shost->hostt->proc_name, "qedi")) {
1251 qedi = iscsi_host_priv(shost);
1253 ret = qedi_data_avail(qedi, path_data->vlan_id);
1258 if (iscsi_cid >= qedi->max_active_conns) {
1262 qedi_ep = qedi->ep_tbl[iscsi_cid];
1263 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1271 QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n");
1277 ether_addr_copy(&qedi_ep->src_mac[0], &qedi->mac[0]);
1282 qedi_ep->pmtu = qedi->ll2_mtu;
1283 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1288 if (path_data->pmtu != qedi->ll2_mtu) {
1295 qedi_reset_host_mtu(qedi, path_data->pmtu);
1296 qedi_ep->pmtu = qedi->ll2_mtu;
1302 if (qedi_alloc_id(&qedi->lcl_port_tbl, port_id))
1309 port_id = qedi_alloc_new_id(&qedi->lcl_port_tbl);
1311 QEDI_ERR(&qedi->dbg_ctx,
1324 memcpy(&qedi->src_ip[0], &path_data->src.v4_addr,
1326 qedi->ip_type = TCP_IPV4;
1328 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
1335 memcpy(&qedi->src_ip[0], &path_data->src.v6_addr,
1337 qedi->ip_type = TCP_IPV6;
1339 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
1345 queue_work(qedi->offload_thread, &qedi_ep->offload_work);
1462 void qedi_start_conn_recovery(struct qedi_ctx *qedi,
1475 QEDI_ERR(&qedi->dbg_ctx,
1612 struct qedi_ctx *qedi;
1628 qedi = ep->qedi;
1630 QEDI_ERR(&qedi->dbg_ctx, "async event iscsi error:0x%x\n",
1649 "qedi: %s - %s\n", message, msg);
1652 qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn);
1681 QEDI_ERR(&ep->qedi->dbg_ctx, "async event TCP error:0x%x\n",
1684 qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn);