Lines Matching refs:fp

261 static void fc_exch_setup_hdr(struct fc_exch *ep, struct fc_frame *fp,  in fc_exch_setup_hdr()  argument
264 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_setup_hdr()
267 fr_sof(fp) = ep->class; in fc_exch_setup_hdr()
269 fr_sof(fp) = fc_sof_normal(ep->class); in fc_exch_setup_hdr()
272 fr_eof(fp) = FC_EOF_T; in fc_exch_setup_hdr()
274 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
284 fill = fr_len(fp) & 3; in fc_exch_setup_hdr()
288 skb_put(fp_skb(fp), fill); in fc_exch_setup_hdr()
292 WARN_ON(fr_len(fp) % 4 != 0); /* no pad to non last frame */ in fc_exch_setup_hdr()
293 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
463 struct fc_frame *fp) in fc_seq_send_locked() argument
466 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_send_locked()
474 fc_frame_free(fp); in fc_seq_send_locked()
481 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_locked()
482 fr_encaps(fp) = ep->encaps; in fc_seq_send_locked()
489 if (fr_max_payload(fp)) in fc_seq_send_locked()
490 sp->cnt += DIV_ROUND_UP((fr_len(fp) - sizeof(*fh)), in fc_seq_send_locked()
491 fr_max_payload(fp)); in fc_seq_send_locked()
498 error = lport->tt.frame_send(lport, fp); in fc_seq_send_locked()
524 int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, struct fc_frame *fp) in fc_seq_send() argument
530 error = fc_seq_send_locked(lport, sp, fp); in fc_seq_send()
636 struct fc_frame *fp; in fc_exch_abort_locked() local
661 fp = fc_frame_alloc(ep->lp, 0); in fc_exch_abort_locked()
662 if (fp) { in fc_exch_abort_locked()
664 fc_fill_fc_hdr(fp, FC_RCTL_BA_ABTS, ep->did, ep->sid, in fc_exch_abort_locked()
667 error = fc_seq_send_locked(ep->lp, sp, fp); in fc_exch_abort_locked()
726 struct fc_frame *fp) in fc_invoke_resp() argument
728 void (*resp)(struct fc_seq *, struct fc_frame *fp, void *arg); in fc_invoke_resp()
741 resp(sp, fp, arg); in fc_invoke_resp()
903 struct fc_frame *fp) in fc_exch_alloc() argument
909 if (!ema->match || ema->match(fp)) { in fc_exch_alloc()
989 struct fc_frame *fp) in fc_exch_resp() argument
994 ep = fc_exch_alloc(lport, fp); in fc_exch_resp()
996 ep->class = fc_frame_class(fp); in fc_exch_resp()
1003 fh = fc_frame_header_get(fp); in fc_exch_resp()
1037 struct fc_frame *fp) in fc_seq_lookup_recip() argument
1039 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_recip()
1075 fc_frame_payload_op(fp) == ELS_TEST) { in fc_seq_lookup_recip()
1084 if ((f_ctl & FC_FC_FIRST_SEQ) && fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1090 ep = fc_exch_resp(lport, mp, fp); in fc_seq_lookup_recip()
1108 if (fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1148 fr_seq(fp) = sp; in fc_seq_lookup_recip()
1166 struct fc_frame *fp) in fc_seq_lookup_orig() argument
1168 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_orig()
1224 void fc_seq_els_rsp_send(struct fc_frame *fp, enum fc_els_cmd els_cmd, in fc_seq_els_rsp_send() argument
1229 fc_seq_ls_rjt(fp, els_data->reason, els_data->explan); in fc_seq_els_rsp_send()
1232 fc_seq_ls_acc(fp); in fc_seq_els_rsp_send()
1235 fc_exch_els_rrq(fp); in fc_seq_els_rsp_send()
1238 fc_exch_els_rec(fp); in fc_seq_els_rsp_send()
1241 FC_LPORT_DBG(fr_dev(fp), "Invalid ELS CMD:%x\n", els_cmd); in fc_seq_els_rsp_send()
1253 static void fc_seq_send_last(struct fc_seq *sp, struct fc_frame *fp, in fc_seq_send_last() argument
1261 fc_fill_fc_hdr(fp, rctl, ep->did, ep->sid, fh_type, f_ctl, 0); in fc_seq_send_last()
1262 fc_seq_send_locked(ep->lp, sp, fp); in fc_seq_send_last()
1274 struct fc_frame *fp; in fc_seq_send_ack() local
1285 fp = fc_frame_alloc(lport, 0); in fc_seq_send_ack()
1286 if (!fp) { in fc_seq_send_ack()
1291 fh = fc_frame_header_get(fp); in fc_seq_send_ack()
1311 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_ack()
1316 fr_sof(fp) = fr_sof(rx_fp); in fc_seq_send_ack()
1318 fr_eof(fp) = FC_EOF_T; in fc_seq_send_ack()
1320 fr_eof(fp) = FC_EOF_N; in fc_seq_send_ack()
1322 lport->tt.frame_send(lport, fp); in fc_seq_send_ack()
1338 struct fc_frame *fp; in fc_exch_send_ba_rjt() local
1348 fp = fc_frame_alloc(lport, sizeof(*rp)); in fc_exch_send_ba_rjt()
1349 if (!fp) { in fc_exch_send_ba_rjt()
1354 fh = fc_frame_header_get(fp); in fc_exch_send_ba_rjt()
1359 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_send_ba_rjt()
1391 fr_sof(fp) = fc_sof_class(fr_sof(rx_fp)); in fc_exch_send_ba_rjt()
1392 fr_eof(fp) = FC_EOF_T; in fc_exch_send_ba_rjt()
1393 if (fc_sof_needs_ack(fr_sof(fp))) in fc_exch_send_ba_rjt()
1394 fr_eof(fp) = FC_EOF_N; in fc_exch_send_ba_rjt()
1396 lport->tt.frame_send(lport, fp); in fc_exch_send_ba_rjt()
1410 struct fc_frame *fp; in fc_exch_recv_abts() local
1419 fp = fc_frame_alloc(ep->lp, sizeof(*ap)); in fc_exch_recv_abts()
1420 if (!fp) { in fc_exch_recv_abts()
1429 fc_frame_free(fp); in fc_exch_recv_abts()
1437 fh = fc_frame_header_get(fp); in fc_exch_recv_abts()
1438 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_recv_abts()
1449 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); in fc_exch_recv_abts()
1471 struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp) in fc_seq_assign() argument
1475 WARN_ON(lport != fr_dev(fp)); in fc_seq_assign()
1476 WARN_ON(fr_seq(fp)); in fc_seq_assign()
1477 fr_seq(fp) = NULL; in fc_seq_assign()
1480 if ((!ema->match || ema->match(fp)) && in fc_seq_assign()
1481 fc_seq_lookup_recip(lport, ema->mp, fp) == FC_RJT_NONE) in fc_seq_assign()
1483 return fr_seq(fp); in fc_seq_assign()
1507 struct fc_frame *fp) in fc_exch_recv_req() argument
1509 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_req()
1519 fc_frame_free(fp); in fc_exch_recv_req()
1522 fr_dev(fp) = lport; in fc_exch_recv_req()
1524 BUG_ON(fr_seq(fp)); /* XXX remove later */ in fc_exch_recv_req()
1531 return fc_lport_recv(lport, fp); in fc_exch_recv_req()
1533 reject = fc_seq_lookup_recip(lport, mp, fp); in fc_exch_recv_req()
1535 sp = fr_seq(fp); /* sequence will be held */ in fc_exch_recv_req()
1537 fc_seq_send_ack(sp, fp); in fc_exch_recv_req()
1538 ep->encaps = fr_encaps(fp); in fc_exch_recv_req()
1551 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_req()
1552 fc_lport_recv(lport, fp); in fc_exch_recv_req()
1557 fc_frame_free(fp); in fc_exch_recv_req()
1568 static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_seq_resp() argument
1570 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_seq_resp()
1597 sof = fr_sof(fp); in fc_exch_recv_seq_resp()
1605 fr_seq(fp) = sp; in fc_exch_recv_seq_resp()
1613 fc_seq_send_ack(sp, fp); in fc_exch_recv_seq_resp()
1615 if (fh->fh_type != FC_TYPE_FCP && fr_eof(fp) == FC_EOF_T && in fc_exch_recv_seq_resp()
1639 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_seq_resp()
1640 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1647 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1656 static void fc_exch_recv_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_resp() argument
1660 sp = fc_seq_lookup_orig(mp, fp); /* doesn't hold sequence */ in fc_exch_recv_resp()
1667 fc_frame_free(fp); in fc_exch_recv_resp()
1678 static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp) in fc_exch_abts_resp() argument
1687 fh = fc_frame_header_get(fp); in fc_exch_abts_resp()
1699 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_abts_resp()
1739 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_abts_resp()
1740 fc_frame_free(fp); in fc_exch_abts_resp()
1754 static void fc_exch_recv_bls(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_bls() argument
1760 fh = fc_frame_header_get(fp); in fc_exch_recv_bls()
1762 fr_seq(fp) = NULL; in fc_exch_recv_bls()
1787 fc_frame_free(fp); in fc_exch_recv_bls()
1793 fc_exch_abts_resp(ep, fp); in fc_exch_recv_bls()
1795 fc_frame_free(fp); in fc_exch_recv_bls()
1799 fc_exch_recv_abts(ep, fp); in fc_exch_recv_bls()
1801 fc_frame_free(fp); in fc_exch_recv_bls()
1804 fc_frame_free(fp); in fc_exch_recv_bls()
1823 struct fc_frame *fp; in fc_seq_ls_acc() local
1828 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_seq_ls_acc()
1829 if (!fp) { in fc_seq_ls_acc()
1834 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_seq_ls_acc()
1837 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_acc()
1838 lport->tt.frame_send(lport, fp); in fc_seq_ls_acc()
1855 struct fc_frame *fp; in fc_seq_ls_rjt() local
1860 fp = fc_frame_alloc(lport, sizeof(*rjt)); in fc_seq_ls_rjt()
1861 if (!fp) { in fc_seq_ls_rjt()
1866 rjt = fc_frame_payload_get(fp, sizeof(*rjt)); in fc_seq_ls_rjt()
1871 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_rjt()
1872 lport->tt.frame_send(lport, fp); in fc_seq_ls_rjt()
2003 struct fc_frame *fp; in fc_exch_els_rec() local
2045 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_exch_els_rec()
2046 if (!fp) { in fc_exch_els_rec()
2051 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_exch_els_rec()
2065 fc_fill_reply_hdr(fp, rfp, FC_RCTL_ELS_REP, 0); in fc_exch_els_rec()
2066 lport->tt.frame_send(lport, fp); in fc_exch_els_rec()
2085 static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg) in fc_exch_rrq_resp() argument
2090 if (IS_ERR(fp)) { in fc_exch_rrq_resp()
2091 int err = PTR_ERR(fp); in fc_exch_rrq_resp()
2100 op = fc_frame_payload_op(fp); in fc_exch_rrq_resp()
2101 fc_frame_free(fp); in fc_exch_rrq_resp()
2160 struct fc_frame *fp, in fc_exch_seq_send() argument
2162 struct fc_frame *fp, in fc_exch_seq_send()
2173 ep = fc_exch_alloc(lport, fp); in fc_exch_seq_send()
2175 fc_frame_free(fp); in fc_exch_seq_send()
2179 fh = fc_frame_header_get(fp); in fc_exch_seq_send()
2190 fc_exch_setup_hdr(ep, fp, ep->f_ctl); in fc_exch_seq_send()
2194 fsp = fr_fsp(fp); in fc_exch_seq_send()
2195 fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); in fc_exch_seq_send()
2198 if (unlikely(lport->tt.frame_send(lport, fp))) in fc_exch_seq_send()
2231 struct fc_frame *fp; in fc_exch_rrq() local
2236 fp = fc_frame_alloc(lport, sizeof(*rrq)); in fc_exch_rrq()
2237 if (!fp) in fc_exch_rrq()
2240 rrq = fc_frame_payload_get(fp, sizeof(*rrq)); in fc_exch_rrq()
2251 fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did, in fc_exch_rrq()
2255 if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep, in fc_exch_rrq()
2277 static void fc_exch_els_rrq(struct fc_frame *fp) in fc_exch_els_rrq() argument
2286 lport = fr_dev(fp); in fc_exch_els_rrq()
2287 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_els_rrq()
2329 fc_seq_ls_acc(fp); in fc_exch_els_rrq()
2335 fc_seq_ls_rjt(fp, ELS_RJT_LOGIC, explan); in fc_exch_els_rrq()
2586 void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) in fc_exch_recv() argument
2588 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv()
2596 fc_frame_free(fp); in fc_exch_recv()
2609 fc_frame_free(fp); in fc_exch_recv()
2616 switch (fr_eof(fp)) { in fc_exch_recv()
2619 skb_trim(fp_skb(fp), fr_len(fp) - FC_FC_FILL(f_ctl)); in fc_exch_recv()
2623 fc_exch_recv_bls(ema->mp, fp); in fc_exch_recv()
2626 fc_exch_recv_seq_resp(ema->mp, fp); in fc_exch_recv()
2628 fc_exch_recv_resp(ema->mp, fp); in fc_exch_recv()
2630 fc_exch_recv_req(lport, ema->mp, fp); in fc_exch_recv()
2634 fr_eof(fp)); in fc_exch_recv()
2635 fc_frame_free(fp); in fc_exch_recv()