Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3525176pxf; Mon, 15 Mar 2021 11:29:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhdwNciW9w6enOUVeMGk6hutcDAXdplJTrJ6qtLrD6GUsgK+AFKfQMPtiGDnbb1zS4NmYw X-Received: by 2002:a17:907:e8f:: with SMTP id ho15mr25902926ejc.541.1615832981747; Mon, 15 Mar 2021 11:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832981; cv=none; d=google.com; s=arc-20160816; b=G6ZTeD7z7YToY9C/3m7FRBvzRVZZO6Pfhlf+uzgDRMovHrOHqoCRWBCdQ6JY+RYe1i qr69dH4fKm7MWSKgg65eodqeGt+uMeKwMoa+s7NOb5dC0q+oIDn948og8+d6NuxRBBcc icHE8vQdzH5DIA6+Bf4BGUyHEXL7SEPyVgGbpJ7j8USw8UZQ+pp1BI/S+JqDBscyHuuN a4Lpy3ge24gRNrx06IOWv1FWLxr2mnU0+elm6b+6EIzUOgUOY/hO3o4RJB6yBVY0u/zd yPhC2aFKi4VVCImXkp4gLIWUZJzQLLOFZhbkJMyENN1Ptkqdlz0AvNkEuAID8shYV1hH e0Lw== 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=8OXdUa6mvvhB3DyFDknTBA7DazfZy5I9qSJeCCd8Ll4=; b=BIII3ZMoxn2twjGiyWmhWFy6+VnpPn1Z68hm9Xt1GOsObXlVPnrgIS/tRPQD3t9jPq ma+spRHsrJjvbFSdyeeB2856AgHth1Oieg4j1pG6OP9bRK62EnkVW+QN7m958sgcy0Fh UDVvjqbuQ4JLHwGckbIWu2OC0vAp2w+t+WoaeploGEt0vPcj5oBezgxkclMPA4M052K5 gpbhFr0NXHNuJl/3/esV2dXzhJ0yG9ahISOEKAWyRZfeGEBt4w70RfgKuZzaoW0vOYny qU0dEFYNqVBA7Ro4K376z8QSS0SZqjLze/SEHkrb3upQxWqXMt302XTk1ZIc46eCnE5O UFHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MkOYGfMs; 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 w25si11622190ejv.100.2021.03.15.11.29.13; Mon, 15 Mar 2021 11:29:41 -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=MkOYGfMs; 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 S235606AbhCOOaj (ORCPT + 99 others); Mon, 15 Mar 2021 10:30:39 -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 S231902AbhCON6m (ORCPT ); Mon, 15 Mar 2021 09:58:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7AC764F10; Mon, 15 Mar 2021 13:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816710; bh=/qmkf0PeBjIAF/IbdefhRGvkHUCPeSlu4laHEVa8GL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkOYGfMseqWPzv17M8UVDCAwnBpwKfJYxxcvLS5plfJXbcnliBNN0PNv40652QPZH nWfVvMrLyx9+6bcafRYk9fnzwcQf0zLTFtkRjEfSCIhWBvbiOJJmIVuOHMIhOPXYAI xoy+ltBWipDJh4dykskziSGOmeFz5f+CiThZa55w= 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 4.19 020/120] net/mlx4_en: update moderation when config reset Date: Mon, 15 Mar 2021 14:56:11 +0100 Message-Id: <20210315135720.668139346@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -3667,6 +3667,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 @@ -798,6 +798,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);