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
28The netdev list is managed (like many other Linux mailing lists) through
29VGER (http://vger.kernel.org/) with archives available at
30https://lore.kernel.org/netdev/
31
32Aside from subsystems like those mentioned above, all network-related
33Linux development (i.e. RFC, review, comments, etc.) takes place on
34netdev.
35
36Development cycle
37-----------------
38
39Here is a bit of background information on
40the cadence of Linux development.  Each new release starts off with a
41two week "merge window" where the main maintainers feed their new stuff
42to Linus for merging into the mainline tree.  After the two weeks, the
43merge window is closed, and it is called/tagged ``-rc1``.  No new
44features get mainlined after this -- only fixes to the rc1 content are
45expected.  After roughly a week of collecting fixes to the rc1 content,
46rc2 is released.  This repeats on a roughly weekly basis until rc7
47(typically; sometimes rc6 if things are quiet, or rc8 if things are in a
48state of churn), and a week after the last vX.Y-rcN was done, the
49official vX.Y is released.
50
51To find out where we are now in the cycle - load the mainline (Linus)
52page here:
53
54  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
55
56and note the top of the "tags" section.  If it is rc1, it is early in
57the dev cycle.  If it was tagged rc7 a week ago, then a release is
58probably imminent. If the most recent tag is a final release tag
59(without an ``-rcN`` suffix) - we are most likely in a merge window
60and ``net-next`` is closed.
61
62git trees and patch flow
63------------------------
64
65There are two networking trees (git repositories) in play.  Both are
66driven by David Miller, the main network maintainer.  There is the
67``net`` tree, and the ``net-next`` tree.  As you can probably guess from
68the names, the ``net`` tree is for fixes to existing code already in the
69mainline tree from Linus, and ``net-next`` is where the new code goes
70for the future release.  You can find the trees here:
71
72- https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
73- https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
74
75Relating that to kernel development: At the beginning of the 2-week
76merge window, the ``net-next`` tree will be closed - no new changes/features.
77The accumulated new content of the past ~10 weeks will be passed onto
78mainline/Linus via a pull request for vX.Y -- at the same time, the
79``net`` tree will start accumulating fixes for this pulled content
80relating to vX.Y
81
82An announcement indicating when ``net-next`` has been closed is usually
83sent to netdev, but knowing the above, you can predict that in advance.
84
85.. warning::
86  Do not send new ``net-next`` content to netdev during the
87  period during which ``net-next`` tree is closed.
88
89RFC patches sent for review only are obviously welcome at any time
90(use ``--subject-prefix='RFC net-next'`` with ``git format-patch``).
91
92Shortly after the two weeks have passed (and vX.Y-rc1 is released), the
93tree for ``net-next`` reopens to collect content for the next (vX.Y+1)
94release.
95
96If you aren't subscribed to netdev and/or are simply unsure if
97``net-next`` has re-opened yet, simply check the ``net-next`` git
98repository link above for any new networking-related commits.  You may
99also check the following website for the current status:
100
101  http://vger.kernel.org/~davem/net-next.html
102
103The ``net`` tree continues to collect fixes for the vX.Y content, and is
104fed back to Linus at regular (~weekly) intervals.  Meaning that the
105focus for ``net`` is on stabilization and bug fixes.
106
107Finally, the vX.Y gets released, and the whole cycle starts over.
108
109netdev patch review
110-------------------
111
112Patch status
113~~~~~~~~~~~~
114
115Status of a patch can be checked by looking at the main patchwork
116queue for netdev:
117
118  https://patchwork.kernel.org/project/netdevbpf/list/
119
120The "State" field will tell you exactly where things are at with your
121patch. Patches are indexed by the ``Message-ID`` header of the emails
122which carried them so if you have trouble finding your patch append
123the value of ``Message-ID`` to the URL above.
124
125Updating patch status
126~~~~~~~~~~~~~~~~~~~~~
127
128It may be tempting to help the maintainers and update the state of your
129own patches when you post a new version or spot a bug. Please **do not**
130do that.
131Interfering with the patch status on patchwork will only cause confusion. Leave
132it to the maintainer to figure out what is the most recent and current
133version that should be applied. If there is any doubt, the maintainer
134will reply and ask what should be done.
135
136Review timelines
137~~~~~~~~~~~~~~~~
138
139Generally speaking, the patches get triaged quickly (in less than
14048h). But be patient, if your patch is active in patchwork (i.e. it's
141listed on the project's patch list) the chances it was missed are close to zero.
142Asking the maintainer for status updates on your
143patch is a good way to ensure your patch is ignored or pushed to the
144bottom of the priority list.
145
146Partial resends
147~~~~~~~~~~~~~~~
148
149Please always resend the entire patch series and make sure you do number your
150patches such that it is clear this is the latest and greatest set of patches
151that can be applied. Do not try to resend just the patches which changed.
152
153Handling misapplied patches
154~~~~~~~~~~~~~~~~~~~~~~~~~~~
155
156Occasionally a patch series gets applied before receiving critical feedback,
157or the wrong version of a series gets applied.
158There is no revert possible, once it is pushed out, it stays like that.
159Please send incremental versions on top of what has been merged in order to fix
160the patches the way they would look like if your latest patch series was to be
161merged.
162
163Stable tree
164~~~~~~~~~~~
165
166While it used to be the case that netdev submissions were not supposed
167to carry explicit ``CC: stable@vger.kernel.org`` tags that is no longer
168the case today. Please follow the standard stable rules in
169:ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`,
170and make sure you include appropriate Fixes tags!
171
172Security fixes
173~~~~~~~~~~~~~~
174
175Do not email netdev maintainers directly if you think you discovered
176a bug that might have possible security implications.
177The current netdev maintainer has consistently requested that
178people use the mailing lists and not reach out directly.  If you aren't
179OK with that, then perhaps consider mailing security@kernel.org or
180reading about http://oss-security.openwall.org/wiki/mailing-lists/distros
181as possible alternative mechanisms.
182
183
184Co-posting changes to user space components
185~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186
187User space code exercising kernel features should be posted
188alongside kernel patches. This gives reviewers a chance to see
189how any new interface is used and how well it works.
190
191When user space tools reside in the kernel repo itself all changes
192should generally come as one series. If series becomes too large
193or the user space project is not reviewed on netdev include a link
194to a public repo where user space patches can be seen.
195
196In case user space tooling lives in a separate repository but is
197reviewed on netdev  (e.g. patches to ``iproute2`` tools) kernel and
198user space patches should form separate series (threads) when posted
199to the mailing list, e.g.::
200
201  [PATCH net-next 0/3] net: some feature cover letter
202   └─ [PATCH net-next 1/3] net: some feature prep
203   └─ [PATCH net-next 2/3] net: some feature do it
204   └─ [PATCH net-next 3/3] selftest: net: some feature
205
206  [PATCH iproute2-next] ip: add support for some feature
207
208Posting as one thread is discouraged because it confuses patchwork
209(as of patchwork 2.2.2).
210
211Preparing changes
212-----------------
213
214Attention to detail is important.  Re-read your own work as if you were the
215reviewer.  You can start with using ``checkpatch.pl``, perhaps even with
216the ``--strict`` flag.  But do not be mindlessly robotic in doing so.
217If your change is a bug fix, make sure your commit log indicates the
218end-user visible symptom, the underlying reason as to why it happens,
219and then if necessary, explain why the fix proposed is the best way to
220get things done.  Don't mangle whitespace, and as is common, don't
221mis-indent function arguments that span multiple lines.  If it is your
222first patch, mail it to yourself so you can test apply it to an
223unpatched tree to confirm infrastructure didn't mangle it.
224
225Finally, go back and read
226:ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
227to be sure you are not repeating some common mistake documented there.
228
229Indicating target tree
230~~~~~~~~~~~~~~~~~~~~~~
231
232To help maintainers and CI bots you should explicitly mark which tree
233your patch is targeting. Assuming that you use git, use the prefix
234flag::
235
236  git format-patch --subject-prefix='PATCH net-next' start..finish
237
238Use ``net`` instead of ``net-next`` (always lower case) in the above for
239bug-fix ``net`` content.
240
241Dividing work into patches
242~~~~~~~~~~~~~~~~~~~~~~~~~~
243
244Put yourself in the shoes of the reviewer. Each patch is read separately
245and therefore should constitute a comprehensible step towards your stated
246goal.
247
248Avoid sending series longer than 15 patches. Larger series takes longer
249to review as reviewers will defer looking at it until they find a large
250chunk of time. A small series can be reviewed in a short time, so Maintainers
251just do it. As a result, a sequence of smaller series gets merged quicker and
252with better review coverage. Re-posting large series also increases the mailing
253list traffic.
254
255Multi-line comments
256~~~~~~~~~~~~~~~~~~~
257
258Comment style convention is slightly different for networking and most of
259the tree.  Instead of this::
260
261  /*
262   * foobar blah blah blah
263   * another line of text
264   */
265
266it is requested that you make it look like this::
267
268  /* foobar blah blah blah
269   * another line of text
270   */
271
272Local variable ordering ("reverse xmas tree", "RCS")
273~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
274
275Netdev has a convention for ordering local variables in functions.
276Order the variable declaration lines longest to shortest, e.g.::
277
278  struct scatterlist *sg;
279  struct sk_buff *skb;
280  int err, i;
281
282If there are dependencies between the variables preventing the ordering
283move the initialization out of line.
284
285Format precedence
286~~~~~~~~~~~~~~~~~
287
288When working in existing code which uses nonstandard formatting make
289your code follow the most recent guidelines, so that eventually all code
290in the domain of netdev is in the preferred format.
291
292Resending after review
293~~~~~~~~~~~~~~~~~~~~~~
294
295Allow at least 24 hours to pass between postings. This will ensure reviewers
296from all geographical locations have a chance to chime in. Do not wait
297too long (weeks) between postings either as it will make it harder for reviewers
298to recall all the context.
299
300Make sure you address all the feedback in your new posting. Do not post a new
301version of the code if the discussion about the previous version is still
302ongoing, unless directly instructed by a reviewer.
303
304Testing
305-------
306
307Expected level of testing
308~~~~~~~~~~~~~~~~~~~~~~~~~
309
310At the very minimum your changes must survive an ``allyesconfig`` and an
311``allmodconfig`` build with ``W=1`` set without new warnings or failures.
312
313Ideally you will have done run-time testing specific to your change,
314and the patch series contains a set of kernel selftest for
315``tools/testing/selftests/net`` or using the KUnit framework.
316
317You are expected to test your changes on top of the relevant networking
318tree (``net`` or ``net-next``) and not e.g. a stable tree or ``linux-next``.
319
320patchwork checks
321~~~~~~~~~~~~~~~~
322
323Checks in patchwork are mostly simple wrappers around existing kernel
324scripts, the sources are available at:
325
326https://github.com/kuba-moo/nipa/tree/master/tests
327
328**Do not** post your patches just to run them through the checks.
329You must ensure that your patches are ready by testing them locally
330before posting to the mailing list. The patchwork build bot instance
331gets overloaded very easily and netdev@vger really doesn't need more
332traffic if we can help it.
333
334netdevsim
335~~~~~~~~~
336
337``netdevsim`` is a test driver which can be used to exercise driver
338configuration APIs without requiring capable hardware.
339Mock-ups and tests based on ``netdevsim`` are strongly encouraged when
340adding new APIs, but ``netdevsim`` in itself is **not** considered
341a use case/user. You must also implement the new APIs in a real driver.
342
343We give no guarantees that ``netdevsim`` won't change in the future
344in a way which would break what would normally be considered uAPI.
345
346``netdevsim`` is reserved for use by upstream tests only, so any
347new ``netdevsim`` features must be accompanied by selftests under
348``tools/testing/selftests/``.
349
350Testimonials / feedback
351-----------------------
352
353Some companies use peer feedback in employee performance reviews.
354Please feel free to request feedback from netdev maintainers,
355especially if you spend significant amount of time reviewing code
356and go out of your way to improve shared infrastructure.
357
358The feedback must be requested by you, the contributor, and will always
359be shared with you (even if you request for it to be submitted to your
360manager).
361