From patchwork Wed Mar 10 19:03:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12129109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DDB9C43331 for ; Wed, 10 Mar 2021 19:04:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC7E164FD5 for ; Wed, 10 Mar 2021 19:04:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233724AbhCJTET (ORCPT ); Wed, 10 Mar 2021 14:04:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:44326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233729AbhCJTD4 (ORCPT ); Wed, 10 Mar 2021 14:03:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1BBFE64FB1; Wed, 10 Mar 2021 19:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615403036; bh=wT14TkWNyI+D1zr2XEPrcqQQppEi/muTDrRtB7IjWsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K92Cr6DR1TtOUR+/YGB0pAZngTZpdQXsjiF7ZOBqCMf2HP6URFrrG+J6/YcDO4A/Z yUPvrmf1k15tqP50ihycXmdvmRuLQDv/UDM+VPIcz1hfWXjboku3eylTm70zITItXf 11lElCulLXkVYanFqV1jK4Q5QPY3cY8YJbfD6CFzOpedqo5/0+laD1HKWtN9GD3G7S uEnxBWIXGDPbgAVIrQV7BGf779SciEg2dufPK5tG4T5ChJJ9/AsHfTtHdaXaNtZjh8 rXOLRVo/GrFcfqRN6dNCBXBvE33Id2YUfLkVTLdSVj9cV2rbH1YJC7xdcXfD+RV3Hz dJy+WUU7pLe1A== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed Subject: [net 06/18] net/mlx5e: Revert parameters on errors when changing PTP state without reset Date: Wed, 10 Mar 2021 11:03:30 -0800 Message-Id: <20210310190342.238957-7-saeed@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210310190342.238957-1-saeed@kernel.org> References: <20210310190342.238957-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Maxim Mikityanskiy Port timestamping for PTP can be enabled/disabled while the channels are closed. In that case mlx5e_safe_switch_channels is skipped, and the preactivate hook is called directly. However, if that hook returns an error, the channel parameters must be reverted back to their old values. This commit adds missing handling on this case. Fixes: 145e5637d941 ("net/mlx5e: Add TX PTP port object support") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index abdf721bb264..0e059d5c57ac 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -2014,8 +2014,13 @@ static int set_pflag_tx_port_ts(struct net_device *netdev, bool enable) */ if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { + struct mlx5e_params old_params; + + old_params = priv->channels.params; priv->channels.params = new_channels.params; err = mlx5e_num_channels_changed(priv); + if (err) + priv->channels.params = old_params; goto out; }