]> git.proxmox.com Git - mirror_ovs.git/blame - CONTRIBUTING.rst
doc: Populate 'ref' section
[mirror_ovs.git] / CONTRIBUTING.rst
CommitLineData
255efa72
SF
1..
2 Licensed under the Apache License, Version 2.0 (the "License"); you may
3 not use this file except in compliance with the License. You may obtain
4 a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 License for the specific language governing permissions and limitations
12 under the License.
13
14 Convention for heading levels in Open vSwitch documentation:
15
16 ======= Heading 0 (reserved for the title in a document)
17 ------- Heading 1
18 ~~~~~~~ Heading 2
19 +++++++ Heading 3
20 ''''''' Heading 4
21
22 Avoid deeper levels because they do not render well.
23
24============================
25Contributing to Open vSwitch
26============================
27
28Send changes to Open vSwitch as patches to dev@openvswitch.org. One patch per
29email. More details are included below.
30
31If you are using Git, then `git format-patch` takes care of most of the
32mechanics described below for you.
33
34Before You Start
35----------------
36
37Before you send patches at all, make sure that each patch makes sense. In
38particular:
39
40- A given patch should not break anything, even if later patches fix the
41 problems that it causes. The source tree should still build and work after
42 each patch is applied. (This enables `git bisect` to work best.)
43
44- A patch should make one logical change. Don't make multiple, logically
45 unconnected changes to disparate subsystems in a single patch.
46
47- A patch that adds or removes user-visible features should also update the
48 appropriate user documentation or manpages. Check "Feature Deprecation
49 Guidelines" section in this document if you intend to remove user-visible
50 feature.
51
52Testing is also important:
53
54- A patch that modifies existing code should be tested with ``make
55 check`` before submission. Please see the `install guide <INSTALL.rst>`__,
56 under "Self-Tests", for more information.
57
58- A patch that adds or deletes files should also be tested with ``make
59 distcheck`` before submission.
60
61- A patch that modifies Linux kernel code should be at least build-tested on
62 various Linux kernel versions before submission. I suggest versions 3.10 and
63 whatever the current latest release version is at the time.
64
65- A patch that modifies the ofproto or vswitchd code should be tested in at
66 least simple cases before submission.
67
68- A patch that modifies xenserver code should be tested on XenServer before
69 submission.
70
71If you are using GitHub, then you may utilize the travis-ci.org CI build system
72by linking your GitHub repository to it. This will run some of the above tests
73automatically when you push changes to your repository. See the "Continuous
74Integration with Travis-CI" in the `install guide <INSTALL.rst>`__ for details
75on how to set it up.
76
77Email Subject
78-------------
79
80The subject line of your email should be in the following format:
81
82 [PATCH <n>/<m>] <area>: <summary>
83
84Where:
85
86``[PATCH <n>/<m>]``:
87 indicates that this is the nth of a series of m patches. It helps reviewers
88 to read patches in the correct order. You may omit this prefix if you are
89 sending only one patch.
90
91``<area>``:
92 indicates the area of the Open vSwitch to which the change applies (often the
93 name of a source file or a directory). You may omit it if the change crosses
94 multiple distinct pieces of code.
95
96``<summary>``:
92caf188
BP
97
98 briefly describes the change. Use the the imperative form,
99 e.g. "Force SNAT for multiple gateway routers." or "Fix daemon exit
100 for bad datapaths or flows." Try to keep the summary short, about
101 50 characters wide.
255efa72
SF
102
103The subject, minus the ``[PATCH <n>/<m>]`` prefix, becomes the first line of
104the commit's change log message.
105
106Description
107-----------
108
109The body of the email should start with a more thorough description of the
110change. This becomes the body of the commit message, following the subject.
111There is no need to duplicate the summary given in the subject.
112
92caf188
BP
113Please limit lines in the description to 75 characters in width. That
114allows the description to format properly even when indented (e.g. by
115"git log" or in email quotations).
255efa72
SF
116
117The description should include:
118
119- The rationale for the change.
120
121- Design description and rationale (but this might be better added as code
122 comments).
123
124- Testing that you performed (or testing that should be done but you could not
125 for whatever reason).
126
127- Tags (see below).
128
129There is no need to describe what the patch actually changed, if the reader can
130see it for himself.
131
132If the patch refers to a commit already in the Open vSwitch repository, please
133include both the commit number and the subject of the patch, e.g. 'commit
134632d136c (vswitch: Remove restriction on datapath names.)'.
135
136If you, the person sending the patch, did not write the patch yourself, then
137the very first line of the body should take the form ``From: <author name>
138<author email>``, followed by a blank line. This will automatically cause the
139named author to be credited with authorship in the repository.
140
141Tags
142----
143
144The description ends with a series of tags, written one to a line as the last
145paragraph of the email. Each tag indicates some property of the patch in an
146easily machine-parseable manner.
147
148Examples of common tags follow.
149
150``Signed-off-by: Author Name <author.name@email.address...>``
151
152 Informally, this indicates that Author Name is the author or submitter of a
153 patch and has the authority to submit it under the terms of the license. The
154 formal meaning is to agree to the Developer's Certificate of Origin (see
155 below).
156
157 If the author and submitter are different, each must sign off. If the patch
158 has more than one author, all must sign off.
159
160 ::
161
162 Signed-off-by: Author Name <author.name@email.address...>
163 Signed-off-by: Submitter Name <submitter.name@email.address...>
164
165``Co-authored-by: Author Name <author.name@email.address...>``
166
167 Git can only record a single person as the author of a given patch. In the
168 rare event that a patch has multiple authors, one must be given the credit in
169 Git and the others must be credited via Co-authored-by: tags. (All
170 co-authors must also sign off.)
171
172``Acked-by: Reviewer Name <reviewer.name@email.address...>``
173
174 Reviewers will often give an ``Acked-by:`` tag to code of which they approve.
175 It is polite for the submitter to add the tag before posting the next version
176 of the patch or applying the patch to the repository. Quality reviewing is
177 hard work, so this gives a small amount of credit to the reviewer.
178
179 Not all reviewers give ``Acked-by:`` tags when they provide positive reviews.
180 It's customary only to add tags from reviewers who actually provide them
181 explicitly.
182
183``Tested-by: Tester Name <reviewer.name@email.address...>``
184
185 When someone tests a patch, it is customary to add a Tested-by: tag
186 indicating that. It's rare for a tester to actually provide the tag; usually
187 the patch submitter makes the tag himself in response to an email indicating
188 successful testing results.
189
190``Tested-at: <URL>``
191
192 When a test report is publicly available, this provides a way to reference
193 it. Typical <URL>s would be build logs from autobuilders or references to
194 mailing list archives.
195
196 Some autobuilders only retain their logs for a limited amount of time. It is
197 less useful to cite these because they may be dead links for a developer
198 reading the commit message months or years later.
199
200``Reported-by: Reporter Name <reporter.name@email.address...>``
201
202 When a patch fixes a bug reported by some person, please credit the reporter
203 in the commit log in this fashion. Please also add the reporter's name and
204 email address to the list of people who provided helpful bug reports in the
205 AUTHORS file at the top of the source tree.
206
207 Fairly often, the reporter of a bug also tests the fix. Occasionally one
208 sees a combined "Reported-and-tested-by:" tag used to indicate this. It is
209 also acceptable, and more common, to include both tags separately.
210
211 (If a bug report is received privately, it might not always be appropriate to
212 publicly credit the reporter. If in doubt, please ask the reporter.)
213
214``Requested-by: Requester Name <requester.name@email.address...>``
215
216 When a patch implements a request or a suggestion made by some
217 person, please credit that person in the commit log in this
218 fashion. For a helpful suggestion, please also add the
219 person's name and email address to the list of people who
220 provided suggestions in the AUTHORS file at the top of the
221 source tree.
222
223 (If a suggestion or a request is received privately, it might
224 not always be appropriate to publicly give credit. If in
225 doubt, please ask.)
226
227``Suggested-by: Suggester Name <suggester.name@email.address...>``
228
229 See ``Requested-by:``.
230
231``CC: Person <name@email>``
232
233 This is a way to tag a patch for the attention of a person
234 when no more specific tag is appropriate. One use is to
235 request a review from a particular person. It doesn't make
236 sense to include the same person in CC and another tag, so
237 e.g. if someone who is CCed later provides an Acked-by, add
238 the Acked-by and remove the CC at the same time.
239
240``Reported-at: <URL>``
241
242 If a patch fixes or is otherwise related to a bug reported in
243 a public bug tracker, please include a reference to the bug in
244 the form of a URL to the specific bug, e.g.:
245
246 ::
247
248 Reported-at: https://bugs.debian.org/743635
249
250 This is also an appropriate way to refer to bug report emails
251 in public email archives, e.g.:
252
253 ::
254
255 Reported-at: http://openvswitch.org/pipermail/dev/2014-June/040952.html
256
257``Submitted-at: <URL>``
258
259 If a patch was submitted somewhere other than the Open vSwitch
260 development mailing list, such as a GitHub pull request, this header can
261 be used to reference the source.
262
263 ::
264
265 Submitted-at: https://github.com/openvswitch/ovs/pull/92
266
267``VMware-BZ: #1234567``
268
269 If a patch fixes or is otherwise related to a bug reported in
270 a private bug tracker, you may include some tracking ID for
271 the bug for your own reference. Please include some
272 identifier to make the origin clear, e.g. "VMware-BZ" refers
273 to VMware's internal Bugzilla instance and "ONF-JIRA" refers
274 to the Open Networking Foundation's JIRA bug tracker.
275
276``ONF-JIRA: EXT-12345``
277
278 See ``VMware-BZ:``.
279
280``Bug #1234567.``
281
282 These are obsolete forms of VMware-BZ: that can still be seen
283 in old change log entries. (They are obsolete because they do
284 not tell the reader what bug tracker is referred to.)
285
286``Issue: 1234567``
287
288 See ``Bug:``.
289
290``Fixes: 63bc9fb1c69f (“packets: Reorder CS_* flags to remove gap.”)``
291
292 If you would like to record which commit introduced a bug being fixed,
293 you may do that with a “Fixes” header. This assists in determining
294 which OVS releases have the bug, so the patch can be applied to all
295 affected versions. The easiest way to generate the header in the
296 proper format is with this git command. This command also CCs the
297 author of the commit being fixed, which makes sense unless the
298 author also made the fix or is already named in another tag:
299
300 ::
301
302 $ git log -1 --pretty=format:"CC: %an <%ae>%nFixes: %h (\"%s\")" \
303 --abbrev=12 COMMIT_REF
304
305``Vulnerability: CVE-2016-2074``
306
307 Specifies that the patch fixes or is otherwise related to a
308 security vulnerability with the given CVE identifier. Other
309 identifiers in public vulnerability databases are also
310 suitable.
311
312 If the vulnerability was reported publicly, then it is also
313 appropriate to cite the URL to the report in a Reported-at
314 tag. Use a Reported-by tag to acknowledge the reporters.
315
316Developer's Certificate of Origin
317---------------------------------
318
319To help track the author of a patch as well as the submission chain, and be
320clear that the developer has authority to submit a patch for inclusion in
321openvswitch please sign off your work. The sign off certifies the following:
322
323::
324
325 Developer's Certificate of Origin 1.1
326
327 By making a contribution to this project, I certify that:
328
329 (a) The contribution was created in whole or in part by me and I
330 have the right to submit it under the open source license
331 indicated in the file; or
332
333 (b) The contribution is based upon previous work that, to the best
334 of my knowledge, is covered under an appropriate open source
335 license and I have the right under that license to submit that
336 work with modifications, whether created in whole or in part
337 by me, under the same open source license (unless I am
338 permitted to submit under a different license), as indicated
339 in the file; or
340
341 (c) The contribution was provided directly to me by some other
342 person who certified (a), (b) or (c) and I have not modified
343 it.
344
345 (d) I understand and agree that this project and the contribution
346 are public and that a record of the contribution (including all
347 personal information I submit with it, including my sign-off) is
348 maintained indefinitely and may be redistributed consistent with
349 this project or the open source license(s) involved.
350
92caf188
BP
351See also http://developercertificate.org/.
352
255efa72
SF
353Feature Deprecation Guidelines
354------------------------------
355
356Open vSwitch is intended to be user friendly. This means that under normal
357circumstances we don't abruptly remove features from OVS that some users might
358still be using. Otherwise, if we would, then we would possibly break our user
359setup when they upgrade and would receive bug reports.
360
361Typical process to deprecate a feature in Open vSwitch is to:
362
363(a) Mention deprecation of a feature in the NEWS file. Also, mention expected
364 release or absolute time when this feature would be removed from OVS
365 altogether. Don't use relative time (e.g. "in 6 months") because that is
366 not clearly interpretable.
367
368(b) If Open vSwitch is configured to use deprecated feature it should print
369 a warning message to the log files clearly indicating that feature is
370 deprecated and that use of it should be avoided.
371
372(c) If this feature is mentioned in man pages, then add "Deprecated" keyword
373 to it.
374
375Also, if there is alternative feature to the one that is about to be marked as
376deprecated, then mention it in (a), (b) and (c) as well.
377
378Remember to follow-up and actually remove the feature from OVS codebase once
379deprecation grace period has expired and users had opportunity to use at least
380one OVS release that would have informed them about feature deprecation!
381
382Comments
383--------
384
385If you want to include any comments in your email that should not be part of
386the commit's change log message, put them after the description, separated by a
387line that contains just `---`. It may be helpful to include a diffstat here
388for changes that touch multiple files.
389
390Patch
391-----
392
393The patch should be in the body of the email following the description,
394separated by a blank line.
395
396Patches should be in ``diff -up`` format. We recommend that you use Git to
397produce your patches, in which case you should use the ``-M -C`` options to
398``git diff`` (or other Git tools) if your patch renames or copies files.
399`Quilt <http://savannah.nongnu.org/projects/quilt>`__ might be useful if you do
400not want to use Git.
401
402Patches should be inline in the email message. Some email clients corrupt
403white space or wrap lines in patches. There are hints on how to configure many
404email clients to avoid this problem on `kernel.org
405<http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/email-clients.txt>`__.
406If you cannot convince your email client not to mangle patches, then sending
407the patch as an attachment is a second choice.
408
409Please follow the style used in the code that you are modifying. The
410`CodingStyle <CodingStyle.rst>`__ file describes the coding style used in most
411of Open vSwitch. Use Linux kernel coding style for Linux kernel code.
412
413If your code is non-datapath code, you may use the ``utilities/checkpatch.py``
414utility as a quick check for certain commonly occuring mistakes (improper
415leading/trailing whitespace, missing signoffs, some improper formatted patch
416files). For linux datapath code, it is a good idea to use the linux script
417``checkpatch.pl``.
418
419Example
420-------
421
422::
423
424 From fa29a1c2c17682879e79a21bb0cdd5bbe67fa7c0 Mon Sep 17 00:00:00 2001
425 From: Jesse Gross <jesse@nicira.com>
426 Date: Thu, 8 Dec 2011 13:17:24 -0800
427 Subject: [PATCH] datapath: Alphabetize include/net/ipv6.h compat header.
428
429 Signed-off-by: Jesse Gross <jesse@nicira.com>
430 ---
431 datapath/linux/Modules.mk | 2 +-
432 1 files changed, 1 insertions(+), 1 deletions(-)
433
434 diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
435 index fdd952e..f6cb88e 100644
436 --- a/datapath/linux/Modules.mk
437 +++ b/datapath/linux/Modules.mk
438 @@ -56,11 +56,11 @@ openvswitch_headers += \
439 linux/compat/include/net/dst.h \
440 linux/compat/include/net/genetlink.h \
441 linux/compat/include/net/ip.h \
442 + linux/compat/include/net/ipv6.h \
443 linux/compat/include/net/net_namespace.h \
444 linux/compat/include/net/netlink.h \
445 linux/compat/include/net/protocol.h \
446 linux/compat/include/net/route.h \
447 - linux/compat/include/net/ipv6.h \
448 linux/compat/genetlink.inc
449
450 both_modules += brcompat
451 --
452 1.7.7.3