Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173655
b: refs/heads/master
c: 7cccc15
h: refs/heads/master
i:
  173653: 108b526
  173651: 667940a
  173647: b7a8e24
v: v3
  • Loading branch information
Chris Leech authored and James Bottomley committed Dec 4, 2009
1 parent bfad4e3 commit bcdf402
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 176 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c9866a548024c33e30f35a14bbcb71ba78266383
refs/heads/master: 7cccc157119be9b3f57e03a5ae197ba0a6a8a89f
205 changes: 30 additions & 175 deletions trunk/drivers/scsi/libfc/fc_lport.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,140 +985,33 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp)
}

/**
* fc_lport_rft_id_resp() - Handle response to Register Fibre
* Channel Types by ID (RFT_ID) request
* @sp: current sequence in RFT_ID exchange
* fc_lport_ns_resp() - Handle response to a name server
* registration exchange
* @sp: current sequence in exchange
* @fp: response frame
* @lp_arg: Fibre Channel host port instance
*
* Locking Note: This function will be called without the lport lock
* held, but it will lock, call an _enter_* function or fc_lport_error
* and then unlock the lport.
*/
static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp,
void *lp_arg)
static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp,
void *lp_arg)
{
struct fc_lport *lport = lp_arg;
struct fc_frame_header *fh;
struct fc_ct_hdr *ct;

FC_LPORT_DBG(lport, "Received a RFT_ID %s\n", fc_els_resp_type(fp));
FC_LPORT_DBG(lport, "Received a ns %s\n", fc_els_resp_type(fp));

if (fp == ERR_PTR(-FC_EX_CLOSED))
return;

mutex_lock(&lport->lp_mutex);

if (lport->state != LPORT_ST_RFT_ID) {
FC_LPORT_DBG(lport, "Received a RFT_ID response, but in state "
"%s\n", fc_lport_state(lport));
if (IS_ERR(fp))
goto err;
goto out;
}

if (IS_ERR(fp)) {
fc_lport_error(lport, fp);
goto err;
}

fh = fc_frame_header_get(fp);
ct = fc_frame_payload_get(fp, sizeof(*ct));

if (fh && ct && fh->fh_type == FC_TYPE_CT &&
ct->ct_fs_type == FC_FST_DIR &&
ct->ct_fs_subtype == FC_NS_SUBTYPE &&
ntohs(ct->ct_cmd) == FC_FS_ACC)
fc_lport_enter_scr(lport);
else
fc_lport_error(lport, fp);
out:
fc_frame_free(fp);
err:
mutex_unlock(&lport->lp_mutex);
}

/**
* fc_lport_rspn_id_resp() - Handle response to Register Symbolic Port Name
* by ID (RSPN_ID) request
* @sp: current sequence in RSPN_ID exchange
* @fp: response frame
* @lp_arg: Fibre Channel host port instance
*
* Locking Note: This function will be called without the lport lock
* held, but it will lock, call an _enter_* function or fc_lport_error
* and then unlock the lport.
*/
static void fc_lport_rspn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
void *lp_arg)
{
struct fc_lport *lport = lp_arg;
struct fc_frame_header *fh;
struct fc_ct_hdr *ct;

FC_LPORT_DBG(lport, "Received a RSPN_ID %s\n", fc_els_resp_type(fp));

if (fp == ERR_PTR(-FC_EX_CLOSED))
return;

mutex_lock(&lport->lp_mutex);

if (lport->state != LPORT_ST_RSPN_ID) {
FC_LPORT_DBG(lport, "Received a RSPN_ID response, but in state "
"%s\n", fc_lport_state(lport));
if (IS_ERR(fp))
goto err;
goto out;
}

if (IS_ERR(fp)) {
fc_lport_error(lport, fp);
goto err;
}

fh = fc_frame_header_get(fp);
ct = fc_frame_payload_get(fp, sizeof(*ct));
if (fh && ct && fh->fh_type == FC_TYPE_CT &&
ct->ct_fs_type == FC_FST_DIR &&
ct->ct_fs_subtype == FC_NS_SUBTYPE &&
ntohs(ct->ct_cmd) == FC_FS_ACC)
fc_lport_enter_rspn_id(lport);
else
fc_lport_error(lport, fp);

out:
fc_frame_free(fp);
err:
mutex_unlock(&lport->lp_mutex);
}
/**
* fc_lport_rsnn_nn_resp() - Handle response to Register Symbolic Node Name
* by Node Name (RSNN_NN) request
* @sp: current sequence in RSNN_NN exchange
* @fp: response frame
* @lp_arg: Fibre Channel host port instance
*
* Locking Note: This function will be called without the lport lock
* held, but it will lock, call an _enter_* function or fc_lport_error
* and then unlock the lport.
*/
static void fc_lport_rsnn_nn_resp(struct fc_seq *sp, struct fc_frame *fp,
void *lp_arg)
{
struct fc_lport *lport = lp_arg;
struct fc_frame_header *fh;
struct fc_ct_hdr *ct;

FC_LPORT_DBG(lport, "Received a RSNN_NN %s\n", fc_els_resp_type(fp));

if (fp == ERR_PTR(-FC_EX_CLOSED))
return;

mutex_lock(&lport->lp_mutex);

if (lport->state != LPORT_ST_RSNN_NN) {
FC_LPORT_DBG(lport, "Received a RSNN_NN response, but in state "
"%s\n", fc_lport_state(lport));
if (lport->state < LPORT_ST_RNN_ID || lport->state > LPORT_ST_RFT_ID) {
FC_LPORT_DBG(lport, "Received a name server response, "
"but in state %s\n", fc_lport_state(lport));
if (IS_ERR(fp))
goto err;
goto out;
Expand All @@ -1131,68 +1024,30 @@ static void fc_lport_rsnn_nn_resp(struct fc_seq *sp, struct fc_frame *fp,

fh = fc_frame_header_get(fp);
ct = fc_frame_payload_get(fp, sizeof(*ct));
if (fh && ct && fh->fh_type == FC_TYPE_CT &&
ct->ct_fs_type == FC_FST_DIR &&
ct->ct_fs_subtype == FC_NS_SUBTYPE &&
ntohs(ct->ct_cmd) == FC_FS_ACC)
fc_lport_enter_rsnn_nn(lport);
else
fc_lport_error(lport, fp);

out:
fc_frame_free(fp);
err:
mutex_unlock(&lport->lp_mutex);
}

/**
* fc_lport_rnn_id_resp() - Handle response to Register Node
* Name by ID (RNN_ID) request
* @sp: current sequence in RNN_ID exchange
* @fp: response frame
* @lp_arg: Fibre Channel host port instance
*
* Locking Note: This function will be called without the lport lock
* held, but it will lock, call an _enter_* function or fc_lport_error
* and then unlock the lport.
*/
static void fc_lport_rnn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
void *lp_arg)
{
struct fc_lport *lport = lp_arg;
struct fc_frame_header *fh;
struct fc_ct_hdr *ct;

FC_LPORT_DBG(lport, "Received a RNN_ID %s\n", fc_els_resp_type(fp));

if (fp == ERR_PTR(-FC_EX_CLOSED))
return;

mutex_lock(&lport->lp_mutex);

if (lport->state != LPORT_ST_RNN_ID) {
FC_LPORT_DBG(lport, "Received a RNN_ID response, but in state "
"%s\n", fc_lport_state(lport));
if (IS_ERR(fp))
goto err;
goto out;
}

if (IS_ERR(fp)) {
fc_lport_error(lport, fp);
goto err;
}

fh = fc_frame_header_get(fp);
ct = fc_frame_payload_get(fp, sizeof(*ct));
if (fh && ct && fh->fh_type == FC_TYPE_CT &&
ct->ct_fs_type == FC_FST_DIR &&
ct->ct_fs_subtype == FC_NS_SUBTYPE &&
ntohs(ct->ct_cmd) == FC_FS_ACC)
fc_lport_enter_rft_id(lport);
switch (lport->state) {
case LPORT_ST_RNN_ID:
fc_lport_enter_rsnn_nn(lport);
break;
case LPORT_ST_RSNN_NN:
fc_lport_enter_rspn_id(lport);
break;
case LPORT_ST_RSPN_ID:
fc_lport_enter_rft_id(lport);
break;
case LPORT_ST_RFT_ID:
fc_lport_enter_scr(lport);
break;
default:
/* should have already been caught by state checks */
break;
}
else
fc_lport_error(lport, fp);

out:
fc_frame_free(fp);
err:
Expand Down Expand Up @@ -1311,7 +1166,7 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport)
}

if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RFT_ID,
fc_lport_rft_id_resp,
fc_lport_ns_resp,
lport, lport->e_d_tov))
fc_lport_error(lport, fp);
}
Expand Down Expand Up @@ -1342,7 +1197,7 @@ static void fc_lport_enter_rspn_id(struct fc_lport *lport)
}

if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RSPN_ID,
fc_lport_rspn_id_resp,
fc_lport_ns_resp,
lport, lport->e_d_tov))
fc_lport_error(lport, fp);
}
Expand Down Expand Up @@ -1373,7 +1228,7 @@ static void fc_lport_enter_rsnn_nn(struct fc_lport *lport)
}

if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RSNN_NN,
fc_lport_rsnn_nn_resp,
fc_lport_ns_resp,
lport, lport->e_d_tov))
fc_lport_error(lport, fp);
}
Expand Down Expand Up @@ -1402,7 +1257,7 @@ static void fc_lport_enter_rnn_id(struct fc_lport *lport)
}

if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RNN_ID,
fc_lport_rnn_id_resp,
fc_lport_ns_resp,
lport, lport->e_d_tov))
fc_lport_error(lport, fp);
}
Expand Down

0 comments on commit bcdf402

Please sign in to comment.