Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3513566pxf; Mon, 15 Mar 2021 11:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1hJfXXuTs3fdPkY8F3yqvPI8k1LFCdtq1TVEHJ2T3tEFdTAXhQsB+qWS7kuWXwQRn+0Aj X-Received: by 2002:a17:907:7699:: with SMTP id jv25mr23712529ejc.363.1615831968032; Mon, 15 Mar 2021 11:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831968; cv=none; d=google.com; s=arc-20160816; b=w+TjKeozhJ3wUSk18+mSE9nuEO5EgmXXG6Lf7C+YoiUHjA6VX5OjxQOaUuh5Evsz02 ddIXZfJu423DObaBo+jKbQfasWCDYt5njoPRVNMc37oJC1yRKmbBK4dAD+eMbObu5WKQ UYETtWCoQgG/DQGDbHpsnfem5EQKdSJoGMfeqsgbw5jiTX0v10AvKSFcJtaK3N72rguY YDeZb9FwTdi/ByexfjBp4YQEpgbQLHRdodYlTih1PrHOU+cxv1IcVLXFdoTHRlPoBLSb im6Ciaj5OE4/4OBQWQjrhnUhkKiHbDJhsBR9uYpHVk7VCLWTIe43hYRXgtpFf11arlKH AwPw== 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=r6la84qMDuys9aaIwt/Vvtk1sWvShgNjdbcUFtG1PS0=; b=CLSwBpB57DV2L0BSqBLE5/fRbtRAd2IGlrHJYqpDlOcpdh+uVcUmYhtKIR4gvdGiGc m76iOfNGN2bFcFHA7ho298GxajcxZ+dAnAQD4kUfjL6oRNg+c9kSPjCBrst1txitPcoN XDWmWGXeEJFc9aGKg4oB5ZRLjCUprCzd2sIkywiLCanO9i8i63gaonF0Swir2SCorteb hbN+LdaWl4jBZgQgtlZ99O2tK151NpaPXr2Qckm4nq1LjdLFkb/Qg4dGLbaSCe/LIYVg 1pkOwhdBD2BCZ3j1JgneufklCAU1ve/+zi8173H7QE5Unw97wF7Zw1HKPBWAAYqdyKBe AiAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JZ7WfhIU; 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 a20si12114356eda.157.2021.03.15.11.12.25; Mon, 15 Mar 2021 11:12:48 -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=JZ7WfhIU; 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 S235753AbhCOOLO (ORCPT + 99 others); Mon, 15 Mar 2021 10:11:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:35420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbhCON5u (ORCPT ); Mon, 15 Mar 2021 09:57:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3F83764F09; Mon, 15 Mar 2021 13:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816669; bh=fjUUu17dwnZ0NHecHECeOCQ3UxojkbVmQ0VRqEx5UfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZ7WfhIUgIxdhba6/D+4WEZoxztAUXlxyKACt98/ZxP8404B/XVPHe1vruRQKtBTk eJ9bXkHGhboRCJmTizFrl5lfuIieqBVCerjbu7USTpY6allaTYR/oUBuTSF7QRaU8N wMqszojEDPZU6j7fH3YG0A/iVE5ogHSvAbeqIH9w= 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.10 045/290] net/mlx4_en: update moderation when config reset Date: Mon, 15 Mar 2021 14:52:18 +0100 Message-Id: <20210315135543.447181545@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 @@ -3559,6 +3559,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 @@ -795,6 +795,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);