[SCSI] fcoe, libfc: fix double fcoe_softc memory alloc
The foce_softc mem was reserved by libfc_host_alloc as well as by fcoe_host_alloc. Removes one liner fcoe_host_alloc completely, instead directly calls libfc_host_alloc to alloc scsi_host with libfc for just one fcoe_softc as fcoe private data. Moves libfc_host_alloc to libfc.h since it is a libfc API, placed lport_priv API adjacent to libfc_host_alloc since this is related to scsi_host priv data. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
parent
fdd78027fd
commit
a0a25da2a4
|
@ -70,8 +70,6 @@ static struct fc_lport *fcoe_hostlist_lookup(const struct net_device *);
|
||||||
static int fcoe_hostlist_add(const struct fc_lport *);
|
static int fcoe_hostlist_add(const struct fc_lport *);
|
||||||
static int fcoe_hostlist_remove(const struct fc_lport *);
|
static int fcoe_hostlist_remove(const struct fc_lport *);
|
||||||
|
|
||||||
static struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *, int);
|
|
||||||
|
|
||||||
static int fcoe_check_wait_queue(struct fc_lport *);
|
static int fcoe_check_wait_queue(struct fc_lport *);
|
||||||
static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *);
|
static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *);
|
||||||
static int fcoe_device_notification(struct notifier_block *, ulong, void *);
|
static int fcoe_device_notification(struct notifier_block *, ulong, void *);
|
||||||
|
@ -464,8 +462,8 @@ static int fcoe_if_create(struct net_device *netdev)
|
||||||
if (lp)
|
if (lp)
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
|
||||||
shost = fcoe_host_alloc(&fcoe_shost_template,
|
shost = libfc_host_alloc(&fcoe_shost_template,
|
||||||
sizeof(struct fcoe_softc));
|
sizeof(struct fcoe_softc));
|
||||||
if (!shost) {
|
if (!shost) {
|
||||||
FC_DBG("Could not allocate host structure\n");
|
FC_DBG("Could not allocate host structure\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -1715,33 +1713,6 @@ void fcoe_clean_pending_queue(struct fc_lport *lp)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue);
|
EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue);
|
||||||
|
|
||||||
/**
|
|
||||||
* libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport
|
|
||||||
* @sht: ptr to the scsi host templ
|
|
||||||
* @priv_size: size of private data after fc_lport
|
|
||||||
*
|
|
||||||
* Returns: ptr to Scsi_Host
|
|
||||||
* TODO: to libfc?
|
|
||||||
*/
|
|
||||||
static inline struct Scsi_Host *
|
|
||||||
libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
|
|
||||||
{
|
|
||||||
return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fcoe_host_alloc() - Allocate a Scsi_Host with room for the fcoe_softc
|
|
||||||
* @sht: ptr to the scsi host templ
|
|
||||||
* @priv_size: size of private data after fc_lport
|
|
||||||
*
|
|
||||||
* Returns: ptr to Scsi_Host
|
|
||||||
*/
|
|
||||||
struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *sht, int priv_size)
|
|
||||||
{
|
|
||||||
return libfc_host_alloc(sht, sizeof(struct fcoe_softc) + priv_size);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(fcoe_host_alloc);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fcoe_reset() - Resets the fcoe
|
* fcoe_reset() - Resets the fcoe
|
||||||
* @shost: shost the reset is from
|
* @shost: shost the reset is from
|
||||||
|
|
|
@ -696,11 +696,6 @@ struct fc_lport {
|
||||||
/*
|
/*
|
||||||
* FC_LPORT HELPER FUNCTIONS
|
* FC_LPORT HELPER FUNCTIONS
|
||||||
*****************************/
|
*****************************/
|
||||||
static inline void *lport_priv(const struct fc_lport *lp)
|
|
||||||
{
|
|
||||||
return (void *)(lp + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int fc_lport_test_ready(struct fc_lport *lp)
|
static inline int fc_lport_test_ready(struct fc_lport *lp)
|
||||||
{
|
{
|
||||||
return lp->state == LPORT_ST_READY;
|
return lp->state == LPORT_ST_READY;
|
||||||
|
@ -743,6 +738,23 @@ static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp)
|
||||||
return per_cpu_ptr(lp->dev_stats, smp_processor_id());
|
return per_cpu_ptr(lp->dev_stats, smp_processor_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void *lport_priv(const struct fc_lport *lp)
|
||||||
|
{
|
||||||
|
return (void *)(lp + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport
|
||||||
|
* @sht: ptr to the scsi host templ
|
||||||
|
* @priv_size: size of private data after fc_lport
|
||||||
|
*
|
||||||
|
* Returns: ptr to Scsi_Host
|
||||||
|
*/
|
||||||
|
static inline struct Scsi_Host *
|
||||||
|
libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
|
||||||
|
{
|
||||||
|
return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LOCAL PORT LAYER
|
* LOCAL PORT LAYER
|
||||||
|
|
Loading…
Reference in New Issue