lkml.org 
[lkml]   [2020]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.6 55/71] net/mlx5e: Encapsulate updating netdev queues into a function
    Date
    From: Maxim Mikityanskiy <maximmi@mellanox.com>

    [ Upstream commit c2c95271f9f39ea9b34db2301b3b6c5105cdb447 ]

    As a preparation for one of the following commits, create a function to
    encapsulate the code that notifies the kernel about the new amount of
    RX and TX queues. The code will be called multiple times in the next
    commit.

    Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
    Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    .../net/ethernet/mellanox/mlx5/core/en_main.c | 19 ++++++++++++-------
    1 file changed, 12 insertions(+), 7 deletions(-)

    diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
    index 4ef3dc79f73c7..8125c605780be 100644
    --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
    +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
    @@ -2886,6 +2886,17 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)
    netdev_set_tc_queue(netdev, tc, nch, 0);
    }

    +static void mlx5e_update_netdev_queues(struct mlx5e_priv *priv)
    +{
    + int num_txqs = priv->channels.num * priv->channels.params.num_tc;
    + int num_rxqs = priv->channels.num * priv->profile->rq_groups;
    + struct net_device *netdev = priv->netdev;
    +
    + mlx5e_netdev_set_tcs(netdev);
    + netif_set_real_num_tx_queues(netdev, num_txqs);
    + netif_set_real_num_rx_queues(netdev, num_rxqs);
    +}
    +
    static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)
    {
    int i, ch;
    @@ -2907,13 +2918,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)

    void mlx5e_activate_priv_channels(struct mlx5e_priv *priv)
    {
    - int num_txqs = priv->channels.num * priv->channels.params.num_tc;
    - int num_rxqs = priv->channels.num * priv->profile->rq_groups;
    - struct net_device *netdev = priv->netdev;
    -
    - mlx5e_netdev_set_tcs(netdev);
    - netif_set_real_num_tx_queues(netdev, num_txqs);
    - netif_set_real_num_rx_queues(netdev, num_rxqs);
    + mlx5e_update_netdev_queues(priv);

    mlx5e_build_txq_maps(priv);
    mlx5e_activate_channels(&priv->channels);
    --
    2.20.1


    \
     
     \ /
      Last update: 2020-04-20 14:47    [W:4.224 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site