Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3129092ybi; Thu, 18 Jul 2019 21:35:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpHLVzVU9hlnWp3IyC3XvQANGGjS0llew6KXyNJ8cOrz4UOgIbjYM0/jeJTkoVMEj9U59G X-Received: by 2002:a63:e213:: with SMTP id q19mr51114790pgh.180.1563510949896; Thu, 18 Jul 2019 21:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563510949; cv=none; d=google.com; s=arc-20160816; b=qpKJNOS9myCYPACm6Wu4bzTGoGtgHCG+2kPofqViDvAj1xXo/3Hlmp305WP6PIbhYR ESD/Xwyi+Ugj6QchdasKaGsPHIfi7WKuE1IgZYm7nwo81yD+hwKrHhT6pN8WYaRoXCyO 8u1HMVj3gi2sntSKB73eTpDkVSa0O2V4lZF2VndD6wOx38VR7rpvE4VcNFaDmHZ2tPi4 Gao42y8ZCMSP7ZAUowyBE9KJcPxyXFXh43uhGI0Uk6XRcYTdXQEo2OZRKNnmtIrEU0UK 7BFU6uUUBDy4zYtyPjMdnLUm1oJz5y41bqruOLUVr6FS6kjc6+JM6J8isnuysMeVyo4S BJTg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VdFOKSDtypAZ63r5ovHiVDSp7hC5MgjU2J5ab0K0NjM=; b=s8YuwyYf+KcIM80fssv7XSM467UKoax4kGcrvhuFDQpMz387o0eHFtdJBls4HUbs8G Anuiao6evAwFXQhxcT+T8G79dmdb0W09sw1GA7B3+opeWnEFDXbzKroRYknP7Cl5fhiR etcrtYDRd6nzWeue3x6DET8GrYqewu8fQrT7utHfaesBPSFn8Nc1iJbE6zrzJyq2AJig WO0nRCbWblOQDK4jwQzxtEOrpbkEFeO8/I6mXa6AZQgBtl20x0zghZoQETIlxOg/oknV GDwtqaI0UfZxWAnGFzKeNdvOFkSZRUJ0TZWMQChyv6XwALDK4GW82maiVobIfsDI7RpX xtvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fzWYcQuM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a190si34164pfb.127.2019.07.18.21.35.34; Thu, 18 Jul 2019 21:35:49 -0700 (PDT) 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=fzWYcQuM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732508AbfGSEec (ORCPT + 99 others); Fri, 19 Jul 2019 00:34:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:33684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729693AbfGSEBx (ORCPT ); Fri, 19 Jul 2019 00:01:53 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D5A321851; Fri, 19 Jul 2019 04:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508912; bh=+hCM6REWCGyOM6ATFUsntBdajWBPV6AdXDvS2mwE8Qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fzWYcQuMN9EAw0u2vd5/2Q+4CK1ltGJPIP/ygvB+bUP4cS38CHYs0xHZa3UzNPY5O GSqqkvR9NRCzYGPKYvqmFrMz4OzZD1/zF0YCUOlENOw8xzOBLY51cDvPPQpYk6/tYH A/nO+OMQjzuiiUYOXPD9q+zxuJzw6NmeliD7AY0k= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Maor Gottlieb , Roi Dayan , Saeed Mahameed , Sasha Levin , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 155/171] net/mlx5: E-Switch, Fix default encap mode Date: Thu, 18 Jul 2019 23:56:26 -0400 Message-Id: <20190719035643.14300-155-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maor Gottlieb [ Upstream commit 9a64144d683a4395f57562d90247c61a0bf5105f ] Encap mode is related to switchdev mode only. Move the init of the encap mode to eswitch_offloads. Before this change, we reported that eswitch supports encap, even tough the device was in non SRIOV mode. Fixes: 7768d1971de67 ('net/mlx5: E-Switch, Add control for encapsulation') Signed-off-by: Maor Gottlieb Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 5 ----- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 6a921e24cd5e..e9339e7d6a18 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1882,11 +1882,6 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) esw->enabled_vports = 0; esw->mode = SRIOV_NONE; esw->offloads.inline_mode = MLX5_INLINE_MODE_NONE; - if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, reformat) && - MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap)) - esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC; - else - esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE; dev->priv.eswitch = esw; return 0; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 47b446d30f71..c2beadc41c40 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -1840,6 +1840,12 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int vf_nvports, { int err; + if (MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, reformat) && + MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, decap)) + esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC; + else + esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE; + err = esw_offloads_steering_init(esw, vf_nvports, total_nvports); if (err) return err; @@ -1901,6 +1907,7 @@ void esw_offloads_cleanup(struct mlx5_eswitch *esw) esw_offloads_devcom_cleanup(esw); esw_offloads_unload_all_reps(esw, num_vfs); esw_offloads_steering_cleanup(esw); + esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE; } static int esw_mode_from_devlink(u16 mode, u16 *mlx5_mode) -- 2.20.1