]> git.proxmox.com Git - mirror_ovs.git/blame - Documentation/faq/contributing.rst
faq: Correct location of flow.h.
[mirror_ovs.git] / Documentation / faq / contributing.rst
CommitLineData
11e02906
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===========
25Development
26===========
27
28Q: How do I implement a new OpenFlow message?
29
30 A: Add your new message to ``enum ofpraw`` and ``enum ofptype`` in
d9a8cf80
WT
31 ``include/openvswitch/ofp-msgs.h``, following the existing pattern.
32 Then recompile and fix all of the new warnings, implementing new functionality
33 for the new message as needed. (If you configure with ``--enable-Werror``, as
34 described in :doc:`/intro/install/general`, then it is impossible to miss any
35 warnings.)
11e02906 36
b05af216
BP
37 To add an OpenFlow vendor extension message (aka experimenter message) for
38 a vendor that doesn't yet have any extension messages, you will also need
39 to edit ``build-aux/extract-ofp-msgs`` and at least ``ofphdrs_decode()``
40 and ``ofpraw_put__()`` in ``lib/ofp-msgs.c``. OpenFlow doesn't standardize
41 vendor extensions very well, so it's hard to make the process simpler than
42 that. (If you have a choice of how to design your vendor extension
43 messages, it will be easier if you make them resemble the ONF and OVS
44 extension messages.)
11e02906
SF
45
46Q: How do I add support for a new field or header?
47
e9de6c06
BP
48 A: Add new members for your field to ``struct flow`` in
49 ``include/openvswitch/flow.h``, and add new enumerations for your new field
50 to ``enum mf_field_id`` in ``include/openvswitch/meta-flow.h``, following
51 the existing pattern. If the field uses a new OXM class, add it to
52 OXM_CLASSES in ``build-aux/extract-ofp-fields``. Also, add support to
11e02906
SF
53 ``miniflow_extract()`` in ``lib/flow.c`` for extracting your new field from
54 a packet into struct miniflow, and to ``nx_put_raw()`` in
55 ``lib/nx-match.c`` to output your new field in OXM matches. Then recompile
56 and fix all of the new warnings, implementing new functionality for the new
57 field or header as needed. (If you configure with ``--enable-Werror``, as
58 described in :doc:`/intro/install/general`, then it is impossible to miss
59 any warnings.)
60
61 If you want kernel datapath support for your new field, you also need to
62 modify the kernel module for the operating systems you are interested in.
63 This isn't mandatory, since fields understood only by userspace work too
64 (with a performance penalty), so it's reasonable to start development
65 without it. If you implement kernel module support for Linux, then the
66 Linux kernel "netdev" mailing list is the place to submit that support
67 first; please read up on the Linux kernel development process separately.
68 The Windows datapath kernel module support, on the other hand, is
69 maintained within the OVS tree, so patches for that can go directly to
70 ovs-dev.
71
72Q: How do I add support for a new OpenFlow action?
73
74 A: Add your new action to ``enum ofp_raw_action_type`` in
75 ``lib/ofp-actions.c``, following the existing pattern. Then recompile and
76 fix all of the new warnings, implementing new functionality for the new
77 action as needed. (If you configure with ``--enable-Werror``, as described
78 in the :doc:`/intro/install/general`, then it is impossible to miss any
79 warnings.)
80
81 If you need to add an OpenFlow vendor extension action for a vendor that
b05af216
BP
82 doesn't yet have any extension actions, then you will also need to add the
83 vendor to ``vendor_map`` in ``build-aux/extract-ofp-actions``. Also, you
84 will need to add support for the vendor to ``ofpact_decode_raw()`` and
85 ``ofpact_put_raw()`` in ``lib/ofp-actions.c``. (If you have a choice of
86 how to design your vendor extension actions, it will be easier if you make
87 them resemble the ONF and OVS extension actions.)
88
89Q: How do I add support for a new OpenFlow error message?
90
91 A: Add your new error to ``enum ofperr`` in
92 ``include/openvswitch/ofp-errors.h``. Read the large comment at the top of
93 the file for details. If you need to add an OpenFlow vendor extension
94 error for a vendor that doesn't yet have any, first add the vendor ID to
95 the ``<name>_VENDOR_ID`` list in ``include/openflow/openflow-common.h``.