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);
65 static void qedi_conn_free_login_resources(struct qedi_ctx *qedi,
69 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
76 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
83 dma_free_coherent(&qedi->pdev->dev,
91 dma_free_coherent(&qedi->pdev->dev,
99 static int qedi_conn_alloc_login_resources(struct qedi_ctx *qedi,
103 dma_alloc_coherent(&qedi->pdev->dev,
114 dma_alloc_coherent(&qedi->pdev->dev,
125 dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
131 dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
137 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SESS,
143 dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
149 dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN,
154 dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN,
164 static void qedi_destroy_cmd_pool(struct qedi_ctx *qedi,
174 dma_free_coherent(&qedi->pdev->dev,
181 dma_free_coherent(&qedi->pdev->dev,
188 static int qedi_alloc_sget(struct qedi_ctx *qedi, struct iscsi_session *session,
194 io->sge_tbl = dma_alloc_coherent(&qedi->pdev->dev,
208 static int qedi_setup_cmd_pool(struct qedi_ctx *qedi,
220 if (qedi_alloc_sget(qedi, session, cmd))
223 cmd->sense_buffer = dma_alloc_coherent(&qedi->pdev->dev,
234 qedi_destroy_cmd_pool(qedi, session);
244 struct qedi_ctx *qedi;
251 shost = qedi_ep->qedi->shost;
252 qedi = iscsi_host_priv(shost);
254 if (cmds_max > qedi->max_sqes)
255 cmds_max = qedi->max_sqes;
263 QEDI_ERR(&qedi->dbg_ctx,
268 if (qedi_setup_cmd_pool(qedi, cls_session->dd_data)) {
269 QEDI_ERR(&qedi->dbg_ctx,
285 struct qedi_ctx *qedi = iscsi_host_priv(shost);
287 qedi_destroy_cmd_pool(qedi, session);
295 struct qedi_ctx *qedi = iscsi_host_priv(shost);
303 QEDI_ERR(&qedi->dbg_ctx,
312 qedi_conn->qedi = qedi;
318 if (qedi_conn_alloc_login_resources(qedi, qedi_conn)) {
338 set_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags);
348 clear_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags);
352 static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi,
357 if (qedi->cid_que.conn_cid_tbl[iscsi_cid]) {
364 qedi->cid_que.conn_cid_tbl[iscsi_cid] = qedi_conn;
368 struct qedi_conn *qedi_get_conn_from_id(struct qedi_ctx *qedi, u32 iscsi_cid)
370 if (!qedi->cid_que.conn_cid_tbl) {
371 QEDI_ERR(&qedi->dbg_ctx, "missing conn<->cid table\n");
374 } else if (iscsi_cid >= qedi->max_active_conns) {
375 QEDI_ERR(&qedi->dbg_ctx, "wrong cid #%d\n", iscsi_cid);
378 return qedi->cid_que.conn_cid_tbl[iscsi_cid];
388 struct qedi_ctx *qedi = iscsi_host_priv(shost);
418 if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) {
432 static int qedi_iscsi_update_conn(struct qedi_ctx *qedi,
445 QEDI_ERR(&qedi->dbg_ctx, "memory alloc failed\n");
472 rval = qedi_ops->update_conn(qedi->cdev, qedi_ep->handle,
476 QEDI_ERR(&qedi->dbg_ctx, "Could not update connection\n");
504 struct qedi_ctx *qedi = qedi_ep->qedi;
510 QEDI_ERR(&qedi->dbg_ctx,
523 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
533 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
550 conn_info->default_cq = (qedi_ep->fw_cid % qedi->num_queues);
577 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
592 rval = qedi_ops->common->db_recovery_add(qedi->cdev,
602 rval = qedi_ops->offload_conn(qedi->cdev, qedi_ep->handle, conn_info);
605 rval = qedi_ops->common->db_recovery_del(qedi->cdev,
609 QEDI_ERR(&qedi->dbg_ctx, "offload_conn returned %d, ep=%p\n",
621 struct qedi_ctx *qedi;
624 qedi = qedi_conn->qedi;
626 rval = qedi_iscsi_update_conn(qedi, qedi_conn);
656 struct qedi_ctx *qedi;
659 qedi = iscsi_host_priv(shost);
661 qedi_conn_free_login_resources(qedi, qedi_conn);
694 struct qedi_ctx *qedi;
697 qedi = iscsi_host_priv(shost);
701 len = sysfs_format_mac(buf, qedi->mac, 6);
707 if (qedi->ip_type == TCP_IPV4)
708 len = sprintf(buf, "%pI4\n", qedi->src_ip);
710 len = sprintf(buf, "%pI6\n", qedi->src_ip);
725 struct qedi_ctx *qedi;
728 qedi = iscsi_host_priv(shost);
729 qedi_ops->get_stats(qedi->cdev, &iscsi_stats);
842 if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags))
845 if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags))
867 struct qedi_ctx *qedi;
871 qedi = qedi_ep->qedi;
875 QEDI_ERR(&qedi->dbg_ctx,
888 QEDI_ERR(&qedi->dbg_ctx,
898 struct qedi_ctx *qedi;
921 qedi = iscsi_host_priv(shost);
923 if (test_bit(QEDI_IN_OFFLINE, &qedi->flags) ||
924 test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
929 if (atomic_read(&qedi->link_state) != QEDI_LINK_UP) {
930 QEDI_WARN(&qedi->dbg_ctx, "qedi link down\n");
936 QEDI_ERR(&qedi->dbg_ctx, "endpoint create fail\n");
945 qedi_ep->qedi = qedi;
953 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
962 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
966 QEDI_ERR(&qedi->dbg_ctx, "Invalid endpoint\n");
969 ret = qedi_alloc_sq(qedi, qedi_ep);
973 ret = qedi_ops->acquire_conn(qedi->cdev, &qedi_ep->handle,
977 QEDI_ERR(&qedi->dbg_ctx, "Could not acquire connection\n");
988 qedi->ep_tbl[iscsi_cid] = qedi_ep;
996 path_req.pmtu = qedi->ll2_mtu;
997 qedi_ep->pmtu = qedi->ll2_mtu;
1011 QEDI_ERR(&qedi->dbg_ctx,
1017 atomic_inc(&qedi->num_offloads);
1021 qedi->ep_tbl[iscsi_cid] = NULL;
1022 tmp = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle);
1024 QEDI_WARN(&qedi->dbg_ctx, "release_conn returned %d\n",
1027 qedi_free_sq(qedi, qedi_ep);
1082 struct qedi_ctx *qedi;
1089 qedi = qedi_ep->qedi;
1100 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1114 if (test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
1116 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1121 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1142 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1156 qedi_clearsq(qedi, qedi_conn, NULL);
1163 wait_delay += qedi->pf_params.iscsi_pf_params.two_msl_timer;
1167 if (test_bit(QEDI_IN_SHUTDOWN, &qedi->flags) ||
1168 test_bit(QEDI_IN_RECOVERY, &qedi->flags))
1172 ret = qedi_ops->common->db_recovery_del(qedi->cdev,
1176 ret = qedi_ops->destroy_conn(qedi->cdev, qedi_ep->handle, abrt_conn);
1178 QEDI_WARN(&qedi->dbg_ctx,
1187 QEDI_WARN(&qedi->dbg_ctx,
1194 ret = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle);
1196 QEDI_WARN(&qedi->dbg_ctx,
1201 qedi->ep_tbl[qedi_ep->iscsi_cid] = NULL;
1202 qedi->cid_que.conn_cid_tbl[qedi_ep->iscsi_cid] = NULL;
1203 qedi_free_id(&qedi->lcl_port_tbl, qedi_ep->src_port);
1204 qedi_free_sq(qedi, qedi_ep);
1210 qedi_ep->qedi = NULL;
1211 atomic_dec(&qedi->num_offloads);
1216 static int qedi_data_avail(struct qedi_ctx *qedi, u16 vlanid)
1218 struct qed_dev *cdev = qedi->cdev;
1225 udev = qedi->udev;
1227 QEDI_ERR(&qedi->dbg_ctx, "udev is NULL.\n");
1233 QEDI_ERR(&qedi->dbg_ctx, "uctlr is NULL.\n");
1239 QEDI_ERR(&qedi->dbg_ctx, "Invalid len %u\n", len);
1245 QEDI_ERR(&qedi->dbg_ctx, "alloc_skb failed\n");
1258 QEDI_ERR(&qedi->dbg_ctx, "ll2 start_xmit returned %d\n",
1271 struct qedi_ctx *qedi;
1283 if (strcmp(shost->hostt->proc_name, "qedi")) {
1290 qedi = iscsi_host_priv(shost);
1292 ret = qedi_data_avail(qedi, path_data->vlan_id);
1297 if (iscsi_cid >= qedi->max_active_conns) {
1301 qedi_ep = qedi->ep_tbl[iscsi_cid];
1302 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1310 QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n");
1316 ether_addr_copy(&qedi_ep->src_mac[0], &qedi->mac[0]);
1321 qedi_ep->pmtu = qedi->ll2_mtu;
1322 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1327 if (path_data->pmtu != qedi->ll2_mtu) {
1334 qedi_reset_host_mtu(qedi, path_data->pmtu);
1335 qedi_ep->pmtu = qedi->ll2_mtu;
1341 if (qedi_alloc_id(&qedi->lcl_port_tbl, port_id))
1348 port_id = qedi_alloc_new_id(&qedi->lcl_port_tbl);
1350 QEDI_ERR(&qedi->dbg_ctx,
1363 memcpy(&qedi->src_ip[0], &path_data->src.v4_addr,
1365 qedi->ip_type = TCP_IPV4;
1367 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
1374 memcpy(&qedi->src_ip[0], &path_data->src.v6_addr,
1376 qedi->ip_type = TCP_IPV6;
1378 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
1384 queue_work(qedi->offload_thread, &qedi_ep->offload_work);
1501 void qedi_start_conn_recovery(struct qedi_ctx *qedi,
1514 QEDI_ERR(&qedi->dbg_ctx,
1651 struct qedi_ctx *qedi;
1667 qedi = ep->qedi;
1669 QEDI_ERR(&qedi->dbg_ctx, "async event iscsi error:0x%x\n",
1688 "qedi: %s - %s\n", message, msg);
1691 qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn);
1706 QEDI_ERR(&ep->qedi->dbg_ctx, "async event TCP error:0x%x\n",
1709 qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn);