20 #include <linux/module.h>
22 #include <linux/utsname.h>
24 #include <linux/slab.h>
26 #include <linux/types.h>
27 #include <linux/string.h>
29 #include <linux/ctype.h>
30 #include <linux/hash.h>
31 #include <asm/unaligned.h>
32 #include <scsi/scsi.h>
59 pr_debug(
"%s: cmd %p sess %p seq %p se_cmd %p\n",
60 caller, cmd, cmd->
sess, cmd->
seq, se_cmd);
62 pr_debug(
"%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n",
68 "len 0
x%
x off 0
x%
x\
n",
76 "ox_id %x rx_id %x seq_id %x e_stat %x\n",
85 _ft_dump_cmd(cmd, caller);
88 static void ft_free_cmd(
struct ft_cmd *
cmd)
135 fp = fc_frame_alloc(lport, len);
140 fcp = fc_frame_payload_get(fp, len);
166 cmd->
seq = lport->
tt.seq_start_next(cmd->
seq);
170 lport->
tt.seq_send(lport, cmd->
seq, fp);
171 lport->
tt.exch_done(cmd->
seq);
201 fp = fc_frame_alloc(lport,
sizeof(*txrdy));
205 txrdy = fc_frame_payload_get(fp,
sizeof(*txrdy));
206 memset(txrdy, 0,
sizeof(*txrdy));
209 cmd->
seq = lport->
tt.seq_start_next(cmd->
seq);
213 fh = fc_frame_header_get(fp);
224 lport->
tt.ddp_target(lport, ep->
xid,
230 lport->
tt.seq_send(lport, cmd->
seq, fp);
263 fh = fc_frame_header_get(fp);
273 pr_debug(
"%s: unhandled frame r_ctl %x\n",
287 static void ft_send_resp_status(
struct fc_lport *lport,
298 fh = fc_frame_header_get(rx_fp);
299 pr_debug(
"FCP error response: did %x oxid %x status %x code %x\n",
303 len +=
sizeof(*info);
304 fp = fc_frame_alloc(lport, len);
307 fcp = fc_frame_payload_get(fp, len);
311 fcp->
ext.fr_rsp_len =
htonl(
sizeof(*info));
320 lport->
tt.seq_send(lport, sp, fp);
321 lport->
tt.exch_done(sp);
323 lport->
tt.frame_send(lport, fp);
330 static void ft_send_resp_code(
struct ft_cmd *cmd,
333 ft_send_resp_status(cmd->
sess->tport->lport,
342 static void ft_send_resp_code_and_free(
struct ft_cmd *cmd,
345 ft_send_resp_code(cmd, code);
352 static void ft_send_tm(
struct ft_cmd *cmd)
358 fcp = fc_frame_payload_get(cmd->
req_frame,
sizeof(*fcp));
424 pr_debug(
"tmr fn %d resp %d fcp code %d\n",
426 ft_send_resp_code(cmd, code);
444 cmd->
seq = lport->
tt.seq_assign(lport, fp);
456 pr_debug(
"cmd or seq allocation failure - sending BUSY\n");
473 ft_recv_cmd(sess, fp);
481 pr_debug(
"%s: unhandled frame r_ctl %x\n",
500 fcp = fc_frame_payload_get(cmd->
req_frame,
sizeof(*fcp));