Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173677
b: refs/heads/master
c: 093bb6a
h: refs/heads/master
i:
  173675: 252b549
v: v3
  • Loading branch information
Joe Eykholt authored and James Bottomley committed Dec 4, 2009
1 parent c9991ae commit 117eca5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 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: 52a6690d3f0cb7414c34b1e26c569b32d4987662
refs/heads/master: 093bb6a2d378ee83fc6ab886c772b6be86abb5a8
34 changes: 27 additions & 7 deletions trunk/drivers/scsi/libfc/fc_lport.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,27 @@ static void fc_lport_enter_ready(struct fc_lport *lport)
lport->tt.disc_start(fc_lport_disc_callback, lport);
}

/**
* fc_lport_set_port_id() - set the local port Port ID
* @lport: The local port which will have its Port ID set.
* @port_id: The new port ID.
* @fp: The frame containing the incoming request, or NULL.
*
* Locking Note: The lport lock is expected to be held before calling
* this function.
*/
static void fc_lport_set_port_id(struct fc_lport *lport, u32 port_id,
struct fc_frame *fp)
{
if (port_id)
printk(KERN_INFO "host%d: Assigned Port ID %6x\n",
lport->host->host_no, port_id);

fc_host_port_id(lport->host) = port_id;
if (lport->tt.lport_set_port_id)
lport->tt.lport_set_port_id(lport, port_id, fp);
}

/**
* fc_lport_recv_flogi_req() - Receive a FLOGI request
* @sp_in: The sequence the FLOGI is on
Expand Down Expand Up @@ -790,7 +811,7 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
remote_fid = FC_LOCAL_PTP_FID_HI;
}

fc_host_port_id(lport->host) = local_fid;
fc_lport_set_port_id(lport, local_fid, rx_fp);

fp = fc_frame_alloc(lport, sizeof(*flp));
if (fp) {
Expand Down Expand Up @@ -926,7 +947,9 @@ static void fc_lport_reset_locked(struct fc_lport *lport)

lport->tt.exch_mgr_reset(lport, 0, 0);
fc_host_fabric_name(lport->host) = 0;
fc_host_port_id(lport->host) = 0;

if (fc_host_port_id(lport->host))
fc_lport_set_port_id(lport, 0, NULL);
}

/**
Expand Down Expand Up @@ -1428,11 +1451,6 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
fh = fc_frame_header_get(fp);
did = ntoh24(fh->fh_d_id);
if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {

printk(KERN_INFO "libfc: Assigned FID (%6x) in FLOGI response\n",
did);
fc_host_port_id(lport->host) = did;

flp = fc_frame_payload_get(fp, sizeof(*flp));
if (flp) {
mfs = ntohs(flp->fl_csp.sp_bb_data) &
Expand All @@ -1452,6 +1470,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
if (e_d_tov > lport->e_d_tov)
lport->e_d_tov = e_d_tov;
lport->r_a_tov = 2 * e_d_tov;
fc_lport_set_port_id(lport, did, fp);
printk(KERN_INFO "libfc: Port (%6x) entered "
"point to point mode\n", did);
fc_lport_ptp_setup(lport, ntoh24(fh->fh_s_id),
Expand All @@ -1464,6 +1483,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
lport->r_a_tov = r_a_tov;
fc_host_fabric_name(lport->host) =
get_unaligned_be64(&flp->fl_wwnn);
fc_lport_set_port_id(lport, did, fp);
fc_lport_enter_dns(lport);
}
}
Expand Down
20 changes: 20 additions & 0 deletions trunk/include/scsi/libfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,26 @@ struct libfc_function_template {
*/
int (*lport_reset)(struct fc_lport *);

/*
* Set the local port FC_ID.
*
* This may be provided by the LLD to allow it to be
* notified when the local port is assigned a FC-ID.
*
* The frame, if non-NULL, is the incoming frame with the
* FLOGI LS_ACC or FLOGI, and may contain the granted MAC
* address for the LLD. The frame pointer may be NULL if
* no MAC is associated with this assignment (LOGO or PLOGI).
*
* If FC_ID is non-zero, r_a_tov and e_d_tov must be valid.
*
* Note: this is called with the local port mutex held.
*
* STATUS: OPTIONAL
*/
void (*lport_set_port_id)(struct fc_lport *, u32 port_id,
struct fc_frame *);

/*
* Create a remote port with a given port ID
*
Expand Down

0 comments on commit 117eca5

Please sign in to comment.