Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3322383pxf; Mon, 15 Mar 2021 07:07:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkrmpC4LSWVl3FR1exuqfRnCTlwOcHM8xudidsNJjWuBdsqArNeN316Z9eVEof/XV6XvH4 X-Received: by 2002:aa7:c7d5:: with SMTP id o21mr29369143eds.166.1615817245196; Mon, 15 Mar 2021 07:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817245; cv=none; d=google.com; s=arc-20160816; b=f+YDFvEe0miCC+ThLhbSWV5IamwxTji5Cdm1loRh6+hg+/lU7eCyww8MkxGdKWc7wC Np5221aQyrDUY5AX6rFrSY72a2WHRNJnWAI2gvB0Y8r4jOAq68fHtgzQ7shL0B5V40oF NG3QfR29G54XkSKN9/p4NTLUqrwP9+6LKiYGSQ3EU1To6YdvjSGhmYwivVgbEOW8Pwv8 VpPwcqK8obiVGObUYcQTq4Vvd7e1YOWAG9u/RoyuvSSQOvsQxY8ry7jXyVQx9dyeWrlu eke4DGfypPYYXZmvIbk/Kcto1EuFUMTdapP2lpFXV08UrTlhDGx6EMpIE38s8KeKVYsS NMoA== 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=V7tWp7cq2UB9r/MDd+AA5Zdnd+NNaBuX2B5Pn1QAvyw=; b=Uee75g7iMJOSUtpZhvacyjQXk2qNlIkVRobeXMTw8afCe+auB+OLXnOebuRctacHzK f/AvR8Sk6cBpFKVlsMvOpiIQ3UCe7Za/F4lVIxpVdGHi7hgRIMtAqKEkfiMzMjwnr+PQ PUX0LyuOg3JD0WuxvRpvkiyTddIkiM3E5mU4XMSyoMqrunjeLsSnfEsQ4GO6QkqtMKHd j3clTHemkQGtGL9axGx9D1l8ekyipOQm3ssZI6Fk+1NGrirlXmpd5AlcM3jv11d2CnY/ aCqCAVEQIZJ/IJdmgYM2/hRe8hic8uQm1FkZoY15Nv970JwEw1dolREI6qBmSDG7r/tm zM3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2a5bEqaR; 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 b17si11318893eds.443.2021.03.15.07.07.00; Mon, 15 Mar 2021 07:07:25 -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=2a5bEqaR; 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 S234843AbhCOOFu (ORCPT + 99 others); Mon, 15 Mar 2021 10:05:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:35138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232018AbhCON5f (ORCPT ); Mon, 15 Mar 2021 09:57:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE06E64F01; Mon, 15 Mar 2021 13:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816653; bh=DkKTATIJMYXCxOj1FLhWxOkTZO/RMTaYmH97YU6QZa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2a5bEqaRI1LPYuVSFH4mTMmD2H4CJ7wmDYDogMlC3NfGshlXDdjsRL+qO7OMFLNRv Nd2YSFIfIPOC1tG5zNLuFpFa5j/Q87HM3ixIjwl60Q+n208B4bZeHZqEuZFf9lwjZn 1BMimhMqljC0n7Xrb6bqAeJZcZGJoV3auPEm/hhw= 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.4 027/168] net/mlx4_en: update moderation when config reset Date: Mon, 15 Mar 2021 14:54:19 +0100 Message-Id: <20210315135551.243302525@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 @@ -3657,6 +3657,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 @@ -797,6 +797,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);