net/mlx4: Set number of RX rings in a utility function
mlx4_en_add() is too long. Moving set number of RX rings to a utiltity function to improve readability and modulization of the code. Signed-off-by: Ido Shamay <idos@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7a4ddcd92e
commit
0251248232
|
@ -274,19 +274,8 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
|
||||||
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
|
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
|
||||||
mlx4_en_init_timestamp(mdev);
|
mlx4_en_init_timestamp(mdev);
|
||||||
|
|
||||||
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) {
|
/* Set default number of RX rings*/
|
||||||
if (!dev->caps.comp_pool) {
|
mlx4_en_set_num_rx_rings(mdev);
|
||||||
mdev->profile.prof[i].rx_ring_num =
|
|
||||||
rounddown_pow_of_two(max_t(int, MIN_RX_RINGS,
|
|
||||||
min_t(int,
|
|
||||||
dev->caps.num_comp_vectors,
|
|
||||||
DEF_RX_RINGS)));
|
|
||||||
} else {
|
|
||||||
mdev->profile.prof[i].rx_ring_num = rounddown_pow_of_two(
|
|
||||||
min_t(int, dev->caps.comp_pool/
|
|
||||||
dev->caps.num_ports - 1 , MAX_MSIX_P_PORT - 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create our own workqueue for reset/multicast tasks
|
/* Create our own workqueue for reset/multicast tasks
|
||||||
* Note: we cannot use the shared workqueue because of deadlocks caused
|
* Note: we cannot use the shared workqueue because of deadlocks caused
|
||||||
|
|
|
@ -318,6 +318,28 @@ static void mlx4_en_free_rx_buf(struct mlx4_en_priv *priv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int num_of_eqs;
|
||||||
|
struct mlx4_dev *dev = mdev->dev;
|
||||||
|
|
||||||
|
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) {
|
||||||
|
if (!dev->caps.comp_pool)
|
||||||
|
num_of_eqs = max_t(int, MIN_RX_RINGS,
|
||||||
|
min_t(int,
|
||||||
|
dev->caps.num_comp_vectors,
|
||||||
|
DEF_RX_RINGS));
|
||||||
|
else
|
||||||
|
num_of_eqs = min_t(int, MAX_MSIX_P_PORT,
|
||||||
|
dev->caps.comp_pool/
|
||||||
|
dev->caps.num_ports) - 1;
|
||||||
|
|
||||||
|
mdev->profile.prof[i].rx_ring_num =
|
||||||
|
rounddown_pow_of_two(num_of_eqs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
|
int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
|
||||||
struct mlx4_en_rx_ring **pring,
|
struct mlx4_en_rx_ring **pring,
|
||||||
u32 size, u16 stride, int node)
|
u32 size, u16 stride, int node)
|
||||||
|
|
|
@ -737,7 +737,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
|
||||||
int cq, int user_prio);
|
int cq, int user_prio);
|
||||||
void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
|
void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
|
||||||
struct mlx4_en_tx_ring *ring);
|
struct mlx4_en_tx_ring *ring);
|
||||||
|
void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev);
|
||||||
int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
|
int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
|
||||||
struct mlx4_en_rx_ring **pring,
|
struct mlx4_en_rx_ring **pring,
|
||||||
u32 size, u16 stride, int node);
|
u32 size, u16 stride, int node);
|
||||||
|
|
Loading…
Reference in New Issue