From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C5FFB45501;
	Wed, 26 Jun 2024 21:56:03 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id B973B402DE;
	Wed, 26 Jun 2024 21:56:03 +0200 (CEST)
Received: from egress-ip11a.ess.de.barracuda.com
 (egress-ip11a.ess.de.barracuda.com [18.184.203.234])
 by mails.dpdk.org (Postfix) with ESMTP id C80C24026E
 for <dev@dpdk.org>; Wed, 26 Jun 2024 21:56:00 +0200 (CEST)
Received: from EUR03-AM7-obe.outbound.protection.outlook.com
 (mail-am7eur03lp2232.outbound.protection.outlook.com [104.47.51.232]) by
 mx-outbound14-103.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2
 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Wed, 26 Jun 2024 19:55:59 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Ez5Ro34VKMwJtQmJZyVDjEEE0fEFLfxBkFxhhpHKwk6NH91bkc0Nb/1Wgj14630fT63cPofCJQbacShWwcVs1kUaQL2DKF25JBJ0xHc89wuuoF7F/sM3AHtpzOXz/KgvcnDcOS48n7mHqLIAMeY1N/Cq/zUv7294pr8OsP6nJZv3EJLcR3H/ld1YCkk9xaBg5ZwCsQB0xJIVU3ES/SZFmFr6bIIEXvopBaD+t3I0P1NKl5Cfrc1+tlP2aP2aCytTepfctntCh7G25IkHpIeSqc1+4xNEZJZHaauXzklik9UbjJew6J4FYje28+0iwwv1NZ/XlXN6g/RpCljNHKoGVg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=ThSrVmhBwsxLGmvwxsgv9y4dm0nmf3KA6noYAhnGXoE=;
 b=lz5uHbrYfducJnXYkV/2rKloX75pVJFWtcWQzi1I6UkcdSUubCjwhbcbIxwJz4RyhwRzbyRNWaRxdkqwhHjsJfgei7u0h/8+Hhprt/uNkJKdeECd7K2AqFqF5gdkfPZfTs8MLKsIRoiFw23JMWEnXnRcEDK3P4YQL04r/fuVjr0BLrpEkhckPTYFFCHguzl8ioc8hM5jgmYu3DV2ZCbPdDF3iNw+6UfMb3zqwcflzNM+r6iTG9MT3DsEOlLR3Cw5GKBkrJjAHuuPNg+9fCX5+LUNwMBOpWYVO6ars8iTjJTlRwVSUjNI+rRdfhLV0+2xt7CAi26XDPbxCMfNEg625Q==
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=ThSrVmhBwsxLGmvwxsgv9y4dm0nmf3KA6noYAhnGXoE=;
 b=FynLgEB/uO2kGQFu+weG48cTRHkq+Ta2cPECCucuU+vh5lX6j8UbJBxJcAgOCIoctqFYye+yDphkSrTxZnVWmThpH3sGDTJQ1xPbJU4AQeWnLvC7+UUSvN7yIsDlhaepixvOJtXdCqsDXFKS6pC2U7PdIThsF4v6J0Upqu0FyIg=
Received: from AS4P250CA0018.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5e3::13)
 by PA2P190MB2131.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:424::10)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Wed, 26 Jun
 2024 19:55:58 +0000
Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com
 (2603:10a6:20b:5e3:cafe::dd) by AS4P250CA0018.outlook.office365.com
 (2603:10a6:20b:5e3::13) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.25 via Frontend
 Transport; Wed, 26 Jun 2024 19:55:58 +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
 AMS0EPF000001AC.mail.protection.outlook.com (10.167.16.152) with Microsoft
 SMTP Server id 15.20.7677.15 via Frontend Transport; Wed, 26 Jun 2024
 19:55:57 +0000
From: Serhii Iliushyk <sil-plv@napatech.com>
To: dev@dpdk.org
Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com,
 andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com,
 Thomas Monjalon <thomas@monjalon.net>
Subject: [PATCH v4 01/23] net/ntnic: add ethdev and makes PMD available
Date: Wed, 26 Jun 2024 21:55:11 +0200
Message-ID: <20240626195545.1793419-1-sil-plv@napatech.com>
X-Mailer: git-send-email 2.45.0
In-Reply-To: <20240530144929.4127931-1-sil-plv@napatech.com>
References: <20240530144929.4127931-1-sil-plv@napatech.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AMS0EPF000001AC:EE_|PA2P190MB2131:EE_
Content-Type: text/plain
X-MS-Office365-Filtering-Correlation-Id: e7dac375-673b-4080-a3bb-08dc9619ff04
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
 ARA:13230038|82310400024|376012|1800799022|36860700011; 
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jL5DIgVV06e4K2MpQZHfDd5gmTDbVgGKJBklbxFo7+YGX8otSEEZWUzOp8jk?=
 =?us-ascii?Q?YQDgeE4kxbnL0iB2O9DJsTdbElJvubZl52ee55LLA6S+mT83CP2ykryBIuu6?=
 =?us-ascii?Q?KZZuK6ja5YNOBeMPOhGW6a7DREfkylbP8PpepbOqSlq0UCc9mjnJ/x5GMiyO?=
 =?us-ascii?Q?4jpHNy9m3DzjjS7b6uIBVf+MLsMJh1R8SvoTsTi+vySm0AMqbeBQD5xGHn6h?=
 =?us-ascii?Q?MO+/SxHbilCKxxJf3eC5tBIJ2uIl4ZnUhMnPtswBE5zmHaKY/IVFopKv1dKS?=
 =?us-ascii?Q?uff4TXm4t8WyvIpV8OFR0iBftsyu7lbPZIa78jJ0ilASWGsZFWGSNPXlE2mI?=
 =?us-ascii?Q?My6n/PgbSBA7y3VGjMTyeh+v6jbH7rm/cJf4uo50wxUG6kRs1NvG6SSL+Sgt?=
 =?us-ascii?Q?mLegDJxklZZjJDCYnsy/Xy3F4Ojqop1Xj7xZF4pT5X1lmrUraZAmn9Jq7zzG?=
 =?us-ascii?Q?tRYiWnAo+z7g0IoEg9Rm7blDS7FS5gsI7kOlOQUsTblehAy/5h1X4aK4Qf37?=
 =?us-ascii?Q?YICx4S5SV1NlQGogfiSCbYGH5sLr+GciAjeD462xRwjR+J6c8SgtWsBAtyPu?=
 =?us-ascii?Q?nNYPHA7NYfLb/qgqSdqK/khPwfC2ohVqO3q9C46nfrCZEgmbsUNk3yzcqd/i?=
 =?us-ascii?Q?pkG2tuayPp9JLL3W6FdOEXspeCaxJBudiwXi4WQhFVAzRaN2BSyEeLamkmWg?=
 =?us-ascii?Q?GZ8fWYESPjrAV7WnhOs6rjKxx5D+t1hJOixHXag1RUL0ba2TdEXhs1JFWZ7A?=
 =?us-ascii?Q?K/KXfT0iUVoigxhrDh9gwsvWkhYYeRUJqWHspPYK3/XIN9FggfrDLeHyf5y6?=
 =?us-ascii?Q?A8b5eLqFnr2m1y6IPg2FZ+dBdbQ5g4vOcEbdFW3NWhJ8mHw8aoTNntoRogPs?=
 =?us-ascii?Q?8Hy53r4V2DX9uO9FMEj/qhacxvC00512EroVaqUgIYvn6sjglKeWrgmFSIRf?=
 =?us-ascii?Q?Auopc8jqIkKRzErK8lg9I4cvE3CTt5jcKFIahtB6nqrmgpiqw4z0Pkm3p7fv?=
 =?us-ascii?Q?B2K5P4yyHRZ+3UOrxtKvf4fNcNPTMDucr1xiuN/iQCAj53vTnoXHRbQmJVkX?=
 =?us-ascii?Q?EKJJ4nBX0KZwtmFHqC/1CQw+IyENigwjr5+wVbGPrpAPz3i2yI28IqyncGLg?=
 =?us-ascii?Q?SebYGY+uV/GPftw5A5FMqnLvLC+//jH0wTDHcRG4BS8YTM/q5uVtYDb74GOJ?=
 =?us-ascii?Q?h1xZ9Lfdu4U9PNT+4VWsTRRecPdK8SkQYO3CK6G0ESEPXa6udTzNKmmgeA42?=
 =?us-ascii?Q?wfkgtUXA+F9rWJFihGCw8Ceiz0FyHeKHClii6NHP5vcMpJm39kOuZJDyipFW?=
 =?us-ascii?Q?hElWIqKC1EMQ/4fY27Epo45BcLeIx8ZvWOYOixo04afz1ogxA0rb0TOJA+e6?=
 =?us-ascii?Q?iC93TKzssV5j/Qk8xBAY05S6F8kSKxki+Pgn6Sg3x/pb/uITEQ6obsHDI7dp?=
 =?us-ascii?Q?N57wAzC83MzgP+EbG3ZUWs76I1oWnvAD?=
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:(13230038)(82310400024)(376012)(1800799022)(36860700011);
 DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: esruIiJka7XWl21hj7Lz66FSOvDhCNTNaHwnqRoS5bCFZ03wNRfT3MEfgs1OOEvmbr3KUP9FhEta0CkPArb6j1YbnExsFgv1m/dbJ5wn821QQbVRSIPJuho+9G5XrzKOihTvZVrqr9NcPkeEa/OT9LTwWWaX1PEhDCvV7gXJ2mq0y9qdXIZCTAkAZDRoRPFM9htRdyusFyHM+z1oGx/jnmYGcSRWBDSK1DybzHr1JEF+GxUy6fqxzcLASlklZ52TrCnYUeyTuN2en3B0J1/x8y/o1cr7VKdAfC/5nuTlO0+bBsNy/wB3KuBzNdVF7B/Jn6NJ3TwSaBCAlw+/MZ9R5ij9To/iwLm2CDO3zMH4VFO98u6fp3magC6NoKsZaShs/92OgebgQznd+O4HkhGmxrRvWgVKrTq3LCMYNACUVE6r/Z4J8LW//HFuyElrI2Cc39MlxgcHo2lGOoZ27R3dNbHXEcjz0pfsKm2D58v0S3jh9n/cbgdPqHRetgd0c6HINdFT5MsaN3EsWXaUvwj37MtW37MZRCkHQYiA6Un6uDvrJ6aCrbLtui2XzMVt8vIKxootlC9Jp6acVVV3WHGkZXPRXVlbxqu3MFTxeS9MywzFoHf6TIe0zc4Eu98cA5SbbyHwXD/NCLzYmS3LVZcbnw==
X-OriginatorOrg: napatech.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 19:55:57.4735 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: e7dac375-673b-4080-a3bb-08dc9619ff04
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: AMS0EPF000001AC.eurprd05.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2P190MB2131
X-BESS-ID: 1719431759-303687-6283-56852-1
X-BESS-VER: 2019.1_20240620.2317
X-BESS-Apparent-Source-IP: 104.47.51.232
X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqaWxpZAVgZQ0MgyKc3YwjgtJd
 XM0iQl2cI0LS0pxTTVMtnCwtgk0SJRqTYWAG1auhZBAAAA
X-BESS-Outbound-Spam-Score: 0.00
X-BESS-Outbound-Spam-Report: Code version 3.2,
 rules version 3.2.2.257218 [from 
 cloudscan13-102.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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Add ntnic ethdev base  implementation

Signed-off-by: Serhii Iliushyk <sil-plv@napatech.com>
---
 .mailmap                           |  1 +
 MAINTAINERS                        |  7 ++++
 doc/guides/nics/features/ntnic.ini |  9 +++++
 doc/guides/nics/index.rst          |  1 +
 doc/guides/nics/ntnic.rst          | 43 ++++++++++++++++++++++++
 drivers/net/meson.build            |  1 +
 drivers/net/ntnic/meson.build      | 24 ++++++++++++++
 drivers/net/ntnic/ntnic_ethdev.c   | 53 ++++++++++++++++++++++++++++++
 8 files changed, 139 insertions(+)
 create mode 100644 doc/guides/nics/features/ntnic.ini
 create mode 100644 doc/guides/nics/ntnic.rst
 create mode 100644 drivers/net/ntnic/meson.build
 create mode 100644 drivers/net/ntnic/ntnic_ethdev.c

diff --git a/.mailmap b/.mailmap
index 6b396107d0..42c4d1473d 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1289,6 +1289,7 @@ Sergey Madaminov <sergey.madaminov@gmail.com>
 Sergey Mironov <grrwlf@gmail.com>
 Sergey Temerkhanov <sergey.temerkhanov@intel.com>
 Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
+Serhii Iliushyk <sil-plv@napatech.com>
 Seth Arnold <seth.arnold@canonical.com>
 Seth Howell <seth.howell@intel.com>
 Shachar Beiser <shacharbe@mellanox.com>
diff --git a/MAINTAINERS b/MAINTAINERS
index c9adff9846..d640ff88b5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -857,6 +857,13 @@ F: drivers/net/octeon_ep/
 F: doc/guides/nics/features/octeon_ep.ini
 F: doc/guides/nics/octeon_ep.rst
 
+Napatech ntnic
+M: Christian Koue Muf <ckm@napatech.com>
+M: Serhii Iliushyk <sil-plv@napatech.com>
+F: drivers/net/ntnic/
+F: doc/guides/nics/ntnic.rst
+F: doc/guides/nics/features/ntnic.ini
+
 NVIDIA mlx4
 M: Matan Azrad <matan@nvidia.com>
 M: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini
new file mode 100644
index 0000000000..25abc6df89
--- /dev/null
+++ b/doc/guides/nics/features/ntnic.ini
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'ntnic' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Link status          = Y
+Linux                = Y
+x86-64               = Y
diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 7bfcac880f..c14bc7988a 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -53,6 +53,7 @@ Network Interface Controller Drivers
     nfb
     nfp
     ngbe
+    ntnic
     null
     octeon_ep
     octeontx
diff --git a/doc/guides/nics/ntnic.rst b/doc/guides/nics/ntnic.rst
new file mode 100644
index 0000000000..68996eac35
--- /dev/null
+++ b/doc/guides/nics/ntnic.rst
@@ -0,0 +1,43 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2023 Napatech A/S
+
+NTNIC Poll Mode Driver
+======================
+
+The NTNIC PMD provides poll mode driver support for Napatech smartNICs.
+
+
+Design
+------
+
+The NTNIC PMD is designed as a pure user-space driver, and requires no special
+Napatech kernel modules.
+
+The Napatech smartNIC presents one control PCI device (PF0). NTNIC PMD accesses
+smartNIC PF0 via vfio-pci kernel driver. Access to PF0 for all purposes is
+exclusive, so only one process should access it. The physical ports are located
+behind PF0 as DPDK port 0 and 1.
+
+
+Supported NICs
+--------------
+
+- NT200A02 2x100G SmartNIC
+
+    - FPGA ID 9563 (Inline Flow Management)
+
+
+Features
+--------
+
+- Link state information.
+
+
+Limitations
+~~~~~~~~~~~
+
+Kernel versions before 5.7 are not supported. Kernel version 5.7 added vfio-pci
+support for creating VFs from the PF which is required for the PMD to use
+vfio-pci on the PF. This support has been back-ported to older Linux
+distributions and they are also supported. If vfio-pci is not required kernel
+version 4.18 is supported.
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index bd38b533c5..fb6d34b782 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -45,6 +45,7 @@ drivers = [
         'nfb',
         'nfp',
         'ngbe',
+        'ntnic',
         'null',
         'octeontx',
         'octeon_ep',
diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build
new file mode 100644
index 0000000000..227949eacb
--- /dev/null
+++ b/drivers/net/ntnic/meson.build
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2020-2023 Napatech A/S
+
+if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64')
+    build = false
+    reason = 'only supported on x86_64 Linux'
+    subdir_done()
+endif
+
+# cflags
+cflags += [
+    '-std=c11',
+]
+
+# includes
+includes = [
+    include_directories('.'),
+]
+
+# all sources
+sources = files(
+    'ntnic_ethdev.c',
+)
+# END
diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c
new file mode 100644
index 0000000000..9cc727ac4b
--- /dev/null
+++ b/drivers/net/ntnic/ntnic_ethdev.c
@@ -0,0 +1,53 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+
+#include <rte_kvargs.h>
+#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_vfio.h>
+#include <rte_ethdev.h>
+#include <rte_bus_pci.h>
+#include <ethdev_pci.h>
+
+/* Global static variables: */
+
+static int
+nthw_pci_dev_init(struct rte_pci_device *pci_dev __rte_unused)
+{
+	return 0;
+}
+
+static int
+nthw_pci_dev_deinit(struct rte_eth_dev *eth_dev __rte_unused)
+{
+	return 0;
+}
+
+static int
+nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	struct rte_pci_device *pci_dev)
+{
+	int res;
+	res = nthw_pci_dev_init(pci_dev);
+	return res;
+}
+
+static int
+nthw_pci_remove(struct rte_pci_device *pci_dev)
+{
+	return rte_eth_dev_pci_generic_remove(pci_dev, nthw_pci_dev_deinit);
+}
+
+static struct rte_pci_driver rte_nthw_pmd = {
+	.driver = {
+		.name = "net_ntnic",
+	},
+
+	.probe = nthw_pci_probe,
+	.remove = nthw_pci_remove,
+};
+
+RTE_PMD_REGISTER_PCI(net_ntnic, rte_nthw_pmd);
-- 
2.45.0