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 397E8C38A2D for ; Wed, 26 Oct 2022 13:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234083AbiJZNy6 (ORCPT ); Wed, 26 Oct 2022 09:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbiJZNxh (ORCPT ); Wed, 26 Oct 2022 09:53:37 -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 D33D110A7D9 for ; Wed, 26 Oct 2022 06:53:07 -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 838BCB82256 for ; Wed, 26 Oct 2022 13:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5B72C433D7; Wed, 26 Oct 2022 13:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666792385; bh=Fb0pkpYXR559oBSHzj9ICqgfckZddz7MTbsku91saIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1n1xZgcv7QKrPOJQEKigC1cFHnBpOmvVUvO2ocGkHn3FEF6mJ5DIKqkr+eqSqPWT jmWxASKjMCzZUzWiapbZun4Ad3CS4UBKbplNh79Z7kSwlBW/UO/0vQoFjaZ+wkcE05 bfFWj4EEurHEL4GqaPsZJHdGLBL22uXgcs6+6UrJ0QF1x+ep+TrOZKlTg0nx8AOW1+ B9YWhvGge66eeZPzTL+qSqzFLvstGaFaq8vgJvKHhLahGuRc+/pygDZemVOO8BpD7R H4gsZd3Bd41FgoAHS9skBttsFXjWtq6HISodkel2brWovvCchwQnE0KTeYdRHfg0NB 39klvJS5boOVQ== 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 15/15] net/mlx5e: Fix macsec sci endianness at rx sa update Date: Wed, 26 Oct 2022 14:51:53 +0100 Message-Id: <20221026135153.154807-16-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 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 6ae9fcdbda07..2ef36cb9555a 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