Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp49298imu; Thu, 8 Nov 2018 14:33:54 -0800 (PST) X-Google-Smtp-Source: AJdET5eZqNkC0tzKPhu9FkygiudXdmOpYBkzkp5itpZc1Q9HAv0TSXHgsF5zdG5LFl3ZsYGC6kkr X-Received: by 2002:a63:101:: with SMTP id 1mr1477331pgb.152.1541716434071; Thu, 08 Nov 2018 14:33:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716434; cv=none; d=google.com; s=arc-20160816; b=g50ldp9W/EJcX6QB8rsLNZ8yVkyeFurIDMWkRbDErYBy7wwZHAwH9GWIs6MLRGH0w0 5taHtq9s84nNaA5AQ04rlhqnQLhK0e4sQeUFdtkinjW5pSet2RtXulIfqNDe6j1ZGuol vUHXMSxyt6AG7LXJj1RnBUOQCubkUr/UOGxMpV4LU1FMvKcOagXZZjbetS1WEsQESnMS I4g8lFztoPWBkNoPiDSCX1IlJHuHSNcp90aD+HlFnZbtEBwQ1CLK6JnJFVEafunBaBjA uL7U2dTd8I05ViikA2gdEnjRdmICGjj6Wu+FdLLguYVAt/qy62rCld7CY4L66/3YTqTr nqcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H8E3ARmGJeFZrY+AC+6wiuq1y2aelSDU+h6WQT4CpP8=; b=JPPfvlTjrWdtdoK1luqVue0g71FvaP1Lpoa5eTNuHyiRtpmldflAkFnIF7PwfTaGvg hOnv+fceMWhzkjgTqC08VQlonIaihsyBVfVZpH1W3+vgl8YjmgiEMz34MwH/nDP5aTNr K/fBrKBJw0OJaXlYUjoF0u/pShklmOlKpPG58Qn0RQ4jk3kROmiHkSKNJtS+PYCgeZmI KRYsLr0Q6eNLF9ywbWJ/lKlvA5eaJlEBcgpNrfATT3+cnJ9apn3zzBGLhf/htbQPxUZM YTRhcnhF8QMIJP78IC95MdafYYVo1LqVV3zs9WX47iSIdaLj6eN0z+rrgXyThr7pRNYR ElPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NjlRkwW9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14si5278026pgg.433.2018.11.08.14.33.38; Thu, 08 Nov 2018 14:33:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NjlRkwW9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730261AbeKIHh0 (ORCPT + 99 others); Fri, 9 Nov 2018 02:37:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:55618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728100AbeKIHh0 (ORCPT ); Fri, 9 Nov 2018 02:37:26 -0500 Received: from localhost (unknown [208.72.13.198]) (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 64B0D20818; Thu, 8 Nov 2018 21:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714397; bh=z+/JXib04T35HdBiAyAV3iElW6udOtIkqyKjaSWVF/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NjlRkwW9jA03wxiWo04HgbLr5NDsN+HvObUCRkoz5+rqSbnlYD/M0+nLqX8pJBmBW zI/yGRmuahCJwfqrI45m9kAZEcu8RXClfMybki+aODv5+sKek4cN6AF71lguRFrlbc m4zOotGmYIIgAXhcM5t+wsFZyUXYbmiedI7IZPS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tariq Toukan , Saeed Mahameed , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 056/114] net/mlx5e: Correctly handle RSS indirection table when changing number of channels Date: Thu, 8 Nov 2018 13:51:11 -0800 Message-Id: <20181108215106.188206690@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 85082dba0a5059c538cfa786d07f5ec5370d22fe ] Upon changing num_channels, reset the RSS indirection table to match the new value. Fixes: 2d75b2bc8a8c ('net/mlx5e: Add ethtool RSS configuration options') Signed-off-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 ++ .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 15 +++++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 22e72bf1ae48..7a716733d9ca 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -586,6 +586,8 @@ int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix); int mlx5e_open_locked(struct net_device *netdev); int mlx5e_close_locked(struct net_device *netdev); +void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len, + int num_channels); static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, struct mlx5e_tx_wqe *wqe, int bf_sz) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 7cc9df717323..7ee301310817 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -385,6 +385,8 @@ static int mlx5e_set_channels(struct net_device *dev, mlx5e_close_locked(dev); priv->params.num_channels = count; + mlx5e_build_default_indir_rqt(priv->params.indirection_rqt, + MLX5E_INDIR_RQT_SIZE, count); if (was_opened) err = mlx5e_open_locked(dev); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 765b069d6a90..26d25ecdca7e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -1186,7 +1186,6 @@ static void mlx5e_fill_indir_rqt_rqns(struct mlx5e_priv *priv, void *rqtc) ix = mlx5e_bits_invert(i, MLX5E_LOG_INDIR_RQT_SIZE); ix = priv->params.indirection_rqt[ix]; - ix = ix % priv->params.num_channels; MLX5_SET(rqtc, rqtc, rq_num[i], test_bit(MLX5E_STATE_OPENED, &priv->state) ? priv->channel[ix]->rq.rqn : @@ -1983,12 +1982,20 @@ u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev) 2 /*sizeof(mlx5e_tx_wqe.inline_hdr_start)*/; } +void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len, + int num_channels) +{ + int i; + + for (i = 0; i < len; i++) + indirection_rqt[i] = i % num_channels; +} + static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev, struct net_device *netdev, int num_channels) { struct mlx5e_priv *priv = netdev_priv(netdev); - int i; priv->params.log_sq_size = MLX5E_PARAMS_DEFAULT_LOG_SQ_SIZE; @@ -2012,8 +2019,8 @@ static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev, netdev_rss_key_fill(priv->params.toeplitz_hash_key, sizeof(priv->params.toeplitz_hash_key)); - for (i = 0; i < MLX5E_INDIR_RQT_SIZE; i++) - priv->params.indirection_rqt[i] = i % num_channels; + mlx5e_build_default_indir_rqt(priv->params.indirection_rqt, + MLX5E_INDIR_RQT_SIZE, num_channels); priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ; -- 2.17.1