Lines Matching refs:fp

273 static void fc_exch_setup_hdr(struct fc_exch *ep, struct fc_frame *fp,  in fc_exch_setup_hdr()  argument
276 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_setup_hdr()
279 fr_sof(fp) = ep->class; in fc_exch_setup_hdr()
281 fr_sof(fp) = fc_sof_normal(ep->class); in fc_exch_setup_hdr()
284 fr_eof(fp) = FC_EOF_T; in fc_exch_setup_hdr()
286 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
296 fill = fr_len(fp) & 3; in fc_exch_setup_hdr()
300 skb_put(fp_skb(fp), fill); in fc_exch_setup_hdr()
304 WARN_ON(fr_len(fp) % 4 != 0); /* no pad to non last frame */ in fc_exch_setup_hdr()
305 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
475 struct fc_frame *fp) in fc_seq_send_locked() argument
478 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_send_locked()
486 fc_frame_free(fp); in fc_seq_send_locked()
493 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_locked()
494 fr_encaps(fp) = ep->encaps; in fc_seq_send_locked()
501 if (fr_max_payload(fp)) in fc_seq_send_locked()
502 sp->cnt += DIV_ROUND_UP((fr_len(fp) - sizeof(*fh)), in fc_seq_send_locked()
503 fr_max_payload(fp)); in fc_seq_send_locked()
510 error = lport->tt.frame_send(lport, fp); in fc_seq_send_locked()
536 int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, struct fc_frame *fp) in fc_seq_send() argument
542 error = fc_seq_send_locked(lport, sp, fp); in fc_seq_send()
648 struct fc_frame *fp; in fc_exch_abort_locked() local
673 fp = fc_frame_alloc(ep->lp, 0); in fc_exch_abort_locked()
674 if (fp) { in fc_exch_abort_locked()
676 fc_fill_fc_hdr(fp, FC_RCTL_BA_ABTS, ep->did, ep->sid, in fc_exch_abort_locked()
679 error = fc_seq_send_locked(ep->lp, sp, fp); in fc_exch_abort_locked()
738 struct fc_frame *fp) in fc_invoke_resp() argument
740 void (*resp)(struct fc_seq *, struct fc_frame *fp, void *arg); in fc_invoke_resp()
753 resp(sp, fp, arg); in fc_invoke_resp()
915 struct fc_frame *fp) in fc_exch_alloc() argument
921 if (!ema->match || ema->match(fp)) { in fc_exch_alloc()
1001 struct fc_frame *fp) in fc_exch_resp() argument
1006 ep = fc_exch_alloc(lport, fp); in fc_exch_resp()
1008 ep->class = fc_frame_class(fp); in fc_exch_resp()
1015 fh = fc_frame_header_get(fp); in fc_exch_resp()
1049 struct fc_frame *fp) in fc_seq_lookup_recip() argument
1051 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_recip()
1087 fc_frame_payload_op(fp) == ELS_TEST) { in fc_seq_lookup_recip()
1096 if ((f_ctl & FC_FC_FIRST_SEQ) && fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1102 ep = fc_exch_resp(lport, mp, fp); in fc_seq_lookup_recip()
1120 if (fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1160 fr_seq(fp) = sp; in fc_seq_lookup_recip()
1178 struct fc_frame *fp) in fc_seq_lookup_orig() argument
1180 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_orig()
1236 void fc_seq_els_rsp_send(struct fc_frame *fp, enum fc_els_cmd els_cmd, in fc_seq_els_rsp_send() argument
1241 fc_seq_ls_rjt(fp, els_data->reason, els_data->explan); in fc_seq_els_rsp_send()
1244 fc_seq_ls_acc(fp); in fc_seq_els_rsp_send()
1247 fc_exch_els_rrq(fp); in fc_seq_els_rsp_send()
1250 fc_exch_els_rec(fp); in fc_seq_els_rsp_send()
1253 FC_LPORT_DBG(fr_dev(fp), "Invalid ELS CMD:%x\n", els_cmd); in fc_seq_els_rsp_send()
1265 static void fc_seq_send_last(struct fc_seq *sp, struct fc_frame *fp, in fc_seq_send_last() argument
1273 fc_fill_fc_hdr(fp, rctl, ep->did, ep->sid, fh_type, f_ctl, 0); in fc_seq_send_last()
1274 fc_seq_send_locked(ep->lp, sp, fp); in fc_seq_send_last()
1286 struct fc_frame *fp; in fc_seq_send_ack() local
1297 fp = fc_frame_alloc(lport, 0); in fc_seq_send_ack()
1298 if (!fp) { in fc_seq_send_ack()
1303 fh = fc_frame_header_get(fp); in fc_seq_send_ack()
1323 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_ack()
1328 fr_sof(fp) = fr_sof(rx_fp); in fc_seq_send_ack()
1330 fr_eof(fp) = FC_EOF_T; in fc_seq_send_ack()
1332 fr_eof(fp) = FC_EOF_N; in fc_seq_send_ack()
1334 lport->tt.frame_send(lport, fp); in fc_seq_send_ack()
1350 struct fc_frame *fp; in fc_exch_send_ba_rjt() local
1360 fp = fc_frame_alloc(lport, sizeof(*rp)); in fc_exch_send_ba_rjt()
1361 if (!fp) { in fc_exch_send_ba_rjt()
1366 fh = fc_frame_header_get(fp); in fc_exch_send_ba_rjt()
1371 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_send_ba_rjt()
1403 fr_sof(fp) = fc_sof_class(fr_sof(rx_fp)); in fc_exch_send_ba_rjt()
1404 fr_eof(fp) = FC_EOF_T; in fc_exch_send_ba_rjt()
1405 if (fc_sof_needs_ack(fr_sof(fp))) in fc_exch_send_ba_rjt()
1406 fr_eof(fp) = FC_EOF_N; in fc_exch_send_ba_rjt()
1408 lport->tt.frame_send(lport, fp); in fc_exch_send_ba_rjt()
1422 struct fc_frame *fp; in fc_exch_recv_abts() local
1431 fp = fc_frame_alloc(ep->lp, sizeof(*ap)); in fc_exch_recv_abts()
1432 if (!fp) { in fc_exch_recv_abts()
1441 fc_frame_free(fp); in fc_exch_recv_abts()
1449 fh = fc_frame_header_get(fp); in fc_exch_recv_abts()
1450 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_recv_abts()
1461 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); in fc_exch_recv_abts()
1483 struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp) in fc_seq_assign() argument
1487 WARN_ON(lport != fr_dev(fp)); in fc_seq_assign()
1488 WARN_ON(fr_seq(fp)); in fc_seq_assign()
1489 fr_seq(fp) = NULL; in fc_seq_assign()
1492 if ((!ema->match || ema->match(fp)) && in fc_seq_assign()
1493 fc_seq_lookup_recip(lport, ema->mp, fp) == FC_RJT_NONE) in fc_seq_assign()
1495 return fr_seq(fp); in fc_seq_assign()
1519 struct fc_frame *fp) in fc_exch_recv_req() argument
1521 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_req()
1531 fc_frame_free(fp); in fc_exch_recv_req()
1534 fr_dev(fp) = lport; in fc_exch_recv_req()
1536 BUG_ON(fr_seq(fp)); /* XXX remove later */ in fc_exch_recv_req()
1543 return fc_lport_recv(lport, fp); in fc_exch_recv_req()
1545 reject = fc_seq_lookup_recip(lport, mp, fp); in fc_exch_recv_req()
1547 sp = fr_seq(fp); /* sequence will be held */ in fc_exch_recv_req()
1549 fc_seq_send_ack(sp, fp); in fc_exch_recv_req()
1550 ep->encaps = fr_encaps(fp); in fc_exch_recv_req()
1563 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_req()
1564 fc_lport_recv(lport, fp); in fc_exch_recv_req()
1569 fc_frame_free(fp); in fc_exch_recv_req()
1580 static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_seq_resp() argument
1582 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_seq_resp()
1609 sof = fr_sof(fp); in fc_exch_recv_seq_resp()
1617 fr_seq(fp) = sp; in fc_exch_recv_seq_resp()
1625 fc_seq_send_ack(sp, fp); in fc_exch_recv_seq_resp()
1627 if (fh->fh_type != FC_TYPE_FCP && fr_eof(fp) == FC_EOF_T && in fc_exch_recv_seq_resp()
1651 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_seq_resp()
1652 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1659 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1668 static void fc_exch_recv_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_resp() argument
1672 sp = fc_seq_lookup_orig(mp, fp); /* doesn't hold sequence */ in fc_exch_recv_resp()
1679 fc_frame_free(fp); in fc_exch_recv_resp()
1690 static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp) in fc_exch_abts_resp() argument
1699 fh = fc_frame_header_get(fp); in fc_exch_abts_resp()
1711 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_abts_resp()
1751 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_abts_resp()
1752 fc_frame_free(fp); in fc_exch_abts_resp()
1766 static void fc_exch_recv_bls(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_bls() argument
1772 fh = fc_frame_header_get(fp); in fc_exch_recv_bls()
1774 fr_seq(fp) = NULL; in fc_exch_recv_bls()
1799 fc_frame_free(fp); in fc_exch_recv_bls()
1805 fc_exch_abts_resp(ep, fp); in fc_exch_recv_bls()
1807 fc_frame_free(fp); in fc_exch_recv_bls()
1811 fc_exch_recv_abts(ep, fp); in fc_exch_recv_bls()
1813 fc_frame_free(fp); in fc_exch_recv_bls()
1816 fc_frame_free(fp); in fc_exch_recv_bls()
1835 struct fc_frame *fp; in fc_seq_ls_acc() local
1840 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_seq_ls_acc()
1841 if (!fp) { in fc_seq_ls_acc()
1846 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_seq_ls_acc()
1849 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_acc()
1850 lport->tt.frame_send(lport, fp); in fc_seq_ls_acc()
1867 struct fc_frame *fp; in fc_seq_ls_rjt() local
1872 fp = fc_frame_alloc(lport, sizeof(*rjt)); in fc_seq_ls_rjt()
1873 if (!fp) { in fc_seq_ls_rjt()
1878 rjt = fc_frame_payload_get(fp, sizeof(*rjt)); in fc_seq_ls_rjt()
1883 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_rjt()
1884 lport->tt.frame_send(lport, fp); in fc_seq_ls_rjt()
2015 struct fc_frame *fp; in fc_exch_els_rec() local
2057 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_exch_els_rec()
2058 if (!fp) { in fc_exch_els_rec()
2063 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_exch_els_rec()
2077 fc_fill_reply_hdr(fp, rfp, FC_RCTL_ELS_REP, 0); in fc_exch_els_rec()
2078 lport->tt.frame_send(lport, fp); in fc_exch_els_rec()
2097 static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg) in fc_exch_rrq_resp() argument
2102 if (IS_ERR(fp)) { in fc_exch_rrq_resp()
2103 int err = PTR_ERR(fp); in fc_exch_rrq_resp()
2112 op = fc_frame_payload_op(fp); in fc_exch_rrq_resp()
2113 fc_frame_free(fp); in fc_exch_rrq_resp()
2172 struct fc_frame *fp, in fc_exch_seq_send() argument
2174 struct fc_frame *fp, in fc_exch_seq_send()
2185 ep = fc_exch_alloc(lport, fp); in fc_exch_seq_send()
2187 fc_frame_free(fp); in fc_exch_seq_send()
2191 fh = fc_frame_header_get(fp); in fc_exch_seq_send()
2202 fc_exch_setup_hdr(ep, fp, ep->f_ctl); in fc_exch_seq_send()
2206 fsp = fr_fsp(fp); in fc_exch_seq_send()
2207 fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); in fc_exch_seq_send()
2210 if (unlikely(lport->tt.frame_send(lport, fp))) in fc_exch_seq_send()
2243 struct fc_frame *fp; in fc_exch_rrq() local
2248 fp = fc_frame_alloc(lport, sizeof(*rrq)); in fc_exch_rrq()
2249 if (!fp) in fc_exch_rrq()
2252 rrq = fc_frame_payload_get(fp, sizeof(*rrq)); in fc_exch_rrq()
2263 fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did, in fc_exch_rrq()
2267 if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep, in fc_exch_rrq()
2289 static void fc_exch_els_rrq(struct fc_frame *fp) in fc_exch_els_rrq() argument
2298 lport = fr_dev(fp); in fc_exch_els_rrq()
2299 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_els_rrq()
2341 fc_seq_ls_acc(fp); in fc_exch_els_rrq()
2347 fc_seq_ls_rjt(fp, ELS_RJT_LOGIC, explan); in fc_exch_els_rrq()
2598 void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) in fc_exch_recv() argument
2600 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv()
2608 fc_frame_free(fp); in fc_exch_recv()
2621 fc_frame_free(fp); in fc_exch_recv()
2628 switch (fr_eof(fp)) { in fc_exch_recv()
2631 skb_trim(fp_skb(fp), fr_len(fp) - FC_FC_FILL(f_ctl)); in fc_exch_recv()
2635 fc_exch_recv_bls(ema->mp, fp); in fc_exch_recv()
2638 fc_exch_recv_seq_resp(ema->mp, fp); in fc_exch_recv()
2640 fc_exch_recv_resp(ema->mp, fp); in fc_exch_recv()
2642 fc_exch_recv_req(lport, ema->mp, fp); in fc_exch_recv()
2646 fr_eof(fp)); in fc_exch_recv()
2647 fc_frame_free(fp); in fc_exch_recv()