mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
scsi: libfc: Replace ->exch_seq_send callback with function call
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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
c5cb444c31
commit
3afd2d1521
@ -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);
|
||||
|
||||
|
@ -2127,6 +2127,24 @@ cleanup:
|
||||
* @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 @@ cleanup:
|
||||
* - 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 @@ err:
|
||||
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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -484,37 +484,6 @@ struct libfc_function_template {
|
||||
struct fc_frame *, void *arg),
|
||||
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 *,
|
||||
|
Loading…
Reference in New Issue
Block a user