From mboxrd@z Thu Jan 1 00:00:00 1970 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 BF5E6C433FE for ; Wed, 26 Oct 2022 13:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234044AbiJZNyj (ORCPT ); Wed, 26 Oct 2022 09:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234108AbiJZNxX (ORCPT ); Wed, 26 Oct 2022 09:53:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D60821057F3 for ; Wed, 26 Oct 2022 06:52:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7261161EB1 for ; Wed, 26 Oct 2022 13:52:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C6B8C433D6; Wed, 26 Oct 2022 13:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666792376; bh=vMTytB8KWWJwDUtV3bvD7tARArHNPnZCQkCiChnoRbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TrALpICyUPzH8ljRa8ZxjOW5PMq6AWHEEreVd5TcEOHpkxYkS945Fzim126xoqQg5 Tt8GCWK+JxhGnMfR//MwJ8utR5ORDWzso+zokPY8mi/XmBO8LPkwfweFVsvN0pLtP2 aRyBZ5WGMObU4hMMbb62rAmf0v188p/LhmDQOUaOg0zRdPPXHB8SPEiP7BP0nuCOaN bgVRZItXarP+GGQlZadheyk7pZVOOGyvhDT7Zq4l0tTG7B9ZmEggmy88PpjYUS+zaf g+UYTqt2NvT+3oY9BJZyl937zN9gNzQqQuPAPciHRJSzjZmKae9FLJ3MCIbXaUiGYy KxjcprBMZ1R2A== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Raed Salem Subject: [V4 net 13/15] net/mlx5e: Fix macsec rx security association (SA) update/delete Date: Wed, 26 Oct 2022 14:51:51 +0100 Message-Id: <20221026135153.154807-14-saeed@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221026135153.154807-1-saeed@kernel.org> References: <20221026135153.154807-1-saeed@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Raed Salem The cited commit adds the support for update/delete MACsec Rx SA, naturally, these operations need to check if the SA in question exists to update/delete the SA and return error code otherwise, however they do just the opposite i.e. return with error if the SA exists Fix by change the check to return error in case the SA in question does not exist, adjust error message and code accordingly. Fixes: aae3454e4d4c ("net/mlx5e: Add MACsec offload Rx command support") Signed-off-by: Raed Salem Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/en_accel/macsec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c index 250c878ba2c9..6ae9fcdbda07 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c @@ -999,11 +999,11 @@ static int mlx5e_macsec_upd_rxsa(struct macsec_context *ctx) } rx_sa = rx_sc->rx_sa[assoc_num]; - if (rx_sa) { + if (!rx_sa) { netdev_err(ctx->netdev, - "MACsec offload rx_sc sci %lld rx_sa %d already exist\n", + "MACsec offload rx_sc sci %lld rx_sa %d doesn't exist\n", sci, assoc_num); - err = -EEXIST; + err = -EINVAL; goto out; } @@ -1055,11 +1055,11 @@ static int mlx5e_macsec_del_rxsa(struct macsec_context *ctx) } rx_sa = rx_sc->rx_sa[assoc_num]; - if (rx_sa) { + if (!rx_sa) { netdev_err(ctx->netdev, - "MACsec offload rx_sc sci %lld rx_sa %d already exist\n", + "MACsec offload rx_sc sci %lld rx_sa %d doesn't exist\n", sci, assoc_num); - err = -EEXIST; + err = -EINVAL; goto out; } -- 2.37.3