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 39CA945AAF; Fri, 4 Oct 2024 18:39:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AA9842D97; Fri, 4 Oct 2024 18:39:48 +0200 (CEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id 59F9540649 for ; Fri, 4 Oct 2024 18:39:47 +0200 (CEST) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-20b1335e4e4so23108865ad.0 for ; Fri, 04 Oct 2024 09:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728059986; x=1728664786; 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=44ACb58WPvOx2bRY0ZUqkvco+BeZ3PtEjZ6qLE4HSfc=; b=LgdQFItprc0Grfrrw8elGKVdyVqtWcg0X8t46AE+Y3njq5fFOC+Gw3BnHKZkvsXyFD r8tXAVWJjTdFnU9OPjb6Fe6KjtiqXosBWHYbjNF0W+/8e82YoC67Z2imLc/a7cKgXJst P+pI649rhQMBnBi6xrUOmd923rp706A3HzeQ7crQ+EakurCACMEts4z1sIQ6PP19Ol63 xtc3x72zsM2KnqcwtUsdVQWDZ0SWmkGoI7SbVqvh+AQWJWRtcTv/SwRE3QJHa5+S4yfe EqJBvkOfHU/F87qvH7voQ/ikuz3cEhjYA1MYItHivpdnmVCPRYrXmbK05Ko74sBC1een QKhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059986; x=1728664786; 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=44ACb58WPvOx2bRY0ZUqkvco+BeZ3PtEjZ6qLE4HSfc=; b=W8jGdT42spFUF1QuTUJlj73h6/0z9/p0rQZ3Wdr5k0i9NKe31YRfO6KEDMFzh2HxOW 1+nV2GqgpSEJ1fsFyXL9+FM2STIuxz7Go+b664wgkkvBXAmi0AgWw2zz3/8HAa6AgrLz x3H+Oh/gNxR7lpiC1blQcd08uFX7uzR+WQ600hgx92zjEwUe6gJ8TNv6VOA5VdgtAkT4 XKBCKzy7nragDLkmfQPFpqDDJK194j4H0LhyoKXJX8F4YP9tTp2YzFtilXYOL3if1+to f7AjjuAdG+DOZKUBHQpPKuvi3LGitT+K3m7jhJOGgAwn8QJEtmS8m3Qr32nT/SUf/EFK j4qw== X-Gm-Message-State: AOJu0YyIjTRLzwIIScxZEE8Sm1Be+pD51uLha+2EGqQxzgSUTuNJwYb4 C23eR2qW4HMv5ByiIcWRK8zIqo+1HFI2OIPX5Qhwjh5ucMxbLsizBDcn/nlw X-Google-Smtp-Source: AGHT+IGzugVBTFcwlCAfmbWWlKwHAJFTUSgmebeyXNW0hCcRW+OEfWZyvip1f57mmCc6rXTCHXWq7A== X-Received: by 2002:a17:903:11c7:b0:20b:a25e:16c5 with SMTP id d9443c01a7336-20bff186805mr49975815ad.53.1728059985895; Fri, 04 Oct 2024 09:39:45 -0700 (PDT) Received: from localhost.localdomain (syn-076-032-089-124.res.spectrum.com. [76.32.89.124]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138afc04sm616765ad.10.2024.10.04.09.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 09:39:45 -0700 (PDT) From: Nandini Persad To: dev@dpdk.org Cc: Ferruh Yigit , Stephen Hemminger , Chengwen Feng Subject: [PATCH v5] doc: add new driver guidelines Date: Fri, 4 Oct 2024 09:39:33 -0700 Message-Id: <20241004163933.52278-1-nandinipersad361@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240916162856.11566-1-stephen@networkplumber.org> References: <20240916162856.11566-1-stephen@networkplumber.org> 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 This document was created to assist contributors in creating DPDK drivers and provides suggestions and guidelines on how to upstream effectively. Signed-off-by: Ferruh Yigit Signed-off-by: Nandini Persad Reviewed-by: Stephen Hemminger Acked-by: Chengwen Feng --- doc/guides/contributing/index.rst | 1 + doc/guides/contributing/new_driver.rst | 213 +++++++++++++++++++++++++ 2 files changed, 214 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..9e88de5445 --- /dev/null +++ b/doc/guides/contributing/new_driver.rst @@ -0,0 +1,213 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2024 The DPDK contributors + + +Adding a New Driver +=================== + +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). + +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`. + + +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: + +* Maintainers 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 Configure sessions +Simple Rx / Tx Add capabilities +Statistics Statistics and device info +Device info Simple data processing +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 Crypto +============================= ======================================= +Advanced Rx / Tx Chained operations +Scatter Support Scatter Gather +Vector Support Security protocols - IPsec, MACsec etc. +TSO / LRO Asymmetric crypto +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 +---------------------- + +Avoid doing the following: + +* Using PMD specific macros when DPDK macros exist +* Including unused headers (process-iwyu.py) +* Disabling compiler warnings for driver +* #ifdef with driver-defined macros +* DPDK version checks (via RTE_VERSION_NUM) in the upstream code +* Introducing Public APIs directly from the driver + +Remember to do the following: + +* Runtime configuration when applicable +* Document device parameters in the driver guide +* Make device operations struct 'const' +* Dynamic logging +* SPDX license tags and copyright notice on each file +* Run the Coccinelle scripts ./devtools/cocci.sh which check for common cleanups + such as useless null checks before calling free routines + + +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, +drivers which depend on non-available components will not be accepted. +If the required dependency is not yet publicly available, then wait to submit +the driver until the dependent library is available. + + +.. _tool_list: + +Test Tools +---------- + +Build and check the driver's documentation. Make sure there are no +warnings and driver shows up in the relevant index page. + +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 +* check-spdx-tag.sh +* Build documentation and validate how output looks + -- 2.34.1