xref: /dpdk/doc/guides/contributing/patches.rst (revision 9e0e4a00df77562b7169edf34d0218ba76fbb96b)
177c79de0SHemant Agrawal..  SPDX-License-Identifier: BSD-3-Clause
277c79de0SHemant Agrawal    Copyright 2018 The DPDK contributors
377c79de0SHemant Agrawal
458abf6e7SJohn McNamara.. submitting_patches:
558abf6e7SJohn McNamara
658abf6e7SJohn McNamaraContributing Code to DPDK
758abf6e7SJohn McNamara=========================
858abf6e7SJohn McNamara
958abf6e7SJohn McNamaraThis document outlines the guidelines for submitting code to DPDK.
1058abf6e7SJohn McNamara
1158abf6e7SJohn McNamaraThe DPDK development process is modelled (loosely) on the Linux Kernel development model so it is worth reading the
1258abf6e7SJohn McNamaraLinux kernel guide on submitting patches:
13f2b99889SYongseok Koh`How to Get Your Change Into the Linux Kernel <https://www.kernel.org/doc/html/latest/process/submitting-patches.html>`_.
1458abf6e7SJohn McNamaraThe rationale for many of the DPDK guidelines is explained in greater detail in the kernel guidelines.
1558abf6e7SJohn McNamara
1658abf6e7SJohn McNamara
1758abf6e7SJohn McNamaraThe DPDK Development Process
18f9de0667SJohn McNamara----------------------------
1958abf6e7SJohn McNamara
2058abf6e7SJohn McNamaraThe DPDK development process has the following features:
2158abf6e7SJohn McNamara
2258abf6e7SJohn McNamara* The code is hosted in a public git repository.
2358abf6e7SJohn McNamara* There is a mailing list where developers submit patches.
2458abf6e7SJohn McNamara* There are maintainers for hierarchical components.
2558abf6e7SJohn McNamara* Patches are reviewed publicly on the mailing list.
26579a5c98SFerruh Yigit* Successfully reviewed patches are merged to the repository.
27f9de0667SJohn McNamara* Patches should be sent to the target repository or sub-tree, see below.
28f9de0667SJohn McNamara* All sub-repositories are merged into main repository for ``-rc1`` and ``-rc2`` versions of the release.
29f9de0667SJohn McNamara* After the ``-rc2`` release all patches should target the main repository.
3058abf6e7SJohn McNamara
313d4f7206SJeff ShawThe mailing list for DPDK development is `dev@dpdk.org <http://dpdk.org/ml/archives/dev/>`_.
3258abf6e7SJohn McNamaraContributors will need to `register for the mailing list <http://dpdk.org/ml/listinfo/dev>`_ in order to submit patches.
3328d8abafSDeirdre O'ConnorIt is also worth registering for the DPDK `Patchwork <http://dpdk.org/dev/patchwork/project/dpdk/list/>`_
3458abf6e7SJohn McNamara
3558abf6e7SJohn McNamaraThe development process requires some familiarity with the ``git`` version control system.
3658abf6e7SJohn McNamaraRefer to the `Pro Git Book <http://www.git-scm.com/book/>`_ for further information.
3758abf6e7SJohn McNamara
38a4862c9eSHemant AgrawalSource License
39a4862c9eSHemant Agrawal--------------
40a4862c9eSHemant Agrawal
41a4862c9eSHemant AgrawalThe DPDK uses the Open Source BSD-3-Clause license for the core libraries and
42a4862c9eSHemant Agrawaldrivers. The kernel components are GPL-2.0 licensed. DPDK uses single line
43a4862c9eSHemant Agrawalreference to Unique License Identifiers in source files as defined by the Linux
44a4862c9eSHemant AgrawalFoundation's `SPDX project <http://spdx.org/>`_.
45a4862c9eSHemant Agrawal
46a4862c9eSHemant AgrawalDPDK uses first line of the file to be SPDX tag. In case of *#!* scripts, SPDX
47a4862c9eSHemant Agrawaltag can be placed in 2nd line of the file.
48a4862c9eSHemant Agrawal
49a4862c9eSHemant AgrawalFor example, to label a file as subject to the BSD-3-Clause license,
50a4862c9eSHemant Agrawalthe following text would be used:
51a4862c9eSHemant Agrawal
52a4862c9eSHemant Agrawal``SPDX-License-Identifier: BSD-3-Clause``
53a4862c9eSHemant Agrawal
54a4862c9eSHemant AgrawalTo label a file as dual-licensed with BSD-3-Clause and GPL-2.0 (e.g., for code
55a4862c9eSHemant Agrawalthat is shared between the kernel and userspace), the following text would be
56a4862c9eSHemant Agrawalused:
57a4862c9eSHemant Agrawal
58a4862c9eSHemant Agrawal``SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)``
59a4862c9eSHemant Agrawal
60a4862c9eSHemant AgrawalRefer to ``licenses/README`` for more details.
6158abf6e7SJohn McNamara
62f9de0667SJohn McNamaraMaintainers and Sub-trees
63f9de0667SJohn McNamara-------------------------
64f9de0667SJohn McNamara
65f9de0667SJohn McNamaraThe DPDK maintenance hierarchy is divided into a main repository ``dpdk`` and sub-repositories ``dpdk-next-*``.
66f9de0667SJohn McNamara
67f9de0667SJohn McNamaraThere are maintainers for the trees and for components within the tree.
68f9de0667SJohn McNamara
69f9de0667SJohn McNamaraTrees and maintainers are listed in the ``MAINTAINERS`` file. For example::
70f9de0667SJohn McNamara
71f9de0667SJohn McNamara    Crypto Drivers
72f9de0667SJohn McNamara    --------------
73f9de0667SJohn McNamara    M: Some Name <some.name@email.com>
74f9de0667SJohn McNamara    B: Another Name <another.name@email.com>
75f9de0667SJohn McNamara    T: git://dpdk.org/next/dpdk-next-crypto
76f9de0667SJohn McNamara
77f9de0667SJohn McNamara    Intel AES-NI GCM PMD
78f9de0667SJohn McNamara    M: Some One <some.one@email.com>
79f9de0667SJohn McNamara    F: drivers/crypto/aesni_gcm/
80f9de0667SJohn McNamara    F: doc/guides/cryptodevs/aesni_gcm.rst
81f9de0667SJohn McNamara
82f9de0667SJohn McNamaraWhere:
83f9de0667SJohn McNamara
84f9de0667SJohn McNamara* ``M`` is a tree or component maintainer.
85f9de0667SJohn McNamara* ``B`` is a tree backup maintainer.
86f9de0667SJohn McNamara* ``T`` is a repository tree.
87f9de0667SJohn McNamara* ``F`` is a maintained file or directory.
88f9de0667SJohn McNamara
89f9de0667SJohn McNamaraAdditional details are given in the ``MAINTAINERS`` file.
90f9de0667SJohn McNamara
91f9de0667SJohn McNamaraThe role of the component maintainers is to:
92f9de0667SJohn McNamara
93f9de0667SJohn McNamara* Review patches for the component or delegate the review.
94f9de0667SJohn McNamara  The review should be done, ideally, within 1 week of submission to the mailing list.
95f9de0667SJohn McNamara* Add an ``acked-by`` to patches, or patchsets, that are ready for committing to a tree.
96acd6dc98SThomas Monjalon* Reply to questions asked about the component.
97f9de0667SJohn McNamara
98f9de0667SJohn McNamaraComponent maintainers can be added or removed by submitting a patch to the ``MAINTAINERS`` file.
99f9de0667SJohn McNamaraMaintainers should have demonstrated a reasonable level of contributions or reviews to the component area.
100f9de0667SJohn McNamaraThe maintainer should be confirmed by an ``ack`` from an established contributor.
101f9de0667SJohn McNamaraThere can be more than one component maintainer if desired.
102f9de0667SJohn McNamara
103f9de0667SJohn McNamaraThe role of the tree maintainers is to:
104f9de0667SJohn McNamara
105f9de0667SJohn McNamara* Maintain the overall quality of their tree.
106f9de0667SJohn McNamara  This can entail additional review, compilation checks or other tests deemed necessary by the maintainer.
107f9de0667SJohn McNamara* Commit patches that have been reviewed by component maintainers and/or other contributors.
108f9de0667SJohn McNamara  The tree maintainer should determine if patches have been reviewed sufficiently.
109f9de0667SJohn McNamara* Ensure that patches are reviewed in a timely manner.
110f9de0667SJohn McNamara* Prepare the tree for integration.
111f9de0667SJohn McNamara* Ensure that there is a designated back-up maintainer and coordinate a handover for periods where the
112f9de0667SJohn McNamara  tree maintainer can't perform their role.
113f9de0667SJohn McNamara
114f9de0667SJohn McNamaraTree maintainers can be added or removed by submitting a patch to the ``MAINTAINERS`` file.
115f9de0667SJohn McNamaraThe proposer should justify the need for a new sub-tree and should have demonstrated a sufficient level of contributions in the area or to a similar area.
116f9de0667SJohn McNamaraThe maintainer should be confirmed by an ``ack`` from an existing tree maintainer.
117f9de0667SJohn McNamaraDisagreements on trees or maintainers can be brought to the Technical Board.
118f9de0667SJohn McNamara
119f9de0667SJohn McNamaraThe backup maintainer for the master tree should be selected from the existing sub-tree maintainers from the project.
120f9de0667SJohn McNamaraThe backup maintainer for a sub-tree should be selected from among the component maintainers within that sub-tree.
121f9de0667SJohn McNamara
122f9de0667SJohn McNamara
12358abf6e7SJohn McNamaraGetting the Source Code
12458abf6e7SJohn McNamara-----------------------
12558abf6e7SJohn McNamara
126579a5c98SFerruh YigitThe source code can be cloned using either of the following:
127579a5c98SFerruh Yigit
128579a5c98SFerruh Yigitmain repository::
12958abf6e7SJohn McNamara
13058abf6e7SJohn McNamara    git clone git://dpdk.org/dpdk
13158abf6e7SJohn McNamara    git clone http://dpdk.org/git/dpdk
13258abf6e7SJohn McNamara
133579a5c98SFerruh Yigitsub-repositories (`list <http://dpdk.org/browse/next>`_)::
134579a5c98SFerruh Yigit
135579a5c98SFerruh Yigit    git clone git://dpdk.org/next/dpdk-next-*
136579a5c98SFerruh Yigit    git clone http://dpdk.org/git/next/dpdk-next-*
13758abf6e7SJohn McNamara
13858abf6e7SJohn McNamaraMake your Changes
13958abf6e7SJohn McNamara-----------------
14058abf6e7SJohn McNamara
14158abf6e7SJohn McNamaraMake your planned changes in the cloned ``dpdk`` repo. Here are some guidelines and requirements:
14258abf6e7SJohn McNamara
14358abf6e7SJohn McNamara* Follow the :ref:`coding_style` guidelines.
14458abf6e7SJohn McNamara
14558abf6e7SJohn McNamara* If you add new files or directories you should add your name to the ``MAINTAINERS`` file.
14658abf6e7SJohn McNamara
14758abf6e7SJohn McNamara* New external functions should be added to the local ``version.map`` file.
14858abf6e7SJohn McNamara  See the :doc:`Guidelines for ABI policy and versioning </contributing/versioning>`.
14958abf6e7SJohn McNamara  New external functions should also be added in alphabetical order.
15058abf6e7SJohn McNamara
15158abf6e7SJohn McNamara* Important changes will require an addition to the release notes in ``doc/guides/rel_notes/``.
15258abf6e7SJohn McNamara  See the :ref:`Release Notes section of the Documentation Guidelines <doc_guidelines>` for details.
15358abf6e7SJohn McNamara
15458abf6e7SJohn McNamara* Test the compilation works with different targets, compilers and options, see :ref:`contrib_check_compilation`.
15558abf6e7SJohn McNamara
15658abf6e7SJohn McNamara* Don't break compilation between commits with forward dependencies in a patchset.
15758abf6e7SJohn McNamara  Each commit should compile on its own to allow for ``git bisect`` and continuous integration testing.
15858abf6e7SJohn McNamara
1598f87ba70SThierry Herbelot* Add tests to the ``app/test`` unit test framework where possible.
16058abf6e7SJohn McNamara
16158abf6e7SJohn McNamara* Add documentation, if relevant, in the form of Doxygen comments or a User Guide in RST format.
16258abf6e7SJohn McNamara  See the :ref:`Documentation Guidelines <doc_guidelines>`.
16358abf6e7SJohn McNamara
16458abf6e7SJohn McNamaraOnce the changes have been made you should commit them to your local repo.
16558abf6e7SJohn McNamara
16658abf6e7SJohn McNamaraFor small changes, that do not require specific explanations, it is better to keep things together in the
16758abf6e7SJohn McNamarasame patch.
16858abf6e7SJohn McNamaraLarger changes that require different explanations should be separated into logical patches in a patchset.
16958abf6e7SJohn McNamaraA good way of thinking about whether a patch should be split is to consider whether the change could be
17058abf6e7SJohn McNamaraapplied without dependencies as a backport.
17158abf6e7SJohn McNamara
172*9e0e4a00SDavid HuntIt is better to keep the related documentation changes in the same patch
173*9e0e4a00SDavid Huntfile as the code, rather than one big documentation patch at then end of a
174*9e0e4a00SDavid Huntpatchset. This makes it easier for future maintenance and development of the
175*9e0e4a00SDavid Huntcode.
176*9e0e4a00SDavid Hunt
17758abf6e7SJohn McNamaraAs a guide to how patches should be structured run ``git log`` on similar files.
17858abf6e7SJohn McNamara
17958abf6e7SJohn McNamara
18058abf6e7SJohn McNamaraCommit Messages: Subject Line
18158abf6e7SJohn McNamara-----------------------------
18258abf6e7SJohn McNamara
18358abf6e7SJohn McNamaraThe first, summary, line of the git commit message becomes the subject line of the patch email.
18458abf6e7SJohn McNamaraHere are some guidelines for the summary line:
18558abf6e7SJohn McNamara
18658abf6e7SJohn McNamara* The summary line must capture the area and the impact of the change.
18758abf6e7SJohn McNamara
18858abf6e7SJohn McNamara* The summary line should be around 50 characters.
18958abf6e7SJohn McNamara
19058abf6e7SJohn McNamara* The summary line should be lowercase apart from acronyms.
19158abf6e7SJohn McNamara
19258abf6e7SJohn McNamara* It should be prefixed with the component name (use git log to check existing components).
19358abf6e7SJohn McNamara  For example::
19458abf6e7SJohn McNamara
19558abf6e7SJohn McNamara     ixgbe: fix offload config option name
19658abf6e7SJohn McNamara
19758abf6e7SJohn McNamara     config: increase max queues per port
19858abf6e7SJohn McNamara
19958abf6e7SJohn McNamara* Use the imperative of the verb (like instructions to the code base).
20058abf6e7SJohn McNamara
20158abf6e7SJohn McNamara* Don't add a period/full stop to the subject line or you will end up two in the patch name: ``dpdk_description..patch``.
20258abf6e7SJohn McNamara
20358abf6e7SJohn McNamaraThe actual email subject line should be prefixed by ``[PATCH]`` and the version, if greater than v1,
20458abf6e7SJohn McNamarafor example: ``PATCH v2``.
20558abf6e7SJohn McNamaraThe is generally added by ``git send-email`` or ``git format-patch``, see below.
20658abf6e7SJohn McNamara
20758abf6e7SJohn McNamaraIf you are submitting an RFC draft of a feature you can use ``[RFC]`` instead of ``[PATCH]``.
20858abf6e7SJohn McNamaraAn RFC patch doesn't have to be complete.
20958abf6e7SJohn McNamaraIt is intended as a way of getting early feedback.
21058abf6e7SJohn McNamara
21158abf6e7SJohn McNamara
21258abf6e7SJohn McNamaraCommit Messages: Body
21358abf6e7SJohn McNamara---------------------
21458abf6e7SJohn McNamara
21558abf6e7SJohn McNamaraHere are some guidelines for the body of a commit message:
21658abf6e7SJohn McNamara
21758abf6e7SJohn McNamara* The body of the message should describe the issue being fixed or the feature being added.
21858abf6e7SJohn McNamara  It is important to provide enough information to allow a reviewer to understand the purpose of the patch.
21958abf6e7SJohn McNamara
22058abf6e7SJohn McNamara* When the change is obvious the body can be blank, apart from the signoff.
22158abf6e7SJohn McNamara
22258abf6e7SJohn McNamara* The commit message must end with a ``Signed-off-by:`` line which is added using::
22358abf6e7SJohn McNamara
22458abf6e7SJohn McNamara      git commit --signoff # or -s
22558abf6e7SJohn McNamara
22658abf6e7SJohn McNamara  The purpose of the signoff is explained in the
227f2b99889SYongseok Koh  `Developer's Certificate of Origin <https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1>`_
22858abf6e7SJohn McNamara  section of the Linux kernel guidelines.
22958abf6e7SJohn McNamara
23058abf6e7SJohn McNamara  .. Note::
23158abf6e7SJohn McNamara
23258abf6e7SJohn McNamara     All developers must ensure that they have read and understood the
23358abf6e7SJohn McNamara     Developer's Certificate of Origin section of the documentation prior
23458abf6e7SJohn McNamara     to applying the signoff and submitting a patch.
23558abf6e7SJohn McNamara
23658abf6e7SJohn McNamara* The signoff must be a real name and not an alias or nickname.
23758abf6e7SJohn McNamara  More than one signoff is allowed.
23858abf6e7SJohn McNamara
23958abf6e7SJohn McNamara* The text of the commit message should be wrapped at 72 characters.
24058abf6e7SJohn McNamara
241f9ef083cSHarry van Haaren* When fixing a regression, it is required to reference the id of the commit
242f9ef083cSHarry van Haaren  which introduced the bug, and put the original author of that commit on CC.
243f9ef083cSHarry van Haaren  You can generate the required lines using the following git alias, which prints
244f9ef083cSHarry van Haaren  the commit SHA and the author of the original code::
24558abf6e7SJohn McNamara
246f9ef083cSHarry van Haaren     git config alias.fixline "log -1 --abbrev=12 --format='Fixes: %h (\"%s\")%nCc: %ae'"
24758abf6e7SJohn McNamara
248f9ef083cSHarry van Haaren  The output of ``git fixline <SHA>`` must then be added to the commit message::
24958abf6e7SJohn McNamara
250f9ef083cSHarry van Haaren     doc: fix some parameter description
25158abf6e7SJohn McNamara
252f9ef083cSHarry van Haaren     Update the docs, fixing description of some parameter.
25358abf6e7SJohn McNamara
254f9ef083cSHarry van Haaren     Fixes: abcdefgh1234 ("doc: add some parameter")
255f9ef083cSHarry van Haaren     Cc: author@example.com
25658abf6e7SJohn McNamara
25758abf6e7SJohn McNamara     Signed-off-by: Alex Smith <alex.smith@example.com>
25858abf6e7SJohn McNamara
25958abf6e7SJohn McNamara* When fixing an error or warning it is useful to add the error message and instructions on how to reproduce it.
26058abf6e7SJohn McNamara
26158abf6e7SJohn McNamara* Use correct capitalization, punctuation and spelling.
26258abf6e7SJohn McNamara
2634aeedc25SHarry van HaarenIn addition to the ``Signed-off-by:`` name the commit messages can also have
2644aeedc25SHarry van Haarentags for who reported, suggested, tested and reviewed the patch being
2654aeedc25SHarry van Haarenposted. Please refer to the `Tested, Acked and Reviewed by`_ section.
26658abf6e7SJohn McNamara
2676561392cSMarko KovacevicPatch Fix Related Issues
2686561392cSMarko Kovacevic~~~~~~~~~~~~~~~~~~~~~~~~
269d687e0d0SMarko Kovacevic
270d687e0d0SMarko Kovacevic`Coverity <https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_
271d687e0d0SMarko Kovacevicis a tool for static code analysis.
272d687e0d0SMarko KovacevicIt is used as a cloud-based service used to scan the DPDK source code,
273d687e0d0SMarko Kovacevicand alert developers of any potential defects in the source code.
274d687e0d0SMarko KovacevicWhen fixing an issue found by Coverity, the patch must contain a Coverity issue ID
275d687e0d0SMarko Kovacevicin the body of the commit message. For example::
276d687e0d0SMarko Kovacevic
277d687e0d0SMarko Kovacevic
278d687e0d0SMarko Kovacevic     doc: fix some parameter description
279d687e0d0SMarko Kovacevic
280d687e0d0SMarko Kovacevic     Update the docs, fixing description of some parameter.
281d687e0d0SMarko Kovacevic
282d687e0d0SMarko Kovacevic     Coverity issue: 12345
283d687e0d0SMarko Kovacevic     Fixes: abcdefgh1234 ("doc: add some parameter")
284d687e0d0SMarko Kovacevic     Cc: author@example.com
285d687e0d0SMarko Kovacevic
286d687e0d0SMarko Kovacevic     Signed-off-by: Alex Smith <alex.smith@example.com>
287d687e0d0SMarko Kovacevic
2886561392cSMarko Kovacevic
2896561392cSMarko Kovacevic`Bugzilla <https://dpdk.org/tracker>`_
2906561392cSMarko Kovacevicis a bug- or issue-tracking system.
2916561392cSMarko KovacevicBug-tracking systems allow individual or groups of developers
2926561392cSMarko Kovaceviceffectively to keep track of outstanding problems with their product.
2936561392cSMarko KovacevicWhen fixing an issue raised in Bugzilla, the patch must contain
2946561392cSMarko Kovacevica Bugzilla issue ID in the body of the commit message.
2956561392cSMarko KovacevicFor example::
2966561392cSMarko Kovacevic
2976561392cSMarko Kovacevic    doc: fix some parameter description
2986561392cSMarko Kovacevic
2996561392cSMarko Kovacevic    Update the docs, fixing description of some parameter.
3006561392cSMarko Kovacevic
3016561392cSMarko Kovacevic    Bugzilla ID: 12345
3026561392cSMarko Kovacevic    Fixes: abcdefgh1234 ("doc: add some parameter")
3036561392cSMarko Kovacevic    Cc: author@example.com
3046561392cSMarko Kovacevic
3056561392cSMarko Kovacevic    Signed-off-by: Alex Smith <alex.smith@example.com>
3066561392cSMarko Kovacevic
307f16e13c9SMarko KovacevicPatch for Stable Releases
308f16e13c9SMarko Kovacevic~~~~~~~~~~~~~~~~~~~~~~~~~
309f16e13c9SMarko Kovacevic
310f16e13c9SMarko KovacevicAll fix patches to the master branch that are candidates for backporting
311f16e13c9SMarko Kovacevicshould also be CCed to the `stable@dpdk.org <http://dpdk.org/ml/listinfo/stable>`_
312f16e13c9SMarko Kovacevicmailing list.
313f16e13c9SMarko KovacevicIn the commit message body the Cc: stable@dpdk.org should be inserted as follows::
314f16e13c9SMarko Kovacevic
315f16e13c9SMarko Kovacevic     doc: fix some parameter description
316f16e13c9SMarko Kovacevic
317f16e13c9SMarko Kovacevic     Update the docs, fixing description of some parameter.
318f16e13c9SMarko Kovacevic
319f16e13c9SMarko Kovacevic     Fixes: abcdefgh1234 ("doc: add some parameter")
320f16e13c9SMarko Kovacevic     Cc: stable@dpdk.org
321f16e13c9SMarko Kovacevic
322f16e13c9SMarko Kovacevic     Signed-off-by: Alex Smith <alex.smith@example.com>
323f16e13c9SMarko Kovacevic
324f16e13c9SMarko KovacevicFor further information on stable contribution you can go to
325f16e13c9SMarko Kovacevic:doc:`Stable Contribution Guide <stable>`.
326f16e13c9SMarko Kovacevic
32758abf6e7SJohn McNamara
32858abf6e7SJohn McNamaraCreating Patches
32958abf6e7SJohn McNamara----------------
33058abf6e7SJohn McNamara
33158abf6e7SJohn McNamaraIt is possible to send patches directly from git but for new contributors it is recommended to generate the
33258abf6e7SJohn McNamarapatches with ``git format-patch`` and then when everything looks okay, and the patches have been checked, to
33358abf6e7SJohn McNamarasend them with ``git send-email``.
33458abf6e7SJohn McNamara
33558abf6e7SJohn McNamaraHere are some examples of using ``git format-patch`` to generate patches:
33658abf6e7SJohn McNamara
33758abf6e7SJohn McNamara.. code-block:: console
33858abf6e7SJohn McNamara
33958abf6e7SJohn McNamara   # Generate a patch from the last commit.
34058abf6e7SJohn McNamara   git format-patch -1
34158abf6e7SJohn McNamara
34258abf6e7SJohn McNamara   # Generate a patch from the last 3 commits.
34358abf6e7SJohn McNamara   git format-patch -3
34458abf6e7SJohn McNamara
34558abf6e7SJohn McNamara   # Generate the patches in a directory.
34658abf6e7SJohn McNamara   git format-patch -3 -o ~/patch/
34758abf6e7SJohn McNamara
34858abf6e7SJohn McNamara   # Add a cover letter to explain a patchset.
34958abf6e7SJohn McNamara   git format-patch -3 -o ~/patch/ --cover-letter
35058abf6e7SJohn McNamara
35158abf6e7SJohn McNamara   # Add a prefix with a version number.
35258abf6e7SJohn McNamara   git format-patch -3 -o ~/patch/ -v 2
35358abf6e7SJohn McNamara
35458abf6e7SJohn McNamara
35558abf6e7SJohn McNamaraCover letters are useful for explaining a patchset and help to generate a logical threading to the patches.
35658abf6e7SJohn McNamaraSmaller notes can be put inline in the patch after the ``---`` separator, for example::
35758abf6e7SJohn McNamara
35858abf6e7SJohn McNamara   Subject: [PATCH] fm10k/base: add FM10420 device ids
35958abf6e7SJohn McNamara
36058abf6e7SJohn McNamara   Add the device ID for Boulder Rapids and Atwood Channel to enable
36158abf6e7SJohn McNamara   drivers to support those devices.
36258abf6e7SJohn McNamara
36358abf6e7SJohn McNamara   Signed-off-by: Alex Smith <alex.smith@example.com>
36458abf6e7SJohn McNamara   ---
36558abf6e7SJohn McNamara
36658abf6e7SJohn McNamara   ADD NOTES HERE.
36758abf6e7SJohn McNamara
36858abf6e7SJohn McNamara    drivers/net/fm10k/base/fm10k_api.c  | 6 ++++++
36958abf6e7SJohn McNamara    drivers/net/fm10k/base/fm10k_type.h | 6 ++++++
37058abf6e7SJohn McNamara    2 files changed, 12 insertions(+)
37158abf6e7SJohn McNamara   ...
37258abf6e7SJohn McNamara
37358abf6e7SJohn McNamaraVersion 2 and later of a patchset should also include a short log of the changes so the reviewer knows what has changed.
37458abf6e7SJohn McNamaraThis can be added to the cover letter or the annotations.
37558abf6e7SJohn McNamaraFor example::
37658abf6e7SJohn McNamara
37758abf6e7SJohn McNamara   ---
37858abf6e7SJohn McNamara   v3:
37958abf6e7SJohn McNamara   * Fixed issued with version.map.
38058abf6e7SJohn McNamara
38158abf6e7SJohn McNamara   v2:
38258abf6e7SJohn McNamara   * Added i40e support.
38358abf6e7SJohn McNamara   * Renamed ethdev functions from rte_eth_ieee15888_*() to rte_eth_timesync_*()
38458abf6e7SJohn McNamara     since 802.1AS can be supported through the same interfaces.
38558abf6e7SJohn McNamara
38658abf6e7SJohn McNamara
38758abf6e7SJohn McNamara.. _contrib_checkpatch:
38858abf6e7SJohn McNamara
38958abf6e7SJohn McNamaraChecking the Patches
39058abf6e7SJohn McNamara--------------------
39158abf6e7SJohn McNamara
3929a98f50eSThomas MonjalonPatches should be checked for formatting and syntax issues using the ``checkpatches.sh`` script in the ``devtools``
39358abf6e7SJohn McNamaradirectory of the DPDK repo.
39458abf6e7SJohn McNamaraThis uses the Linux kernel development tool ``checkpatch.pl`` which  can be obtained by cloning, and periodically,
39558abf6e7SJohn McNamaraupdating the Linux kernel sources.
39658abf6e7SJohn McNamara
39758abf6e7SJohn McNamaraThe path to the original Linux script must be set in the environment variable ``DPDK_CHECKPATCH_PATH``.
39858abf6e7SJohn McNamaraThis, and any other configuration variables required by the development tools, are loaded from the following
39958abf6e7SJohn McNamarafiles, in order of preference::
40058abf6e7SJohn McNamara
40158abf6e7SJohn McNamara   .develconfig
40258abf6e7SJohn McNamara   ~/.config/dpdk/devel.config
40358abf6e7SJohn McNamara   /etc/dpdk/devel.config.
40458abf6e7SJohn McNamara
40558abf6e7SJohn McNamaraOnce the environment variable the script can be run as follows::
40658abf6e7SJohn McNamara
4079a98f50eSThomas Monjalon   devtools/checkpatches.sh ~/patch/
40858abf6e7SJohn McNamara
40958abf6e7SJohn McNamaraThe script usage is::
41058abf6e7SJohn McNamara
41158abf6e7SJohn McNamara   checkpatches.sh [-h] [-q] [-v] [patch1 [patch2] ...]]"
41258abf6e7SJohn McNamara
41358abf6e7SJohn McNamaraWhere:
41458abf6e7SJohn McNamara
41558abf6e7SJohn McNamara* ``-h``: help, usage.
41658abf6e7SJohn McNamara* ``-q``: quiet. Don't output anything for files without issues.
41758abf6e7SJohn McNamara* ``-v``: verbose.
41858abf6e7SJohn McNamara* ``patchX``: path to one or more patches.
41958abf6e7SJohn McNamara
420edbeb7d9SThomas MonjalonThen the git logs should be checked using the ``check-git-log.sh`` script.
421edbeb7d9SThomas Monjalon
422edbeb7d9SThomas MonjalonThe script usage is::
423edbeb7d9SThomas Monjalon
424edbeb7d9SThomas Monjalon   check-git-log.sh [range]
425edbeb7d9SThomas Monjalon
426edbeb7d9SThomas MonjalonWhere the range is a ``git log`` option.
427edbeb7d9SThomas Monjalon
42858abf6e7SJohn McNamara
42958abf6e7SJohn McNamara.. _contrib_check_compilation:
43058abf6e7SJohn McNamara
43158abf6e7SJohn McNamaraChecking Compilation
43258abf6e7SJohn McNamara--------------------
43358abf6e7SJohn McNamara
4348f87ba70SThierry HerbelotCompilation of patches and changes should be tested using the ``test-build.sh`` script in the ``devtools``
43558abf6e7SJohn McNamaradirectory of the DPDK repo::
43658abf6e7SJohn McNamara
4379a98f50eSThomas Monjalon  devtools/test-build.sh x86_64-native-linuxapp-gcc+next+shared
43858abf6e7SJohn McNamara
43958abf6e7SJohn McNamaraThe script usage is::
44058abf6e7SJohn McNamara
44158abf6e7SJohn McNamara   test-build.sh [-h] [-jX] [-s] [config1 [config2] ...]]
44258abf6e7SJohn McNamara
44358abf6e7SJohn McNamaraWhere:
44458abf6e7SJohn McNamara
44558abf6e7SJohn McNamara* ``-h``: help, usage.
44658abf6e7SJohn McNamara* ``-jX``: use X parallel jobs in "make".
44758abf6e7SJohn McNamara* ``-s``: short test with only first config and without examples/doc.
44858abf6e7SJohn McNamara* ``config``: default config name plus config switches delimited with a ``+`` sign.
44958abf6e7SJohn McNamara
45058abf6e7SJohn McNamaraExamples of configs are::
45158abf6e7SJohn McNamara
45258abf6e7SJohn McNamara   x86_64-native-linuxapp-gcc
453948fd64bSPanu Matilainen   x86_64-native-linuxapp-gcc+next+shared
454948fd64bSPanu Matilainen   x86_64-native-linuxapp-clang+shared
45558abf6e7SJohn McNamara
4561e46fadeSCian FerriterThe builds can be modified via the following environmental variables:
45758abf6e7SJohn McNamara
45858abf6e7SJohn McNamara* ``DPDK_BUILD_TEST_CONFIGS`` (target1+option1+option2 target2)
45958abf6e7SJohn McNamara* ``DPDK_DEP_CFLAGS``
46058abf6e7SJohn McNamara* ``DPDK_DEP_LDFLAGS``
46158abf6e7SJohn McNamara* ``DPDK_DEP_PCAP`` (y/[n])
46258abf6e7SJohn McNamara* ``DPDK_NOTIFY`` (notify-send)
46358abf6e7SJohn McNamara
46458abf6e7SJohn McNamaraThese can be set from the command line or in the config files shown above in the :ref:`contrib_checkpatch`.
46558abf6e7SJohn McNamara
46658abf6e7SJohn McNamaraThe recommended configurations and options to test compilation prior to submitting patches are::
46758abf6e7SJohn McNamara
46858abf6e7SJohn McNamara   x86_64-native-linuxapp-gcc+shared+next
469948fd64bSPanu Matilainen   x86_64-native-linuxapp-clang+shared
470948fd64bSPanu Matilainen   i686-native-linuxapp-gcc
47158abf6e7SJohn McNamara
47258abf6e7SJohn McNamara   export DPDK_DEP_ZLIB=y
47358abf6e7SJohn McNamara   export DPDK_DEP_PCAP=y
47458abf6e7SJohn McNamara   export DPDK_DEP_SSL=y
47558abf6e7SJohn McNamara
47658abf6e7SJohn McNamara
47758abf6e7SJohn McNamaraSending Patches
47858abf6e7SJohn McNamara---------------
47958abf6e7SJohn McNamara
48058abf6e7SJohn McNamaraPatches should be sent to the mailing list using ``git send-email``.
48158abf6e7SJohn McNamaraYou can configure an external SMTP with something like the following::
48258abf6e7SJohn McNamara
48358abf6e7SJohn McNamara   [sendemail]
48458abf6e7SJohn McNamara       smtpuser = name@domain.com
48558abf6e7SJohn McNamara       smtpserver = smtp.domain.com
48658abf6e7SJohn McNamara       smtpserverport = 465
48758abf6e7SJohn McNamara       smtpencryption = ssl
48858abf6e7SJohn McNamara
48958abf6e7SJohn McNamaraSee the `Git send-email <https://git-scm.com/docs/git-send-email>`_ documentation for more details.
49058abf6e7SJohn McNamara
49158abf6e7SJohn McNamaraThe patches should be sent to ``dev@dpdk.org``.
49258abf6e7SJohn McNamaraIf the patches are a change to existing files then you should send them TO the maintainer(s) and CC ``dev@dpdk.org``.
49358abf6e7SJohn McNamaraThe appropriate maintainer can be found in the ``MAINTAINERS`` file::
49458abf6e7SJohn McNamara
49558abf6e7SJohn McNamara   git send-email --to maintainer@some.org --cc dev@dpdk.org 000*.patch
49658abf6e7SJohn McNamara
4977a629106SFerruh YigitScript ``get-maintainer.sh`` can be used to select maintainers automatically::
4987a629106SFerruh Yigit
4997a629106SFerruh Yigit  git send-email --to-cmd ./devtools/get-maintainer.sh --cc dev@dpdk.org 000*.patch
5007a629106SFerruh Yigit
50158abf6e7SJohn McNamaraNew additions can be sent without a maintainer::
50258abf6e7SJohn McNamara
50358abf6e7SJohn McNamara   git send-email --to dev@dpdk.org 000*.patch
50458abf6e7SJohn McNamara
50558abf6e7SJohn McNamaraYou can test the emails by sending it to yourself or with the ``--dry-run`` option.
50658abf6e7SJohn McNamara
50758abf6e7SJohn McNamaraIf the patch is in relation to a previous email thread you can add it to the same thread using the Message ID::
50858abf6e7SJohn McNamara
50958abf6e7SJohn McNamara   git send-email --to dev@dpdk.org --in-reply-to <1234-foo@bar.com> 000*.patch
51058abf6e7SJohn McNamara
51158abf6e7SJohn McNamaraThe Message ID can be found in the raw text of emails or at the top of each Patchwork patch,
51258abf6e7SJohn McNamara`for example <http://dpdk.org/dev/patchwork/patch/7646/>`_.
51358abf6e7SJohn McNamaraShallow threading (``--thread --no-chain-reply-to``) is preferred for a patch series.
51458abf6e7SJohn McNamara
51558abf6e7SJohn McNamaraOnce submitted your patches will appear on the mailing list and in Patchwork.
51658abf6e7SJohn McNamara
51758abf6e7SJohn McNamaraExperienced committers may send patches directly with ``git send-email`` without the ``git format-patch`` step.
51858abf6e7SJohn McNamaraThe options ``--annotate`` and ``confirm = always`` are recommended for checking patches before sending.
51958abf6e7SJohn McNamara
52058abf6e7SJohn McNamara
521d53f61b6SLuca BoccassiBackporting patches for Stable Releases
522d53f61b6SLuca Boccassi~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
523d53f61b6SLuca Boccassi
524d53f61b6SLuca BoccassiSometimes a maintainer or contributor wishes, or can be asked, to send a patch
525d53f61b6SLuca Boccassifor a stable release rather than mainline.
526d53f61b6SLuca BoccassiIn this case the patch(es) should be sent to ``stable@dpdk.org``,
527d53f61b6SLuca Boccassinot to ``dev@dpdk.org``.
528d53f61b6SLuca Boccassi
529d53f61b6SLuca BoccassiGiven that there are multiple stable releases being maintained at the same time,
530d53f61b6SLuca Boccassiplease specify exactly which branch(es) the patch is for
531d53f61b6SLuca Boccassiusing ``git send-email --subject-prefix='PATCH 16.11' ...``
532d53f61b6SLuca Boccassiand also optionally in the cover letter or in the annotation.
533d53f61b6SLuca Boccassi
534d53f61b6SLuca Boccassi
53558abf6e7SJohn McNamaraThe Review Process
53658abf6e7SJohn McNamara------------------
53758abf6e7SJohn McNamara
5384aeedc25SHarry van HaarenPatches are reviewed by the community, relying on the experience and
5394aeedc25SHarry van Haarencollaboration of the members to double-check each other's work. There are a
5404aeedc25SHarry van Haarennumber of ways to indicate that you have checked a patch on the mailing list.
54158abf6e7SJohn McNamara
5424aeedc25SHarry van Haaren
5434aeedc25SHarry van HaarenTested, Acked and Reviewed by
5444aeedc25SHarry van Haaren~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5454aeedc25SHarry van Haaren
5464aeedc25SHarry van HaarenTo indicate that you have interacted with a patch on the mailing list you
5474aeedc25SHarry van Haarenshould respond to the patch in an email with one of the following tags:
5484aeedc25SHarry van Haaren
5494aeedc25SHarry van Haaren * Reviewed-by:
5504aeedc25SHarry van Haaren * Acked-by:
5514aeedc25SHarry van Haaren * Tested-by:
5524aeedc25SHarry van Haaren * Reported-by:
5534aeedc25SHarry van Haaren * Suggested-by:
5544aeedc25SHarry van Haaren
5554aeedc25SHarry van HaarenThe tag should be on a separate line as follows::
5564aeedc25SHarry van Haaren
5574aeedc25SHarry van Haaren   tag-here: Name Surname <email@address.com>
5584aeedc25SHarry van Haaren
5594aeedc25SHarry van HaarenEach of these tags has a specific meaning. In general, the DPDK community
5604aeedc25SHarry van Haarenfollows the kernel usage of the tags. A short summary of the meanings of each
5614aeedc25SHarry van Haarentag is given here for reference:
5624aeedc25SHarry van Haaren
5634aeedc25SHarry van Haaren.. _statement: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#reviewer-s-statement-of-oversight
5644aeedc25SHarry van Haaren
5654aeedc25SHarry van Haaren``Reviewed-by:`` is a strong statement_ that the patch is an appropriate state
5664aeedc25SHarry van Haarenfor merging without any remaining serious technical issues. Reviews from
5674aeedc25SHarry van Haarencommunity members who are known to understand the subject area and to perform
5684aeedc25SHarry van Haarenthorough reviews will increase the likelihood of the patch getting merged.
5694aeedc25SHarry van Haaren
5704aeedc25SHarry van Haaren``Acked-by:`` is a record that the person named was not directly involved in
5714aeedc25SHarry van Haarenthe preparation of the patch but wishes to signify and record their acceptance
5724aeedc25SHarry van Haarenand approval of it.
5734aeedc25SHarry van Haaren
5744aeedc25SHarry van Haaren``Tested-by:`` indicates that the patch has been successfully tested (in some
5754aeedc25SHarry van Haarenenvironment) by the person named.
5764aeedc25SHarry van Haaren
5774aeedc25SHarry van Haaren``Reported-by:`` is used to acknowledge person who found or reported the bug.
5784aeedc25SHarry van Haaren
5794aeedc25SHarry van Haaren``Suggested-by:`` indicates that the patch idea was suggested by the named
5804aeedc25SHarry van Haarenperson.
5814aeedc25SHarry van Haaren
5824aeedc25SHarry van Haaren
5834aeedc25SHarry van Haaren
5844aeedc25SHarry van HaarenSteps to getting your patch merged
5854aeedc25SHarry van Haaren~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5864aeedc25SHarry van Haaren
5874aeedc25SHarry van HaarenThe more work you put into the previous steps the easier it will be to get a
5884aeedc25SHarry van Haarenpatch accepted. The general cycle for patch review and acceptance is:
58958abf6e7SJohn McNamara
59058abf6e7SJohn McNamara#. Submit the patch.
59158abf6e7SJohn McNamara
59258abf6e7SJohn McNamara#. Check the automatic test reports in the coming hours.
59358abf6e7SJohn McNamara
59458abf6e7SJohn McNamara#. Wait for review comments. While you are waiting review some other patches.
59558abf6e7SJohn McNamara
59658abf6e7SJohn McNamara#. Fix the review comments and submit a ``v n+1`` patchset::
59758abf6e7SJohn McNamara
59858abf6e7SJohn McNamara      git format-patch -3 -v 2
59958abf6e7SJohn McNamara
60058abf6e7SJohn McNamara#. Update Patchwork to mark your previous patches as "Superseded".
60158abf6e7SJohn McNamara
60258abf6e7SJohn McNamara#. If the patch is deemed suitable for merging by the relevant maintainer(s) or other developers they will ``ack``
60358abf6e7SJohn McNamara   the patch with an email that includes something like::
60458abf6e7SJohn McNamara
60558abf6e7SJohn McNamara      Acked-by: Alex Smith <alex.smith@example.com>
60658abf6e7SJohn McNamara
60758abf6e7SJohn McNamara   **Note**: When acking patches please remove as much of the text of the patch email as possible.
60858abf6e7SJohn McNamara   It is generally best to delete everything after the ``Signed-off-by:`` line.
60958abf6e7SJohn McNamara
61058abf6e7SJohn McNamara#. Having the patch ``Reviewed-by:`` and/or ``Tested-by:`` will also help the patch to be accepted.
61158abf6e7SJohn McNamara
61258abf6e7SJohn McNamara#. If the patch isn't deemed suitable based on being out of scope or conflicting with existing functionality
61358abf6e7SJohn McNamara   it may receive a ``nack``.
61458abf6e7SJohn McNamara   In this case you will need to make a more convincing technical argument in favor of your patches.
61558abf6e7SJohn McNamara
61658abf6e7SJohn McNamara#. In addition a patch will not be accepted if it doesn't address comments from a previous version with fixes or
61758abf6e7SJohn McNamara   valid arguments.
61858abf6e7SJohn McNamara
6197968191bSBruce Richardson#. It is the responsibility of a maintainer to ensure that patches are reviewed and to provide an ``ack`` or
6207968191bSBruce Richardson   ``nack`` of those patches as appropriate.
6217968191bSBruce Richardson
6227968191bSBruce Richardson#. Once a patch has been acked by the relevant maintainer, reviewers may still comment on it for a further
6237968191bSBruce Richardson   two weeks. After that time, the patch should be merged into the relevant git tree for the next release.
6247968191bSBruce Richardson   Additional notes and restrictions:
6257968191bSBruce Richardson
6267968191bSBruce Richardson   * Patches should be acked by a maintainer at least two days before the release merge
6277968191bSBruce Richardson     deadline, in order to make that release.
6287968191bSBruce Richardson   * For patches acked with less than two weeks to go to the merge deadline, all additional
6297968191bSBruce Richardson     comments should be made no later than two days before the merge deadline.
6307968191bSBruce Richardson   * After the appropriate time for additional feedback has passed, if the patch has not yet
6317968191bSBruce Richardson     been merged to the relevant tree by the committer, it should be treated as though it had,
6327968191bSBruce Richardson     in that any additional changes needed to it must be addressed by a follow-on patch, rather
6337968191bSBruce Richardson     than rework of the original.
6347968191bSBruce Richardson   * Trivial patches may be merged sooner than described above at the tree committer's
6357968191bSBruce Richardson     discretion.
6363a99ac9dSCiara Power
6373a99ac9dSCiara PowerDPDK Maintainers
6383a99ac9dSCiara Power----------------
6393a99ac9dSCiara Power
6403a99ac9dSCiara PowerThe following are the DPDK maintainers as listed in the ``MAINTAINERS`` file
6413a99ac9dSCiara Powerin the DPDK root directory.
6423a99ac9dSCiara Power
6433a99ac9dSCiara Power.. literalinclude:: ../../../MAINTAINERS
6443a99ac9dSCiara Power   :lines: 3-
645