On Tue, Mar 14, 2017 at 8:35 AM, Vishwanathapura, Niranjana <niranjana.vishwanathapura@xxxxxxxxx> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html