Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D7CAC43217 for ; Wed, 24 Nov 2021 13:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355397AbhKXN6U (ORCPT ); Wed, 24 Nov 2021 08:58:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:45462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352075AbhKXNyq (ORCPT ); Wed, 24 Nov 2021 08:54:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 718D061A51; Wed, 24 Nov 2021 13:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637759162; bh=xXegRvPQDgj3JG9BA/uoacZeQuIHIWmQcmXqKxY+Msk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZFnckFf0ZtNg2giGLzoWvcG+Cl2fO1OqkLcs2f/9EjKwDSklE1tjeyfa/BtmM/UKG g1NlhfDD+qbmJQtIIQRH+5MkpjKevYTwOTIldfbRoCisyohLz4BuhwgjN5FBLcRCRT Fn1jTX85jG9GMrvcEjMhVPbDl+2cbQ0MXLjcpVPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raed Salem , Mark Bloch , Maor Dickman , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 151/279] net/mlx5: E-Switch, return error if encap isnt supported Date: Wed, 24 Nov 2021 12:57:18 +0100 Message-Id: <20211124115723.982875846@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115718.776172708@linuxfoundation.org> References: <20211124115718.776172708@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: Raed Salem [ Upstream commit c4c3176739dfa6efcc5b1d1de4b3fd2b51b048c7 ] On regular ConnectX HCAs getting encap mode isn't supported when the E-Switch is in NONE mode. Current code would return no error code when trying to get encap mode in such case which is wrong. Fix by returning error value to indicate failure to caller in such case. Fixes: 8e0aa4bc959c ("net/mlx5: E-switch, Protect eswitch mode changes") Signed-off-by: Raed Salem Reviewed-by: Mark Bloch Reviewed-by: Maor Dickman Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 08534d562d5a9..0c79e11339362 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -3581,7 +3581,7 @@ int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, *encap = esw->offloads.encap; unlock: up_write(&esw->mode_lock); - return 0; + return err; } static bool -- 2.33.0