libfc callback cleanup
Subsystems (5)
Hannes Reinecke
maintainerPATCH 2/20 libfc: Replace ->lport_reset callback with function call
In reply to Hannes ReineckeThe ->lport_reset callback only ever had one implementation, which already is exported. So remove it and use the function directly.
--- drivers/scsi/fnic/fnic_scsi.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 2 +- drivers/scsi/libfc/fc_lport.c | 3 --- include/scsi/libfc.h | 7 ------- 4 files changed, 2 insertions(+), 12 deletions(-)
drivers/scsi/fnic/fnic_scsi.c +1 -1
@@ -2543,7 +2543,7 @@ int fnic_reset(struct Scsi_Host *shost)* Reset local port, this will clean up libFC exchanges, * reset remote port sessions, and if link is up, begin flogi */ - ret = lp->tt.lport_reset (lp); + ret =fc_lport_reset (lp); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "Returning from fnic reset %s\n",
drivers/scsi/libfc/fc_fcp.c +1 -1
@@ -2224,7 +2224,7 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)fc_block_scsi_eh (sc_cmd); - lport->tt.lport_reset (lport); +fc_lport_reset (lport); wait_tmo = jiffies +FC_HOST_RESET_TIMEOUT ;while (!fc_fcp_lport_queue_ready (lport) &&time_before (jiffies, wait_tmo))
drivers/scsi/libfc/fc_lport.c +0 -3
@@ -1868,9 +1868,6 @@ int fc_lport_init(struct fc_lport *lport)if (!lport->tt.lport_recv) lport->tt.lport_recv = fc_lport_recv_req; -if (!lport->tt.lport_reset) - lport->tt.lport_reset = fc_lport_reset; -fc_host_port_type (lport->host) =FC_PORTTYPE_NPORT ;fc_host_node_name (lport->host) = lport->wwnn;fc_host_port_name (lport->host) = lport->wwpn;
include/scsi/libfc.h +0 -7
@@ -628,13 +628,6 @@ struct libfc_function_template {void (*lport_recv)(struct fc_lport *,struct fc_frame *);/* -* Reset the local port. -* -* STATUS: OPTIONAL -*/ -int (*lport_reset)(struct fc_lport *); - -/* * Set the local port FC_ID. * * This may be provided by the LLD to allow it to be
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainercover libfc callback cleanup
Hi all,
it has been bugging me for a while that libfc has tons of callbacks in an attempt to abstract things away. But as it turned out no-one ever used those, rendering them quite pointless.
As I got some time to kill on the train back from Vienna I've decided to finally kill them and call the functions directly.
As usual, comments and reviews are welcome.
Hannes Reinecke (20):
libfc: Replace ->seq_els_rsp_send callback with function call
libfc: Replace ->lport_reset callback with function call
libfc: Replace ->lport_recv with function call
libfc: Replace ->exch_seq_send callback with function call
libfc: Replace ->rport_destroy callback with function call
libfc: Replace ->rport_lookup callback with function call
scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'
libfc: Replace ->rport_create callback with function call
libfc: Replace ->rport_login callback with function call
libfc: Replace ->rport_logoff callback with function call
libfc: Replace ->rport_recv_req callback with function call
libfc: Replace ->rport_flush_queue callback with function call
libfc: Remove fc_rport_init()
libfc: Replace ->seq_send callback with function call
libfc: Replace ->seq_exch_abort callback with function call
libfc: Replace ->exch_done callback with function call
libfc: Replace ->seq_start_next callback with function call
libfc: Replace ->seq_set_resp callback with direct function call
libfc: Replace ->seq_assign callback with function call
libfc: Replace ->seq_release callback with function call
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 - drivers/scsi/bnx2fc/bnx2fc_tgt.c | 3 +- drivers/scsi/fcoe/fcoe_ctlr.c | 35 ++++--- drivers/scsi/fnic/fnic_scsi.c | 2 +- drivers/scsi/libfc/fc_disc.c | 33 ++++--- drivers/scsi/libfc/fc_elsct.c | 2 +- drivers/scsi/libfc/fc_exch.c | 104 ++++++++++---------- drivers/scsi/libfc/fc_fcp.c | 45 ++++----- drivers/scsi/libfc/fc_libfc.c | 2 +- drivers/scsi/libfc/fc_lport.c | 62 ++++++------ drivers/scsi/libfc/fc_rport.c | 167 ++++++++++++++------------------ drivers/scsi/scsi_transport_fc.c | 8 +- drivers/target/tcm_fc/tfc_cmd.c | 20 ++-- drivers/target/tcm_fc/tfc_io.c | 4 +- include/scsi/libfc.h | 195 ++++++-------------------------------- 15 files changed, 254 insertions(+), 429 deletions(-)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 1/20 libfc: Replace ->seq_els_rsp_send callback with function call
The 'seq_els_rsp_send' callback only ever had one implementation, so we might as well drop it and use the function directly.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/libfc/fc_disc.c | 4 ++-- drivers/scsi/libfc/fc_exch.c | 8 +++----- drivers/scsi/libfc/fc_lport.c | 6 +++--- drivers/scsi/libfc/fc_rport.c | 26 +++++++++++++------------- include/scsi/libfc.h | 10 ++-------- 6 files changed, 24 insertions(+), 32 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +1 -1
@@ -3031,7 +3031,7 @@ static void fcoe_ctlr_disc_recv(struct fc_lport *lport, struct fc_frame *fp) rjt_data.reason =ELS_RJT_UNSUP ; rjt_data.explan =ELS_EXPL_NONE ; - lport->tt.seq_els_rsp_send (fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (fp,ELS_LS_RJT , &rjt_data);fc_frame_free (fp); }
drivers/scsi/libfc/fc_disc.c +2 -2
@@ -154,7 +154,7 @@ static void fc_disc_recv_rscn_req(struct fc_disc *disc, struct fc_frame *fp)break ; } } - lport->tt.seq_els_rsp_send (fp,ELS_LS_ACC ,NULL ); +fc_seq_els_rsp_send (fp,ELS_LS_ACC ,NULL );/* * If not doing a complete rediscovery, do GPN_ID on
@@ -182,7 +182,7 @@ static void fc_disc_recv_rscn_req(struct fc_disc *disc, struct fc_frame *fp)FC_DISC_DBG (disc,"Received a bad RSCN frame\n" ); rjt_data.reason =ELS_RJT_LOGIC ; rjt_data.explan =ELS_EXPL_NONE ; - lport->tt.seq_els_rsp_send (fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (fp,ELS_LS_RJT , &rjt_data);fc_frame_free (fp); }
drivers/scsi/libfc/fc_exch.c +3 -5
@@ -1222,8 +1222,8 @@ static void fc_exch_set_addr(struct fc_exch *ep,* * The received frame is not freed. */ -static void fc_seq_els_rsp_send (struct fc_frame *fp,enum fc_els_cmd els_cmd, -struct fc_seq_els_data *els_data) +void fc_seq_els_rsp_send (struct fc_frame *fp,enum fc_els_cmd els_cmd, +struct fc_seq_els_data *els_data) {switch (els_cmd) {case ELS_LS_RJT :
@@ -1242,6 +1242,7 @@ static void fc_seq_els_rsp_send(struct fc_frame *fp, enum fc_els_cmd els_cmd,FC_LPORT_DBG (fr_dev (fp),"Invalid ELS CMD:%x\n" , els_cmd); } } +EXPORT_SYMBOL_GPL (fc_seq_els_rsp_send);/** * fc_seq_send_last() - Send a sequence that is the last in the exchange
@@ -2635,9 +2636,6 @@ int fc_exch_init(struct fc_lport *lport)if (!lport->tt.seq_send) lport->tt.seq_send = fc_seq_send; -if (!lport->tt.seq_els_rsp_send) - lport->tt.seq_els_rsp_send = fc_seq_els_rsp_send; -if (!lport->tt.exch_done) lport->tt.exch_done = fc_exch_done;
drivers/scsi/libfc/fc_lport.c +3 -3
@@ -412,7 +412,7 @@ static void fc_lport_recv_rlir_req(struct fc_lport *lport, struct fc_frame *fp)FC_LPORT_DBG (lport,"Received RLIR request while in state %s\n" ,fc_lport_state (lport)); - lport->tt.seq_els_rsp_send (fp,ELS_LS_ACC ,NULL ); +fc_seq_els_rsp_send (fp,ELS_LS_ACC ,NULL );fc_frame_free (fp); }
@@ -481,7 +481,7 @@ static void fc_lport_recv_rnid_req(struct fc_lport *lport,if (!req) { rjt_data.reason =ELS_RJT_LOGIC ; rjt_data.explan =ELS_EXPL_NONE ; - lport->tt.seq_els_rsp_send (in_fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (in_fp,ELS_LS_RJT , &rjt_data); }else { fmt = req->rnid_fmt; len =sizeof (*rp);
@@ -521,7 +521,7 @@ static void fc_lport_recv_rnid_req(struct fc_lport *lport,*/ static void fc_lport_recv_logo_req (struct fc_lport *lport,struct fc_frame *fp) { - lport->tt.seq_els_rsp_send (fp,ELS_LS_ACC ,NULL ); +fc_seq_els_rsp_send (fp,ELS_LS_ACC ,NULL );fc_lport_enter_reset (lport);fc_frame_free (fp); }
drivers/scsi/libfc/fc_rport.c +13 -13
@@ -967,7 +967,7 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport, reject_put:kref_put (&rdata->kref, lport->tt.rport_destroy); reject: - lport->tt.seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data);fc_frame_free (rx_fp); }
@@ -1416,7 +1416,7 @@ static void fc_rport_recv_rtv_req(struct fc_rport_priv *rdata,if (!fp) { rjt_data.reason =ELS_RJT_UNAB ; rjt_data.reason =ELS_EXPL_INSUF_RES ; - lport->tt.seq_els_rsp_send (in_fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (in_fp,ELS_LS_RJT , &rjt_data); goto drop; } rtv =fc_frame_payload_get (fp,sizeof (*rtv));
@@ -1591,7 +1591,7 @@ static void fc_rport_recv_adisc_req(struct fc_rport_priv *rdata,if (!adisc) { rjt_data.reason =ELS_RJT_PROT ; rjt_data.explan =ELS_EXPL_INV_LEN ; - lport->tt.seq_els_rsp_send (in_fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (in_fp,ELS_LS_RJT , &rjt_data); goto drop; }
@@ -1667,7 +1667,7 @@ static void fc_rport_recv_rls_req(struct fc_rport_priv *rdata, goto out; out_rjt: - lport->tt.seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data); out:fc_frame_free (rx_fp); }
@@ -1734,11 +1734,11 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp)fc_rport_recv_adisc_req (rdata, fp);break ;case ELS_RRQ : - lport->tt.seq_els_rsp_send (fp,ELS_RRQ ,NULL ); +fc_seq_els_rsp_send (fp,ELS_RRQ ,NULL );fc_frame_free (fp);break ;case ELS_REC : - lport->tt.seq_els_rsp_send (fp,ELS_REC ,NULL ); +fc_seq_els_rsp_send (fp,ELS_REC ,NULL );fc_frame_free (fp);break ;case ELS_RLS :
@@ -1759,14 +1759,14 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp) reject: els_data.reason =ELS_RJT_UNAB ; els_data.explan =ELS_EXPL_PLOGI_REQD ; - lport->tt.seq_els_rsp_send (fp,ELS_LS_RJT , &els_data); +fc_seq_els_rsp_send (fp,ELS_LS_RJT , &els_data);fc_frame_free (fp);return ; busy: els_data.reason =ELS_RJT_BUSY ; els_data.explan =ELS_EXPL_NONE ; - lport->tt.seq_els_rsp_send (fp,ELS_LS_RJT , &els_data); +fc_seq_els_rsp_send (fp,ELS_LS_RJT , &els_data);fc_frame_free (fp);return ; }
@@ -1812,7 +1812,7 @@ static void fc_rport_recv_req(struct fc_lport *lport, struct fc_frame *fp)default : els_data.reason =ELS_RJT_UNSUP ; els_data.explan =ELS_EXPL_NONE ; - lport->tt.seq_els_rsp_send (fp,ELS_LS_RJT , &els_data); +fc_seq_els_rsp_send (fp,ELS_LS_RJT , &els_data);fc_frame_free (fp);break ; }
@@ -1939,7 +1939,7 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,return ; reject: - lport->tt.seq_els_rsp_send (fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (fp,ELS_LS_RJT , &rjt_data);fc_frame_free (fp); }
@@ -2055,7 +2055,7 @@ static void fc_rport_recv_prli_req(struct fc_rport_priv *rdata, rjt_data.reason =ELS_RJT_PROT ; rjt_data.explan =ELS_EXPL_INV_LEN ; reject: - lport->tt.seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data); drop:fc_frame_free (rx_fp); }
@@ -2126,7 +2126,7 @@ static void fc_rport_recv_prlo_req(struct fc_rport_priv *rdata, rjt_data.reason =ELS_RJT_PROT ; rjt_data.explan =ELS_EXPL_INV_LEN ; reject: - lport->tt.seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data); +fc_seq_els_rsp_send (rx_fp,ELS_LS_RJT , &rjt_data); drop:fc_frame_free (rx_fp); }
@@ -2146,7 +2146,7 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp)struct fc_rport_priv *rdata;u32 sid; - lport->tt.seq_els_rsp_send (fp,ELS_LS_ACC ,NULL ); +fc_seq_els_rsp_send (fp,ELS_LS_ACC ,NULL ); sid =fc_frame_sid (fp);
include/scsi/libfc.h +2 -8
@@ -553,14 +553,6 @@ struct libfc_function_template { struct fc_frame *);/* -* Send an ELS response using information from the received frame. -* -* STATUS: OPTIONAL -*/ -void (*seq_els_rsp_send)(struct fc_frame *,enum fc_els_cmd , -struct fc_seq_els_data *); - -/* * Abort an exchange and sequence. Generally called because of a * exchange timeout or an abort from the upper layer. *
@@ -1138,6 +1130,8 @@ void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,*****************************/ int fc_exch_init (struct fc_lport *);void fc_exch_update_stats (struct fc_lport *lport); +void fc_seq_els_rsp_send (struct fc_frame *,enum fc_els_cmd , +struct fc_seq_els_data *);struct fc_exch_mgr_anchor *fc_exch_mgr_add (struct fc_lport *,struct fc_exch_mgr *,bool (*match)(struct fc_frame *));
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 3/20 libfc: Replace ->lport_recv with function call
In reply to Hannes ReineckeThe ->lport_recv callback only ever had one implementation, so call the function directly and remove the callback.
--- drivers/scsi/libfc/fc_exch.c | 4 ++-- drivers/scsi/libfc/fc_lport.c | 9 +++------ include/scsi/libfc.h | 8 +------- 3 files changed, 6 insertions(+), 15 deletions(-)
drivers/scsi/libfc/fc_exch.c +2 -2
@@ -1527,7 +1527,7 @@ static void fc_exch_recv_req(struct fc_lport *lport, struct fc_exch_mgr *mp,* The upper-level protocol may request one later, if needed. */ if (fh->fh_rx_id ==htons (FC_XID_UNKNOWN )) -return lport->tt.lport_recv (lport, fp); +return fc_lport_recv (lport, fp); reject =fc_seq_lookup_recip (lport, mp, fp);if (reject ==FC_RJT_NONE ) {
@@ -1548,7 +1548,7 @@ static void fc_exch_recv_req(struct fc_lport *lport, struct fc_exch_mgr *mp,* first. */ if (!fc_invoke_resp (ep, sp, fp)) - lport->tt.lport_recv (lport, fp); +fc_lport_recv (lport, fp);fc_exch_release (ep);/* release from lookup */ }else { FC_LPORT_DBG(lport, "exch/seq lookup failed: reject %x\n",
drivers/scsi/libfc/fc_lport.c +3 -6
@@ -944,15 +944,14 @@ struct fc4_prov fc_lport_els_prov = { };/** -* fc_lport_recv_req() - The generic lport request handler +* fc_lport_recv() - The generic lport request handler * @lport: The lport that received the request * @fp: The frame the request is in * * Locking Note: This function should not be called with the lport * lock held because it may grab the lock. */ -static void fc_lport_recv_req (struct fc_lport *lport, -struct fc_frame *fp) +void fc_lport_recv (struct fc_lport *lport,struct fc_frame *fp) {struct fc_frame_header *fh =fc_frame_header_get (fp);struct fc_seq *sp =fr_seq (fp);
@@ -983,6 +982,7 @@ static void fc_lport_recv_req(struct fc_lport *lport,if (sp) lport->tt.exch_done (sp); } +EXPORT_SYMBOL (fc_lport_recv);/** * fc_lport_reset() - Reset a local port
@@ -1865,9 +1865,6 @@ int fc_lport_config(struct fc_lport *lport)*/ int fc_lport_init (struct fc_lport *lport) { -if (!lport->tt.lport_recv) - lport->tt.lport_recv = fc_lport_recv_req; -fc_host_port_type (lport->host) =FC_PORTTYPE_NPORT ;fc_host_node_name (lport->host) = lport->wwnn;fc_host_port_name (lport->host) = lport->wwpn;
include/scsi/libfc.h +1 -7
@@ -621,13 +621,6 @@ struct libfc_function_template {void (*rport_flush_queue)(void );/* -* Receive a frame for a local port. -* -* STATUS: OPTIONAL -*/ -void (*lport_recv)(struct fc_lport *,struct fc_frame *); - -/* * Set the local port FC_ID. * * This may be provided by the LLD to allow it to be
@@ -1060,6 +1053,7 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)void fc_vports_linkchange (struct fc_lport *);int fc_lport_config (struct fc_lport *);int fc_lport_reset (struct fc_lport *); +void fc_lport_recv (struct fc_lport *lport,struct fc_frame *fp);int fc_set_mfs (struct fc_lport *,u32 mfs);struct fc_lport *libfc_vport_create (struct fc_vport *,int privsize);struct fc_lport *fc_vport_id_lookup (struct fc_lport *,u32 port_id);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 4/20 libfc: Replace ->exch_seq_send callback with function call
In reply to Hannes ReineckeThe ->exch_seq_send callback only ever had one implementation, so we can call the function directly and drop the callback.
--- drivers/scsi/libfc/fc_elsct.c | 2 +- drivers/scsi/libfc/fc_exch.c | 37 ++++++++++++++++++++++++++----------- drivers/scsi/libfc/fc_fcp.c | 11 +++++------ drivers/scsi/libfc/fc_lport.c | 8 ++++---- drivers/scsi/libfc/fc_rport.c | 4 ++-- include/scsi/libfc.h | 38 +++++++------------------------------- 6 files changed, 45 insertions(+), 55 deletions(-)
drivers/scsi/libfc/fc_elsct.c +1 -1
@@ -67,7 +67,7 @@ struct fc_seq *fc_elsct_send(struct fc_lport *lport, u32 did,fc_fill_fc_hdr (fp, r_ctl, did, lport->port_id, fh_type,FC_FCTL_REQ ,0 ); -return lport->tt.exch_seq_send (lport, fp, resp,NULL , arg, timer_msec); +return fc_exch_seq_send (lport, fp, resp,NULL , arg, timer_msec); }EXPORT_SYMBOL (fc_elsct_send);
drivers/scsi/libfc/fc_exch.c +26 -11
@@ -2127,6 +2127,24 @@ static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg)* @arg: The argument to be passed to the response handler * @timer_msec: The timeout period for the exchange * +* The exchange response handler is set in this routine to resp() +* function pointer. It can be called in two scenarios: if a timeout +* occurs or if a response frame is received for the exchange. The +* fc_frame pointer in response handler will also indicate timeout +* as error using IS_ERR related macros. +* +* The exchange destructor handler is also set in this routine. +* The destructor handler is invoked by EM layer when exchange +* is about to free, this can be used by caller to free its +* resources along with exchange free. +* +* The arg is passed back to resp and destructor handler. +* +* The timeout value (in msec) for an exchange is set if non zero +* timer_msec argument is specified. The timer is canceled when +* it fires or when the exchange is done. The exchange timeout handler +* is registered by EM layer. +* * The frame pointer with some of the header's fields must be * filled before calling this routine, those fields are: *
@@ -2137,14 +2155,13 @@ static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg)* - frame control * - parameter or relative offset */ -static struct fc_seq *fc_exch_seq_send (struct fc_lport *lport, -struct fc_frame *fp, -void (*resp)(struct fc_seq *, -struct fc_frame *fp, -void *arg), -void (*destructor)(struct fc_seq *, -void *), -void *arg,u32 timer_msec) +struct fc_seq *fc_exch_seq_send (struct fc_lport *lport, +struct fc_frame *fp, +void (*resp)(struct fc_seq *, +struct fc_frame *fp, +void *arg), +void (*destructor)(struct fc_seq *,void *), +void *arg,u32 timer_msec) {struct fc_exch *ep;struct fc_seq *sp =NULL ;
@@ -2197,6 +2214,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,fc_exch_delete (ep);return NULL ; } +EXPORT_SYMBOL (fc_exch_seq_send);/** * fc_exch_rrq() - Send an ELS RRQ (Reinstate Recovery Qualifier) command
@@ -2630,9 +2648,6 @@ int fc_exch_init(struct fc_lport *lport)if (!lport->tt.seq_set_resp) lport->tt.seq_set_resp = fc_seq_set_resp; -if (!lport->tt.exch_seq_send) - lport->tt.exch_seq_send = fc_exch_seq_send; -if (!lport->tt.seq_send) lport->tt.seq_send = fc_seq_send;
drivers/scsi/libfc/fc_fcp.c +5 -6
@@ -196,7 +196,7 @@ static void fc_fcp_pkt_hold(struct fc_fcp_pkt *fsp)* @seq: The sequence that the FCP packet is on (required by destructor API) * @fsp: The FCP packet to be released * -* This routine is called by a destructor callback in the exch_seq_send() +* This routine is called by a destructor callback in the fc_exch_seq_send() * routine of the libfc Transport Template. The 'struct fc_seq' is a required * argument even though it is not used by this routine. *
@@ -1206,8 +1206,7 @@ static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp, rpriv->local_port->port_id,FC_TYPE_FCP , FC_FCTL_REQ, 0); - seq = lport->tt.exch_seq_send (lport, fp, resp, fc_fcp_pkt_destroy, - fsp,0 ); + seq =fc_exch_seq_send (lport, fp, resp, fc_fcp_pkt_destroy, fsp,0 );if (!seq) { rc =-1 ; goto unlock;
@@ -1757,9 +1756,9 @@ static void fc_fcp_srr(struct fc_fcp_pkt *fsp, enum fc_rctl r_ctl, u32 offset) rpriv->local_port->port_id,FC_TYPE_FCP , FC_FCTL_REQ, 0); - seq = lport->tt.exch_seq_send (lport, fp, fc_fcp_srr_resp, - fc_fcp_pkt_destroy, - fsp,get_fsp_rec_tov (fsp)); + seq =fc_exch_seq_send (lport, fp, fc_fcp_srr_resp, + fc_fcp_pkt_destroy, + fsp,get_fsp_rec_tov (fsp));if (!seq) goto retry;
drivers/scsi/libfc/fc_lport.c +4 -4
@@ -2006,8 +2006,8 @@ static int fc_lport_els_request(struct fc_bsg_job *job, info->nents = job->reply_payload.sg_cnt; info->sg = job->reply_payload.sg_list; -if (!lport->tt.exch_seq_send (lport, fp, fc_lport_bsg_resp, -NULL , info, tov)) { +if (!fc_exch_seq_send (lport, fp, fc_lport_bsg_resp, +NULL , info, tov)) {kfree (info);return -ECOMM ; }
@@ -2067,8 +2067,8 @@ static int fc_lport_ct_request(struct fc_bsg_job *job, info->nents = job->reply_payload.sg_cnt; info->sg = job->reply_payload.sg_list; -if (!lport->tt.exch_seq_send (lport, fp, fc_lport_bsg_resp, -NULL , info, tov)) { +if (!fc_exch_seq_send (lport, fp, fc_lport_bsg_resp, +NULL , info, tov)) {kfree (info);return -ECOMM ; }
drivers/scsi/libfc/fc_rport.c +2 -2
@@ -1282,8 +1282,8 @@ static void fc_rport_enter_prli(struct fc_rport_priv *rdata) FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);kref_get (&rdata->kref); -if (!lport->tt.exch_seq_send (lport, fp, fc_rport_prli_resp, -NULL , rdata,2 * lport->r_a_tov)) { +if (!fc_exch_seq_send (lport, fp, fc_rport_prli_resp, +NULL , rdata,2 * lport->r_a_tov)) {fc_rport_error_retry (rdata, -FC_EX_XMIT_ERR );kref_put (&rdata->kref, lport->tt.rport_destroy); }
include/scsi/libfc.h +7 -31
@@ -485,37 +485,6 @@ struct libfc_function_template { void *arg, u32 timer_msec);/* -* Send the FC frame payload using a new exchange and sequence. -* -* The exchange response handler is set in this routine to resp() -* function pointer. It can be called in two scenarios: if a timeout -* occurs or if a response frame is received for the exchange. The -* fc_frame pointer in response handler will also indicate timeout -* as error using IS_ERR related macros. -* -* The exchange destructor handler is also set in this routine. -* The destructor handler is invoked by EM layer when exchange -* is about to free, this can be used by caller to free its -* resources along with exchange free. -* -* The arg is passed back to resp and destructor handler. -* -* The timeout value (in msec) for an exchange is set if non zero -* timer_msec argument is specified. The timer is canceled when -* it fires or when the exchange is done. The exchange timeout handler -* is registered by EM layer. -* -* STATUS: OPTIONAL -*/ -struct fc_seq *(*exch_seq_send)(struct fc_lport *,struct fc_frame *, -void (*resp)(struct fc_seq *, -struct fc_frame *, -void *), -void (*destructor)(struct fc_seq *, -void *), -void *,unsigned int timer_msec); - -/* * Sets up the DDP context for a given exchange id on the given * scatterlist if LLD supports DDP for large receive. *
@@ -1117,6 +1086,13 @@ void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,*****************************/ int fc_exch_init (struct fc_lport *);void fc_exch_update_stats (struct fc_lport *lport); +struct fc_seq *fc_exch_seq_send (struct fc_lport *lport, +struct fc_frame *fp, +void (*resp)(struct fc_seq *, +struct fc_frame *fp, +void *arg), +void (*destructor)(struct fc_seq *,void *), +void *arg,u32 timer_msec);void fc_seq_els_rsp_send (struct fc_frame *,enum fc_els_cmd ,struct fc_seq_els_data *); struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 7/20 scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'
In reply to Hannes ReineckeRequired for the next patch.
--- drivers/scsi/scsi_transport_fc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/scsi_transport_fc.c +4 -4
@@ -2592,7 +2592,7 @@ static void fc_terminate_rport_io(struct fc_rport *rport)/** -* fc_rport_create - allocates and creates a remote FC port. +* fc_remote_port_create - allocates and creates a remote FC port. * @shost: scsi host the remote port is connected to. * @channel: Channel on shost port connected to. * @ids: The world wide names, fc address, and FC4 port
@@ -2605,8 +2605,8 @@ static void fc_terminate_rport_io(struct fc_rport *rport)* This routine assumes no locks are held on entry. */ static struct fc_rport * -fc_rport_create (struct Scsi_Host *shost,int channel, -struct fc_rport_identifiers *ids) +fc_remote_port_create (struct Scsi_Host *shost,int channel, +struct fc_rport_identifiers *ids) {struct fc_host_attrs *fc_host =shost_to_fc_host (shost);struct fc_internal *fci =to_fc_internal (shost->transportt);
@@ -2914,7 +2914,7 @@ struct fc_rport *spin_unlock_irqrestore (shost->host_lock, flags);/* No consistent binding found - create new remote port entry */ - rport =fc_rport_create (shost, channel, ids); + rport =fc_remote_port_create (shost, channel, ids);return rport; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 5/20 libfc: Replace ->rport_destroy callback with function call
In reply to Hannes ReineckeThe ->rport_destroy callback only ever had one implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 12 ++++---- drivers/scsi/libfc/fc_disc.c | 6 ++-- drivers/scsi/libfc/fc_lport.c | 6 ++-- drivers/scsi/libfc/fc_rport.c | 68 +++++++++++++++++++------------------------ include/scsi/libfc.h | 7 +---- 5 files changed, 43 insertions(+), 56 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +6 -6
@@ -2180,7 +2180,7 @@ static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport)list_for_each_entry_rcu (rdata, &lport->disc.rports, peers) {if (kref_get_unless_zero (&rdata->kref)) { lport->tt.rport_logoff (rdata); -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); } }rcu_read_unlock ();
@@ -2566,7 +2566,7 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac) frport =fcoe_ctlr_rport (rdata);memcpy (mac, frport->enode_mac,ETH_ALEN ); ret =0 ; -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); }return ret; }
@@ -2678,7 +2678,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, } frport->time = jiffies; } -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy);return ; }if (fip->state !=FIP_ST_VNMP_UP )
@@ -2719,7 +2719,7 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip)continue ; frport =fcoe_ctlr_rport (rdata);if (!frport->time) { -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy);continue ; } deadline = frport->time +
@@ -2732,7 +2732,7 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip) lport->tt.rport_logoff (rdata); }else if (time_before (deadline, next_time)) next_time = deadline; -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); }rcu_read_unlock ();return next_time;
@@ -3089,7 +3089,7 @@ static void fcoe_ctlr_vn_disc(struct fcoe_ctlr *fip) frport =fcoe_ctlr_rport (rdata);if (frport->time) lport->tt.rport_login (rdata); -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); }rcu_read_unlock ();if (callback)
drivers/scsi/libfc/fc_disc.c +3 -3
@@ -72,7 +72,7 @@ static void fc_disc_stop_rports(struct fc_disc *disc)list_for_each_entry_rcu (rdata, &disc->rports, peers) {if (kref_get_unless_zero (&rdata->kref)) { lport->tt.rport_logoff (rdata); -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); } }rcu_read_unlock ();
@@ -303,7 +303,7 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)else lport->tt.rport_logoff (rdata); } -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); }rcu_read_unlock ();mutex_unlock (&disc->disc_mutex);
@@ -649,7 +649,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,mutex_unlock (&disc->disc_mutex); } out: -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); }/**
drivers/scsi/libfc/fc_lport.c +3 -3
@@ -247,7 +247,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport, {if (lport->ptp_rdata) { lport->tt.rport_logoff (lport->ptp_rdata); -kref_put (&lport->ptp_rdata->kref, lport->tt.rport_destroy); +kref_put (&lport->ptp_rdata->kref, fc_rport_destroy); }mutex_lock (&lport->disc.disc_mutex); lport->ptp_rdata = lport->tt.rport_create (lport, remote_fid);
@@ -1017,7 +1017,7 @@ static void fc_lport_reset_locked(struct fc_lport *lport)if (lport->ptp_rdata) { lport->tt.rport_logoff (lport->ptp_rdata); -kref_put (&lport->ptp_rdata->kref, lport->tt.rport_destroy); +kref_put (&lport->ptp_rdata->kref, fc_rport_destroy); lport->ptp_rdata =NULL ; }
@@ -2129,7 +2129,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)if (!rdata)break ; tov = rdata->e_d_tov; -kref_put (&rdata->kref, lport->tt.rport_destroy); +kref_put (&rdata->kref, fc_rport_destroy); } rc =fc_lport_ct_request (job, lport, did, tov);
drivers/scsi/libfc/fc_rport.c +30 -38
276 lines not on this page · raw message
include/scsi/libfc.h +1 -6
@@ -652,12 +652,6 @@ struct libfc_function_template {struct fc_rport_priv *(*rport_lookup)(const struct fc_lport *,u32 );/* -* Destroy an rport after final kref_put(). -* The argument is a pointer to the kref inside the fc_rport_priv. -*/ -void (*rport_destroy)(struct kref *); - -/* * Callback routine after the remote port is logged in * * STATUS: OPTIONAL
@@ -1035,6 +1029,7 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)*****************************/ int fc_rport_init (struct fc_lport *);void fc_rport_terminate_io (struct fc_rport *); +void fc_rport_destroy (struct kref *kref);/* * DISCOVERY LAYER
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 6/20 libfc: Replace ->rport_lookup callback with function call
In reply to Hannes ReineckeThe ->rport_lookup callback only ever had a single implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 4 ++-- drivers/scsi/libfc/fc_lport.c | 2 +- drivers/scsi/libfc/fc_rport.c | 16 +++++++--------- include/scsi/libfc.h | 9 ++------- 4 files changed, 12 insertions(+), 19 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +2 -2
@@ -2561,7 +2561,7 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac)struct fcoe_rport *frport;int ret =-1 ; - rdata = lport->tt.rport_lookup (lport, port_id); + rdata =fc_rport_lookup (lport, port_id);if (rdata) { frport =fcoe_ctlr_rport (rdata);memcpy (mac, frport->enode_mac,ETH_ALEN );
@@ -2663,7 +2663,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip,fcoe_ctlr_vn_send (fip,FIP_SC_VN_PROBE_REQ , fcoe_all_vn2vn,0 );return ; } - rdata = lport->tt.rport_lookup (lport, new->ids.port_id); + rdata =fc_rport_lookup (lport, new->ids.port_id);if (rdata) {if (rdata->ids.node_name == new->ids.node_name && rdata->ids.port_name == new->ids.port_name) {
drivers/scsi/libfc/fc_lport.c +1 -1
@@ -2125,7 +2125,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)break ; tov = rdata->e_d_tov; }else { - rdata = lport->tt.rport_lookup (lport, did); + rdata =fc_rport_lookup (lport, did);if (!rdata)break ; tov = rdata->e_d_tov;
drivers/scsi/libfc/fc_rport.c +7 -9
@@ -111,8 +111,8 @@* The reference count of the fc_rport_priv structure is * increased by one. */ -static struct fc_rport_priv *fc_rport_lookup (const struct fc_lport *lport, -u32 port_id) +struct fc_rport_priv *fc_rport_lookup (const struct fc_lport *lport, +u32 port_id) {struct fc_rport_priv *rdata =NULL , *tmp_rdata;
@@ -126,6 +126,7 @@ static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,rcu_read_unlock ();return rdata; } +EXPORT_SYMBOL (fc_rport_lookup);/** * fc_rport_create() - Create a new remote port
@@ -141,7 +142,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, {struct fc_rport_priv *rdata; - rdata = lport->tt.rport_lookup (lport, port_id); + rdata =fc_rport_lookup (lport, port_id);if (rdata)return rdata;
@@ -875,7 +876,7 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport, goto reject; } - rdata = lport->tt.rport_lookup (lport, sid); + rdata =fc_rport_lookup (lport, sid);if (!rdata) { rjt_data.reason =ELS_RJT_FIP ; rjt_data.explan =ELS_EXPL_NOT_NEIGHBOR ;
@@ -1684,7 +1685,7 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp)struct fc_rport_priv *rdata;struct fc_seq_els_data els_data; - rdata = lport->tt.rport_lookup (lport,fc_frame_sid (fp)); + rdata =fc_rport_lookup (lport,fc_frame_sid (fp));if (!rdata) { FC_RPORT_ID_DBG(lport, fc_frame_sid(fp), "Received ELS 0x%02x from non-logged-in port\n",
@@ -2145,7 +2146,7 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp) sid =fc_frame_sid (fp); - rdata = lport->tt.rport_lookup (lport, sid); + rdata =fc_rport_lookup (lport, sid);if (rdata) {mutex_lock (&rdata->rp_mutex); FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n",
@@ -2174,9 +2175,6 @@ static void fc_rport_flush_queue(void)*/ int fc_rport_init (struct fc_lport *lport) { -if (!lport->tt.rport_lookup) - lport->tt.rport_lookup = fc_rport_lookup; -if (!lport->tt.rport_create) lport->tt.rport_create = fc_rport_create;
include/scsi/libfc.h +2 -7
@@ -645,13 +645,6 @@ struct libfc_function_template {void (*rport_recv_req)(struct fc_lport *,struct fc_frame *);/* -* lookup an rport by it's port ID. -* -* STATUS: OPTIONAL -*/ -struct fc_rport_priv *(*rport_lookup)(const struct fc_lport *,u32 ); - -/* * Callback routine after the remote port is logged in * * STATUS: OPTIONAL
@@ -1029,6 +1022,8 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)*****************************/ int fc_rport_init (struct fc_lport *);void fc_rport_terminate_io (struct fc_rport *); +struct fc_rport_priv *fc_rport_lookup (const struct fc_lport *lport, +u32 port_id);void fc_rport_destroy (struct kref *kref);/*
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 8/20 libfc: Replace ->rport_create callback with function call
In reply to Hannes ReineckeThe ->rport_create callback only ever had a single implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/libfc/fc_disc.c | 7 +++---- drivers/scsi/libfc/fc_lport.c | 6 +++--- drivers/scsi/libfc/fc_rport.c | 9 +++------ include/scsi/libfc.h | 8 +------- 5 files changed, 11 insertions(+), 21 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +1 -1
@@ -2515,7 +2515,7 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new)return ;mutex_lock (&lport->disc.disc_mutex); - rdata = lport->tt.rport_create (lport, port_id); + rdata =fc_rport_create (lport, port_id);if (!rdata) {mutex_unlock (&lport->disc.disc_mutex);return ;
drivers/scsi/libfc/fc_disc.c +3 -4
@@ -454,7 +454,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)if (ids.port_id != lport->port_id && ids.port_name != lport->wwpn) { - rdata = lport->tt.rport_create (lport, ids.port_id); + rdata =fc_rport_create (lport, ids.port_id);if (rdata) { rdata->ids.port_name = ids.port_name; rdata->disc_id = disc->disc_id;
@@ -624,8 +624,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,mutex_unlock (&rdata->rp_mutex); lport->tt.rport_logoff (rdata);mutex_lock (&lport->disc.disc_mutex); - new_rdata = lport->tt.rport_create (lport, - rdata->ids.port_id); + new_rdata =fc_rport_create (lport, rdata->ids.port_id);mutex_unlock (&lport->disc.disc_mutex);if (new_rdata) { new_rdata->disc_id = disc->disc_id;
@@ -690,7 +689,7 @@ static int fc_disc_single(struct fc_lport *lport, struct fc_disc_port *dp) {struct fc_rport_priv *rdata; - rdata = lport->tt.rport_create (lport, dp->port_id); + rdata =fc_rport_create (lport, dp->port_id);if (!rdata)return -ENOMEM ; rdata->disc_id =0 ;
drivers/scsi/libfc/fc_lport.c +3 -3
@@ -250,7 +250,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport,kref_put (&lport->ptp_rdata->kref, fc_rport_destroy); }mutex_lock (&lport->disc.disc_mutex); - lport->ptp_rdata = lport->tt.rport_create (lport, remote_fid); + lport->ptp_rdata =fc_rport_create (lport, remote_fid);kref_get (&lport->ptp_rdata->kref); lport->ptp_rdata->ids.port_name = remote_wwpn; lport->ptp_rdata->ids.node_name = remote_wwnn;
@@ -1431,7 +1431,7 @@ static void fc_lport_enter_dns(struct fc_lport *lport)fc_lport_state_enter (lport,LPORT_ST_DNS );mutex_lock (&lport->disc.disc_mutex); - rdata = lport->tt.rport_create (lport,FC_FID_DIR_SERV ); + rdata =fc_rport_create (lport,FC_FID_DIR_SERV );mutex_unlock (&lport->disc.disc_mutex);if (!rdata) goto err;
@@ -1548,7 +1548,7 @@ static void fc_lport_enter_fdmi(struct fc_lport *lport)fc_lport_state_enter (lport,LPORT_ST_FDMI );mutex_lock (&lport->disc.disc_mutex); - rdata = lport->tt.rport_create (lport,FC_FID_MGMT_SERV ); + rdata =fc_rport_create (lport,FC_FID_MGMT_SERV );mutex_unlock (&lport->disc.disc_mutex);if (!rdata) goto err;
drivers/scsi/libfc/fc_rport.c +3 -6
@@ -137,8 +137,7 @@ struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,* * Locking note: must be called with the disc_mutex held. */ -static struct fc_rport_priv *fc_rport_create (struct fc_lport *lport, -u32 port_id) +struct fc_rport_priv *fc_rport_create (struct fc_lport *lport,u32 port_id) {struct fc_rport_priv *rdata;
@@ -172,6 +171,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, }return rdata; } +EXPORT_SYMBOL (fc_rport_create);/** * fc_rport_destroy() - Free a remote port after last reference is released
@@ -1847,7 +1847,7 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport, disc = &lport->disc;mutex_lock (&disc->disc_mutex); - rdata = lport->tt.rport_create (lport, sid); + rdata =fc_rport_create (lport, sid);if (!rdata) {mutex_unlock (&disc->disc_mutex); rjt_data.reason =ELS_RJT_UNAB ;
@@ -2175,9 +2175,6 @@ static void fc_rport_flush_queue(void)*/ int fc_rport_init (struct fc_lport *lport) { -if (!lport->tt.rport_create) - lport->tt.rport_create = fc_rport_create; -if (!lport->tt.rport_login) lport->tt.rport_login = fc_rport_login;
include/scsi/libfc.h +1 -7
@@ -610,13 +610,6 @@ struct libfc_function_template { struct fc_frame *);/* -* Create a remote port with a given port ID -* -* STATUS: OPTIONAL -*/ -struct fc_rport_priv *(*rport_create)(struct fc_lport *,u32 ); - -/* * Initiates the RP state machine. It is called from the LP module. * This function will issue the following commands to the N_Port * identified by the FC ID provided.
@@ -1024,6 +1017,7 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)void fc_rport_terminate_io (struct fc_rport *);struct fc_rport_priv *fc_rport_lookup (const struct fc_lport *lport,u32 port_id); +struct fc_rport_priv *fc_rport_create (struct fc_lport *,u32 );void fc_rport_destroy (struct kref *kref);/*
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 9/20 libfc: Replace ->rport_login callback with function call
In reply to Hannes ReineckeThe ->rport_login callback only ever had one implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 4 ++-- drivers/scsi/libfc/fc_disc.c | 6 +++--- drivers/scsi/libfc/fc_lport.c | 6 +++--- drivers/scsi/libfc/fc_rport.c | 14 ++++++++++---- include/scsi/libfc.h | 14 +------------- 5 files changed, 19 insertions(+), 25 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +2 -2
@@ -2674,7 +2674,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip,LIBFCOE_FIP_DBG (fip,"beacon expired " "for rport %x\n" , rdata->ids.port_id); - lport->tt.rport_login (rdata); +fc_rport_login (rdata); } frport->time = jiffies; }
@@ -3088,7 +3088,7 @@ static void fcoe_ctlr_vn_disc(struct fcoe_ctlr *fip)continue ; frport =fcoe_ctlr_rport (rdata);if (frport->time) - lport->tt.rport_login (rdata); +fc_rport_login (rdata);kref_put (&rdata->kref, fc_rport_destroy); }rcu_read_unlock ();
drivers/scsi/libfc/fc_disc.c +3 -3
@@ -299,7 +299,7 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)continue ;if (rdata->disc_id) {if (rdata->disc_id == disc->disc_id) - lport->tt.rport_login (rdata); +fc_rport_login (rdata);else lport->tt.rport_logoff (rdata); }
@@ -628,13 +628,13 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,mutex_unlock (&lport->disc.disc_mutex);if (new_rdata) { new_rdata->disc_id = disc->disc_id; - lport->tt.rport_login (new_rdata); +fc_rport_login (new_rdata); } goto out; } rdata->disc_id = disc->disc_id;mutex_unlock (&rdata->rp_mutex); - lport->tt.rport_login (rdata); +fc_rport_login (rdata); }else if (ntohs (cp->ct_cmd) ==FC_FS_RJT ) {FC_DISC_DBG (disc,"GPN_ID rejected reason %x exp %x\n" , cp->ct_reason, cp->ct_explan);
drivers/scsi/libfc/fc_lport.c +3 -3
@@ -256,7 +256,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport, lport->ptp_rdata->ids.node_name = remote_wwnn;mutex_unlock (&lport->disc.disc_mutex); - lport->tt.rport_login (lport->ptp_rdata); +fc_rport_login (lport->ptp_rdata);fc_lport_enter_ready (lport); }
@@ -1437,7 +1437,7 @@ static void fc_lport_enter_dns(struct fc_lport *lport) goto err; rdata->ops = &fc_lport_rport_ops; - lport->tt.rport_login (rdata); +fc_rport_login (rdata);return ; err:
@@ -1554,7 +1554,7 @@ static void fc_lport_enter_fdmi(struct fc_lport *lport) goto err; rdata->ops = &fc_lport_rport_ops; - lport->tt.rport_login (rdata); +fc_rport_login (rdata);return ; err:
drivers/scsi/libfc/fc_rport.c +10 -4
@@ -412,6 +412,14 @@ static void fc_rport_work(struct work_struct *work)* fc_rport_login() - Start the remote port login state machine * @rdata: The remote port to be logged in to * +* Initiates the RP state machine. It is called from the LP module. +* This function will issue the following commands to the N_Port +* identified by the FC ID provided. +* +* - PLOGI +* - PRLI +* - RTV +* * Locking Note: Called without the rport lock held. This * function will hold the rport lock, call an _enter_* * function and then unlock the rport.
@@ -420,7 +428,7 @@ static void fc_rport_work(struct work_struct *work)* If it appears we are already logged in, ADISC is used to verify * the setup. */ -static int fc_rport_login (struct fc_rport_priv *rdata) +int fc_rport_login (struct fc_rport_priv *rdata) {mutex_lock (&rdata->rp_mutex);
@@ -452,6 +460,7 @@ static int fc_rport_login(struct fc_rport_priv *rdata)return 0 ; } +EXPORT_SYMBOL (fc_rport_login);/** * fc_rport_enter_delete() - Schedule a remote port to be deleted
@@ -2175,9 +2184,6 @@ static void fc_rport_flush_queue(void)*/ int fc_rport_init (struct fc_lport *lport) { -if (!lport->tt.rport_login) - lport->tt.rport_login = fc_rport_login; -if (!lport->tt.rport_logoff) lport->tt.rport_logoff = fc_rport_logoff;
include/scsi/libfc.h +1 -13
@@ -610,19 +610,6 @@ struct libfc_function_template { struct fc_frame *);/* -* Initiates the RP state machine. It is called from the LP module. -* This function will issue the following commands to the N_Port -* identified by the FC ID provided. -* -* - PLOGI -* - PRLI -* - RTV -* -* STATUS: OPTIONAL -*/ -int (*rport_login)(struct fc_rport_priv *); - -/* * Logoff, and remove the rport from the transport if * it had been added. This will send a LOGO to the target. *
@@ -1019,6 +1006,7 @@ struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport, u32 port_id);struct fc_rport_priv *fc_rport_create (struct fc_lport *,u32 );void fc_rport_destroy (struct kref *kref); +int fc_rport_login (struct fc_rport_priv *rdata);/* * DISCOVERY LAYER
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 11/20 libfc: Replace ->rport_recv_req callback with function call
In reply to Hannes ReineckeThe ->rport_recv_req callback only ever had one implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/libfc/fc_lport.c | 2 +- drivers/scsi/libfc/fc_rport.c | 6 ++---- include/scsi/libfc.h | 8 +------- 3 files changed, 4 insertions(+), 12 deletions(-)
drivers/scsi/libfc/fc_lport.c +1 -1
@@ -902,7 +902,7 @@ static void fc_lport_recv_els_req(struct fc_lport *lport,/* * Check opcode. */ - recv = lport->tt.rport_recv_req; + recv = fc_rport_recv_req;switch (fc_frame_payload_op (fp)) {case ELS_FLOGI :if (!lport->point_to_multipoint)
drivers/scsi/libfc/fc_rport.c +2 -4
@@ -1786,7 +1786,7 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp)* * Reference counting: does not modify kref */ -static void fc_rport_recv_req (struct fc_lport *lport,struct fc_frame *fp) +void fc_rport_recv_req (struct fc_lport *lport,struct fc_frame *fp) {struct fc_seq_els_data els_data;
@@ -1823,6 +1823,7 @@ static void fc_rport_recv_req(struct fc_lport *lport, struct fc_frame *fp)break ; } } +EXPORT_SYMBOL (fc_rport_recv_req);/** * fc_rport_recv_plogi_req() - Handler for Port Login (PLOGI) requests
@@ -2185,9 +2186,6 @@ static void fc_rport_flush_queue(void)*/ int fc_rport_init (struct fc_lport *lport) { -if (!lport->tt.rport_recv_req) - lport->tt.rport_recv_req = fc_rport_recv_req; -if (!lport->tt.rport_flush_queue) lport->tt.rport_flush_queue = fc_rport_flush_queue;
include/scsi/libfc.h +1 -7
@@ -610,13 +610,6 @@ struct libfc_function_template { struct fc_frame *);/* -* Receive a request from a remote port. -* -* STATUS: OPTIONAL -*/ -void (*rport_recv_req)(struct fc_lport *,struct fc_frame *); - -/* * Callback routine after the remote port is logged in * * STATUS: OPTIONAL
@@ -1000,6 +993,7 @@ struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,void fc_rport_destroy (struct kref *kref);int fc_rport_login (struct fc_rport_priv *rdata);int fc_rport_logoff (struct fc_rport_priv *rdata); +void fc_rport_recv_req (struct fc_lport *lport,struct fc_frame *fp);/* * DISCOVERY LAYER
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 10/20 libfc: Replace ->rport_logoff callback with function call
In reply to Hannes ReineckeThe ->rport_logoff callback only ever had one implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 3 +-- drivers/scsi/fcoe/fcoe_ctlr.c | 8 ++++---- drivers/scsi/libfc/fc_disc.c | 8 ++++---- drivers/scsi/libfc/fc_lport.c | 10 +++++----- drivers/scsi/libfc/fc_rport.c | 8 +++----- include/scsi/libfc.h | 9 +-------- 6 files changed, 18 insertions(+), 28 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_tgt.c +1 -2
@@ -80,7 +80,6 @@ static void bnx2fc_offload_session(struct fcoe_port *port,struct bnx2fc_rport *tgt, struct fc_rport_priv *rdata) { - struct fc_lport *lport = rdata->local_port; struct fc_rport *rport = rdata->rport;struct bnx2fc_interface *interface = port->priv;struct bnx2fc_hba *hba = interface->hba;
@@ -160,7 +159,7 @@ static void bnx2fc_offload_session(struct fcoe_port *port, tgt_init_err:if (tgt->fcoe_conn_id !=-1 )bnx2fc_free_conn_id (hba, tgt->fcoe_conn_id); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata); }void bnx2fc_flush_active_ios (struct bnx2fc_rport *tgt)
drivers/scsi/fcoe/fcoe_ctlr.c +4 -4
@@ -2153,7 +2153,7 @@ static void fcoe_ctlr_vn_rport_callback(struct fc_lport *lport,LIBFCOE_FIP_DBG (fip,"rport FLOGI limited port_id %6.6x\n" , rdata->ids.port_id); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata); }break ;default :
@@ -2179,7 +2179,7 @@ static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport)rcu_read_lock ();list_for_each_entry_rcu (rdata, &lport->disc.rports, peers) {if (kref_get_unless_zero (&rdata->kref)) { - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata);kref_put (&rdata->kref, fc_rport_destroy); } }
@@ -2531,7 +2531,7 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) (ids->node_name != -1 && ids->node_name != new->ids.node_name)) {mutex_unlock (&rdata->rp_mutex);LIBFCOE_FIP_DBG (fip,"vn_add rport logoff %6.6x\n" , port_id); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata);mutex_lock (&rdata->rp_mutex); } ids->port_name = new->ids.port_name;
@@ -2729,7 +2729,7 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip)LIBFCOE_FIP_DBG (fip,"port %16.16llx fc_id %6.6x beacon expired\n" , rdata->ids.port_name, rdata->ids.port_id); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata); }else if (time_before (deadline, next_time)) next_time = deadline;kref_put (&rdata->kref, fc_rport_destroy);
drivers/scsi/libfc/fc_disc.c +4 -4
@@ -71,7 +71,7 @@ static void fc_disc_stop_rports(struct fc_disc *disc)rcu_read_lock ();list_for_each_entry_rcu (rdata, &disc->rports, peers) {if (kref_get_unless_zero (&rdata->kref)) { - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata);kref_put (&rdata->kref, fc_rport_destroy); } }
@@ -301,7 +301,7 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)if (rdata->disc_id == disc->disc_id)fc_rport_login (rdata);else - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata); }kref_put (&rdata->kref, fc_rport_destroy); }
@@ -622,7 +622,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,"Port-id %6.6x wwpn %16.16llx\n" , rdata->ids.port_id, port_name);mutex_unlock (&rdata->rp_mutex); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata);mutex_lock (&lport->disc.disc_mutex); new_rdata =fc_rport_create (lport, rdata->ids.port_id);mutex_unlock (&lport->disc.disc_mutex);
@@ -638,7 +638,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, }else if (ntohs (cp->ct_cmd) ==FC_FS_RJT ) {FC_DISC_DBG (disc,"GPN_ID rejected reason %x exp %x\n" , cp->ct_reason, cp->ct_explan); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata); }else {FC_DISC_DBG (disc,"GPN_ID unexpected response code %x\n" ,ntohs (cp->ct_cmd));
drivers/scsi/libfc/fc_lport.c +5 -5
@@ -200,7 +200,7 @@ static void fc_lport_rport_callback(struct fc_lport *lport,"in the DNS or FDMI state, it's in the " "%d state" , rdata->ids.port_id, lport->state); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata); }break ;case RPORT_EV_LOGO :
@@ -246,7 +246,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport, u64 remote_wwnn) {if (lport->ptp_rdata) { - lport->tt.rport_logoff (lport->ptp_rdata); +fc_rport_logoff (lport->ptp_rdata);kref_put (&lport->ptp_rdata->kref, fc_rport_destroy); }mutex_lock (&lport->disc.disc_mutex);
@@ -623,7 +623,7 @@ int fc_fabric_logoff(struct fc_lport *lport) lport->tt.disc_stop_final (lport);mutex_lock (&lport->lp_mutex);if (lport->dns_rdata) - lport->tt.rport_logoff (lport->dns_rdata); +fc_rport_logoff (lport->dns_rdata);mutex_unlock (&lport->lp_mutex); lport->tt.rport_flush_queue ();mutex_lock (&lport->lp_mutex);
@@ -1011,12 +1011,12 @@ int fc_lport_reset(struct fc_lport *lport)static void fc_lport_reset_locked (struct fc_lport *lport) {if (lport->dns_rdata) { - lport->tt.rport_logoff (lport->dns_rdata); +fc_rport_logoff (lport->dns_rdata); lport->dns_rdata =NULL ; }if (lport->ptp_rdata) { - lport->tt.rport_logoff (lport->ptp_rdata); +fc_rport_logoff (lport->ptp_rdata);kref_put (&lport->ptp_rdata->kref, fc_rport_destroy); lport->ptp_rdata =NULL ; }
drivers/scsi/libfc/fc_rport.c +3 -5
@@ -295,7 +295,7 @@ static void fc_rport_work(struct work_struct *work) }if (!rport) {FC_RPORT_DBG (rdata,"Failed to add the rport\n" ); - lport->tt.rport_logoff (rdata); +fc_rport_logoff (rdata);kref_put (&rdata->kref, fc_rport_destroy);return ; }
@@ -504,7 +504,7 @@ static void fc_rport_enter_delete(struct fc_rport_priv *rdata,* function will hold the rport lock, call an _enter_* * function and then unlock the rport. */ -static int fc_rport_logoff (struct fc_rport_priv *rdata) +int fc_rport_logoff (struct fc_rport_priv *rdata) {struct fc_lport *lport = rdata->local_port;u32 port_id = rdata->ids.port_id;
@@ -538,6 +538,7 @@ static int fc_rport_logoff(struct fc_rport_priv *rdata)mutex_unlock (&rdata->rp_mutex);return 0 ; } +EXPORT_SYMBOL (fc_rport_logoff);/** * fc_rport_enter_ready() - Transition to the RPORT_ST_READY state
@@ -2184,9 +2185,6 @@ static void fc_rport_flush_queue(void)*/ int fc_rport_init (struct fc_lport *lport) { -if (!lport->tt.rport_logoff) - lport->tt.rport_logoff = fc_rport_logoff; -if (!lport->tt.rport_recv_req) lport->tt.rport_recv_req = fc_rport_recv_req;
include/scsi/libfc.h +1 -8
@@ -610,14 +610,6 @@ struct libfc_function_template { struct fc_frame *);/* -* Logoff, and remove the rport from the transport if -* it had been added. This will send a LOGO to the target. -* -* STATUS: OPTIONAL -*/ -int (*rport_logoff)(struct fc_rport_priv *); - -/* * Receive a request from a remote port. * * STATUS: OPTIONAL
@@ -1007,6 +999,7 @@ struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,struct fc_rport_priv *fc_rport_create (struct fc_lport *,u32 );void fc_rport_destroy (struct kref *kref);int fc_rport_login (struct fc_rport_priv *rdata); +int fc_rport_logoff (struct fc_rport_priv *rdata);/* * DISCOVERY LAYER
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 12/20 libfc: Replace ->rport_flush_queue callback with function call
In reply to Hannes ReineckeThe ->rport_flush_queue callback only ever had a single implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/libfc/fc_disc.c | 2 +- drivers/scsi/libfc/fc_lport.c | 2 +- drivers/scsi/libfc/fc_rport.c | 6 ++---- include/scsi/libfc.h | 8 +------- 5 files changed, 6 insertions(+), 14 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +1 -1
@@ -2215,7 +2215,7 @@ static void fcoe_ctlr_disc_stop(struct fc_lport *lport)static void fcoe_ctlr_disc_stop_final (struct fc_lport *lport) {fcoe_ctlr_disc_stop (lport); - lport->tt.rport_flush_queue (); +fc_rport_flush_queue ();synchronize_rcu (); }
drivers/scsi/libfc/fc_disc.c +1 -1
@@ -719,7 +719,7 @@ static void fc_disc_stop(struct fc_lport *lport)static void fc_disc_stop_final (struct fc_lport *lport) {fc_disc_stop (lport); - lport->tt.rport_flush_queue (); +fc_rport_flush_queue (); }/**
drivers/scsi/libfc/fc_lport.c +1 -1
@@ -625,7 +625,7 @@ int fc_fabric_logoff(struct fc_lport *lport)if (lport->dns_rdata)fc_rport_logoff (lport->dns_rdata);mutex_unlock (&lport->lp_mutex); - lport->tt.rport_flush_queue (); +fc_rport_flush_queue ();mutex_lock (&lport->lp_mutex);fc_lport_enter_logo (lport);mutex_unlock (&lport->lp_mutex);
drivers/scsi/libfc/fc_rport.c +2 -4
@@ -2175,10 +2175,11 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp)/** * fc_rport_flush_queue() - Flush the rport_event_queue */ -static void fc_rport_flush_queue (void ) +void fc_rport_flush_queue (void ) {flush_workqueue (rport_event_queue); } +EXPORT_SYMBOL (fc_rport_flush_queue);/** * fc_rport_init() - Initialize the remote port layer for a local port
@@ -2186,9 +2187,6 @@ static void fc_rport_flush_queue(void)*/ int fc_rport_init (struct fc_lport *lport) { -if (!lport->tt.rport_flush_queue) - lport->tt.rport_flush_queue = fc_rport_flush_queue; -return 0 ; }EXPORT_SYMBOL (fc_rport_init);
include/scsi/libfc.h +1 -7
@@ -583,13 +583,6 @@ struct libfc_function_template {void (*exch_mgr_reset)(struct fc_lport *,u32 s_id,u32 d_id);/* -* Flush the rport work queue. Generally used before shutdown. -* -* STATUS: OPTIONAL -*/ -void (*rport_flush_queue)(void ); - -/* * Set the local port FC_ID. * * This may be provided by the LLD to allow it to be
@@ -994,6 +987,7 @@ struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,int fc_rport_login (struct fc_rport_priv *rdata);int fc_rport_logoff (struct fc_rport_priv *rdata);void fc_rport_recv_req (struct fc_lport *lport,struct fc_frame *fp); +void fc_rport_flush_queue (void );/* * DISCOVERY LAYER
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 13/20 libfc: Remove fc_rport_init()
In reply to Hannes ReineckeFunction is empty now and can be removed.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 - drivers/scsi/fcoe/fcoe_ctlr.c | 1 - drivers/scsi/libfc/fc_rport.c | 10 ---------- include/scsi/libfc.h | 1 - 4 files changed, 13 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +0 -1
@@ -970,7 +970,6 @@ static int bnx2fc_libfc_config(struct fc_lport *lport) sizeof(struct libfc_function_template));fc_elsct_init (lport);fc_exch_init (lport); -fc_rport_init (lport);fc_disc_init (lport);fc_disc_config (lport, lport);return 0 ;
drivers/scsi/fcoe/fcoe_ctlr.c +0 -1
@@ -3235,7 +3235,6 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip,fc_exch_init (lport);fc_elsct_init (lport);fc_lport_init (lport); -fc_rport_init (lport);fc_disc_init (lport);fcoe_ctlr_mode_set (lport, fip, fip->mode);return 0 ;
drivers/scsi/libfc/fc_rport.c +0 -10
@@ -2182,16 +2182,6 @@ void fc_rport_flush_queue(void)EXPORT_SYMBOL (fc_rport_flush_queue);/** -* fc_rport_init() - Initialize the remote port layer for a local port -* @lport: The local port to initialize the remote port layer for -*/ -int fc_rport_init (struct fc_lport *lport) -{ -return 0 ; -} -EXPORT_SYMBOL (fc_rport_init); - -/** * fc_rport_fcp_prli() - Handle incoming PRLI for the FCP initiator. * @rdata: remote port private * @spp_len: service parameter page length
include/scsi/libfc.h +0 -1
@@ -978,7 +978,6 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)/* * REMOTE PORT LAYER *****************************/ -int fc_rport_init (struct fc_lport *);void fc_rport_terminate_io (struct fc_rport *);struct fc_rport_priv *fc_rport_lookup (const struct fc_lport *lport,u32 port_id);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 14/20 libfc: Replace ->seq_send callback with function call
In reply to Hannes ReineckeThe ->seq_send callback only ever had one implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/libfc/fc_exch.c | 7 ++----- drivers/scsi/libfc/fc_fcp.c | 4 ++-- drivers/target/tcm_fc/tfc_cmd.c | 6 +++--- drivers/target/tcm_fc/tfc_io.c | 2 +- include/scsi/libfc.h | 8 +------- 5 files changed, 9 insertions(+), 18 deletions(-)
drivers/scsi/libfc/fc_exch.c +2 -5
@@ -533,8 +533,7 @@ static int fc_seq_send_locked(struct fc_lport *lport, struct fc_seq *sp,* Note: The frame will be freed either by a direct call to fc_frame_free(fp) * or indirectly by calling libfc_function_template.frame_send(). */ -static int fc_seq_send (struct fc_lport *lport,struct fc_seq *sp, -struct fc_frame *fp) +int fc_seq_send (struct fc_lport *lport,struct fc_seq *sp,struct fc_frame *fp) {struct fc_exch *ep;int error;
@@ -544,6 +543,7 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp,spin_unlock_bh (&ep->ex_lock);return error; } +EXPORT_SYMBOL (fc_seq_send);/** * fc_seq_alloc() - Allocate a sequence for a given exchange
@@ -2648,9 +2648,6 @@ int fc_exch_init(struct fc_lport *lport)if (!lport->tt.seq_set_resp) lport->tt.seq_set_resp = fc_seq_set_resp; -if (!lport->tt.seq_send) - lport->tt.seq_send = fc_seq_send; -if (!lport->tt.exch_done) lport->tt.exch_done = fc_exch_done;
drivers/scsi/libfc/fc_fcp.c +2 -2
@@ -731,7 +731,7 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq,/* * send fragment using for a sequence. */ - error = lport->tt.seq_send (lport, seq, fp); + error =fc_seq_send (lport, seq, fp);if (error) {WARN_ON (1 );/* send error should be rare */ return error;
@@ -1033,7 +1033,7 @@ static void fc_fcp_complete_locked(struct fc_fcp_pkt *fsp)fc_fill_fc_hdr (conf_frame,FC_RCTL_DD_SOL_CTL , ep->did, ep->sid,FC_TYPE_FCP , f_ctl,0 ); - lport->tt.seq_send (lport, csp, conf_frame); +fc_seq_send (lport, csp, conf_frame); } } lport->tt.exch_done (seq);
drivers/target/tcm_fc/tfc_cmd.c +3 -3
@@ -165,7 +165,7 @@ int ft_queue_status(struct se_cmd *se_cmd)fc_fill_fc_hdr (fp,FC_RCTL_DD_CMD_STATUS , ep->did, ep->sid,FC_TYPE_FCP ,FC_FC_EX_CTX |FC_FC_LAST_SEQ |FC_FC_END_SEQ ,0 ); - rc = lport->tt.seq_send (lport, cmd->seq, fp); + rc =fc_seq_send (lport, cmd->seq, fp);if (rc) {pr_info_ratelimited ("%s: Failed to send response frame %p, " "xid <0x%x>\n" , __func__, fp, ep->xid);
@@ -242,7 +242,7 @@ int ft_write_pending(struct se_cmd *se_cmd) cmd->was_ddp_setup =1 ; } } - lport->tt.seq_send (lport, cmd->seq, fp); +fc_seq_send (lport, cmd->seq, fp);return 0 ; }
@@ -323,7 +323,7 @@ static void ft_send_resp_status(struct fc_lport *lport,fc_fill_reply_hdr (fp, rx_fp,FC_RCTL_DD_CMD_STATUS ,0 ); sp =fr_seq (fp);if (sp) { - lport->tt.seq_send (lport, sp, fp); +fc_seq_send (lport, sp, fp); lport->tt.exch_done (sp); }else { lport->tt.frame_send (lport, fp);
drivers/target/tcm_fc/tfc_io.c +1 -1
@@ -174,7 +174,7 @@ int ft_queue_data_in(struct se_cmd *se_cmd) f_ctl |=FC_FC_END_SEQ ;fc_fill_fc_hdr (fp,FC_RCTL_DD_SOL_DATA , ep->did, ep->sid,FC_TYPE_FCP , f_ctl, fh_off); - error = lport->tt.seq_send (lport, seq, fp); + error =fc_seq_send (lport, seq, fp);if (error) {pr_info_ratelimited ("%s: Failed to send frame %p, " "xid <0x%x>, remaining %zu, "
include/scsi/libfc.h +1 -7
@@ -513,13 +513,6 @@ struct libfc_function_template {* STATUS: OPTIONAL */ void (*get_lesb)(struct fc_lport *,struct fc_els_lesb *lesb); -/* -* Send a frame using an existing sequence and exchange. -* -* STATUS: OPTIONAL -*/ -int (*seq_send)(struct fc_lport *,struct fc_seq *, -struct fc_frame *);/* * Abort an exchange and sequence. Generally called because of a
@@ -1058,6 +1051,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class,void fc_exch_mgr_free (struct fc_lport *);void fc_exch_recv (struct fc_lport *,struct fc_frame *);void fc_exch_mgr_reset (struct fc_lport *,u32 s_id,u32 d_id); +int fc_seq_send (struct fc_lport *lport,struct fc_seq *sp,struct fc_frame *fp);/* * Functions for fc_functions_template
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 16/20 libfc: Replace ->exch_done callback with function call
In reply to Hannes ReineckeThe ->exch_done callback only ever had one implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/libfc/fc_exch.c | 6 ++---- drivers/scsi/libfc/fc_fcp.c | 20 +++++++++----------- drivers/scsi/libfc/fc_lport.c | 2 +- drivers/target/tcm_fc/tfc_cmd.c | 4 ++-- include/scsi/libfc.h | 9 +-------- 5 files changed, 15 insertions(+), 26 deletions(-)
drivers/scsi/libfc/fc_exch.c +2 -4
@@ -969,7 +969,7 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)* * Note: May sleep if invoked from outside a response handler. */ -static void fc_exch_done (struct fc_seq *sp) +void fc_exch_done (struct fc_seq *sp) {struct fc_exch *ep =fc_seq_exch (sp);int rc;
@@ -982,6 +982,7 @@ static void fc_exch_done(struct fc_seq *sp)if (!rc)fc_exch_delete (ep); } +EXPORT_SYMBOL (fc_exch_done);/** * fc_exch_resp() - Allocate a new exchange for a response frame
@@ -2654,9 +2655,6 @@ int fc_exch_init(struct fc_lport *lport)if (!lport->tt.seq_set_resp) lport->tt.seq_set_resp = fc_seq_set_resp; -if (!lport->tt.exch_done) - lport->tt.exch_done = fc_exch_done; -if (!lport->tt.exch_mgr_reset) lport->tt.exch_mgr_reset = fc_exch_mgr_reset;
drivers/scsi/libfc/fc_fcp.c +9 -11
@@ -311,7 +311,7 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp)static void fc_fcp_retry_cmd (struct fc_fcp_pkt *fsp,int status_code) {if (fsp->seq_ptr) { - fsp->lp->tt.exch_done (fsp->seq_ptr); +fc_exch_done (fsp->seq_ptr); fsp->seq_ptr =NULL ; }
@@ -1036,7 +1036,7 @@ static void fc_fcp_complete_locked(struct fc_fcp_pkt *fsp)fc_seq_send (lport, csp, conf_frame); } } - lport->tt.exch_done (seq); +fc_exch_done (seq); }/* * Some resets driven by SCSI are not I/Os and do not have
@@ -1054,10 +1054,8 @@ static void fc_fcp_complete_locked(struct fc_fcp_pkt *fsp)*/ static void fc_fcp_cleanup_cmd (struct fc_fcp_pkt *fsp,int error) { -struct fc_lport *lport = fsp->lp; -if (fsp->seq_ptr) { - lport->tt.exch_done (fsp->seq_ptr); +fc_exch_done (fsp->seq_ptr); fsp->seq_ptr =NULL ; } fsp->status_code = error;
@@ -1349,7 +1347,7 @@ static int fc_lun_reset(struct fc_lport *lport, struct fc_fcp_pkt *fsp,spin_lock_bh (&fsp->scsi_pkt_lock);if (fsp->seq_ptr) { - lport->tt.exch_done (fsp->seq_ptr); +fc_exch_done (fsp->seq_ptr); fsp->seq_ptr =NULL ; } fsp->wait_for_comp =0 ;
@@ -1403,7 +1401,7 @@ static void fc_tm_done(struct fc_seq *seq, struct fc_frame *fp, void *arg)if (fh->fh_type !=FC_TYPE_BLS )fc_fcp_resp (fsp, fp); fsp->seq_ptr =NULL ; - fsp->lp->tt.exch_done (seq); +fc_exch_done (seq); out_unlock:fc_fcp_unlock_pkt (fsp); out:
@@ -1793,9 +1791,9 @@ static void fc_fcp_srr_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg) fh =fc_frame_header_get (fp);/* -* BUG? fc_fcp_srr_error calls exch_done which would release +* BUG? fc_fcp_srr_error calls fc_exch_done which would release * the ep. But if fc_fcp_srr_error had got -FC_EX_TIMEOUT, -* then fc_exch_timeout would be sending an abort. The exch_done +* then fc_exch_timeout would be sending an abort. The fc_exch_done * call by fc_fcp_srr_error would prevent fc_exch.c from seeing * an abort response though. */
@@ -1816,7 +1814,7 @@ static void fc_fcp_srr_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg) }fc_fcp_unlock_pkt (fsp); out: - fsp->lp->tt.exch_done (seq); +fc_exch_done (seq);fc_frame_free (fp); }
@@ -1846,7 +1844,7 @@ static void fc_fcp_srr_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp) }fc_fcp_unlock_pkt (fsp); out: - fsp->lp->tt.exch_done (fsp->recov_seq); +fc_exch_done (fsp->recov_seq); }/**
drivers/scsi/libfc/fc_lport.c +1 -1
@@ -980,7 +980,7 @@ void fc_lport_recv(struct fc_lport *lport, struct fc_frame *fp)FC_LPORT_DBG (lport,"dropping unexpected frame type %x\n" , fh->fh_type);fc_frame_free (fp);if (sp) - lport->tt.exch_done (sp); +fc_exch_done (sp); }EXPORT_SYMBOL (fc_lport_recv);
drivers/target/tcm_fc/tfc_cmd.c +2 -2
@@ -177,7 +177,7 @@ int ft_queue_status(struct se_cmd *se_cmd) se_cmd->scsi_status =SAM_STAT_TASK_SET_FULL ;return -ENOMEM ; } - lport->tt.exch_done (cmd->seq); +fc_exch_done (cmd->seq);/* * Drop the extra ACK_KREF reference taken by target_submit_cmd() * ahead of ft_check_stop_free() -> transport_generic_free_cmd()
@@ -324,7 +324,7 @@ static void ft_send_resp_status(struct fc_lport *lport, sp =fr_seq (fp);if (sp) {fc_seq_send (lport, sp, fp); - lport->tt.exch_done (sp); +fc_exch_done (sp); }else { lport->tt.frame_send (lport, fp); }
include/scsi/libfc.h +1 -8
@@ -515,14 +515,6 @@ struct libfc_function_template {void (*get_lesb)(struct fc_lport *,struct fc_els_lesb *lesb);/* -* Indicate that an exchange/sequence tuple is complete and the memory -* allocated for the related objects may be freed. -* -* STATUS: OPTIONAL -*/ -void (*exch_done)(struct fc_seq *); - -/* * Start a new sequence on the same exchange/sequence tuple. * * STATUS: OPTIONAL
@@ -1040,6 +1032,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class,void fc_exch_mgr_reset (struct fc_lport *,u32 s_id,u32 d_id);int fc_seq_send (struct fc_lport *lport,struct fc_seq *sp,struct fc_frame *fp);int fc_seq_exch_abort (const struct fc_seq *,unsigned int timer_msec); +void fc_exch_done (struct fc_seq *sp);/* * Functions for fc_functions_template
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 15/20 libfc: Replace ->seq_exch_abort callback with function call
In reply to Hannes ReineckeThe ->seq_exch_abort callback only ever had one implementation, so we can as well call it directly and drop the callback.
--- drivers/scsi/libfc/fc_exch.c | 13 ++++++++----- drivers/scsi/libfc/fc_fcp.c | 4 ++-- include/scsi/libfc.h | 14 +------------- 3 files changed, 11 insertions(+), 20 deletions(-)
drivers/scsi/libfc/fc_exch.c +8 -5
@@ -629,6 +629,13 @@ static void fc_seq_set_resp(struct fc_seq *sp,* @ep: The exchange to be aborted * @timer_msec: The period of time to wait before aborting * +* Abort an exchange and sequence. Generally called because of a +* exchange timeout or an abort from the upper layer. +* +* A timer_msec can be specified for abort timeout, if non-zero +* timer_msec value is specified then exchange resp handler +* will be called with timeout error if no response to abort. +* * Locking notes: Called with exch lock held * * Return value: 0 on success else error code
@@ -692,8 +699,7 @@ static int fc_exch_abort_locked(struct fc_exch *ep,* * Return value: 0 on success else error code */ -static int fc_seq_exch_abort (const struct fc_seq *req_sp, -unsigned int timer_msec) +int fc_seq_exch_abort (const struct fc_seq *req_sp,unsigned int timer_msec) {struct fc_exch *ep;int error;
@@ -2654,9 +2660,6 @@ int fc_exch_init(struct fc_lport *lport)if (!lport->tt.exch_mgr_reset) lport->tt.exch_mgr_reset = fc_exch_mgr_reset; -if (!lport->tt.seq_exch_abort) - lport->tt.seq_exch_abort = fc_seq_exch_abort; -if (!lport->tt.seq_assign) lport->tt.seq_assign = fc_seq_assign;
drivers/scsi/libfc/fc_fcp.c +2 -2
@@ -287,9 +287,9 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp)put_cpu (); fsp->state |=FC_SRB_ABORT_PENDING ; - rc = fsp->lp->tt.seq_exch_abort (fsp->seq_ptr,0 ); + rc =fc_seq_exch_abort (fsp->seq_ptr,0 );/* -* ->seq_exch_abort() might return -ENXIO if +* fc_seq_exch_abort() might return -ENXIO if * the sequence is already completed */ if (rc == -ENXIO ) {
include/scsi/libfc.h +1 -13
@@ -515,19 +515,6 @@ struct libfc_function_template {void (*get_lesb)(struct fc_lport *,struct fc_els_lesb *lesb);/* -* Abort an exchange and sequence. Generally called because of a -* exchange timeout or an abort from the upper layer. -* -* A timer_msec can be specified for abort timeout, if non-zero -* timer_msec value is specified then exchange resp handler -* will be called with timeout error if no response to abort. -* -* STATUS: OPTIONAL -*/ -int (*seq_exch_abort)(const struct fc_seq *, -unsigned int timer_msec); - -/* * Indicate that an exchange/sequence tuple is complete and the memory * allocated for the related objects may be freed. *
@@ -1052,6 +1039,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class,void fc_exch_recv (struct fc_lport *,struct fc_frame *);void fc_exch_mgr_reset (struct fc_lport *,u32 s_id,u32 d_id);int fc_seq_send (struct fc_lport *lport,struct fc_seq *sp,struct fc_frame *fp); +int fc_seq_exch_abort (const struct fc_seq *,unsigned int timer_msec);/* * Functions for fc_functions_template
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 18/20 libfc: Replace ->seq_set_resp callback with direct function call
In reply to Hannes ReineckeThe ->seq_set_resp callback only ever had one implementation, so call it directly and drop the callback.
--- drivers/scsi/libfc/fc_exch.c | 11 ++++------- drivers/target/tcm_fc/tfc_cmd.c | 2 +- include/scsi/libfc.h | 13 +++---------- 3 files changed, 8 insertions(+), 18 deletions(-)
drivers/scsi/libfc/fc_exch.c +4 -7
@@ -602,10 +602,9 @@ struct fc_seq *fc_seq_start_next(struct fc_seq *sp)* * Note: May sleep if invoked from outside a response handler. */ -static void fc_seq_set_resp (struct fc_seq *sp, -void (*resp)(struct fc_seq *,struct fc_frame *, -void *), -void *arg) +void fc_seq_set_resp (struct fc_seq *sp, +void (*resp)(struct fc_seq *,struct fc_frame *,void *), +void *arg) {struct fc_exch *ep =fc_seq_exch (sp);DEFINE_WAIT (wait);
@@ -624,6 +623,7 @@ static void fc_seq_set_resp(struct fc_seq *sp, ep->arg = arg;spin_unlock_bh (&ep->ex_lock); } +EXPORT_SYMBOL (fc_seq_set_resp);/** * fc_exch_abort_locked() - Abort an exchange
@@ -2650,9 +2650,6 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)*/ int fc_exch_init (struct fc_lport *lport) { -if (!lport->tt.seq_set_resp) - lport->tt.seq_set_resp = fc_seq_set_resp; -if (!lport->tt.exch_mgr_reset) lport->tt.exch_mgr_reset = fc_exch_mgr_reset;
drivers/target/tcm_fc/tfc_cmd.c +1 -1
@@ -563,7 +563,7 @@ static void ft_send_work(struct work_struct *work) task_attr =TCM_SIMPLE_TAG ; } -fc_seq_exch (cmd->seq)->lp->tt.seq_set_resp (cmd->seq, ft_recv_seq, cmd); +fc_seq_set_resp (cmd->seq, ft_recv_seq, cmd); cmd->se_cmd.tag =fc_seq_exch (cmd->seq)->rxid;/* * Use a single se_cmd->cmd_kref as we expect to release se_cmd
include/scsi/libfc.h +3 -10
@@ -515,16 +515,6 @@ struct libfc_function_template {void (*get_lesb)(struct fc_lport *,struct fc_els_lesb *lesb);/* -* Set a response handler for the exchange of the sequence. -* -* STATUS: OPTIONAL -*/ -void (*seq_set_resp)(struct fc_seq *sp, -void (*resp)(struct fc_seq *,struct fc_frame *, -void *), -void *arg); - -/* * Assign a sequence for an incoming request frame. * * STATUS: OPTIONAL
@@ -1013,6 +1003,9 @@ struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,void fc_seq_els_rsp_send (struct fc_frame *,enum fc_els_cmd ,struct fc_seq_els_data *);struct fc_seq *fc_seq_start_next (struct fc_seq *sp); +void fc_seq_set_resp (struct fc_seq *sp, +void (*resp)(struct fc_seq *,struct fc_frame *,void *), +void *arg);struct fc_exch_mgr_anchor *fc_exch_mgr_add (struct fc_lport *,struct fc_exch_mgr *,bool (*match)(struct fc_frame *));
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 19/20 libfc: Replace ->seq_assign callback with function call
In reply to Hannes ReineckeThe ->seq_assign callback only ever had one implementation, so call the function directly and drop the callback.
--- drivers/scsi/libfc/fc_exch.c | 6 ++---- drivers/target/tcm_fc/tfc_cmd.c | 2 +- include/scsi/libfc.h | 8 +------- 3 files changed, 4 insertions(+), 12 deletions(-)
drivers/scsi/libfc/fc_exch.c +2 -4
@@ -1477,7 +1477,7 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp)* A reference will be held on the exchange/sequence for the caller, which * must call fc_seq_release(). */ -static struct fc_seq *fc_seq_assign (struct fc_lport *lport,struct fc_frame *fp) +struct fc_seq *fc_seq_assign (struct fc_lport *lport,struct fc_frame *fp) {struct fc_exch_mgr_anchor *ema;
@@ -1491,6 +1491,7 @@ static struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp)break ;return fr_seq (fp); } +EXPORT_SYMBOL (fc_seq_assign);/** * fc_seq_release() - Release the hold
@@ -2653,9 +2654,6 @@ int fc_exch_init(struct fc_lport *lport)if (!lport->tt.exch_mgr_reset) lport->tt.exch_mgr_reset = fc_exch_mgr_reset; -if (!lport->tt.seq_assign) - lport->tt.seq_assign = fc_seq_assign; -if (!lport->tt.seq_release) lport->tt.seq_release = fc_seq_release;
drivers/target/tcm_fc/tfc_cmd.c +1 -1
@@ -461,7 +461,7 @@ static void ft_recv_cmd(struct ft_sess *sess, struct fc_frame *fp) cmd->se_cmd.map_tag = tag; cmd->sess = sess; - cmd->seq = lport->tt.seq_assign (lport, fp); + cmd->seq =fc_seq_assign (lport, fp);if (!cmd->seq) {percpu_ida_free (&se_sess->sess_tag_pool, tag); goto busy;
include/scsi/libfc.h +1 -7
@@ -515,13 +515,6 @@ struct libfc_function_template {void (*get_lesb)(struct fc_lport *,struct fc_els_lesb *lesb);/* -* Assign a sequence for an incoming request frame. -* -* STATUS: OPTIONAL -*/ -struct fc_seq *(*seq_assign)(struct fc_lport *,struct fc_frame *); - -/* * Release the reference on the sequence returned by seq_assign(). * * STATUS: OPTIONAL
@@ -1006,6 +999,7 @@ void fc_seq_els_rsp_send(struct fc_frame *, enum fc_els_cmd,void fc_seq_set_resp (struct fc_seq *sp,void (*resp)(struct fc_seq *,struct fc_frame *,void *),void *arg); +struct fc_seq *fc_seq_assign (struct fc_lport *lport,struct fc_frame *fp);struct fc_exch_mgr_anchor *fc_exch_mgr_add (struct fc_lport *,struct fc_exch_mgr *,bool (*match)(struct fc_frame *));
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 17/20 libfc: Replace ->seq_start_next callback with function call
In reply to Hannes ReineckeThe ->seq_start_next callback only ever had one implementation, so call the function directly and drop the callback.
--- drivers/scsi/libfc/fc_exch.c | 6 ++---- drivers/scsi/libfc/fc_fcp.c | 4 ++-- drivers/scsi/libfc/fc_libfc.c | 2 +- drivers/target/tcm_fc/tfc_cmd.c | 4 ++-- drivers/target/tcm_fc/tfc_io.c | 2 +- include/scsi/libfc.h | 8 +------- 6 files changed, 9 insertions(+), 17 deletions(-)
drivers/scsi/libfc/fc_exch.c +2 -4
@@ -585,7 +585,7 @@ static struct fc_seq *fc_seq_start_next_locked(struct fc_seq *sp)* for a given sequence/exchange pair * @sp: The sequence/exchange to get a new exchange for */ -static struct fc_seq *fc_seq_start_next (struct fc_seq *sp) +struct fc_seq *fc_seq_start_next (struct fc_seq *sp) {struct fc_exch *ep =fc_seq_exch (sp);
@@ -595,6 +595,7 @@ static struct fc_seq *fc_seq_start_next(struct fc_seq *sp)return sp; } +EXPORT_SYMBOL (fc_seq_start_next);/* * Set the response handler for the exchange associated with a sequence.
@@ -2649,9 +2650,6 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)*/ int fc_exch_init (struct fc_lport *lport) { -if (!lport->tt.seq_start_next) - lport->tt.seq_start_next = fc_seq_start_next; -if (!lport->tt.seq_set_resp) lport->tt.seq_set_resp = fc_seq_set_resp;
drivers/scsi/libfc/fc_fcp.c +2 -2
@@ -653,7 +653,7 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq, remaining = seq_blen; fh_parm_offset = frame_offset = offset; tlen =0 ; - seq = lport->tt.seq_start_next (seq); + seq =fc_seq_start_next (seq); f_ctl =FC_FC_REL_OFF ;WARN_ON (!seq);
@@ -1024,7 +1024,7 @@ static void fc_fcp_complete_locked(struct fc_fcp_pkt *fsp)struct fc_frame *conf_frame;struct fc_seq *csp; - csp = lport->tt.seq_start_next (seq); + csp =fc_seq_start_next (seq); conf_frame =fc_fcp_frame_alloc (fsp->lp,0 );if (conf_frame) { f_ctl =FC_FC_SEQ_INIT ;
drivers/scsi/libfc/fc_libfc.c +1 -1
@@ -226,7 +226,7 @@ void fc_fill_reply_hdr(struct fc_frame *fp, const struct fc_frame *in_fp, sp =fr_seq (in_fp);if (sp) -fr_seq (fp) =fr_dev (in_fp)->tt.seq_start_next (sp); +fr_seq (fp) =fc_seq_start_next (sp);fc_fill_hdr (fp, in_fp, r_ctl,FC_FCTL_RESP ,0 , parm_offset); }EXPORT_SYMBOL (fc_fill_reply_hdr);
drivers/target/tcm_fc/tfc_cmd.c +2 -2
@@ -161,7 +161,7 @@ int ft_queue_status(struct se_cmd *se_cmd)/* * Send response. */ - cmd->seq = lport->tt.seq_start_next (cmd->seq); + cmd->seq =fc_seq_start_next (cmd->seq);fc_fill_fc_hdr (fp,FC_RCTL_DD_CMD_STATUS , ep->did, ep->sid,FC_TYPE_FCP ,FC_FC_EX_CTX |FC_FC_LAST_SEQ |FC_FC_END_SEQ ,0 );
@@ -221,7 +221,7 @@ int ft_write_pending(struct se_cmd *se_cmd)memset (txrdy,0 ,sizeof (*txrdy)); txrdy->ft_burst_len =htonl (se_cmd->data_length); - cmd->seq = lport->tt.seq_start_next (cmd->seq); + cmd->seq =fc_seq_start_next (cmd->seq);fc_fill_fc_hdr (fp,FC_RCTL_DD_DATA_DESC , ep->did, ep->sid,FC_TYPE_FCP ,FC_FC_EX_CTX |FC_FC_END_SEQ |FC_FC_SEQ_INIT ,0 );
drivers/target/tcm_fc/tfc_io.c +1 -1
@@ -82,7 +82,7 @@ int ft_queue_data_in(struct se_cmd *se_cmd) ep =fc_seq_exch (cmd->seq); lport = ep->lp; - cmd->seq = lport->tt.seq_start_next (cmd->seq); + cmd->seq =fc_seq_start_next (cmd->seq); remaining = se_cmd->data_length;
include/scsi/libfc.h +1 -7
@@ -515,13 +515,6 @@ struct libfc_function_template {void (*get_lesb)(struct fc_lport *,struct fc_els_lesb *lesb);/* -* Start a new sequence on the same exchange/sequence tuple. -* -* STATUS: OPTIONAL -*/ -struct fc_seq *(*seq_start_next)(struct fc_seq *); - -/* * Set a response handler for the exchange of the sequence. * * STATUS: OPTIONAL
@@ -1019,6 +1012,7 @@ struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, void *arg, u32 timer_msec);void fc_seq_els_rsp_send (struct fc_frame *,enum fc_els_cmd ,struct fc_seq_els_data *); +struct fc_seq *fc_seq_start_next (struct fc_seq *sp);struct fc_exch_mgr_anchor *fc_exch_mgr_add (struct fc_lport *,struct fc_exch_mgr *,bool (*match)(struct fc_frame *));
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 20/20 libfc: Replace ->seq_release callback with function call
In reply to Hannes ReineckeThe ->seq_release callback only ever had one implementation, so call the function directly and drop the callback.
--- drivers/scsi/libfc/fc_exch.c | 6 ++---- drivers/target/tcm_fc/tfc_cmd.c | 2 +- include/scsi/libfc.h | 8 +------- 3 files changed, 4 insertions(+), 12 deletions(-)
drivers/scsi/libfc/fc_exch.c +2 -4
@@ -1497,10 +1497,11 @@ struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp)* fc_seq_release() - Release the hold * @sp: The sequence. */ -static void fc_seq_release (struct fc_seq *sp) +void fc_seq_release (struct fc_seq *sp) {fc_exch_release (fc_seq_exch (sp)); } +EXPORT_SYMBOL (fc_seq_release);/** * fc_exch_recv_req() - Handler for an incoming request
@@ -2654,9 +2655,6 @@ int fc_exch_init(struct fc_lport *lport)if (!lport->tt.exch_mgr_reset) lport->tt.exch_mgr_reset = fc_exch_mgr_reset; -if (!lport->tt.seq_release) - lport->tt.seq_release = fc_seq_release; -return 0 ; }EXPORT_SYMBOL (fc_exch_init);
drivers/target/tcm_fc/tfc_cmd.c +1 -1
@@ -92,7 +92,7 @@ static void ft_free_cmd(struct ft_cmd *cmd) fp = cmd->req_frame; lport =fr_dev (fp);if (fr_seq (fp)) - lport->tt.seq_release (fr_seq (fp)); +fc_seq_release (fr_seq (fp));fc_frame_free (fp);percpu_ida_free (&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag);ft_sess_put (sess);/* undo get from lookup at recv */
include/scsi/libfc.h +1 -7
@@ -515,13 +515,6 @@ struct libfc_function_template {void (*get_lesb)(struct fc_lport *,struct fc_els_lesb *lesb);/* -* Release the reference on the sequence returned by seq_assign(). -* -* STATUS: OPTIONAL -*/ -void (*seq_release)(struct fc_seq *); - -/* * Reset an exchange manager, completing all sequences and exchanges. * If s_id is non-zero, reset only exchanges originating from that FID. * If d_id is non-zero, reset only exchanges sending to that FID.
@@ -1000,6 +993,7 @@ void fc_seq_set_resp(struct fc_seq *sp,void (*resp)(struct fc_seq *,struct fc_frame *,void *), void *arg);struct fc_seq *fc_seq_assign (struct fc_lport *lport,struct fc_frame *fp); +void fc_seq_release (struct fc_seq *sp);struct fc_exch_mgr_anchor *fc_exch_mgr_add (struct fc_lport *,struct fc_exch_mgr *,bool (*match)(struct fc_frame *));
Signature · 1 line
1.8.5.6
Re: [PATCH 01/20] libfc: Replace ->seq_els_rsp_send callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The '
seq_els_rsp_send' callback only ever had one implementation, so we might as well drop it and use the function directly.Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 01/20] libfc: Replace ->seq_els_rsp_send callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The '
seq_els_rsp_send' callback only ever had one implementation, so we might as well drop it and use the function directly.Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 02/20] libfc: Replace ->lport_reset callback with function call
In reply to Hannes ReineckeQuoted 6 lines · Hannes Reinecke
The ->lport_reset callback only ever had one implementation, which already is exported. So remove it and use the function directly.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 03/20] libfc: Replace ->lport_recv with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->lport_recv callback only ever had one implementation, so call the function directly and remove the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 04/20] libfc: Replace ->exch_seq_send callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->exch_seq_send callback only ever had one implementation, so we can call the function directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 05/20] libfc: Replace ->rport_destroy callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->rport_destroy callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 06/20] libfc: Replace ->rport_lookup callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->rport_lookup callback only ever had a single implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 08/20] libfc: Replace ->rport_create callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->rport_create callback only ever had a single implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Any reason we can't rename fc_rport_create() with fc_remote_port_create() so the scsi_transport_fc.c patch isn't needed?
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 09/20] libfc: Replace ->rport_login callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->rport_login callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 10/20] libfc: Replace ->rport_logoff callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->rport_logoff callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 11/20] libfc: Replace ->rport_recv_req callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->rport_recv_req callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 12/20] libfc: Replace ->rport_flush_queue callback with function call
In reply to Hannes ReineckeQuoted 6 lines · Hannes Reinecke
The ->rport_flush_queue callback only ever had a single implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 13/20] libfc: Remove fc_rport_init()
In reply to Hannes ReineckeQuoted 4 lines · Hannes Reinecke
Function is empty now and can be removed.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 14/20] libfc: Replace ->seq_send callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->seq_send callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 15/20] libfc: Replace ->seq_exch_abort callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->seq_exch_abort callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 16/20] libfc: Replace ->exch_done callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->exch_done callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 17/20] libfc: Replace ->seq_start_next callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->seq_start_next callback only ever had one implementation, so call the function directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 18/20] libfc: Replace ->seq_set_resp callback with direct function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->seq_set_resp callback only ever had one implementation, so call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 19/20] libfc: Replace ->seq_assign callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->seq_assign callback only ever had one implementation, so call the function directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 20/20] libfc: Replace ->seq_release callback with function call
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
The ->seq_release callback only ever had one implementation, so call the function directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Hannes Reinecke
maintainerRe: [PATCH 08/20] libfc: Replace ->rport_create callback with function call
In reply to Johannes ThumshirnQuoted 10 lines · Johannes Thumshirn
Quoted 5 lines · Hannes Reinecke
The ->rport_create callback only ever had a single implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Any reason we can't rename
fc_rport_create()withfc_remote_port_create()so thescsi_transport_fc.cpatch isn't needed?
Yes: consistency.
Every function in libfc/fc_rport.c is named 'fc_rport_XXX'. So we should stick to that naming scheme here, too.scsi_transport_fc.c does not have such a strict naming scheme, so it's easier to rename that.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Johannes Thumshirn
Acked-byRe: [PATCH 08/20] libfc: Replace ->rport_create callback with function call
Quoted 11 lines · Hannes Reinecke
Quoted 10 lines · Johannes Thumshirn
Quoted 5 lines · Hannes Reinecke
The ->rport_create callback only ever had a single implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>---
Any reason we can't rename
fc_rport_create()withfc_remote_port_create()so thescsi_transport_fc.cpatch isn't needed?
Quoted 7 lines
Yes: consistency.
Every function in
libfc/fc_rport.cis named 'fc_rport_XXX'. So we should stick to that naming scheme here, too.scsi_transport_fc.cdoes not have such a strict naming scheme, so it's easier to rename that.
OK,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 07/20] scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'
In reply to Hannes ReineckeQuoted 4 lines · Hannes Reinecke
Required for the next patch.
Signed-off-by Hannes Reinecke <[email protected]>---
Given the comment on the next patch,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 07/20] scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'
In reply to Hannes ReineckeQuoted 32 lines · Hannes Reinecke
Required for the next patch.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_transport_fc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/scsi/scsi_transport_fc.c +3
-3@@ -2592,7 +2592,7 @@ static void fc_terminate_rport_io(struct fc_rport *rport)/** -* fc_rport_create - allocates and creates a remote FC port. +* fc_remote_port_create - allocates and creates a remote FC port. * @shost: scsi host the remote port is connected to. * @channel: Channel on shost port connected to. * @ids: The world wide names, fc address, and FC4 port @@ -2605,8 +2605,8 @@ static void fc_terminate_rport_io(struct fc_rport *rport)* This routine assumes no locks are held on entry. */ static struct fc_rport * -fc_rport_create (struct Scsi_Host *shost,int channel, -struct fc_rport_identifiers *ids) +fc_remote_port_create (struct Scsi_Host *shost,int channel, +struct fc_rport_identifiers *ids) {struct fc_host_attrs *fc_host =shost_to_fc_host (shost);struct fc_internal *fci =to_fc_internal (shost->transportt);
drivers/scsi/scsi_transport_fc.c struct fc_rport * · line 2920
Quoted 8 lines
drivers/scsi/scsi_transport_fc.c +1
-1@@ -2914,7 +2914,7 @@ struct fc_rport *spin_unlock_irqrestore (shost->host_lock, flags);/* No consistent binding found - create new remote port entry */ - rport =fc_rport_create (shost, channel, ids); + rport =fc_remote_port_create (shost, channel, ids);return rport; }
Hannes,
Why are you making an interface change that will now affect drivers that are not users of libfc ? Can't this be localized within libfc ?
-- james
Re: [PATCH 07/20] scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'
In reply to a message not in the archiveQuoted 7 lines · Johannes Thumshirn
Hi James,
fc_rport_create()inscsi_transport_fc.cis static so there is no interface change here.Johannes
ah - that this was the published routine. ok.
-- james
Quoted 32 lines · Hannes Reinecke
Hi all,
it has been bugging me for a while that libfc has tons of callbacks in an attempt to abstract things away. But as it turned out no-one ever used those, rendering them quite pointless.
As I got some time to kill on the train back from Vienna I've decided to finally kill them and call the functions directly.As usual, comments and reviews are welcome.
Hannes Reinecke (20):
libfc: Replace ->seq_els_rsp_send callback with function call
libfc: Replace ->lport_reset callback with function call
libfc: Replace ->lport_recv with function call
libfc: Replace ->exch_seq_send callback with function call
libfc: Replace ->rport_destroy callback with function call
libfc: Replace ->rport_lookup callback with function call
scsi_transport_fc: rename 'fc_rport_create' to 'fc_remote_port_create'
libfc: Replace ->rport_create callback with function call
libfc: Replace ->rport_login callback with function call
libfc: Replace ->rport_logoff callback with function call
libfc: Replace ->rport_recv_req callback with function call
libfc: Replace ->rport_flush_queue callback with function call
libfc: Removefc_rport_init()
libfc: Replace ->seq_send callback with function call
libfc: Replace ->seq_exch_abort callback with function call
libfc: Replace ->exch_done callback with function call
libfc: Replace ->seq_start_next callback with function call
libfc: Replace ->seq_set_resp callback with direct function call
libfc: Replace ->seq_assign callback with function call
libfc: Replace ->seq_release callback with function call
Quoted 17 lines
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 - drivers/scsi/bnx2fc/bnx2fc_tgt.c | 3 +- drivers/scsi/fcoe/fcoe_ctlr.c | 35 ++++--- drivers/scsi/fnic/fnic_scsi.c | 2 +- drivers/scsi/libfc/fc_disc.c | 33 ++++--- drivers/scsi/libfc/fc_elsct.c | 2 +- drivers/scsi/libfc/fc_exch.c | 104 ++++++++++---------- drivers/scsi/libfc/fc_fcp.c | 45 ++++----- drivers/scsi/libfc/fc_libfc.c | 2 +- drivers/scsi/libfc/fc_lport.c | 62 ++++++------ drivers/scsi/libfc/fc_rport.c | 167 ++++++++++++++------------------ drivers/scsi/scsi_transport_fc.c | 8 +- drivers/target/tcm_fc/tfc_cmd.c | 20 ++-- drivers/target/tcm_fc/tfc_io.c | 4 +- include/scsi/libfc.h | 195 ++++++-------------------------------- 15 files changed, 254 insertions(+), 429 deletions(-)
Hannes, thanks for doing this. Should make the code much more readable.
Re: [PATCH 10/20] libfc: Replace ->rport_logoff callback with function call
In reply to Hannes ReineckeQuoted 4 lines · Hannes Reinecke
The ->rport_logoff callback only ever had one implementation, so we can as well call it directly and drop the callback.
Signed-off-by Hannes Reinecke <[email protected]>
Quoted 9 lines
--- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 3 +-- drivers/scsi/fcoe/fcoe_ctlr.c | 8 ++++---- drivers/scsi/libfc/fc_disc.c | 8 ++++---- drivers/scsi/libfc/fc_lport.c | 10 +++++----- drivers/scsi/libfc/fc_rport.c | 8 +++----- include/scsi/libfc.h | 9 +-------- 6 files changed, 18 insertions(+), 28 deletions(-)
Straightforward conversion.
Re: [PATCH 13/20] libfc: Remove fc_rport_init()
In reply to Hannes ReineckeQuoted 61 lines · Hannes Reinecke
Function is empty now and can be removed.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 - drivers/scsi/fcoe/fcoe_ctlr.c | 1 - drivers/scsi/libfc/fc_rport.c | 10 ---------- include/scsi/libfc.h | 1 - 4 files changed, 13 deletions(-)drivers/scsi/bnx2fc/bnx2fc_fcoe.c +0
-1@@ -970,7 +970,6 @@ static int bnx2fc_libfc_config(struct fc_lport *lport) sizeof(struct libfc_function_template));fc_elsct_init (lport);fc_exch_init (lport); -fc_rport_init (lport);fc_disc_init (lport);fc_disc_config (lport, lport);return 0 ;drivers/scsi/fcoe/fcoe_ctlr.c +0
-1@@ -3235,7 +3235,6 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip,fc_exch_init (lport);fc_elsct_init (lport);fc_lport_init (lport); -fc_rport_init (lport);fc_disc_init (lport);fcoe_ctlr_mode_set (lport, fip, fip->mode);return 0 ;drivers/scsi/libfc/fc_rport.c +0
-10@@ -2182,16 +2182,6 @@ void fc_rport_flush_queue(void)EXPORT_SYMBOL (fc_rport_flush_queue);/** -* fc_rport_init() - Initialize the remote port layer for a local port -* @lport: The local port to initialize the remote port layer for -*/ -int fc_rport_init (struct fc_lport *lport) -{ -return 0 ; -} -EXPORT_SYMBOL (fc_rport_init); - -/** * fc_rport_fcp_prli() - Handle incoming PRLI for the FCP initiator. * @rdata: remote port private * @spp_len: service parameter page length include/scsi/libfc.h +0
-0
include/scsi/libfc.h static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) · line 983
Quoted 7 lines
include/scsi/libfc.h +0
-1@@ -978,7 +978,6 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)/* * REMOTE PORT LAYER *****************************/ -int fc_rport_init (struct fc_lport *);void fc_rport_terminate_io (struct fc_rport *);struct fc_rport_priv *fc_rport_lookup (const struct fc_lport *lport,u32 port_id);
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Hannes" == Hannes Reinecke <[email protected]> writes:
Hannes> Hi all, it has been bugging me for a while that libfc has tons Hannes> of callbacks in an attempt to abstract things away. But as it Hannes> turned out no-one ever used those, rendering them quite Hannes> pointless. As I got some time to kill on the train back from Hannes> Vienna I've decided to finally kill them and call the functions Hannes> directly.
Applied to 4.10/scsi-queue.
Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering