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 14B86C38A2D for ; Mon, 24 Oct 2022 12:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233502AbiJXM0o (ORCPT ); Mon, 24 Oct 2022 08:26:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231646AbiJXMYo (ORCPT ); Mon, 24 Oct 2022 08:24:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 786655756B for ; Mon, 24 Oct 2022 05:00:41 -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 ams.source.kernel.org (Postfix) with ESMTPS id 619D7B811D5 for ; Mon, 24 Oct 2022 11:55:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94C6CC433D7; Mon, 24 Oct 2022 11:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666612514; bh=vMTytB8KWWJwDUtV3bvD7tARArHNPnZCQkCiChnoRbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=REfbTSBzWZMxocKDpYEWKyyZ8XKdQNoBXVomuxI0cymtsf0SS0X+DvisYdbck++U0 Mlz/EF+87/5plSgWtm7QxV6turTsvl/sjRz/GgoEtBoX5dOMlL4ZgFdOkTIFxnmarS 16GzX/Yu6qLnYBJHPw4VAIfsmbAyPNfmJFE58xLaKzn/lKXIYF3saa+YruvsftrJvM vGlK8XpkYjDML5vOcgGmUSbeMFNsN3toB3xszo+tqylYDlcUvJQRZoRlWzekXQeb7I 9opMN83R4igeBl2OsPzk5bVwjh6azUY1z63lGlrPrcE2tiZq6QyAdSGR7ajvF1/hVX m8xQGmX6EE7FA== 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: [V3 net 14/16] net/mlx5e: Fix macsec rx security association (SA) update/delete Date: Mon, 24 Oct 2022 12:53:55 +0100 Message-Id: <20221024115357.37278-15-saeed@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024115357.37278-1-saeed@kernel.org> References: <20221024115357.37278-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