From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A43C4BA09 for ; Wed, 26 Feb 2020 01:41:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B369A21927 for ; Wed, 26 Feb 2020 01:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582681296; bh=VTHpAmOwi6PxNdMCnznkox/kLCoNu1pxt3MJCNPFvEw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=0BEYfGuWVT7Z6pcnu/o6VtwntQtBS9k3LkQQY69v0Bp+4/b0Vbu7YHXulx76EWaMP OH7TMXIdq6vgNrEbGKRublMW5ohMBmkPjGqj3wt133ECchm8ODsGHaCqO5n0hELITb I6HD8Y6Kt0kDRzUcUFUP+oXbTK1InDtqf2gp7n0Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729566AbgBZBlg (ORCPT ); Tue, 25 Feb 2020 20:41:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:53862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729376AbgBZBlf (ORCPT ); Tue, 25 Feb 2020 20:41:35 -0500 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1827E2082F; Wed, 26 Feb 2020 01:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582681295; bh=VTHpAmOwi6PxNdMCnznkox/kLCoNu1pxt3MJCNPFvEw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rlf7gY9KHMzE2g0sCVJQv6LvcWifLhn3R7MA73/pKKAiEyYAW0Zbe4pkEWFqbjQp4 5Z0QJQjd/La/Exj+kJzad3LjRnBToNb25ZrAYpzwJxQF1UPxpFvVpYVFXMR08gNwr9 94y4n+cIe1IEwszZhfvK9GGlE6KzIgFIzBSBwFu8= Date: Tue, 25 Feb 2020 17:41:33 -0800 From: Jakub Kicinski To: Saeed Mahameed Cc: "David S. Miller" , netdev@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan Subject: Re: [net-next 03/16] net/mlx5e: Encapsulate updating netdev queues into a function Message-ID: <20200225174133.05c4a1d7@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20200226011246.70129-4-saeedm@mellanox.com> References: <20200226011246.70129-1-saeedm@mellanox.com> <20200226011246.70129-4-saeedm@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 25 Feb 2020 17:12:33 -0800 Saeed Mahameed wrote: > From: Maxim Mikityanskiy > > 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 > Reviewed-by: Tariq Toukan > Signed-off-by: Saeed Mahameed > --- > .../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);