Lines Matching refs:fp

262 static void fc_exch_setup_hdr(struct fc_exch *ep, struct fc_frame *fp,  in fc_exch_setup_hdr()  argument
265 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_setup_hdr()
268 fr_sof(fp) = ep->class; in fc_exch_setup_hdr()
270 fr_sof(fp) = fc_sof_normal(ep->class); in fc_exch_setup_hdr()
273 fr_eof(fp) = FC_EOF_T; in fc_exch_setup_hdr()
275 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
285 fill = fr_len(fp) & 3; in fc_exch_setup_hdr()
289 skb_put(fp_skb(fp), fill); in fc_exch_setup_hdr()
293 WARN_ON(fr_len(fp) % 4 != 0); /* no pad to non last frame */ in fc_exch_setup_hdr()
294 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
464 struct fc_frame *fp) in fc_seq_send_locked() argument
467 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_send_locked()
475 fc_frame_free(fp); in fc_seq_send_locked()
482 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_locked()
483 fr_encaps(fp) = ep->encaps; in fc_seq_send_locked()
490 if (fr_max_payload(fp)) in fc_seq_send_locked()
491 sp->cnt += DIV_ROUND_UP((fr_len(fp) - sizeof(*fh)), in fc_seq_send_locked()
492 fr_max_payload(fp)); in fc_seq_send_locked()
499 error = lport->tt.frame_send(lport, fp); in fc_seq_send_locked()
525 int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, struct fc_frame *fp) in fc_seq_send() argument
531 error = fc_seq_send_locked(lport, sp, fp); in fc_seq_send()
637 struct fc_frame *fp; in fc_exch_abort_locked() local
662 fp = fc_frame_alloc(ep->lp, 0); in fc_exch_abort_locked()
663 if (fp) { in fc_exch_abort_locked()
665 fc_fill_fc_hdr(fp, FC_RCTL_BA_ABTS, ep->did, ep->sid, in fc_exch_abort_locked()
668 error = fc_seq_send_locked(ep->lp, sp, fp); in fc_exch_abort_locked()
730 struct fc_frame *fp) in fc_invoke_resp() argument
732 void (*resp)(struct fc_seq *, struct fc_frame *fp, void *arg); in fc_invoke_resp()
745 resp(sp, fp, arg); in fc_invoke_resp()
907 struct fc_frame *fp) in fc_exch_alloc() argument
913 if (!ema->match || ema->match(fp)) { in fc_exch_alloc()
993 struct fc_frame *fp) in fc_exch_resp() argument
998 ep = fc_exch_alloc(lport, fp); in fc_exch_resp()
1000 ep->class = fc_frame_class(fp); in fc_exch_resp()
1007 fh = fc_frame_header_get(fp); in fc_exch_resp()
1041 struct fc_frame *fp) in fc_seq_lookup_recip() argument
1043 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_recip()
1079 fc_frame_payload_op(fp) == ELS_TEST) { in fc_seq_lookup_recip()
1088 if ((f_ctl & FC_FC_FIRST_SEQ) && fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1094 ep = fc_exch_resp(lport, mp, fp); in fc_seq_lookup_recip()
1112 if (fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1152 fr_seq(fp) = sp; in fc_seq_lookup_recip()
1170 struct fc_frame *fp) in fc_seq_lookup_orig() argument
1172 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_orig()
1228 void fc_seq_els_rsp_send(struct fc_frame *fp, enum fc_els_cmd els_cmd, in fc_seq_els_rsp_send() argument
1233 fc_seq_ls_rjt(fp, els_data->reason, els_data->explan); in fc_seq_els_rsp_send()
1236 fc_seq_ls_acc(fp); in fc_seq_els_rsp_send()
1239 fc_exch_els_rrq(fp); in fc_seq_els_rsp_send()
1242 fc_exch_els_rec(fp); in fc_seq_els_rsp_send()
1245 FC_LPORT_DBG(fr_dev(fp), "Invalid ELS CMD:%x\n", els_cmd); in fc_seq_els_rsp_send()
1257 static void fc_seq_send_last(struct fc_seq *sp, struct fc_frame *fp, in fc_seq_send_last() argument
1265 fc_fill_fc_hdr(fp, rctl, ep->did, ep->sid, fh_type, f_ctl, 0); in fc_seq_send_last()
1266 fc_seq_send_locked(ep->lp, sp, fp); in fc_seq_send_last()
1278 struct fc_frame *fp; in fc_seq_send_ack() local
1289 fp = fc_frame_alloc(lport, 0); in fc_seq_send_ack()
1290 if (!fp) { in fc_seq_send_ack()
1295 fh = fc_frame_header_get(fp); in fc_seq_send_ack()
1315 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_ack()
1320 fr_sof(fp) = fr_sof(rx_fp); in fc_seq_send_ack()
1322 fr_eof(fp) = FC_EOF_T; in fc_seq_send_ack()
1324 fr_eof(fp) = FC_EOF_N; in fc_seq_send_ack()
1326 lport->tt.frame_send(lport, fp); in fc_seq_send_ack()
1342 struct fc_frame *fp; in fc_exch_send_ba_rjt() local
1352 fp = fc_frame_alloc(lport, sizeof(*rp)); in fc_exch_send_ba_rjt()
1353 if (!fp) { in fc_exch_send_ba_rjt()
1358 fh = fc_frame_header_get(fp); in fc_exch_send_ba_rjt()
1363 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_send_ba_rjt()
1395 fr_sof(fp) = fc_sof_class(fr_sof(rx_fp)); in fc_exch_send_ba_rjt()
1396 fr_eof(fp) = FC_EOF_T; in fc_exch_send_ba_rjt()
1397 if (fc_sof_needs_ack(fr_sof(fp))) in fc_exch_send_ba_rjt()
1398 fr_eof(fp) = FC_EOF_N; in fc_exch_send_ba_rjt()
1400 lport->tt.frame_send(lport, fp); in fc_exch_send_ba_rjt()
1414 struct fc_frame *fp; in fc_exch_recv_abts() local
1423 fp = fc_frame_alloc(ep->lp, sizeof(*ap)); in fc_exch_recv_abts()
1424 if (!fp) { in fc_exch_recv_abts()
1433 fc_frame_free(fp); in fc_exch_recv_abts()
1441 fh = fc_frame_header_get(fp); in fc_exch_recv_abts()
1442 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_recv_abts()
1453 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); in fc_exch_recv_abts()
1475 struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp) in fc_seq_assign() argument
1479 WARN_ON(lport != fr_dev(fp)); in fc_seq_assign()
1480 WARN_ON(fr_seq(fp)); in fc_seq_assign()
1481 fr_seq(fp) = NULL; in fc_seq_assign()
1484 if ((!ema->match || ema->match(fp)) && in fc_seq_assign()
1485 fc_seq_lookup_recip(lport, ema->mp, fp) == FC_RJT_NONE) in fc_seq_assign()
1487 return fr_seq(fp); in fc_seq_assign()
1511 struct fc_frame *fp) in fc_exch_recv_req() argument
1513 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_req()
1523 fc_frame_free(fp); in fc_exch_recv_req()
1526 fr_dev(fp) = lport; in fc_exch_recv_req()
1528 BUG_ON(fr_seq(fp)); /* XXX remove later */ in fc_exch_recv_req()
1535 return fc_lport_recv(lport, fp); in fc_exch_recv_req()
1537 reject = fc_seq_lookup_recip(lport, mp, fp); in fc_exch_recv_req()
1539 sp = fr_seq(fp); /* sequence will be held */ in fc_exch_recv_req()
1541 fc_seq_send_ack(sp, fp); in fc_exch_recv_req()
1542 ep->encaps = fr_encaps(fp); in fc_exch_recv_req()
1555 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_req()
1556 fc_lport_recv(lport, fp); in fc_exch_recv_req()
1561 fc_frame_free(fp); in fc_exch_recv_req()
1572 static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_seq_resp() argument
1574 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_seq_resp()
1601 sof = fr_sof(fp); in fc_exch_recv_seq_resp()
1609 fr_seq(fp) = sp; in fc_exch_recv_seq_resp()
1617 fc_seq_send_ack(sp, fp); in fc_exch_recv_seq_resp()
1619 if (fh->fh_type != FC_TYPE_FCP && fr_eof(fp) == FC_EOF_T && in fc_exch_recv_seq_resp()
1648 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_seq_resp()
1649 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1657 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1666 static void fc_exch_recv_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_resp() argument
1670 sp = fc_seq_lookup_orig(mp, fp); /* doesn't hold sequence */ in fc_exch_recv_resp()
1677 fc_frame_free(fp); in fc_exch_recv_resp()
1688 static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp) in fc_exch_abts_resp() argument
1697 fh = fc_frame_header_get(fp); in fc_exch_abts_resp()
1709 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_abts_resp()
1749 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_abts_resp()
1750 fc_frame_free(fp); in fc_exch_abts_resp()
1764 static void fc_exch_recv_bls(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_bls() argument
1770 fh = fc_frame_header_get(fp); in fc_exch_recv_bls()
1772 fr_seq(fp) = NULL; in fc_exch_recv_bls()
1797 fc_frame_free(fp); in fc_exch_recv_bls()
1803 fc_exch_abts_resp(ep, fp); in fc_exch_recv_bls()
1805 fc_frame_free(fp); in fc_exch_recv_bls()
1809 fc_exch_recv_abts(ep, fp); in fc_exch_recv_bls()
1811 fc_frame_free(fp); in fc_exch_recv_bls()
1814 fc_frame_free(fp); in fc_exch_recv_bls()
1833 struct fc_frame *fp; in fc_seq_ls_acc() local
1838 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_seq_ls_acc()
1839 if (!fp) { in fc_seq_ls_acc()
1844 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_seq_ls_acc()
1847 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_acc()
1848 lport->tt.frame_send(lport, fp); in fc_seq_ls_acc()
1865 struct fc_frame *fp; in fc_seq_ls_rjt() local
1870 fp = fc_frame_alloc(lport, sizeof(*rjt)); in fc_seq_ls_rjt()
1871 if (!fp) { in fc_seq_ls_rjt()
1876 rjt = fc_frame_payload_get(fp, sizeof(*rjt)); in fc_seq_ls_rjt()
1881 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_rjt()
1882 lport->tt.frame_send(lport, fp); in fc_seq_ls_rjt()
2019 struct fc_frame *fp; in fc_exch_els_rec() local
2061 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_exch_els_rec()
2062 if (!fp) { in fc_exch_els_rec()
2067 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_exch_els_rec()
2081 fc_fill_reply_hdr(fp, rfp, FC_RCTL_ELS_REP, 0); in fc_exch_els_rec()
2082 lport->tt.frame_send(lport, fp); in fc_exch_els_rec()
2101 static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg) in fc_exch_rrq_resp() argument
2106 if (IS_ERR(fp)) { in fc_exch_rrq_resp()
2107 int err = PTR_ERR(fp); in fc_exch_rrq_resp()
2116 op = fc_frame_payload_op(fp); in fc_exch_rrq_resp()
2117 fc_frame_free(fp); in fc_exch_rrq_resp()
2176 struct fc_frame *fp, in fc_exch_seq_send() argument
2178 struct fc_frame *fp, in fc_exch_seq_send()
2189 ep = fc_exch_alloc(lport, fp); in fc_exch_seq_send()
2191 fc_frame_free(fp); in fc_exch_seq_send()
2195 fh = fc_frame_header_get(fp); in fc_exch_seq_send()
2206 fc_exch_setup_hdr(ep, fp, ep->f_ctl); in fc_exch_seq_send()
2210 fsp = fr_fsp(fp); in fc_exch_seq_send()
2211 fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); in fc_exch_seq_send()
2214 if (unlikely(lport->tt.frame_send(lport, fp))) in fc_exch_seq_send()
2247 struct fc_frame *fp; in fc_exch_rrq() local
2252 fp = fc_frame_alloc(lport, sizeof(*rrq)); in fc_exch_rrq()
2253 if (!fp) in fc_exch_rrq()
2256 rrq = fc_frame_payload_get(fp, sizeof(*rrq)); in fc_exch_rrq()
2267 fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did, in fc_exch_rrq()
2271 if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep, in fc_exch_rrq()
2293 static void fc_exch_els_rrq(struct fc_frame *fp) in fc_exch_els_rrq() argument
2302 lport = fr_dev(fp); in fc_exch_els_rrq()
2303 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_els_rrq()
2345 fc_seq_ls_acc(fp); in fc_exch_els_rrq()
2351 fc_seq_ls_rjt(fp, ELS_RJT_LOGIC, explan); in fc_exch_els_rrq()
2602 void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) in fc_exch_recv() argument
2604 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv()
2612 fc_frame_free(fp); in fc_exch_recv()
2625 fc_frame_free(fp); in fc_exch_recv()
2632 switch (fr_eof(fp)) { in fc_exch_recv()
2635 skb_trim(fp_skb(fp), fr_len(fp) - FC_FC_FILL(f_ctl)); in fc_exch_recv()
2639 fc_exch_recv_bls(ema->mp, fp); in fc_exch_recv()
2642 fc_exch_recv_seq_resp(ema->mp, fp); in fc_exch_recv()
2644 fc_exch_recv_resp(ema->mp, fp); in fc_exch_recv()
2646 fc_exch_recv_req(lport, ema->mp, fp); in fc_exch_recv()
2650 fr_eof(fp)); in fc_exch_recv()
2651 fc_frame_free(fp); in fc_exch_recv()