Re: [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library

Bhanu Prakash Gollapudi
2011-09-08T14:41:55Z

On 9/8/2011 4:11 AM, Mike Christie wrote:
> On 08/04/2011 07:38 PM, Bhanu Prakash Gollapudi wrote:
>> /**
>> - * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
>> - * @netdev: the associated net device
>> - * @wwn: the output WWN
>> - * @type: the type of WWN (WWPN or WWNN)
>> - *
>> - * Returns: 0 for success
>> - */
>> -static int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
>> -{
>> - const struct net_device_ops *ops = netdev->netdev_ops;
>> -
>> - if (ops->ndo_fcoe_get_wwn)
>> - return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
>> - return -EINVAL;
>> -}
>> -
>> -/**
>
>
>
>> +/**
>> + * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
>> + * @netdev: the associated net device
>> + * @wwn: the output WWN
>> + * @type: the type of WWN (WWPN or WWNN)
>> + *
>> + * Returns: 0 for success
>> + */
>> +int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
>> +{
>> + const struct net_device_ops *ops = netdev->netdev_ops;
>> +
>> + if (ops->ndo_fcoe_get_wwn)
>> + return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
>> + return -EINVAL;
>> +}
>> +EXPORT_SYMBOL_GPL(fcoe_get_wwn);
>> +
>>
>
> I got a report that this is going to be a problem because the fcoe ops
> like ndo_fcoe_get_wwn are defined when CONFIG_FCOE is set. That is set
> for fcoe.ko. If you move functions calling those callouts to libfcoe
> then it is possible CONFIG_FCOE is not set (if you were just using
> bnx2fc.ko and not using fcoe.ko for example), and the build fails like this:
>
>
> drivers/scsi/fcoe/fcoe_transport.c: In function ‘fcoe_get_wwn’:
> drivers/scsi/fcoe/fcoe_transport.c:152: error: ‘const struct
> net_device_ops’ has no member named ‘ndo_fcoe_get_wwn’
> drivers/scsi/fcoe/fcoe_transport.c:153: error: ‘const struct
> net_device_ops’ has no member named ‘ndo_fcoe_get_wwn’
> make[3]: *** [drivers/scsi/fcoe/fcoe_transport.o] Error 1
>
>
> Do we need some ifdefs in libfcoe around the ops use or should there be
> some sort of lower level transport module callouts (or whatever modules
> like bnxfc and fcoe are called) that libfcoe calls into so those drivers
> can call into something like the netdev callouts if they use them?
>
Mike, This change has already been submitted and applied to net-next
tree, as the change is in netdevice.h. The flags and ndo_fcoe_get_wwn
are now moved under CONFIG_LIBFCOE.

http://patchwork.ozlabs.org/patch/111838/

Thanks,
Bhanu

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html