From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2EF645AD9; Mon, 7 Oct 2024 21:41:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6733B427A6; Mon, 7 Oct 2024 21:36:11 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 5682640E40 for ; Mon, 7 Oct 2024 21:35:42 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2236.outbound.protection.outlook.com [104.47.11.236]) by mx-outbound43-193.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 07 Oct 2024 19:35:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wjPzF+zO2xMQM1p91A9wPr6qdWteK4ewcVbkbZfs9TtmLSn9zDEJO5cCwPDKu67Oov9+qnyqgXhmh0RqS1hMaAx1lD3xw0HhCcvkm/0j7AkIIM9Qq/W/VYL2D92Ztsgy3R6Nu9HPothvaVj6XH2gOEmZ2Be1BDuI2h57JudKh4hs/WAFsxvTL/Y8XvxAcGEdiSTZ+cnQTXwDNDY7eRYbUqkaphvUEbzt9X8j/6ohwqas7hC+nWpVgJNRqdJGMxSQug0echbEAxj239+lOVJ8B9vfYPJWagGmFVFT0eUvOT5Ag7DiDis/a71PaLD3sUtlTTvb+8zjUiold9MG8c8fuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XTDnyENbMqcn90eK0YTsRkkaqTy46V03yiHSRO7Ka34=; b=nW2wBp8FavzBQdWon884VgfK4z3EM0vk9/iZRUORYaRkPFlFfsog2eeM771lb8/GyaXMiZy+6Abl1/G9Q4ESx0zolZ980Ux799K6HUB0GMtS8/BVGBi8fyBGuvzWsmDnVVQDIj/r6iYTxKFOnZ4jBdpkwlwZeTcgOQFOW82oc4pyLJu+clt/GJNkm5cisRn+AHR7jFij8mra+U6+3uRaaNlbaEzZXzZlR2WoaTj4XsxZfHI0Z7TKXEqLeyuH4EPGusuYG6HFyXE/LKHjnIc7lNBmk46o3j8nPLjyI2o3KB7CU+UaVivCSEyjsGSKqHCWSVU2NKx2zYmq6Z5QnPrawg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XTDnyENbMqcn90eK0YTsRkkaqTy46V03yiHSRO7Ka34=; b=k6Bev8xqFbHZEKm0B6xYeBhYlNtB5H8TDkbZBNrVxViXGQ+yC2p2eKTACyPebzS14X4q8XYNqtf+Oel5mZpPZicF45doR5adDU/sho3Bw8qYTbFi4IProxHPEoI5xpBLoym0IHr8EBcVaLQ9EkaOQ/qyL44mbjhPRnBtqzPUxwY= Received: from DB9PR05CA0016.eurprd05.prod.outlook.com (2603:10a6:10:1da::21) by DBAP190MB0838.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1aa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Mon, 7 Oct 2024 19:35:39 +0000 Received: from DB1PEPF000509EC.eurprd03.prod.outlook.com (2603:10a6:10:1da:cafe::7) by DB9PR05CA0016.outlook.office365.com (2603:10a6:10:1da::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Mon, 7 Oct 2024 19:35:39 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by DB1PEPF000509EC.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Mon, 7 Oct 2024 19:35:39 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, Danylo Vodopianov Subject: [PATCH v2 45/50] net/ntnic: used writer data handling functions Date: Mon, 7 Oct 2024 21:34:21 +0200 Message-ID: <20241007193436.675785-46-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241007193436.675785-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241007193436.675785-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509EC:EE_|DBAP190MB0838:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 4bd7bad4-ecd7-41c7-c335-08dce7073967 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Lxkc22IfhUA6ys0xaLYyj+kqIBpMMIiChMBsFEMuoHZfouvCd+VXMzW5r+1j?= =?us-ascii?Q?WqZisV3IdcJfRH/1EmgunuIryJwHoq/1Kppo29I5T+ic2qquLFdyRtPh7DqJ?= =?us-ascii?Q?gIGATbu3rORRHXa+Ltw5kNgxltpfpWgDIa/XAZATd/oWuIf2WesUtF5/9M2+?= =?us-ascii?Q?dVUipWnY8c+bN8aTgXNd/jm5s4QCc79oAe8ujGO/AzScpMPdKBx43/yXYDZT?= =?us-ascii?Q?86ySDMnZiGDVFdO43N4sUgmFB1Xr0cajTn2kQHbfqfoWeVkuqnsA6vkDSyCh?= =?us-ascii?Q?/n2QL3yWxebbTaGjUzROZmYXc79L+dwQTtfnh047e2cxCvJymCo0Co8Gs98h?= =?us-ascii?Q?36ePVJ89PJJZ5FWyWDKcqtZHsDi7etQmVVTXrl7o3kz1iyMDQq14yeRkZl/i?= =?us-ascii?Q?a6Wzay4SmDBZSmbdhxdxiD87b1EoGNPitjey5EE3ceukMk3FBIZKtd61cLdj?= =?us-ascii?Q?0s3n/NFW8fgp3LmdgJ9CPgokD2YTAbqMiC30r66n/5kRkSu8pQG2ueCV5qAb?= =?us-ascii?Q?qwxCCYxf6MA43oJWEvEAPHlp7+89+QywMVyxp9AIpZo+p9nXltgMhnYgs1fu?= =?us-ascii?Q?h57bF8qE4v6EqAE+031LXW/nZQ9N+BWA3LgS247937wjB5Gg8+HgkaAoHPgV?= =?us-ascii?Q?QgeHyVMQIz/JWePwD7MEyl8C//PINmfXVjmM/LpJJ3V/TVHncDheFdczYZ9l?= =?us-ascii?Q?pGlLCYGy2Us7TTMuOfPPGpR18r4nEOTK034SkGIgoQQX2Of1Nc67/WQ0hiHX?= =?us-ascii?Q?3wghCEltKXKr5bescxJ44VD+ua/wsF328HK2gpr+pGPYCLheUqIxbYq/kByM?= =?us-ascii?Q?mwcLjLUSYS+54+G2R1+xvvvsbYN5a5PL1kC4OVkuaZxnPWitTTLX/4Ijy6Cz?= =?us-ascii?Q?dDz4tduQOgjn80TzfGZYXxyTd7ykl57sQUONZuxkY7ZfeQ4HmeZtQp1KelMn?= =?us-ascii?Q?JG8nrC6ryAXlhtPbukTM4g7ypcVrbYXC8E5vq081sm+Y+HMqudxQm/s+NYFY?= =?us-ascii?Q?xRNphFQPFfE7PAF6DdTrPkp2cEIgM5MapiEpcXUcBug0t2sTwR2cT4a/7mjJ?= =?us-ascii?Q?G7Ggdl20/9opaCapd0chzt5OfsjrK6PUpVXgDGsPcO5kGTDvGwkW3oy07y+Z?= =?us-ascii?Q?NYSutPw1GS4PHyC+OXU0La8hlAdnt9qY/ilArueLYM8LpzwmHDvQ7L3J2v7C?= =?us-ascii?Q?R//kelg2xKi9pcNo98BASLS7DVxVlDlFQ8o4e0vcmksgNg0lv82xh8OULKa9?= =?us-ascii?Q?J+hgSbMbRmUWhyG10Lg4Lgvsq9j35iHeYW8qWgVL4DYtL8d7iR3HlhrtZmgj?= =?us-ascii?Q?cRten2c4H5W0N3g09O//xk1bpB39KoqXVuJOApT3XNGu5oKu7ihf44bv6HQs?= =?us-ascii?Q?6Ce9T+bj44zBA9OqbQAWzhmsS1KL?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: b7+Um+2HXTVqpCx+6Le6XzYHuWaJN0AbsRWtooF27lR06o/O27cDfmq1QNQaGBhPvrEHgdlylXWpN/f337aSU2ytkegIYgDQsCF7mKyVoHFdyk66IjGmdJSgdvkqS0oKrLzm0ijN1s4yeTap04ZqIAOixT1a7YGY4yym2d7RHG3qjaMz5w1oMXX7E/gpj+iBzN+2Ap83rXBhVINnO9SsY/t+DwsUcWIku0DtlZs933Kz+OAaIAyOnwqAzATPXqMDGUUxv4+lXYHeGsAp76popXH3Sg4Upwdz7yHLo8Wl+1kB9cVtlTWxR0xk6TmhVQDUqN+0za6IHyesaNkRTTRL2Ct9io9lUXDdP4DsFgswP41IPxSru4f3nJRYrR8fccy+TF60nA4PxObqXdKxHG4xoaqdqMpMmV/WnFZc8rLdcFLHzqNvNcvdYcXvwpyaUIEz9gxF198jiootc0CxYBvH90aVXNRTQVjNMVupxKlTMOhfiNgsEPi6FruyNfoIa2yLS/wtA34QTKWM3N5jCA5eFjMPFsSsdsUtVVh6ucJGGamVSM3J78fjctc0u6Pdex13ioXDAuSUbukpoJ6u6MOkaFagZaec8UCafbWA3j3mC/uFSdsCi1YP6e0BT7EAI36jvtsQz1MPEIPLSee4KpakGw== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2024 19:35:39.1000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bd7bad4-ecd7-41c7-c335-08dce7073967 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509EC.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0838 X-BESS-ID: 1728329741-311201-2745-3532-1 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.11.236 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkaGhgamQGYGUNTC0NTSNDXN3N zA2Cgp0dDQMNHcyNTU1MLCzDAp1cQ8Tak2FgDSByYwQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259566 [from cloudscan22-232.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 From: Danylo Vodopianov Introduced functions to set and flush RX and TX used writer data. Added support for setting shadow data with functions for guest physical address, host ID, queue size, packed, interrupt enable, vector, and ISTK for RX and TX. Implemented set_rx_used_writer_data and set_tx_used_writer_data to configure and flush data based on updated shadow structures. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 60 +++- drivers/net/ntnic/include/ntnic_dbs.h | 71 ++++ drivers/net/ntnic/nthw/dbs/nthw_dbs.c | 316 ++++++++++++++++++ .../nthw/supported/nthw_fpga_reg_defs_dbs.h | 23 ++ 4 files changed, 468 insertions(+), 2 deletions(-) diff --git a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c index 065dac6af0..1df42dad11 100644 --- a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +++ b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c @@ -285,6 +285,19 @@ dbs_initialize_virt_queue_structs(void *avail_struct_addr, void *used_struct_add flgs); } +static uint16_t dbs_qsize_log2(uint16_t qsize) +{ + uint32_t qs = 0; + + while (qsize) { + qsize = qsize >> 1; + ++qs; + } + + --qs; + return qs; +} + static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, uint32_t index, uint16_t start_idx, @@ -300,7 +313,29 @@ static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, { (void)header; (void)desc_struct_phys_addr; - (void)used_struct_phys_addr; + uint32_t qs = dbs_qsize_log2(queue_size); + uint32_t int_enable; + uint32_t vec; + uint32_t istk; + + /* + * 4. Configure the DBS.RX_UW_DATA memory; good idea to initialize all + * DBS_RX_QUEUES entries. + * Notice: We always start out with interrupts disabled (by setting the + * "irq_vector" argument to -1). Queues that require interrupts will have + * it enabled at a later time (after we have enabled vfio interrupts in + * the kernel). + */ + int_enable = 0; + vec = 0; + istk = 0; + NT_LOG_DBGX(DBG, NTNIC, "set_rx_uw_data int=0 irq_vector=%u\n", irq_vector); + + if (set_rx_uw_data(p_nthw_dbs, index, + (uint64_t)used_struct_phys_addr, + host_id, qs, 0, int_enable, vec, istk) != 0) { + return NULL; + } /* * 2. Configure the DBS.RX_AM_DATA memory and enable the queues you plan to use; @@ -366,7 +401,28 @@ static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, { (void)header; (void)desc_struct_phys_addr; - (void)used_struct_phys_addr; + uint32_t int_enable; + uint32_t vec; + uint32_t istk; + uint32_t qs = dbs_qsize_log2(queue_size); + + /* + * 4. Configure the DBS.TX_UW_DATA memory; good idea to initialize all + * DBS_TX_QUEUES entries. + * Notice: We always start out with interrupts disabled (by setting the + * "irq_vector" argument to -1). Queues that require interrupts will have + * it enabled at a later time (after we have enabled vfio interrupts in the + * kernel). + */ + int_enable = 0; + vec = 0; + istk = 0; + + if (set_tx_uw_data(p_nthw_dbs, index, + (uint64_t)used_struct_phys_addr, + host_id, qs, 0, int_enable, vec, istk, in_order) != 0) { + return NULL; + } /* * 2. Configure the DBS.TX_AM_DATA memory and enable the queues you plan to use; diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h index 438f1858f5..f3b5a20739 100644 --- a/drivers/net/ntnic/include/ntnic_dbs.h +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -33,6 +33,29 @@ struct nthw_dbs_tx_am_data_s { uint32_t int_enable; }; +/* DBS_RX_UW_DATA */ +struct nthw_dbs_rx_uw_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t packed; + uint32_t int_enable; + uint32_t vec; + uint32_t istk; +}; + +/* DBS_TX_UW_DATA */ +struct nthw_dbs_tx_uw_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t packed; + uint32_t int_enable; + uint32_t vec; + uint32_t istk; + uint32_t in_order; +}; + /* DBS_TX_QP_DATA */ struct nthw_dbs_tx_qp_data_s { uint32_t virtual_port; @@ -121,6 +144,33 @@ struct nthw_dbs_s { nthw_field_t *mp_fld_tx_avail_monitor_data_packed; nthw_field_t *mp_fld_tx_avail_monitor_data_int; + nthw_register_t *mp_reg_rx_used_writer_control; + nthw_field_t *mp_fld_rx_used_writer_control_adr; + nthw_field_t *mp_fld_rx_used_writer_control_cnt; + + nthw_register_t *mp_reg_rx_used_writer_data; + nthw_field_t *mp_fld_rx_used_writer_data_guest_physical_address; + nthw_field_t *mp_fld_rx_used_writer_data_host_id; + nthw_field_t *mp_fld_rx_used_writer_data_queue_size; + nthw_field_t *mp_fld_rx_used_writer_data_packed; + nthw_field_t *mp_fld_rx_used_writer_data_int; + nthw_field_t *mp_fld_rx_used_writer_data_vec; + nthw_field_t *mp_fld_rx_used_writer_data_istk; + + nthw_register_t *mp_reg_tx_used_writer_control; + nthw_field_t *mp_fld_tx_used_writer_control_adr; + nthw_field_t *mp_fld_tx_used_writer_control_cnt; + + nthw_register_t *mp_reg_tx_used_writer_data; + nthw_field_t *mp_fld_tx_used_writer_data_guest_physical_address; + nthw_field_t *mp_fld_tx_used_writer_data_host_id; + nthw_field_t *mp_fld_tx_used_writer_data_queue_size; + nthw_field_t *mp_fld_tx_used_writer_data_packed; + nthw_field_t *mp_fld_tx_used_writer_data_int; + nthw_field_t *mp_fld_tx_used_writer_data_vec; + nthw_field_t *mp_fld_tx_used_writer_data_istk; + nthw_field_t *mp_fld_tx_used_writer_data_in_order; + nthw_register_t *mp_reg_tx_queue_property_control; nthw_field_t *mp_fld_tx_queue_property_control_adr; nthw_field_t *mp_fld_tx_queue_property_control_cnt; @@ -129,8 +179,10 @@ struct nthw_dbs_s { nthw_field_t *mp_fld_tx_queue_property_data_v_port; struct nthw_dbs_rx_am_data_s m_rx_am_shadow[NT_DBS_RX_QUEUES_MAX]; + struct nthw_dbs_rx_uw_data_s m_rx_uw_shadow[NT_DBS_RX_QUEUES_MAX]; struct nthw_dbs_tx_am_data_s m_tx_am_shadow[NT_DBS_TX_QUEUES_MAX]; + struct nthw_dbs_tx_uw_data_s m_tx_uw_shadow[NT_DBS_TX_QUEUES_MAX]; struct nthw_dbs_tx_qp_data_s m_tx_qp_shadow[NT_DBS_TX_QUEUES_MAX]; }; @@ -174,6 +226,25 @@ int set_tx_am_data(nthw_dbs_t *p, uint32_t host_id, uint32_t packed, uint32_t int_enable); +int set_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk); +int set_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order); int nthw_dbs_set_tx_qp_data(nthw_dbs_t *p, uint32_t index, uint32_t virtual_port); #endif /* _NTNIC_DBS_H_ */ diff --git a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c index 99a1575036..11453d8d38 100644 --- a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c +++ b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c @@ -11,6 +11,27 @@ static void set_shadow_tx_qp_data(nthw_dbs_t *p, uint32_t index, uint32_t virtual_port); static void flush_tx_qp_data(nthw_dbs_t *p, uint32_t index); +static void set_shadow_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order); +static void flush_tx_uw_data(nthw_dbs_t *p, uint32_t index); +static void set_shadow_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk); +static void flush_rx_uw_data(nthw_dbs_t *p, uint32_t index); static void set_shadow_rx_am_data(nthw_dbs_t *p, uint32_t index, uint64_t guest_physical_address, @@ -199,6 +220,52 @@ int dbs_init(nthw_dbs_t *p, nthw_fpga_t *p_fpga, int n_instance) p->mp_fld_tx_avail_monitor_data_int = nthw_register_query_field(p->mp_reg_tx_avail_monitor_data, DBS_TX_AM_DATA_INT); + p->mp_reg_rx_used_writer_control = nthw_module_get_register(p->mp_mod_dbs, DBS_RX_UW_CTRL); + p->mp_fld_rx_used_writer_control_adr = + nthw_register_get_field(p->mp_reg_rx_used_writer_control, DBS_RX_UW_CTRL_ADR); + p->mp_fld_rx_used_writer_control_cnt = + nthw_register_get_field(p->mp_reg_rx_used_writer_control, DBS_RX_UW_CTRL_CNT); + + p->mp_reg_rx_used_writer_data = nthw_module_get_register(p->mp_mod_dbs, DBS_RX_UW_DATA); + p->mp_fld_rx_used_writer_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_GPA); + p->mp_fld_rx_used_writer_data_host_id = + nthw_register_get_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_HID); + p->mp_fld_rx_used_writer_data_queue_size = + nthw_register_get_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_QS); + p->mp_fld_rx_used_writer_data_packed = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_PCKED); + p->mp_fld_rx_used_writer_data_int = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_INT); + p->mp_fld_rx_used_writer_data_vec = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_VEC); + p->mp_fld_rx_used_writer_data_istk = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_ISTK); + + p->mp_reg_tx_used_writer_control = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_UW_CTRL); + p->mp_fld_tx_used_writer_control_adr = + nthw_register_get_field(p->mp_reg_tx_used_writer_control, DBS_TX_UW_CTRL_ADR); + p->mp_fld_tx_used_writer_control_cnt = + nthw_register_get_field(p->mp_reg_tx_used_writer_control, DBS_TX_UW_CTRL_CNT); + + p->mp_reg_tx_used_writer_data = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_UW_DATA); + p->mp_fld_tx_used_writer_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_GPA); + p->mp_fld_tx_used_writer_data_host_id = + nthw_register_get_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_HID); + p->mp_fld_tx_used_writer_data_queue_size = + nthw_register_get_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_QS); + p->mp_fld_tx_used_writer_data_packed = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_PCKED); + p->mp_fld_tx_used_writer_data_int = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_INT); + p->mp_fld_tx_used_writer_data_vec = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_VEC); + p->mp_fld_tx_used_writer_data_istk = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_ISTK); + p->mp_fld_tx_used_writer_data_in_order = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_INO); + p->mp_reg_tx_queue_property_control = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_QP_CTRL); p->mp_fld_tx_queue_property_control_adr = @@ -247,6 +314,9 @@ void dbs_reset(nthw_dbs_t *p) for (i = 0; i < NT_DBS_RX_QUEUES_MAX; ++i) { set_shadow_rx_am_data(p, i, 0, 0, 0, 0, 0); flush_rx_am_data(p, i); + + set_shadow_rx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0); + flush_rx_uw_data(p, i); } /* Reset TX memory banks and shado */ @@ -254,6 +324,9 @@ void dbs_reset(nthw_dbs_t *p) set_shadow_tx_am_data(p, i, 0, 0, 0, 0, 0); flush_tx_am_data(p, i); + set_shadow_tx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0, 0); + flush_tx_uw_data(p, i); + set_shadow_tx_qp_data(p, i, 0); flush_tx_qp_data(p, i); } @@ -491,6 +564,249 @@ int set_tx_am_data(nthw_dbs_t *p, return 0; } +static void set_rx_uw_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_rx_used_writer_control_adr, index); + nthw_field_set_val32(p->mp_fld_rx_used_writer_control_cnt, 1); + nthw_register_flush(p->mp_reg_rx_used_writer_control, 1); +} + +static void set_shadow_rx_uw_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_rx_uw_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_rx_uw_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_rx_uw_shadow[index].host_id = host_id; +} + +static void set_shadow_rx_uw_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_rx_uw_shadow[index].queue_size = queue_size; +} + +static void set_shadow_rx_uw_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_rx_uw_shadow[index].packed = packed; +} + +static void set_shadow_rx_uw_data_int_enable(nthw_dbs_t *p, uint32_t index, uint32_t int_enable) +{ + p->m_rx_uw_shadow[index].int_enable = int_enable; +} + +static void set_shadow_rx_uw_data_vec(nthw_dbs_t *p, uint32_t index, uint32_t vec) +{ + p->m_rx_uw_shadow[index].vec = vec; +} + +static void set_shadow_rx_uw_data_istk(nthw_dbs_t *p, uint32_t index, uint32_t istk) +{ + p->m_rx_uw_shadow[index].istk = istk; +} + +static void set_shadow_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk) +{ + set_shadow_rx_uw_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_rx_uw_data_host_id(p, index, host_id); + set_shadow_rx_uw_data_queue_size(p, index, queue_size); + set_shadow_rx_uw_data_packed(p, index, packed); + set_shadow_rx_uw_data_int_enable(p, index, int_enable); + set_shadow_rx_uw_data_vec(p, index, vec); + set_shadow_rx_uw_data_istk(p, index, istk); +} + +static void flush_rx_uw_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_rx_used_writer_data_guest_physical_address, + (uint32_t *)&p->m_rx_uw_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_host_id, + p->m_rx_uw_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_queue_size, + (1U << p->m_rx_uw_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_queue_size, + p->m_rx_uw_shadow[index].queue_size); + } + + if (p->mp_fld_rx_used_writer_data_packed) { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_packed, + p->m_rx_uw_shadow[index].packed); + } + + if (p->mp_fld_rx_used_writer_data_int) { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_int, + p->m_rx_uw_shadow[index].int_enable); + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_vec, + p->m_rx_uw_shadow[index].vec); + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_istk, + p->m_rx_uw_shadow[index].istk); + } + + set_rx_uw_data_index(p, index); + nthw_register_flush(p->mp_reg_rx_used_writer_data, 1); +} + +int set_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk) +{ + if (!p->mp_reg_rx_used_writer_data) + return -ENOTSUP; + + set_shadow_rx_uw_data(p, index, guest_physical_address, host_id, queue_size, packed, + int_enable, vec, istk); + flush_rx_uw_data(p, index); + return 0; +} + +static void set_tx_uw_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_tx_used_writer_control_adr, index); + nthw_field_set_val32(p->mp_fld_tx_used_writer_control_cnt, 1); + nthw_register_flush(p->mp_reg_tx_used_writer_control, 1); +} + +static void set_shadow_tx_uw_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_tx_uw_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_tx_uw_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_tx_uw_shadow[index].host_id = host_id; +} + +static void set_shadow_tx_uw_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_tx_uw_shadow[index].queue_size = queue_size; +} + +static void set_shadow_tx_uw_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_tx_uw_shadow[index].packed = packed; +} + +static void set_shadow_tx_uw_data_int_enable(nthw_dbs_t *p, uint32_t index, uint32_t int_enable) +{ + p->m_tx_uw_shadow[index].int_enable = int_enable; +} + +static void set_shadow_tx_uw_data_vec(nthw_dbs_t *p, uint32_t index, uint32_t vec) +{ + p->m_tx_uw_shadow[index].vec = vec; +} + +static void set_shadow_tx_uw_data_istk(nthw_dbs_t *p, uint32_t index, uint32_t istk) +{ + p->m_tx_uw_shadow[index].istk = istk; +} + +static void set_shadow_tx_uw_data_in_order(nthw_dbs_t *p, uint32_t index, uint32_t in_order) +{ + p->m_tx_uw_shadow[index].in_order = in_order; +} + +static void set_shadow_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order) +{ + set_shadow_tx_uw_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_tx_uw_data_host_id(p, index, host_id); + set_shadow_tx_uw_data_queue_size(p, index, queue_size); + set_shadow_tx_uw_data_packed(p, index, packed); + set_shadow_tx_uw_data_int_enable(p, index, int_enable); + set_shadow_tx_uw_data_vec(p, index, vec); + set_shadow_tx_uw_data_istk(p, index, istk); + set_shadow_tx_uw_data_in_order(p, index, in_order); +} + +static void flush_tx_uw_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_tx_used_writer_data_guest_physical_address, + (uint32_t *)&p->m_tx_uw_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_host_id, + p->m_tx_uw_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_queue_size, + (1U << p->m_tx_uw_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_queue_size, + p->m_tx_uw_shadow[index].queue_size); + } + + if (p->mp_fld_tx_used_writer_data_packed) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_packed, + p->m_tx_uw_shadow[index].packed); + } + + if (p->mp_fld_tx_used_writer_data_int) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_int, + p->m_tx_uw_shadow[index].int_enable); + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_vec, + p->m_tx_uw_shadow[index].vec); + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_istk, + p->m_tx_uw_shadow[index].istk); + } + + if (p->mp_fld_tx_used_writer_data_in_order) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_in_order, + p->m_tx_uw_shadow[index].in_order); + } + + set_tx_uw_data_index(p, index); + nthw_register_flush(p->mp_reg_tx_used_writer_data, 1); +} + +int set_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order) +{ + if (!p->mp_reg_tx_used_writer_data) + return -ENOTSUP; + + set_shadow_tx_uw_data(p, index, guest_physical_address, host_id, queue_size, packed, + int_enable, vec, istk, in_order); + flush_tx_uw_data(p, index); + return 0; +} + static void set_tx_qp_data_index(nthw_dbs_t *p, uint32_t index) { nthw_field_set_val32(p->mp_fld_tx_queue_property_control_adr, index); diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h index 00570fa8af..c6c23de0ef 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h @@ -45,6 +45,17 @@ #define DBS_RX_PTR_PTR (0x7f834481UL) #define DBS_RX_PTR_QUEUE (0x4f3fa6d1UL) #define DBS_RX_PTR_VALID (0xbcc5ec4dUL) +#define DBS_RX_UW_CTRL (0x31afc0deUL) +#define DBS_RX_UW_CTRL_ADR (0x2ee4a2c9UL) +#define DBS_RX_UW_CTRL_CNT (0x3eec3b18UL) +#define DBS_RX_UW_DATA (0x9e7e42c7UL) +#define DBS_RX_UW_DATA_GPA (0x9193d52cUL) +#define DBS_RX_UW_DATA_HID (0x71a5cf86UL) +#define DBS_RX_UW_DATA_INT (0x22912312UL) +#define DBS_RX_UW_DATA_ISTK (0xd469a7ddUL) +#define DBS_RX_UW_DATA_PCKED (0xef15c665UL) +#define DBS_RX_UW_DATA_QS (0x7d422f44UL) +#define DBS_RX_UW_DATA_VEC (0x55cc9b53UL) #define DBS_STATUS (0xb5f35220UL) #define DBS_STATUS_OK (0xcf09a30fUL) #define DBS_TX_AM_CTRL (0xd6d29b9UL) @@ -94,6 +105,18 @@ #define DBS_TX_QP_CTRL_CNT (0x942b1855UL) #define DBS_TX_QP_DATA (0x7a2a262bUL) #define DBS_TX_QP_DATA_VPORT (0xda741d67UL) +#define DBS_TX_UW_CTRL (0x3cb1b099UL) +#define DBS_TX_UW_CTRL_ADR (0xd626e97fUL) +#define DBS_TX_UW_CTRL_CNT (0xc62e70aeUL) +#define DBS_TX_UW_DATA (0x93603280UL) +#define DBS_TX_UW_DATA_GPA (0x69519e9aUL) +#define DBS_TX_UW_DATA_HID (0x89678430UL) +#define DBS_TX_UW_DATA_INO (0x5036a148UL) +#define DBS_TX_UW_DATA_INT (0xda5368a4UL) +#define DBS_TX_UW_DATA_ISTK (0xf693732fUL) +#define DBS_TX_UW_DATA_PCKED (0xbc84af81UL) +#define DBS_TX_UW_DATA_QS (0xdda7f099UL) +#define DBS_TX_UW_DATA_VEC (0xad0ed0e5UL) #endif /* _NTHW_FPGA_REG_DEFS_DBS_ */ -- 2.45.0