From patchwork Sun Feb 6 15:36:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12736592 X-Patchwork-Delegate: kuba@kernel.org 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 C256AC433F5 for ; Sun, 6 Feb 2022 15:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243953AbiBFPhW (ORCPT ); Sun, 6 Feb 2022 10:37:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233954AbiBFPhV (ORCPT ); Sun, 6 Feb 2022 10:37:21 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2054.outbound.protection.outlook.com [40.107.93.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C434DC043186 for ; Sun, 6 Feb 2022 07:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sx4TK+8FzEhdqbXSeVnNidTAxy6UwXKSfSHIjyBSXkkBuge1dq813P9oKst59t/joHymyeYt0wvSFQIY4AhJ2tdXJfANU8omMhB+pcL1mx2aULp6i03ty1Za9/YE9uyvzpObqxkHXzCfxiPrXFXGjZsG4mEixgpglxrak4WAgQWWKEjcU0dwnTM98OuY4D665XO7RBcYIdGgkxqb7mtWO4uM+6G2IShp8T5t7zHnT75Ct8q+Xs2Pq6Sxn3rUAF7+KN3hX6u5VCKVioEPzsFqfd+wKDSyq8S7rIsHsXRAAdNk7JqHf5G97ayGx1vFDMNqpqlAox0/qEpSzqmGx0lTsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tZqrEsaOrrfXQaKNVEyMiwjknDyBZJ9tZW1JwRDmFeU=; b=AwGfGkQ6ipReFrpnsmaaed9iN6Xe0Yr6uQiIPZoGXFxBbRX59b/U6v9rX2iDjxmtm+a9csSDVDgoOUR8Od42z7E0xbr5QpUPtbitiaUufNTTQAUnr5d99YafR7gPC428QdtSZFs2EtffKMMxUsH9Zvx+DABz/VS8vduxAtK65JRB0JRCtG3Z/3yP6f87BBG3feb5+9wVbbhm/5XDYrd/nXfcLowLxNjfk8YBLilsGKGujsV+qBYQuBUYi492dYjvV3Ef94hS1Yn8QWcp9QwvuVIaovPvmXuIWHqpGorpuBt2LJI2iugJNdBZFDr9CpJ51TUJ7TaLj4cmFVE1f385Jg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tZqrEsaOrrfXQaKNVEyMiwjknDyBZJ9tZW1JwRDmFeU=; b=tVF3HU/MrFFwJ7TnmJVNY+fz0WZZlrSzvS9guA8xNZ3Dzv1pJrXLqocD4sqMpcjRk4jTkPD0cuMDg6S/OFbuvW0F2Or0yb7rcIVtItczbNMEE8cHmV6F1blip78stQ5G3UJWIpt6dOWJpBh5t4vHEF7RCqn9o53XWaDzcnwHcyEkJTgdF3YEQdMvrQir5ZMK/vzezeyKm34wZrYy1GPKxS0ck1F4Gox2cZ2GZwl+k71OI+I8HC5n560cQuf32oD8iYhOt+wl9P0QcZrtfraB+y4+NJ8iZ6z28vfYvUabdGqAXXUm+W2e6yGNs6jI7DqVGxKmSzILEeFgk21M0ZyntA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) by BN8PR12MB3395.namprd12.prod.outlook.com (2603:10b6:408:43::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Sun, 6 Feb 2022 15:37:16 +0000 Received: from DM6PR12MB4337.namprd12.prod.outlook.com ([fe80::5cff:a12b:dfa4:3eff]) by DM6PR12MB4337.namprd12.prod.outlook.com ([fe80::5cff:a12b:dfa4:3eff%3]) with mapi id 15.20.4951.018; Sun, 6 Feb 2022 15:37:16 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 1/4] mlxsw: core_acl_flex_actions: Add SIP_DIP_ACTION Date: Sun, 6 Feb 2022 17:36:10 +0200 Message-Id: <20220206153613.763944-2-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220206153613.763944-1-idosch@nvidia.com> References: <20220206153613.763944-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0134.eurprd09.prod.outlook.com (2603:10a6:803:12c::18) To DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27b6a3e5-a96e-4a76-6492-08d9e9868db6 X-MS-TrafficTypeDiagnostic: BN8PR12MB3395:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1169; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6bhp03vAxBtsNX4Y6JUSRbCvipF/L4QpWsX1TIgaBp3T5BaU03AAtMRXjwUJqQnIuoG0Ko8y+fIcnVbDM2U7hpBQWiNvwFLtCIHRxR27c8UBt7ReLruqxNWK9oqz+C2yqmVW2j/wkBd6BXC0AuHfr/ochscGLSx+hR593efmAZI4tFCyq28xUPnccURy5JBz3Xn4hpEvk1OGZbri0eBbH7OL+2lHpQQjP8YGsiwVvTHzEgyA9j8QMzj1YzfRuYQnP777s2qnOURED48I/aUB5NEvdmvs1wTVbAYPs0R7g1i2Of3OdGKQ1O6LRFsdEegeQqnGmj0lTS5UfRJwQuzh98r73zDvIsSL/NEKqBzWdaPo3MRMj7nyvviDBD0shZKgjRTvn/q0mS0dIDQiH+3QyCObem4GMoZEBGEmW3cPIG+CzaX9IlMgE5jrSpbg2bHIxFzljT6ywu535gTwvQiywSESvw+RwX9MWDKA8iir2wmY1qZObHdDoHBr+1vu09jlc4MX1aF0HQkR1IcuzunjnvItHsdJ09Gh6iszaEfPPNFEiR/ufc6iOepAOgcJzdO96lEo1oC/eOjdFDBXx9+yPkOj8jujh2kM+tYLDvJ2HHkN0teRXscIoEgtGNNojNiz+bpJxjnqh5FI1mOE+CzIPw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4337.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6486002)(26005)(186003)(83380400001)(6506007)(6666004)(6512007)(5660300002)(6916009)(316002)(36756003)(8676002)(4326008)(2906002)(66556008)(66476007)(86362001)(8936002)(66946007)(508600001)(107886003)(1076003)(2616005)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XDowa06lkGL+Lj1GiEHChtJ3rzEd8/I12SVVg3fBj2uAUFuZH7GimzrOssg30JGfNkfHlxb25gPX/FNd9b+e98dr+2Fva0SzciPM3r5ZaHwkQ5inJlL8wswo05m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eSW9tGZbTjBYNsg/JXDqP0sJzRj10aMyrkUxMws0SlZ8vNO6a51v3wLj4oZNDj3iooz02f9xgymkFojLQrX643JSsQQ9zCUSJfU2jeb+3Ei5fBAQSrmPDcuqUnFBlqeg905j48DiqucWJVwn+03bO2IIga4VvAEAgSU+kO4S/Dz19RO62fYgacpQEhd0sGs55EWUPK6Y4wXOYKbBY4yrODwd6HfIMjfFd+kbfYJQlFfUm93ojNbAa7rXS0bzoGC0h79fJyXInNXkn3cZPMoyKaRI3twiikJ5wqHv8tQ0vpBJG774k5Bh/KGGETgvyAg+lULXGLPLQ3bx5h5kH6CABLr0cPajLtZPXdZS+h0Q+P7A0UIas5lbsOH4JKB0tPMbodR9kV/aIhccHqps3Lg0/hM65jOxAut0= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27b6a3e5-a96e-4a76-6492-08d9e9868db6 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4337.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2022 15:37:16.2847 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iiFtbK8zu4+UoeQeDXojadC3XCg86SM+90Zjj7UMBOF+Crpi8N5mfkoKKLM/LcThQWPQf+u8zk/w2zvS7RZs3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3395 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson Add fields related to SIP_DIP_ACTION, which is used for changing of SIP and DIP addresses. Signed-off-by: Danielle Ratson Reviewed-by: Petr Machata Signed-off-by: Ido Schimmel --- .../mellanox/mlxsw/core_acl_flex_actions.c | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c index 77e82e6cf6e8..b6fe26ee488b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c @@ -1957,6 +1957,51 @@ int mlxsw_afa_block_append_mcrouter(struct mlxsw_afa_block *block, } EXPORT_SYMBOL(mlxsw_afa_block_append_mcrouter); +/* SIP DIP Action + * -------------- + * The SIP_DIP_ACTION is used for modifying the SIP and DIP fields of the + * packet, e.g. for NAT. The L3 checksum is updated. Also, if the L4 is TCP or + * if the L4 is UDP and the checksum field is not zero, then the L4 checksum is + * updated. + */ + +#define MLXSW_AFA_IP_CODE 0x11 +#define MLXSW_AFA_IP_SIZE 2 + +enum mlxsw_afa_ip_s_d { + /* ip refers to dip */ + MLXSW_AFA_IP_S_D_DIP, + /* ip refers to sip */ + MLXSW_AFA_IP_S_D_SIP, +}; + +/* afa_ip_s_d + * Source or destination. + */ +MLXSW_ITEM32(afa, ip, s_d, 0x00, 31, 1); + +enum mlxsw_afa_ip_m_l { + /* LSB: ip[63:0] refers to ip[63:0] */ + MLXSW_AFA_IP_M_L_LSB, + /* MSB: ip[63:0] refers to ip[127:64] */ + MLXSW_AFA_IP_M_L_MSB, +}; + +/* afa_ip_m_l + * MSB or LSB. + */ +MLXSW_ITEM32(afa, ip, m_l, 0x00, 30, 1); + +/* afa_ip_ip_63_32 + * Bits [63:32] in the IP address to change to. + */ +MLXSW_ITEM32(afa, ip, ip_63_32, 0x08, 0, 32); + +/* afa_ip_ip_31_0 + * Bits [31:0] in the IP address to change to. + */ +MLXSW_ITEM32(afa, ip, ip_31_0, 0x0C, 0, 32); + /* L4 Port Action * -------------- * The L4_PORT_ACTION is used for modifying the sport and dport fields of the packet, e.g. for NAT.