Commit 92261156 authored by Joe Eykholt's avatar Joe Eykholt Committed by James Bottomley

[SCSI] libfc: don't require a local exchange for incoming requests

Incoming requests shouldn't require a local exchange if we're
just going to reply with one or two frames and don't expect
anything further.  Don't allocate exchanges for such requests
until requested by the upper-layer protocol.

The sequence is always NULL for new requests, so remove
that as an argument to request handlers.

Also change the first argument to lport->tt.seq_els_rsp_send
from the sequence pointer to the received frame pointer, to
supply the exchange IDs and destination ID info.
Signed-off-by: default avatarJoe Eykholt <jeykholt@cisco.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 239e8104
...@@ -2341,20 +2341,19 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -2341,20 +2341,19 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
/** /**
* fcoe_ctlr_disc_recv - discovery receive handler for VN2VN mode. * fcoe_ctlr_disc_recv - discovery receive handler for VN2VN mode.
* @fip: The FCoE controller * @lport: The local port
* @fp: The received frame
* *
* This should never be called since we don't see RSCNs or other * This should never be called since we don't see RSCNs or other
* fabric-generated ELSes. * fabric-generated ELSes.
*/ */
static void fcoe_ctlr_disc_recv(struct fc_seq *seq, struct fc_frame *fp, static void fcoe_ctlr_disc_recv(struct fc_lport *lport, struct fc_frame *fp)
struct fc_lport *lport)
{ {
struct fc_seq_els_data rjt_data; struct fc_seq_els_data rjt_data;
rjt_data.fp = NULL;
rjt_data.reason = ELS_RJT_UNSUP; rjt_data.reason = ELS_RJT_UNSUP;
rjt_data.explan = ELS_EXPL_NONE; rjt_data.explan = ELS_EXPL_NONE;
lport->tt.seq_els_rsp_send(seq, ELS_LS_RJT, &rjt_data); lport->tt.seq_els_rsp_send(fp, ELS_LS_RJT, &rjt_data);
fc_frame_free(fp); fc_frame_free(fp);
} }
......
...@@ -75,15 +75,13 @@ void fc_disc_stop_rports(struct fc_disc *disc) ...@@ -75,15 +75,13 @@ void fc_disc_stop_rports(struct fc_disc *disc)
/** /**
* fc_disc_recv_rscn_req() - Handle Registered State Change Notification (RSCN) * fc_disc_recv_rscn_req() - Handle Registered State Change Notification (RSCN)
* @sp: The sequence of the RSCN exchange * @disc: The discovery object to which the RSCN applies
* @fp: The RSCN frame * @fp: The RSCN frame
* @lport: The local port that the request will be sent on
* *
* Locking Note: This function expects that the disc_mutex is locked * Locking Note: This function expects that the disc_mutex is locked
* before it is called. * before it is called.
*/ */
static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, static void fc_disc_recv_rscn_req(struct fc_disc *disc, struct fc_frame *fp)
struct fc_disc *disc)
{ {
struct fc_lport *lport; struct fc_lport *lport;
struct fc_els_rscn *rp; struct fc_els_rscn *rp;
...@@ -151,7 +149,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, ...@@ -151,7 +149,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
break; break;
} }
} }
lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); lport->tt.seq_els_rsp_send(fp, ELS_LS_ACC, NULL);
/* /*
* If not doing a complete rediscovery, do GPN_ID on * If not doing a complete rediscovery, do GPN_ID on
...@@ -177,25 +175,22 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, ...@@ -177,25 +175,22 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
return; return;
reject: reject:
FC_DISC_DBG(disc, "Received a bad RSCN frame\n"); FC_DISC_DBG(disc, "Received a bad RSCN frame\n");
rjt_data.fp = NULL;
rjt_data.reason = ELS_RJT_LOGIC; rjt_data.reason = ELS_RJT_LOGIC;
rjt_data.explan = ELS_EXPL_NONE; rjt_data.explan = ELS_EXPL_NONE;
lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data); lport->tt.seq_els_rsp_send(fp, ELS_LS_RJT, &rjt_data);
fc_frame_free(fp); fc_frame_free(fp);
} }
/** /**
* fc_disc_recv_req() - Handle incoming requests * fc_disc_recv_req() - Handle incoming requests
* @sp: The sequence of the request exchange
* @fp: The request frame
* @lport: The local port receiving the request * @lport: The local port receiving the request
* @fp: The request frame
* *
* Locking Note: This function is called from the EM and will lock * Locking Note: This function is called from the EM and will lock
* the disc_mutex before calling the handler for the * the disc_mutex before calling the handler for the
* request. * request.
*/ */
static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp, static void fc_disc_recv_req(struct fc_lport *lport, struct fc_frame *fp)
struct fc_lport *lport)
{ {
u8 op; u8 op;
struct fc_disc *disc = &lport->disc; struct fc_disc *disc = &lport->disc;
...@@ -204,7 +199,7 @@ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp, ...@@ -204,7 +199,7 @@ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp,
switch (op) { switch (op) {
case ELS_RSCN: case ELS_RSCN:
mutex_lock(&disc->disc_mutex); mutex_lock(&disc->disc_mutex);
fc_disc_recv_rscn_req(sp, fp, disc); fc_disc_recv_rscn_req(disc, fp);
mutex_unlock(&disc->disc_mutex); mutex_unlock(&disc->disc_mutex);
break; break;
default: default:
......
This diff is collapsed.
...@@ -375,34 +375,31 @@ static void fc_lport_add_fc4_type(struct fc_lport *lport, enum fc_fh_type type) ...@@ -375,34 +375,31 @@ static void fc_lport_add_fc4_type(struct fc_lport *lport, enum fc_fh_type type)
/** /**
* fc_lport_recv_rlir_req() - Handle received Registered Link Incident Report. * fc_lport_recv_rlir_req() - Handle received Registered Link Incident Report.
* @sp: The sequence in the RLIR exchange
* @fp: The RLIR request frame
* @lport: Fibre Channel local port recieving the RLIR * @lport: Fibre Channel local port recieving the RLIR
* @fp: The RLIR request frame
* *
* Locking Note: The lport lock is expected to be held before calling * Locking Note: The lport lock is expected to be held before calling
* this function. * this function.
*/ */
static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp, static void fc_lport_recv_rlir_req(struct fc_lport *lport, struct fc_frame *fp)
struct fc_lport *lport)
{ {
FC_LPORT_DBG(lport, "Received RLIR request while in state %s\n", FC_LPORT_DBG(lport, "Received RLIR request while in state %s\n",
fc_lport_state(lport)); fc_lport_state(lport));
lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); lport->tt.seq_els_rsp_send(fp, ELS_LS_ACC, NULL);
fc_frame_free(fp); fc_frame_free(fp);
} }
/** /**
* fc_lport_recv_echo_req() - Handle received ECHO request * fc_lport_recv_echo_req() - Handle received ECHO request
* @sp: The sequence in the ECHO exchange
* @fp: ECHO request frame
* @lport: The local port recieving the ECHO * @lport: The local port recieving the ECHO
* @fp: ECHO request frame
* *
* Locking Note: The lport lock is expected to be held before calling * Locking Note: The lport lock is expected to be held before calling
* this function. * this function.
*/ */
static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp, static void fc_lport_recv_echo_req(struct fc_lport *lport,
struct fc_lport *lport) struct fc_frame *in_fp)
{ {
struct fc_frame *fp; struct fc_frame *fp;
unsigned int len; unsigned int len;
...@@ -431,15 +428,14 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp, ...@@ -431,15 +428,14 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
/** /**
* fc_lport_recv_rnid_req() - Handle received Request Node ID data request * fc_lport_recv_rnid_req() - Handle received Request Node ID data request
* @sp: The sequence in the RNID exchange
* @fp: The RNID request frame
* @lport: The local port recieving the RNID * @lport: The local port recieving the RNID
* @fp: The RNID request frame
* *
* Locking Note: The lport lock is expected to be held before calling * Locking Note: The lport lock is expected to be held before calling
* this function. * this function.
*/ */
static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp, static void fc_lport_recv_rnid_req(struct fc_lport *lport,
struct fc_lport *lport) struct fc_frame *in_fp)
{ {
struct fc_frame *fp; struct fc_frame *fp;
struct fc_els_rnid *req; struct fc_els_rnid *req;
...@@ -457,10 +453,9 @@ static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp, ...@@ -457,10 +453,9 @@ static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp,
req = fc_frame_payload_get(in_fp, sizeof(*req)); req = fc_frame_payload_get(in_fp, sizeof(*req));
if (!req) { if (!req) {
rjt_data.fp = NULL;
rjt_data.reason = ELS_RJT_LOGIC; rjt_data.reason = ELS_RJT_LOGIC;
rjt_data.explan = ELS_EXPL_NONE; rjt_data.explan = ELS_EXPL_NONE;
lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data); lport->tt.seq_els_rsp_send(in_fp, ELS_LS_RJT, &rjt_data);
} else { } else {
fmt = req->rnid_fmt; fmt = req->rnid_fmt;
len = sizeof(*rp); len = sizeof(*rp);
...@@ -492,17 +487,15 @@ static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp, ...@@ -492,17 +487,15 @@ static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp,
/** /**
* fc_lport_recv_logo_req() - Handle received fabric LOGO request * fc_lport_recv_logo_req() - Handle received fabric LOGO request
* @sp: The sequence in the LOGO exchange
* @fp: The LOGO request frame
* @lport: The local port recieving the LOGO * @lport: The local port recieving the LOGO
* @fp: The LOGO request frame
* *
* Locking Note: The lport lock is exected to be held before calling * Locking Note: The lport lock is exected to be held before calling
* this function. * this function.
*/ */
static void fc_lport_recv_logo_req(struct fc_seq *sp, struct fc_frame *fp, static void fc_lport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp)
struct fc_lport *lport)
{ {
lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); lport->tt.seq_els_rsp_send(fp, ELS_LS_ACC, NULL);
fc_lport_enter_reset(lport); fc_lport_enter_reset(lport);
fc_frame_free(fp); fc_frame_free(fp);
} }
...@@ -773,9 +766,8 @@ EXPORT_SYMBOL(fc_lport_set_local_id); ...@@ -773,9 +766,8 @@ EXPORT_SYMBOL(fc_lport_set_local_id);
/** /**
* fc_lport_recv_flogi_req() - Receive a FLOGI request * fc_lport_recv_flogi_req() - Receive a FLOGI request
* @sp_in: The sequence the FLOGI is on
* @rx_fp: The FLOGI frame
* @lport: The local port that recieved the request * @lport: The local port that recieved the request
* @rx_fp: The FLOGI frame
* *
* A received FLOGI request indicates a point-to-point connection. * A received FLOGI request indicates a point-to-point connection.
* Accept it with the common service parameters indicating our N port. * Accept it with the common service parameters indicating our N port.
...@@ -784,13 +776,11 @@ EXPORT_SYMBOL(fc_lport_set_local_id); ...@@ -784,13 +776,11 @@ EXPORT_SYMBOL(fc_lport_set_local_id);
* Locking Note: The lport lock is expected to be held before calling * Locking Note: The lport lock is expected to be held before calling
* this function. * this function.
*/ */
static void fc_lport_recv_flogi_req(struct fc_seq *sp_in, static void fc_lport_recv_flogi_req(struct fc_lport *lport,
struct fc_frame *rx_fp, struct fc_frame *rx_fp)
struct fc_lport *lport)
{ {
struct fc_frame *fp; struct fc_frame *fp;
struct fc_frame_header *fh; struct fc_frame_header *fh;
struct fc_seq *sp;
struct fc_els_flogi *flp; struct fc_els_flogi *flp;
struct fc_els_flogi *new_flp; struct fc_els_flogi *new_flp;
u64 remote_wwpn; u64 remote_wwpn;
...@@ -850,16 +840,13 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in, ...@@ -850,16 +840,13 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
} }
fc_lport_ptp_setup(lport, remote_fid, remote_wwpn, fc_lport_ptp_setup(lport, remote_fid, remote_wwpn,
get_unaligned_be64(&flp->fl_wwnn)); get_unaligned_be64(&flp->fl_wwnn));
out: out:
sp = fr_seq(rx_fp);
fc_frame_free(rx_fp); fc_frame_free(rx_fp);
} }
/** /**
* fc_lport_recv_req() - The generic lport request handler * fc_lport_recv_req() - The generic lport request handler
* @lport: The local port that received the request * @lport: The local port that received the request
* @sp: The sequence the request is on
* @fp: The request frame * @fp: The request frame
* *
* This function will see if the lport handles the request or * This function will see if the lport handles the request or
...@@ -868,11 +855,10 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in, ...@@ -868,11 +855,10 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
* Locking Note: This function should not be called with the lport * Locking Note: This function should not be called with the lport
* lock held becuase it will grab the lock. * lock held becuase it will grab the lock.
*/ */
static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp, static void fc_lport_recv_req(struct fc_lport *lport, struct fc_frame *fp)
struct fc_frame *fp)
{ {
struct fc_frame_header *fh = fc_frame_header_get(fp); struct fc_frame_header *fh = fc_frame_header_get(fp);
void (*recv) (struct fc_seq *, struct fc_frame *, struct fc_lport *); void (*recv)(struct fc_lport *, struct fc_frame *);
mutex_lock(&lport->lp_mutex); mutex_lock(&lport->lp_mutex);
...@@ -912,19 +898,13 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp, ...@@ -912,19 +898,13 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp,
break; break;
} }
recv(sp, fp, lport); recv(lport, fp);
} else { } else {
FC_LPORT_DBG(lport, "dropping invalid frame (eof %x)\n", FC_LPORT_DBG(lport, "dropping invalid frame (eof %x)\n",
fr_eof(fp)); fr_eof(fp));
fc_frame_free(fp); fc_frame_free(fp);
} }
mutex_unlock(&lport->lp_mutex); mutex_unlock(&lport->lp_mutex);
/*
* The common exch_done for all request may not be good
* if any request requires longer hold on exhange. XXX
*/
lport->tt.exch_done(sp);
} }
/** /**
......
This diff is collapsed.
...@@ -249,14 +249,12 @@ struct fcoe_dev_stats { ...@@ -249,14 +249,12 @@ struct fcoe_dev_stats {
/** /**
* struct fc_seq_els_data - ELS data used for passing ELS specific responses * struct fc_seq_els_data - ELS data used for passing ELS specific responses
* @fp: The ELS frame
* @reason: The reason for rejection * @reason: The reason for rejection
* @explan: The explaination of the rejection * @explan: The explaination of the rejection
* *
* Mainly used by the exchange manager layer. * Mainly used by the exchange manager layer.
*/ */
struct fc_seq_els_data { struct fc_seq_els_data {
struct fc_frame *fp;
enum fc_els_rjt_reason reason; enum fc_els_rjt_reason reason;
enum fc_els_rjt_explan explan; enum fc_els_rjt_explan explan;
}; };
...@@ -519,12 +517,11 @@ struct libfc_function_template { ...@@ -519,12 +517,11 @@ struct libfc_function_template {
struct fc_frame *); struct fc_frame *);
/* /*
* Send an ELS response using infomation from a previous * Send an ELS response using infomation from the received frame.
* exchange and sequence.
* *
* STATUS: OPTIONAL * STATUS: OPTIONAL
*/ */
void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd, void (*seq_els_rsp_send)(struct fc_frame *, enum fc_els_cmd,
struct fc_seq_els_data *); struct fc_seq_els_data *);
/* /*
...@@ -583,8 +580,7 @@ struct libfc_function_template { ...@@ -583,8 +580,7 @@ struct libfc_function_template {
* *
* STATUS: OPTIONAL * STATUS: OPTIONAL
*/ */
void (*lport_recv)(struct fc_lport *, struct fc_seq *, void (*lport_recv)(struct fc_lport *, struct fc_frame *);
struct fc_frame *);
/* /*
* Reset the local port. * Reset the local port.
...@@ -646,8 +642,7 @@ struct libfc_function_template { ...@@ -646,8 +642,7 @@ struct libfc_function_template {
* *
* STATUS: OPTIONAL * STATUS: OPTIONAL
*/ */
void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, void (*rport_recv_req)(struct fc_lport *, struct fc_frame *);
struct fc_lport *);
/* /*
* lookup an rport by it's port ID. * lookup an rport by it's port ID.
...@@ -693,8 +688,7 @@ struct libfc_function_template { ...@@ -693,8 +688,7 @@ struct libfc_function_template {
* *
* STATUS: OPTIONAL * STATUS: OPTIONAL
*/ */
void (*disc_recv_req)(struct fc_seq *, struct fc_frame *, void (*disc_recv_req)(struct fc_lport *, struct fc_frame *);
struct fc_lport *);
/* /*
* Start discovery for a local port. * Start discovery for a local port.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment