xref: /linux/Documentation/process/maintainer-netdev.rst (revision cc7a4a3138a4df44b83940afbe2de330173cc28c)
1.. SPDX-License-Identifier: GPL-2.0
2
3.. _netdev-FAQ:
4
5=============================
6Networking subsystem (netdev)
7=============================
8
9tl;dr
10-----
11
12 - designate your patch to a tree - ``[PATCH net]`` or ``[PATCH net-next]``
13 - for fixes the ``Fixes:`` tag is required, regardless of the tree
14 - don't post large series (> 15 patches), break them up
15 - don't repost your patches within one 24h period
16 - reverse xmas tree
17
18netdev
19------
20
21netdev is a mailing list for all network-related Linux stuff.  This
22includes anything found under net/ (i.e. core code like IPv6) and
23drivers/net (i.e. hardware specific drivers) in the Linux source tree.
24
25Note that some subsystems (e.g. wireless drivers) which have a high
26volume of traffic have their own specific mailing lists and trees.
27
28Like many other Linux mailing lists, the netdev list is hosted at
29kernel.org with archives available at https://lore.kernel.org/netdev/.
30
31Aside from subsystems like those mentioned above, all network-related
32Linux development (i.e. RFC, review, comments, etc.) takes place on
33netdev.
34
35Development cycle
36-----------------
37
38Here is a bit of background information on
39the cadence of Linux development.  Each new release starts off with a
40two week "merge window" where the main maintainers feed their new stuff
41to Linus for merging into the mainline tree.  After the two weeks, the
42merge window is closed, and it is called/tagged ``-rc1``.  No new
43features get mainlined after this -- only fixes to the rc1 content are
44expected.  After roughly a week of collecting fixes to the rc1 content,
45rc2 is released.  This repeats on a roughly weekly basis until rc7
46(typically; sometimes rc6 if things are quiet, or rc8 if things are in a
47state of churn), and a week after the last vX.Y-rcN was done, the
48official vX.Y is released.
49
50To find out where we are now in the cycle - load the mainline (Linus)
51page here:
52
53  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
54
55and note the top of the "tags" section.  If it is rc1, it is early in
56the dev cycle.  If it was tagged rc7 a week ago, then a release is
57probably imminent. If the most recent tag is a final release tag
58(without an ``-rcN`` suffix) - we are most likely in a merge window
59and ``net-next`` is closed.
60
61git trees and patch flow
62------------------------
63
64There are two networking trees (git repositories) in play.  Both are
65driven by David Miller, the main network maintainer.  There is the
66``net`` tree, and the ``net-next`` tree.  As you can probably guess from
67the names, the ``net`` tree is for fixes to existing code already in the
68mainline tree from Linus, and ``net-next`` is where the new code goes
69for the future release.  You can find the trees here:
70
71- https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
72- https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
73
74Relating that to kernel development: At the beginning of the 2-week
75merge window, the ``net-next`` tree will be closed - no new changes/features.
76The accumulated new content of the past ~10 weeks will be passed onto
77mainline/Linus via a pull request for vX.Y -- at the same time, the
78``net`` tree will start accumulating fixes for this pulled content
79relating to vX.Y
80
81An announcement indicating when ``net-next`` has been closed is usually
82sent to netdev, but knowing the above, you can predict that in advance.
83
84.. warning::
85  Do not send new ``net-next`` content to netdev during the
86  period during which ``net-next`` tree is closed.
87
88RFC patches sent for review only are obviously welcome at any time
89(use ``--subject-prefix='RFC net-next'`` with ``git format-patch``).
90
91Shortly after the two weeks have passed (and vX.Y-rc1 is released), the
92tree for ``net-next`` reopens to collect content for the next (vX.Y+1)
93release.
94
95If you aren't subscribed to netdev and/or are simply unsure if
96``net-next`` has re-opened yet, simply check the ``net-next`` git
97repository link above for any new networking-related commits.  You may
98also check the following website for the current status:
99
100  https://netdev.bots.linux.dev/net-next.html
101
102The ``net`` tree continues to collect fixes for the vX.Y content, and is
103fed back to Linus at regular (~weekly) intervals.  Meaning that the
104focus for ``net`` is on stabilization and bug fixes.
105
106Finally, the vX.Y gets released, and the whole cycle starts over.
107
108netdev patch review
109-------------------
110
111.. _patch_status:
112
113Patch status
114~~~~~~~~~~~~
115
116Status of a patch can be checked by looking at the main patchwork
117queue for netdev:
118
119  https://patchwork.kernel.org/project/netdevbpf/list/
120
121The "State" field will tell you exactly where things are at with your
122patch:
123
124================== =============================================================
125Patch state        Description
126================== =============================================================
127New, Under review  pending review, patch is in the maintainer’s queue for
128                   review; the two states are used interchangeably (depending on
129                   the exact co-maintainer handling patchwork at the time)
130Accepted           patch was applied to the appropriate networking tree, this is
131                   usually set automatically by the pw-bot
132Needs ACK          waiting for an ack from an area expert or testing
133Changes requested  patch has not passed the review, new revision is expected
134                   with appropriate code and commit message changes
135Rejected           patch has been rejected and new revision is not expected
136Not applicable     patch is expected to be applied outside of the networking
137                   subsystem
138Awaiting upstream  patch should be reviewed and handled by appropriate
139                   sub-maintainer, who will send it on to the networking trees;
140                   patches set to ``Awaiting upstream`` in netdev's patchwork
141                   will usually remain in this state, whether the sub-maintainer
142                   requested changes, accepted or rejected the patch
143Deferred           patch needs to be reposted later, usually due to dependency
144                   or because it was posted for a closed tree
145Superseded         new version of the patch was posted, usually set by the
146                   pw-bot
147RFC                not to be applied, usually not in maintainer’s review queue,
148                   pw-bot can automatically set patches to this state based
149                   on subject tags
150================== =============================================================
151
152Patches are indexed by the ``Message-ID`` header of the emails
153which carried them so if you have trouble finding your patch append
154the value of ``Message-ID`` to the URL above.
155
156Updating patch status
157~~~~~~~~~~~~~~~~~~~~~
158
159Contributors and reviewers do not have the permissions to update patch
160state directly in patchwork. Patchwork doesn't expose much information
161about the history of the state of patches, therefore having multiple
162people update the state leads to confusion.
163
164Instead of delegating patchwork permissions netdev uses a simple mail
165bot which looks for special commands/lines within the emails sent to
166the mailing list. For example to mark a series as Changes Requested
167one needs to send the following line anywhere in the email thread::
168
169  pw-bot: changes-requested
170
171As a result the bot will set the entire series to Changes Requested.
172This may be useful when author discovers a bug in their own series
173and wants to prevent it from getting applied.
174
175The use of the bot is entirely optional, if in doubt ignore its existence
176completely. Maintainers will classify and update the state of the patches
177themselves. No email should ever be sent to the list with the main purpose
178of communicating with the bot, the bot commands should be seen as metadata.
179
180The use of the bot is restricted to authors of the patches (the ``From:``
181header on patch submission and command must match!), maintainers of
182the modified code according to the MAINTAINERS file (again, ``From:``
183must match the MAINTAINERS entry) and a handful of senior reviewers.
184
185Bot records its activity here:
186
187  https://netdev.bots.linux.dev/pw-bot.html
188
189Review timelines
190~~~~~~~~~~~~~~~~
191
192Generally speaking, the patches get triaged quickly (in less than
19348h). But be patient, if your patch is active in patchwork (i.e. it's
194listed on the project's patch list) the chances it was missed are close to zero.
195
196The high volume of development on netdev makes reviewers move on
197from discussions relatively quickly. New comments and replies
198are very unlikely to arrive after a week of silence. If a patch
199is no longer active in patchwork and the thread went idle for more
200than a week - clarify the next steps and/or post the next version.
201
202For RFC postings specifically, if nobody responded in a week - reviewers
203either missed the posting or have no strong opinions. If the code is ready,
204repost as a PATCH.
205
206There are 2 services actively providing LLM-generated review on posted patches:
207
208- https://sashiko.dev/
209- https://netdev-ai.bots.linux.dev/sashiko/
210
211both use the Sashiko infrastructure on top of different models. Reviews are
212available after 24h. Patch authors are expected to proactively look into the
213AI-generated reviews and handle such feedback as any other kind of review:
214either debate it or address it. In both cases a reply on the mailing list is
215expected.
216
217Authors are strongly encouraged to run LLM reviews on the posted patches in
218advance of the actual post. Large series triggering a significant amount of
219AI-generated feedback will likely get little attention from maintainers and
220reviewers.
221
222Emails saying just "ping" or "bump" are considered rude. If you can't figure
223out the status of the patch from patchwork or where the discussion has
224landed - describe your best guess and ask if it's correct. For example::
225
226  I don't understand what the next steps are. Person X seems to be unhappy
227  with A, should I do B and repost the patches?
228
229Don't reach out to maintainers or reviewers via private email and/or other
230communications channels: all the discussion must remain public, and
231requesting special attention is unfair towards the community, at best.
232
233.. _Changes requested:
234
235Changes requested
236~~~~~~~~~~~~~~~~~
237
238Patches :ref:`marked<patch_status>` as ``Changes Requested`` need
239to be revised. The new version should come with a change log,
240preferably including links to previous postings, for example::
241
242  [PATCH net-next v3] net: make cows go moo
243
244  Even users who don't drink milk appreciate hearing the cows go "moo".
245
246  The amount of mooing will depend on packet rate so should match
247  the diurnal cycle quite well.
248
249  Signed-off-by: Joe Defarmer <joe@barn.org>
250  ---
251  v3:
252    - add a note about time-of-day mooing fluctuation to the commit message
253  v2: https://lore.kernel.org/netdev/123themessageid@barn.org/
254    - fix missing argument in kernel doc for netif_is_bovine()
255    - fix memory leak in netdev_register_cow()
256  v1: https://lore.kernel.org/netdev/456getstheclicks@barn.org/
257
258The commit message should be revised to answer any questions reviewers
259had to ask in previous discussions. Occasionally the update of
260the commit message will be the only change in the new version.
261
262Partial resends
263~~~~~~~~~~~~~~~
264
265Please always resend the entire patch series and make sure you do number your
266patches such that it is clear this is the latest and greatest set of patches
267that can be applied. Do not try to resend just the patches which changed.
268
269Handling misapplied patches
270~~~~~~~~~~~~~~~~~~~~~~~~~~~
271
272Occasionally a patch series gets applied before receiving critical feedback,
273or the wrong version of a series gets applied.
274
275Making the patch disappear once it is pushed out is not possible, the commit
276history in netdev trees is immutable.
277Please send incremental versions on top of what has been merged in order to fix
278the patches the way they would look like if your latest patch series was to be
279merged.
280
281In cases where full revert is needed the revert has to be submitted
282as a patch to the list with a commit message explaining the technical
283problems with the reverted commit. Reverts should be used as a last resort,
284when original change is completely wrong; incremental fixes are preferred.
285
286Bug fixes
287~~~~~~~~~
288
289All bug fixes must state how the issue was discovered and validated,
290and how the fix was tested. This should be done in plain English, not with
291special tags or annotations. That said, the information does not have to be
292provided if the existing trailers imply it (e.g. ``Reported-by: syzbot...``
293implies the discovery method and validation).
294
295Example statements describing discovery:
296
297 - discovered by a non-AI static analysis tool
298 - discovered by an AI code review agent
299 - discovered by manual code inspection
300 - triggered during code development
301 - triggered in CI testing
302 - observed on a machine in real use
303
304If the discovery method does not imply the issue was triggered, the commit
305message should describe the validation, i.e. how the bug was confirmed
306to be real. The commit message must disclose whether reproducing the issue
307required modifying the kernel (e.g. inserting a delay to widen a race, or
308writing a loadable module to issue the right sequence of calls) or using error
309injection. The reproduction steps should be included in the commit message
310if they are short (roughly 10 lines or fewer); longer reproducers can be posted
311online with a link included.
312
313The testing statement should explain whether the fix was tested against the
314reproducer and against kernel selftests. If the bug is in a hardware driver,
315the testing statement must include information about the HW on which the
316fix was tested.
317
318Stable tree
319~~~~~~~~~~~
320
321While it used to be the case that netdev submissions were not supposed
322to carry explicit ``CC: stable@vger.kernel.org`` tags that is no longer
323the case today. Please follow the standard stable rules in
324:ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`,
325and make sure you include appropriate Fixes tags!
326
327Security fixes
328~~~~~~~~~~~~~~
329
330Do not email netdev maintainers directly if you think you discovered
331a bug that might have possible security implications.
332The current netdev maintainer has consistently requested that
333people use the mailing lists and not reach out directly.  If you aren't
334OK with that, then perhaps consider mailing security@kernel.org or
335reading about http://oss-security.openwall.org/wiki/mailing-lists/distros
336as possible alternative mechanisms.
337
338
339Co-posting changes to user space components
340~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
341
342User space code exercising kernel features should be posted
343alongside kernel patches. This gives reviewers a chance to see
344how any new interface is used and how well it works.
345
346When user space tools reside in the kernel repo itself all changes
347should generally come as one series. If series becomes too large
348or the user space project is not reviewed on netdev include a link
349to a public repo where user space patches can be seen.
350
351In case user space tooling lives in a separate repository but is
352reviewed on netdev  (e.g. patches to ``iproute2`` tools) kernel and
353user space patches should form separate series (threads) when posted
354to the mailing list, e.g.::
355
356  [PATCH net-next 0/3] net: some feature cover letter
357   └─ [PATCH net-next 1/3] net: some feature prep
358   └─ [PATCH net-next 2/3] net: some feature do it
359   └─ [PATCH net-next 3/3] selftest: net: some feature
360
361  [PATCH iproute2-next] ip: add support for some feature
362
363Posting as one thread is discouraged because it confuses patchwork
364(as of patchwork 2.2.2).
365
366Co-posting selftests
367~~~~~~~~~~~~~~~~~~~~
368
369Selftests should be part of the same series as the code changes.
370Specifically for fixes both code change and related test should go into
371the same tree (the tests may lack a Fixes tag, which is expected).
372Mixing code changes and test changes in a single commit is discouraged.
373
374Preparing changes
375-----------------
376
377Attention to detail is important.  Re-read your own work as if you were the
378reviewer.  You can start with using ``checkpatch.pl``, perhaps even with
379the ``--strict`` flag.  But do not be mindlessly robotic in doing so.
380If your change is a bug fix, make sure your commit log indicates the
381end-user visible symptom, the underlying reason as to why it happens,
382and then if necessary, explain why the fix proposed is the best way to
383get things done.  Don't mangle whitespace, and as is common, don't
384mis-indent function arguments that span multiple lines.  If it is your
385first patch, mail it to yourself so you can test apply it to an
386unpatched tree to confirm infrastructure didn't mangle it.
387
388Finally, go back and read
389:ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
390to be sure you are not repeating some common mistake documented there.
391
392Indicating target tree
393~~~~~~~~~~~~~~~~~~~~~~
394
395To help maintainers and CI bots you should explicitly mark which tree
396your patch is targeting. Assuming that you use git, use the prefix
397flag::
398
399  git format-patch --subject-prefix='PATCH net-next' start..finish
400
401Use ``net`` instead of ``net-next`` (always lower case) in the above for
402bug-fix ``net`` content.
403
404Dividing work into patches
405~~~~~~~~~~~~~~~~~~~~~~~~~~
406
407Put yourself in the shoes of the reviewer. Each patch is read separately
408and therefore should constitute a comprehensible step towards your stated
409goal.
410
411Avoid sending series longer than 15 patches. Larger series takes longer
412to review as reviewers will defer looking at it until they find a large
413chunk of time. A small series can be reviewed in a short time, so Maintainers
414just do it. As a result, a sequence of smaller series gets merged quicker and
415with better review coverage. Re-posting large series also increases the mailing
416list traffic.
417
418Limit patches outstanding on mailing list
419-----------------------------------------
420
421Avoid having more than 15 patches, across all series, outstanding for
422review on the mailing list for a single tree. In other words, a maximum of
42315 patches under review on net, and a maximum of 15 patches under review on
424net-next.
425
426This limit is intended to focus developer effort on testing patches before
427upstream review. Aiding the quality of upstream submissions, and easing the
428load on reviewers.
429
430.. _rcs:
431
432Local variable ordering ("reverse xmas tree", "RCS")
433~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
434
435Netdev has a convention for ordering local variables in functions.
436Order the variable declaration lines longest to shortest, e.g.::
437
438  struct scatterlist *sg;
439  struct sk_buff *skb;
440  int err, i;
441
442If there are dependencies between the variables preventing the ordering
443move the initialization out of line.
444
445Format precedence
446~~~~~~~~~~~~~~~~~
447
448When working in existing code which uses nonstandard formatting make
449your code follow the most recent guidelines, so that eventually all code
450in the domain of netdev is in the preferred format.
451
452Using device-managed and cleanup.h constructs
453~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
454
455Netdev remains skeptical about promises of all "auto-cleanup" APIs,
456including even ``devm_`` helpers, historically. They are not the preferred
457style of implementation, merely an acceptable one.
458
459Use of ``guard()`` is discouraged within any function longer than 20 lines,
460``scoped_guard()`` is considered more readable. Using normal lock/unlock is
461still (weakly) preferred.
462
463Low level cleanup constructs (such as ``__free()``) can be used when building
464APIs and helpers, especially scoped iterators. However, direct use of
465``__free()`` within networking core and drivers is discouraged.
466Similar guidance applies to declaring variables mid-function.
467
468Clean-up patches
469~~~~~~~~~~~~~~~~
470
471Netdev discourages patches which perform simple clean-ups, which are not in
472the context of other work. For example:
473
474* Addressing ``checkpatch.pl``, and other trivial coding style warnings
475* Addressing :ref:`Local variable ordering<rcs>` issues
476* Conversions to device-managed APIs (``devm_`` helpers)
477
478This is because it is felt that the churn that such changes produce comes
479at a greater cost than the value of such clean-ups.
480
481Conversely, spelling and grammar fixes are not discouraged.
482
483Resending after review
484~~~~~~~~~~~~~~~~~~~~~~
485
486Allow at least 24 hours to pass between postings. This will ensure reviewers
487from all geographical locations have a chance to chime in. Do not wait
488too long (weeks) between postings either as it will make it harder for reviewers
489to recall all the context.
490
491Make sure you address all the feedback in your new posting. Do not post a new
492version of the code if the discussion about the previous version is still
493ongoing, unless directly instructed by a reviewer.
494
495The new version of patches should be posted as a separate thread,
496not as a reply to the previous posting. Change log should include a link
497to the previous posting (see :ref:`Changes requested`).
498
499Testing
500-------
501
502Expected level of testing
503~~~~~~~~~~~~~~~~~~~~~~~~~
504
505At the very minimum your changes must survive an ``allyesconfig`` and an
506``allmodconfig`` build with ``W=1`` set without new warnings or failures.
507
508Ideally you will have done run-time testing specific to your change,
509and the patch series contains a set of kernel selftest for
510``tools/testing/selftests/net`` or using the KUnit framework.
511
512You are expected to test your changes on top of the relevant networking
513tree (``net`` or ``net-next``) and not e.g. a stable tree or ``linux-next``.
514
515patchwork checks
516~~~~~~~~~~~~~~~~
517
518Checks in patchwork are mostly simple wrappers around existing kernel
519scripts, the sources are available at:
520
521https://github.com/linux-netdev/nipa/tree/master/tests
522
523**Do not** post your patches just to run them through the checks.
524You must ensure that your patches are ready by testing them locally
525before posting to the mailing list. The patchwork build bot instance
526gets overloaded very easily and netdev@vger really doesn't need more
527traffic if we can help it.
528
529netdevsim
530~~~~~~~~~
531
532``netdevsim`` is a test driver which can be used to exercise driver
533configuration APIs without requiring capable hardware.
534Mock-ups and tests based on ``netdevsim`` are encouraged when
535adding new APIs with complex logic in the stack. The tests should
536be written so that they can run both against ``netdevsim`` and a real
537device (see ``tools/testing/selftests/drivers/net/README.rst``).
538``netdevsim``-only tests should focus on testing corner cases
539and failure paths in the core which are hard to exercise with a real driver.
540
541``netdevsim`` in itself is **not** considered
542a use case/user. You must also implement the new APIs in a real driver.
543
544We give no guarantees that ``netdevsim`` won't change in the future
545in a way which would break what would normally be considered uAPI.
546
547``netdevsim`` is reserved for use by upstream tests only, so any
548new ``netdevsim`` features must be accompanied by selftests under
549``tools/testing/selftests/``.
550
551Supported status for drivers
552----------------------------
553
554.. note: The following requirements apply only to Ethernet NIC drivers.
555
556Netdev defines additional requirements for drivers which want to acquire
557the ``Supported`` status in the MAINTAINERS file. ``Supported`` drivers must
558be running all upstream driver tests and reporting the results twice a day.
559Drivers which do not comply with this requirement should use the ``Maintained``
560status. There is currently no difference in how ``Supported`` and ``Maintained``
561drivers are treated upstream.
562
563The exact rules a driver must follow to acquire the ``Supported`` status:
564
5651. Must run all tests under ``drivers/net`` and ``drivers/net/hw`` targets
566   of Linux selftests. Running and reporting private / internal tests is
567   also welcome, but upstream tests are a must.
568
5692. The minimum run frequency is once every 12 hours. Must test the
570   designated branch from the selected branch feed. Note that branches
571   are auto-constructed and exposed to intentional malicious patch posting,
572   so the test systems must be isolated.
573
5743. Drivers supporting multiple generations of devices must test at
575   least one device from each generation. A testbed manifest (exact
576   format TBD) should describe the device models tested.
577
5784. The tests must run reliably, if multiple branches are skipped or tests
579   are failing due to execution environment problems the ``Supported``
580   status will be withdrawn.
581
5825. Test failures due to bugs either in the driver or the test itself,
583   or lack of support for the feature the test is targeting are
584   *not* a basis for losing the ``Supported`` status.
585
586netdev CI will maintain an official page of supported devices, listing their
587recent test results.
588
589The driver maintainer may arrange for someone else to run the test,
590there is no requirement for the person listed as maintainer (or their
591employer) to be responsible for running the tests. Collaboration between
592vendors, hosting GH CI, other repos under linux-netdev, etc. is most welcome.
593
594See https://github.com/linux-netdev/nipa/wiki for more information about
595netdev CI. Feel free to reach out to maintainers or the list with any questions.
596
597Reviewer guidance
598-----------------
599
600Reviewing other people's patches on the list is highly encouraged,
601regardless of the level of expertise. For general guidance and
602helpful tips please see :ref:`development_advancedtopics_reviews`.
603
604It's safe to assume that netdev maintainers know the community and the level
605of expertise of the reviewers. The reviewers should not be concerned about
606their comments impeding or derailing the patch flow. A Reviewed-by tag
607is understood to mean "I have reviewed this code to the best of my ability"
608rather than "I can attest this code is correct".
609
610Reviewers are highly encouraged to do more in-depth review of submissions
611and not focus exclusively on process issues, trivial or subjective
612matters like code formatting, tags etc.
613
614Testimonials / feedback
615-----------------------
616
617Some companies use peer feedback in employee performance reviews.
618Please feel free to request feedback from netdev maintainers,
619especially if you spend significant amount of time reviewing code
620and go out of your way to improve shared infrastructure.
621
622The feedback must be requested by you, the contributor, and will always
623be shared with you (even if you request for it to be submitted to your
624manager).
625