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 A1DD945ACC; Sun, 6 Oct 2024 22:41:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C998740DCB; Sun, 6 Oct 2024 22:38:23 +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 54FAF40B8D for ; Sun, 6 Oct 2024 22:38:00 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2112.outbound.protection.outlook.com [104.47.18.112]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 06 Oct 2024 20:37:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r500sgkIOKwWcaefgBbWhCjFNQhlvjzvNnA+1ZkwQq72EYFmaOMLkGqwQCdm8waw5cg00wp3OOX5+d27WYF7hG9cGE+yCBJ3I3DmYzA27uZgjEpDSuGvMI2L/VhUItoQdzon/VVBI6dvvMLPhz39PQm1WCtG9rSF3r5fRzkuegfILKQGw6evvBu+YzM6lSyM9QOH7DL7Dx2fDmSUFBJQy7GBuDoYVPwIwUqZwgx34Tbv0+qQsa2AN3Rj7Kx2VTlEkfR8tRyJh56BKsKavd9reU4pc9I9aGvtGkFVH0DjQHknD8XHPnTQsRlAAoBtq3AgCkuMd/xKpvhZJP/D5VNREg== 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=B8u/DwR1WhibYc5POCYyGm2FQ55vYKNswWFMUXYm5Ew=; b=V4FAOQPJZiUmBp6f2rbcoqVvCRZQuthmKBsFq7HQMp0H5lyHql6qpzoyQMUujkbAhHwKSbUEpfBzfeSNsn/iUgFcEqaeZFk9zhUfVo7NasE5DVHjKytH2xkQFvRPW3jxBxhSqJx0DHAzZfIUcR4HUiu+ZG+xX0ROeoqJ3BsbFIKQ/fMOBGDnsjhN8ejYEzWx4HCF/hW2WNZVIMIzwIWvtLlnzXJPvBgnmjtle+jo9mgurw7FAPnd+56dWKRLtDJ0pD8G5gYR8psadSbiD2UXew1zLem75OZJtvU1aECQElu6+8EoaU+FOjf2IL2zgb873ectqezsibGbBR0y8WbaiQ== 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=B8u/DwR1WhibYc5POCYyGm2FQ55vYKNswWFMUXYm5Ew=; b=W0/VzXX8UfHWRk+F7sHz5RCdS/9b+zbQcWHm10GdoCBDcSIshhoouiGddj/N4tefBmOpIsDj0fJHF9C26p3K8OsT8WuXkeLwE5PG9R2k8MHKjklXQdHwxFcz7PKSN12wJ16gU0II58l7l9k6FX+R1CoT/+6+X9INCjMzgsDf68g= Received: from AM6PR04CA0020.eurprd04.prod.outlook.com (2603:10a6:20b:92::33) by DBAP190MB0935.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Sun, 6 Oct 2024 20:37:57 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::c6) by AM6PR04CA0020.outlook.office365.com (2603:10a6:20b:92::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20 via Frontend Transport; Sun, 6 Oct 2024 20:37:57 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Sun, 6 Oct 2024 20:37:57 +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, Oleksandr Kolomeiets Subject: [PATCH v1 32/50] net/ntnic: add queue select (QSL) FPGA module Date: Sun, 6 Oct 2024 22:36:59 +0200 Message-ID: <20241006203728.330792-33-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241006203728.330792-1-sil-plv@napatech.com> References: <20241006203728.330792-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|DBAP190MB0935:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b76bf2fe-dad5-4584-e4d8-08dce646c323 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?j3fSlwheBM1gFu75UqAOWNbNr+RlSjlMXtGhH1ziXZ8/GjJ16g82RfNRVG6n?= =?us-ascii?Q?1vG8hYfEjCjcgNPBDp4Gurapg5AZErFAmKFqvljJ77NFe9YRsPvFdK4A0mO8?= =?us-ascii?Q?0Husnnn9gFJ1VHEuRx1+Bvjlc9kaPByrpRfm+hCpv5Lh1LGBc1WmfL4YYZwX?= =?us-ascii?Q?TPNXXjRXgC1HdZMAdlU92EO8Tl1DGa3PRth6lmkJY0DbY4odqnPWdZarDUoq?= =?us-ascii?Q?C9BbDR/bvIoTaswIl+y/ih2OQhtJ7xhz6SYOm47/tDfhxY8SCb9IIUi5UrD1?= =?us-ascii?Q?T70bBBDzBdqMjp0AIFvUnb0cw6nx7ubxuzBxwAAigpeYHYfa5LoTyD+Ft/8f?= =?us-ascii?Q?UYUKEH8h+9k9A+280kUz2HP98EUj/QgUrgJkk7YIhuPlpF5Mj5jebHWd15ug?= =?us-ascii?Q?f0Y9M6xLedoKM9vPCBk1yg3GinZczExz9r0+Fr5EeC8AJ2rY4U4J657Nos/6?= =?us-ascii?Q?Petacm02TKGgQpkhQ8DbvHRXZekXVCIXFp7SCumtGgm6tvEHy2Ec0TMDlV7o?= =?us-ascii?Q?wTqQiZMMy50rJZXs9zjLOsQa9L1vSb5qsVW/X0xt6nuly+LChMA77BN8OLIf?= =?us-ascii?Q?rGR0U3kjuX7ZgUnR5LOid83Na+TzMNoV0O2xe2+WjZ4fuG1pYq6S/q4C6hCh?= =?us-ascii?Q?Mv4AZCVkLb/RzLvLbmvtDrP/KK5Bv2IlQQfsEUqEC5/OhMu7CliQtgDTvmP9?= =?us-ascii?Q?QdqCSpQ/Et24W+8TLeqfjN9WrEiFdrLMfz6I8f7fX4IBbLR1DgbsesY5d5iR?= =?us-ascii?Q?ZYKzvIRTnj0Daq7Wtm7D65Wo8R4MkZs//5k3wpCUme1pEWNgVom1db6v0u+t?= =?us-ascii?Q?OCX1wIa1E+eNGJc27sr9BwuHNtwdW51M54VYTwUiTdKW4yuYyduaz/0tT+n0?= =?us-ascii?Q?8knPwJbyv23uhk/+hKVxau9o5x5KZ8uz7CK8vMLA8zc0OMCOoZMtayXv7BwC?= =?us-ascii?Q?7CpFuvT12+UxRrfpaKLl4BETXIAfG3e/K8f97KzsrT7JqcsmqsjZkemphxjB?= =?us-ascii?Q?Zyc9K1lQHwF8tcBCwO+EqpPZhYF99zUtUofalEyBGwzoM0t5tK/dmx0byDSn?= =?us-ascii?Q?VEd+0VPxdiBGSHHq2g2FGG1F/uHECaypDrqs67HaLffqNI35n1Gm1lKeaLh+?= =?us-ascii?Q?Y66MWuUg9NKOYOevwxAOmrkTWzgmwwCgqwiHNGqVbQt/G82NPFjN/RhIiKMO?= =?us-ascii?Q?GzsHoUIpQVfk0RA/njzAYetI6zxbuZHusCWxSGzpoeVY4r5jmXM2M04PDqAu?= =?us-ascii?Q?2C/W/1VXh+6psUYX1nrnPHj5jNIR4bujJGB6pP/YUG7NBmn2ITKBd7xbnyrH?= =?us-ascii?Q?PtuE43LIBqGTop2bq6Ga7MdAVPCp59xJGHmqrbpqBdtNS/bYMMfRW1ZibzCf?= =?us-ascii?Q?Jo5HLOGg6sfIrXu6UQnRxMiLr1tO?= 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)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: NQ3NKHUz94pFDjnn9J9joUYJuQ1uEaL9Dn4KWhDDnW7anrfhAjbNcB6RDFdj+t68UU3o05H4LX/uSjZKCa3yWDp+GvQ2GnLQqYexDshLdOS1Hg2EFXgGS4jbXvgixIxSzBIrmSktv8RAY4YcIXhycuxsWcVN4JSDYa2ed1DDeefxTYKPFyEa53Et0Tnmx0focIkytBtVnTFPD505m0pBZ87bsA3uwctcXLMw9nvx5v2Y4NIB3rdHedHLretzqMKDpoYLqEj8kJa8uaCWG+Ovn1NIKooLSjbf/ZBij1wt1f88fvFHQEQFlUpFj2MXbWQl3zOgzABI7PAQDrCVOan1Q/yYCIqubz3N+R3CcW77XApmR+gVWIwPQSeGklEuwseCX4pjBlI0KL4yenimpAAYpUDkMOnaRNfMJeh2NJKaOIJ5xN8kIC7jlbna2Lja6cDo0BGaFxfEmHZ1BuBD5jFS0twptZHfxjhnypUmI9CoxbPR0NQvjh7eVPojAerJQOGesKwBHgbegzM9I7AM6DWvVgXqBOvG7clkFjg8rz87ugyl25Ui+xRq4vpFKcCoKeaeU8yo3j/MDBqEL909/YmaWT4nqp25peBTq/fK0LejcPNDkL/98Fd2PRsf8SO1Vzau5B6YQpwAfwpuRndsF73Axg== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2024 20:37:57.3745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b76bf2fe-dad5-4584-e4d8-08dce646c323 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0935 X-BESS-ID: 1728247079-311388-12679-123471-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.18.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGlibmQGYGUDTR3MDEJNE8JS 051cAyLc3IwMjcyMLcAIQTLS0tLZRqYwHDpJ8aQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259547 [from cloudscan15-206.eu-central-1a.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: Oleksandr Kolomeiets The Queue Selector module directs packets to a given destination which includes host queues, physical ports, exceptions paths, and discard. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 37 ++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 14 ++ .../nthw/flow_api/hw_mod/hw_mod_backend.c | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c | 170 ++++++++++++++++++ .../supported/nthw_fpga_9563_055_049_0000.c | 57 +++++- 6 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 6bf651272f..13e0d1731e 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -537,6 +537,42 @@ struct qsl_func_s { struct hw_mod_qsl_v7_s v7; }; }; +enum hw_qsl_e { + /* functions */ + HW_QSL_RCP_PRESET_ALL = 0, + HW_QSL_RCP_COMPARE, + HW_QSL_RCP_FIND, + HW_QSL_QST_PRESET_ALL, + /* fields */ + HW_QSL_RCP_DISCARD = FIELD_START_INDEX, + HW_QSL_RCP_DROP, + HW_QSL_RCP_TBL_LO, + HW_QSL_RCP_TBL_HI, + HW_QSL_RCP_TBL_IDX, + HW_QSL_RCP_TBL_MSK, + HW_QSL_RCP_LR, + HW_QSL_RCP_TSA, + HW_QSL_RCP_VLI, + HW_QSL_QST_QUEUE, + HW_QSL_QST_EN, /* Alias: HW_QSL_QST_QEN */ + HW_QSL_QST_TX_PORT, + HW_QSL_QST_LRE, + HW_QSL_QST_TCI, + HW_QSL_QST_VEN, + HW_QSL_QEN_EN, + HW_QSL_UNMQ_DEST_QUEUE, + HW_QSL_UNMQ_EN, +}; +bool hw_mod_qsl_present(struct flow_api_backend_s *be); +int hw_mod_qsl_alloc(struct flow_api_backend_s *be); +void hw_mod_qsl_free(struct flow_api_backend_s *be); +int hw_mod_qsl_reset(struct flow_api_backend_s *be); +int hw_mod_qsl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_qst_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_qen_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_unmq_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_unmq_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index, + uint32_t value); struct slc_lr_func_s { COMMON_FUNC_INFO_S; @@ -721,6 +757,7 @@ struct flow_api_backend_s { struct km_func_s km; struct flm_func_s flm; struct hsh_func_s hsh; + struct qsl_func_s qsl; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 18aafc57f0..02981ef987 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -53,6 +53,7 @@ sources = files( 'nthw/flow_api/hw_mod/hw_mod_flm.c', 'nthw/flow_api/hw_mod/hw_mod_hsh.c', 'nthw/flow_api/hw_mod/hw_mod_km.c', + 'nthw/flow_api/hw_mod/hw_mod_qsl.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index b43c8fef1a..5d6571310c 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -144,6 +144,14 @@ int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) /* delete all created flows from this device */ pthread_mutex_lock(&ndev->mtx); + /* + * remove unmatched queue if setup in QSL + * remove exception queue setting in QSL UNM + */ + hw_mod_qsl_unmq_set(&ndev->be, HW_QSL_UNMQ_DEST_QUEUE, eth_dev->port, 0); + hw_mod_qsl_unmq_set(&ndev->be, HW_QSL_UNMQ_EN, eth_dev->port, 0); + hw_mod_qsl_unmq_flush(&ndev->be, eth_dev->port, 1); + #ifdef FLOW_DEBUG ndev->be.iface->set_debug_mode(ndev->be.be_dev, FLOW_BACKEND_DEBUG_MODE_NONE); #endif @@ -293,6 +301,12 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_HSH_RCP, ndev->be.hsh.nb_rcp)) goto err_exit; + if (init_resource_elements(ndev, RES_QSL_RCP, ndev->be.qsl.nb_rcp_categories)) + goto err_exit; + + if (init_resource_elements(ndev, RES_QSL_QST, ndev->be.qsl.nb_qst_entries)) + goto err_exit; + if (init_resource_elements(ndev, RES_SLC_LR_RCP, ndev->be.max_categories)) goto err_exit; diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 3ccc14c4ce..4f16235a67 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -21,6 +21,7 @@ static const struct { { "KM", hw_mod_km_alloc, hw_mod_km_free, hw_mod_km_reset, hw_mod_km_present }, { "FLM", hw_mod_flm_alloc, hw_mod_flm_free, hw_mod_flm_reset, hw_mod_flm_present }, { "HSH", hw_mod_hsh_alloc, hw_mod_hsh_free, hw_mod_hsh_reset, hw_mod_hsh_present }, + { "QSL", hw_mod_qsl_alloc, hw_mod_qsl_free, hw_mod_qsl_reset, hw_mod_qsl_present }, }; #define MOD_COUNT (ARRAY_SIZE(module)) diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c new file mode 100644 index 0000000000..f69717cf84 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c @@ -0,0 +1,170 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "QSL" +#define _VER_ be->qsl.ver + +#define QSL_QEN_ENTRIES 32 +#define QSL_QNMQ_ENTRIES 256 + +bool hw_mod_qsl_present(struct flow_api_backend_s *be) +{ + return be->iface->get_qsl_present(be->be_dev); +} + +int hw_mod_qsl_alloc(struct flow_api_backend_s *be) +{ + int nb; + _VER_ = be->iface->get_qsl_version(be->be_dev); + NT_LOG(DBG, FILTER, "QSL MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + nb = be->iface->get_nb_qsl_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(qsl_categories); + + be->qsl.nb_rcp_categories = (uint32_t)nb; + + nb = be->iface->get_nb_qsl_qst_entries(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(qsl_qst_entries); + + be->qsl.nb_qst_entries = (uint32_t)nb; + + switch (_VER_) { + case 7: + if (!callocate_mod((struct common_func_s *)&be->qsl, 4, &be->qsl.v7.rcp, + be->qsl.nb_rcp_categories, sizeof(struct qsl_v7_rcp_s), + &be->qsl.v7.qst, be->qsl.nb_qst_entries, + sizeof(struct qsl_v7_qst_s), &be->qsl.v7.qen, QSL_QEN_ENTRIES, + sizeof(struct qsl_v7_qen_s), &be->qsl.v7.unmq, QSL_QNMQ_ENTRIES, + sizeof(struct qsl_v7_unmq_s))) + return -1; + + break; + + /* end case 7 */ + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_qsl_free(struct flow_api_backend_s *be) +{ + if (be->qsl.base) { + free(be->qsl.base); + be->qsl.base = NULL; + } +} + +int hw_mod_qsl_reset(struct flow_api_backend_s *be) +{ + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->qsl)); + + NT_LOG(DBG, FILTER, "INIT QSL RCP\n"); + hw_mod_qsl_rcp_flush(be, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT QSL QST\n"); + hw_mod_qsl_qst_flush(be, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT QSL QEN\n"); + hw_mod_qsl_qen_flush(be, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT QSL UNMQ\n"); + be->iface->qsl_unmq_flush(be->be_dev, &be->qsl, 0, 256); + + return 0; +} + +int hw_mod_qsl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->qsl.nb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->qsl.nb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->qsl_rcp_flush(be->be_dev, &be->qsl, start_idx, count); +} + +int hw_mod_qsl_qst_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->qsl.nb_qst_entries; + + if ((unsigned int)(start_idx + count) > be->qsl.nb_qst_entries) + return INDEX_TOO_LARGE; + + return be->iface->qsl_qst_flush(be->be_dev, &be->qsl, start_idx, count); +} + +int hw_mod_qsl_qen_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = QSL_QEN_ENTRIES; + + if ((start_idx + count) > QSL_QEN_ENTRIES) + return INDEX_TOO_LARGE; + + return be->iface->qsl_qen_flush(be->be_dev, &be->qsl, start_idx, count); +} + +int hw_mod_qsl_unmq_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = QSL_QNMQ_ENTRIES; + + if ((start_idx + count) > QSL_QNMQ_ENTRIES) + return INDEX_TOO_LARGE; + + return be->iface->qsl_unmq_flush(be->be_dev, &be->qsl, start_idx, count); +} + +static int hw_mod_qsl_unmq_mod(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index, + uint32_t *value, int get) +{ + if (index >= QSL_QNMQ_ENTRIES) + return INDEX_TOO_LARGE; + + switch (_VER_) { + case 7: + switch (field) { + case HW_QSL_UNMQ_DEST_QUEUE: + GET_SET(be->qsl.v7.unmq[index].dest_queue, value); + break; + + case HW_QSL_UNMQ_EN: + GET_SET(be->qsl.v7.unmq[index].en, value); + break; + + default: + return UNSUP_FIELD; + } + + break; + + /* end case 7 */ + default: + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_qsl_unmq_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index, + uint32_t value) +{ + return hw_mod_qsl_unmq_mod(be, field, index, &value, 0); +} diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index 4317da8094..7eeb210b80 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -1297,6 +1297,60 @@ static nthw_fpga_register_init_s pci_wr_tg_registers[] = { { PCI_WR_TG_TG_WR_RUN, 4, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_wr_tg_tg_wr_run_fields }, }; +static nthw_fpga_field_init_s qsl_qen_ctrl_fields[] = { + { QSL_QEN_CTRL_ADR, 5, 0, 0x0000 }, + { QSL_QEN_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_qen_data_fields[] = { + { QSL_QEN_DATA_EN, 4, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_qst_ctrl_fields[] = { + { QSL_QST_CTRL_ADR, 12, 0, 0x0000 }, + { QSL_QST_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_qst_data_fields[] = { + { QSL_QST_DATA_LRE, 1, 9, 0x0000 }, { QSL_QST_DATA_QEN, 1, 7, 0x0000 }, + { QSL_QST_DATA_QUEUE, 7, 0, 0x0000 }, { QSL_QST_DATA_TCI, 16, 10, 0x0000 }, + { QSL_QST_DATA_TX_PORT, 1, 8, 0x0000 }, { QSL_QST_DATA_VEN, 1, 26, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_rcp_ctrl_fields[] = { + { QSL_RCP_CTRL_ADR, 5, 0, 0x0000 }, + { QSL_RCP_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_rcp_data_fields[] = { + { QSL_RCP_DATA_DISCARD, 1, 0, 0x0000 }, { QSL_RCP_DATA_DROP, 2, 1, 0x0000 }, + { QSL_RCP_DATA_LR, 2, 51, 0x0000 }, { QSL_RCP_DATA_TBL_HI, 12, 15, 0x0000 }, + { QSL_RCP_DATA_TBL_IDX, 12, 27, 0x0000 }, { QSL_RCP_DATA_TBL_LO, 12, 3, 0x0000 }, + { QSL_RCP_DATA_TBL_MSK, 12, 39, 0x0000 }, { QSL_RCP_DATA_TSA, 1, 53, 0x0000 }, + { QSL_RCP_DATA_VLI, 2, 54, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_unmq_ctrl_fields[] = { + { QSL_UNMQ_CTRL_ADR, 1, 0, 0x0000 }, + { QSL_UNMQ_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_unmq_data_fields[] = { + { QSL_UNMQ_DATA_DEST_QUEUE, 7, 0, 0x0000 }, + { QSL_UNMQ_DATA_EN, 1, 7, 0x0000 }, +}; + +static nthw_fpga_register_init_s qsl_registers[] = { + { QSL_QEN_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_qen_ctrl_fields }, + { QSL_QEN_DATA, 5, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, qsl_qen_data_fields }, + { QSL_QST_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_qst_ctrl_fields }, + { QSL_QST_DATA, 3, 27, NTHW_FPGA_REG_TYPE_WO, 0, 6, qsl_qst_data_fields }, + { QSL_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_rcp_ctrl_fields }, + { QSL_RCP_DATA, 1, 56, NTHW_FPGA_REG_TYPE_WO, 0, 9, qsl_rcp_data_fields }, + { QSL_UNMQ_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_unmq_ctrl_fields }, + { QSL_UNMQ_DATA, 7, 8, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_unmq_data_fields }, +}; + static nthw_fpga_field_init_s rac_dbg_ctrl_fields[] = { { RAC_DBG_CTRL_C, 32, 0, 0x0000 }, }; @@ -1456,6 +1510,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { MOD_PCI_WR_TG, 0, MOD_PCI_WR_TG, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 2304, 7, pci_wr_tg_registers }, + { MOD_QSL, 0, MOD_QSL, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 1792, 8, qsl_registers }, { MOD_RAC, 0, MOD_RAC, 3, 0, NTHW_FPGA_BUS_TYPE_PCI, 8192, 14, rac_registers }, { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, }; @@ -1617,5 +1672,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 18, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 19, fpga_modules, }; -- 2.45.0