29 #include <linux/module.h>
31 #include <linux/utsname.h>
33 #include <linux/slab.h>
35 #include <linux/types.h>
36 #include <linux/string.h>
38 #include <linux/ctype.h>
39 #include <linux/hash.h>
41 #include <asm/unaligned.h>
42 #include <scsi/scsi.h>
87 cmd->
seq = lport->
tt.seq_start_next(cmd->
seq);
103 use_sg = !(remaining % 4);
108 mem_len =
min((
size_t)sg->
length, remaining);
119 cmd->
sess->max_frame;
120 frame_len =
min(frame_len, remaining);
121 fp = fc_frame_alloc(lport, use_sg ? 0 : frame_len);
124 to = fc_frame_payload_get(fp, 0);
126 frame_off += frame_len;
135 tlen =
min(mem_len, frame_len);
138 off_in_page = mem_off;
141 skb_fill_page_desc(
fp_skb(fp),
142 skb_shinfo(
fp_skb(fp))->nr_frags,
143 page, off_in_page, tlen);
145 fp_skb(fp)->data_len += tlen;
172 error = lport->
tt.seq_send(lport, cmd->
seq, fp);
176 "xid <0x%x>, remaining %zu, "
178 __func__, fp, ep->
xid,
215 fh = fc_frame_header_get(fp);
229 buf = fc_frame_payload_get(fp, 1);
231 pr_err(
"%s: xid 0x%x, f_ctl 0x%x, cmd->sg %p, "
232 "cmd->sg_cnt 0x%x. DDP was setup"
233 " hence not expected to receive frame with "
234 "payload, Frame will be dropped if"
235 "'Sequence Initiative' bit in f_ctl is"
236 "not set\n", __func__, ep->
xid, f_ctl,
263 if (frame_len <=
sizeof(*fh))
265 frame_len -=
sizeof(*fh);
266 from = fc_frame_payload_get(fp, 0);
290 if (rel_off >= mem_len) {
299 tlen =
min(mem_len, frame_len);