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 BAB5145B04; Thu, 10 Oct 2024 16:20:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B66440E30; Thu, 10 Oct 2024 16:15:46 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 1B34D40E6E for ; Thu, 10 Oct 2024 16:15:19 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2235.outbound.protection.outlook.com [104.47.51.235]) by mx-outbound11-198.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 10 Oct 2024 14:15:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SoUoHqmMNxBGan91DSiAGtPQIb7vc79baVH3yoiKl9vAAsuWK5XeU5+QXh/ZHTDSrgAEbSreMQOvithQmTomMogk2QQLPe+IlXMYGDw88O+C2Uwe80d0hYkBciN513UEEkzx99NCPh9bUW/Aa+bIMdJUtTpfkpd1u1K+mjzwgDSrY6zyIaJyWyCeaAzzT2/afOiuicxq0FRAurKp1KcyJRuC0pnkw6dFZZsTZNURlSV8xr4FfDVINUwse7Vk0C06bEv1Ra1mAy/8AIMF6Us+uZR0ecwxTPHXiEFn/m84RAvnjYxMYy/BF+8smFzx6+zaz5p1GcEk9PdvBzAiDscbfQ== 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=Pgzr5ndNqY6BvniE//jCwLzYRQSzQIuMID+vgKUcbsA=; b=Mng22mC9QTVAzbzV7T6AutSGx/afMBYKYYoRbmrgDVKQKSLJRczZm4KkxBHBYZh+2n5/Wd6UTLR4EB3WIzYz5xrq8udAF5pIVhk8kV+0DQLO8dTqIhPqlLU7l3lcPTWOS4V5xcqkS2dCpiAw1cy0/BfVB7U5hBrX+8I1VAEklzYuLVAQwYcXvE+weUCQZWHzUX0szP8thgK2B/drF6JfuC6n2qDFNPAgQqsQfKpDJeCIRHrvW/98TRVJA4pwIsu0YHFJ4RHA+1D4lrVKEgZBvJwRpj81eBjGEzv3vXCGSeT/E1b3KuxuXavQrSOwKgCzA6CSZFBcC6jbXbjrnkjJfQ== 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=Pgzr5ndNqY6BvniE//jCwLzYRQSzQIuMID+vgKUcbsA=; b=dRMiVG7Kj/pzB0o4/nY9CI8mv5feliotxuYqRcRKASRAdhGfnbcdM4RH7UZ1gSsq2TmuB3U6uvJC0juVGkQ+pabm7mcXMPsoaz4jw/EcbhYvda+sctg2IsckDjxN/4op0eVrDDu5LBLQINxNzisesjFpu6LFEMKr6tryIdfhCKw= Received: from DU2PR04CA0081.eurprd04.prod.outlook.com (2603:10a6:10:232::26) by AS4P190MB2024.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:51c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Thu, 10 Oct 2024 14:15:12 +0000 Received: from DU6PEPF0000B61B.eurprd02.prod.outlook.com (2603:10a6:10:232:cafe::77) by DU2PR04CA0081.outlook.office365.com (2603:10a6:10:232::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Thu, 10 Oct 2024 14:15:12 +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 DU6PEPF0000B61B.mail.protection.outlook.com (10.167.8.132) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 14:15:12 +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 v3 46/50] net/ntnic: add descriptor reader data handling functions Date: Thu, 10 Oct 2024 16:14:01 +0200 Message-ID: <20241010141416.4063591-47-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241010141416.4063591-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241010141416.4063591-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61B:EE_|AS4P190MB2024:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b79f9da4-397e-41c9-f49e-08dce935f489 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?UUrZwG7eNdTZAMGstuq0+MCNW53UqVYN/BisxUTXUTuOSfL9Yes5VDnJ4C5s?= =?us-ascii?Q?H+3HeONFT6JayYgUR9VVsWVcc7HVl1CFRZAjKXHCdTNHjZr3BXZHLJrnm2sI?= =?us-ascii?Q?ZWpYqBEJ3JTG2lOIFgdJhk+Uh2wnd5BDDlqBSUp92pYXIjrjmFQA0uhRNC6+?= =?us-ascii?Q?jRAQk7mgmbVaf1DS6fbZfbATNaVH6ADAN7eJJEF/ewiu1tLx2s34sfMybMOC?= =?us-ascii?Q?IP/yFtxuODYAlVoWrHRYTnPpxcHEM7PZokTLH0Ldkaeea+ugiDMmq9loaW0+?= =?us-ascii?Q?m81+v60teIgyB9sNQ64kJm1dreEI+EeeAYyg+tdc2B2eokLanHsq6zkP2EX/?= =?us-ascii?Q?BBkgNQIpf9+8+AO5d1fQBe7/e0baog35mqgdxp7Z+73+Nr7tD2InpUbIPoLg?= =?us-ascii?Q?A3SP6IPAuxr6QEVbLF1Ar7VZEKZM49KfQoyJKU4ivdP53pcSdsxmwKPSGK7i?= =?us-ascii?Q?ZGvvIeFQ6HAYkM77OQkbXCeTg3b0Fh56p5zCQL5egq7MDFNtvyjiXAuKrPYq?= =?us-ascii?Q?pDBbXvnDgdu2Eymuo4KuUZC/31k/cXsi01PQ/Sx98FaCfLG8/xo2MO4eIHsT?= =?us-ascii?Q?uwNLyvR4MErT7quXjOpY01QaWSrDW+6HajbkeQyN5DF1/Mq8bGyIekt7hDwd?= =?us-ascii?Q?r03DaAjPPtlBLXBc9KUivMxWsr6MoT15kmTWoQW117CAmRalmLY1jIdKYw7z?= =?us-ascii?Q?6Uy5Is3z76NbFWi/JgT0NtQVVNP87BTq5SXMRBuN4glzjjkkUTwdMbw+Rgos?= =?us-ascii?Q?pfOk4BlxIlbx8QBARxBhu+5lyrdzEDVKdBdzVVBSkAFtUriS9C7XM3nCdqi6?= =?us-ascii?Q?IOiWxpTWvD82AgNF45N1BKprXhmbd0mISEx6q0ZyKCJgef/xWB3iR/X5dxGE?= =?us-ascii?Q?5PWrl8D41ZIrr+R6VoYcRVtnrOs3EMLYNrUKuzKmmmIKLYbhoPxsCa3Wb4Yg?= =?us-ascii?Q?3k/FgzlI27LkF+USKYsuW3q9C0LbtK9mtquweIaPsDpUkfoeQhgKDhxHzDub?= =?us-ascii?Q?AbV56gWqlPQf4SqXGXev4+MdyLE+l+cCe7kgATRHdP9KBS6/yNQK/C2Tu7Yy?= =?us-ascii?Q?iuOzeXjg0EDVPA7CoVc1sLPMunk8/cPdUrPwW9kr+PtYL0s/S9vo2IAI9N+Z?= =?us-ascii?Q?2kuiuPgoyfx8+fhgi+ysubWb7OMyrDye/Kukg9r/FbwJ/SE04YeSa956mGhq?= =?us-ascii?Q?Nb78DMQIolOQqRgh6F5w/DkiDPlW/p0aIWaBoSGd46YvmZOMg7hzf3Rq6U/y?= =?us-ascii?Q?V7e7kEn+qxy3fg8FvaLXX6KpkeTG1eQPigbCUpHsKIVyErlPfw6LeimNL6Kx?= =?us-ascii?Q?j7Pah5LcrLaf336dQaac3FqGINHVAPNQrgp5pPGg0qkZXdweITbqraLf8YEu?= =?us-ascii?Q?hlibcnweh/hYAqGklvJ6CenFUTRS?= 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)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: mN8oSB0GCKj/9CXXM7xkUH+39u7QjxGHMu01Jpb47aV3diuY8hNQDWHzprhYRXytLp3RqM7xgkUNLOPko6IOFhe+MNtSju8pgW8yH8fU2QnMbG/Gcu9gP5SDQQ9b+R9IgthxO/aY+bSBwQLXNO6qRirbnuO9Pd489i3WP/reelXjXjCemGgr0lt32pRFPZRHhTQNKV7CB5GQyhg6Gtwt4NTuBPGuCPfbqfxtGxVNlsuiqRV9if+hRHPGKnebZmm9DwwIfC7llbdbKcGCBi5QxP8Qsj7+vUmUd3gCX3AFyyY7lQ7v1r/1LwUkyAPsJlg6CmyR5uyMrPqv+P1KDbuklXdsHGmh2PnKSeaCj3IhYe92+FxhDbmHxM+90+XdXyy2F+BxFcf/XzYgFLNlDXe+s5lbFCmmLFEuOq2f3/kJxtoNiPV+GqwB1Ifrvl2Mxi8yC5W2IRvsJynO1ABBEVoOkf1N2jFZcGSzKQ8/txUec3+5m6unM+46I6b7AkSiCMGXbJsnKSnDQ9xkVrJKGJzKNbkBd/l0C4zQMuK9DAv2L7mWBVA1Za1jTj9f2FeigKZS/E+MTpI6CYmNVN0jdYwPgK9ABEp7LdcJnxF1tFhiJBwOzVZa9E6qoy1DQc4SLpCWBjGWMZZhKwrOg8DHTNEm/+75JcJeURV471bIaIx8OC8= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:15:12.2175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b79f9da4-397e-41c9-f49e-08dce935f489 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: DU6PEPF0000B61B.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4P190MB2024 X-BESS-ID: 1728569714-303014-12773-25658-2 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.51.235 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaWhpbGQGYGUDTN2MzCIDE5yc LQPMUyMdkkydTU0tQgOckoycDY2DDJRKk2FgC3zFxIQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259630 [from cloudscan21-251.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=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 Added functions for setting and flushing RX and TX descriptor reader data. Implemented internal strcutres to update shadow structures with guest physical address, host ID, queue size, header, and packed status. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 30 +- drivers/net/ntnic/include/ntnic_dbs.h | 59 ++++ drivers/net/ntnic/nthw/dbs/nthw_dbs.c | 267 ++++++++++++++++++ .../nthw/supported/nthw_fpga_reg_defs_dbs.h | 19 ++ 4 files changed, 371 insertions(+), 4 deletions(-) diff --git a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c index dbf2285424..be241eb057 100644 --- a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +++ b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c @@ -104,6 +104,8 @@ struct nthw_virt_queue { * 1: Napatech DVIO0 descriptor (12 bytes). */ void *avail_struct_phys_addr; + void *used_struct_phys_addr; + void *desc_struct_phys_addr; }; static struct nthw_virt_queue rxvq[MAX_VIRT_QUEUES]; @@ -311,13 +313,21 @@ static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, uint32_t vq_type, int irq_vector) { - (void)header; - (void)desc_struct_phys_addr; uint32_t qs = dbs_qsize_log2(queue_size); uint32_t int_enable; uint32_t vec; uint32_t istk; + /* + * Setup DBS module - DSF00094 + * 3. Configure the DBS.RX_DR_DATA memory; good idea to initialize all + * DBS_RX_QUEUES entries. + */ + if (set_rx_dr_data(p_nthw_dbs, index, (uint64_t)desc_struct_phys_addr, host_id, qs, header, + 0) != 0) { + return NULL; + } + /* * 4. Configure the DBS.RX_UW_DATA memory; good idea to initialize all * DBS_RX_QUEUES entries. @@ -375,6 +385,8 @@ static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, rxvq[index].am_enable = (irq_vector < 0) ? RX_AM_ENABLE : RX_AM_DISABLE; rxvq[index].host_id = host_id; rxvq[index].avail_struct_phys_addr = avail_struct_phys_addr; + rxvq[index].used_struct_phys_addr = used_struct_phys_addr; + rxvq[index].desc_struct_phys_addr = desc_struct_phys_addr; rxvq[index].vq_type = vq_type; rxvq[index].in_order = 0; /* not used */ rxvq[index].irq_vector = irq_vector; @@ -399,13 +411,21 @@ static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, int irq_vector, uint32_t in_order) { - (void)header; - (void)desc_struct_phys_addr; uint32_t int_enable; uint32_t vec; uint32_t istk; uint32_t qs = dbs_qsize_log2(queue_size); + /* + * Setup DBS module - DSF00094 + * 3. Configure the DBS.TX_DR_DATA memory; good idea to initialize all + * DBS_TX_QUEUES entries. + */ + if (set_tx_dr_data(p_nthw_dbs, index, (uint64_t)desc_struct_phys_addr, host_id, qs, port, + header, 0) != 0) { + return NULL; + } + /* * 4. Configure the DBS.TX_UW_DATA memory; good idea to initialize all * DBS_TX_QUEUES entries. @@ -468,6 +488,8 @@ static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, txvq[index].port = port; txvq[index].virtual_port = virtual_port; txvq[index].avail_struct_phys_addr = avail_struct_phys_addr; + txvq[index].used_struct_phys_addr = used_struct_phys_addr; + txvq[index].desc_struct_phys_addr = desc_struct_phys_addr; txvq[index].vq_type = vq_type; txvq[index].in_order = in_order; txvq[index].irq_vector = irq_vector; diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h index f3b5a20739..64947b4d8f 100644 --- a/drivers/net/ntnic/include/ntnic_dbs.h +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -56,6 +56,25 @@ struct nthw_dbs_tx_uw_data_s { uint32_t in_order; }; +/* DBS_RX_DR_DATA */ +struct nthw_dbs_rx_dr_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t header; + uint32_t packed; +}; + +/* DBS_TX_DR_DATA */ +struct nthw_dbs_tx_dr_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t header; + uint32_t port; + uint32_t packed; +}; + /* DBS_TX_QP_DATA */ struct nthw_dbs_tx_qp_data_s { uint32_t virtual_port; @@ -171,6 +190,29 @@ struct nthw_dbs_s { 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_rx_descriptor_reader_control; + nthw_field_t *mp_fld_rx_descriptor_reader_control_adr; + nthw_field_t *mp_fld_rx_descriptor_reader_control_cnt; + + nthw_register_t *mp_reg_rx_descriptor_reader_data; + nthw_field_t *mp_fld_rx_descriptor_reader_data_guest_physical_address; + nthw_field_t *mp_fld_rx_descriptor_reader_data_host_id; + nthw_field_t *mp_fld_rx_descriptor_reader_data_queue_size; + nthw_field_t *mp_fld_rx_descriptor_reader_data_header; + nthw_field_t *mp_fld_rx_descriptor_reader_data_packed; + + nthw_register_t *mp_reg_tx_descriptor_reader_control; + nthw_field_t *mp_fld_tx_descriptor_reader_control_adr; + nthw_field_t *mp_fld_tx_descriptor_reader_control_cnt; + + nthw_register_t *mp_reg_tx_descriptor_reader_data; + nthw_field_t *mp_fld_tx_descriptor_reader_data_guest_physical_address; + nthw_field_t *mp_fld_tx_descriptor_reader_data_host_id; + nthw_field_t *mp_fld_tx_descriptor_reader_data_queue_size; + nthw_field_t *mp_fld_tx_descriptor_reader_data_port; + nthw_field_t *mp_fld_tx_descriptor_reader_data_header; + nthw_field_t *mp_fld_tx_descriptor_reader_data_packed; + 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; @@ -180,9 +222,11 @@ struct nthw_dbs_s { 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_rx_dr_data_s m_rx_dr_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_dr_data_s m_tx_dr_shadow[NT_DBS_TX_QUEUES_MAX]; struct nthw_dbs_tx_qp_data_s m_tx_qp_shadow[NT_DBS_TX_QUEUES_MAX]; }; @@ -245,6 +289,21 @@ int set_tx_uw_data(nthw_dbs_t *p, uint32_t vec, uint32_t istk, uint32_t in_order); +int set_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed); +int set_tx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed); 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 171a4509f6..016b580855 100644 --- a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c +++ b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c @@ -11,6 +11,23 @@ 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_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed); +static void flush_tx_dr_data(nthw_dbs_t *p, uint32_t index); +static void set_shadow_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed); +static void flush_rx_dr_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, @@ -266,6 +283,54 @@ int dbs_init(nthw_dbs_t *p, nthw_fpga_t *p_fpga, int n_instance) 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_rx_descriptor_reader_control = + nthw_module_get_register(p->mp_mod_dbs, DBS_RX_DR_CTRL); + p->mp_fld_rx_descriptor_reader_control_adr = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_control, + DBS_RX_DR_CTRL_ADR); + p->mp_fld_rx_descriptor_reader_control_cnt = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_control, + DBS_RX_DR_CTRL_CNT); + + p->mp_reg_rx_descriptor_reader_data = + nthw_module_get_register(p->mp_mod_dbs, DBS_RX_DR_DATA); + p->mp_fld_rx_descriptor_reader_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_GPA); + p->mp_fld_rx_descriptor_reader_data_host_id = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_HID); + p->mp_fld_rx_descriptor_reader_data_queue_size = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_QS); + p->mp_fld_rx_descriptor_reader_data_header = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_HDR); + p->mp_fld_rx_descriptor_reader_data_packed = + nthw_register_query_field(p->mp_reg_rx_descriptor_reader_data, + DBS_RX_DR_DATA_PCKED); + + p->mp_reg_tx_descriptor_reader_control = + nthw_module_get_register(p->mp_mod_dbs, DBS_TX_DR_CTRL); + p->mp_fld_tx_descriptor_reader_control_adr = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_control, + DBS_TX_DR_CTRL_ADR); + p->mp_fld_tx_descriptor_reader_control_cnt = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_control, + DBS_TX_DR_CTRL_CNT); + + p->mp_reg_tx_descriptor_reader_data = + nthw_module_get_register(p->mp_mod_dbs, DBS_TX_DR_DATA); + p->mp_fld_tx_descriptor_reader_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_GPA); + p->mp_fld_tx_descriptor_reader_data_host_id = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_HID); + p->mp_fld_tx_descriptor_reader_data_queue_size = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_QS); + p->mp_fld_tx_descriptor_reader_data_header = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_HDR); + p->mp_fld_tx_descriptor_reader_data_port = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_PORT); + p->mp_fld_tx_descriptor_reader_data_packed = + nthw_register_query_field(p->mp_reg_tx_descriptor_reader_data, + DBS_TX_DR_DATA_PCKED); + 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 = @@ -317,6 +382,9 @@ void dbs_reset(nthw_dbs_t *p) set_shadow_rx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0); flush_rx_uw_data(p, i); + + set_shadow_rx_dr_data(p, i, 0, 0, 0, 0, 0); + flush_rx_dr_data(p, i); } /* Reset TX memory banks and shado */ @@ -327,6 +395,9 @@ void dbs_reset(nthw_dbs_t *p) set_shadow_tx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0, 0); flush_tx_uw_data(p, i); + set_shadow_tx_dr_data(p, i, 0, 0, 0, 0, 0, 0); + flush_tx_dr_data(p, i); + set_shadow_tx_qp_data(p, i, 0); flush_tx_qp_data(p, i); } @@ -807,6 +878,202 @@ int set_tx_uw_data(nthw_dbs_t *p, return 0; } +static void set_rx_dr_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_control_adr, index); + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_control_cnt, 1); + nthw_register_flush(p->mp_reg_rx_descriptor_reader_control, 1); +} + +static void set_shadow_rx_dr_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_rx_dr_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_rx_dr_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_rx_dr_shadow[index].host_id = host_id; +} + +static void set_shadow_rx_dr_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_rx_dr_shadow[index].queue_size = queue_size; +} + +static void set_shadow_rx_dr_data_header(nthw_dbs_t *p, uint32_t index, uint32_t header) +{ + p->m_rx_dr_shadow[index].header = header; +} + +static void set_shadow_rx_dr_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_rx_dr_shadow[index].packed = packed; +} + +static void set_shadow_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed) +{ + set_shadow_rx_dr_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_rx_dr_data_host_id(p, index, host_id); + set_shadow_rx_dr_data_queue_size(p, index, queue_size); + set_shadow_rx_dr_data_header(p, index, header); + set_shadow_rx_dr_data_packed(p, index, packed); +} + +static void flush_rx_dr_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_rx_descriptor_reader_data_guest_physical_address, + (uint32_t *)&p->m_rx_dr_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_host_id, + p->m_rx_dr_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_queue_size, + (1U << p->m_rx_dr_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_queue_size, + p->m_rx_dr_shadow[index].queue_size); + } + + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_header, + p->m_rx_dr_shadow[index].header); + + if (p->mp_fld_rx_descriptor_reader_data_packed) { + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_packed, + p->m_rx_dr_shadow[index].packed); + } + + set_rx_dr_data_index(p, index); + nthw_register_flush(p->mp_reg_rx_descriptor_reader_data, 1); +} + +int set_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed) +{ + if (!p->mp_reg_rx_descriptor_reader_data) + return -ENOTSUP; + + set_shadow_rx_dr_data(p, index, guest_physical_address, host_id, queue_size, header, + packed); + flush_rx_dr_data(p, index); + return 0; +} + +static void set_tx_dr_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_control_adr, index); + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_control_cnt, 1); + nthw_register_flush(p->mp_reg_tx_descriptor_reader_control, 1); +} + +static void set_shadow_tx_dr_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_tx_dr_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_tx_dr_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_tx_dr_shadow[index].host_id = host_id; +} + +static void set_shadow_tx_dr_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_tx_dr_shadow[index].queue_size = queue_size; +} + +static void set_shadow_tx_dr_data_header(nthw_dbs_t *p, uint32_t index, uint32_t header) +{ + p->m_tx_dr_shadow[index].header = header; +} + +static void set_shadow_tx_dr_data_port(nthw_dbs_t *p, uint32_t index, uint32_t port) +{ + p->m_tx_dr_shadow[index].port = port; +} + +static void set_shadow_tx_dr_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_tx_dr_shadow[index].packed = packed; +} + +static void set_shadow_tx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed) +{ + set_shadow_tx_dr_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_tx_dr_data_host_id(p, index, host_id); + set_shadow_tx_dr_data_queue_size(p, index, queue_size); + set_shadow_tx_dr_data_header(p, index, header); + set_shadow_tx_dr_data_port(p, index, port); + set_shadow_tx_dr_data_packed(p, index, packed); +} + +static void flush_tx_dr_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_tx_descriptor_reader_data_guest_physical_address, + (uint32_t *)&p->m_tx_dr_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_host_id, + p->m_tx_dr_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_queue_size, + (1U << p->m_tx_dr_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_queue_size, + p->m_tx_dr_shadow[index].queue_size); + } + + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_header, + p->m_tx_dr_shadow[index].header); + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_port, + p->m_tx_dr_shadow[index].port); + + if (p->mp_fld_tx_descriptor_reader_data_packed) { + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_packed, + p->m_tx_dr_shadow[index].packed); + } + + set_tx_dr_data_index(p, index); + nthw_register_flush(p->mp_reg_tx_descriptor_reader_data, 1); +} + +int set_tx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed) +{ + if (!p->mp_reg_tx_descriptor_reader_data) + return -ENOTSUP; + + set_shadow_tx_dr_data(p, index, guest_physical_address, host_id, queue_size, port, header, + packed); + flush_tx_dr_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 c6c23de0ef..0c7bbd8efd 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 @@ -30,6 +30,15 @@ #define DBS_RX_CONTROL_QE (0x3e928d3UL) #define DBS_RX_CONTROL_UWE (0xb490e8dbUL) #define DBS_RX_CONTROL_UWS (0x40445d8aUL) +#define DBS_RX_DR_CTRL (0xa0cbc617UL) +#define DBS_RX_DR_CTRL_ADR (0xa7b57286UL) +#define DBS_RX_DR_CTRL_CNT (0xb7bdeb57UL) +#define DBS_RX_DR_DATA (0xf1a440eUL) +#define DBS_RX_DR_DATA_GPA (0x18c20563UL) +#define DBS_RX_DR_DATA_HDR (0xb98ed4d5UL) +#define DBS_RX_DR_DATA_HID (0xf8f41fc9UL) +#define DBS_RX_DR_DATA_PCKED (0x1e27ce2aUL) +#define DBS_RX_DR_DATA_QS (0xffb980ddUL) #define DBS_RX_IDLE (0x93c723bfUL) #define DBS_RX_IDLE_BUSY (0x8e043b5bUL) #define DBS_RX_IDLE_IDLE (0x9dba27ccUL) @@ -74,6 +83,16 @@ #define DBS_TX_CONTROL_QE (0xa30cf70eUL) #define DBS_TX_CONTROL_UWE (0x4c52a36dUL) #define DBS_TX_CONTROL_UWS (0xb886163cUL) +#define DBS_TX_DR_CTRL (0xadd5b650UL) +#define DBS_TX_DR_CTRL_ADR (0x5f773930UL) +#define DBS_TX_DR_CTRL_CNT (0x4f7fa0e1UL) +#define DBS_TX_DR_DATA (0x2043449UL) +#define DBS_TX_DR_DATA_GPA (0xe0004ed5UL) +#define DBS_TX_DR_DATA_HDR (0x414c9f63UL) +#define DBS_TX_DR_DATA_HID (0x36547fUL) +#define DBS_TX_DR_DATA_PCKED (0x4db6a7ceUL) +#define DBS_TX_DR_DATA_PORT (0xf306968cUL) +#define DBS_TX_DR_DATA_QS (0x5f5c5f00UL) #define DBS_TX_IDLE (0xf0171685UL) #define DBS_TX_IDLE_BUSY (0x61399ebbUL) #define DBS_TX_IDLE_IDLE (0x7287822cUL) -- 2.45.0