lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Feb 2020 17:41:33 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Saeed Mahameed <saeedm@...lanox.com>
Cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        Maxim Mikityanskiy <maximmi@...lanox.com>,
        Tariq Toukan <tariqt@...lanox.com>
Subject: Re: [net-next 03/16] net/mlx5e: Encapsulate updating netdev queues
 into a function

On Tue, 25 Feb 2020 17:12:33 -0800 Saeed Mahameed wrote:
> From: Maxim Mikityanskiy <maximmi@...lanox.com>
> 
> 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@...lanox.com>
> Reviewed-by: Tariq Toukan <tariqt@...lanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@...lanox.com>
> ---
>  .../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 a4d3e1b6ab20..85a86ff72aac 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -2869,6 +2869,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;
> @@ -2890,13 +2901,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);

Not sure where we stand on just moving bad code, but set_real_num_
_queues can fail, Dave just pointed this out to someone recently in
review.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ