break;
}
dp->lp = lport;
- dp->ids.port_id = ntoh24(pp->rscn_fid);
- dp->ids.port_name = -1;
- dp->ids.node_name = -1;
- dp->ids.roles = FC_RPORT_ROLE_UNKNOWN;
+ dp->port_id = ntoh24(pp->rscn_fid);
list_add_tail(&dp->peers, &disc_ports);
break;
case ELS_ADDR_FMT_AREA:
redisc, lport->state, disc->pending);
list_for_each_entry_safe(dp, next, &disc_ports, peers) {
list_del(&dp->peers);
- rdata = lport->tt.rport_lookup(lport, dp->ids.port_id);
+ rdata = lport->tt.rport_lookup(lport, dp->port_id);
if (rdata) {
lport->tt.rport_logoff(rdata);
}
while (plen >= sizeof(*np)) {
ids.port_id = ntoh24(np->fp_fid);
ids.port_name = ntohll(np->fp_wwpn);
- ids.node_name = -1;
- ids.roles = FC_RPORT_ROLE_UNKNOWN;
if (ids.port_id != fc_host_port_id(lport->host) &&
ids.port_name != lport->wwpn) {
- rdata = lport->tt.rport_create(lport, &ids);
- if (rdata)
+ rdata = lport->tt.rport_create(lport, ids.port_id);
+ if (rdata) {
+ rdata->ids.port_name = ids.port_name;
rdata->disc_id = disc->disc_id;
- else {
+ } else {
printk(KERN_WARNING "libfc: Failed to allocate "
"memory for the newly discovered port "
"(%6x)\n", ids.port_id);
lport = disc->lport;
- if (dp->ids.port_id == fc_host_port_id(lport->host))
+ if (dp->port_id == fc_host_port_id(lport->host))
goto out;
- rdata = lport->tt.rport_create(lport, &dp->ids);
+ rdata = lport->tt.rport_create(lport, dp->port_id);
if (rdata) {
rdata->disc_id = disc->disc_id;
kfree(dp);
u32 remote_fid, u64 remote_wwpn,
u64 remote_wwnn)
{
- struct fc_rport_identifiers ids;
-
- ids.port_id = remote_fid;
- ids.port_name = remote_wwpn;
- ids.node_name = remote_wwnn;
- ids.roles = FC_RPORT_ROLE_UNKNOWN;
-
mutex_lock(&lport->disc.disc_mutex);
if (lport->ptp_rp)
lport->tt.rport_logoff(lport->ptp_rp);
- lport->ptp_rp = lport->tt.rport_create(lport, &ids);
+ lport->ptp_rp = lport->tt.rport_create(lport, remote_fid);
+ lport->ptp_rp->ids.port_name = remote_wwpn;
+ lport->ptp_rp->ids.node_name = remote_wwnn;
mutex_unlock(&lport->disc.disc_mutex);
lport->tt.rport_login(lport->ptp_rp);
static void fc_lport_enter_dns(struct fc_lport *lport)
{
struct fc_rport_priv *rdata;
- struct fc_rport_identifiers ids;
-
- ids.port_id = FC_FID_DIR_SERV;
- ids.port_name = -1;
- ids.node_name = -1;
- ids.roles = FC_RPORT_ROLE_UNKNOWN;
FC_LPORT_DBG(lport, "Entered DNS state from %s state\n",
fc_lport_state(lport));
fc_lport_state_enter(lport, LPORT_ST_DNS);
mutex_lock(&lport->disc.disc_mutex);
- rdata = lport->tt.rport_create(lport, &ids);
+ rdata = lport->tt.rport_create(lport, FC_FID_DIR_SERV);
mutex_unlock(&lport->disc.disc_mutex);
if (!rdata)
goto err;
}
/**
- * fc_rport_create() - create remote port in INIT state.
- * @lport: local port.
- * @ids: remote port identifiers.
+ * fc_rport_create() - Create a new remote port
+ * @lport: The local port that the new remote port is for
+ * @port_id: The port ID for the new remote port
*
* Locking note: must be called with the disc_mutex held.
*/
static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
- struct fc_rport_identifiers *ids)
+ u32 port_id)
{
struct fc_rport_priv *rdata;
- rdata = lport->tt.rport_lookup(lport, ids->port_id);
+ rdata = lport->tt.rport_lookup(lport, port_id);
if (rdata)
return rdata;
if (!rdata)
return NULL;
- rdata->ids = *ids;
+ rdata->ids.node_name = -1;
+ rdata->ids.port_name = -1;
+ rdata->ids.port_id = port_id;
+ rdata->ids.roles = FC_RPORT_ROLE_UNKNOWN;
+
kref_init(&rdata->kref);
mutex_init(&rdata->rp_mutex);
rdata->local_port = lport;
rdata->maxframe_size = FC_MIN_MAX_PAYLOAD;
INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout);
INIT_WORK(&rdata->event_work, fc_rport_work);
- if (ids->port_id != FC_FID_DIR_SERV)
+ if (port_id != FC_FID_DIR_SERV)
list_add(&rdata->peers, &lport->disc.rports);
return rdata;
}
/**
* struct fc_disc_port - temporary discovery port to hold rport identifiers
- * @lp: Fibre Channel host port instance
- * @peers: node for list management during discovery and RSCN processing
- * @ids: identifiers structure to pass to fc_remote_port_add()
- * @rport_work: work struct for starting the rport state machine
+ * @lp: Fibre Channel host port instance
+ * @peers: Node for list management during discovery and RSCN processing
+ * @rport_work: Work struct for starting the rport state machine
+ * @port_id: Port ID of the discovered port
*/
struct fc_disc_port {
struct fc_lport *lp;
struct list_head peers;
- struct fc_rport_identifiers ids;
struct work_struct rport_work;
+ u32 port_id;
};
enum fc_rport_event {
int (*lport_reset)(struct fc_lport *);
/*
- * Create a remote port
+ * Create a remote port with a given port ID
+ *
+ * STATUS: OPTIONAL
*/
- struct fc_rport_priv *(*rport_create)(struct fc_lport *,
- struct fc_rport_identifiers *);
+ struct fc_rport_priv *(*rport_create)(struct fc_lport *, u32);
/*
* Initiates the RP state machine. It is called from the LP module.