Robert Love wrote:
> This patch does three things:
>
> 1) Creates dummy fc_rport and fc_rport_libfc_priv objects
> to use durring gpn_id and gnn_id instead of fc_ns_port
> objects. This will be used in a later patch that will
> move gpn_id and gnn_id into the RP state machine. The
> RP state machine passes around fc_rport's not
> fc_ns_port's.
>
> 2) Uses stack memory to allocate the temporary fc_ns_port
> for each discovered port. There's no need to dynamically
> allocate memory if it's just going to be freed in the
> same block.
>
> Signed-off-by: Robert Love <[EMAIL PROTECTED]>
> ---
> @@ -71,6 +59,32 @@ static void fc_ns_retry(struct fc_lport *lp);
> static void fc_ns_single(struct fc_lport *, struct fc_ns_port *);
> static int fc_ns_restart(struct fc_lport *);
>
> +struct fc_rport *fc_ns_create_dummy_rport(struct fc_ns_port *dp)
> +{
> + struct fc_rport *rp;
> + struct fc_rport_libfc_priv *rpp;
> + rp = kzalloc(sizeof(*rp) + sizeof(*rpp), GFP_KERNEL);
Should check for NULL here.
> + rpp = ((void *)rp + sizeof(struct fc_rport));
> +
> + rp->dd_data = rpp;
> + rp->port_id = dp->ids.port_id;
> + rp->port_name = dp->ids.port_name;
> + rp->node_name = dp->ids.node_name;
> + rp->roles = dp->ids.roles;
> +
> + spin_lock_init(&rpp->rp_lock);
> + rpp->local_port = dp->lp;
> + rpp->rp_state = RPORT_ST_INIT;
> + rpp->flags = FC_RP_FLAGS_REC_SUPPORTED;
> + INIT_DELAYED_WORK(&rpp->retry_work, fc_ns_timeout);
> +
> + return rp;
> +}
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel