Lines Matching refs:fp
272 static void fc_exch_setup_hdr(struct fc_exch *ep, struct fc_frame *fp, in fc_exch_setup_hdr() argument
275 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_setup_hdr()
278 fr_sof(fp) = ep->class; in fc_exch_setup_hdr()
280 fr_sof(fp) = fc_sof_normal(ep->class); in fc_exch_setup_hdr()
283 fr_eof(fp) = FC_EOF_T; in fc_exch_setup_hdr()
285 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
295 fill = fr_len(fp) & 3; in fc_exch_setup_hdr()
299 skb_put(fp_skb(fp), fill); in fc_exch_setup_hdr()
303 WARN_ON(fr_len(fp) % 4 != 0); /* no pad to non last frame */ in fc_exch_setup_hdr()
304 fr_eof(fp) = FC_EOF_N; in fc_exch_setup_hdr()
467 struct fc_frame *fp) in fc_seq_send_locked() argument
470 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_send_locked()
478 fc_frame_free(fp); in fc_seq_send_locked()
485 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_locked()
486 fr_encaps(fp) = ep->encaps; in fc_seq_send_locked()
493 if (fr_max_payload(fp)) in fc_seq_send_locked()
494 sp->cnt += DIV_ROUND_UP((fr_len(fp) - sizeof(*fh)), in fc_seq_send_locked()
495 fr_max_payload(fp)); in fc_seq_send_locked()
502 error = lport->tt.frame_send(lport, fp); in fc_seq_send_locked()
529 struct fc_frame *fp) in fc_seq_send() argument
535 error = fc_seq_send_locked(lport, sp, fp); in fc_seq_send()
632 struct fc_frame *fp; in fc_exch_abort_locked() local
653 fp = fc_frame_alloc(ep->lp, 0); in fc_exch_abort_locked()
654 if (fp) { in fc_exch_abort_locked()
656 fc_fill_fc_hdr(fp, FC_RCTL_BA_ABTS, ep->did, ep->sid, in fc_exch_abort_locked()
659 error = fc_seq_send_locked(ep->lp, sp, fp); in fc_exch_abort_locked()
719 struct fc_frame *fp) in fc_invoke_resp() argument
721 void (*resp)(struct fc_seq *, struct fc_frame *fp, void *arg); in fc_invoke_resp()
734 resp(sp, fp, arg); in fc_invoke_resp()
892 struct fc_frame *fp) in fc_exch_alloc() argument
897 if (!ema->match || ema->match(fp)) in fc_exch_alloc()
965 struct fc_frame *fp) in fc_exch_resp() argument
970 ep = fc_exch_alloc(lport, fp); in fc_exch_resp()
972 ep->class = fc_frame_class(fp); in fc_exch_resp()
979 fh = fc_frame_header_get(fp); in fc_exch_resp()
1013 struct fc_frame *fp) in fc_seq_lookup_recip() argument
1015 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_recip()
1051 fc_frame_payload_op(fp) == ELS_TEST) { in fc_seq_lookup_recip()
1060 if ((f_ctl & FC_FC_FIRST_SEQ) && fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1066 ep = fc_exch_resp(lport, mp, fp); in fc_seq_lookup_recip()
1084 if (fc_sof_is_init(fr_sof(fp))) { in fc_seq_lookup_recip()
1124 fr_seq(fp) = sp; in fc_seq_lookup_recip()
1142 struct fc_frame *fp) in fc_seq_lookup_orig() argument
1144 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_seq_lookup_orig()
1200 static void fc_seq_els_rsp_send(struct fc_frame *fp, enum fc_els_cmd els_cmd, in fc_seq_els_rsp_send() argument
1205 fc_seq_ls_rjt(fp, els_data->reason, els_data->explan); in fc_seq_els_rsp_send()
1208 fc_seq_ls_acc(fp); in fc_seq_els_rsp_send()
1211 fc_exch_els_rrq(fp); in fc_seq_els_rsp_send()
1214 fc_exch_els_rec(fp); in fc_seq_els_rsp_send()
1217 FC_LPORT_DBG(fr_dev(fp), "Invalid ELS CMD:%x\n", els_cmd); in fc_seq_els_rsp_send()
1228 static void fc_seq_send_last(struct fc_seq *sp, struct fc_frame *fp, in fc_seq_send_last() argument
1236 fc_fill_fc_hdr(fp, rctl, ep->did, ep->sid, fh_type, f_ctl, 0); in fc_seq_send_last()
1237 fc_seq_send_locked(ep->lp, sp, fp); in fc_seq_send_last()
1249 struct fc_frame *fp; in fc_seq_send_ack() local
1260 fp = fc_frame_alloc(lport, 0); in fc_seq_send_ack()
1261 if (!fp) in fc_seq_send_ack()
1264 fh = fc_frame_header_get(fp); in fc_seq_send_ack()
1284 fc_exch_setup_hdr(ep, fp, f_ctl); in fc_seq_send_ack()
1289 fr_sof(fp) = fr_sof(rx_fp); in fc_seq_send_ack()
1291 fr_eof(fp) = FC_EOF_T; in fc_seq_send_ack()
1293 fr_eof(fp) = FC_EOF_N; in fc_seq_send_ack()
1295 lport->tt.frame_send(lport, fp); in fc_seq_send_ack()
1311 struct fc_frame *fp; in fc_exch_send_ba_rjt() local
1319 fp = fc_frame_alloc(lport, sizeof(*rp)); in fc_exch_send_ba_rjt()
1320 if (!fp) in fc_exch_send_ba_rjt()
1322 fh = fc_frame_header_get(fp); in fc_exch_send_ba_rjt()
1327 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_send_ba_rjt()
1359 fr_sof(fp) = fc_sof_class(fr_sof(rx_fp)); in fc_exch_send_ba_rjt()
1360 fr_eof(fp) = FC_EOF_T; in fc_exch_send_ba_rjt()
1361 if (fc_sof_needs_ack(fr_sof(fp))) in fc_exch_send_ba_rjt()
1362 fr_eof(fp) = FC_EOF_N; in fc_exch_send_ba_rjt()
1364 lport->tt.frame_send(lport, fp); in fc_exch_send_ba_rjt()
1378 struct fc_frame *fp; in fc_exch_recv_abts() local
1386 fp = fc_frame_alloc(ep->lp, sizeof(*ap)); in fc_exch_recv_abts()
1387 if (!fp) in fc_exch_recv_abts()
1394 fc_frame_free(fp); in fc_exch_recv_abts()
1402 fh = fc_frame_header_get(fp); in fc_exch_recv_abts()
1403 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_recv_abts()
1414 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); in fc_exch_recv_abts()
1436 static struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp) in fc_seq_assign() argument
1440 WARN_ON(lport != fr_dev(fp)); in fc_seq_assign()
1441 WARN_ON(fr_seq(fp)); in fc_seq_assign()
1442 fr_seq(fp) = NULL; in fc_seq_assign()
1445 if ((!ema->match || ema->match(fp)) && in fc_seq_assign()
1446 fc_seq_lookup_recip(lport, ema->mp, fp) == FC_RJT_NONE) in fc_seq_assign()
1448 return fr_seq(fp); in fc_seq_assign()
1470 struct fc_frame *fp) in fc_exch_recv_req() argument
1472 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_req()
1482 fc_frame_free(fp); in fc_exch_recv_req()
1485 fr_dev(fp) = lport; in fc_exch_recv_req()
1487 BUG_ON(fr_seq(fp)); /* XXX remove later */ in fc_exch_recv_req()
1494 return lport->tt.lport_recv(lport, fp); in fc_exch_recv_req()
1496 reject = fc_seq_lookup_recip(lport, mp, fp); in fc_exch_recv_req()
1498 sp = fr_seq(fp); /* sequence will be held */ in fc_exch_recv_req()
1500 fc_seq_send_ack(sp, fp); in fc_exch_recv_req()
1501 ep->encaps = fr_encaps(fp); in fc_exch_recv_req()
1514 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_req()
1515 lport->tt.lport_recv(lport, fp); in fc_exch_recv_req()
1520 fc_frame_free(fp); in fc_exch_recv_req()
1531 static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_seq_resp() argument
1533 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv_seq_resp()
1560 sof = fr_sof(fp); in fc_exch_recv_seq_resp()
1571 fr_seq(fp) = sp; in fc_exch_recv_seq_resp()
1579 fc_seq_send_ack(sp, fp); in fc_exch_recv_seq_resp()
1581 if (fh->fh_type != FC_TYPE_FCP && fr_eof(fp) == FC_EOF_T && in fc_exch_recv_seq_resp()
1605 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_recv_seq_resp()
1606 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1613 fc_frame_free(fp); in fc_exch_recv_seq_resp()
1622 static void fc_exch_recv_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_resp() argument
1626 sp = fc_seq_lookup_orig(mp, fp); /* doesn't hold sequence */ in fc_exch_recv_resp()
1633 fc_frame_free(fp); in fc_exch_recv_resp()
1644 static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp) in fc_exch_abts_resp() argument
1653 fh = fc_frame_header_get(fp); in fc_exch_abts_resp()
1665 ap = fc_frame_payload_get(fp, sizeof(*ap)); in fc_exch_abts_resp()
1705 if (!fc_invoke_resp(ep, sp, fp)) in fc_exch_abts_resp()
1706 fc_frame_free(fp); in fc_exch_abts_resp()
1720 static void fc_exch_recv_bls(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_bls() argument
1726 fh = fc_frame_header_get(fp); in fc_exch_recv_bls()
1728 fr_seq(fp) = NULL; in fc_exch_recv_bls()
1753 fc_frame_free(fp); in fc_exch_recv_bls()
1759 fc_exch_abts_resp(ep, fp); in fc_exch_recv_bls()
1761 fc_frame_free(fp); in fc_exch_recv_bls()
1764 fc_exch_recv_abts(ep, fp); in fc_exch_recv_bls()
1767 fc_frame_free(fp); in fc_exch_recv_bls()
1786 struct fc_frame *fp; in fc_seq_ls_acc() local
1789 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_seq_ls_acc()
1790 if (!fp) in fc_seq_ls_acc()
1792 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_seq_ls_acc()
1795 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_acc()
1796 lport->tt.frame_send(lport, fp); in fc_seq_ls_acc()
1813 struct fc_frame *fp; in fc_seq_ls_rjt() local
1816 fp = fc_frame_alloc(lport, sizeof(*rjt)); in fc_seq_ls_rjt()
1817 if (!fp) in fc_seq_ls_rjt()
1819 rjt = fc_frame_payload_get(fp, sizeof(*rjt)); in fc_seq_ls_rjt()
1824 fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); in fc_seq_ls_rjt()
1825 lport->tt.frame_send(lport, fp); in fc_seq_ls_rjt()
1956 struct fc_frame *fp; in fc_exch_els_rec() local
1984 fp = fc_frame_alloc(lport, sizeof(*acc)); in fc_exch_els_rec()
1985 if (!fp) in fc_exch_els_rec()
1988 acc = fc_frame_payload_get(fp, sizeof(*acc)); in fc_exch_els_rec()
2002 fc_fill_reply_hdr(fp, rfp, FC_RCTL_ELS_REP, 0); in fc_exch_els_rec()
2003 lport->tt.frame_send(lport, fp); in fc_exch_els_rec()
2022 static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg) in fc_exch_rrq_resp() argument
2027 if (IS_ERR(fp)) { in fc_exch_rrq_resp()
2028 int err = PTR_ERR(fp); in fc_exch_rrq_resp()
2037 op = fc_frame_payload_op(fp); in fc_exch_rrq_resp()
2038 fc_frame_free(fp); in fc_exch_rrq_resp()
2079 struct fc_frame *fp, in fc_exch_seq_send() argument
2081 struct fc_frame *fp, in fc_exch_seq_send()
2093 ep = fc_exch_alloc(lport, fp); in fc_exch_seq_send()
2095 fc_frame_free(fp); in fc_exch_seq_send()
2099 fh = fc_frame_header_get(fp); in fc_exch_seq_send()
2110 fc_exch_setup_hdr(ep, fp, ep->f_ctl); in fc_exch_seq_send()
2114 fsp = fr_fsp(fp); in fc_exch_seq_send()
2115 fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); in fc_exch_seq_send()
2118 if (unlikely(lport->tt.frame_send(lport, fp))) in fc_exch_seq_send()
2150 struct fc_frame *fp; in fc_exch_rrq() local
2155 fp = fc_frame_alloc(lport, sizeof(*rrq)); in fc_exch_rrq()
2156 if (!fp) in fc_exch_rrq()
2159 rrq = fc_frame_payload_get(fp, sizeof(*rrq)); in fc_exch_rrq()
2170 fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did, in fc_exch_rrq()
2174 if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep, in fc_exch_rrq()
2195 static void fc_exch_els_rrq(struct fc_frame *fp) in fc_exch_els_rrq() argument
2204 lport = fr_dev(fp); in fc_exch_els_rrq()
2205 rp = fc_frame_payload_get(fp, sizeof(*rp)); in fc_exch_els_rrq()
2245 fc_seq_ls_acc(fp); in fc_exch_els_rrq()
2251 fc_seq_ls_rjt(fp, ELS_RJT_LOGIC, explan); in fc_exch_els_rrq()
2501 void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) in fc_exch_recv() argument
2503 struct fc_frame_header *fh = fc_frame_header_get(fp); in fc_exch_recv()
2511 fc_frame_free(fp); in fc_exch_recv()
2524 fc_frame_free(fp); in fc_exch_recv()
2531 switch (fr_eof(fp)) { in fc_exch_recv()
2534 skb_trim(fp_skb(fp), fr_len(fp) - FC_FC_FILL(f_ctl)); in fc_exch_recv()
2538 fc_exch_recv_bls(ema->mp, fp); in fc_exch_recv()
2541 fc_exch_recv_seq_resp(ema->mp, fp); in fc_exch_recv()
2543 fc_exch_recv_resp(ema->mp, fp); in fc_exch_recv()
2545 fc_exch_recv_req(lport, ema->mp, fp); in fc_exch_recv()
2549 fr_eof(fp)); in fc_exch_recv()
2550 fc_frame_free(fp); in fc_exch_recv()