forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
....@@ -95,7 +95,7 @@
9595 .eh_device_reset_handler = iscsi_eh_device_reset,
9696 .eh_target_reset_handler = iscsi_eh_recover_target,
9797 .target_alloc = iscsi_target_alloc,
98
- .use_clustering = DISABLE_CLUSTERING,
98
+ .dma_boundary = PAGE_SIZE - 1,
9999 .this_id = -1,
100100 .track_queue_depth = 1,
101101 };
....@@ -117,6 +117,7 @@
117117 /* connection management */
118118 .create_conn = cxgbi_create_conn,
119119 .bind_conn = cxgbi_bind_conn,
120
+ .unbind_conn = iscsi_conn_unbind,
120121 .destroy_conn = iscsi_tcp_conn_teardown,
121122 .start_conn = iscsi_conn_start,
122123 .stop_conn = iscsi_conn_stop,
....@@ -361,7 +362,7 @@
361362 /* len includes the length of any HW ULP additions */
362363 req->len = htonl(len);
363364 /* V_TX_ULP_SUBMODE sets both the mode and submode */
364
- req->flags = htonl(V_TX_ULP_SUBMODE(cxgbi_skcb_ulp_mode(skb)) |
365
+ req->flags = htonl(V_TX_ULP_SUBMODE(cxgbi_skcb_tx_ulp_mode(skb)) |
365366 V_TX_SHOVE((skb_peek(&csk->write_queue) ? 0 : 1)));
366367 req->sndseq = htonl(csk->snd_nxt);
367368 req->param = htonl(V_TX_PORT(l2t->smt_idx));
....@@ -375,10 +376,8 @@
375376 }
376377 }
377378
378
-/**
379
+/*
379380 * push_tx_frames -- start transmit
380
- * @c3cn: the offloaded connection
381
- * @req_completion: request wr_ack or not
382381 *
383382 * Prepends TX_DATA_WR or CPL_CLOSE_CON_REQ headers to buffers waiting in a
384383 * connection's send queue and sends them on to T3. Must be called with the
....@@ -442,7 +441,7 @@
442441 req_completion = 1;
443442 csk->wr_una_cred = 0;
444443 }
445
- len += cxgbi_ulp_extra_len(cxgbi_skcb_ulp_mode(skb));
444
+ len += cxgbi_ulp_extra_len(cxgbi_skcb_tx_ulp_mode(skb));
446445 make_tx_data_wr(csk, skb, len, req_completion);
447446 csk->snd_nxt += len;
448447 cxgbi_skcb_clear_flag(skb, SKCBF_TX_NEED_HDR);
....@@ -645,7 +644,7 @@
645644 int *need_rst)
646645 {
647646 switch (abort_reason) {
648
- case CPL_ERR_BAD_SYN: /* fall through */
647
+ case CPL_ERR_BAD_SYN:
649648 case CPL_ERR_CONN_RESET:
650649 return csk->state > CTP_ESTABLISHED ? -EPIPE : -ECONNRESET;
651650 case CPL_ERR_XMIT_TIMEDOUT:
....@@ -886,11 +885,6 @@
886885 return -ENOMEM;
887886 }
888887
889
-/**
890
- * release_offload_resources - release offload resource
891
- * @c3cn: the offloaded iscsi tcp connection.
892
- * Release resources held by an offload connection (TID, L2T entry, etc.)
893
- */
894888 static void l2t_put(struct cxgbi_sock *csk)
895889 {
896890 struct t3cdev *t3dev = (struct t3cdev *)csk->cdev->lldev;
....@@ -902,6 +896,10 @@
902896 }
903897 }
904898
899
+/*
900
+ * release_offload_resources - release offload resource
901
+ * Release resources held by an offload connection (TID, L2T entry, etc.)
902
+ */
905903 static void release_offload_resources(struct cxgbi_sock *csk)
906904 {
907905 struct t3cdev *t3dev = (struct t3cdev *)csk->cdev->lldev;
....@@ -959,6 +957,7 @@
959957 struct net_device *ndev = cdev->ports[csk->port_id];
960958 struct cxgbi_hba *chba = cdev->hbas[csk->port_id];
961959 struct sk_buff *skb = NULL;
960
+ int ret;
962961
963962 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
964963 "csk 0x%p,%u,0x%lx.\n", csk, csk->state, csk->flags);
....@@ -979,14 +978,17 @@
979978 csk->atid = cxgb3_alloc_atid(t3dev, &t3_client, csk);
980979 if (csk->atid < 0) {
981980 pr_err("NO atid available.\n");
982
- goto rel_resource;
981
+ ret = -EINVAL;
982
+ goto put_sock;
983983 }
984984 cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
985985 cxgbi_sock_get(csk);
986986
987987 skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
988
- if (!skb)
989
- goto rel_resource;
988
+ if (!skb) {
989
+ ret = -ENOMEM;
990
+ goto free_atid;
991
+ }
990992 skb->sk = (struct sock *)csk;
991993 set_arp_failure_handler(skb, act_open_arp_failure);
992994 csk->snd_win = cxgb3i_snd_win;
....@@ -1008,10 +1010,14 @@
10081010 send_act_open_req(csk, skb, csk->l2t);
10091011 return 0;
10101012
1011
-rel_resource:
1012
- if (skb)
1013
- __kfree_skb(skb);
1014
- return -EINVAL;
1013
+free_atid:
1014
+ cxgb3_free_atid(t3dev, csk->atid);
1015
+put_sock:
1016
+ cxgbi_sock_put(csk);
1017
+ l2t_release(t3dev, csk->l2t);
1018
+ csk->l2t = NULL;
1019
+
1020
+ return ret;
10151021 }
10161022
10171023 cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS] = {
....@@ -1245,8 +1251,12 @@
12451251 tformat.pgsz_order[i] = uinfo.pgsz_factor[i];
12461252 cxgbi_tagmask_check(tagmask, &tformat);
12471253
1248
- cxgbi_ddp_ppm_setup(&tdev->ulp_iscsi, cdev, &tformat, ppmax,
1249
- uinfo.llimit, uinfo.llimit, 0);
1254
+ err = cxgbi_ddp_ppm_setup(&tdev->ulp_iscsi, cdev, &tformat,
1255
+ (uinfo.ulimit - uinfo.llimit + 1),
1256
+ uinfo.llimit, uinfo.llimit, 0, 0, 0);
1257
+ if (err)
1258
+ return err;
1259
+
12501260 if (!(cdev->flags & CXGBI_FLAG_DDP_OFF)) {
12511261 uinfo.tagmask = tagmask;
12521262 uinfo.ulimit = uinfo.llimit + (ppmax << PPOD_SIZE_SHIFT);
....@@ -1320,7 +1330,7 @@
13201330
13211331 err = cxgb3i_ddp_init(cdev);
13221332 if (err) {
1323
- pr_info("0x%p ddp init failed\n", cdev);
1333
+ pr_info("0x%p ddp init failed %d\n", cdev, err);
13241334 goto err_out;
13251335 }
13261336