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 82A88C433FE for ; Wed, 19 Oct 2022 06:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230062AbiJSGjf (ORCPT ); Wed, 19 Oct 2022 02:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230122AbiJSGjJ (ORCPT ); Wed, 19 Oct 2022 02:39:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5854970E7B for ; Tue, 18 Oct 2022 23:38:52 -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 EBFED61718 for ; Wed, 19 Oct 2022 06:38:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4809FC433C1; Wed, 19 Oct 2022 06:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666161530; bh=xXKFW0mAjFSUFQ4l5IUczjHBUuE22iI2OD9/yp391Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOiTt2bBEw4j+mSljdhDdZ4YxvDLVUi55BSXP+nWxdZP3ghDI4rXeUVufeGYZelag K1WVWMK7NdGQCiJ/vLDlcN9brLroKYfNAPQ504QvCynXaRlJfY+OLSI0qxaw8Wl0/N hkgfZcyukLfYL3f+dnwTOuEm7m2wYB5thUbi980RPgAdNCg0pIDGXN5eEPw7btZh3m 7wW4KmTmuXyvbWFwTW9NQTctT48obgByyBBVIImSHxbUTpDdAzKLmwiClj18YIMnME 1wb1mhgWrZAlITgmJhtp/nTVqbJRACQ2WJ0gn1xOYSf4/qNKwezM+BcgvQbe7ACovj 0ZS7e+sbPeYSQ== 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 16/16] net/mlx5e: Fix macsec sci endianness at rx sa update Date: Tue, 18 Oct 2022 23:38:13 -0700 Message-Id: <20221019063813.802772-17-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 at rx sa update operation passes the sci object attribute, in the wrong endianness and not as expected by the HW effectively create malformed hw sa context in case of update rx sa consequently, HW produces unexpected MACsec packets which uses this sa. Fix by passing sci to create macsec object with the correct endianness, while at it add __force u64 to prevent sparse check error of type "sparse: error: incorrect type in assignment". Fixes: aae3454e4d4c ("net/mlx5e: Add MACsec offload Rx command support") Signed-off-by: Raed Salem Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 975fedf6bfd6..34c54c787f4d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c @@ -444,7 +444,7 @@ static int mlx5e_macsec_update_rx_sa(struct mlx5e_macsec *macsec, return 0; } - attrs.sci = rx_sa->sci; + attrs.sci = cpu_to_be64((__force u64)rx_sa->sci); attrs.enc_key_id = rx_sa->enc_key_id; err = mlx5e_macsec_create_object(mdev, &attrs, false, &rx_sa->macsec_obj_id); if (err) -- 2.37.3