Lines Matching +full:no +full:- +full:big +full:- +full:frame +full:- +full:no

1 // SPDX-License-Identifier: GPL-2.0-only
11 * Copyright (c) 2009 Linux-iSCSI.org
12 * Copyright (c) 2009 Nicholas A. Bellinger <nab@linux-iscsi.org>
64 if (cmd->aborted) in ft_queue_data_in()
67 if (se_cmd->scsi_status == SAM_STAT_TASK_SET_FULL) in ft_queue_data_in()
70 ep = fc_seq_exch(cmd->seq); in ft_queue_data_in()
71 lport = ep->lp; in ft_queue_data_in()
72 cmd->seq = fc_seq_start_next(cmd->seq); in ft_queue_data_in()
74 remaining = se_cmd->data_length; in ft_queue_data_in()
77 * Setup to use first mem list entry, unless no data. in ft_queue_data_in()
79 BUG_ON(remaining && !se_cmd->t_data_sg); in ft_queue_data_in()
81 sg = se_cmd->t_data_sg; in ft_queue_data_in()
82 mem_len = sg->length; in ft_queue_data_in()
83 mem_off = sg->offset; in ft_queue_data_in()
87 /* no scatter/gather in skb for odd word length due to fc_seq_send() */ in ft_queue_data_in()
91 struct fc_seq *seq = cmd->seq; in ft_queue_data_in()
95 __func__, ep->xid); in ft_queue_data_in()
100 mem_len = min((size_t)sg->length, remaining); in ft_queue_data_in()
101 mem_off = sg->offset; in ft_queue_data_in()
107 * , then allow 'frame_len' to be as big as 'lso_max' in ft_queue_data_in()
108 * if indicated transfer length is >= lport->lso_max in ft_queue_data_in()
110 frame_len = (lport->seq_offload) ? lport->lso_max : in ft_queue_data_in()
111 cmd->sess->max_frame; in ft_queue_data_in()
115 return -ENOMEM; in ft_queue_data_in()
120 * Setup the frame's max payload which is used by base in ft_queue_data_in()
121 * driver to indicate HW about max frame size, so that in ft_queue_data_in()
125 fr_max_payload(fp) = cmd->sess->max_frame; in ft_queue_data_in()
134 skb_shinfo(fp_skb(fp))->nr_frags, in ft_queue_data_in()
137 fp_skb(fp)->data_len += tlen; in ft_queue_data_in()
138 fp_skb(fp)->truesize += page_size(page); in ft_queue_data_in()
144 tlen = min(tlen, (size_t)(PAGE_SIZE - in ft_queue_data_in()
152 mem_len -= tlen; in ft_queue_data_in()
153 frame_len -= tlen; in ft_queue_data_in()
154 remaining -= tlen; in ft_queue_data_in()
157 (skb_shinfo(fp_skb(fp))->nr_frags < FC_FRAME_SG_LEN)) in ft_queue_data_in()
161 fc_fill_fc_hdr(fp, FC_RCTL_DD_SOL_DATA, ep->did, ep->sid, in ft_queue_data_in()
165 pr_info_ratelimited("%s: Failed to send frame %p, " in ft_queue_data_in()
168 __func__, fp, ep->xid, in ft_queue_data_in()
169 remaining, lport->lso_max); in ft_queue_data_in()
177 se_cmd->scsi_status = SAM_STAT_TASK_SET_FULL; in ft_queue_data_in()
189 target_execute_cmd(&cmd->se_cmd); in ft_execute_work()
193 * Receive write data frame.
197 struct se_cmd *se_cmd = &cmd->se_cmd; in ft_recv_write_data()
198 struct fc_seq *seq = cmd->seq; in ft_recv_write_data()
216 if (!(ntoh24(fh->fh_f_ctl) & FC_FC_REL_OFF)) in ft_recv_write_data()
219 f_ctl = ntoh24(fh->fh_f_ctl); in ft_recv_write_data()
221 lport = ep->lp; in ft_recv_write_data()
222 if (cmd->was_ddp_setup) { in ft_recv_write_data()
230 pr_err("%s: xid 0x%x, f_ctl 0x%x, cmd->sg %p, " in ft_recv_write_data()
231 "cmd->sg_cnt 0x%x. DDP was setup" in ft_recv_write_data()
232 " hence not expected to receive frame with " in ft_recv_write_data()
233 "payload, Frame will be dropped if" in ft_recv_write_data()
235 "not set\n", __func__, ep->xid, f_ctl, in ft_recv_write_data()
236 se_cmd->t_data_sg, se_cmd->t_data_nents); in ft_recv_write_data()
246 * write data frame is received successfully where payload is in ft_recv_write_data()
247 * posted directly to user buffer and only the last frame's in ft_recv_write_data()
260 rel_off = ntohl(fh->fh_parm_offset); in ft_recv_write_data()
264 frame_len -= sizeof(*fh); in ft_recv_write_data()
266 if (rel_off >= se_cmd->data_length) in ft_recv_write_data()
268 if (frame_len + rel_off > se_cmd->data_length) in ft_recv_write_data()
269 frame_len = se_cmd->data_length - rel_off; in ft_recv_write_data()
272 * Setup to use first mem list entry, unless no data. in ft_recv_write_data()
274 BUG_ON(frame_len && !se_cmd->t_data_sg); in ft_recv_write_data()
276 sg = se_cmd->t_data_sg; in ft_recv_write_data()
277 mem_len = sg->length; in ft_recv_write_data()
278 mem_off = sg->offset; in ft_recv_write_data()
285 mem_len = sg->length; in ft_recv_write_data()
286 mem_off = sg->offset; in ft_recv_write_data()
290 rel_off -= mem_len; in ft_recv_write_data()
295 mem_len -= rel_off; in ft_recv_write_data()
303 tlen = min(tlen, (size_t)(PAGE_SIZE - in ft_recv_write_data()
309 frame_len -= tlen; in ft_recv_write_data()
311 mem_len -= tlen; in ft_recv_write_data()
312 cmd->write_data_len += tlen; in ft_recv_write_data()
315 if (cmd->write_data_len == se_cmd->data_length) { in ft_recv_write_data()
316 INIT_WORK(&cmd->work, ft_execute_work); in ft_recv_write_data()
317 queue_work(cmd->sess->tport->tpg->workqueue, &cmd->work); in ft_recv_write_data()
334 seq = cmd->seq; in ft_invl_hw_context()
337 if (cmd->was_ddp_setup && seq) { in ft_invl_hw_context()
340 lport = ep->lp; in ft_invl_hw_context()
341 if (lport && (ep->xid <= lport->lro_xid)) { in ft_invl_hw_context()
346 cmd->write_data_len = lport->tt.ddp_done(lport, in ft_invl_hw_context()
347 ep->xid); in ft_invl_hw_context()
353 * identified using ep->xid) in ft_invl_hw_context()
355 cmd->was_ddp_setup = 0; in ft_invl_hw_context()