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 18CAAC433FE for ; Wed, 19 Oct 2022 06:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbiJSGje (ORCPT ); Wed, 19 Oct 2022 02:39:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbiJSGjH (ORCPT ); Wed, 19 Oct 2022 02:39:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBA56F54A for ; Tue, 18 Oct 2022 23:38:49 -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 DA40361780 for ; Wed, 19 Oct 2022 06:38:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 381D0C43470; Wed, 19 Oct 2022 06:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666161528; bh=IFNo5RdpG7AHcX8bFrPO0F7pMMmXawwb4r4LICt6uBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHGo3nvHuWsT5YR6GivLWhMgQLoto9EI7jyyAmcmEy3EyPgZ1mBuMTxqo1bZQcTdT AK/6FJ34GMzyby2ZOUdVW0OXzCquFasWDkX+P+ku1xJtQlNv89cXylgbYgC4ib9ppu YcqnYiADETCnEzQIw+SCBp9DzjsWoIIt04g13Kno8zw7GfLbnCE5Gd9fXxmuM6effL zY6dLA1t7g1g3yVb2NP5QsI/Omdoc1IkZ9XZGPkNH6hsW0NlaCMbiDdwXUHR9qDRzh Xdr6x9qBANCSuQLEzFx7J46DBBq4ABXz0IYlyFysxRtS7sVeuHxcJvY9u1+0BuDJ9W CW6H0GKguNQEg== 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: [net 14/16] net/mlx5e: Fix macsec rx security association (SA) update/delete Date: Tue, 18 Oct 2022 23:38:11 -0700 Message-Id: <20221019063813.802772-15-saeed@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221019063813.802772-1-saeed@kernel.org> References: <20221019063813.802772-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 d111e86afe72..975fedf6bfd6 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