Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3508962pxf; Mon, 15 Mar 2021 11:06:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzau7KCYa0R+LIBOVTIJVRxW+1D3yzpJo1xPekOe8VuSGxU6w1/So5BoyllpFJKusgX8Ydt X-Received: by 2002:a17:906:405b:: with SMTP id y27mr25670678ejj.332.1615831579900; Mon, 15 Mar 2021 11:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831579; cv=none; d=google.com; s=arc-20160816; b=TYESC3nKPNYvJsuT8ioq/0NlNhebTC4XMqD6WNhq2DXi+CLHLG+8eu4kKXL1vJyI7f 6PcW964+2o+d5v1SObgYLA6I76onGzEZdnsjcrwQUOv6PTpzuyUFRtmNWRPH9isHxTq4 yIq+GnORePTyy4NNT2ChjKVCIOgH5dqgPMGwtsTFbvVKBFx5qr8+hj460cZtKryh4iRL PVSUtx77MvRz6bnTU2fp3yyfWcPJbxJEiWcmuxVB/3HE2hWCVc8l+hpovN5jsIxyQKuw qAZMzcKH4Df6bVyFJ77/UuD3/oCPidSLWanivg2/V+xUM8rHJcSERaI9SDLnIrgdgpdV b26g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0AWoKti84v3iCQICQzYBEisnqu5yxNn7dth5/MF4fr0=; b=AvU60Jy/sq6NJlgecAYo8BGSWcWadkWQ0mldn2Idc2xd08/I9VRkmQ0YRDgHPjWVJi vnUlA/CTRmRZfS0OdZpjCADv+aUJlP/+c8CC4WW5lJoCyFmMg5qyWHQuVCI3a1s+AQCq wWS3w8Ql8F+F9fMb1ShMqZgufyJ5Uk0RNFnlvhPCbNAitmM8YRf4vrSrlZCXPc9TBtd0 OSsVDbTOu+ozATqHOIn58h74WzXcHcy6zR62itYYmWSM4dN5BF6EQmWwtGR4oIPhAYYF Nj4ehGjVao4oXW4YmEJR/N2iGU25lg0kEoyh4vXggDD4Qp1XhDgu4erVMJ1p3iBIZ+Eb psDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="A26U10+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b21si11126360eju.469.2021.03.15.11.05.40; Mon, 15 Mar 2021 11:06:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="A26U10+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235407AbhCOOHg (ORCPT + 99 others); Mon, 15 Mar 2021 10:07:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbhCON5y (ORCPT ); Mon, 15 Mar 2021 09:57:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F0B364F38; Mon, 15 Mar 2021 13:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816673; bh=hfBGN1Peg/rIQkG7ON/X7Zf0+SAOusI5JQZZixjpQRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A26U10+/4Xed5GhFs8g4rVFpd6FkKdUL0fbYVjuEytx+EEkd8uXMPMbHABfW3h6ma n3SH07PZYGMAdHSh/6wYWd8LwPJL3CtrG3boQEGTe07pvN9mmbo/I6fyY4RFMdhXmT SW85cPuObXuAG44PoyLNiTbVPn/OAr+mfMpy9RkA= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Kevin(Yudong) Yang" , Eric Dumazet , Neal Cardwell , Tariq Toukan , "David S. Miller" Subject: [PATCH 5.11 056/306] net/mlx4_en: update moderation when config reset Date: Mon, 15 Mar 2021 14:51:59 +0100 Message-Id: <20210315135509.544280532@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Kevin(Yudong) Yang commit 00ff801bb8ce6711e919af4530b6ffa14a22390a upstream. This patch fixes a bug that the moderation config will not be applied when calling mlx4_en_reset_config. For example, when turning on rx timestamping, mlx4_en_reset_config() will be called, causing the NIC to forget previous moderation config. This fix is in phase with a previous fix: commit 79c54b6bbf06 ("net/mlx4_en: Fix TX moderation info loss after set_ringparam is called") Tested: Before this patch, on a host with NIC using mlx4, run netserver and stream TCP to the host at full utilization. $ sar -I SUM 1 INTR intr/s 14:03:56 sum 48758.00 After rx hwtstamp is enabled: $ sar -I SUM 1 14:10:38 sum 317771.00 We see the moderation is not working properly and issued 7x more interrupts. After the patch, and turned on rx hwtstamp, the rate of interrupts is as expected: $ sar -I SUM 1 14:52:11 sum 49332.00 Fixes: 79c54b6bbf06 ("net/mlx4_en: Fix TX moderation info loss after set_ringparam is called") Signed-off-by: Kevin(Yudong) Yang Reviewed-by: Eric Dumazet Reviewed-by: Neal Cardwell CC: Tariq Toukan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 ++ drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c @@ -47,7 +47,7 @@ #define EN_ETHTOOL_SHORT_MASK cpu_to_be16(0xffff) #define EN_ETHTOOL_WORD_MASK cpu_to_be32(0xffffffff) -static int mlx4_en_moderation_update(struct mlx4_en_priv *priv) +int mlx4_en_moderation_update(struct mlx4_en_priv *priv) { int i, t; int err = 0; --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -3558,6 +3558,8 @@ int mlx4_en_reset_config(struct net_devi en_err(priv, "Failed starting port\n"); } + if (!err) + err = mlx4_en_moderation_update(priv); out: mutex_unlock(&mdev->state_lock); kfree(tmp); --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -775,6 +775,7 @@ void mlx4_en_ptp_overflow_check(struct m #define DEV_FEATURE_CHANGED(dev, new_features, feature) \ ((dev->features & feature) ^ (new_features & feature)) +int mlx4_en_moderation_update(struct mlx4_en_priv *priv); int mlx4_en_reset_config(struct net_device *dev, struct hwtstamp_config ts_config, netdev_features_t new_features);