[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAk-MO8gQ5x-4Ubk1nzPntEWa2ivTK6uXyJ4eC7fmtUCNnOdfA@mail.gmail.com>
Date: Tue, 14 Mar 2017 16:42:55 +0200
From: Erez Shitrit <erezsh@....mellanox.co.il>
To: "Vishwanathapura, Niranjana" <niranjana.vishwanathapura@...el.com>
Cc: Erez Shitrit <erezsh@...lanox.com>,
Doug Ledford <dledford@...hat.com>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
netdev@...r.kernel.org, valex@...lanox.com,
Leon Romanovsky <leonro@...lanox.com>, saedm@...lanox.com
Subject: Re: [RFC v1 for accelerated IPoIB 05/25] IB/ipoib: Support ipoib
acceleration options callbacks
On Tue, Mar 14, 2017 at 8:35 AM, Vishwanathapura, Niranjana
<niranjana.vishwanathapura@...el.com> wrote:
> On Mon, Mar 13, 2017 at 08:31:16PM +0200, Erez Shitrit wrote:
>>
>> +static struct net_device *ipoib_create_netdev_default(struct ib_device
>> *hca,
>> + const char *name,
>> + void (*setup)(struct
>> net_device *))
>> {
>> struct net_device *dev;
>> + struct rdma_netdev *rn;
>>
>> - dev = alloc_netdev((int)sizeof(struct ipoib_dev_priv), name,
>> - NET_NAME_UNKNOWN, ipoib_setup);
>> + dev = alloc_netdev((int)sizeof(struct ipoib_rdma_netdev),
>> + name,
>> + NET_NAME_UNKNOWN, setup);
>> if (!dev)
>> return NULL;
>>
>> - return netdev_priv(dev);
>> + rn = netdev_priv(dev);
>> +
>> + rn->ib_dev_init = ipoib_dev_init_default;
>> + rn->ib_dev_cleanup = ipoib_dev_uninit_default;
>> + rn->send = ipoib_send;
>> + rn->attach_mcast = ipoib_mcast_attach;
>> + rn->detach_mcast = ipoib_mcast_detach;
>> +
>> + dev->netdev_ops = &ipoib_netdev_default_pf;
>> +
>
>
> Probably no need to set netdev_ops here as it gets overwritten.
No, it is switched, and used.
>
>
>> + return dev;
>> +}
>> +
>> +struct ipoib_dev_priv *ipoib_intf_alloc(struct ib_device *hca, u8 port,
>> + const char *name)
>> +{
>> + struct net_device *dev;
>> + struct ipoib_dev_priv *priv;
>> + struct rdma_netdev *rn;
>> +
>> + priv = kzalloc(sizeof(*priv), GFP_KERNEL);
>> + if (!priv) {
>> + pr_err("%s failed allocting priv\n", __func__);
>> + return NULL;
>> + }
>> +
>> + if (!hca->alloc_rdma_netdev)
>> + dev = ipoib_create_netdev_default(hca, name,
>> ipoib_setup_common);
>> + else
>> + dev = hca->alloc_rdma_netdev(hca, port, RDMA_NETDEV_IPOIB,
>> + name, NET_NAME_UNKNOWN,
>> + ipoib_setup_common);
>> + if (!dev) {
>> + kfree(priv);
>> + return NULL;
>> + }
>
>
> This will break ipoib on hfi1 as hfi1 will define alloc_rdma_netdev for
> OPA_VNIC type. We should probably look for a dedicated return type
> (-ENODEV?) to determine of the driver supports specified rdma netdev type.
> Or use a ib device attribute to suggest driver support ipoib rdma netdev.
sorry, I don't understand that, we are in ipoib driver, so the type is
RDMA_NETDEV_IPOIB, if hfi wants to implement it should use the same
flag, and to use OPA_VNIC for vnic.
>
> Niranjana
Powered by blists - more mailing lists