From patchwork Wed May 5 12:23:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92916 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 291AFA0524; Wed, 5 May 2021 14:23:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E20941103; Wed, 5 May 2021 14:23:53 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2066.outbound.protection.outlook.com [40.107.244.66]) by mails.dpdk.org (Postfix) with ESMTP id 45F2C410FE for ; Wed, 5 May 2021 14:23:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nlyk1269+VrGD13AexbCbk6L7AXHbiheidBNseD1tOwKtw4ZB6v+SmtPaCWXWk49CkskSzWRsLnb5VCPB0SArwDscM8uoPPw4mWb9kcE+bPrseeyTF14yleayj1XI91ai/u+hOboMnj9E4uu96VvsIkV/0rlh7noac/M5dPfjuCVPSdKzvSMMHye90AK6W2PQFAS0ZFrLy7QG5CJZbdauVEUTNCOHgw+L5rPDSf9cQSglEeBaaVNzRgcw9YHuubQzeoRi5VbdZS4WUe3qHelCTnU+Jn2VxOG7ho+mzz3KzatC2c6LpGtKXeYZYZ1eQJlAjEM4b2TrA+6zv0Cp9TlnA== 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-SenderADCheck; bh=5m+ieE7zc1GLz0SUsFZX3mEDLIOA2bTIKdx1es7028s=; b=fVqWD0iqD1SyUBY46Nh0t0zYUXmSZqdwHIwGk73JZMhJegiFeYepCZPluLMpQ0tQ38934Ghj8zsDCNDAg1Ja5v3MH1AOnYQzVccTlhjjqoeZWwZ/8qs9vWviSNauMajn6tbm5e59WfNbBFJAV+qFDgr3ohufjr4ovw7xliJz0laHE49HXTns53zl8XT4mon7SRZ9vTbA44x7ZbdLYX8Q/0UdpgtNAjMst5GWm+rIftPpyObptmbrE8V4or0pI/0gNjMFv6pqKIb7YwUIDI4v4Z/qjydmRD1i+HQvJW4oJSOloOexGKCVD9n7Pne6g46E98uL8D9MhEgEramrEIJc9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=5m+ieE7zc1GLz0SUsFZX3mEDLIOA2bTIKdx1es7028s=; b=P2fl0I6MiKrsyyTJUfxs4458yOoAokRXClZjyRZeUsBPjZdySsTWlH4oK0UK7RstQX+ZDSESv3URXSepCNeg+19IdxP0AeWoxqjToTrB6Nk9Kwzk++3D2YEXwOQ9vhTlrRZcM4SUffLRN4Uc0pah0vlMeTP6qbrh2YlGipMi4LV178+dS1yNOCnf3YqWuiFq06Q9fbqJJdq1miANlLSI+gEgjSiUGJvqQXJWTWxn7JqMspoFBjeGkdXTT8gmeI/8+XUaBylh7INU23sfwXA12yDqTo9SoNpBsibyxY53B6ISxFAZrswRqBqSkrvA+nma/cj9Xo2oX+YGc6yLDscBXw== Received: from DM3PR08CA0010.namprd08.prod.outlook.com (2603:10b6:0:52::20) by BY5PR12MB4227.namprd12.prod.outlook.com (2603:10b6:a03:206::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Wed, 5 May 2021 12:23:51 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:0:52:cafe::1e) by DM3PR08CA0010.outlook.office365.com (2603:10b6:0:52::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:50 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:23:47 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:12 +0300 Message-ID: <20210505122328.51129-2-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8ee25b8-d13e-4c3b-ae83-08d90fc0a3f0 X-MS-TrafficTypeDiagnostic: BY5PR12MB4227: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QIcTRVCccMlBGzm8q62b1muYXte1rbNiT8fIJzB7YuUlwRWY4FAfa1vPVpDnie0Wp4kLWPfxajT4ZjgQ0hjlxGqY3SRjYJBqBkhIkFmm4jfAIaQdIAChC/0JmkTsZpJ+9fy1jxOVa/uds6CxicHUn29IY+h+SXMBubmYh4iOAxuZXGHVe6WNVcqxdSdBUINw+oTcZM0J0Y+qB83lEJo1XaQOJvyFbmYI2XMXh1h018xFfMq+FQP3UHkmoWfqEsuqcysuNDFf9jga4WVXgmAemoAj/z+zxdwYTWWjXnDo3Qva3q22oLrrSP1gr6bkwWsZpZpDOkn3eqkXU8MjH+/mgC0V10GYqkY2lx7+EtMoOFjp7wYwya1YY9sHOY4l0ZOJNKzIjogvCS4JHgCHLrKUVQQWAKeit8aX0uZmfr97B59QUm3BIXJvFu57nMyYhxLV/hzvEeI+29JtV1oPWamtnN22AtoRn+WapaQJd7ICVXYTTTvCdfVKM+yUVcmg4Sa81/gkZ7iu/deMkRejaTyV0ACYKSsZSzgYOkThbg9UFU7JkK80F9HzcLzxMMTB08BqunZ3APcQKZHOWr5RhJGUg5OO6+1WLF10DFbRTwRVCYN7hG5Ed2k5iJY6mDne3Umez27mTUEau/fae8850kHRX34svSlAp/GbSWBTF3FgYdQ= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(346002)(396003)(46966006)(36840700001)(70206006)(110136005)(82740400003)(6286002)(316002)(54906003)(107886003)(7636003)(478600001)(336012)(356005)(82310400003)(83380400001)(186003)(16526019)(36756003)(5660300002)(36860700001)(47076005)(55016002)(6666004)(426003)(2906002)(2616005)(26005)(4326008)(36906005)(8936002)(70586007)(1076003)(8676002)(7696005)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:50.6783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8ee25b8-d13e-4c3b-ae83-08d90fc0a3f0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4227 Subject: [dpdk-dev] [PATCH v7 01/17] common/mlx5: add connection tracking object definition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The structures of ASO connection tracking offload object are added based on the definitions in the PRM. One CT object context will be loaded into the cache completely in a reversed order of dwords. The valid bit should be the MSB of the last dword. This is used for the conntrack context creation and update, as well as for the query. The capabilities 2 (HCA_CAP_2) layout is also added. The connection tracking related capabilities could be queried via the HCA_CAP_2. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/mlx5_prm.h | 85 ++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 330101233a..683ab40338 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1124,6 +1124,7 @@ enum { MLX5_GET_HCA_CAP_OP_MOD_ROCE = 0x4 << 1, MLX5_GET_HCA_CAP_OP_MOD_NIC_FLOW_TABLE = 0x7 << 1, MLX5_GET_HCA_CAP_OP_MOD_VDPA_EMULATION = 0x13 << 1, + MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 = 0x20 << 1, }; #define MLX5_GENERAL_OBJ_TYPES_CAP_VIRTQ_NET_Q \ @@ -1692,6 +1693,29 @@ struct mlx5_ifc_flow_table_nic_cap_bits { ft_field_support_2_nic_receive; }; +struct mlx5_ifc_cmd_hca_cap_2_bits { + u8 reserved_at_0[0x80]; /* End of DW4. */ + u8 reserved_at_80[0xb]; + u8 log_max_num_reserved_qpn[0x5]; + u8 reserved_at_90[0x3]; + u8 log_reserved_qpn_granularity[0x5]; + u8 reserved_at_98[0x3]; + u8 log_reserved_qpn_max_alloc[0x5]; /* End of DW5. */ + u8 max_reformat_insert_size[0x8]; + u8 max_reformat_insert_offset[0x8]; + u8 max_reformat_remove_size[0x8]; + u8 max_reformat_remove_offset[0x8]; /* End of DW6. */ + u8 aso_conntrack_reg_id[0x8]; + u8 reserved_at_c8[0x3]; + u8 log_conn_track_granularity[0x5]; + u8 reserved_at_d0[0x3]; + u8 log_conn_track_max_alloc[0x5]; + u8 reserved_at_d8[0x3]; + u8 log_max_conn_track_offload[0x5]; + u8 reserved_at_e0[0x20]; /* End of DW7. */ + u8 reserved_at_100[0x700]; +}; + union mlx5_ifc_hca_cap_union_bits { struct mlx5_ifc_cmd_hca_cap_bits cmd_hca_cap; struct mlx5_ifc_per_protocol_networking_offload_caps_bits @@ -2630,6 +2654,67 @@ struct mlx5_ifc_create_flow_meter_aso_in_bits { struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr; struct mlx5_ifc_flow_meter_aso_bits flow_meter_aso; }; + +struct mlx5_ifc_tcp_window_params_bits { + u8 max_ack[0x20]; + u8 max_win[0x20]; + u8 reply_end[0x20]; + u8 sent_end[0x20]; +}; + +struct mlx5_ifc_conn_track_aso_bits { + struct mlx5_ifc_tcp_window_params_bits reply_dir; /* End of DW3. */ + struct mlx5_ifc_tcp_window_params_bits original_dir; /* End of DW7. */ + u8 last_end[0x20]; /* End of DW8. */ + u8 last_ack[0x20]; /* End of DW9. */ + u8 last_seq[0x20]; /* End of DW10. */ + u8 last_win[0x10]; + u8 reserved_at_170[0xa]; + u8 last_dir[0x1]; + u8 last_index[0x5]; /* End of DW11. */ + u8 reserved_at_180[0x40]; /* End of DW13. */ + u8 reply_direction_tcp_scale[0x4]; + u8 reply_direction_tcp_close_initiated[0x1]; + u8 reply_direction_tcp_liberal_enabled[0x1]; + u8 reply_direction_tcp_data_unacked[0x1]; + u8 reply_direction_tcp_max_ack[0x1]; + u8 reserved_at_1c8[0x8]; + u8 original_direction_tcp_scale[0x4]; + u8 original_direction_tcp_close_initiated[0x1]; + u8 original_direction_tcp_liberal_enabled[0x1]; + u8 original_direction_tcp_data_unacked[0x1]; + u8 original_direction_tcp_max_ack[0x1]; + u8 reserved_at_1d8[0x8]; /* End of DW14. */ + u8 valid[0x1]; + u8 state[0x3]; + u8 freeze_track[0x1]; + u8 reserved_at_1e5[0xb]; + u8 reserved_at_1f0[0x1]; + u8 connection_assured[0x1]; + u8 sack_permitted[0x1]; + u8 challenged_acked[0x1]; + u8 heartbeat[0x1]; + u8 max_ack_window[0x3]; + u8 reserved_at_1f8[0x1]; + u8 retransmission_counter[0x3]; + u8 retranmission_limit_exceeded[0x1]; + u8 retranmission_limit[0x3]; /* End of DW15. */ +}; + +struct mlx5_ifc_conn_track_offload_bits { + u8 modify_field_select[0x40]; + u8 reserved_at_40[0x40]; + u8 reserved_at_80[0x8]; + u8 conn_track_aso_access_pd[0x18]; + u8 reserved_at_a0[0x160]; + struct mlx5_ifc_conn_track_aso_bits conn_track_aso; +}; + +struct mlx5_ifc_create_conn_track_aso_in_bits { + struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr; + struct mlx5_ifc_conn_track_offload_bits conn_track_offload; +}; + enum mlx5_access_aso_opc_mod { ASO_OPC_MOD_IPSEC = 0x0, ASO_OPC_MOD_CONNECTION_TRACKING = 0x1, From patchwork Wed May 5 12:23:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92917 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 35CEDA0524; Wed, 5 May 2021 14:24:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF5BC41114; Wed, 5 May 2021 14:23:54 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.54]) by mails.dpdk.org (Postfix) with ESMTP id 4803F41106 for ; Wed, 5 May 2021 14:23:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OWJfrZ1AqYG92g4OIyoMzbned216rdkyKIVswLEOqmwvsfa65Hpe7K8eskEBe4KFTnRM+qezYvKOJSH1mERDkJps5JxID9bpMsaEKCXFPYFb8m8/ZUufeIS1i96qlprZR9dpAax39F37M4OuAijLYUmNY/3dGcA0qJx2dnwVMMH+Cxgag1rbqceHfda/Z/QGABtpWhZu6j3T95kZW2O6D9towpDK0XpP4nWDxOj8ySKlBB/bbITiOHb+xFKeCktzV/zucYgPoH1/HQqBer7ZRSkb4TbG5Dl59hixQOok2HO3WupVle6eHJUtmukaNdZ0tJMzFfBIlTlGuoNdpjesPQ== 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-SenderADCheck; bh=KR37BJARjaH4/fI2wcVL1IwqC43ddwIMyvlzcEnn2mE=; b=Kn03X4IR3+D1fBcj9u0UTsWAaYNhybJnozDQS0ulD+BUxIa8xevgOJT8qCeFY82Cs/TffKdV0AMO4e6HzWA/zzDdd+9khBzh1Fsv9jbxFvVPjT/FYaTwkfUXqb3BF4HbrXnE7u96AESoq8+/6SpGuKHVyTZ72BfBmZRFWWXPqqbINz738dNgWrBAVgU+BXwFSh+kmcctk2Z0J+cMG0pV1xoRbb/M5qiRndHHXPLO85XxvDSn/zm4pBlTtoBfDawB1l+jWIUXHCjGtnhbKCBd11LGp3WYFXR1d2Q4WngOdUmkRiHV5pRkAWY3cejCMzuuXNdwyOAMg9Xh/A6x1D70VA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=KR37BJARjaH4/fI2wcVL1IwqC43ddwIMyvlzcEnn2mE=; b=M8fXjJibvLMwQxA9nsNavxW01tin1jJwSGjCWDHlhVAbCFIn1rVyaiFACgNH5Rnrh1DoL+UO3khfieecmEkzm5YLem5/oYwq/w9IgQByU1QCiuRYaIZ995p+4+KiiCnlBzG8jup8EeNBjGtWUvIBuJd1QZZeqrtwxkI/Dzn6/F4zABd6G4urGocOjzUJjaXFhFR4zQtXxs1OyAZiFfAG4x//aRf7MJx/oOpCyHcKuqGlSG5UnPRO4DZePIlmsKQ+QZJfO+5liJ/2XZ2yANY65E30he3bUabE/NpUJzrazizawdxzveaUaAkkkgSXxD5cCe+KR5G/OMWUwy01PNRX1A== Received: from DM3PR08CA0011.namprd08.prod.outlook.com (2603:10b6:0:52::21) by MN2PR12MB3648.namprd12.prod.outlook.com (2603:10b6:208:c1::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.38; Wed, 5 May 2021 12:23:52 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:0:52:cafe::f) by DM3PR08CA0011.outlook.office365.com (2603:10b6:0:52::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:51 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:23:49 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:13 +0300 Message-ID: <20210505122328.51129-3-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a7a6ff4-6ede-4a90-473d-08d90fc0a4a1 X-MS-TrafficTypeDiagnostic: MN2PR12MB3648: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4HoCR+yPLGt+t13JR5NNQPntyR9jrgkLCyF3E6pymomCtDYnaAuAVhtxlzHV67WzMtymj02fc5kVAxouii2ICgZrCqXySq4/ANlW/oPH8aeDYufELlC7xvjycIskxWi9whYeP5BpB/0h7e56o3IIpyIWnRUdb9wc4+WSnFIH/RsdV5fZjgC9rILYCDcWVmWrnHCCXg+foRvNmk6OOLzttiVKXP62Jp8/0XllxL7ZidwOiRTkDlocvdQJBPbTKD+iy8DOgtMgJTacYUycyCQzBhFdNu82hUUf4flNnpZOD5lS4OfyXRdp9drn6T7u5YYb6sb6d8UNTpkc1Ca5GAElHSMUlNF6i2DepTj/Ml3WQLQk0NDeg45IZHheGqELXTPWU9Egidfe5mOw6C3hY7uuMbvo/+hQbEkCd21PFLhIWgjHwwhq3GzD5tnpTeF/mF8ELlcFyXQnEYuhWA8kssSPyoL0qN/BZG0qMM0hpXVcdnpSGlQ865qP0HI8wLx5JmammTnOe4Y2rPnFk0EslfqeTp/TU/B+bjdZydNEVDkMe3E+zti4XuDGn10RwHxXolbNTxsgxalie4QTDiL1wi5Zpvma5OOR9XNgLNAbRLDX/41JZs8/mguQdp+9UpwMkSdGpbPdCVK0GaH6LhzvwNVJrtV8gputmQuZcCw64VQcyfg= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(346002)(39860400002)(36840700001)(46966006)(36860700001)(4326008)(478600001)(8936002)(70206006)(336012)(7696005)(6666004)(7636003)(356005)(2616005)(5660300002)(110136005)(26005)(82740400003)(6286002)(16526019)(54906003)(1076003)(8676002)(316002)(55016002)(107886003)(36756003)(36906005)(426003)(82310400003)(83380400001)(70586007)(2906002)(47076005)(186003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:51.8387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a7a6ff4-6ede-4a90-473d-08d90fc0a4a1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3648 Subject: [dpdk-dev] [PATCH v7 02/17] common/mlx5: add CT offload capability checking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" During startup, the ASO connection tracking offload capability could be queried via HCA_CAP_QUERY command. If the HW doesn't support ASO CT, the value would be 0 by default. The following initialization should be skipped and the creation of the CT object should return a failure directly. The following CT creation should also check this capability. With the old driver, the pre-processing macro should be used in order to make the compiling pass. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 3 +++ 4 files changed, 9 insertions(+) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 3334bd5cb2..007834a49b 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -189,6 +189,8 @@ has_sym_args = [ 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], [ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h', 'mlx5dv_dump_dr_rule' ], + [ 'HAVE_MLX5_DR_ACTION_ASO_CT', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ], ] config = configuration_data() foreach arg:has_sym_args diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 1b54c05313..7a0efa59e5 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -783,6 +783,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, MLX5_GET(cmd_hca_cap, hcattr, umr_indirect_mkey_disabled); attr->umr_modify_entity_size_disabled = MLX5_GET(cmd_hca_cap, hcattr, umr_modify_entity_size_disabled); + attr->ct_offload = !!(MLX5_GET64(cmd_hca_cap, hcattr, + general_obj_types) & + MLX5_GENERAL_OBJ_TYPES_CAP_CONN_TRACK_OFFLOAD); if (attr->qos.sup) { MLX5_SET(query_hca_cap_in, in, op_mod, MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP | diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index 5681e03fee..e6f9b90293 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -137,6 +137,7 @@ struct mlx5_hca_attr { uint32_t qp_ts_format:2; uint32_t regex:1; uint32_t reg_c_preserve:1; + uint32_t ct_offload:1; /* General obj type ASO CT offload supported. */ uint32_t regexp_num_of_engines; uint32_t log_max_ft_sampler_num:8; uint32_t geneve_tlv_opt; diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 683ab40338..b385b6f518 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1139,6 +1139,8 @@ enum { (1ULL << MLX5_GENERAL_OBJ_TYPE_FLOW_METER_ASO) #define MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT \ (1ULL << MLX5_OBJ_TYPE_GENEVE_TLV_OPT) +#define MLX5_GENERAL_OBJ_TYPES_CAP_CONN_TRACK_OFFLOAD \ + (1ULL << MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD) enum { MLX5_HCA_CAP_OPMOD_GET_MAX = 0, @@ -2487,6 +2489,7 @@ enum { MLX5_GENERAL_OBJ_TYPE_FLEX_PARSE_GRAPH = 0x0022, MLX5_GENERAL_OBJ_TYPE_FLOW_METER_ASO = 0x0024, MLX5_GENERAL_OBJ_TYPE_FLOW_HIT_ASO = 0x0025, + MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD = 0x0031, }; struct mlx5_ifc_general_obj_in_cmd_hdr_bits { From patchwork Wed May 5 12:23:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92918 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 378BDA0524; Wed, 5 May 2021 14:24:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E0C384111D; Wed, 5 May 2021 14:23:57 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by mails.dpdk.org (Postfix) with ESMTP id 0F3EA4110D for ; Wed, 5 May 2021 14:23:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YNJz0M3SpQQ8zXzrF/sYht4z5GLL5TELUgxzi1/fEGa4B1ChIWalQuQkLlfl8X8KMqliZXJq7YIPslTvdI1nPVlTwg0MyTYI5NiyHYIGJcO/EcUcyfuzhktQPwCuafLixvGK+DZkvy9y5N3oTvu1ehQ9TbddjzMoJ1KO+UL7d50YwgXBmThNkaJMQbLIPm+9KI3i0l0rBRJ/O5WZR6YqBwtLom7EyAcYqXo07pN6KeSLwmVaBa/BREZm76/blwkAXMBVv5pVpzhHoLiHMvhN77jyVtXsmoN93BagS/aLkTRg2fpRvvhOZrO049LEyglurIIa7nvz7qPtyb88Rsy9Eg== 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-SenderADCheck; bh=+gk1nVDax2w47lIPGJGwgzkAOPkF2za5WTb0fHiwARY=; b=Jy/+JxVGYnkyLtOIk4zsF/Rv89GQ0VgLz1M4ieSyi5PxZVcCVEVsVkCvMdrXuspdht2zQ3c/UgAvrsMEoDnKpprGNhbiDTFQjHTqTcr3TMR+Gbly3apAMnd8qmoK8AFYAyoBL0KFt5r3asMZckuT+MTVCVhRnbbVJ/gmOIGiepzB73hxUVZ672zXlI2g3tuOPMvfL8CN+lMyzMsrRLmCxll6mDEjrfJt+8BkBwiWKfm5ZOFivR7E/Rh6+5TUv5CnXVKnhD8YwoMxwU6OtS9OHFf18KKoBZVaqLFJITNSSM/zuZlljxt89VLSrPEMPcQlUoyhdnni751PnkkNm4rVNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=+gk1nVDax2w47lIPGJGwgzkAOPkF2za5WTb0fHiwARY=; b=LKmiOh3TWdfoFncm01Hvvb0Si7L9ShRuvxc0jJBXn/Ag1I0/RQZeOpGLUembBfqHGRq40wMyp2NK38YpZNA1Guu76b9OOiS7OG77GxaqB3+RUG3KC27UbdSQ+xwIU14jziPM993wx3c90BApUfgmK05VYXVQXjJNxD9uSEiCC4RMHdbV6BPi45b4USteuEicWkH+3vi2wUWVsdAWhopTkXzDh5gjwHs1h033xhLcmGSWHFrjfUxvlvzBcpJNYM8ECUkG/wjCUFi4P79W5/qe1lO2QxeYvo7u4h1q4dT39sSLvT0H08CEz8a6uCW+bMPt0uVxxPH1eWHSyBgyiF1w0A== Received: from DM6PR07CA0055.namprd07.prod.outlook.com (2603:10b6:5:74::32) by MWHPR12MB1486.namprd12.prod.outlook.com (2603:10b6:301:10::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.44; Wed, 5 May 2021 12:23:53 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:5:74:cafe::87) by DM6PR07CA0055.outlook.office365.com (2603:10b6:5:74::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:53 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:23:51 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:14 +0300 Message-ID: <20210505122328.51129-4-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f72accfa-1585-4c60-5eeb-08d90fc0a5ab X-MS-TrafficTypeDiagnostic: MWHPR12MB1486: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8hyYVv6vJMY5dFgIOxH12AqPgL3j0D9Q1szr0jrp4X4CmR94erGbXjEZqxJAAw1FKud6DOhrPtyVqLJEKO9vvV6AgSUj0JZD3Fgz4Xa4zJP5GIk3B4rSBieL3LXWNejdVYDIZNQVE8Ra4HYS9VKwl+otnDhnq2rKioBbMEpyRld8qm3Sxe8ckQsai9E8LtkkLd5Jd0/VipPZSHs9QfeS9P9bQOqq6R3Vz157Y02IOmQR2gYBfZhogqUzheAukXCE8XOvJv/eXVEX0IijY1RJUmlbHubAD8XzrBxnrG8UhxyOMDX7r9rKwO7ieFLeU2a38WJIXGsgh4hdtrHf/vk73fe6ryuyRnte21SYbqf3zt8o8tJ3sgLjNU42FfEZ2f8azUIhxvWJsYg4W2xqh/Pu9erZ+MNvbazsiZ4rlIYPssW1haYyUaMt+kHik40W9c7FhvkuIf1aqtvMU7sNmMbklwATaJAN8i6lz96zmE1DskzDeSmHw6NzKWLBT6F3W0se7s4G7wBuq3k7zWdo0zG22JajyZhkFwGJBSeBr6CtJzxQWprmVBH3yxgDBxIG807JDNWbMjmsxMsWdg6WJ+pBevPP1Mp7kHCMXkMMAIQZK61G8tusgh2JeSxxxxbzTXDdXGqrtREDWkdxwXLTyNPTJ/WHuo3jj83JHuKAiDAMozY= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(346002)(396003)(136003)(39860400002)(46966006)(36840700001)(1076003)(4326008)(36756003)(70206006)(83380400001)(47076005)(2616005)(8936002)(7696005)(186003)(7636003)(26005)(356005)(70586007)(316002)(8676002)(86362001)(6666004)(54906003)(478600001)(82310400003)(55016002)(110136005)(2906002)(5660300002)(36860700001)(16526019)(36906005)(6286002)(107886003)(336012)(82740400003)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:53.6105 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f72accfa-1585-4c60-5eeb-08d90fc0a5ab X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1486 Subject: [dpdk-dev] [PATCH v7 03/17] net/mlx5: use meter color reg for CT X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Based on the capacity, 3 registers could be used. Due to the register allocation, only the one REG_C_3 for meter color could be reused right now. Then in the same flow, no more than one ASO action can be supported. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 4 +++- drivers/net/mlx5/mlx5_flow.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a9c0108ee3..65399cd452 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -760,7 +760,9 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev, return priv->mtr_color_reg != REG_C_2 ? REG_C_2 : REG_C_3; case MLX5_MTR_COLOR: - case MLX5_ASO_FLOW_HIT: /* Both features use the same REG_C. */ + case MLX5_ASO_FLOW_HIT: + case MLX5_ASO_CONNTRACK: + /* All features use the same REG_C. */ MLX5_ASSERT(priv->mtr_color_reg != REG_NON); return priv->mtr_color_reg; case MLX5_COPY_MARK: diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 0fb8f64474..402c829843 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -85,6 +85,7 @@ enum mlx5_feature_name { MLX5_MTR_COLOR, MLX5_MTR_ID, MLX5_ASO_FLOW_HIT, + MLX5_ASO_CONNTRACK, }; /* Default queue number. */ From patchwork Wed May 5 12:23:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92919 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BCC63A0524; Wed, 5 May 2021 14:24:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FA0241129; Wed, 5 May 2021 14:23:59 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2046.outbound.protection.outlook.com [40.107.220.46]) by mails.dpdk.org (Postfix) with ESMTP id 782474110D for ; Wed, 5 May 2021 14:23:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YOkvEcG5EF4CeYCxH1deUrgcFpNnnxleinpo83GyKjOOuh4sqv0/zyF8QZxjXr9PkPL+BCDBLxPOtRuZTsmTez1Bg3C6YQsN/0FvV9JDXczeKX6kzlQYzC91cTiDL2WjyzdAB32u03ylDNYYcYAOw5vEWU3h91qv04ox3bWQEcwO1mEFr62SYbhD6F4L9EfrCscTTACpTNdJCOmH1IdXLd/PR3JEX6Egs+wA/+gItMDDnfaikYO/aoYsXjjctjnQqGDjYD1FVWIK5RAHjSaUbVYU2x/C4auB4+Y5H+PzKRrcX/kH4utcmAtxU3xyXN5drCYAqtO64IzVgAycHf80SQ== 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-SenderADCheck; bh=TsCBYo9P6UfIDv6dfy6Lu17+EvfOzpWRCC6kICxrV+Y=; b=f+s1Zu/NWa6mbjhCHy3f9RzD/1/ratumIIrj4tIvdRzu4NC4hWgjlVw97uL3wDWpMcpmxUovXAZ0Z87Y7VCgz16rGvM1u2bA/2XjdmHMcfo3wtk31odjYwkx3nr7WXrjYpGwgnm+f+bbdAuHlnVrFYY5JSbWUvIReqaBZzZbeCnMh8HFvoKZRfTjF/ReMWxfSl7q9vQaMMmrH89l+7LL/ya4eSrU6hezK/iOIFlYx2t5Zh6O1p9OEABGdw57qD3RavGfT9GAuvDsC1OPpP+/4MI/Zfu5iTBIAALWV5VoCr4xV5v3XxYbm6SljAx6gmYgijxSdj+vuUQ4AHHq+mJq2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=TsCBYo9P6UfIDv6dfy6Lu17+EvfOzpWRCC6kICxrV+Y=; b=kuplGo70SNQRDgS1QA2C/ENciBs5MqKu0J2kmCpAYiiYid52kuQ9pdnbPymKILZF6Rk4+Qe23g6oOWe6JO1lRRzdScyQwX5ejGxDiZyFWEnDjALPDymJWrQxF08VBUOLBUc/LBCDvhUhHOD3JD+6+PnKgrSDHj+fGWNRghrlY1/mTmqRByvDgwO9rebKpyHUJ+AXVt5e5h0YTiODrA4G/3VU2YCrYx8kuuwIev32Pzld+SN0/ekngwTQ5cCNIIBBpvJY9QbYsJyjM435Y1+OINLizFSlDUXzyzXIqLhk5emsmDWAOqwtDQ1XMsNqvprt5Web40UEjCTU9C7fzuraxQ== Received: from DM5PR13CA0029.namprd13.prod.outlook.com (2603:10b6:3:7b::15) by DM6PR12MB3657.namprd12.prod.outlook.com (2603:10b6:5:149::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.40; Wed, 5 May 2021 12:23:55 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:3:7b:cafe::cd) by DM5PR13CA0029.outlook.office365.com (2603:10b6:3:7b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.8 via Frontend Transport; Wed, 5 May 2021 12:23:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:55 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:23:53 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:15 +0300 Message-ID: <20210505122328.51129-5-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef5d64e4-1c57-4eed-0e68-08d90fc0a6f0 X-MS-TrafficTypeDiagnostic: DM6PR12MB3657: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WmJ1wCbxEANB5Pv6x1GGD847vuGu2dF5d7wU3LTJVFpPfTA2K4NQphj/Tw7no0dlB1luQNcgrhlDBUahWINSX9S6edhRCruXELupxqPIPWaKCIY4NcbLcammF3wU96DJpNQ07t7ky1HeokGzALconyyIegc27J7Ztrp0F1gBSQJF4KAIxn6MzxoJAUyvDoMk3A7vdpm8Egd/CONQp0YyxlPw1qru8SuCyL49RbKh+po6r6N6xMy9DIGaQtJegio7TvtFFkGmTT6D2SFss5ZN3b2JZ8GG9uzO3+rOo7GkcFAPuI3m0Yhuk7KPuG54FsjEseQcePjGvw3GSS90V8XveXBSuNs8V51bTrxIIBp9YRD1rcmyHI8k2Fg1JUMCQGA5ZJxClpgzN+7vS7xP8eBG4JWmzfEOL7BdD7VhkwqjuJAtOQDI7zkWeGSGjK+d/JoWG2MyNCp7O2tdET1EBMC/9elqOW/XArX9+EWlW1G9d9oQUtNhAakvvwPdkF6P3BS3IunQq9pJFZRbSLDdY0FZpX9W5tt+uDPZH64IQkVP/fapitB++3pcWsIvLRoTbEYMF75VILQNsgIMNQBU+WJWVqWRPhEH8q02IAKIT3D1QmHohy3ZnOJ0qN2dMFquGzqRMxgO7yHVD3krXS0Q2utaSYEVrZrNfToACffS6GJR+b4= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(346002)(376002)(36840700001)(46966006)(356005)(7636003)(83380400001)(82310400003)(4326008)(5660300002)(36860700001)(2906002)(82740400003)(426003)(478600001)(107886003)(47076005)(8936002)(6286002)(55016002)(26005)(16526019)(36756003)(186003)(110136005)(316002)(7696005)(36906005)(8676002)(54906003)(86362001)(1076003)(70586007)(70206006)(336012)(2616005)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:55.6944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef5d64e4-1c57-4eed-0e68-08d90fc0a6f0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3657 Subject: [dpdk-dev] [PATCH v7 04/17] net/mlx5: initialization of CT management X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The definitions of ASO connection tracking objects management structures are added. Considering performance, the bulk allocation of ASO CT objects should be used. The maximal value per bulk and the granularity could be fetched from HCA capabilities 2. Right now, a fixed number of 64 is used for each bulk for a better management purpose. The ASO QP for CT is initialized, the SQ will be used for both modify and query command. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_os.c | 13 +++++++++ drivers/net/mlx5/mlx5.c | 36 +++++++++++++++++++++++ drivers/net/mlx5/mlx5.h | 50 ++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_aso.c | 50 ++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 479ee7d8d1..5ac787106d 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1323,6 +1323,19 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, DRV_LOG(DEBUG, "Flow Hit ASO is supported."); } #endif /* HAVE_MLX5_DR_CREATE_ACTION_ASO */ +#if defined(HAVE_MLX5_DR_CREATE_ACTION_ASO) && \ + defined(HAVE_MLX5_DR_ACTION_ASO_CT) + if (config->hca_attr.ct_offload && + priv->mtr_color_reg == REG_C_3) { + err = mlx5_flow_aso_ct_mng_init(sh); + if (err) { + err = -err; + goto error; + } + DRV_LOG(DEBUG, "CT ASO is supported."); + sh->ct_aso_en = 1; + } +#endif /* HAVE_MLX5_DR_CREATE_ACTION_ASO && HAVE_MLX5_DR_ACTION_ASO_CT */ #if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE) if (config->hca_attr.log_max_ft_sampler_num > 0 && config->dv_flow_en) { diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 912b6a33b4..7e83d09fec 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -672,6 +672,42 @@ mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh) } } +/* + * Initialize the ASO connection tracking structure. + * + * @param[in] sh + * Pointer to mlx5_dev_ctx_shared object. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_flow_aso_ct_mng_init(struct mlx5_dev_ctx_shared *sh) +{ + int err; + + if (sh->ct_mng) + return 0; + sh->ct_mng = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*sh->ct_mng), + RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY); + if (!sh->ct_mng) { + DRV_LOG(ERR, "ASO CT management allocation failed."); + rte_errno = ENOMEM; + return -rte_errno; + } + err = mlx5_aso_queue_init(sh, ASO_OPC_MOD_CONNECTION_TRACKING); + if (err) { + mlx5_free(sh->ct_mng); + /* rte_errno should be extracted from the failure. */ + rte_errno = EINVAL; + return -rte_errno; + } + rte_spinlock_init(&sh->ct_mng->ct_sl); + rte_rwlock_init(&sh->ct_mng->resize_rwl); + LIST_INIT(&sh->ct_mng->free_cts); + return 0; +} + /** * Initialize the flow resources' indexed mempool. * diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index b042f37231..0ff7b8c2bc 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -988,6 +988,52 @@ struct mlx5_bond_info { } ports[MLX5_BOND_MAX_PORTS]; }; +/* Number of connection tracking objects per pool: must be a power of 2. */ +#define MLX5_ASO_CT_ACTIONS_PER_POOL 64 + +/* ASO Conntrack state. */ +enum mlx5_aso_ct_state { + ASO_CONNTRACK_FREE, /* Inactive, in the free list. */ + ASO_CONNTRACK_WAIT, /* WQE sent in the SQ. */ + ASO_CONNTRACK_READY, /* CQE received w/o error. */ + ASO_CONNTRACK_QUERY, /* WQE for query sent. */ + ASO_CONNTRACK_MAX, /* Guard. */ +}; + +/* Generic ASO connection tracking structure. */ +struct mlx5_aso_ct_action { + LIST_ENTRY(mlx5_aso_ct_action) next; /* Pointer to the next ASO CT. */ + void *dr_action_orig; /* General action object for original dir. */ + void *dr_action_rply; /* General action object for reply dir. */ + uint32_t refcnt; /* Action used count in device flows. */ + uint16_t offset; /* Offset of ASO CT in DevX objects bulk. */ + uint16_t peer; /* The only peer port index could also use this CT. */ + enum mlx5_aso_ct_state state; /* ASO CT state. */ + bool is_original; /* The direction of the DR action to be used. */ +}; + +/* ASO connection tracking software pool definition. */ +struct mlx5_aso_ct_pool { + uint16_t index; /* Pool index in pools array. */ + struct mlx5_devx_obj *devx_obj; + /* The first devx object in the bulk, used for freeing (not yet). */ + struct mlx5_aso_ct_action actions[MLX5_ASO_CT_ACTIONS_PER_POOL]; + /* CT action structures bulk. */ +}; + +LIST_HEAD(aso_ct_list, mlx5_aso_ct_action); + +/* Pools management structure for ASO connection tracking pools. */ +struct mlx5_aso_ct_pools_mng { + struct mlx5_aso_ct_pool **pools; + uint16_t n; /* Total number of pools. */ + uint16_t next; /* Number of pools in use, index of next free pool. */ + rte_spinlock_t ct_sl; /* The ASO CT free list lock. */ + rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */ + struct aso_ct_list free_cts; /* Free ASO CT objects list. */ + struct mlx5_aso_sq aso_sq; /* ASO queue objects. */ +}; + /* * Shared Infiniband device context for Master/Representors * which belong to same IB device with multiple IB ports. @@ -1001,6 +1047,7 @@ struct mlx5_dev_ctx_shared { uint32_t sq_ts_format:2; /* SQ timestamp formats supported. */ uint32_t qp_ts_format:2; /* QP timestamp formats supported. */ uint32_t meter_aso_en:1; /* Flow Meter ASO is supported. */ + uint32_t ct_aso_en:1; /* Connection Tracking ASO is supported. */ uint32_t max_port; /* Maximal IB device port index. */ struct mlx5_bond_info bond; /* Bonding information. */ void *ctx; /* Verbs/DV/DevX context. */ @@ -1063,6 +1110,8 @@ struct mlx5_dev_ctx_shared { rte_spinlock_t geneve_tlv_opt_sl; /* Lock for geneve tlv resource */ struct mlx5_flow_mtr_mng *mtrmng; /* Meter management structure. */ + struct mlx5_aso_ct_pools_mng *ct_mng; + /* Management data for ASO connection tracking. */ struct mlx5_dev_shared_port port[]; /* per device port data array. */ }; @@ -1360,6 +1409,7 @@ bool mlx5_flex_parser_ecpri_exist(struct rte_eth_dev *dev); int mlx5_flex_parser_ecpri_alloc(struct rte_eth_dev *dev); int mlx5_flow_aso_age_mng_init(struct mlx5_dev_ctx_shared *sh); int mlx5_aso_flow_mtrs_mng_init(struct mlx5_dev_ctx_shared *sh); +int mlx5_flow_aso_ct_mng_init(struct mlx5_dev_ctx_shared *sh); /* mlx5_ethdev.c */ diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 300987d0e9..9f2d21b375 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -186,6 +186,43 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq) } } +/* + * Initialize Send Queue used for ASO connection tracking. + * + * @param[in] sq + * ASO SQ to initialize. + */ +static void +mlx5_aso_ct_init_sq(struct mlx5_aso_sq *sq) +{ + volatile struct mlx5_aso_wqe *restrict wqe; + int i; + int size = 1 << sq->log_desc_n; + uint64_t addr; + + /* All the next fields state should stay constant. */ + for (i = 0, wqe = &sq->sq_obj.aso_wqes[0]; i < size; ++i, ++wqe) { + wqe->general_cseg.sq_ds = rte_cpu_to_be_32((sq->sqn << 8) | + (sizeof(*wqe) >> 4)); + /* One unique MR for the query data. */ + wqe->aso_cseg.lkey = rte_cpu_to_be_32(sq->mr.lkey); + /* Magic number 64 represents the length of a ASO CT obj. */ + addr = (uint64_t)((uintptr_t)sq->mr.addr + i * 64); + wqe->aso_cseg.va_h = rte_cpu_to_be_32((uint32_t)(addr >> 32)); + wqe->aso_cseg.va_l_r = rte_cpu_to_be_32((uint32_t)addr | 1u); + /* + * The values of operand_masks are different for modify + * and query. + * And data_mask may be different for each modification. In + * query, it could be zero and ignored. + * CQE generation is always needed, in order to decide when + * it is available to create the flow or read the data. + */ + wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS << + MLX5_COMP_MODE_OFFSET); + } +} + /** * Create Send Queue used for ASO access. * @@ -293,6 +330,19 @@ mlx5_aso_queue_init(struct mlx5_dev_ctx_shared *sh, return -1; mlx5_aso_mtr_init_sq(&sh->mtrmng->pools_mng.sq); break; + case ASO_OPC_MOD_CONNECTION_TRACKING: + /* 64B per object for query. */ + if (mlx5_aso_reg_mr(sh, 64 * sq_desc_n, + &sh->ct_mng->aso_sq.mr, 0)) + return -1; + if (mlx5_aso_sq_create(sh->ctx, &sh->ct_mng->aso_sq, 0, + sh->tx_uar, sh->pdn, MLX5_ASO_QUEUE_LOG_DESC, + sh->sq_ts_format)) { + mlx5_aso_dereg_mr(sh, &sh->ct_mng->aso_sq.mr); + return -1; + } + mlx5_aso_ct_init_sq(&sh->ct_mng->aso_sq); + break; default: DRV_LOG(ERR, "Unknown ASO operation mode"); return -1; From patchwork Wed May 5 12:23:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92920 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B832A0524; Wed, 5 May 2021 14:24:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D084941135; Wed, 5 May 2021 14:24:00 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2078.outbound.protection.outlook.com [40.107.237.78]) by mails.dpdk.org (Postfix) with ESMTP id C27A441120 for ; Wed, 5 May 2021 14:23:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BDh6xThsbyWapRpwCLz9HYnYM3UCv0+mNQ77EJ9S3gzjnvR3qGyrYcB5J0W5Jw7kdGrxbXbsNtcsef1uNiuWw0qK6g8VPfEKnaz7ZjFNcu0/xHc1LYNcdr+HPenV6Y//Vsm7Hkja1eIt+4PR5h19EoHMLWJjKjG/2Q//7PZzcc/RqvrlJs64+y6FKp/VZp/zTqRwzoWTVmdOzDmRTXVZhfAfd7DGDaM1NgQ9bzjr1QW6D+WZUrxiZc3KAivLsSf+5jpgcOxhG9kAuVTdH46GzPRbqjSB3LvXF5QakJRi9ImzSFC9BgjpvhM5Itams7oopU39Q2IaVtqf7PqegucbTw== 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-SenderADCheck; bh=an5YxhzxRm3Qtxr76My3oa8waHb03K/w4AsPOd5XtUg=; b=LNQvRM/8M9stxRAF5ZtntBWm+k6mz29cmtuIz2E/nQKenFW0MJRHJVk1qSteXWWw8dPdgNXKE+vgpeW2CKuaVOcv8VASlEekPyoN8KklImjmfrNciKMMbOOOkrgbAEK2loIbkvUJsxL9psptx+13/S9ImIrEWQ76XW6i+kNK5T2dPDr8U5QvjyvReZ9DG4K6Sq97V8HIFkbqWgycbou82tZ9xYI18+nm04/0tum6EmmP9lIDjLz76AQeO7sGHpCckmxv3g4IJ+vRP8c2VWlZgYqpRmLhgcsS2rrsqHQjDNyXUQS7rkkUlBaJZThNf8LsYiNLQJUI0VF49wXn+6LPkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=an5YxhzxRm3Qtxr76My3oa8waHb03K/w4AsPOd5XtUg=; b=f0KJw22D7/J88r30hSGzLaHYJ6YinHy8Fr1SnPYu+WOKWjdn6ZSDf45wYXsPrUEGLPbxjflNK9EBThp8q4enRejs+hCZy0SKpwPn1dP/FsSRuOFn5ASRedENJyp7P3e+bNQi3w85iyBf94QUGvE7x/hxo1VxNFMyYsJbtSMn2d12sJMf59hbhxtYpckRQuMyMYFo4yK/Uqk2udYcWV+TByEsUJPjQ5el81xRX7MAbdqDfCYLw/emaKnI8cKjOzeV0hUozS9Z77PFme1A/zDlATG7B8Gr+lzT6qlaXBigKBZFcJXJO79H4rTKPi5wHSpyLzstTrHsSEbrzVxWPHFSuQ== Received: from DM6PR01CA0012.prod.exchangelabs.com (2603:10b6:5:296::17) by DM4PR12MB5088.namprd12.prod.outlook.com (2603:10b6:5:38b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.26; Wed, 5 May 2021 12:23:58 +0000 Received: from DM6NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::a9) by DM6PR01CA0012.outlook.office365.com (2603:10b6:5:296::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT011.mail.protection.outlook.com (10.13.172.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:57 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:23:55 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:16 +0300 Message-ID: <20210505122328.51129-6-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 759446c3-965e-4e5e-981e-08d90fc0a82d X-MS-TrafficTypeDiagnostic: DM4PR12MB5088: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OuJZ2Em5KC3RfCY4s4+OSDFCyneqMlh0Tb/sHysgJDxHMrpRG7QOv73xkD8duD4iDZHuBoUETlD5r8B/rTzHG+GNOnq6V10W4Odo4UFvZQNjA2cYBabQMnqbc4FgMADFp5A2cLyglDiyBo3j4iMiljwPQ0W6gpWEcf2oJcaG6vb5VW3TB6z7y6yQfaYbcG5GZuSuRP+3g9C1we3PONA2AhDOAtNSjMOaDGYxcw9rv7LlYI/vsVNH6rucILeeDARLY+4XmQ/7XtjwsL8c7aMnmQ8Wtbr2Yep6RXT3vkzHz/KTM05AYqR634Yg+N04uQEg5YmNLlDCdoQHAQGuqDfCOQaGbV6PfbFzIkDsdPBimDw1xiXUK3N4oFxSa8M3im1aHV7wf42Z/IW2Ku0zeozyr5Sy6k0z8W8Q5T/L4kIyqbsLlQhGUx5v32fzplNYW9L6JI7pGNwRPT7x2NTTkVyEaCOOBNqaVQ3Q7IS2NgY/FH/4Ir4I2mzat8ExxselLLs7UDhFVIF6xeUoug+TFMozlG/c81+8cNhCiYdibzcl2kGwcWm1xl3KjG9B0gPOHRjkxsE7tYoyGykAgTCxFUjmn3eLwT03Uq/1CZpwT3e5BpSpUO9KfHLOBVVk6oSAuqp2+A93LIAoWGpN1zw4Mc188eWOORi1U+bQHZzU43lgqvA= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(396003)(346002)(46966006)(36840700001)(1076003)(316002)(478600001)(2906002)(82740400003)(356005)(5660300002)(7636003)(6286002)(36756003)(426003)(110136005)(8676002)(4326008)(8936002)(82310400003)(186003)(7696005)(26005)(16526019)(47076005)(36860700001)(55016002)(2616005)(54906003)(6666004)(70206006)(86362001)(70586007)(36906005)(107886003)(83380400001)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:57.8244 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 759446c3-965e-4e5e-981e-08d90fc0a82d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5088 Subject: [dpdk-dev] [PATCH v7 05/17] common/mlx5: add Dexv CT objects creation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding support for connection tracking ASO creation via Devx command. Right now only bulk creation is supported. By default, the objects with zero contents will be created. Before using a single object, the modification via posting a WQE to the ASO CT SQ is needed. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/mlx5_devx_cmds.c | 50 ++++++++++++++++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 4 +++ drivers/common/mlx5/version.map | 1 + 3 files changed, 55 insertions(+) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 7a0efa59e5..3f89796eb4 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -2255,6 +2255,56 @@ mlx5_devx_cmd_create_flow_meter_aso_obj(void *ctx, uint32_t pd, return flow_meter_aso_obj; } +/* + * Create general object of type CONN_TRACK_OFFLOAD using DevX API. + * + * @param[in] ctx + * Context returned from mlx5 open_device() glue function. + * @param [in] pd + * PD value to associate the CONN_TRACK_OFFLOAD ASO object with. + * @param [in] log_obj_size + * log_obj_size to allocate its power of 2 * objects + * in one CONN_TRACK_OFFLOAD bulk allocation. + * + * @return + * The DevX object created, NULL otherwise and rte_errno is set. + */ +struct mlx5_devx_obj * +mlx5_devx_cmd_create_conn_track_offload_obj(void *ctx, uint32_t pd, + uint32_t log_obj_size) +{ + uint32_t in[MLX5_ST_SZ_DW(create_conn_track_aso_in)] = {0}; + uint32_t out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)]; + struct mlx5_devx_obj *ct_aso_obj; + void *ptr; + + ct_aso_obj = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*ct_aso_obj), + 0, SOCKET_ID_ANY); + if (!ct_aso_obj) { + DRV_LOG(ERR, "Failed to allocate CONN_TRACK_OFFLOAD object."); + rte_errno = ENOMEM; + return NULL; + } + ptr = MLX5_ADDR_OF(create_conn_track_aso_in, in, hdr); + MLX5_SET(general_obj_in_cmd_hdr, ptr, opcode, + MLX5_CMD_OP_CREATE_GENERAL_OBJECT); + MLX5_SET(general_obj_in_cmd_hdr, ptr, obj_type, + MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD); + MLX5_SET(general_obj_in_cmd_hdr, ptr, log_obj_range, log_obj_size); + ptr = MLX5_ADDR_OF(create_conn_track_aso_in, in, conn_track_offload); + MLX5_SET(conn_track_offload, ptr, conn_track_aso_access_pd, pd); + ct_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), + out, sizeof(out)); + if (!ct_aso_obj->obj) { + rte_errno = errno; + DRV_LOG(ERR, "Failed to create CONN_TRACK_OFFLOAD obj by using DevX."); + mlx5_free(ct_aso_obj); + return NULL; + } + ct_aso_obj->id = MLX5_GET(general_obj_out_cmd_hdr, out, obj_id); + return ct_aso_obj; +} + /** * Create general object of type GENEVE TLV option using DevX API. * diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index e6f9b90293..58dc123778 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -570,6 +570,10 @@ struct mlx5_devx_obj *mlx5_devx_cmd_queue_counter_alloc(void *ctx); __rte_internal int mlx5_devx_cmd_queue_counter_query(struct mlx5_devx_obj *dcs, int clear, uint32_t *out_of_buffers); +__rte_internal +struct mlx5_devx_obj *mlx5_devx_cmd_create_conn_track_offload_obj(void *ctx, + uint32_t pd, uint32_t log_obj_size); + /** * Create general object of type FLOW_METER_ASO using DevX API.. * diff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map index 18dc96276d..4bbcba5b8e 100644 --- a/drivers/common/mlx5/version.map +++ b/drivers/common/mlx5/version.map @@ -13,6 +13,7 @@ INTERNAL { mlx5_dev_to_pci_addr; # WINDOWS_NO_EXPORT mlx5_devx_cmd_alloc_pd; + mlx5_devx_cmd_create_conn_track_offload_obj; mlx5_devx_cmd_create_cq; mlx5_devx_cmd_create_flex_parser; mlx5_devx_cmd_create_qp; From patchwork Wed May 5 12:23:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92921 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C4ECA0524; Wed, 5 May 2021 14:24:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 168CD41120; Wed, 5 May 2021 14:24:04 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) by mails.dpdk.org (Postfix) with ESMTP id 9523E41120 for ; Wed, 5 May 2021 14:24:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gSbXde491Y2+152r8wcMBmBqiiMkT1O/+hWWJIgG592NhhN2guYsTsUNAS+w5K4sm4ZQ0qdcGLuIGdMoINp5glCt+gJ2rOHb905CqbJoT8L/gZXogjKoE2GjO8RkNvbMd71z4Y2Q2+cgShbTNN8wL0mpvdORMHV/FkA0Ne0ml84rDbU1d3wAB3rLhfDv47Vk9Ne/jW3FN7oQNDOGYOA+eBtclFY77WhyHHdP3u6MrsPtL1BidoavA6ZD/hSTEB6KtKq9scSGZGUviNn1QUCFrqHrxUJh2h0QoAOZUhCq4rEJd58SzC/Hw+Uh3NCG040IqL4dJy/c8hrTTcLh1Fpe5A== 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-SenderADCheck; bh=b5+Xy81XOEcZioYHxeeY+3FvXobIWeKfZmPIT4Fd5RI=; b=AXF3UpGXMYk2C5CzJkAj9mBbQ4qIgZdiZxOB5XH+TaRup2xLjjWLxz27trryf8ZY30SmyoEDZDVGub5SczTidXyu3lx493smhviBx4WvU8T9l2s5L19XMCoARnqmx078mtpu7qHAlN6i0f6GheSo4Bq8+32ZofR3Zbc0X5XefpzB8jE6lQZNga/VG/jt2asAEPIbkJ/Mb053bJPnykIqdsmjW4WB3p/8gvEhrN8Jd2UXXQ9gO2kC6KNcFKqfvA+xR5JCklsgrpLm7Uxp8y3W1HP0Hxj4S2VYGVJq8V8W1YIR9FLwq+j2OcRmm0kwwlJ4Eb1zWX4IMLfk4zp6T09ttA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=b5+Xy81XOEcZioYHxeeY+3FvXobIWeKfZmPIT4Fd5RI=; b=SK3HlFogDIo7/ibv6wWbJfYckARVWf0wgYH07q+jobg3yuRLRBqP0h1W8bSYi4z+Ka8Kn6320cYbW7FeyqMk569h1fM9aPTB/PrhyIvm983PNP/u7yeg14DnK3Q4UJfhBxofOuiU6Yamv6y+CEIRruZ8BCxEPeF1OBd73v5Z6Aj1a8EEaeF0CN10DX7JJAeovwn6klNBKXygV90WmsSF1YzTkGnt3bY+Y28pI30zubF9NXV1s5WRQO9Fnw9W4OnyqP0TgYmtvxB3Qx+pdNfP3U8QVIZ7mtTpk759UkwbqoveJWMPA1K2Ww34c3AvtHFVlxRokbaUmcI5ASJEb8Q90A== Received: from DS7PR03CA0233.namprd03.prod.outlook.com (2603:10b6:5:3ba::28) by CY4PR1201MB2487.namprd12.prod.outlook.com (2603:10b6:903:d0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.40; Wed, 5 May 2021 12:24:00 +0000 Received: from DM6NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ba:cafe::dc) by DS7PR03CA0233.outlook.office365.com (2603:10b6:5:3ba::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT054.mail.protection.outlook.com (10.13.173.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:23:59 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:23:57 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:17 +0300 Message-ID: <20210505122328.51129-7-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa0b6f39-82a0-4e5a-d20b-08d90fc0a960 X-MS-TrafficTypeDiagnostic: CY4PR1201MB2487: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:40; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1mpv77kxgcyT4A2PS1AqKk12nZS1YnbmfuneaOq1dx0ZroxZkSr8doLWw/ABjIv27Wu0QzRLNvVmxvyQ3C3prTtIKhcuc9A71g4S1J+Copge7QGSnaJPgFH5EGEKGqT7MYTWwTnHnTE6aAekfRErB2hxQg6ZBTv+rSXddijFL0VfXaIo5Jzac8VyG8oOfdC8nvRJ9dRTr/MDpFLuDT5gCK9NGvksB0beBQrA2ijcTa6tPqee9Ch09UNQRy7Jx6u978sJMfZYujw4BqBpQVw5E8Ig1NebL6tYfqC8emfIbpFGvX0alRJq5hR4cNQWOnbTVsy5xsddRTReiO1uhbU3J7Sqyb93xpl6k6mQLUfjB1a5DCgd/x5npmTKd3znzABLGKzjOTsfWiPuQCQrk2pWVgmerR9YD/FNarUpbJxPuaKTQpR9I7jTtmQXapvNW2XUG3Gr7WB9fh8/1F96Kl5P2BANcAydSqTEwu3lL/8lzd6p82u6KFMwLQpl18T7lDaBouE8h6zsYmW2BP17kdlIiEM0qrJHvSCuffryR7fZiR/GrWWBP4bWo0/e0Slj5mK2O+6Daevqc4QegNQ8goMS14ybGUqI2XhvR+DEx3WfhROl9XvouJVvDku9U6hXP00WVkbklNhJPOyaFWUxJPM17IJ8JYabcFqgWLCkIZS8V9w= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(39860400002)(346002)(396003)(136003)(46966006)(36840700001)(7636003)(83380400001)(36906005)(110136005)(7696005)(2616005)(82740400003)(47076005)(356005)(8936002)(36860700001)(54906003)(26005)(5660300002)(55016002)(186003)(16526019)(316002)(36756003)(426003)(1076003)(107886003)(70206006)(30864003)(336012)(86362001)(6666004)(478600001)(6286002)(8676002)(82310400003)(2906002)(70586007)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:59.8018 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa0b6f39-82a0-4e5a-d20b-08d90fc0a960 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB2487 Subject: [dpdk-dev] [PATCH v7 06/17] net/mlx5: add modify support for CT X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After the connection tracking object bulk is allocated, all the objects' contents are filled with zero by default. Every new-allocated object must be modified via WQE operation before it is used. In order to reduce the latency for the flow creation, an asynchronous way is used instead of busy waiting for the CQE to be generated. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 8 + drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_flow_aso.c | 252 +++++++++++++++++++++++++++++++ 3 files changed, 262 insertions(+) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 0ff7b8c2bc..96b5cccf19 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -493,6 +493,7 @@ struct mlx5_aso_sq_elem { uint16_t burst_size; }; struct mlx5_aso_mtr *mtr; + struct mlx5_aso_ct_action *ct; }; }; @@ -1012,6 +1013,10 @@ struct mlx5_aso_ct_action { bool is_original; /* The direction of the DR action to be used. */ }; +/* CT action object state update. */ +#define MLX5_ASO_CT_UPDATE_STATE(c, s) \ + __atomic_store_n(&((c)->state), (s), __ATOMIC_RELAXED) + /* ASO connection tracking software pool definition. */ struct mlx5_aso_ct_pool { uint16_t index; /* Pool index in pools array. */ @@ -1695,5 +1700,8 @@ int mlx5_aso_meter_update_by_wqe(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_mtr *mtr); int mlx5_aso_mtr_wait(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_mtr *mtr); +int mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + const struct rte_flow_action_conntrack *profile); #endif /* RTE_PMD_MLX5_H_ */ diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 402c829843..71b0871bcd 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -843,6 +843,8 @@ struct mlx5_flow { #define MLX5_ASO_WQE_CQE_RESPONSE_DELAY 10u #define MLX5_MTR_POLL_WQE_CQE_TIMES 100000u +#define MLX5_CT_POLL_WQE_CQE_TIMES MLX5_MTR_POLL_WQE_CQE_TIMES + #define MLX5_MAN_WIDTH 8 /* Legacy Meter parameter structure. */ struct mlx5_legacy_flow_meter { diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 9f2d21b375..fbf6e5ef38 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -887,3 +887,255 @@ mlx5_aso_mtr_wait(struct mlx5_dev_ctx_shared *sh, mtr->offset); return -1; } + +/* + * Post a WQE to the ASO CT SQ to modify the context. + * + * @param[in] mng + * Pointer to the CT pools management structure. + * @param[in] ct + * Pointer to the generic CT structure related to the context. + * @param[in] profile + * Pointer to configuration profile. + * + * @return + * 1 on success (WQE number), 0 on failure. + */ +static uint16_t +mlx5_aso_ct_sq_enqueue_single(struct mlx5_aso_ct_pools_mng *mng, + struct mlx5_aso_ct_action *ct, + const struct rte_flow_action_conntrack *profile) +{ + volatile struct mlx5_aso_wqe *wqe = NULL; + struct mlx5_aso_sq *sq = &mng->aso_sq; + uint16_t size = 1 << sq->log_desc_n; + uint16_t mask = size - 1; + uint16_t res; + struct mlx5_aso_ct_pool *pool; + void *desg; + void *orig_dir; + void *reply_dir; + + rte_spinlock_lock(&sq->sqsl); + /* Prevent other threads to update the index. */ + res = size - (uint16_t)(sq->head - sq->tail); + if (unlikely(!res)) { + rte_spinlock_unlock(&sq->sqsl); + DRV_LOG(ERR, "Fail: SQ is full and no free WQE to send"); + return 0; + } + wqe = &sq->sq_obj.aso_wqes[sq->head & mask]; + rte_prefetch0(&sq->sq_obj.aso_wqes[(sq->head + 1) & mask]); + /* Fill next WQE. */ + MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_WAIT); + sq->elts[sq->head & mask].ct = ct; + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + /* Each WQE will have a single CT object. */ + wqe->general_cseg.misc = rte_cpu_to_be_32(pool->devx_obj->id + + ct->offset); + wqe->general_cseg.opcode = rte_cpu_to_be_32(MLX5_OPCODE_ACCESS_ASO | + (ASO_OPC_MOD_CONNECTION_TRACKING << + WQE_CSEG_OPC_MOD_OFFSET) | + sq->pi << WQE_CSEG_WQE_INDEX_OFFSET); + wqe->aso_cseg.operand_masks = rte_cpu_to_be_32 + (0u | + (ASO_OPER_LOGICAL_OR << ASO_CSEG_COND_OPER_OFFSET) | + (ASO_OP_ALWAYS_TRUE << ASO_CSEG_COND_1_OPER_OFFSET) | + (ASO_OP_ALWAYS_TRUE << ASO_CSEG_COND_0_OPER_OFFSET) | + (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET)); + wqe->aso_cseg.data_mask = UINT64_MAX; + /* To make compiler happy. */ + desg = (void *)(uintptr_t)wqe->aso_dseg.data; + MLX5_SET(conn_track_aso, desg, valid, 1); + MLX5_SET(conn_track_aso, desg, state, profile->state); + MLX5_SET(conn_track_aso, desg, freeze_track, !profile->enable); + MLX5_SET(conn_track_aso, desg, connection_assured, + profile->live_connection); + MLX5_SET(conn_track_aso, desg, sack_permitted, profile->selective_ack); + MLX5_SET(conn_track_aso, desg, challenged_acked, + profile->challenge_ack_passed); + /* Heartbeat, retransmission_counter, retranmission_limit_exceeded: 0 */ + MLX5_SET(conn_track_aso, desg, heartbeat, 0); + MLX5_SET(conn_track_aso, desg, max_ack_window, + profile->max_ack_window); + MLX5_SET(conn_track_aso, desg, retransmission_counter, 0); + MLX5_SET(conn_track_aso, desg, retranmission_limit_exceeded, 0); + MLX5_SET(conn_track_aso, desg, retranmission_limit, + profile->retransmission_limit); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_scale, + profile->reply_dir.scale); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_close_initiated, + profile->reply_dir.close_initiated); + /* Both directions will use the same liberal mode. */ + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_liberal_enabled, + profile->liberal_mode); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_data_unacked, + profile->reply_dir.data_unacked); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_max_ack, + profile->reply_dir.last_ack_seen); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_scale, + profile->original_dir.scale); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_close_initiated, + profile->original_dir.close_initiated); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_liberal_enabled, + profile->liberal_mode); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_data_unacked, + profile->original_dir.data_unacked); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_max_ack, + profile->original_dir.last_ack_seen); + MLX5_SET(conn_track_aso, desg, last_win, profile->last_window); + MLX5_SET(conn_track_aso, desg, last_dir, profile->last_direction); + MLX5_SET(conn_track_aso, desg, last_index, profile->last_index); + MLX5_SET(conn_track_aso, desg, last_seq, profile->last_seq); + MLX5_SET(conn_track_aso, desg, last_ack, profile->last_ack); + MLX5_SET(conn_track_aso, desg, last_end, profile->last_end); + orig_dir = MLX5_ADDR_OF(conn_track_aso, desg, original_dir); + MLX5_SET(tcp_window_params, orig_dir, sent_end, + profile->original_dir.sent_end); + MLX5_SET(tcp_window_params, orig_dir, reply_end, + profile->original_dir.reply_end); + MLX5_SET(tcp_window_params, orig_dir, max_win, + profile->original_dir.max_win); + MLX5_SET(tcp_window_params, orig_dir, max_ack, + profile->original_dir.max_ack); + reply_dir = MLX5_ADDR_OF(conn_track_aso, desg, reply_dir); + MLX5_SET(tcp_window_params, reply_dir, sent_end, + profile->reply_dir.sent_end); + MLX5_SET(tcp_window_params, reply_dir, reply_end, + profile->reply_dir.reply_end); + MLX5_SET(tcp_window_params, reply_dir, max_win, + profile->reply_dir.max_win); + MLX5_SET(tcp_window_params, reply_dir, max_ack, + profile->reply_dir.max_ack); + sq->head++; + sq->pi += 2; /* Each WQE contains 2 WQEBB's. */ + rte_io_wmb(); + sq->sq_obj.db_rec[MLX5_SND_DBR] = rte_cpu_to_be_32(sq->pi); + rte_wmb(); + *sq->uar_addr = *(volatile uint64_t *)wqe; /* Assume 64 bit ARCH. */ + rte_wmb(); + rte_spinlock_unlock(&sq->sqsl); + return 1; +} + +/* + * Update the status field of CTs to indicate ready to be used by flows. + * A continuous number of CTs since last update. + * + * @param[in] sq + * Pointer to ASO CT SQ. + * @param[in] num + * Number of CT structures to be updated. + * + * @return + * 0 on success, a negative value. + */ +static void +mlx5_aso_ct_status_update(struct mlx5_aso_sq *sq, uint16_t num) +{ + uint16_t size = 1 << sq->log_desc_n; + uint16_t mask = size - 1; + uint16_t i; + struct mlx5_aso_ct_action *ct = NULL; + uint16_t idx; + + for (i = 0; i < num; i++) { + idx = (uint16_t)((sq->tail + i) & mask); + ct = sq->elts[idx].ct; + MLX5_ASSERT(ct); + MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_READY); + } +} + +/* + * Handle completions from WQEs sent to ASO CT. + * + * @param[in] mng + * Pointer to the CT pools management structure. + */ +static void +mlx5_aso_ct_completion_handle(struct mlx5_aso_ct_pools_mng *mng) +{ + struct mlx5_aso_sq *sq = &mng->aso_sq; + struct mlx5_aso_cq *cq = &sq->cq; + volatile struct mlx5_cqe *restrict cqe; + const uint32_t cq_size = 1 << cq->log_desc_n; + const uint32_t mask = cq_size - 1; + uint32_t idx; + uint32_t next_idx; + uint16_t max; + uint16_t n = 0; + int ret; + + rte_spinlock_lock(&sq->sqsl); + max = (uint16_t)(sq->head - sq->tail); + if (unlikely(!max)) { + rte_spinlock_unlock(&sq->sqsl); + return; + } + next_idx = cq->cq_ci & mask; + do { + idx = next_idx; + next_idx = (cq->cq_ci + 1) & mask; + /* Need to confirm the position of the prefetch. */ + rte_prefetch0(&cq->cq_obj.cqes[next_idx]); + cqe = &cq->cq_obj.cqes[idx]; + ret = check_cqe(cqe, cq_size, cq->cq_ci); + /* + * Be sure owner read is done before any other cookie field or + * opaque field. + */ + rte_io_rmb(); + if (unlikely(ret != MLX5_CQE_STATUS_SW_OWN)) { + if (likely(ret == MLX5_CQE_STATUS_HW_OWN)) + break; + mlx5_aso_cqe_err_handle(sq); + } else { + n++; + } + cq->cq_ci++; + } while (1); + if (likely(n)) { + mlx5_aso_ct_status_update(sq, n); + sq->tail += n; + rte_io_wmb(); + cq->cq_obj.db_rec[0] = rte_cpu_to_be_32(cq->cq_ci); + } + rte_spinlock_unlock(&sq->sqsl); +} + +/* + * Update connection tracking ASO context by sending WQE. + * + * @param[in] sh + * Pointer to mlx5_dev_ctx_shared object. + * @param[in] ct + * Pointer to connection tracking offload object. + * @param[in] profile + * Pointer to connection tracking TCP parameter. + * + * @return + * 0 on success, -1 on failure. + */ +int +mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + const struct rte_flow_action_conntrack *profile) +{ + struct mlx5_aso_ct_pools_mng *mng = sh->ct_mng; + uint32_t poll_wqe_times = MLX5_CT_POLL_WQE_CQE_TIMES; + struct mlx5_aso_ct_pool *pool; + + MLX5_ASSERT(ct); + do { + mlx5_aso_ct_completion_handle(mng); + if (mlx5_aso_ct_sq_enqueue_single(mng, ct, profile)) + return 0; + /* Waiting for wqe resource. */ + rte_delay_us_sleep(10u); + } while (--poll_wqe_times); + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + DRV_LOG(ERR, "Fail to send WQE for ASO CT %d in pool %d", + ct->offset, pool->index); + return -1; +} From patchwork Wed May 5 12:23:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92922 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2511A0524; Wed, 5 May 2021 14:24:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45B0941144; Wed, 5 May 2021 14:24:06 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770041.outbound.protection.outlook.com [40.107.77.41]) by mails.dpdk.org (Postfix) with ESMTP id 7A9DA41141 for ; Wed, 5 May 2021 14:24:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SAIQvdbitl1eklIPz5Y7pEXbD0fZQBarleJRSXnjkfL6KhVzVDhpOlKhB/pSibkdXDrP/dC/1KZvArdqZYxwcWjIyzpOkybs2cvEnNEdehXRzU2qRXGcH08p8X+TjGA8zHGrpiGNcShHP9JapbG5wc+MxQBytBDiV1ZC5XmYNA0IMP2Jpd66EAPqZwlvixI/4gH95DNMfcvijFsA7HVHlTlnEiXCo38tOwH78ZuF9dOEt5NSuAp1LTrwjsyhlecI0izCTq+t+4Ya8z4apNLd5+/Ca0KFse5UGnZHK1PrNfPPQ49WZ0tUzEpAQW0jqYsicj463TQ7XDYkDLnFoR+LyA== 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-SenderADCheck; bh=auAqAiqJtcThzVJa04SJOYLOO0FWOF3s89lYIS4CaCM=; b=TcsdeDEXu8dYLRJDUUe7QBOFsbtlS/04Uk7nDajF3gg3aofSE2siQVD2H132Tr2DjOa92YruELhVxOVKdFTV6fz361bkmR8d3GLVROBf5gnYG3G1mxLGSagTQrJvkcsbXTBLZOzAJvc36IPlU0eeBVRzscUTL92aPueEKMSjxSVLCx3cJJm2b5ifLiM6sjKWVShmAq+bPg7W74Ye9C5lOLbotjcM2yTdOeX/tczDCDb0VqVNm0raIXmPt49JIDygdxJVvCerCDv5P1rWi0WvtXcO8pnkPlCW9NNN2nVbemRm1H7AFOouBQkT/iMMus0W5w3Xl9E6m20j3U+sPviRXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=auAqAiqJtcThzVJa04SJOYLOO0FWOF3s89lYIS4CaCM=; b=mFuJ0nsKfpfK7qFkcRtIotvEWdqnPOPhcUfFHJw/HwRkWtiaE5jhnjt3vssblehH/9RS/SLKcyXKOaAYGBbIlBm6J5SOXTV0i7MDXOELyzRIm+y4IA7DSulsw91sJ+CQstE0hLm8w/it1I9MZuiOebvWf29cF38ENrk5hy6i5/Ty+ieBdGQAzEaj+JYFP9DCQtrNnWgND/qPz8OAHWrJVngdYFZR42joMU61cZHgrnn5X0ZotB6dhrH9/uo777rdlnZOwrcnhNVSAh0k7AKdo3FGofqwrCgkgaS/UERciVrYbvyzaX1d/+x0nNC1ku7uJKX/mkfAQfWgOClLnLzu4w== Received: from DM6PR05CA0066.namprd05.prod.outlook.com (2603:10b6:5:335::35) by DM5PR1201MB0204.namprd12.prod.outlook.com (2603:10b6:4:51::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24; Wed, 5 May 2021 12:24:02 +0000 Received: from DM6NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::e8) by DM6PR05CA0066.outlook.office365.com (2603:10b6:5:335::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.9 via Frontend Transport; Wed, 5 May 2021 12:24:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT047.mail.protection.outlook.com (10.13.172.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:01 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:23:59 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:18 +0300 Message-ID: <20210505122328.51129-8-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62854bb4-8b74-4990-919c-08d90fc0aa98 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0204: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nT8RxWj6QrHGLA6i5Z4+szW2kMJZH5ypSu0eRsIH5chkTQwmjwVgEOVCfLQPu0SqsB3Gp/Lb9yjcwVtjGUJnTV8h7DQQrhwJlcMdk8ypWElAzV3cXmCdOynebKnhc9yg5f8A0rJrp6hrXdLjvJAfYtU2VsmlfNNctAK9qX5iW6nbY7jzAmJZCRk2D27OfLISHh1C3PQnTXbX3MvQObhbEHWR9IMvRnmhAAjsYmz6wBCmXncIZ5ryes4kwsseyXodTcBSz0+/EUvYZxgY/Gb78X3ZxgsaWx4lomShfXeyNRgEIy9eW3SQ9CS6Oct8LZHJrmkomlTKSqI9peZiABT/bmswMBX/fGk210Uv3zp1tV/VF+46UbcsaI3Hi+tH2AFeU1Y1n+ODs7utyxI+WIe8uVf04ISyEpBv2c2EVbIuzjKtNzKa/8FRCB1J/Pi743WVwzmg/Culk0PLuF6tjda+vWylDZLeQnUip39bVO2oBYWg5MBDmsJzsFHIFBJDdBy8bx7iw082x/u3TmcsEUCjIICI+WVgO2augig+Gzuzeoh5N+QKdGdLhvNYnTpDZWfQbvaDXyYVTzOhFMZMTteBpBJhN4Sbu5xauT5J3N6JBqsD5ug6xCNbxdHX56qP+XnotjZ4gnH21pgP53aih6SY+LxoD/pdwDMCLkt2uEWok7M= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(39860400002)(136003)(346002)(396003)(46966006)(36840700001)(8936002)(36906005)(110136005)(30864003)(7696005)(6666004)(86362001)(26005)(54906003)(4326008)(82740400003)(2906002)(478600001)(36756003)(36860700001)(316002)(6286002)(55016002)(107886003)(70206006)(8676002)(70586007)(83380400001)(47076005)(186003)(1076003)(16526019)(356005)(5660300002)(336012)(426003)(82310400003)(2616005)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:01.8279 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62854bb4-8b74-4990-919c-08d90fc0aa98 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0204 Subject: [dpdk-dev] [PATCH v7 07/17] net/mlx5: add actions creating for CT X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Allocating a CT from the management pools and creating the DR actions for both directions by default. If there is no available connection tracking action, a new pool will be created with a fixed size bulk allocation. Right now, all the resources are controlled by the linked list. The ASO connection tracking context associated with these actions need to be updated via WQE before using for steering. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 4 + drivers/net/mlx5/mlx5_flow.h | 28 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 262 ++++++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 96b5cccf19..0f2a26efc0 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -992,6 +992,10 @@ struct mlx5_bond_info { /* Number of connection tracking objects per pool: must be a power of 2. */ #define MLX5_ASO_CT_ACTIONS_PER_POOL 64 +/* Generate incremental and unique CT index from pool and offset. */ +#define MLX5_MAKE_CT_IDX(pool, offset) \ + ((pool) * MLX5_ASO_CT_ACTIONS_PER_POOL + (offset) + 1) + /* ASO Conntrack state. */ enum mlx5_aso_ct_state { ASO_CONNTRACK_FREE, /* Inactive, in the free list. */ diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 71b0871bcd..0d2daa7faf 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -46,6 +46,7 @@ enum { MLX5_INDIRECT_ACTION_TYPE_RSS, MLX5_INDIRECT_ACTION_TYPE_AGE, MLX5_INDIRECT_ACTION_TYPE_COUNT, + MLX5_INDIRECT_ACTION_TYPE_CT, }; /* Matches on selected register. */ @@ -1317,6 +1318,33 @@ mlx5_validate_integrity_item(const struct rte_flow_item_integrity *item) return (test.value == 0); } +/* + * Get ASO CT action by index. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] idx + * Index to the ASO CT action. + * + * @return + * The specified ASO CT action pointer. + */ +static inline struct mlx5_aso_ct_action * +flow_aso_ct_get_by_idx(struct rte_eth_dev *dev, uint32_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; + struct mlx5_aso_ct_pool *pool; + + idx--; + MLX5_ASSERT((idx / MLX5_ASO_CT_ACTIONS_PER_POOL) < mng->n); + /* Bit operation AND could be used. */ + rte_rwlock_read_lock(&mng->resize_rwl); + pool = mng->pools[idx / MLX5_ASO_CT_ACTIONS_PER_POOL]; + rte_rwlock_read_unlock(&mng->resize_rwl); + return &pool->actions[idx % MLX5_ASO_CT_ACTIONS_PER_POOL]; +} + int mlx5_flow_group_to_table(struct rte_eth_dev *dev, const struct mlx5_flow_tunnel *tunnel, uint32_t group, uint32_t *table, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index c6f90e0a89..3b84dea34b 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -11515,6 +11515,262 @@ flow_dv_prepare_counter(struct rte_eth_dev *dev, return flow_dv_counter_get_by_idx(dev, flow->counter, NULL); } +/* + * Release an ASO CT action. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] idx + * Index of ASO CT action to release. + * + * @return + * 0 when CT action was removed, otherwise the number of references. + */ +static inline int +flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; + struct mlx5_aso_ct_action *ct = flow_aso_ct_get_by_idx(dev, idx); + uint32_t ret = __atomic_sub_fetch(&ct->refcnt, 1, __ATOMIC_RELAXED); + + if (!ret) { + if (ct->dr_action_orig) { +#ifdef HAVE_MLX5_DR_ACTION_ASO_CT + claim_zero(mlx5_glue->destroy_flow_action + (ct->dr_action_orig)); +#endif + ct->dr_action_orig = NULL; + } + if (ct->dr_action_rply) { +#ifdef HAVE_MLX5_DR_ACTION_ASO_CT + claim_zero(mlx5_glue->destroy_flow_action + (ct->dr_action_rply)); +#endif + ct->dr_action_rply = NULL; + } + rte_spinlock_lock(&mng->ct_sl); + LIST_INSERT_HEAD(&mng->free_cts, ct, next); + rte_spinlock_unlock(&mng->ct_sl); + } + return ret; +} + +/* + * Resize the ASO CT pools array by 64 pools. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * + * @return + * 0 on success, otherwise negative errno value and rte_errno is set. + */ +static int +flow_dv_aso_ct_pools_resize(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; + void *old_pools = mng->pools; + /* Magic number now, need a macro. */ + uint32_t resize = mng->n + 64; + uint32_t mem_size = sizeof(struct mlx5_aso_ct_pool *) * resize; + void *pools = mlx5_malloc(MLX5_MEM_ZERO, mem_size, 0, SOCKET_ID_ANY); + + if (!pools) { + rte_errno = ENOMEM; + return -rte_errno; + } + rte_rwlock_write_lock(&mng->resize_rwl); + /* ASO SQ/QP was already initialized in the startup. */ + if (old_pools) { + /* Realloc could be an alternative choice. */ + rte_memcpy(pools, old_pools, + mng->n * sizeof(struct mlx5_aso_ct_pool *)); + mlx5_free(old_pools); + } + mng->n = resize; + mng->pools = pools; + rte_rwlock_write_unlock(&mng->resize_rwl); + return 0; +} + +/* + * Create and initialize a new ASO CT pool. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[out] ct_free + * Where to put the pointer of a new CT action. + * + * @return + * The CT actions pool pointer and @p ct_free is set on success, + * NULL otherwise and rte_errno is set. + */ +static struct mlx5_aso_ct_pool * +flow_dv_ct_pool_create(struct rte_eth_dev *dev, + struct mlx5_aso_ct_action **ct_free) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; + struct mlx5_aso_ct_pool *pool = NULL; + struct mlx5_devx_obj *obj = NULL; + uint32_t i; + uint32_t log_obj_size = rte_log2_u32(MLX5_ASO_CT_ACTIONS_PER_POOL); + + obj = mlx5_devx_cmd_create_conn_track_offload_obj(priv->sh->ctx, + priv->sh->pdn, log_obj_size); + if (!obj) { + rte_errno = ENODATA; + DRV_LOG(ERR, "Failed to create conn_track_offload_obj using DevX."); + return NULL; + } + pool = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*pool), 0, SOCKET_ID_ANY); + if (!pool) { + rte_errno = ENOMEM; + claim_zero(mlx5_devx_cmd_destroy(obj)); + return NULL; + } + pool->devx_obj = obj; + pool->index = mng->next; + /* Resize pools array if there is no room for the new pool in it. */ + if (pool->index == mng->n && flow_dv_aso_ct_pools_resize(dev)) { + claim_zero(mlx5_devx_cmd_destroy(obj)); + mlx5_free(pool); + return NULL; + } + mng->pools[pool->index] = pool; + mng->next++; + /* Assign the first action in the new pool, the rest go to free list. */ + *ct_free = &pool->actions[0]; + /* Lock outside, the list operation is safe here. */ + for (i = 1; i < MLX5_ASO_CT_ACTIONS_PER_POOL; i++) { + /* refcnt is 0 when allocating the memory. */ + pool->actions[i].offset = i; + LIST_INSERT_HEAD(&mng->free_cts, &pool->actions[i], next); + } + return pool; +} + +/* + * Allocate a ASO CT action from free list. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[out] error + * Pointer to the error structure. + * + * @return + * Index to ASO CT action on success, 0 otherwise and rte_errno is set. + */ +static uint32_t +flow_dv_aso_ct_alloc(struct rte_eth_dev *dev, struct rte_flow_error *error) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; + struct mlx5_aso_ct_action *ct = NULL; + struct mlx5_aso_ct_pool *pool; + uint8_t reg_c; + uint32_t ct_idx; + + MLX5_ASSERT(mng); + if (!priv->config.devx) { + rte_errno = ENOTSUP; + return 0; + } + /* Get a free CT action, if no, a new pool will be created. */ + rte_spinlock_lock(&mng->ct_sl); + ct = LIST_FIRST(&mng->free_cts); + if (ct) { + LIST_REMOVE(ct, next); + } else if (!flow_dv_ct_pool_create(dev, &ct)) { + rte_spinlock_unlock(&mng->ct_sl); + rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "failed to create ASO CT pool"); + return 0; + } + rte_spinlock_unlock(&mng->ct_sl); + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + ct_idx = MLX5_MAKE_CT_IDX(pool->index, ct->offset); + /* 0: inactive, 1: created, 2+: used by flows. */ + __atomic_store_n(&ct->refcnt, 1, __ATOMIC_RELAXED); + reg_c = mlx5_flow_get_reg_id(dev, MLX5_ASO_CONNTRACK, 0, error); + if (!ct->dr_action_orig) { +#ifdef HAVE_MLX5_DR_ACTION_ASO_CT + ct->dr_action_orig = mlx5_glue->dv_create_flow_action_aso + (priv->sh->rx_domain, pool->devx_obj->obj, + ct->offset, + MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR, + reg_c - REG_C_0); +#else + RTE_SET_USED(reg_c); +#endif + if (!ct->dr_action_orig) { + flow_dv_aso_ct_release(dev, ct_idx); + rte_flow_error_set(error, rte_errno, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "failed to create ASO CT action"); + return 0; + } + } + if (!ct->dr_action_rply) { +#ifdef HAVE_MLX5_DR_ACTION_ASO_CT + ct->dr_action_rply = mlx5_glue->dv_create_flow_action_aso + (priv->sh->rx_domain, pool->devx_obj->obj, + ct->offset, + MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_RESPONDER, + reg_c - REG_C_0); +#endif + if (!ct->dr_action_rply) { + flow_dv_aso_ct_release(dev, ct_idx); + rte_flow_error_set(error, rte_errno, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "failed to create ASO CT action"); + return 0; + } + } + return ct_idx; +} + +/* + * Create a conntrack object with context and actions by using ASO mechanism. + * + * @param[in] dev + * Pointer to rte_eth_dev structure. + * @param[in] pro + * Pointer to conntrack information profile. + * @param[out] error + * Pointer to the error structure. + * + * @return + * Index to conntrack object on success, 0 otherwise. + */ +static uint32_t +flow_dv_translate_create_conntrack(struct rte_eth_dev *dev, + const struct rte_flow_action_conntrack *pro, + struct rte_flow_error *error) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_dev_ctx_shared *sh = priv->sh; + struct mlx5_aso_ct_action *ct; + uint32_t idx; + + if (!sh->ct_aso_en) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Connection is not supported"); + idx = flow_dv_aso_ct_alloc(dev, error); + if (!idx) + return rte_flow_error_set(error, rte_errno, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Failed to allocate CT object"); + ct = flow_aso_ct_get_by_idx(dev, idx); + if (mlx5_aso_ct_update_by_wqe(sh, ct, pro)) + return rte_flow_error_set(error, EBUSY, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Failed to update CT"); + return idx; +} + /** * Fill the flow with DV spec, lock free * (mutex should be acquired by caller). @@ -13754,6 +14010,12 @@ flow_dv_action_create(struct rte_eth_dev *dev, idx = (MLX5_INDIRECT_ACTION_TYPE_COUNT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret; break; + case RTE_FLOW_ACTION_TYPE_CONNTRACK: + ret = flow_dv_translate_create_conntrack(dev, action->conf, + err); + idx = (MLX5_INDIRECT_ACTION_TYPE_CT << + MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret; + break; default: rte_flow_error_set(err, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "action type not supported"); From patchwork Wed May 5 12:23:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92923 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B3E5DA0524; Wed, 5 May 2021 14:24:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 298F841104; Wed, 5 May 2021 14:24:09 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2047.outbound.protection.outlook.com [40.107.93.47]) by mails.dpdk.org (Postfix) with ESMTP id 6F4FF41145 for ; Wed, 5 May 2021 14:24:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lE7LUvjpMI4Til29L52kbSj6hq4RSAVM1Mib6ZpC+LgpeixyZUD6zuqWWgKCwHbPOFSYPPnPxQ2VjLlDFaCEZjk9p7NJyYiP6yTB/axm6Rv6FOnmZslNxUNL+GY546WyPM7uDMS3LVZp8uH7J/GgeSOVrL4puIlbyP+5UOvRQCEG59hXN0gind+zGDwxT1XT9LQOGEjMcwd4EGZeJRQN+7ZCNSUj7gIDnR3M9Zt8MAVMed1bCiSND+7MJPMEOHGSBG0YEpL8gcbNceHraj99P62vb/obF6r4lFCdx1x3mozJh8jn0OTGDmxMmIwi88voaaK9FICPcpqfsAcCn+l0IQ== 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-SenderADCheck; bh=zz83slvzD6KOlilMy2PZ98U9nx50EpVlVh2tNZZqVNY=; b=fmArNY8aC+MHFAqdJo913CdFhlCQLAew/HwdtN/uUWU51T3YufMFvKPiIoNl8gJay9ho5jhyOEytZT8p+DrfuOepjfLBjGH6s7IiM8vJn+Z2q0mdx73XdFoucL2n7ANBoQvEBABE/0CgoxO8/rFAn8yMQohfG8mBQSnuMhv7lm1U7ZwFrvsJAlJHe5AqSFLwi0BexS7z4anE1lUPUHfJDxipfQWmTeDP8mPaD0Nnc7eZcatA3hepUxrO01O3FPoaWpOOt2RTCTJ1ym0Lnu7Rp6zd9rHoukDC73CrFEkJ73cV4iKlJLXqB903D0/gU4SGw3XBCYpHAzg3K/AvknZrPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=zz83slvzD6KOlilMy2PZ98U9nx50EpVlVh2tNZZqVNY=; b=iZmGs0uxRVqWxlMD1ApRs8DwESC9qppPyeypETYLodU/e5yuzcTVcWE4TUU+rJSDLU9l6rEW8Oo43R8EBk20CRorjalf2kT/4kubjKBEsp8JwgV56T1SbNQ5RfALwBX7S9TxQcvgQemPWrsvou4DxNzspKrVyITgQkPhFzCCiOcFlcVUW0doYymFPeC7Z3dwCZUfExXbdvOwmUziEZGaAkaA7rQFxtBnkIqheZeHjSrBVLzD+YRkbxkBcVG9IJfkefXHioAQQX3/1/7Qf95+z7YgMrj84cBdIdiREco2pi3vs6GHFF3O2x3ACvoAjANtv9iqyHJIWq0Sj41hrzdFWw== Received: from DS7PR05CA0012.namprd05.prod.outlook.com (2603:10b6:5:3b9::17) by BN8PR12MB2994.namprd12.prod.outlook.com (2603:10b6:408:42::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.43; Wed, 5 May 2021 12:24:06 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::52) by DS7PR05CA0012.outlook.office365.com (2603:10b6:5:3b9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.9 via Frontend Transport; Wed, 5 May 2021 12:24:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:05 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:01 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:19 +0300 Message-ID: <20210505122328.51129-9-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce26412d-5edf-4dac-9c18-08d90fc0acef X-MS-TrafficTypeDiagnostic: BN8PR12MB2994: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1169; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZjIwvZsC3XUwkY5F9G5c+0xGPwQ9hISfzE38jIAan7aTAV0NdTLncpbKplJ/iwabfHssYjhB7TZYqhnYPQ+mPHdECrv1UebNZQ+Lv/mDbbsktfwxvx9OASOccmMfRfdj74YmboLNlXPdrSD4H92GZTpXmidgJKQGWdCL+ZYMl5jQVGLlT/4OuxQ7oA/dlN67hL9luE6uAQwul31LDPH5ofLThsPXaw/eOBmVqlCIFNsnslgmyyL11qPizmQ/PKXlP8uPYxcZApRZWJrzUtl+MTr2qCAH+YWqz3o53eXBVwXTIFzXSpUIWKQFErjUUOUyL+vwyf1pWQ6ckIg0GXGctq0k+T0k8zZ2U3G1vYUOpdtXyfzw1FtlkFUkZC4Q4ZqsAK1gXy7zYC8cQqf8TbGReMEdvG0EKAHnxO9QC7tHIrNj6L3aLu3lZG/lunfkpH7LKNMN6vCWC7Ef0JEvzRiigNuKr9cREC2+/Dv+8iRhwncQdTFieh6lUOs5auvYNaysDktH7IAzoAqhFZTDUVklOIYNp30nt75xCZqN0syBKRRsm4kWEjWDc5lAEf0vPilcXwzCqRxejsr4AEDtrcIJxJ1Dx0USnilvWF4oyIxaqO5WkI5uHx8B5eC981Sy3pm2vx2kFNskY3S9JjdK86G2QVZGVF+nV7Wn2DqsP9moRkg= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(376002)(39860400002)(396003)(346002)(36840700001)(46966006)(6286002)(316002)(8936002)(5660300002)(8676002)(70206006)(110136005)(54906003)(47076005)(478600001)(36906005)(4326008)(7696005)(83380400001)(36860700001)(107886003)(55016002)(26005)(186003)(16526019)(82740400003)(426003)(1076003)(6666004)(336012)(2906002)(7636003)(2616005)(356005)(86362001)(70586007)(36756003)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:05.7628 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce26412d-5edf-4dac-9c18-08d90fc0acef X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2994 Subject: [dpdk-dev] [PATCH v7 08/17] net/mlx5: close CT management structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When freeing the IB shared context during stopping a device, the ASO connection tracking management structure should also be cleaned up. All the DR actions created should be destroyed. The structures need to be freed and ASO CT QP should be released. In the meanwhile, the allocated and registered memory region for query should also be deregistered and then freed. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.c | 56 ++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_aso.c | 4 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 7e83d09fec..b610f29a66 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -708,6 +708,60 @@ mlx5_flow_aso_ct_mng_init(struct mlx5_dev_ctx_shared *sh) return 0; } +/* + * Close and release all the resources of the + * ASO connection tracking management structure. + * + * @param[in] sh + * Pointer to mlx5_dev_ctx_shared object to free. + */ +static void +mlx5_flow_aso_ct_mng_close(struct mlx5_dev_ctx_shared *sh) +{ + struct mlx5_aso_ct_pools_mng *mng = sh->ct_mng; + struct mlx5_aso_ct_pool *ct_pool; + struct mlx5_aso_ct_action *ct; + uint32_t idx; + uint32_t val; + uint32_t cnt; + int i; + + mlx5_aso_queue_uninit(sh, ASO_OPC_MOD_CONNECTION_TRACKING); + idx = mng->next; + while (idx--) { + cnt = 0; + ct_pool = mng->pools[idx]; + for (i = 0; i < MLX5_ASO_CT_ACTIONS_PER_POOL; i++) { + ct = &ct_pool->actions[i]; + val = __atomic_fetch_sub(&ct->refcnt, 1, + __ATOMIC_RELAXED); + MLX5_ASSERT(val == 1); + if (val > 1) + cnt++; +#ifdef HAVE_MLX5_DR_ACTION_ASO_CT + if (ct->dr_action_orig) + claim_zero(mlx5_glue->destroy_flow_action + (ct->dr_action_orig)); + if (ct->dr_action_rply) + claim_zero(mlx5_glue->destroy_flow_action + (ct->dr_action_rply)); +#endif + } + claim_zero(mlx5_devx_cmd_destroy(ct_pool->devx_obj)); + if (cnt) { + DRV_LOG(DEBUG, "%u ASO CT objects are being used in the pool %u", + cnt, i); + } + mlx5_free(ct_pool); + /* in case of failure. */ + mng->next--; + } + mlx5_free(mng->pools); + mlx5_free(mng); + /* Management structure must be cleared to 0s during allocation. */ + sh->ct_mng = NULL; +} + /** * Initialize the flow resources' indexed mempool. * @@ -1510,6 +1564,8 @@ mlx5_dev_close(struct rte_eth_dev *dev) if (priv->mreg_cp_tbl) mlx5_hlist_destroy(priv->mreg_cp_tbl); mlx5_mprq_free_mp(dev); + if (priv->sh->ct_mng) + mlx5_flow_aso_ct_mng_close(priv->sh); mlx5_os_free_shared_dr(priv); if (priv->rss_conf.rss_key != NULL) mlx5_free(priv->rss_conf.rss_key); diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index fbf6e5ef38..37cb43147a 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -372,6 +372,10 @@ mlx5_aso_queue_uninit(struct mlx5_dev_ctx_shared *sh, case ASO_OPC_MOD_POLICER: sq = &sh->mtrmng->pools_mng.sq; break; + case ASO_OPC_MOD_CONNECTION_TRACKING: + mlx5_aso_dereg_mr(sh, &sh->ct_mng->aso_sq.mr); + sq = &sh->ct_mng->aso_sq; + break; default: DRV_LOG(ERR, "Unknown ASO operation mode"); return; From patchwork Wed May 5 12:23:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92924 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 719D7A0524; Wed, 5 May 2021 14:24:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BF8141152; Wed, 5 May 2021 14:24:11 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2070.outbound.protection.outlook.com [40.107.92.70]) by mails.dpdk.org (Postfix) with ESMTP id A8B7241126 for ; Wed, 5 May 2021 14:24:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g0J83hceKcZQAwJJsTj7nTmpNGk31HYTvaFO6Y6IKDsR761Vp8iLGMi4YpeZhyBTVr5kWmo+L5UCQfrDBSPiX8/OglcsTfKv4r5fslPBI07DusJP6Sr2sLie7KyiR3ebfKcSo1BaHck7qWYhpN9EQWZ04ZGs+l6VnRPFOLzCIgF3PBL6JUvxLnnrjt6XIrfh4UXNWcVeG5Q1NRixh9Gw2UF/Qk/l0YUmW7iqdRXel4ndXqKozqkNHzUsmgG/rPKTq37yr4j//p5yEYVMa5R4u8ibxMuvSktHMNxHmWYfiaGF1TiRboBQTQKo4aPYdO+MGtBRN8pBOzlx2xyJaf+KSw== 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-SenderADCheck; bh=DDkIi91gm7fyefjrj3fbp5yiUwuJTK2j7i7BZN2tAKM=; b=lzorOrRF9+ztDZn9+o0GKEz8qad+WZS1gTFl70PdH2kg+HY4IsdtNn/AaOqg8Wcmo0ezaiXA01dbuni+PthQ+AwK2VhgXHd64EkCANUW7zXFPd107C0/iZqxZQMdzOAswDA+7YuJA3w2q5FYZC9U5DBlzpjYlzc8USMz80graUx6KDAcDLQkA0ARwOUvNwcj/bSnsIeATS2AA2vA7/IfIJemixhYsleSIxi9QvqKtzhlr8Tt1CChRTUxeBR0kK1PzCJ1RkzxD+dKwwDhsTNU46rfiOLNolwfwQHk0qTn8hNByZiSafsxwW5d76yjNLwkecvaPI2MruiY2z7+nk1krw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=DDkIi91gm7fyefjrj3fbp5yiUwuJTK2j7i7BZN2tAKM=; b=llAX8MEdPR+4PrvHJjUCi8n+hHsNzV0fzTN8c/WNM7UKpAliReIH1HrozJWiTtOl0Z6SbtN4vIYhR7C6nH/8RyKjPUXqlcrnayJw+aw2uvVGMTsxkQvm/rp3d3mZCdRQMWv+yV5jdB/Fo8eAjzM/66cpuQyahejInffglVkWKAFa3Eg1KvXYfHiagnitByMFjvnXfBzUw0TeG1Rv1pHlqgvrdmBXOVA69Jqur0paMUB3STPEoibIlVQiQds4s/oTUMqIhhzh7KPktdf6iPjH7yB7NGNfZWocp42aJGvJbMg4B3HZ8+/skBUksERVkSHHAQKzkSLKS1u5uLCIb6durA== Received: from DS7PR05CA0018.namprd05.prod.outlook.com (2603:10b6:5:3b9::23) by BN8PR12MB3188.namprd12.prod.outlook.com (2603:10b6:408:6b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.38; Wed, 5 May 2021 12:24:08 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::26) by DS7PR05CA0018.outlook.office365.com (2603:10b6:5:3b9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.11 via Frontend Transport; Wed, 5 May 2021 12:24:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:08 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:03 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:20 +0300 Message-ID: <20210505122328.51129-10-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1c5b7f27-032c-4f80-f3a8-08d90fc0ae59 X-MS-TrafficTypeDiagnostic: BN8PR12MB3188: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:112; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UxgspM2V/LEEqJcdnAWhRqNQ3TBNh9Pz6T8FFRkPm3mQ/t1fj40CQ8bn3sH3lp0pG32IbyFS0uN3GgjYhygQIb1+8KIx2TFxjdG9ydLkUCXXCG+jezLq1E/RxOUfgnjyxq5mBUZcfHfcz63/iOgpSIDHx6qKvgeNvHmCoC8mkgWzQImVC5O6LcRfGv31i1d1gPLi3F/Tg1rLw7IzweJc2/SPRNA2lRWForRCVACUWMKWyzAgNXHl0LpkCt0Ir5IxeWzTrm8qYEnFznZ/HeJFsC7cBQ8A0El2OeLBIv0lyl7WhO8xj9o4B01/fu1AT3pKg88RjWarBcOvFxVh6MVbxOSIjkyMtlFKYDROQkDoO37jkHQ5JxgMg4pgjCeKk57QIAxPcKoIry40r8cfD5xXn+aUP856wu6r+9gDmVdsCq+5qfU+VRa/ldACl/6RcZa0oaVRCxZ0zwnyAi5YCICiea6nLlCYgCvH0Z1lX+5K0iXBpv68syTY/B+h/v75iq6dUEyRbhB+h+5+hnyb3+4VjmxVCBSaGCWhyyTPLAmle6unzrNAykukvYvelco5jvf3qs7boLDXPin5RCsLgsMZkC5quJL+4Lq82m62JSdy4Y5IeXHjCcxNPj8paYloSFR1jp6xlsxrJJdhcEVgbAYXSISC4r2iQF/O7vlGh4rdNDA= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(346002)(396003)(136003)(39860400002)(46966006)(36840700001)(86362001)(8676002)(6286002)(7636003)(107886003)(356005)(82740400003)(36860700001)(26005)(5660300002)(82310400003)(16526019)(186003)(478600001)(55016002)(1076003)(2906002)(426003)(47076005)(70586007)(2616005)(70206006)(36756003)(83380400001)(8936002)(6666004)(7696005)(54906003)(316002)(36906005)(110136005)(4326008)(30864003)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:08.1204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c5b7f27-032c-4f80-f3a8-08d90fc0ae59 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3188 Subject: [dpdk-dev] [PATCH v7 09/17] net/mlx5: add ASO CT query implementation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After the connection tracking context is created and being used by the flows, the context will be updated by the HW automatically after a packet passed the CT validation. E.g., the ACK, SEQ, window and state of CT can be updated with both direction traffic. In order to query the updated contents of this context, a WQE should be posted to the SQ with a return buffer. The data will be filled into the buffer. And the profile will be filled with specific value. During the execution of query command, the context may be updated. The result of the query command may not be the latest one. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 10 +- drivers/net/mlx5/mlx5_flow_aso.c | 245 +++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 19 +++ 3 files changed, 273 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 0f2a26efc0..6d3f89519d 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -493,7 +493,10 @@ struct mlx5_aso_sq_elem { uint16_t burst_size; }; struct mlx5_aso_mtr *mtr; - struct mlx5_aso_ct_action *ct; + struct { + struct mlx5_aso_ct_action *ct; + char *query_data; + }; }; }; @@ -1707,5 +1710,10 @@ int mlx5_aso_mtr_wait(struct mlx5_dev_ctx_shared *sh, int mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_ct_action *ct, const struct rte_flow_action_conntrack *profile); +int mlx5_aso_ct_wait_ready(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct); +int mlx5_aso_ct_query_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + struct rte_flow_action_conntrack *profile); #endif /* RTE_PMD_MLX5_H_ */ diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 37cb43147a..92fa9ede60 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -933,6 +933,7 @@ mlx5_aso_ct_sq_enqueue_single(struct mlx5_aso_ct_pools_mng *mng, /* Fill next WQE. */ MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_WAIT); sq->elts[sq->head & mask].ct = ct; + sq->elts[sq->head & mask].query_data = NULL; pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); /* Each WQE will have a single CT object. */ wqe->general_cseg.misc = rte_cpu_to_be_32(pool->devx_obj->id + @@ -1048,9 +1049,95 @@ mlx5_aso_ct_status_update(struct mlx5_aso_sq *sq, uint16_t num) ct = sq->elts[idx].ct; MLX5_ASSERT(ct); MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_READY); + if (sq->elts[idx].query_data) + rte_memcpy(sq->elts[idx].query_data, + (char *)((uintptr_t)sq->mr.addr + idx * 64), + 64); } } +/* + * Post a WQE to the ASO CT SQ to query the current context. + * + * @param[in] mng + * Pointer to the CT pools management structure. + * @param[in] ct + * Pointer to the generic CT structure related to the context. + * @param[in] data + * Pointer to data area to be filled. + * + * @return + * 1 on success (WQE number), 0 on failure. + */ +static int +mlx5_aso_ct_sq_query_single(struct mlx5_aso_ct_pools_mng *mng, + struct mlx5_aso_ct_action *ct, char *data) +{ + volatile struct mlx5_aso_wqe *wqe = NULL; + struct mlx5_aso_sq *sq = &mng->aso_sq; + uint16_t size = 1 << sq->log_desc_n; + uint16_t mask = size - 1; + uint16_t res; + uint16_t wqe_idx; + struct mlx5_aso_ct_pool *pool; + enum mlx5_aso_ct_state state = + __atomic_load_n(&ct->state, __ATOMIC_RELAXED); + + if (state == ASO_CONNTRACK_FREE) { + DRV_LOG(ERR, "Fail: No context to query"); + return -1; + } else if (state == ASO_CONNTRACK_WAIT) { + return 0; + } + rte_spinlock_lock(&sq->sqsl); + res = size - (uint16_t)(sq->head - sq->tail); + if (unlikely(!res)) { + rte_spinlock_unlock(&sq->sqsl); + DRV_LOG(ERR, "Fail: SQ is full and no free WQE to send"); + return 0; + } + MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_QUERY); + wqe = &sq->sq_obj.aso_wqes[sq->head & mask]; + /* Confirm the location and address of the prefetch instruction. */ + rte_prefetch0(&sq->sq_obj.aso_wqes[(sq->head + 1) & mask]); + /* Fill next WQE. */ + wqe_idx = sq->head & mask; + sq->elts[wqe_idx].ct = ct; + sq->elts[wqe_idx].query_data = data; + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + /* Each WQE will have a single CT object. */ + wqe->general_cseg.misc = rte_cpu_to_be_32(pool->devx_obj->id + + ct->offset); + wqe->general_cseg.opcode = rte_cpu_to_be_32(MLX5_OPCODE_ACCESS_ASO | + (ASO_OPC_MOD_CONNECTION_TRACKING << + WQE_CSEG_OPC_MOD_OFFSET) | + sq->pi << WQE_CSEG_WQE_INDEX_OFFSET); + /* + * There is no write request is required. + * ASO_OPER_LOGICAL_AND and ASO_OP_ALWAYS_FALSE are both 0. + * "BYTEWISE_64BYTE" is needed for a whole context. + * Set to 0 directly to reduce an endian swap. (Modify should rewrite.) + * "data_mask" is ignored. + * Buffer address was already filled during initialization. + */ + wqe->aso_cseg.operand_masks = rte_cpu_to_be_32(BYTEWISE_64BYTE << + ASO_CSEG_DATA_MASK_MODE_OFFSET); + wqe->aso_cseg.data_mask = 0; + sq->head++; + /* + * Each WQE contains 2 WQEBB's, even though + * data segment is not used in this case. + */ + sq->pi += 2; + rte_io_wmb(); + sq->sq_obj.db_rec[MLX5_SND_DBR] = rte_cpu_to_be_32(sq->pi); + rte_wmb(); + *sq->uar_addr = *(volatile uint64_t *)wqe; /* Assume 64 bit ARCH. */ + rte_wmb(); + rte_spinlock_unlock(&sq->sqsl); + return 1; +} + /* * Handle completions from WQEs sent to ASO CT. * @@ -1143,3 +1230,161 @@ mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, ct->offset, pool->index); return -1; } + +/* + * The routine is used to wait for WQE completion to continue with queried data. + * + * @param[in] sh + * Pointer to mlx5_dev_ctx_shared object. + * @param[in] ct + * Pointer to connection tracking offload object. + * + * @return + * 0 on success, -1 on failure. + */ +int +mlx5_aso_ct_wait_ready(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct) +{ + struct mlx5_aso_ct_pools_mng *mng = sh->ct_mng; + uint32_t poll_cqe_times = MLX5_CT_POLL_WQE_CQE_TIMES; + struct mlx5_aso_ct_pool *pool; + + if (__atomic_load_n(&ct->state, __ATOMIC_RELAXED) == + ASO_CONNTRACK_READY) + return 0; + do { + mlx5_aso_ct_completion_handle(mng); + if (__atomic_load_n(&ct->state, __ATOMIC_RELAXED) == + ASO_CONNTRACK_READY) + return 0; + /* Waiting for CQE ready, consider should block or sleep. */ + rte_delay_us_sleep(MLX5_ASO_WQE_CQE_RESPONSE_DELAY); + } while (--poll_cqe_times); + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + DRV_LOG(ERR, "Fail to poll CQE for ASO CT %d in pool %d", + ct->offset, pool->index); + return -1; +} + +/* + * Convert the hardware conntrack data format into the profile. + * + * @param[in] profile + * Pointer to conntrack profile to be filled after query. + * @param[in] wdata + * Pointer to data fetched from hardware. + */ +static inline void +mlx5_aso_ct_obj_analyze(struct rte_flow_action_conntrack *profile, + char *wdata) +{ + void *o_dir = MLX5_ADDR_OF(conn_track_aso, wdata, original_dir); + void *r_dir = MLX5_ADDR_OF(conn_track_aso, wdata, reply_dir); + + /* MLX5_GET16 should be taken into consideration. */ + profile->state = (enum rte_flow_conntrack_state) + MLX5_GET(conn_track_aso, wdata, state); + profile->enable = !MLX5_GET(conn_track_aso, wdata, freeze_track); + profile->selective_ack = MLX5_GET(conn_track_aso, wdata, + sack_permitted); + profile->live_connection = MLX5_GET(conn_track_aso, wdata, + connection_assured); + profile->challenge_ack_passed = MLX5_GET(conn_track_aso, wdata, + challenged_acked); + profile->max_ack_window = MLX5_GET(conn_track_aso, wdata, + max_ack_window); + profile->retransmission_limit = MLX5_GET(conn_track_aso, wdata, + retranmission_limit); + profile->last_window = MLX5_GET(conn_track_aso, wdata, last_win); + profile->last_direction = MLX5_GET(conn_track_aso, wdata, last_dir); + profile->last_index = (enum rte_flow_conntrack_tcp_last_index) + MLX5_GET(conn_track_aso, wdata, last_index); + profile->last_seq = MLX5_GET(conn_track_aso, wdata, last_seq); + profile->last_ack = MLX5_GET(conn_track_aso, wdata, last_ack); + profile->last_end = MLX5_GET(conn_track_aso, wdata, last_end); + profile->liberal_mode = MLX5_GET(conn_track_aso, wdata, + reply_direction_tcp_liberal_enabled) | + MLX5_GET(conn_track_aso, wdata, + original_direction_tcp_liberal_enabled); + /* No liberal in the RTE structure profile. */ + profile->reply_dir.scale = MLX5_GET(conn_track_aso, wdata, + reply_direction_tcp_scale); + profile->reply_dir.close_initiated = MLX5_GET(conn_track_aso, wdata, + reply_direction_tcp_close_initiated); + profile->reply_dir.data_unacked = MLX5_GET(conn_track_aso, wdata, + reply_direction_tcp_data_unacked); + profile->reply_dir.last_ack_seen = MLX5_GET(conn_track_aso, wdata, + reply_direction_tcp_max_ack); + profile->reply_dir.sent_end = MLX5_GET(tcp_window_params, + r_dir, sent_end); + profile->reply_dir.reply_end = MLX5_GET(tcp_window_params, + r_dir, reply_end); + profile->reply_dir.max_win = MLX5_GET(tcp_window_params, + r_dir, max_win); + profile->reply_dir.max_ack = MLX5_GET(tcp_window_params, + r_dir, max_ack); + profile->original_dir.scale = MLX5_GET(conn_track_aso, wdata, + original_direction_tcp_scale); + profile->original_dir.close_initiated = MLX5_GET(conn_track_aso, wdata, + original_direction_tcp_close_initiated); + profile->original_dir.data_unacked = MLX5_GET(conn_track_aso, wdata, + original_direction_tcp_data_unacked); + profile->original_dir.last_ack_seen = MLX5_GET(conn_track_aso, wdata, + original_direction_tcp_max_ack); + profile->original_dir.sent_end = MLX5_GET(tcp_window_params, + o_dir, sent_end); + profile->original_dir.reply_end = MLX5_GET(tcp_window_params, + o_dir, reply_end); + profile->original_dir.max_win = MLX5_GET(tcp_window_params, + o_dir, max_win); + profile->original_dir.max_ack = MLX5_GET(tcp_window_params, + o_dir, max_ack); +} + +/* + * Query connection tracking information parameter by send WQE. + * + * @param[in] dev + * Pointer to Ethernet device. + * @param[in] ct + * Pointer to connection tracking offload object. + * @param[out] profile + * Pointer to connection tracking TCP information. + * + * @return + * 0 on success, -1 on failure. + */ +int +mlx5_aso_ct_query_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + struct rte_flow_action_conntrack *profile) +{ + struct mlx5_aso_ct_pools_mng *mng = sh->ct_mng; + uint32_t poll_wqe_times = MLX5_CT_POLL_WQE_CQE_TIMES; + struct mlx5_aso_ct_pool *pool; + char out_data[64 * 2]; + int ret; + + MLX5_ASSERT(ct); + do { + mlx5_aso_ct_completion_handle(mng); + ret = mlx5_aso_ct_sq_query_single(mng, ct, out_data); + if (ret < 0) + return ret; + else if (ret > 0) + goto data_handle; + /* Waiting for wqe resource or state. */ + else + rte_delay_us_sleep(10u); + } while (--poll_wqe_times); + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + DRV_LOG(ERR, "Fail to send WQE for ASO CT %d in pool %d", + ct->offset, pool->index); + return -1; +data_handle: + ret = mlx5_aso_ct_wait_ready(sh, ct); + if (!ret) + mlx5_aso_ct_obj_analyze(profile, out_data); + return ret; +} diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 3b84dea34b..e1beb83e92 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -14808,6 +14808,8 @@ flow_dv_action_query(struct rte_eth_dev *dev, uint32_t act_idx = (uint32_t)(uintptr_t)handle; uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET; uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1); + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_action *ct; switch (type) { case MLX5_INDIRECT_ACTION_TYPE_AGE: @@ -14823,6 +14825,23 @@ flow_dv_action_query(struct rte_eth_dev *dev, return 0; case MLX5_INDIRECT_ACTION_TYPE_COUNT: return flow_dv_query_count(dev, idx, data, error); + case MLX5_INDIRECT_ACTION_TYPE_CT: + ct = flow_aso_ct_get_by_idx(dev, idx); + if (!ct->refcnt) + return rte_flow_error_set(error, EFAULT, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "CT object is inactive"); + ((struct rte_flow_action_conntrack *)data)->peer_port = + ct->peer; + ((struct rte_flow_action_conntrack *)data)->is_original_dir = + ct->is_original; + if (mlx5_aso_ct_query_by_wqe(priv->sh, ct, data)) + return rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Failed to query CT context"); + return 0; default: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, From patchwork Wed May 5 12:23:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92925 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D972CA0524; Wed, 5 May 2021 14:24:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F2D641159; Wed, 5 May 2021 14:24:12 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2051.outbound.protection.outlook.com [40.107.220.51]) by mails.dpdk.org (Postfix) with ESMTP id 0100A4114E for ; Wed, 5 May 2021 14:24:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GdpkYGBGlSudRRkMuaFjiiqA4ChyD5Xmsi2Bm+c22MqZ9TZHJBNO4/OFmw/QMSg0eJK+fZZbwCrVLc09BhupwU3x5f1BPAoTwjeMoAs/6PuRO3KGQk1iO88jjpnF5z/ftcugXkq0qk2tXMJEvJi/wQhSg/lg0Xjvz98ZTvgDMm7RWDeoCwl7p1VrtA/6tOk/x/vPg4tZYiKQob5JTh5fEKxrGFMLyYQ2RlSlz2mY3k59SxXBwA9Y0lFS93AdAOJKUGR2LQV5mqjmdB+8Q+Bbt87tz7SHCociHaasfVYKSvxL/mXlbKf+xq1Svtpb5zsLonvilBixWzgSVUDKWGWWIA== 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-SenderADCheck; bh=yVPlTU6ih4+mZg0N0mF+AO9yT79T1Oqeiv4hgAg15mg=; b=EMu8yibAVvvgWPi+bfdcBbwfGFZVOpk6rK75u5IALPj6ymspsRdNn3WrtuJLFYvt7Cy+jdUxUXs7X4eT/5DQxONfv1njyyeMfT0YEoKL4892Nby1igyB01iuseXKWOZwGMc53SMUSUTIMPSPzRpVVbpu1PuYVbtmPXUnRZU1cH07TaIOFuRgUZad27925oG2Ve9JW1nA9JeX1+xrUkaYVo8jFHVFLfzjkALKcOrFTAEsNrSyuDRNzDQfAV9FrHT0DxGSR3z6krUQ4gLvOEZcWO5GS3O8MqeNGkQ2PsMUyAT9Z5rttUOBjkbxeqL99yHCeqSsE4gamUkNQw4Jgh0O/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=yVPlTU6ih4+mZg0N0mF+AO9yT79T1Oqeiv4hgAg15mg=; b=gYvaaQGSoBa9b97g6BP5umJuT+L60X/POHX7bGiQc59eN11RWFZxWVa6iNdy4Nd9Aa/yOpfwK/KigNJGwO0rkLOMD4UIz7AYD9wBgGp1uHfpXmnGqg1Zj1lYx0CV7s3FZ1sCbEetxJJ+w0VZFNvTvPm5WH5mvqskcnnhY1Gow6sHDfjiEjqMYVvcgnnZlgHWw19OYdMQlbd1FCd7UkNF66nuaXhs8j4raF8L9pFOLF9ZupVU2kXD+j5JEVzucniQcetGGnXIvSE5/IEaJMCk1tT6qYyRF5PQ/vWWFeOPpkCDaCCZClKj492q10fT6gK2Ay0v2I5uyuomx01vO+GIlQ== Received: from DS7PR05CA0010.namprd05.prod.outlook.com (2603:10b6:5:3b9::15) by DM5PR12MB1641.namprd12.prod.outlook.com (2603:10b6:4:10::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.35; Wed, 5 May 2021 12:24:09 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::2c) by DS7PR05CA0010.outlook.office365.com (2603:10b6:5:3b9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.9 via Frontend Transport; Wed, 5 May 2021 12:24:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:09 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:05 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:21 +0300 Message-ID: <20210505122328.51129-11-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6070bb09-3e27-465c-2a3c-08d90fc0aef0 X-MS-TrafficTypeDiagnostic: DM5PR12MB1641: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xx62o9jrxzI/jCOS15K0EmM8MLEYgrHa1pSsXz+tNj9Bc8cXamIaBL31VGRC52qC4G5KPycbkki3ZRgynhYZRA9NcyKeG8GE0pbGQbBoiRodD3w4RB1MTU5xEG+lBzy8Jw/nYPs1z5ChGBrWqwtYmCOawhW4aSVprBLfWkL0kfsHHuZWCzqxjytZctdKmVXFSc9xTYTrsxemxcIFW3olxkNewu2rY/+zwljo3WYDr95eTHArlGu5QrW/RvJFrGcTA0HBndPe6p3n0tqHp84gRLbLastRwZbbQwqJ4bZJLfKPCMjLYMRsRUqWX5oDTc+3DERDK5bSeIxkdMYD/MHioIgwvADgrcxwQ0aP/oXOJ6eOntbq7FylFpBmKSwDOjk+tnN9Y7hnbjKMAXYCitsVn/jTjRskpoOg6815pECK/Hk7bEVwGh8GtOPmOX3Sx6aK+aX68vd2QP+qvGvxD0Eglte5yo7YjImwvH/aYSt24MshZiFo2ESif0Rpiyru7LjgTxcS9ZXafhcmUWACO5r6Z45fqfC7m76bwteRuj0rpFYycve9qorHKTAyQnkqsgzsMKQ5efjPBbUH9VTPn1kOAaxt6EtQAvav4bFsb5YEpyWaL/jKdgqqltyfP/LkTf8g49XEssCKxgMbn3mRXmmtDw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(346002)(136003)(376002)(39860400002)(36840700001)(46966006)(54906003)(336012)(316002)(82310400003)(83380400001)(4326008)(478600001)(426003)(7636003)(86362001)(110136005)(36906005)(2616005)(16526019)(186003)(6286002)(356005)(36860700001)(26005)(107886003)(47076005)(7696005)(36756003)(2906002)(6666004)(82740400003)(8676002)(8936002)(55016002)(70586007)(1076003)(5660300002)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:09.1539 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6070bb09-3e27-465c-2a3c-08d90fc0aef0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1641 Subject: [dpdk-dev] [PATCH v7 10/17] net/mlx5: add ASO CT destroy handling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When trying to destroy an ASO connection tracking context, the DR action created on this context should also be destroyed. Before inserting the related software object into the management free list, the reference count should be checked. Right now, the context object will not be freed to the system and will be reused directly from the free list. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index e1beb83e92..c0d17fd599 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -11531,9 +11531,15 @@ flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t idx) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; + uint32_t ret; struct mlx5_aso_ct_action *ct = flow_aso_ct_get_by_idx(dev, idx); - uint32_t ret = __atomic_sub_fetch(&ct->refcnt, 1, __ATOMIC_RELAXED); + enum mlx5_aso_ct_state state = + __atomic_load_n(&ct->state, __ATOMIC_RELAXED); + /* Cannot release when CT is in the ASO SQ. */ + if (state == ASO_CONNTRACK_WAIT || state == ASO_CONNTRACK_QUERY) + return -1; + ret = __atomic_sub_fetch(&ct->refcnt, 1, __ATOMIC_RELAXED); if (!ret) { if (ct->dr_action_orig) { #ifdef HAVE_MLX5_DR_ACTION_ASO_CT @@ -11549,6 +11555,8 @@ flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t idx) #endif ct->dr_action_rply = NULL; } + /* Clear the state to free, no need in 1st allocation. */ + MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_FREE); rte_spinlock_lock(&mng->ct_sl); LIST_INSERT_HEAD(&mng->free_cts, ct, next); rte_spinlock_unlock(&mng->ct_sl); @@ -14078,6 +14086,12 @@ flow_dv_action_destroy(struct rte_eth_dev *dev, DRV_LOG(DEBUG, "Indirect age action %" PRIu32 " was" " released with references %d.", idx, ret); return 0; + case MLX5_INDIRECT_ACTION_TYPE_CT: + ret = flow_dv_aso_ct_release(dev, idx); + if (ret) + DRV_LOG(DEBUG, "Connection tracking object %u still " + "has references %d.", idx, ret); + return 0; default: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, From patchwork Wed May 5 12:23:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92927 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D22C7A0A02; Wed, 5 May 2021 14:25:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D0FA4116A; Wed, 5 May 2021 14:24:15 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2041.outbound.protection.outlook.com [40.107.223.41]) by mails.dpdk.org (Postfix) with ESMTP id 5560B4115E for ; Wed, 5 May 2021 14:24:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dFn799W7SiP4HeoWBswSdXzMGstUaSYQ8atNFqFIdowOMoRIETpj+nMK4SKrjDVVWNOxFJQ/wbDifD+rMmIbQXp03c2TRvBhPVBtJGC45xCtozhHTg2Pd9DVUbIxsXjXsIYIc1H3z6h0lqFqeNTiyydgy8uiVQSEtB/nQs2dADqRHze9xO3fLWzljx70dIn3sCm50ZjimmxuRK2qdYY0BeaqIf7fKu9TDOdpeM7lJ5cw3IQHSCMrKagd2SDdhQKjTvusr+FGlV5gzQLbKOQ9aKbIIKuDauUb643+xzjpkAfPm+Mdrwhp+C5/WQPDDvrP0pngkevA86Iypk/0D8Jzlg== 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-SenderADCheck; bh=Thttn/iUPnwf592vWgInHxOKWiQBYwI6jR4GCFrfed8=; b=NeG79nNA9yBdewXpGKIWdI8idLgwFByAUk7nro6KnGy5Ch65yGQLvSL6/YHhXGQNPUoeaJ/tOnjhGbho60jG1+n+Zj3hG401wdZvNmiMLL9bBrdldFR5DvH/AnRo9JCwjK+kAQ0A+TrenvwwMnSxRMjuD4k32Y33SzRppwBO0EJIySp8lWjvNbzn3uZJWarwcF9Wk3L/Iwz2s7Dtx7OwZktjPPdT30zkdIDej/GtFxEkGzZQVBWYUw6lCYgSji7la/nAdT2u7cMT2hMEXn2BP/7hQRC7krlC7s3rs6nYcp09cSvtpfPqY+Kl0OZ8i4SHlAw1jpb3He4zC+NrY4eFUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=Thttn/iUPnwf592vWgInHxOKWiQBYwI6jR4GCFrfed8=; b=kui3gNJFq11if1UJEPLmJNDBDOJfsLfm7L6W32WRHFcbZWv/ERzsK1CIspbnngG5QqdHhxuAPxOKE3/MUqsdyp9GfpGZZeQ08dQ00zMST1K/Kr6AD7mEWKgzWpdq4XmLLxKWvnEHDHhOxZD4WHnXOWB4MpSJE6LG9foKZEn4GEWyXM1WY2vc0LxhBEHx2/kVAvPj4dNjaKcR6uTF0+iizlmHjbkvIdH9o7snUHKXlYfb8EOEK71/X99bu9v4dMKM1RHAbc6dyIycxbXTOAcNDjhfxxSeei5zt3YSFKHHCq1FRFxrhwcb71A1Q8r0pkUKl6ZJCVq/VCAEch5JDUir2g== Received: from DS7PR05CA0018.namprd05.prod.outlook.com (2603:10b6:5:3b9::23) by MW3PR12MB4457.namprd12.prod.outlook.com (2603:10b6:303:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.38; Wed, 5 May 2021 12:24:11 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::26) by DS7PR05CA0018.outlook.office365.com (2603:10b6:5:3b9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.11 via Frontend Transport; Wed, 5 May 2021 12:24:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:11 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:07 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:22 +0300 Message-ID: <20210505122328.51129-12-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a97a4838-1592-4921-6c92-08d90fc0b015 X-MS-TrafficTypeDiagnostic: MW3PR12MB4457: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pJslTIQG2lcBR+f8cC4zGOdRbSw7/4hmcHJFarEDlLZUkW1oeVKkGez//NoUp7K6qH4bzyI5HPayk3fO+K3E66k+7hp4oxpt24/pGlkTANUGemBcUjJxGky30q63KiTBjg8MtGCV79EPAmmKkCLbljy28peuWglym4vq6pZ94yargZFeMxFJA+3PekZe+JJ7LI/2wbhkDB9ulUvMZLzIJnjoqdp18Fq5RJSsgqo0xaU6knJVPOBVWXYSV/XXbiMMlheVHAICfLrVEgmhEFMWVdSyHDTCjhGK2PQNch89y0sx5B63AMTnYTW8X3S9fIzwQWENxo8QeNU3//5BKxE3aCLALXDcYQbF5EFv6SnxRvJ7XXo7dAZSRA7uHACnkVYvrbVuZzUQhKxxuP6UJ4Qy6vXDgaNr7N6zplk80aEtl7IG4I2KFXTXc++TEBj/r3R/gsfexF7MjB0BfjTAsEZSWrygwaFJ3Tkbcr+Z5/iyVc3/arZOjI6p1fw8sG2ae7ern1lpvKTiOn6sPwN1dom+5c8HZvCIpa/o85W268mswoBaNBT0tGop8JxdXw8p7QL4B6rPzSuXd8ZTsjnzhvNxWE9kNm6W7WwiLH1/cW/UJfSUl93MW1pZyuvzICkwWx8VifgXNNoHy+fpZb/IC+SDxLe4/FwA+YftPMRn1WRR1OoXIwQQdKIzpqgaSmRWfW76 X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(396003)(376002)(39860400002)(136003)(46966006)(36840700001)(47076005)(426003)(2906002)(8676002)(336012)(1076003)(36756003)(5660300002)(36860700001)(356005)(4326008)(8936002)(70206006)(55016002)(26005)(6286002)(186003)(7696005)(83380400001)(107886003)(2616005)(70586007)(82310400003)(86362001)(36906005)(82740400003)(16526019)(7636003)(316002)(110136005)(54906003)(478600001)(6666004)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:11.0778 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a97a4838-1592-4921-6c92-08d90fc0b015 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4457 Subject: [dpdk-dev] [PATCH v7 11/17] net/mlx5: add translation of CT action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When creating a flow with this action context for CT, it needs to be translated in 2 levels. First, retrieve from action context to rte_flow action. Second, translate it to the corresponding DR action with traffic direction that was specified when creating or updating via rte_flow_action_handle* API. Before using the DR action in a flow, the CT context should be available to use in the hardware. A synchronization is done before inserting the flow rule with CT action to check the HW availability of this CT context. In order to release the DR actions and reuse the context of a CT, the reference count should also be handled in the flow rule destroying. The CT index will be recorded in the rte_flow by reusing the ASO age index to save memory, since only one ASO action is supported in one flow rule currently. The action context type should also be saved for CT. When destroying a flow rule, if the context type is CT and the index is valid (non-zero), the release process should be handled. By default, the handling will fall back to try to release the ASO age if any. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow.c | 9 +++++++ drivers/net/mlx5/mlx5_flow.h | 7 +++++- drivers/net/mlx5/mlx5_flow_aso.c | 41 ++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 28 +++++++++++++++++++++- 5 files changed, 85 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 6d3f89519d..a1bb779306 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1715,5 +1715,7 @@ int mlx5_aso_ct_wait_ready(struct mlx5_dev_ctx_shared *sh, int mlx5_aso_ct_query_by_wqe(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_ct_action *ct, struct rte_flow_action_conntrack *profile); +int mlx5_aso_ct_available(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct); #endif /* RTE_PMD_MLX5_H_ */ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 65399cd452..d5957d1ce4 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3559,6 +3559,15 @@ flow_action_handles_translate(struct rte_eth_dev *dev, break; } /* Fall-through */ + case MLX5_INDIRECT_ACTION_TYPE_CT: + if (priv->sh->ct_aso_en) { + translated[handle->index].type = + RTE_FLOW_ACTION_TYPE_CONNTRACK; + translated[handle->index].conf = + (void *)(uintptr_t)idx; + break; + } + /* Fall-through */ default: mlx5_free(translated); return rte_flow_error_set diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 0d2daa7faf..fe0a53c1e2 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -230,6 +230,7 @@ enum mlx5_feature_name { #define MLX5_FLOW_ACTION_TUNNEL_MATCH (1ull << 38) #define MLX5_FLOW_ACTION_MODIFY_FIELD (1ull << 39) #define MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY (1ull << 40) +#define MLX5_FLOW_ACTION_CT (1ull << 41) #define MLX5_FLOW_FATE_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \ @@ -973,11 +974,15 @@ struct rte_flow { uint32_t drv_type:2; /**< Driver type. */ uint32_t tunnel:1; uint32_t meter:24; /**< Holds flow meter id. */ + uint32_t indirect_type:2; /**< Indirect action type. */ uint32_t rix_mreg_copy; /**< Index to metadata register copy table resource. */ uint32_t counter; /**< Holds flow counter. */ uint32_t tunnel_id; /**< Tunnel id */ - uint32_t age; /**< Holds ASO age bit index. */ + union { + uint32_t age; /**< Holds ASO age bit index. */ + uint32_t ct; /**< Holds ASO CT index. */ + }; uint32_t geneve_tlv_option; /**< Holds Geneve TLV option id. > */ } __rte_packed; diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 92fa9ede60..64631ffc29 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -1388,3 +1388,44 @@ mlx5_aso_ct_query_by_wqe(struct mlx5_dev_ctx_shared *sh, mlx5_aso_ct_obj_analyze(profile, out_data); return ret; } + +/* + * Make sure the conntrack context is synchronized with hardware before + * creating a flow rule that uses it. + * + * @param[in] sh + * Pointer to shared device context. + * @param[in] ct + * Pointer to connection tracking offload object. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_aso_ct_available(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct) +{ + struct mlx5_aso_ct_pools_mng *mng = sh->ct_mng; + uint32_t poll_cqe_times = MLX5_CT_POLL_WQE_CQE_TIMES; + enum mlx5_aso_ct_state state = + __atomic_load_n(&ct->state, __ATOMIC_RELAXED); + + if (state == ASO_CONNTRACK_FREE) { + rte_errno = ENXIO; + return -rte_errno; + } else if (state == ASO_CONNTRACK_READY || + state == ASO_CONNTRACK_QUERY) { + return 0; + } + do { + mlx5_aso_ct_completion_handle(mng); + state = __atomic_load_n(&ct->state, __ATOMIC_RELAXED); + if (state == ASO_CONNTRACK_READY || + state == ASO_CONNTRACK_QUERY) + return 0; + /* Waiting for CQE ready, consider should block or sleep. */ + rte_delay_us_sleep(MLX5_ASO_WQE_CQE_RESPONSE_DELAY); + } while (--poll_cqe_times); + rte_errno = EBUSY; + return -rte_errno; +} diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index c0d17fd599..1a27379d3b 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -11776,6 +11776,7 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev, return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "Failed to update CT"); + ct->is_original = !!pro->is_original_dir; return idx; } @@ -11941,6 +11942,8 @@ flow_dv_translate(struct rte_eth_dev *dev, int action_type = actions->type; const struct rte_flow_action *found_action = NULL; uint32_t jump_group = 0; + uint32_t ct_idx; + struct mlx5_aso_ct_action *ct; if (!mlx5_flow_os_action_supported(action_type)) return rte_flow_error_set(error, ENOTSUP, @@ -12394,6 +12397,26 @@ flow_dv_translate(struct rte_eth_dev *dev, return -rte_errno; action_flags |= MLX5_FLOW_ACTION_MODIFY_FIELD; break; + case RTE_FLOW_ACTION_TYPE_CONNTRACK: + ct_idx = (uint32_t)(uintptr_t)action->conf; + ct = flow_aso_ct_get_by_idx(dev, ct_idx); + if (mlx5_aso_ct_available(priv->sh, ct)) + return rte_flow_error_set(error, rte_errno, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, + "CT is unavailable."); + if (ct->is_original) + dev_flow->dv.actions[actions_n] = + ct->dr_action_orig; + else + dev_flow->dv.actions[actions_n] = + ct->dr_action_rply; + flow->indirect_type = MLX5_INDIRECT_ACTION_TYPE_CT; + flow->ct = ct_idx; + __atomic_fetch_add(&ct->refcnt, 1, __ATOMIC_RELAXED); + actions_n++; + action_flags |= MLX5_FLOW_ACTION_CT; + break; case RTE_FLOW_ACTION_TYPE_END: actions_end = true; if (mhdr_res->actions_num) { @@ -13564,7 +13587,10 @@ flow_dv_destroy(struct rte_eth_dev *dev, struct rte_flow *flow) mlx5_flow_meter_detach(priv, fm); flow->meter = 0; } - if (flow->age) + /* Keep the current age handling by default. */ + if (flow->indirect_type == MLX5_INDIRECT_ACTION_TYPE_CT && flow->ct) + flow_dv_aso_ct_release(dev, flow->ct); + else if (flow->age) flow_dv_aso_age_release(dev, flow->age); if (flow->geneve_tlv_option) { flow_dv_geneve_tlv_option_resource_release(dev); From patchwork Wed May 5 12:23:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92926 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E9BCA0524; Wed, 5 May 2021 14:25:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C6FE41163; Wed, 5 May 2021 14:24:14 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2084.outbound.protection.outlook.com [40.107.92.84]) by mails.dpdk.org (Postfix) with ESMTP id 3E4974115D for ; Wed, 5 May 2021 14:24:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YWnKDWhdswxQz7qWkgAUEOBUkiaQKg6qYcPsygLCdxG9K7rWjXVYYJKL2bfJPKhYjZqaSfSXopwchAiHaTAYFSq4qmobECZm8L6z4VHbTPOUBwWoSBjdKAIgSpY6wBfw9KvE/z8Xa6TEkerJMsXOtMzDjkiKLejbUpQ+B4QNrlEj25Q/AokvEl3i/E8Djydnl4OWLbJn1pS6NK86E5ve3XLT/GB5AgfbbexkgHZpz8uL0y0fMkCzxUiIPjs+/uDq7sPQHSRAnGymcUTZRnklPnznYJLp348KikMj1oIN4BBj0zUU3eUjQ5Ze5ZFF2TpLzcoag+A5Lcl/Gz57oPtMBQ== 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-SenderADCheck; bh=cnJqwAR1LbdS5c/Y12wVWOKrg2q6ZbByDkSreIRG8sg=; b=Lm0yTPs4aaH4ehU4DKC5l9iq67xFH/dIbp7TreK7+shNS6jFwmMYFEWifgAp+Cvbn7fcR2eqvxMEnYGjIHU7BGPx0v6m4p1jD0Cst9cQIUsf0Uya63iW3CkiaQmoOj7f8F6f/BjhNyN8BRP07amixXWtW9uyY36o1fA0cgPYv1mA2IuMTlqw6HZaH5qqQcPPpKOkJfzRv+P7jiJratPPOsdvTrcr7Tf2p+fHGGRIlk9lKPFcKHkDIlVZw4Yc94EFmzF1PsqdHMFaVlQ1G8X4CHKaATeBweOH/4jk5Md99MJja/jWCFEeeozA5627TWpt/eXk8KX+ZfJHdEfOHqNDlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=cnJqwAR1LbdS5c/Y12wVWOKrg2q6ZbByDkSreIRG8sg=; b=a2KpxBiOHQxwF/wFvrryJrXjpMhw9gn7j2zpsCB4P68xwlVMIZwsi2lPWvaiDfRQKukp4yawYPYMstB24fe6qMz+IxL315Awxwgg8lknvEcqHiMnwiKhQZxBck2tMf9cumIpalmtuzPTF6ARJXzAxfot8vO8tFOXHD734El6UoEcF5cXC28Ol17CUP4F+tey68HcQp4G6VVdzSe/QoJPgbcjeyx5HslSvz1FUgIpeGSBdfmqXJmSE4hV7hXAliJtVGkP9uZU4k5bkK9Jfe9AcvtkAfRLQNGUJgbuiTJ5LVdjzCzFc8cRl8MMb++adCe8NvxCSYF5ozxlxpmZtzTFQA== Received: from DS7PR05CA0012.namprd05.prod.outlook.com (2603:10b6:5:3b9::17) by CH0PR12MB5060.namprd12.prod.outlook.com (2603:10b6:610:e3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25; Wed, 5 May 2021 12:24:12 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::52) by DS7PR05CA0012.outlook.office365.com (2603:10b6:5:3b9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.9 via Frontend Transport; Wed, 5 May 2021 12:24:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:12 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:10 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:23 +0300 Message-ID: <20210505122328.51129-13-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8194f931-92a7-4492-f8fa-08d90fc0b0b9 X-MS-TrafficTypeDiagnostic: CH0PR12MB5060: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1eO8IVStnFraALftme+BDFSC+m6rnTXcW+ofB1vjg2SLvyN0tpP2S1nrr8VltsxUVZJMcl6yfskLpkobaixmM/iR4xsnn3g02OiBy2kXRgnKE8I9ze1gO0uEWFrQSVGTIJuWO+X3ANp/1QQm8eGzeE3Hqoiukxr1LVJYbtun9z+ZHsswBAGtwvTc/vaza1LrO31v/EzT9e8zlOzjhT1SJhc8fvfz01FUIFJ4lS/CvQjy0D6YsiWYBVX2gbQKr0d7okYo/5NLb16HIS1D76P9dF6zKMgxT+z3l823gnAsrMNNaPXFl0U4l4RmY3wS6CEwnJnCjCw8G2nC+/LpoPmrImHku6YMVn5hCGGZZSOuRgNl+70a1nkx0I8s9EiFtdAW5e0+j6P0nb5pzGgMnLOJ5TkQqLDeilATNRYc5AgeKTYHqE/auTb+eWLAvhyC9bxVPugNwoA77HOa4p0ZC2URgZI0/pZcnLUqEn/SHOUkPLpJ1oI+3N7DRZIBRP9DnqBZlnI2CiQrwvlfq3p++Bdrsdt/L/C+HMDMR381UThzH8Kjt5Hy7QNqt1qmQfVz7sUDe2pRlofaolQMW9S4lB3w91+jTZ1PWyiRxQpZvrDaDPRA6FaV1QJjOyGQq3OrT8pAcWYnJVw21UCIQtwWT/b4fg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(376002)(136003)(346002)(39860400002)(36840700001)(46966006)(7696005)(36756003)(5660300002)(86362001)(54906003)(316002)(8936002)(110136005)(2616005)(186003)(36906005)(82310400003)(8676002)(2906002)(6666004)(26005)(356005)(107886003)(7636003)(70206006)(4326008)(478600001)(36860700001)(55016002)(336012)(83380400001)(82740400003)(1076003)(16526019)(426003)(70586007)(6286002)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:12.1651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8194f931-92a7-4492-f8fa-08d90fc0b0b9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5060 Subject: [dpdk-dev] [PATCH v7 12/17] net/mlx5: add translation of CT item X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The return register of the DR action will be used for matching. After the ASO CT checking of a TCP packet, the syndrome is filled in the register. Only the 8 LSB should be used. A converting from RTE_FLOW_CONNTRACK_FLAG* to the syndrome should be done after checing the spec and mask fields. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 7 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 62 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index fe0a53c1e2..9ad518b824 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -409,6 +409,13 @@ enum mlx5_feature_name { /* Maximum number of fields to modify in MODIFY_FIELD */ #define MLX5_ACT_MAX_MOD_FIELDS 5 +/* Syndrome bits definition for connection tracking. */ +#define MLX5_CT_SYNDROME_VALID (0x0 << 6) +#define MLX5_CT_SYNDROME_INVALID (0x1 << 6) +#define MLX5_CT_SYNDROME_TRAP (0x2 << 6) +#define MLX5_CT_SYNDROME_STATE_CHANGE (0x1 << 1) +#define MLX5_CT_SYNDROME_BAD_PACKET (0x1 << 0) + enum mlx5_flow_drv_type { MLX5_FLOW_TYPE_MIN, MLX5_FLOW_TYPE_DV, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 1a27379d3b..4a58b01da7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9616,6 +9616,64 @@ flow_dv_translate_item_ecpri(struct rte_eth_dev *dev, void *matcher, } } +/* + * Add connection tracking status item to matcher + * + * @param[in] dev + * The devich to configure through. + * @param[in, out] matcher + * Flow matcher. + * @param[in, out] key + * Flow matcher value. + * @param[in] item + * Flow pattern to translate. + */ +static void +flow_dv_translate_item_aso_ct(struct rte_eth_dev *dev, + void *matcher, void *key, + const struct rte_flow_item *item) +{ + uint32_t reg_value = 0; + int reg_id; + /* 8LSB 0b 11/0000/11, middle 4 bits are reserved. */ + uint32_t reg_mask = 0; + const struct rte_flow_item_conntrack *spec = item->spec; + const struct rte_flow_item_conntrack *mask = item->mask; + uint32_t flags; + struct rte_flow_error error; + + if (!mask) + mask = &rte_flow_item_conntrack_mask; + if (!spec || !mask->flags) + return; + flags = spec->flags & mask->flags; + /* The conflict should be checked in the validation. */ + if (flags & RTE_FLOW_CONNTRACK_PKT_STATE_VALID) + reg_value |= MLX5_CT_SYNDROME_VALID; + if (flags & RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED) + reg_value |= MLX5_CT_SYNDROME_STATE_CHANGE; + if (flags & RTE_FLOW_CONNTRACK_PKT_STATE_INVALID) + reg_value |= MLX5_CT_SYNDROME_INVALID; + if (flags & RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED) + reg_value |= MLX5_CT_SYNDROME_TRAP; + if (flags & RTE_FLOW_CONNTRACK_PKT_STATE_BAD) + reg_value |= MLX5_CT_SYNDROME_BAD_PACKET; + if (mask->flags & (RTE_FLOW_CONNTRACK_PKT_STATE_VALID | + RTE_FLOW_CONNTRACK_PKT_STATE_INVALID | + RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED)) + reg_mask |= 0xc0; + if (mask->flags & RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED) + reg_mask |= MLX5_CT_SYNDROME_STATE_CHANGE; + if (mask->flags & RTE_FLOW_CONNTRACK_PKT_STATE_BAD) + reg_mask |= MLX5_CT_SYNDROME_BAD_PACKET; + /* The REG_C_x value could be saved during startup. */ + reg_id = mlx5_flow_get_reg_id(dev, MLX5_ASO_CONNTRACK, 0, &error); + if (reg_id == REG_NON) + return; + flow_dv_match_meta_reg(matcher, key, (enum modify_reg)reg_id, + reg_value, reg_mask); +} + static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] = { 0 }; #define HEADER_IS_ZERO(match_criteria, headers) \ @@ -12734,6 +12792,10 @@ flow_dv_translate(struct rte_eth_dev *dev, match_value, head_item, items); break; + case RTE_FLOW_ITEM_TYPE_CONNTRACK: + flow_dv_translate_item_aso_ct(dev, match_mask, + match_value, items); + break; default: break; } From patchwork Wed May 5 12:23:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92928 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D280A0524; Wed, 5 May 2021 14:25:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD5D341106; Wed, 5 May 2021 14:24:18 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-eopbgr760072.outbound.protection.outlook.com [40.107.76.72]) by mails.dpdk.org (Postfix) with ESMTP id 8D51241157 for ; Wed, 5 May 2021 14:24:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpTi4QxxDlc1xB6Cjgwt36IvLB9O1PSo/kwLaxXzMwJ18q2JO28UeRS2OuMFzsTy9vJzVBtnjdgVXbD3lAajv2CQEfGCAKsyZUQitxbDrvcizF+phewhXN7pI2Imau4bqWuCkyX7DrIqGF/frx7ONdndx9lNN9OsCnmOvIfcCO5cg3DtzrjlOkAFBT19UKZvUJTkFwjEBFj3XaI7Sj/UyJ6ukBCwFm60qiUqInxDns/wfUq7N3LlrHrKlhR6HIBPog7FjvZ7OFDzvnI1rqY6alvRTBrNFAWIzfolNxxwnAanxXoj7CPvz2P5XHh/nrzer5pFd6IJUva90Bu+HAVbdQ== 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-SenderADCheck; bh=zjG4uVmWyYX8dDpGlLwvHZOp9IaHFXlIpqV9CFtPPQM=; b=hjdqS3txMQJ7tUDQHecMPQEiUwfomi6zmd3dr+N5Ah5WdDn7PWyz2kIhGDcne+b01w/E7slxajiZ/QTFnEFymqrtpvlHHfc31jsn4CUdnO09fR7y7hzhJa5QS4k/Uvyb7T77iD+j3RDz1OaZXD9tO+EhQ0qNn4N3/mAuFLvkU68++hBV9WHnYov3e2qiAvZUEz3LXd4de1DA4it3k1JnKSn9dlMcRicutUE2m9Nwmpq+Go7B8gl0X8ArZ89UGwHOM0oIpL9T7DBO7a4p6MO+Q9S3IRzUpkTLGzNS+63GVyqeroGMYHUbaxbXjtR6Pw1Tvx9JiUXbJtQipFcrdXak5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=zjG4uVmWyYX8dDpGlLwvHZOp9IaHFXlIpqV9CFtPPQM=; b=b2OAci6cMti9rQPfn5Wny2Q4u0tpiK8OFyojrZWLr8OJpcs3zMTzNWk57kXocqGQ07xkibhqvxVXRCI38LXPB3TRErOzinSh2ih5hyyc+x2sC9J7GG98o7T4qYtUdFvqlCSvJ9lxyj2ZVYdWegwjsfrGq+ovmqw2ZBQEVKJKbdaINi0RdePr8e5GzC6TK+Q99oRq59KjVqY42YyzFC5rgX+fdXErpT4ro8O4HMKCqZm0yYg3OJ5/DenVjDSExkT38JhMZva0sEuY5qpnadxCP24dKg5Pi1/HQD5ufWjSOU1zdcmR3R6CY0HzpaQ8w+98LfKZRV9l7d+3gCiE9+VVLA== Received: from DM6PR02CA0117.namprd02.prod.outlook.com (2603:10b6:5:1b4::19) by CY4PR1201MB2518.namprd12.prod.outlook.com (2603:10b6:903:d6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24; Wed, 5 May 2021 12:24:14 +0000 Received: from DM6NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::41) by DM6PR02CA0117.outlook.office365.com (2603:10b6:5:1b4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT061.mail.protection.outlook.com (10.13.173.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:13 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:12 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:24 +0300 Message-ID: <20210505122328.51129-14-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f97c283-3296-48c0-c6ea-08d90fc0b1d0 X-MS-TrafficTypeDiagnostic: CY4PR1201MB2518: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QCMpj8o0v6GpOpHrf1vTdAg1DVufQ5lBgi+CRCwAg9+Zv2/Vr4RUk0ZBC6mTJv4pso890wVV/udJOpi1vY6PMCbKb61cG0QaOUtN6n93lp12MvGFHJxxyG96qEIekb+RGMYLAwPX2o/eS/fyHGNuZERq6mCVQsPxNBYpaC7Vv6728uqUmmgmFq+RBRcWWedKavRlLW38sunNmGlCpifHa8qNep47awCMD1daWtz62DBQrUyqIpy0eNamlfL+KAVdhpW2QAb0+d+npHNUAPMAmTj5qn2sTuCpFehhtskJcaLOkfLZvTociq5QfW+K0a4DEOq7/63Wp0SGs0abKwTSeb56ZN0rGONmmaFjjzwnrzjnzkATrz3plBBqF+nJdnTYgkeO5Rc2HI9MUXajM5ffk48u3XUqpWSgh1c2QljrWuem580v+a8IXv4/4vYinv4thwqJ276qSMiFYMNBnV4or7jI5paADRL+idYyd66ESYbwLROqqdQY8nF2gOj68+3To6se/0steTvfEbKLWvO9Se1pp0gzFu2BEwviE5WzrRMl6uXNEAFh7WwmijFbEFKaHfFqUaWWd3GNRknfz57+X4R9rpeBQ7+wHKEwBJ7sbur4acm83Uw9B8Jf3CHsvPLMB/3bptBCTgJTS2zrFrZ2jHLtJ4Q1Yc6bjsWsgxFDJiFoHQjYKH45Ig7STrBESlcF X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(376002)(39860400002)(346002)(396003)(36840700001)(46966006)(36906005)(1076003)(15650500001)(26005)(47076005)(2906002)(316002)(5660300002)(54906003)(478600001)(7696005)(6286002)(107886003)(110136005)(83380400001)(86362001)(7636003)(55016002)(4326008)(36756003)(336012)(186003)(82310400003)(16526019)(6666004)(2616005)(356005)(426003)(8676002)(70206006)(70586007)(8936002)(82740400003)(36860700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:13.9933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f97c283-3296-48c0-c6ea-08d90fc0b1d0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB2518 Subject: [dpdk-dev] [PATCH v7 13/17] net/mlx5: add CT context update X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When updating a connection tracking context, two separate parts could be updated. First, the direction. This will only update the traffic direction recorded in the software for flow creation. Second, the TCP parameters. The hardware context will be updated via the WQE. This update will be blocked until the hardware status is updated and ready for the next flow creation. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4a58b01da7..f7eeca20ab 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -14254,6 +14254,60 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx, return ret; } +/* + * Updates in place conntrack context or direction. + * Context update should be synchronized. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] idx + * The conntrack object ID to be updated. + * @param[in] update + * Pointer to the structure of information to update. + * @param[out] error + * Perform verbose error reporting if not NULL. Initialized in case of + * error only. + * + * @return + * 0 on success, otherwise negative errno value. + */ +static int +__flow_dv_action_ct_update(struct rte_eth_dev *dev, uint32_t idx, + const struct rte_flow_modify_conntrack *update, + struct rte_flow_error *error) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_action *ct; + const struct rte_flow_action_conntrack *new_prf; + int ret = 0; + + ct = flow_aso_ct_get_by_idx(dev, idx); + if (!ct->refcnt) + return rte_flow_error_set(error, ENOMEM, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "CT object is inactive"); + new_prf = &update->new_ct; + if (update->direction) + ct->is_original = !!new_prf->is_original_dir; + if (update->state) { + ret = mlx5_aso_ct_update_by_wqe(priv->sh, ct, new_prf); + if (ret) + return rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Failed to send CT context update WQE"); + /* Block until ready or a failure. */ + ret = mlx5_aso_ct_available(priv->sh, ct); + if (ret) + rte_flow_error_set(error, rte_errno, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Timeout to get the CT update"); + } + return ret; +} + /** * Updates in place shared action configuration, lock free, * (mutex should be acquired by caller). @@ -14289,6 +14343,8 @@ flow_dv_action_update(struct rte_eth_dev *dev, case MLX5_INDIRECT_ACTION_TYPE_RSS: action_conf = ((const struct rte_flow_action *)update)->conf; return __flow_dv_action_rss_update(dev, idx, action_conf, err); + case MLX5_INDIRECT_ACTION_TYPE_CT: + return __flow_dv_action_ct_update(dev, idx, update, err); default: return rte_flow_error_set(err, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, From patchwork Wed May 5 12:23:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92929 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5E220A0524; Wed, 5 May 2021 14:25:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 501DB41175; Wed, 5 May 2021 14:24:20 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062.outbound.protection.outlook.com [40.107.94.62]) by mails.dpdk.org (Postfix) with ESMTP id B232641122 for ; Wed, 5 May 2021 14:24:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dGcmaa/aCD/0uv1cX9GnYSx7yzG8tmz1PEupOYWRmBImYIMyD7D4QD3xdzLt5Rx2wIm85EujH1LlVc6uMG7YPsTsOizxdTToRfCw0h3XyoR15+ff+ijI9plKcdLgH5Mnj+yet41jFljGwskX8yvQO083vr1ExtoSwpiDsCSbEIxpYtwxRltrnC7BNFQWY6qhhWLizSfxqlh5DWLpdv4Hu1GEFS5r4K0Q8iqfzuKUkn+TAIPG0m2OhW+l6hhUDhZl2soAV3GAnUdNSY45J/xDhqxm9xwBiP7vUCViKpjZan786FKBuuWgcmXAkHRPSq1ybyOgPyji7U3xzA3QuaJDEA== 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-SenderADCheck; bh=TQaMF6nLfooe1OW7HvHSFNsR6s5PlAQ5rWh+qMGAOrs=; b=BHD3yEEPq2B/nB+0BXBXGkiCjnAM//p4bK3EbX6pLobdAgPJBOLEkeKKTos/GgtdBEZxG4w3Fpu059f5KpQlIUw/5Uvsy0wOOz2AOV42D6tkTqih7R/RKxeINQjnYbRGdXeqbDr0P/K22yXbbwTly9YPAJaYEgIlXeoLImW5rM8s1sqlkwrkGVm+KnCK05Gd1wwpBp/fajbnPUD/5uPvXr41/3hUlBb156vy6t1vQPfqegYu3pi2Gy0rUZSxfKG0Th0076RCaU4uudK64tVETg1OfrZe0jTfyt7yphT3w+MqWl0e/4xMeUCMYP4iAhnsz2NVqRyN2KDhBrc3oB67sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=TQaMF6nLfooe1OW7HvHSFNsR6s5PlAQ5rWh+qMGAOrs=; b=fGfl9kFRQEQ5bHYgUBAX49yQq6Md1HeP916O5/+8d0OEo+0SMqLkAADbxzhoH2j1wOB6J2V1JIBeaFrJLjBGuYhhtNwGKSJ1uyUyAMLWpLb9aKaQKgOPq6N9WOJtuM7PjG39dfCUlggiM5MjqQM3mu6Y9hk7kUFENM3Ak77608Z66dCrOoYkf6kMM8x5s7F0tdn7cWr9z/Zee2IHW9dbxTEWqB/mWyW4Yd2M6DlFkNuais12ymNXGvIQHUDG7pB0s2wjnD1+QphHeIrDvcyKapNrmodX7B/vJcoHA5li4aWGwxuciMmT9oo58+d8xNgdJvg6zgW3063FRcuid3Zqnw== Received: from DM6PR01CA0009.prod.exchangelabs.com (2603:10b6:5:296::14) by BN6PR12MB1555.namprd12.prod.outlook.com (2603:10b6:405:5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.40; Wed, 5 May 2021 12:24:16 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::9e) by DM6PR01CA0009.outlook.office365.com (2603:10b6:5:296::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Wed, 5 May 2021 12:24:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:16 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:14 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:25 +0300 Message-ID: <20210505122328.51129-15-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1530351d-9240-45c4-cb5e-08d90fc0b30e X-MS-TrafficTypeDiagnostic: BN6PR12MB1555: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qs007XiZXJGCapwA34iwAox6bDlGzC2yMRI+lzeJ7kLqpLWnoxSY1m3OhgewPER0omXT/Uci98hp2/pnd+w97yYFxdb9eZ3flAZyeW+HU6MU3TBdEzrJ4IRGb4RnGtUO9C6qKp3Mq04jA6Uqnluzg4cE7F+FqAwV0DJdnyHnaIfnvReRc+ZzGDATQd8uv+R55MngtF7k0uoO1b9wSGxy94tu81y28bRwgE0fMBvJqXPkYkXpROTZHibSqPrWANgAswzh0zNKu4G7SPcYxarlvaSPpt6wxy/fDuIrNScsuacvVYc1/dtUk38M6U31D2NIHl00/yHQBmN22zwfUAAELZ5Y23yJZFAUxdJDHws2xHD2rc+OVDjac/LIlPnTDax+LgTEOLsFN+FsviZIqj/hw3LjpgvR8Z91qoTJs8LsVMImsic3+kVJ7V13jX7utbaitt662im/XJ/IplST6/dX4or0x6+RIhxmBg7812hBxk+kDwUBTLJpXe5XItrXwEmmq6sBBimR7LAutjpZPbzqf2k0JbevqhmyiaJ+jSbK+0lEBOlC+3sY7ZLk3VKlNS6T+ppruZUxqFoLbjoyh4e9E/ZV58GiuxCudeHkRQiMhY5Zt/0US91ihU0dIfEn9VX0mi2tBUzzpAehidfsn6zv1gqOHPOmA1je6UUyh7JllxFub6zx7axIFohHNwZYag0s X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(376002)(136003)(346002)(39860400002)(46966006)(36840700001)(356005)(70586007)(36756003)(7696005)(6286002)(26005)(55016002)(7636003)(6666004)(70206006)(82740400003)(8936002)(47076005)(8676002)(36860700001)(186003)(336012)(316002)(4326008)(107886003)(110136005)(2616005)(426003)(54906003)(83380400001)(1076003)(86362001)(36906005)(2906002)(478600001)(82310400003)(5660300002)(16526019)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:16.0705 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1530351d-9240-45c4-cb5e-08d90fc0b30e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1555 Subject: [dpdk-dev] [PATCH v7 14/17] net/mlx5: validation of CT action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The validation of a CT action contains two parts. The first is the CT action configurations parameter. When creating a CT action context, some members need to be verified. The second is that when creating a flow, the DR action of CT should be validated with other actions and items as well. Currently, only the TCP protocol support connection tracking. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 4 ++ drivers/net/mlx5/mlx5_flow.c | 31 +++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 69 +++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index a1bb779306..7eca6a6fa6 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1616,6 +1616,10 @@ int mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow, void mlx5_flow_rxq_dynf_metadata_set(struct rte_eth_dev *dev); int mlx5_flow_get_aged_flows(struct rte_eth_dev *dev, void **contexts, uint32_t nb_contexts, struct rte_flow_error *error); +int mlx5_validate_action_ct(struct rte_eth_dev *dev, + const struct rte_flow_action_conntrack *conntrack, + struct rte_flow_error *error); + /* mlx5_mp_os.c */ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index d5957d1ce4..f464271d42 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1688,6 +1688,37 @@ mlx5_flow_validate_action_count(struct rte_eth_dev *dev __rte_unused, return 0; } +/* + * Validate the ASO CT action. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] conntrack + * Pointer to the CT action profile. + * @param[out] error + * Pointer to error structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_validate_action_ct(struct rte_eth_dev *dev, + const struct rte_flow_action_conntrack *conntrack, + struct rte_flow_error *error) +{ + RTE_SET_USED(dev); + + if (conntrack->state > RTE_FLOW_CONNTRACK_STATE_TIME_WAIT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Invalid CT state"); + if (conntrack->last_index > RTE_FLOW_CONNTRACK_FLAG_RST) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Invalid last TCP packet flag"); + return 0; +} + /** * Verify the @p attributes will be correctly understood by the NIC and store * them in the @p flow if everything is correct. diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index f7eeca20ab..67538d0aa7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -3442,6 +3442,57 @@ flow_dv_validate_action_raw_encap_decap return 0; } +/* + * Validate the ASO CT action. + * + * @param[in] dev + * Pointer to the rte_eth_dev structure. + * @param[in] action_flags + * Holds the actions detected until now. + * @param[in] item_flags + * The items found in this flow rule. + * @param[in] attr + * Pointer to flow attributes. + * @param[out] error + * Pointer to error structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +static int +flow_dv_validate_action_aso_ct(struct rte_eth_dev *dev, + uint64_t action_flags, + uint64_t item_flags, + const struct rte_flow_attr *attr, + struct rte_flow_error *error) +{ + RTE_SET_USED(dev); + + if (attr->group == 0 && !attr->transfer) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Only support non-root table"); + if (action_flags & MLX5_FLOW_FATE_ACTIONS) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "CT cannot follow a fate action"); + if ((action_flags & MLX5_FLOW_ACTION_METER) || + (action_flags & MLX5_FLOW_ACTION_AGE)) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Only one ASO action is supported"); + if (action_flags & MLX5_FLOW_ACTION_ENCAP) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Encap cannot exist before CT"); + if (!(item_flags & MLX5_FLOW_LAYER_OUTER_L4_TCP)) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "Not a outer TCP packet"); + return 0; +} + /** * Match encap_decap resource. * @@ -7442,6 +7493,14 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, action_flags |= MLX5_FLOW_ACTION_MODIFY_FIELD; rw_act_num += ret; break; + case RTE_FLOW_ACTION_TYPE_CONNTRACK: + ret = flow_dv_validate_action_aso_ct(dev, action_flags, + item_flags, attr, + error); + if (ret < 0) + return ret; + action_flags |= MLX5_FLOW_ACTION_CT; + break; default: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, @@ -14291,6 +14350,10 @@ __flow_dv_action_ct_update(struct rte_eth_dev *dev, uint32_t idx, if (update->direction) ct->is_original = !!new_prf->is_original_dir; if (update->state) { + /* Only validate the profile when it needs to be updated. */ + ret = mlx5_validate_action_ct(dev, new_prf, error); + if (ret) + return ret; ret = mlx5_aso_ct_update_by_wqe(priv->sh, ct, new_prf); if (ret) return rte_flow_error_set(error, EIO, @@ -16175,6 +16238,12 @@ flow_dv_action_validate(struct rte_eth_dev *dev, NULL, "Mix shared and indirect counter is not supported"); return flow_dv_validate_action_count(dev, true, 0, err); + case RTE_FLOW_ACTION_TYPE_CONNTRACK: + if (!priv->sh->ct_aso_en) + return rte_flow_error_set(err, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "ASO CT is not supported"); + return mlx5_validate_action_ct(dev, action->conf, err); default: return rte_flow_error_set(err, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, From patchwork Wed May 5 12:23:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92930 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7628CA0524; Wed, 5 May 2021 14:25:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 844424112A; Wed, 5 May 2021 14:24:21 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2054.outbound.protection.outlook.com [40.107.102.54]) by mails.dpdk.org (Postfix) with ESMTP id 30E7341122 for ; Wed, 5 May 2021 14:24:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KL7Aex68AIBLOA8i1ozUqJaV9dqPYz1dlL11QYmtb4jwTgr5RtsEbz6uz2TO8wHRt0Rc/mMacMISxR5EqxsppNhmGXewjsGPOeb+Umj0NdJPpf43fbRIDvVap3f0HXkRFDVRaodkgMMsifoHgPaRFQCA0xAVWJ1Vamk14uLF981Td7+fA6NdZxiDMdGPIbIBRuJVpuySPgGmK5D1xrhcIYFMf8uZPwgHA+cIvesHNEk1H6yCcbQ8Q+EgCWyligXrrqJ1cZNiBKYy+nT4xJa0lvbqjhZyfc4pxwdPJyD4FKx835h2x8MZTbtXfWRwLO34tJtgxLIwVmpmwHkELgqG3w== 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-SenderADCheck; bh=VsQivPTxJUPH1Kj9gYPdJ0861oSm5sW/7V0APgwVkVU=; b=em3aYWObCmV4+dnqm22C7zpQBslwchb5tWoNJKf7kBR06A68vzfxFqY1TccvuiGgeRkROcWAvHzuyxlKsz9QhYUOL3nIzuu1Hk9IBzolPF7f8h45ADQG6mP0TjJjCutY42S5AiEbneslkAe+2StOkjbbe7CKWEYMI/ioalxtE6KUJf7PRF2RczJuLibBSrXIxm0BH9KQ1IkBMpU651PRTsVD7ka1pe6Y0ywQiBd/vCoZDXukM7o6mspVOqzIlCSTiLZZqgbPOnbr6bZboxdosRkeI+CXyAtqWpNpjnM9/kZ6F48YrYfYH1xUQEx2hs3KlBznRvbsUH7Q6da5wU4bUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=VsQivPTxJUPH1Kj9gYPdJ0861oSm5sW/7V0APgwVkVU=; b=Mukkzg5Adn3/nvh2ZmlXbkzfWeEe5jaPLCpYlx9doJlkfly7sAnDifBSJIhj8QXJ0HxNRdns3nm8/rRNsas7HTok9WIsQElmUco05Qn6MRxPAs4Vm6UR/vRvbweFvaAjb6M8cNWyStpgRQJPPSa00649JJiAP8OsUq3KXOethMZ1iZzemH4GGaRlj+lCRexDyxzIBtJxUm1M1KWTPS+fJu6IYxuWTmaqcSlvWlgv8SK+6Z58DlTx9d6w+OAB7WeB69dYYvid8sl4cVTmabrK/KZsSbYDvdlkwhS29XZxStJSzB170VDv52uBW9ttdeK+RLOxadZ/hgXlHLmJUzXVbw== Received: from DM6PR02CA0142.namprd02.prod.outlook.com (2603:10b6:5:332::9) by PH0PR12MB5497.namprd12.prod.outlook.com (2603:10b6:510:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Wed, 5 May 2021 12:24:18 +0000 Received: from DM6NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::f4) by DM6PR02CA0142.outlook.office365.com (2603:10b6:5:332::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT047.mail.protection.outlook.com (10.13.172.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:17 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:16 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:26 +0300 Message-ID: <20210505122328.51129-16-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0fd9b37d-8f7a-4e95-1b2a-08d90fc0b419 X-MS-TrafficTypeDiagnostic: PH0PR12MB5497: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fqW4d60SYoPYTBW3E3yPVJ8tDaNiHWWdrh5yg1z+l5346Q9tBc2kprI73yk9BnNFtvFONd726WSoiJlv0UfYcSFD6ulIQec8IPZz8m46Zy5xy0sCcCzmHmHxNhlXcVDstPlUP6mpjxLquWOPnPFfMlgHfw/PT1W3qUlaL6BT96Le7llWu6ePojo9Xim95hBCDemU11dpPvH/2h8LqljpMqjMNJrp6V0sq5uRZF5oxhQuIyuKSFiUUxwHZd5VGgvH/l+a8Qle7fsSg40bZCYTcCjS0pMwDX0F/knEnZbU/7WaGZHziVzcjmPvhsUBKOTRST8hb0xgNgC5+E3r/E0b9eUk1+VVgHUa8MBLRFMtIC1H+YngPrtz9c+UxfInv++h2ZEWQV5qCnqo6Q48xoW0kOeYpirr5W4VZq8WouFZ1nhPLcxykvV8faaKObxYKs8Ge0kautVzjPeIgGO3FUlJ0SC8ktuCn/Mtcdhbs23feI+txFhsYX0he+X3sBcOcAu221r81wXn6e/24o46+grwNztkcf2AVhIAN0zDn7DRtpU6AQLfitQ76WQrbGTL84U2eCvjvZ3nnq259V/G2tE+ALNfS7w8Aoggy6k3pzQPPJh8WhrWEOTg+oNTPRVvAIlZDtDPN3Wk0eYwuQ7i9Kx/mAE/ddsYAP2xU7VBcqoGxog= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(376002)(396003)(346002)(39860400002)(46966006)(36840700001)(2906002)(107886003)(1076003)(316002)(36906005)(7696005)(54906003)(70586007)(70206006)(36756003)(4326008)(47076005)(478600001)(82310400003)(55016002)(6286002)(86362001)(82740400003)(336012)(16526019)(2616005)(426003)(356005)(186003)(8936002)(6666004)(36860700001)(26005)(110136005)(83380400001)(8676002)(5660300002)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:17.8218 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd9b37d-8f7a-4e95-1b2a-08d90fc0b419 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5497 Subject: [dpdk-dev] [PATCH v7 15/17] net/mlx5: validation of CT item X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The item of ASO connection tracking will be translated into the register value when matching. The validation of this item has no dependency on other layers, since the flow including this item should be jumped from another group. All the layers checking was already done in the previous groups. Only the state bits conflict should be checked. It is assumed that the flow with CT item will always work on the TCP traffic. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 3 ++ drivers/net/mlx5/mlx5_flow_dv.c | 51 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 9ad518b824..e6b9d1def0 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -151,6 +151,9 @@ enum mlx5_feature_name { /* INTEGRITY item bit */ #define MLX5_FLOW_ITEM_INTEGRITY (UINT64_C(1) << 34) +/* Conntrack item. */ +#define MLX5_FLOW_LAYER_ASO_CT (UINT64_C(1) << 35) + /* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 67538d0aa7..5c6284f1b1 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2623,6 +2623,51 @@ flow_dv_validate_item_ipv6_frag_ext(const struct rte_flow_item *item, "specified range not supported"); } +/* + * Validate ASO CT item. + * + * @param[in] dev + * Pointer to the rte_eth_dev structure. + * @param[in] item + * Item specification. + * @param[in] item_flags + * Pointer to bit-fields that holds the items detected until now. + * @param[out] error + * Pointer to error structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +static int +flow_dv_validate_item_aso_ct(struct rte_eth_dev *dev, + const struct rte_flow_item *item, + uint64_t *item_flags, + struct rte_flow_error *error) +{ + const struct rte_flow_item_conntrack *spec = item->spec; + const struct rte_flow_item_conntrack *mask = item->mask; + RTE_SET_USED(dev); + uint32_t flags; + + if (*item_flags & MLX5_FLOW_LAYER_ASO_CT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "Only one CT is supported"); + if (!mask) + mask = &rte_flow_item_conntrack_mask; + flags = spec->flags & mask->flags; + if ((flags & RTE_FLOW_CONNTRACK_PKT_STATE_VALID) && + ((flags & RTE_FLOW_CONNTRACK_PKT_STATE_INVALID) || + (flags & RTE_FLOW_CONNTRACK_PKT_STATE_BAD) || + (flags & RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED))) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "Conflict status bits"); + /* State change also needs to be considered. */ + *item_flags |= MLX5_FLOW_LAYER_ASO_CT; + return 0; +} + /** * Validate the pop VLAN action. * @@ -6925,6 +6970,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = MLX5_FLOW_ITEM_INTEGRITY; break; + case RTE_FLOW_ITEM_TYPE_CONNTRACK: + ret = flow_dv_validate_item_aso_ct(dev, items, + &item_flags, error); + if (ret < 0) + return ret; + break; default: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, From patchwork Wed May 5 12:23:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92931 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6EF1CA0524; Wed, 5 May 2021 14:25:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B42F64117D; Wed, 5 May 2021 14:24:24 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2057.outbound.protection.outlook.com [40.107.93.57]) by mails.dpdk.org (Postfix) with ESMTP id 378A84117C for ; Wed, 5 May 2021 14:24:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eNJFcK9DZNr6B0pmVr9LPnFKq6Z5gwNOVA3N5evdMfnM9ETKurj/segirq6yx9uRc6gCdN8VRToIlb5Cd60VwWp8zTe07jW00KB/SJhJdYqwBs1eto+aVKxFGUxkyp9z34GHThOb7g7s9TB0ikn8U9sZ4Itf2QaMwX1T7uUI6MrV3YbzE6lfCxX3idzr6knJh7eFDiwKOvyZ+kHhFhSeOf3rLxPkiVeQsX8wjHoXCfkH6eswJYaJxHdNyWdKi7UkYdstkFlZWGlsJ59RVZjekBC1EW02iRe13l8OUjN4NS+58MLkqdu0REJKI4NWDU/wgTEW/JizBCL4WRIANCiLJw== 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-SenderADCheck; bh=Rnmwd6N0aYy2bHO7R6X0pQtIyACmgC54sahPjQg6RAI=; b=jFdI6x45j2rWkWjF+NL8ySVns0+MTVM7JUE5dhsmSs9lLveJSaR5a0T+NIN0yY8517zXBWZP6SrGQNbkotAhtOmpZhbV/T7xZeTCuF3YV4ajn9rtDIwYpA7VmP9cSNwo0lFFs3UnikRxAN3TzchZYuTaZf6OG4yHmRdsROlesJIhF5jptRVjwYpMTx/D3F6NrwZ6rNSTlSNQygCo2zaGsNbre1C59s9efmlRbP2A1XD+vOCk5+NzYFdHTndSNEjU8+YM8pVGaOi2V3nVm3XVLkqE3GNnJrp2L5dU3n1vt9q6BT0J1Kjbr+0pvnGKG959rEd6Eg1BG/kxiwUkhRZVBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=Rnmwd6N0aYy2bHO7R6X0pQtIyACmgC54sahPjQg6RAI=; b=D7qZp/qe6hViN6dN/tKEuzrsGVhdJSdBQtICG9/X+klC9tQkRkQ24+MxFY0gDt3e7hzO5oRRGSH8XwgoowlSWQ9bgSMAK0CfBcipi+BGHDHAf5pNImf8C0SURvgQafemcXIAUqBsqvPhFi7+AwxQS302wKLB4IBhCDxdG68KFcrR1Auz3BDFgLZBCE9AoeYHrQrPOha8/DbGL6OghxM+43vG9BiBAFkpNvG0fImUxEGg/QGlNgzkT6YnFa438JVK8uzUv5n4Zoiu+8Y6HX4tJohqmpHtfZHVKCU9xzmflF/9JxULY2102XDkq+AarMb+grclaM9massYydWzrDChfw== Received: from DM6PR12CA0030.namprd12.prod.outlook.com (2603:10b6:5:1c0::43) by MW3PR12MB4410.namprd12.prod.outlook.com (2603:10b6:303:5b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.26; Wed, 5 May 2021 12:24:20 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1c0:cafe::ab) by DM6PR12CA0030.outlook.office365.com (2603:10b6:5:1c0::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:20 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:18 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:27 +0300 Message-ID: <20210505122328.51129-17-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85bddc31-3093-4aad-0a92-08d90fc0b5bf X-MS-TrafficTypeDiagnostic: MW3PR12MB4410: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:352; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7T8IylnP8Xg/ckhbPkpRST/JAwKIlTgy4S7JYyqRDPvtZ1KG6EEZAflQC0fxhcSWuGNK/TeN/cBYq+p7qfsdJGBpKs1XZXkRbL7GtXHuTwKKT4gGHZzpGt3eEPv8KEwxdruomrLFegnKhvO2dHuQXwHhml95oChTkwR2y8tn00Ef6zSNoz589/7590dNlGdCy75dyPF3IuDspvcq+Uf84jKs+ka2WFmJ3LLHW+3A1rF3A2VGQdotBNk88QaSKm6UsySXxFFbB/tBaxR2n55w/KwYbS8eVLgpQ5A9GdIPQ70srSUwj8Itqzj4kBnPZ7UvlcifHsy0dYu1fjECgsh+x6TuXyl+A402smo4xseDCsDj9aeI2MnoEgyVWHNcheefSf6UZ2eTg94VIOmjNmYuGWhDq46hVgoFVl5F7Kwa0m+t10jp67mYGdAyQapwiQSuGyg2BekBXLS/KJAh0WbwghKIs4+h2ftZK1py6cEM+vG6rxowFpRhzb9QOqQP/IoEXvI+UsbF82K4PsNoBPeLFh++ngph69xnnl9dAqFKPLNzxshaSOKWjjDOSPNZLz75G2ydtzw5XQdP/UrLNnPSiboKaom3GxSXSfMk5gcAdKc5uVLfxfT3TwGZ+rONpq7J6YvHJAG+6kcwaxGy9nI2j0Ge3yA1UVKy+hpug2fvUNpZyBXl9lT0YXR6WKxvxFMl X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(346002)(396003)(39860400002)(136003)(46966006)(36840700001)(6286002)(110136005)(4326008)(30864003)(82310400003)(36906005)(36756003)(47076005)(83380400001)(2906002)(86362001)(316002)(186003)(1076003)(478600001)(54906003)(36860700001)(356005)(8936002)(70206006)(7636003)(8676002)(6666004)(7696005)(107886003)(16526019)(26005)(82740400003)(426003)(5660300002)(336012)(70586007)(2616005)(55016002)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:20.5810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85bddc31-3093-4aad-0a92-08d90fc0b5bf X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4410 Subject: [dpdk-dev] [PATCH v7 16/17] net/mlx5: add support of CT between two ports X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After creating a connection tracking context, it can be used between two ports. For each port, the flow for one direction traffic will be created. The context can only be shared between the owner port and the peer port that was specified when being created. Only the owner port could update the context or query it in current implementation. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 57 +++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow_dv.c | 72 +++++++++++++++++++++++++-------- 2 files changed, 111 insertions(+), 18 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index e6b9d1def0..04c8806bf6 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -49,6 +49,25 @@ enum { MLX5_INDIRECT_ACTION_TYPE_CT, }; +/* Now, the maximal ports will be supported is 256, action number is 4M. */ +#define MLX5_INDIRECT_ACT_CT_MAX_PORT 0x100 + +#define MLX5_INDIRECT_ACT_CT_OWNER_SHIFT 22 +#define MLX5_INDIRECT_ACT_CT_OWNER_MASK (MLX5_INDIRECT_ACT_CT_MAX_PORT - 1) + +/* 30-31: type, 22-29: owner port, 0-21: index. */ +#define MLX5_INDIRECT_ACT_CT_GEN_IDX(owner, index) \ + ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | \ + (((owner) & MLX5_INDIRECT_ACT_CT_OWNER_MASK) << \ + MLX5_INDIRECT_ACT_CT_OWNER_SHIFT) | (index)) + +#define MLX5_INDIRECT_ACT_CT_GET_OWNER(index) \ + (((index) >> MLX5_INDIRECT_ACT_CT_OWNER_SHIFT) & \ + MLX5_INDIRECT_ACT_CT_OWNER_MASK) + +#define MLX5_INDIRECT_ACT_CT_GET_IDX(index) \ + ((index) & ((1 << MLX5_INDIRECT_ACT_CT_OWNER_SHIFT) - 1)) + /* Matches on selected register. */ struct mlx5_rte_flow_item_tag { enum modify_reg id; @@ -1334,7 +1353,7 @@ mlx5_validate_integrity_item(const struct rte_flow_item_integrity *item) } /* - * Get ASO CT action by index. + * Get ASO CT action by device and index. * * @param[in] dev * Pointer to the Ethernet device structure. @@ -1345,7 +1364,7 @@ mlx5_validate_integrity_item(const struct rte_flow_item_integrity *item) * The specified ASO CT action pointer. */ static inline struct mlx5_aso_ct_action * -flow_aso_ct_get_by_idx(struct rte_eth_dev *dev, uint32_t idx) +flow_aso_ct_get_by_dev_idx(struct rte_eth_dev *dev, uint32_t idx) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; @@ -1360,6 +1379,40 @@ flow_aso_ct_get_by_idx(struct rte_eth_dev *dev, uint32_t idx) return &pool->actions[idx % MLX5_ASO_CT_ACTIONS_PER_POOL]; } +/* + * Get ASO CT action by owner & index. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] idx + * Index to the ASO CT action and owner port combination. + * + * @return + * The specified ASO CT action pointer. + */ +static inline struct mlx5_aso_ct_action * +flow_aso_ct_get_by_idx(struct rte_eth_dev *dev, uint32_t own_idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_action *ct; + uint16_t owner = (uint16_t)MLX5_INDIRECT_ACT_CT_GET_OWNER(own_idx); + uint32_t idx = MLX5_INDIRECT_ACT_CT_GET_IDX(own_idx); + + if (owner == PORT_ID(priv)) { + ct = flow_aso_ct_get_by_dev_idx(dev, idx); + } else { + struct rte_eth_dev *owndev = &rte_eth_devices[owner]; + + MLX5_ASSERT(owner < RTE_MAX_ETHPORTS); + if (dev->data->dev_started != 1) + return NULL; + ct = flow_aso_ct_get_by_dev_idx(owndev, idx); + if (ct->peer != PORT_ID(priv)) + return NULL; + } + return ct; +} + int mlx5_flow_group_to_table(struct rte_eth_dev *dev, const struct mlx5_flow_tunnel *tunnel, uint32_t group, uint32_t *table, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 5c6284f1b1..076a2493c1 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -11684,7 +11684,7 @@ flow_dv_prepare_counter(struct rte_eth_dev *dev, } /* - * Release an ASO CT action. + * Release an ASO CT action by its own device. * * @param[in] dev * Pointer to the Ethernet device structure. @@ -11695,12 +11695,12 @@ flow_dv_prepare_counter(struct rte_eth_dev *dev, * 0 when CT action was removed, otherwise the number of references. */ static inline int -flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t idx) +flow_dv_aso_ct_dev_release(struct rte_eth_dev *dev, uint32_t idx) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_aso_ct_pools_mng *mng = priv->sh->ct_mng; uint32_t ret; - struct mlx5_aso_ct_action *ct = flow_aso_ct_get_by_idx(dev, idx); + struct mlx5_aso_ct_action *ct = flow_aso_ct_get_by_dev_idx(dev, idx); enum mlx5_aso_ct_state state = __atomic_load_n(&ct->state, __ATOMIC_RELAXED); @@ -11729,7 +11729,21 @@ flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t idx) LIST_INSERT_HEAD(&mng->free_cts, ct, next); rte_spinlock_unlock(&mng->ct_sl); } - return ret; + return (int)ret; +} + +static inline int +flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t own_idx) +{ + uint16_t owner = (uint16_t)MLX5_INDIRECT_ACT_CT_GET_OWNER(own_idx); + uint32_t idx = MLX5_INDIRECT_ACT_CT_GET_IDX(own_idx); + struct rte_eth_dev *owndev = &rte_eth_devices[owner]; + RTE_SET_USED(dev); + + MLX5_ASSERT(owner < RTE_MAX_ETHPORTS); + if (dev->data->dev_started != 1) + return -1; + return flow_dv_aso_ct_dev_release(owndev, idx); } /* @@ -11881,7 +11895,7 @@ flow_dv_aso_ct_alloc(struct rte_eth_dev *dev, struct rte_flow_error *error) RTE_SET_USED(reg_c); #endif if (!ct->dr_action_orig) { - flow_dv_aso_ct_release(dev, ct_idx); + flow_dv_aso_ct_dev_release(dev, ct_idx); rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "failed to create ASO CT action"); @@ -11897,7 +11911,7 @@ flow_dv_aso_ct_alloc(struct rte_eth_dev *dev, struct rte_flow_error *error) reg_c - REG_C_0); #endif if (!ct->dr_action_rply) { - flow_dv_aso_ct_release(dev, ct_idx); + flow_dv_aso_ct_dev_release(dev, ct_idx); rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "failed to create ASO CT action"); @@ -11939,12 +11953,13 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev, return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "Failed to allocate CT object"); - ct = flow_aso_ct_get_by_idx(dev, idx); + ct = flow_aso_ct_get_by_dev_idx(dev, idx); if (mlx5_aso_ct_update_by_wqe(sh, ct, pro)) return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "Failed to update CT"); ct->is_original = !!pro->is_original_dir; + ct->peer = pro->peer_port; return idx; } @@ -12110,7 +12125,7 @@ flow_dv_translate(struct rte_eth_dev *dev, int action_type = actions->type; const struct rte_flow_action *found_action = NULL; uint32_t jump_group = 0; - uint32_t ct_idx; + uint32_t owner_idx; struct mlx5_aso_ct_action *ct; if (!mlx5_flow_os_action_supported(action_type)) @@ -12566,8 +12581,13 @@ flow_dv_translate(struct rte_eth_dev *dev, action_flags |= MLX5_FLOW_ACTION_MODIFY_FIELD; break; case RTE_FLOW_ACTION_TYPE_CONNTRACK: - ct_idx = (uint32_t)(uintptr_t)action->conf; - ct = flow_aso_ct_get_by_idx(dev, ct_idx); + owner_idx = (uint32_t)(uintptr_t)action->conf; + ct = flow_aso_ct_get_by_idx(dev, owner_idx); + if (!ct) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, + "Failed to get CT object."); if (mlx5_aso_ct_available(priv->sh, ct)) return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_ACTION, @@ -12580,7 +12600,7 @@ flow_dv_translate(struct rte_eth_dev *dev, dev_flow->dv.actions[actions_n] = ct->dr_action_rply; flow->indirect_type = MLX5_INDIRECT_ACTION_TYPE_CT; - flow->ct = ct_idx; + flow->ct = owner_idx; __atomic_fetch_add(&ct->refcnt, 1, __ATOMIC_RELAXED); actions_n++; action_flags |= MLX5_FLOW_ACTION_CT; @@ -14191,6 +14211,7 @@ flow_dv_action_create(struct rte_eth_dev *dev, { uint32_t idx = 0; uint32_t ret = 0; + struct mlx5_priv *priv = dev->data->dev_private; switch (action->type) { case RTE_FLOW_ACTION_TYPE_RSS: @@ -14219,8 +14240,7 @@ flow_dv_action_create(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_CONNTRACK: ret = flow_dv_translate_create_conntrack(dev, action->conf, err); - idx = (MLX5_INDIRECT_ACTION_TYPE_CT << - MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret; + idx = MLX5_INDIRECT_ACT_CT_GEN_IDX(PORT_ID(priv), ret); break; default: rte_flow_error_set(err, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, @@ -14286,7 +14306,9 @@ flow_dv_action_destroy(struct rte_eth_dev *dev, return 0; case MLX5_INDIRECT_ACTION_TYPE_CT: ret = flow_dv_aso_ct_release(dev, idx); - if (ret) + if (ret < 0) + return ret; + if (ret > 0) DRV_LOG(DEBUG, "Connection tracking object %u still " "has references %d.", idx, ret); return 0; @@ -14390,8 +14412,16 @@ __flow_dv_action_ct_update(struct rte_eth_dev *dev, uint32_t idx, struct mlx5_aso_ct_action *ct; const struct rte_flow_action_conntrack *new_prf; int ret = 0; + uint16_t owner = (uint16_t)MLX5_INDIRECT_ACT_CT_GET_OWNER(idx); + uint32_t dev_idx; - ct = flow_aso_ct_get_by_idx(dev, idx); + if (PORT_ID(priv) != owner) + return rte_flow_error_set(error, EACCES, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "CT object owned by another port"); + dev_idx = MLX5_INDIRECT_ACT_CT_GET_IDX(idx); + ct = flow_aso_ct_get_by_dev_idx(dev, dev_idx); if (!ct->refcnt) return rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, @@ -15082,6 +15112,8 @@ flow_dv_action_query(struct rte_eth_dev *dev, uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1); struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_aso_ct_action *ct; + uint16_t owner; + uint32_t dev_idx; switch (type) { case MLX5_INDIRECT_ACTION_TYPE_AGE: @@ -15098,7 +15130,15 @@ flow_dv_action_query(struct rte_eth_dev *dev, case MLX5_INDIRECT_ACTION_TYPE_COUNT: return flow_dv_query_count(dev, idx, data, error); case MLX5_INDIRECT_ACTION_TYPE_CT: - ct = flow_aso_ct_get_by_idx(dev, idx); + owner = (uint16_t)MLX5_INDIRECT_ACT_CT_GET_OWNER(idx); + if (owner != PORT_ID(priv)) + return rte_flow_error_set(error, EACCES, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "CT object owned by another port"); + dev_idx = MLX5_INDIRECT_ACT_CT_GET_IDX(idx); + ct = flow_aso_ct_get_by_dev_idx(dev, dev_idx); + MLX5_ASSERT(ct); if (!ct->refcnt) return rte_flow_error_set(error, EFAULT, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, From patchwork Wed May 5 12:23:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92932 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF19EA0524; Wed, 5 May 2021 14:25:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCC7B4117E; Wed, 5 May 2021 14:24:25 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2076.outbound.protection.outlook.com [40.107.220.76]) by mails.dpdk.org (Postfix) with ESMTP id 84F524117D for ; Wed, 5 May 2021 14:24:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DdRqvn0RcjB9zYevB+Yh0cFz9QA6ngYzzBtjDD5t43f9xWVYe+1rvwHS9sPbxyifwhv02tl67NkSJFZyM9VNIEioN9DaJufUy5ZdE+ngIMlzm56qCLKwThdf0YxPkA7p4bCPhO0Kml45nllDYaOCbZzl3vyrdGiIEDF187EZSLdqaISZe831V/rvV65hQoIDoYjkHPigK52S15mFSaxJpoAzdXRuQVlzZ+fJWcPa380FKZV4W8BJkYXO5a4svFCtrx1ANbCQ9GuxNhgHp/+X9iGhXt/i1E4XTdjonnWKl7E8midiPyA/247kP2TV5ePiLx/NoyfT1TSCDwMYQRrIIg== 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-SenderADCheck; bh=DZh3IWOaMx59TLUPFsQSIAEUHzDhRS8ip9Aemplp1OU=; b=NWzru0p57o6basRgwlvBRAFGmI2JqjvCFbKXJMznaXpKpE4fLykpvn5fs96om6a624MMEE8zVDM0Wo6wxqwyNdqHsua+SNY3uwxpZB4aO3mS1urRpanBfvGtFi04GJmR0XJBu+5IPeF+AIrnXvOceLLoGe+Tm+zaXYVUuJzs+mw0da6v5+77bZCaRAb/dnGGdPo/MWHwHGf3uYlr5Cj3xfJwurn7gWkDSENteeoh69061P+tr8WvIWka5cJ8uLx+LwCpFEP7NXBtUme1hZKc/eghqR+2CLTiyJeWJM5mhKlKIci7Rvx9elnoDGrNELJd6c1zyovgLaXGkNwgQ/mNSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=DZh3IWOaMx59TLUPFsQSIAEUHzDhRS8ip9Aemplp1OU=; b=YGH2N794p2gTiFVz2LsaLYW3PtmCCegohQQ1lG29AuZ1WouTXqEnERdLp+DOL99JUtJnqxeM01ESN6lxezxP7ZRipbKhKC7vlEEcP4PK/jeNQ86vnYDZL/Vwg72EZ3KE/I8jQKHUuzIcUSVuu20phNUFxXHIz2eSBUncD2CRpOHgP+wcRROW4jcJATpkTq2E1HDILy0IXAipFpCqQdQNawAMa1Den/9Bj/5TSt+pnyS6mQNT9Ib4pRFwKbGd2pFTvA9tThOM38264ksLL0bCovvN5GX3oW9X3Raz6Vl4wMyAoiXQ7xjgt9XZ6WrdsLrMGYH7HpD1NJ2uSfVojSmVpw== Received: from DM6PR11CA0011.namprd11.prod.outlook.com (2603:10b6:5:190::24) by DM6PR12MB2699.namprd12.prod.outlook.com (2603:10b6:5:4a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.40; Wed, 5 May 2021 12:24:22 +0000 Received: from DM6NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::a1) by DM6PR11CA0011.outlook.office365.com (2603:10b6:5:190::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Wed, 5 May 2021 12:24:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT003.mail.protection.outlook.com (10.13.173.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 12:24:22 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 12:24:20 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:28 +0300 Message-ID: <20210505122328.51129-18-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5be3118e-cda9-49c5-a104-08d90fc0b6af X-MS-TrafficTypeDiagnostic: DM6PR12MB2699: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:131; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k7NcwfZCRB8wx+3hu0EmFasOv0eo9ugMC6JgYxoQxi0wzMDfj9M38IY2xvcSZ826quxu5OaZegB023dC6bE0pnfskYwvEeMkVsuIl1cIxbNutW9LkMvAIvxVYG3heOCQ/49w469yD5JJvaYKpTTrfle2GpZykOa/5/YDHFbrAjOzD0J7f0OZxCc9bnoycXrJ2qsH6zfKMb2OlLqLwOoIcZxnMtPPq47aQQ9Y5b++NwYgU64KuPqYcUhX2FT/U2cf1TyRjFx4G3zh27aqnX7Y1WfynPF8UFWT4r4AJIHwx715SEtL9JvPXufUClgPZQrxCVG9jmdTFWL5L0PG8nbZO7xPiKiIzawM2OlxN7yCz5KOIX+io1aSjnEEIcJaagUQdflcWOURTg325EbadPgMtZQbuR8z73+xaRf5LIUjo7BLtL25jHS/L0q5/B3pUCxCEcuPEDgMLluy3QOzci2EohjuggrJ8+StGtzSKzkQDwBCXI6mzwy6GyAS49q2Mzsf8uXheLKUnLhEn8PhIxc28Y2g00v5HX+x2eqrX81Ni1stAVIqTt+jHJx+9MSbKcRCi4cLZkeIKjlj7fsXr/CMtsDYVUuG/FU8YeKPg0/aIQzZBvzigbN/mKTJXF1jI+7tpfNS3AZhAUuvEgL+k7GJlw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(136003)(376002)(46966006)(36840700001)(110136005)(55016002)(47076005)(426003)(86362001)(36860700001)(6286002)(15650500001)(82310400003)(16526019)(8676002)(4326008)(336012)(83380400001)(186003)(54906003)(107886003)(36906005)(1076003)(70586007)(7636003)(70206006)(5660300002)(2616005)(26005)(82740400003)(316002)(2906002)(356005)(8936002)(7696005)(478600001)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:22.1627 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5be3118e-cda9-49c5-a104-08d90fc0b6af X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2699 Subject: [dpdk-dev] [PATCH v7 17/17] doc: update mlx5 support for conntrack X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In the release notes and mlx5 NIC document, the support and limitation of connection tracking are added. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 14 ++++++++++++++ doc/guides/rel_notes/release_21_05.rst | 2 ++ 4 files changed, 18 insertions(+) diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 8046bd121e..0deb4ef547 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -66,6 +66,7 @@ Module EEPROM dump = Registers dump = LED = Multiprocess aware = +Connection tracking = FreeBSD = Linux = Windows = diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini index ddd131da16..45dbe75d07 100644 --- a/doc/guides/nics/features/mlx5.ini +++ b/doc/guides/nics/features/mlx5.ini @@ -45,6 +45,7 @@ Stats per queue = Y FW version = Y Module EEPROM dump = Y Multiprocess aware = Y +Connection tracking = Y Linux = Y Windows = P ARMv8 = Y diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index e7aeb779fd..5aa1100a83 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -108,6 +108,7 @@ Features flow group. - Flow metering, including meter policy API. - Flow integrity offload API. +- Connection tracking. Limitations ----------- @@ -433,6 +434,14 @@ Limitations or flow create 0 ingress pattern integrity level is 0 value mask l4_ok value spec 0 / eth / ipv4 proto is udp / end … +- Connection tracking: + + - connection tracking (conntrack) couldn't co-exist with ASO meter, ASO age action in a single flow rule. + - Flow rules insertion rate and memory consumption. + - software limitation: + - ports: a maximal number of 256. + - conntrack: a maximal number of 4M. + Statistics ---------- @@ -1695,6 +1704,11 @@ Supported hardware offloads | | | rdma-core 35 | | rdma-core 35 | | | | ConnectX-5 | | ConnectX-5 | +-----------------------+-----------------+-----------------+ + | Connection tracking | | | | DPDK 21.05 | + | | | N/A | | OFED 5.3 | + | | | | | rdma-core 35 | + | | | | | ConnectX-6 Dx | + +-----------------------+-----------------+-----------------+ .. table:: Minimal SW/HW versions for shared action offload :name: sact diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index 4938c931ff..1b4b13f76c 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -167,6 +167,8 @@ New Features * Added support for ASO (Advanced Steering Operation) meter. * Added support for ASO metering by PPS (packet per second). * Added support for the monitor policy of Power Management API. + * Added support for connection tracking action and item as well as context create, + destroy, update and query. * **Updated NXP DPAA driver.**