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 93D83457B5; Wed, 14 Aug 2024 04:36:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B19040E68; Wed, 14 Aug 2024 04:36:17 +0200 (CEST) Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by mails.dpdk.org (Postfix) with ESMTP id C8670402A8 for ; Wed, 14 Aug 2024 04:36:15 +0200 (CEST) Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2cb576db1c5so4156227a91.1 for ; Tue, 13 Aug 2024 19:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1723602975; x=1724207775; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GT7oLdw2cL1k5gT5Ql7c3bbVunYuEmgjpf0ZjFtwEFA=; b=MWSAJUkwK9iJeP22OhOzn+NwmMnY/KHZn8V6CkeEvXbnXs+ZOoSqdEY+tPqvZdN/Ae zKveIJTphyxkACV2tXcTwF8ducqXotx105Eaq2twQcBbM4aAh9lZWh4q/Pdc9jbx8oT5 QldFnl1exwAF0XOg0HmBBm0IqOxOEGkauFpcvV447u49uJR5SDfWGoumJ74Ljy97lKsA IvFEpat18iAa812UK5h8EW2RsB/mLe9zRBlIpc8hjab71oYkccST+0zScmuCTW7CLTv9 o7aIeshe87Y6wEfPh9ES5NIpr45jel0/axr9OYnKz/qdJD7aYQKfpeNS4DdILmA3UOOo RyUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723602975; x=1724207775; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GT7oLdw2cL1k5gT5Ql7c3bbVunYuEmgjpf0ZjFtwEFA=; b=McR46X96RsU2pvkyDlvpMe4I6tT2XPR1sLKcLCb3y3i+A2BdhH9ry6YScn26lzu+4W oATMepqhzAiD226XAHR/jxFfsmJRovfJc8Yh4JVxt+k/6PaBkPvFgZyvkfFlYjDZb28m o3nogILxFkjcZRJLIXtF1rQTRrNqeWuOYvui6UwO+8xGK6czSQ++YdR7eUJo7eyk3eX4 ZXkTdB0jllk3n5RsvWCUh3C7FnMZO6Tnd0oPV22XSqCVA6Hc+gVIIt9RUGHA76tiPoqu hAHylpR3MSivlImiV3o4iFTlOrwA9k/T7ackgVSYVo2DzJDadoxHEoIqUFbYsZNTih+8 9+nA== X-Gm-Message-State: AOJu0YxvomWQ2lq2IGvY/wfpjsVRq7MVj81glHNMgoAFudoDNcw+MDgL CsmhMJPKwZnjHo8yNcrIB2WnPU4xjWaXL2XkWdGNkHTIzKj/TDkf088K90hAEBkU/222mA6KIeI uNco= X-Google-Smtp-Source: AGHT+IElqUByOZihBbsN/vygSagjdU9wV6A/eQS3E9+zdbcgU1gZ5d4oRkvcEdX2d4pQza6D/Sh7Aw== X-Received: by 2002:a17:90a:d718:b0:2cd:4100:ef17 with SMTP id 98e67ed59e1d1-2d3aab6bb5fmr1566469a91.31.1723602974541; Tue, 13 Aug 2024 19:36:14 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3ac80c5c1sm331390a91.39.2024.08.13.19.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 19:36:14 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Nandini Persad Subject: [PATCH v2] doc: add new driver guidelines Date: Tue, 13 Aug 2024 19:35:31 -0700 Message-ID: <20240814023604.124686-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240813201250.9383-1-nandinipersad361@gmail.com> References: <20240813201250.9383-1-nandinipersad361@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Nandini Persad This document was created to assist contributors in creating DPDK drivers and provides suggestions and guidelines on how to upstream effectively. Signed-off-by: Nandini Persad --- v2 - text should be i file not patch doc/guides/contributing/index.rst | 1 + doc/guides/contributing/new_driver.rst | 198 +++++++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 doc/guides/contributing/new_driver.rst diff --git a/doc/guides/contributing/index.rst b/doc/guides/contributing/index.rst index dcb9b1fbf0..7fc6511361 100644 --- a/doc/guides/contributing/index.rst +++ b/doc/guides/contributing/index.rst @@ -15,6 +15,7 @@ Contributor's Guidelines documentation unit_test new_library + new_driver patches vulnerability stable diff --git a/doc/guides/contributing/new_driver.rst b/doc/guides/contributing/new_driver.rst new file mode 100644 index 0000000000..037b64bd24 --- /dev/null +++ b/doc/guides/contributing/new_driver.rst @@ -0,0 +1,198 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2024 The DPDK contributors + + +Upstreaming New DPDK Drivers Guide +================================== + +The DPDK project continuously grows its ecosystem by adding support for new +devices. +This document is designed to assist contributors in creating DPDK +drivers, also known as Poll Mode Drivers (PMD's). + +By having public support for a device, we can ensure accessibility across various +operating systems and guarantee community maintenance in future releases. +If a new device is similar to a device already supported by an existing driver, +it is more efficient to update the existing driver. + +Here are our best practice recommendations for creating a new driver. + + +Early Engagement with the Community +----------------------------------- + +When creating a new driver, we highly recommend engaging with the DPDK +community early instead of waiting the work to mature. + +These public discussions help align development of your driver with DPDK expectations. +You may submit a roadmap before the release to inform the community of +your plans. Additionally, sending a Request for Comments (RFC) early in +the release cycle, or even during the prior release, is advisable. + +DPDK is mainly consumed via Long Term Support (LTS) releases. +It is common to target a new PMD to a LTS release. For this, it is +suggested to start upstreaming at least one release before a LTS release. + + +Progressive Work +---------------- + +To continually progress your work, we recommend planning for incremental +upstreaming across multiple patch series or releases. + +It's important to prioritize quality of the driver over upstreaming +in a single release or single patch series. + + +Finalizing +---------- + +Once the driver has been upstreamed, the author has +a responsibility to the community to maintain it. + +This includes the public test report. Authors must send a public +test report after the first upstreaming of the PMD. The same +public test procedure may be reproduced regularly per release. + +After the PMD is upstreamed, the author should send a patch +to update the website with the name of the new PMD and supported devices +via the DPDK mailing list.. + +For more information about the role of maintainers, see :doc:`patches.rst`. + + + +Splitting into Patches +---------------------- + +We recommend that drivers are split into patches, so that each patch represents +a single feature. If the driver code is already developed, it may be challenging +to split. However, there are many benefits to doing so. + +Splitting patches makes it easier to understand a feature and clarifies the +list of components/files that compose that specific feature. + +It also enables the ability to track from the source code to the feature +it is enabled for and helps users to understand the reasoning and intention +of implementation. This kind of tracing is regularly required +for defect resolution and refactoring. + +Another benefit of splitting the codebase per feature is that it highlights +unnecessary or irrelevant code, as any code not belonging to any specific +feature becomes obvious. + +Git bisect is also more useful if patches are split per patch. + +The split should focus on logical features +rather than file-based divisions. + +Each patch in the series must compile without errors +and should maintain functionality. + +Enable the build as early as possible within the series +to facilitate continuous integration and testing. +This approach ensures a clear and manageable development process. + +We suggest splitting patches following this approach: + +* Each patch should be organized logically as a new feature. +* Run test tools per patch (See :ref:`tool_list`:). +* Update relevant documentation and .ini file with each patch. + + +The following order in the patch series is as suggested below. + +The first patch should have the driver's skeleton which should include: + +* Maintainer's file update +* Driver documentation +* Document must have links to official product documentation web page +* The new document should be added into the index (`doc/guides/index.rst`) +* Initial .ini file +* Release notes announcement for the new driver + + +The next patches should include basic device features. +The following is suggested sample list to include in these patches: + +======================= ======================== +Net Crypto +======================= ======================== +Initialization Initialization +Configure queues Configure queues +Start queues Start queues +Simple Rx / Tx Simple Data Processing +Statistics Statistics +Device info +Link interrupt +Burst mode info +Promisc all-multicast +RSS +======================= ======================== + + +Advanced features should be in the next group of patches. +The suggestions for these, listed below, are in no specific order: + +============================= +Net +============================= +Advanced Rx / Tx +Scatter Support +Vector Support +TSO / LRO +Rx / Tx Descriptor Status +RX / Tx Queue Info +Flow Offload +Traffic Management/Metering +Extended statistics +Secondary Process Support +FreeBSD / Windows Support +Flow control +FEC +EEPROM access +Register Dump +Time Synchronization, PTP +Perf documentation +============================= + + +After all features are enabled, if there is remaining base code that +is not upstreamed, they can be upstreamed at the end of the patch series. +However, we recommend these patches are still split into logical groups. + + +Additional Suggestions +---------------------- + +* We recommend using DPDK macros instead of inventing new ones in the PMD. +* Do not include unused headers. Use the ./devtools/process-iwyu.py tool. +* Do not disable compiler warnings in the build file. +* Do not use #ifdef with driver-defined macros, instead prefer runtime configuration. +* Document device parameters in the driver guide. +* Make device operations struct 'const'. +* Use dynamic logging. +* Do not use DPDK version checks in the upstream code. +* Be sure to have SPDX license tags and copyright notice on each side. + + +Dependencies +------------ + +At times, drivers may have dependencies to external software. +For driver dependencies, same DPDK rules for dependencies applies. +Dependencies should be publicly and freely available, +or this is a blocker for upstreaming the driver. + + +.. _tool_list: + +Test Tools +---------- + +Be sure to run the following test tools per patch in a patch series: + +* checkpatches.sh +* check-git-log.sh +* check-meson.py +* check-doc-vs-code.sh -- 2.43.0