On Tue, Mar 14, 2017 at 6:00 PM, Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx> wrote: > On Tue, Mar 14, 2017 at 04:42:55PM +0200, Erez Shitrit wrote: >> >> + 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. > > He means it should look like this: > > if (hca->alloc_rdma_netdev) > dev = hca->alloc_rdma_netdev(hca, port, RDMA_NETDEV_IPOIB, > name, NET_NAME_UNKNOWN, > ipoib_setup_common); > > if (IS_ERR(dev) && PTR_ERR(dev) != ENOTSUP) > goto out; > > dev = ipoib_create_netdev_default(hca, name, ipoib_setup_common); > if (IS_ERR(dev)) > goto out; > > WARN_ON(dev == NULL); > > [...] > > out: > return PTR_ERR(dev); OK, got it. will arrange the code accordingly. thank you both. > > And I'm confused why 'ipoib_create_netdev_default' doesn't need the > same function signature as hca->alloc_rdma_netdev I can pass both of them the same parameters, just to be consistent, (the default doesn't need the type RDMA_NETDEV_IPOIB and the port). > > Both drivers should implement hca->alloc_rdma_netdev to return ENOTSUP Both is for vnic and ipoib ? > if RDMA_NETDEV is not supported. > > Jason -- 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