RDMA/netdev: Hoist alloc_netdev_mqs out of the driver
netdev has several interfaces that expect to call alloc_netdev_mqs from
the core code, with the driver only providing the arguments. This is
incompatible with the rdma_netdev interface that returns the netdev
directly.
Thus re-organize the API used by ipoib so that the verbs core code calls
alloc_netdev_mqs for the driver. This is done by allowing the drivers to
provide the allocation parameters via a 'get_params' callback and then
initializing an allocated netdev as a second step.
Fixes: cd565b4b51
("IB/IPoIB: Support acceleration options callbacks")
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Denis Drozdov <denisd@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:

committed by
Saeed Mahameed

parent
a6deaa9959
commit
f6a8a19bb1
@@ -2223,6 +2223,16 @@ struct rdma_netdev {
|
||||
union ib_gid *gid, u16 mlid);
|
||||
};
|
||||
|
||||
struct rdma_netdev_alloc_params {
|
||||
size_t sizeof_priv;
|
||||
unsigned int txqs;
|
||||
unsigned int rxqs;
|
||||
void *param;
|
||||
|
||||
int (*initialize_rdma_netdev)(struct ib_device *device, u8 port_num,
|
||||
struct net_device *netdev, void *param);
|
||||
};
|
||||
|
||||
struct ib_port_pkey_list {
|
||||
/* Lock to hold while modifying the list. */
|
||||
spinlock_t list_lock;
|
||||
@@ -2523,8 +2533,8 @@ struct ib_device {
|
||||
/**
|
||||
* rdma netdev operation
|
||||
*
|
||||
* Driver implementing alloc_rdma_netdev must return -EOPNOTSUPP if it
|
||||
* doesn't support the specified rdma netdev type.
|
||||
* Driver implementing alloc_rdma_netdev or rdma_netdev_get_params
|
||||
* must return -EOPNOTSUPP if it doesn't support the specified type.
|
||||
*/
|
||||
struct net_device *(*alloc_rdma_netdev)(
|
||||
struct ib_device *device,
|
||||
@@ -2534,6 +2544,10 @@ struct ib_device {
|
||||
unsigned char name_assign_type,
|
||||
void (*setup)(struct net_device *));
|
||||
|
||||
int (*rdma_netdev_get_params)(struct ib_device *device, u8 port_num,
|
||||
enum rdma_netdev_t type,
|
||||
struct rdma_netdev_alloc_params *params);
|
||||
|
||||
struct module *owner;
|
||||
struct device dev;
|
||||
struct kobject *ports_parent;
|
||||
@@ -4179,4 +4193,9 @@ struct ib_ucontext *ib_uverbs_get_ucontext(struct ib_uverbs_file *ufile);
|
||||
|
||||
int uverbs_destroy_def_handler(struct ib_uverbs_file *file,
|
||||
struct uverbs_attr_bundle *attrs);
|
||||
|
||||
struct net_device *rdma_alloc_netdev(struct ib_device *device, u8 port_num,
|
||||
enum rdma_netdev_t type, const char *name,
|
||||
unsigned char name_assign_type,
|
||||
void (*setup)(struct net_device *));
|
||||
#endif /* IB_VERBS_H */
|
||||
|
Reference in New Issue
Block a user