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 18A40A0C4B; Thu, 21 Oct 2021 07:24:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4CAC410E2; Thu, 21 Oct 2021 07:24:16 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80082.outbound.protection.outlook.com [40.107.8.82]) by mails.dpdk.org (Postfix) with ESMTP id 48DAB40142 for ; Thu, 21 Oct 2021 07:24:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WuBvMbUZc+tPe//9Q+75asHR87u3Eww4+EDdZQL7q+6s5P2FsbB7Dv+4GFS1aS4ToI+sDQY72kNfwQ11rRWFJIxdvEmyZm0R0mS+YPL4i+Kz9rnWEva41QflOgD/mjc8+qgXPjmxuXdsOdjlcGU08IumD+DReVZ6gUoq0S3zSQ+fvcOJP/X7D7JowrXjxe9Ql5RmfeZQTG2ezZNMDnnIbW7HBueUqbmdtm5ZU7sEFDVngN80DD8Nf9WE4jafG+slvKKMJBy2pwunHckASCOQSKq2Uo7QFgkriqdb6uB7JUp4F0MMxVsKGUmAELdVn0E7UyACWneAbLMUsaMWUnOkIQ== 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=iSnv/54jtwYod1YsL5udsqXN52eHFA0xY7I+r/c3lDY=; b=FsID74eU7HhAx/eAie3uQKFJvk6yO3MklP9ArYRMfhzPKQb2bp20OeBJzcWsYGeAfivQPTPHAODpYaxToHa8o4Jz0eIJvI8qeqSmQTRe0yzMWrYetgZlO0ZQTbnxQGnFYxvZjGuEDJq4T+6YDOULkuLy+oYhq5yF62irzh4ILX0HRvnnM9Tx2p21Awek29rcWIhG5tJ5N4DwJhaNBRB77DLLsIoIcb8AY4bbP5bwkUozmJa1sh+BCbAr6FKTcB7UL3Cy1nVOsFSdFnuAdgTjUVFL5xpslZxrhP6eqBoDMFLV2se6cGrsjQtnUmC5j+78+OacJRrxnAKn0Dpw0Lv8gQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iSnv/54jtwYod1YsL5udsqXN52eHFA0xY7I+r/c3lDY=; b=NlFeKhu28HAMw8Mcuu0xMKcQb/tdzvKDieAgWNzqMEK5NkFc0TG0OyfQUc+TxVXKJrWh0UyPRAZXfLUMF8yNRCiv2o0BcSMeZLrYmBtWWM9n8jQj5K+PorISisRONwadUpKfo2zrZbDYmbNIdeTajl5h19q1qata3XxutNSnJPs= Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8918.eurprd04.prod.outlook.com (2603:10a6:10:2e1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Thu, 21 Oct 2021 05:24:14 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80%3]) with mapi id 15.20.4608.020; Thu, 21 Oct 2021 05:24:14 +0000 From: Hemant Agrawal To: Apeksha Gupta , "david.marchand@redhat.com" , "andrew.rybchenko@oktetlabs.ru" , "ferruh.yigit@intel.com" CC: "dev@dpdk.org" , Sachin Saxena , Apeksha Gupta Thread-Topic: [PATCH v6 1/5] net/enetfec: introduce NXP ENETFEC driver Thread-Index: AQHXxja0xU/YKdcaDkqme4S8Zs1pk6vc60ww Date: Thu, 21 Oct 2021 05:24:13 +0000 Message-ID: References: <20211019184003.23128-2-apeksha.gupta@nxp.com> <20211021044700.12370-1-apeksha.gupta@nxp.com> <20211021044700.12370-2-apeksha.gupta@nxp.com> In-Reply-To: <20211021044700.12370-2-apeksha.gupta@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 446cede0-8591-41ae-5664-08d99453053d x-ms-traffictypediagnostic: DU2PR04MB8918: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:989; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /zbxmOeoqHFi0YB4wr+W8VkAkgK9gm5V/uFx+ReKBOSq8PyeRdSN18XlM4Js7C2bxTwAwiAu9pnhbD1XeQIoASPqGsR9MBhAeoxAl8ic6XnKdxWZwHhVphLOWqKyJdUvng3D04pNbfr9RjcZlG2PSnIs7PcHhPI/0apzjOfvXj04j5wc/LrN9Hyw4e7QCaF3HC2isAnJqjK6ezJlg/tWaj6lQRWqnLj1Nw4QA4QAhokHvQ3hWywWkZbZV9fAPEKRmeQ5ZIVTUOmTi+ChliweJPMhakTLZ6/JLRxSZVv09V3jti8a3N6XJCCtbFE5xECNJcAmrLX5DRBgTnn87K5XMsABC6TTJhtD7zrECh2qNAVBofyxbc7Q5sVymTWYSp2ZCplwrYmVtIOStajnz7ja9zJwt0qfgmNiRWhLTY0X7/FMTZdMwutjLzIUtnL87h4uZ2EApxWZk+DGkbWQeqYs6kfXTFocST3EUwhni8c6etc/F8W6SpmHGbTyz7krCTxpMyDqxNM3n+fgg9IC4x5g2Y6cO4+fY/eGlppAMst9fVgccxl9gfJ+5vumMzA1HY/403YJdbqAOnh3iUzljjiCp1yjLiAepV6BhWhb3/LlYpeCXae1Unbit4O4kDL0+ipideqgjGILhPweZr1ugquuJHnFVAM8Pt8YQQamG7p8p3HrWS4rV3DD5WqiiRc7oEZa7mgkcFjMoKfxbFZqGErxtxWrGg7R4CKTu3n55p9SoXhTxBOGuVw5XlIyr8noAM8yqtr0aLFYLmSeSVXNvtd1pf24rOK/Y8SFT1HISHOoVxWAkRMzfNGI8s1vEaat5MEghYxaC0twtoSBKkA2O4kIXQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(76116006)(8936002)(508600001)(38100700002)(122000001)(316002)(55016002)(26005)(66946007)(9686003)(2906002)(54906003)(44832011)(186003)(71200400001)(33656002)(66446008)(8676002)(66476007)(64756008)(110136005)(7696005)(30864003)(38070700005)(66556008)(5660300002)(53546011)(6506007)(52536014)(83380400001)(86362001)(55236004)(4326008)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?W8OLgxRVbJPjXUKDtYHAUpGrlnFYaVuXoahhQhS2R8mt6l+JyKcY/wtrr5Hb?= =?us-ascii?Q?eKb/fiGVMUzrDxGCaXrIq0vflvRVUUqewHcA7fuDkt3zLyQ+zn23Po7/PJeg?= =?us-ascii?Q?Ar9GNGLjB/GQXJkIsSanWUv6wrAD5rO3uJoNtjF6e5CDWUhamjlJxcykCzao?= =?us-ascii?Q?TYVfLcosGwszWPehho+gXDynSx0HZT+bDmjJrXzPP9bfqQDDYV27eP5WbLB1?= =?us-ascii?Q?wBAu68zgom46NCa5Ob7Y3jjAG8Qwm0zpUYkn8v3kkbnYl0PDWcZPSvK3uyCE?= =?us-ascii?Q?kCfomTtZW/3/t04owmaa9lRPjeI39mlc8N1xK8/QyrJx29PH46gLmgiHVqoE?= =?us-ascii?Q?iTrSc6SWT7nKTFw3P5xNkuodqolT1kKywmIiZ7WkV8uFwTcEwk9fieeQB/51?= =?us-ascii?Q?JhcMkt2ECWj+KiloaLFaEUuQmEdZirnJ1vXWS4BuC+Ijg6AB+Lc+afmK4eeG?= =?us-ascii?Q?o1Xy9cAuyyN6079P/+3/DtxwCP6xYWjpIqkxhwia9EOxEophLyZIqQawTmGY?= =?us-ascii?Q?gLCpZs6O/hAVUqttcWOgxvO00FxhueGlCn34biPKrTXob2alH1LagISvjB00?= =?us-ascii?Q?ciAJQp/9H1wfJ+yp07swWmpcCxpI51Yw5HuYnzxJZfZMbjx8z63HcD4Yw4Uq?= =?us-ascii?Q?49quS9jt5hLY2p2TPVOouXwcGbZ5pjH2IqOfR8Ne3qIOYAVJYiEUG5hAVcGs?= =?us-ascii?Q?rvx5wdxe4AiriXxtxSZvxx9YATnixSHkUME+OcdkkrlPuuKCHPe9OuTxGA10?= =?us-ascii?Q?BcwamgouhY8CEVxI1a0Nr+JDpP+fRvXPj7vDEdmcwW5wp8DCwfDmNWz4BwBc?= =?us-ascii?Q?ZpPLjmE1f/aJazKXnuIW5VFPduz4B38uQbN1XgjGvOvLEvZv7XNZmQAyFVRc?= =?us-ascii?Q?uuGVsjpv6gqqC3U2fTe47h0PWupEj0mlTW3xPD7ptMMzQKDF9B4GrLd2YG6s?= =?us-ascii?Q?OyzVA5IIgxxlODGvX5aYK9ZVdb2K646Y60en3KLW1eII154SqSjsF1ALIVvh?= =?us-ascii?Q?XqADNheQUAw11WTDd8e6C89Kv8uKEXPBaVh24XgCKLjFWZzvYBXnjXwJNghR?= =?us-ascii?Q?DTvFiz/dN+WLmHoJdRDNapsrKt4W3UNECmljckcGFMmmTMZLk2ff7FnhV/Lo?= =?us-ascii?Q?pOZNl1wdYEQyPuamA5Zto5jYwFA/Z7/qiMa27xbdNmyUCVG+UMW2L0sF6FBQ?= =?us-ascii?Q?Sn33sTpKEtsoKcwDFppLZ0y/LHhHrjiblvQDPH6OOgNg29DHlYB73b7D5nKD?= =?us-ascii?Q?k33ldJTE3btY5B0rTwmHS+bKLVa032UueBmgpTSIRqFvXri/i4omXggp29Mj?= =?us-ascii?Q?xWLjwivOGt3/YQGE65kU7sP5DWCkiLjh6yxQd5V00iuQQtVYRVRslZAeURno?= =?us-ascii?Q?q+9+93TLXxZS2oeqa4MTGIg54KpLgHIBHdvdyWvPtXCaVvO8wp96TgbbYMq1?= =?us-ascii?Q?D5Js4XgwzD0=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 446cede0-8591-41ae-5664-08d99453053d X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2021 05:24:13.9513 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hemant.agrawal@nxp.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8918 Subject: Re: [dpdk-dev] [PATCH v6 1/5] net/enetfec: introduce NXP ENETFEC driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Series- Acked-by: Hemant Agrawal > -----Original Message----- > From: Apeksha Gupta > Sent: Thursday, October 21, 2021 10:17 AM > To: david.marchand@redhat.com; andrew.rybchenko@oktetlabs.ru; > ferruh.yigit@intel.com > Cc: dev@dpdk.org; Sachin Saxena ; Hemant > Agrawal ; Apeksha Gupta > > Subject: [PATCH v6 1/5] net/enetfec: introduce NXP ENETFEC driver > Importance: High >=20 > ENETFEC (Fast Ethernet Controller) is a network poll mode driver for NXP = SoC > i.MX 8M Mini. >=20 > This patch adds skeleton for enetfec driver with probe function. >=20 > Signed-off-by: Sachin Saxena > Signed-off-by: Apeksha Gupta > --- >=20 > v6: > - Fix document build errors > --- > --- > MAINTAINERS | 7 + > doc/guides/nics/enetfec.rst | 131 ++++++++++++++++++ > doc/guides/nics/features/enetfec.ini | 9 ++ > doc/guides/nics/index.rst | 1 + > doc/guides/rel_notes/release_21_11.rst | 4 + > drivers/net/enetfec/enet_ethdev.c | 85 ++++++++++++ > drivers/net/enetfec/enet_ethdev.h | 179 +++++++++++++++++++++++++ > drivers/net/enetfec/enet_pmd_logs.h | 31 +++++ > drivers/net/enetfec/meson.build | 11 ++ > drivers/net/enetfec/version.map | 3 + > drivers/net/meson.build | 1 + > 11 files changed, 462 insertions(+) > create mode 100644 doc/guides/nics/enetfec.rst create mode 100644 > doc/guides/nics/features/enetfec.ini > create mode 100644 drivers/net/enetfec/enet_ethdev.c create mode > 100644 drivers/net/enetfec/enet_ethdev.h create mode 100644 > drivers/net/enetfec/enet_pmd_logs.h > create mode 100644 drivers/net/enetfec/meson.build create mode 100644 > drivers/net/enetfec/version.map >=20 > diff --git a/MAINTAINERS b/MAINTAINERS > index 8dceb6c0e0..db2df484d0 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -876,6 +876,13 @@ F: drivers/net/enetc/ > F: doc/guides/nics/enetc.rst > F: doc/guides/nics/features/enetc.ini >=20 > +NXP enetfec > +M: Apeksha Gupta > +M: Sachin Saxena > +F: drivers/net/enetfec/ > +F: doc/guides/nics/enetfec.rst > +F: doc/guides/nics/features/enetfec.ini > + > NXP pfe > M: Gagandeep Singh > F: doc/guides/nics/pfe.rst > diff --git a/doc/guides/nics/enetfec.rst b/doc/guides/nics/enetfec.rst ne= w > file mode 100644 index 0000000000..dfcd032098 > --- /dev/null > +++ b/doc/guides/nics/enetfec.rst > @@ -0,0 +1,131 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright 2021 NXP > + > +ENETFEC Poll Mode Driver > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +The ENETFEC NIC PMD (**librte_net_enetfec**) provides poll mode driver > +support for the inbuilt NIC found in the ** NXP i.MX 8M Mini** SoC. > + > +More information can be found at NXP Official Website > + w. > +nxp.com%2Fproducts%2Fprocessors-and-microcontrollers%2Farm- > processors%2 > +Fi-mx-applications-processors%2Fi-mx-8-processors%2Fi-mx-8m-mini-arm- > co > +rtex-a53-cortex-m4-audio-voice- > video%3Ai.MX8MMINI&data=3D04%7C01%7Che > +mant.agrawal%40nxp.com%7C26a60f13113a49b78f4608d9944dd6ef%7C68 > 6ea1d3bc2 > +b4c6fa92cd99c5c301635%7C0%7C1%7C637703884297668393%7CUnknow > n%7CTWFpbGZs > +b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M > n0%3D% > +7C1000&sdata=3DzF5Z6DynoGsXwMRUvHW47564qG9zB0VcNnTJ%2B4H > Pq9w%3D&r > +eserved=3D0> > + > +ENETFEC > +------- > + > +This section provides an overview of the NXP ENETFEC and how it is > +integrated into the DPDK. > + > +Contents summary > + > +- ENETFEC overview > +- ENETFEC features > +- Supported ENETFEC SoCs > +- Prerequisites > +- Driver compilation and testing > +- Limitations > + > +ENETFEC Overview > +~~~~~~~~~~~~~~~~ > +The i.MX 8M Mini Media Applications Processor is built to achieve both > +high performance and low power consumption. ENETFEC PMD is a > hardware > +programmable packet forwarding engine to provide high performance > +Ethernet interface. It has only 1 GB Ethernet interface with RJ45 > +connector. > + > +The diagram below shows a system level overview of ENETFEC: > + > + .. code-block:: console > + > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > + Userspace > + +-----------------------------------------+ > + | ENETFEC Driver | > + | +-------------------------+ | > + | | virtual ethernet device | | > + +-----------------------------------------+ > + ^ | > + | | > + | | > + RXQ | | TXQ > + | | > + | v > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > + Kernel Space > + +---------+ > + | fec-uio | > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D= =3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > + Hardware > + +-----------------------------------------+ > + | i.MX 8M MINI EVK | > + | +-----+ | > + | | MAC | | > + +---------------+-----+-------------------+ > + | PHY | > + +-----+ > + > +ENETFEC Ethernet driver is traditional DPDK PMD driver running in the > +userspace.'fec-uio' is the kernel driver. The MAC and PHY are the > +hardware blocks. ENETFEC PMD uses standard UIO interface to access > +kernel for PHY initialisation and for mapping the allocated memory of > +register & buffer descriptor with DPDK which gives access to > +non-cacheable memory for buffer descriptor. net_enetfec is logical > +Ethernet interface, created by ENETFEC driver. > + > +- ENETFEC driver registers the device in virtual device driver. > +- RTE framework scans and will invoke the probe function of ENETFEC driv= er. > +- The probe function will set the basic device registers and also setups= BD > rings. > +- On packet Rx the respective BD Ring status bit is set which is then > +used for > + packet processing. > +- Then Tx is done first followed by Rx via logical interfaces. > + > +ENETFEC Features > +~~~~~~~~~~~~~~~~~ > + > +- Linux > +- ARMv8 > + > +Supported ENETFEC SoCs > +~~~~~~~~~~~~~~~~~~~~~~ > + > +- i.MX 8M Mini > + > +Prerequisites > +~~~~~~~~~~~~~ > + > +There are three main pre-requisites for executing ENETFEC PMD on a i.MX > +8M Mini compatible board: > + > +1. **ARM 64 Tool Chain** > + > + For example, the `*aarch64* Linaro Toolchain > ases.linaro.org%2Fcomponents%2Ftoolchain%2Fbinaries%2F7.4- > 2019.02%2Faarch64-linux-gnu%2Fgcc-linaro-7.4.1-2019.02-x86_64_aarch64- > linux- > gnu.tar.xz&data=3D04%7C01%7Chemant.agrawal%40nxp.com%7C26a60f1 > 3113a49b78f4608d9944dd6ef%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C > 0%7C1%7C637703884297678352%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi > MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C10 > 00&sdata=3D71GHiCjpjQLW3fUkSbJM%2BlkEzmclax2ULh3pW6%2Bn%2Bb > o%3D&reserved=3D0>`_. > + > +2. **Linux Kernel** > + > + It can be obtained from `NXP's Github hosting > ce.codeaurora.org%2Fexternal%2Fqoriq%2Fqoriq- > components%2Flinux&data=3D04%7C01%7Chemant.agrawal%40nxp.com > %7C26a60f13113a49b78f4608d9944dd6ef%7C686ea1d3bc2b4c6fa92cd99c5 > c301635%7C0%7C1%7C637703884297678352%7CUnknown%7CTWFpbGZsb > 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0 > %3D%7C1000&sdata=3Dcad2L9dOaiH3WBn1NavBuWl4HqSsSdRo0Hi2DRC > COjg%3D&reserved=3D0>`_. > + > + .. note:: > + > + Branch is 'lf-5.10.y' > + > +3. **Rootfile system** > + > + Any *aarch64* supporting filesystem can be used. For example, > + Ubuntu 18.04 LTS (Bionic) or 20.04 LTS(Focal) userland which can be > obtained > + from `here > age.ubuntu.com%2Fubuntu- > base%2Freleases%2F18.04%2Frelease%2Fubuntu-base-18.04.1-base- > arm64.tar.gz&data=3D04%7C01%7Chemant.agrawal%40nxp.com%7C26a6 > 0f13113a49b78f4608d9944dd6ef%7C686ea1d3bc2b4c6fa92cd99c5c301635 > %7C0%7C1%7C637703884297678352%7CUnknown%7CTWFpbGZsb3d8eyJW > IjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C > 1000&sdata=3Dm5j36jMgTleERPfborMvcN%2F9X5X8Ft2Cyagt139G8OM% > 3D&reserved=3D0>`_. > + > +4. The Ethernet device will be registered as virtual device, so ENETFEC = has > dependency on > + **rte_bus_vdev** library and it is mandatory to use `--vdev` with val= ue > `net_enetfec` to > + run DPDK application. > + > +Driver compilation and testing > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +Follow instructions available in the document :ref:`compiling and > +testing a PMD for a NIC ` to launch > +**dpdk-testpmd** > + > +Limitations > +~~~~~~~~~~~ > + > +- Multi queue is not supported. > diff --git a/doc/guides/nics/features/enetfec.ini > b/doc/guides/nics/features/enetfec.ini > new file mode 100644 > index 0000000000..bdfbdbd9d4 > --- /dev/null > +++ b/doc/guides/nics/features/enetfec.ini > @@ -0,0 +1,9 @@ > +; > +; Supported features of the 'enetfec' network poll mode driver. > +; > +; Refer to default.ini for the full list of available PMD features. > +; > +[Features] > +Linux =3D Y > +ARMv8 =3D Y > +Usage doc =3D Y > diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst index > 784d5d39f6..777fdab4a0 100644 > --- a/doc/guides/nics/index.rst > +++ b/doc/guides/nics/index.rst > @@ -26,6 +26,7 @@ Network Interface Controller Drivers > e1000em > ena > enetc > + enetfec > enic > fm10k > hinic > diff --git a/doc/guides/rel_notes/release_21_11.rst > b/doc/guides/rel_notes/release_21_11.rst > index 3362c52a73..e964838967 100644 > --- a/doc/guides/rel_notes/release_21_11.rst > +++ b/doc/guides/rel_notes/release_21_11.rst > @@ -20,6 +20,10 @@ DPDK Release 21.11 > ninja -C build doc > xdg-open build/doc/guides/html/rel_notes/release_21_11.html >=20 > +* **Added NXP ENETFEC PMD.** > + > + Added the new ENETFEC driver for the NXP IMX8MMEVK platform. See > the > + :doc:`../nics/enetfec` NIC driver guide for more details on this new dr= iver. >=20 > New Features > ------------ > diff --git a/drivers/net/enetfec/enet_ethdev.c > b/drivers/net/enetfec/enet_ethdev.c > new file mode 100644 > index 0000000000..8a74fb5bf2 > --- /dev/null > +++ b/drivers/net/enetfec/enet_ethdev.c > @@ -0,0 +1,85 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2020-2021 NXP > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "enet_ethdev.h" > +#include "enet_pmd_logs.h" > + > +#define ENETFEC_NAME_PMD net_enetfec > +#define ENETFEC_CDEV_INVALID_FD -1 > + > +static int > +enetfec_eth_init(struct rte_eth_dev *dev) { > + rte_eth_dev_probing_finish(dev); > + return 0; > +} > + > +static int > +pmd_enetfec_probe(struct rte_vdev_device *vdev) { > + struct rte_eth_dev *dev =3D NULL; > + struct enetfec_private *fep; > + const char *name; > + int rc; > + > + name =3D rte_vdev_device_name(vdev); > + if (name =3D=3D NULL) > + return -EINVAL; > + ENETFEC_PMD_LOG(INFO, "Initializing pmd_fec for %s", name); > + > + dev =3D rte_eth_vdev_allocate(vdev, sizeof(*fep)); > + if (dev =3D=3D NULL) > + return -ENOMEM; > + > + /* setup board info structure */ > + fep =3D dev->data->dev_private; > + fep->dev =3D dev; > + rc =3D enetfec_eth_init(dev); > + if (rc) > + goto failed_init; > + > + return 0; > + > +failed_init: > + ENETFEC_PMD_ERR("Failed to init"); > + return rc; > +} > + > +static int > +pmd_enetfec_remove(struct rte_vdev_device *vdev) { > + struct rte_eth_dev *eth_dev =3D NULL; > + int ret; > + > + /* find the ethdev entry */ > + eth_dev =3D rte_eth_dev_allocated(rte_vdev_device_name(vdev)); > + if (eth_dev =3D=3D NULL) > + return -ENODEV; > + > + ret =3D rte_eth_dev_release_port(eth_dev); > + if (ret !=3D 0) > + return -EINVAL; > + > + ENETFEC_PMD_INFO("Closing sw device"); > + return 0; > +} > + > +static struct rte_vdev_driver pmd_enetfec_drv =3D { > + .probe =3D pmd_enetfec_probe, > + .remove =3D pmd_enetfec_remove, > +}; > + > +RTE_PMD_REGISTER_VDEV(ENETFEC_NAME_PMD, pmd_enetfec_drv); > +RTE_LOG_REGISTER_DEFAULT(enetfec_logtype_pmd, NOTICE); > diff --git a/drivers/net/enetfec/enet_ethdev.h > b/drivers/net/enetfec/enet_ethdev.h > new file mode 100644 > index 0000000000..c674dfc782 > --- /dev/null > +++ b/drivers/net/enetfec/enet_ethdev.h > @@ -0,0 +1,179 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2020-2021 NXP > + */ > + > +#ifndef __ENETFEC_ETHDEV_H__ > +#define __ENETFEC_ETHDEV_H__ > + > +#include > + > +/* > + * ENETFEC with AVB IP can support maximum 3 rx and tx queues. > + */ > +#define ENETFEC_MAX_Q 3 > + > +#define ETHER_ADDR_LEN 6 > +#define BD_LEN 49152 > +#define ENETFEC_TX_FR_SIZE 2048 > +#define MAX_TX_BD_RING_SIZE 512 /* It should be power of 2 */ > +#define MAX_RX_BD_RING_SIZE 512 > + > +/* full duplex or half duplex */ > +#define HALF_DUPLEX 0x00 > +#define FULL_DUPLEX 0x01 > +#define UNKNOWN_DUPLEX 0xff > + > +#define PKT_MAX_BUF_SIZE 1984 > +#define OPT_FRAME_SIZE (PKT_MAX_BUF_SIZE << 16) > +#define ETH_ALEN RTE_ETHER_ADDR_LEN > +#define ETH_HLEN RTE_ETHER_HDR_LEN > +#define VLAN_HLEN 4 > + > +#define __iomem > +#if defined(RTE_ARCH_ARM) > +#if defined(RTE_ARCH_64) > +#define dcbf(p) { asm volatile("dc cvac, %0" : : "r"(p) : "memory"); } > +#define dcbf_64(p) dcbf(p) > + > +#else /* RTE_ARCH_32 */ > +#define dcbf(p) RTE_SET_USED(p) > +#define dcbf_64(p) dcbf(p) > +#endif > + > +#else > +#define dcbf(p) RTE_SET_USED(p) > +#define dcbf_64(p) dcbf(p) > +#endif > + > +/* Required types */ > +typedef uint8_t u8; > +typedef uint16_t u16; > +typedef uint32_t u32; > +typedef uint64_t u64; > + > +struct bufdesc { > + uint16_t bd_datlen; /* buffer data length */ > + uint16_t bd_sc; /* buffer control & status */ > + uint32_t bd_bufaddr; /* buffer address */ > +}; > + > +struct bufdesc_ex { > + struct bufdesc desc; > + uint32_t bd_esc; > + uint32_t bd_prot; > + uint32_t bd_bdu; > + uint32_t ts; > + uint16_t res0[4]; > +}; > + > +struct bufdesc_prop { > + int queue_id; > + /* Addresses of Tx and Rx buffers */ > + struct bufdesc *base; > + struct bufdesc *last; > + struct bufdesc *cur; > + void __iomem *active_reg_desc; > + uint64_t descr_baseaddr_p; > + unsigned short ring_size; > + unsigned char d_size; > + unsigned char d_size_log2; > +}; > + > +struct enetfec_priv_tx_q { > + struct bufdesc_prop bd; > + struct rte_mbuf *tx_mbuf[MAX_TX_BD_RING_SIZE]; > + struct bufdesc *dirty_tx; > + struct rte_mempool *pool; > + struct enetfec_private *fep; > +}; > + > +struct enetfec_priv_rx_q { > + struct bufdesc_prop bd; > + struct rte_mbuf *rx_mbuf[MAX_RX_BD_RING_SIZE]; > + struct rte_mempool *pool; > + struct enetfec_private *fep; > +}; > + > +/* Buffer descriptors of FEC are used to track the ring buffers. Buffer > + * descriptor base is x_bd_base. Currently available buffer are x_cur > + * and x_cur. where x is rx or tx. Current buffer is tracked by > +dirty_tx > + * that is sent by the controller. > + * The tx_cur and dirty_tx are same in completely full and empty > + * conditions. Actual condition is determined by empty & ready bits. > + */ > +struct enetfec_private { > + struct rte_eth_dev *dev; > + struct rte_eth_stats stats; > + struct rte_mempool *pool; > + uint16_t max_rx_queues; > + uint16_t max_tx_queues; > + unsigned int total_tx_ring_size; > + unsigned int total_rx_ring_size; > + bool bufdesc_ex; > + unsigned int tx_align; > + unsigned int rx_align; > + int full_duplex; > + unsigned int phy_speed; > + uint32_t quirks; > + int flag_csum; > + int flag_pause; > + int flag_wol; > + bool rgmii_txc_delay; > + bool rgmii_rxc_delay; > + int link; > + void *hw_baseaddr_v; > + uint64_t hw_baseaddr_p; > + void *bd_addr_v; > + uint64_t bd_addr_p; > + uint64_t bd_addr_p_r[ENETFEC_MAX_Q]; > + uint64_t bd_addr_p_t[ENETFEC_MAX_Q]; > + void *dma_baseaddr_r[ENETFEC_MAX_Q]; > + void *dma_baseaddr_t[ENETFEC_MAX_Q]; > + uint64_t cbus_size; > + unsigned int reg_size; > + unsigned int bd_size; > + int hw_ts_rx_en; > + int hw_ts_tx_en; > + struct enetfec_priv_rx_q *rx_queues[ENETFEC_MAX_Q]; > + struct enetfec_priv_tx_q *tx_queues[ENETFEC_MAX_Q]; }; > + > +#define writel(v, p) ({*(volatile unsigned int *)(p) =3D (v); }) #define > +readl(p) rte_read32(p) > + > +static inline struct > +bufdesc *enet_get_nextdesc(struct bufdesc *bdp, struct bufdesc_prop > +*bd) { > + return (bdp >=3D bd->last) ? bd->base > + : (struct bufdesc *)(((uintptr_t)bdp) + bd->d_size); } > + > +static inline struct > +bufdesc *enet_get_prevdesc(struct bufdesc *bdp, struct bufdesc_prop > +*bd) { > + return (bdp <=3D bd->base) ? bd->last > + : (struct bufdesc *)(((uintptr_t)bdp) - bd->d_size); } > + > +static inline int > +enet_get_bd_index(struct bufdesc *bdp, struct bufdesc_prop *bd) { > + return ((const char *)bdp - (const char *)bd->base) >> > +bd->d_size_log2; } > + > +static inline int > +fls64(unsigned long word) > +{ > + return (64 - __builtin_clzl(word)) - 1; } > + > +uint16_t enetfec_recv_pkts(void *rxq1, __rte_unused struct rte_mbuf > **rx_pkts, > + uint16_t nb_pkts); > +uint16_t enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > + uint16_t nb_pkts); > +struct bufdesc *enet_get_nextdesc(struct bufdesc *bdp, > + struct bufdesc_prop *bd); > +int enet_new_rxbdp(struct enetfec_private *fep, struct bufdesc *bdp, > + struct rte_mbuf *mbuf); > + > +#endif /*__ENETFEC_ETHDEV_H__*/ > diff --git a/drivers/net/enetfec/enet_pmd_logs.h > b/drivers/net/enetfec/enet_pmd_logs.h > new file mode 100644 > index 0000000000..e7b3964a0e > --- /dev/null > +++ b/drivers/net/enetfec/enet_pmd_logs.h > @@ -0,0 +1,31 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2020-2021 NXP > + */ > + > +#ifndef _ENETFEC_LOGS_H_ > +#define _ENETFEC_LOGS_H_ > + > +extern int enetfec_logtype_pmd; > + > +/* PMD related logs */ > +#define ENETFEC_PMD_LOG(level, fmt, args...) \ > + rte_log(RTE_LOG_ ## level, enetfec_logtype_pmd, "\nfec_net: %s()" > \ > + fmt "\n", __func__, ##args) > + > +#define PMD_INIT_FUNC_TRACE() ENET_PMD_LOG(DEBUG, " >>") > + > +#define ENETFEC_PMD_DEBUG(fmt, args...) \ > + ENETFEC_PMD_LOG(DEBUG, fmt, ## args) > +#define ENETFEC_PMD_ERR(fmt, args...) \ > + ENETFEC_PMD_LOG(ERR, fmt, ## args) > +#define ENETFEC_PMD_INFO(fmt, args...) \ > + ENETFEC_PMD_LOG(INFO, fmt, ## args) > + > +#define ENETFEC_PMD_WARN(fmt, args...) \ > + ENETFEC_PMD_LOG(WARNING, fmt, ## args) > + > +/* DP Logs, toggled out at compile time if level lower than current > +level */ #define ENETFEC_DP_LOG(level, fmt, args...) \ > + RTE_LOG_DP(level, PMD, fmt, ## args) > + > +#endif /* _ENETFEC_LOGS_H_ */ > diff --git a/drivers/net/enetfec/meson.build > b/drivers/net/enetfec/meson.build new file mode 100644 index > 0000000000..79dca58dea > --- /dev/null > +++ b/drivers/net/enetfec/meson.build > @@ -0,0 +1,11 @@ > +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2021 NXP > + > +if not is_linux > + build =3D false > + reason =3D 'only supported on linux' > +endif > + > +sources =3D files('enet_ethdev.c', > + 'enet_uio.c', > + 'enet_rxtx.c') > diff --git a/drivers/net/enetfec/version.map > b/drivers/net/enetfec/version.map new file mode 100644 index > 0000000000..b66517b171 > --- /dev/null > +++ b/drivers/net/enetfec/version.map > @@ -0,0 +1,3 @@ > +DPDK_22 { > + local: *; > +}; > diff --git a/drivers/net/meson.build b/drivers/net/meson.build index > 24ad121fe4..ac294d8507 100644 > --- a/drivers/net/meson.build > +++ b/drivers/net/meson.build > @@ -18,6 +18,7 @@ drivers =3D [ > 'e1000', > 'ena', > 'enetc', > + 'enetfec', > 'enic', > 'failsafe', > 'fm10k', > -- > 2.17.1