52
52
* while making the callback. To ensure that the rport is not free'd while
53
53
* processing the callback the rport callbacks are serialized through a
54
54
* single-threaded workqueue. An rport would never be free'd while in a
55
* callback handler becuase no other rport work in this queue can be executed
55
* callback handler because no other rport work in this queue can be executed
56
56
* at the same time.
58
58
* When discovery succeeds or fails a callback is made to the lport as
163
163
* fc_lport_rport_callback() - Event handler for rport events
164
164
* @lport: The lport which is receiving the event
165
165
* @rdata: private remote port data
166
* @event: The event that occured
166
* @event: The event that occurred
168
168
* Locking Note: The rport lock should not be held when calling
381
381
* fc_lport_recv_rlir_req() - Handle received Registered Link Incident Report.
382
* @lport: Fibre Channel local port recieving the RLIR
382
* @lport: Fibre Channel local port receiving the RLIR
383
383
* @fp: The RLIR request frame
385
385
* Locking Note: The lport lock is expected to be held before calling
398
398
* fc_lport_recv_echo_req() - Handle received ECHO request
399
* @lport: The local port recieving the ECHO
399
* @lport: The local port receiving the ECHO
400
400
* @fp: ECHO request frame
402
402
* Locking Note: The lport lock is expected to be held before calling
434
434
* fc_lport_recv_rnid_req() - Handle received Request Node ID data request
435
* @lport: The local port recieving the RNID
435
* @lport: The local port receiving the RNID
436
436
* @fp: The RNID request frame
438
438
* Locking Note: The lport lock is expected to be held before calling
493
493
* fc_lport_recv_logo_req() - Handle received fabric LOGO request
494
* @lport: The local port recieving the LOGO
494
* @lport: The local port receiving the LOGO
495
495
* @fp: The LOGO request frame
497
497
* Locking Note: The lport lock is exected to be held before calling
633
633
lport->tt.fcp_abort_io(lport);
634
634
lport->tt.disc_stop_final(lport);
635
635
lport->tt.exch_mgr_reset(lport, 0, 0);
636
fc_fc4_del_lport(lport);
638
639
EXPORT_SYMBOL(fc_lport_destroy);
772
773
* fc_lport_recv_flogi_req() - Receive a FLOGI request
773
* @lport: The local port that recieved the request
774
* @lport: The local port that received the request
774
775
* @rx_fp: The FLOGI frame
776
777
* A received FLOGI request indicates a point-to-point connection.
857
858
* if an rport should handle the request.
859
860
* Locking Note: This function should not be called with the lport
860
* lock held becuase it will grab the lock.
861
* lock held because it will grab the lock.
862
static void fc_lport_recv_req(struct fc_lport *lport, struct fc_frame *fp)
863
static void fc_lport_recv_els_req(struct fc_lport *lport,
864
struct fc_frame_header *fh = fc_frame_header_get(fp);
865
866
void (*recv)(struct fc_lport *, struct fc_frame *);
867
868
mutex_lock(&lport->lp_mutex);
907
FC_LPORT_DBG(lport, "dropping invalid frame (eof %x)\n",
911
907
mutex_unlock(&lport->lp_mutex);
910
static int fc_lport_els_prli(struct fc_rport_priv *rdata, u32 spp_len,
911
const struct fc_els_spp *spp_in,
912
struct fc_els_spp *spp_out)
914
return FC_SPP_RESP_INVL;
917
struct fc4_prov fc_lport_els_prov = {
918
.prli = fc_lport_els_prli,
919
.recv = fc_lport_recv_els_req,
923
* fc_lport_recv_req() - The generic lport request handler
924
* @lport: The lport that received the request
925
* @fp: The frame the request is in
927
* Locking Note: This function should not be called with the lport
928
* lock held because it may grab the lock.
930
static void fc_lport_recv_req(struct fc_lport *lport,
933
struct fc_frame_header *fh = fc_frame_header_get(fp);
934
struct fc_seq *sp = fr_seq(fp);
935
struct fc4_prov *prov;
938
* Use RCU read lock and module_lock to be sure module doesn't
939
* deregister and get unloaded while we're calling it.
940
* try_module_get() is inlined and accepts a NULL parameter.
941
* Only ELSes and FCP target ops should come through here.
942
* The locking is unfortunate, and a better scheme is being sought.
946
if (fh->fh_type >= FC_FC4_PROV_SIZE)
948
prov = rcu_dereference(fc_passive_prov[fh->fh_type]);
949
if (!prov || !try_module_get(prov->module))
952
prov->recv(lport, fp);
953
module_put(prov->module);
957
FC_LPORT_DBG(lport, "dropping unexpected frame type %x\n", fh->fh_type);
959
lport->tt.exch_done(sp);
915
963
* fc_lport_reset() - Reset a local port
916
964
* @lport: The local port which should be reset
1550
1598
fc_lport_add_fc4_type(lport, FC_TYPE_FCP);
1551
1599
fc_lport_add_fc4_type(lport, FC_TYPE_CT);
1600
fc_fc4_conf_lport_params(lport, FC_TYPE_FCP);