mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 12:10:38 -04:00
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
@@ -1228,21 +1228,15 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
|
||||
struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev);
|
||||
void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up);
|
||||
|
||||
#ifndef CONFIG_MLX5_CORE_IPOIB
|
||||
static inline
|
||||
struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
|
||||
struct ib_device *ibdev,
|
||||
const char *name,
|
||||
void (*setup)(struct net_device *))
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_MLX5_CORE_IPOIB
|
||||
struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
|
||||
struct ib_device *ibdev,
|
||||
const char *name,
|
||||
void (*setup)(struct net_device *));
|
||||
#endif /* CONFIG_MLX5_CORE_IPOIB */
|
||||
int mlx5_rdma_rn_get_params(struct mlx5_core_dev *mdev,
|
||||
struct ib_device *device,
|
||||
struct rdma_netdev_alloc_params *params);
|
||||
|
||||
struct mlx5_profile {
|
||||
u64 mask;
|
||||
|
||||
@@ -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