]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/intel-ipsec-mb/CONTRIBUTING
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / intel-ipsec-mb / CONTRIBUTING
CommitLineData
f67539c2
TL
1Contributing to intel-ipsec-mb
2==============================
3
4As an open source project, we welcome contributions of any kind.
5These can range from bug reports, code reviews and code development,
6to significant code or documentation features.
7
8Note:
9There is just one branch used in the project. All development is done on the
10master branch. Code taken from the tip of the master branch should not be
11considered fit for production.
12Refer to the releases tab for stable code versions:
13https://github.com/intel/intel-ipsec-mb/releases
14
15
16How can I contribute?
17=====================
18
19This document specifies contributing guidelines to the intel-ipsec-mb source
20tree. It covers some general guidelines, the preferred style and formatting
21for source files, additional requirements like documentation and development
22workflow. The goal of this document is to walk you through the concepts and
23specifics that should be understood while contributing to intel-ipsec-mb.
24
25
26Reporting Bugs
27==============
28
29Bugs should be reported via GitHub issues. The description should include
30a platform name, OS and kernel version, library version and detailed
31information on how to reproduce the bug.
32
33
34Suggesting Enhancements
35=======================
36
37Improvements should be reported via GitHub issues or pull requests.
38
39
40Creating Pull Requests
41======================
42
43Pull requests should be created using standard procedure available on GitHub.
44It is important to fill in all required information into a template. For major
45modifications (e.g. adding a new feature, refactoring), for effective
46development, it is recommended to share high level document with core
47development team via GitHub issue so that one can ask questions if one foresees
48issues that may occur in existing development.
49
50
51Coding Style Guides
52===================
53
54General Guidelines
55==================
56
57The rules and guidelines given in this document cannot cover every situation,
58so the following general guidelines should be used as a fallback:
59
60The code style should be consistent within each individual file.
61In the case of creating new files, the style should be consistent within
62each file in a given directory or module. The primary reason for coding
63standards is to increase code readability and comprehensibility, therefore
64always use whatever option will make the code easier to read. Line length
65is recommended to be not more than 80 characters, including comments.
66
67
68C
69=
70
71Formatting using checkpatch.pl
72==============================
73
74To format your code please use checkpatch.pl script (version 0.32) from
75Linux kernel
76(https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl).
77
78The top level Makefile contains a target "style" that can be used to check
79formatting. Please ensure the checkpatch.pl script has been added to your PATH.
80
81
82Indentation
83===========
84
85Tabs are 8 characters and thus indentations are also 8 characters.
86It should be consistent within each part of the code. When adding a new file,
87spaces should be used over tabs.
88
89
90C Comment Style
91===============
92
93Usual Comments
94==============
95
96These comments should be used in normal cases. To document a public API,
97a doxygen-like format must be used: refer to Doxygen Guidelines
98(http://www.doxygen.nl/manual/docblocks.html).
99
100/*
101 * VERY important single-line comments look like this.
102 */
103
104/* Most single-line comments look like this. */
105
106/*
107 * Multi-line comments look like this. Make them real sentences. Fill
108 * them so they look like real paragraphs.
109 */
110
111
112License Header
113==============
114
115Each file should begin with a special comment containing the appropriate
116copyright and license for the file. After any copyright header, a blank line
117should be left before any other contents, e.g. include statements in a C file.
118
119
120Preprocessor Directives (Header Includes)
121=========================================
122
123Include files from the local application directory are included using quotes,
124while includes from other paths are included using angle brackets: "<>".
125
126Example:
127
128#include <stdlib.h>
129#include <string.h>
130
131#include "intel-ipsec-mb.h"
132#include "asm.h"
133
134
135Header File Guards
136==================
137
138Headers should be protected against multiple inclusion with the usual:
139
140#ifndef _FILE_H_
141#define _FILE_H_
142
143/* Code */
144
145#endif /* _FILE_H_ */
146
147
148Macros
149======
150
151You can define a macro similar in C using #define preprocessor directive.
152
153For example:
154
155/**
156 * ---------------------------------------
157 * Local macros
158 * ---------------------------------------
159 */
160
161/*
162 * Custom ASSERT and DIM macros
163 */
164#ifdef DEBUG
165#include <assert.h>
166#define IMB_ASSERT(x) assert(x)
167#else
168#define IMB_ASSERT(x)
169#endif
170
171#ifndef IMB_DIM
172#define IMB_DIM(x) (sizeof(x) / sizeof(x[0]))
173#endif
174
175
176ASM
177===
178
179Syntax
180======
181
182Intel syntax should be used always.
183
184
185Register Naming
186===============
187
188Virtual registers with meaningful names should be used over direct register
189names when possible.
190
191
192Indentation
193===========
194
195Tabs are 8 characters and thus indentations are also 8 characters.
196To improve readability, instructions should be preceded by a single indent
197and followed by one or more indents in order to align the first operand.
198Spaces should be used over tabs.
199
200Example:
201 vmovdqu %%T5, [%%GDATA + HashKey_6]
202 vpshufd %%T2, %%XMM2, 01001110b
203 vpshufd %%T3, %%T5, 01001110b
204 vpclmulqdq %%T4, %%XMM2, %%T5, 0x11
205
206
207Comment Style
208=============
209
210Two semicolons should be used for comment lines and a single semicolon
211for end of line comments.
212
213Example:
214 ;; first phase of the reduction
215 vmovdqu %%T3, [rel POLY2]
216
217 vpclmulqdq %%T2, %%T3, %%T7, 0x01
218 vpslldq %%T2, %%T2, 8 ; shift-L xmm2 2 DWs
219
220
221Macros
222======
223
224Macros should be used where possible to reduce code duplication. All macros
225should be properly documented, specifiying input/output parameters and
226their types.
227
228Example:
229%macro AESROUND_1_TO_16_BLOCKS 5
230%define %%L0B0_3 %1 ; [in/out] ZMM; blocks 0 to 3
231%define %%L0B4_7 %2 ; [in/out] ZMM; blocks 4 to 7
232%define %%KEY %3 ; [in] ZMM containing round key
233%define %%ROUND %4 ; [in] numerical value containing round number
234%define %%IA0 %5 ; [clobbered] temp GP register
235
236Macros should be located within or before the .text section in the file.
237
238
239License Header
240==============
241
242Each file should begin with a special comment containing the appropriate
243copyright and license for the file. After any copyright header, a blank line
244should be left before any other contents.
245
246
247File and Code Structure
248=======================
249
250New files should be structured in the following layout:
251 1. License header
252 2. .data section
253 3. .text section
254
255Please see avx512/cntr_vaes_avx512.asm for an example.
256All new modules should compile to produce relocatable code.
257
258
259Public APIs in the library
260==========================
261
262All functions that are exposed by the library must have their prototypes
263defined in intel-ipsec-mb.h and symbols added to libIPSec_MB.def.
264
265
266Documentation
267=============
268
269Please make sure to update documentation when necessary. If not possible
270(e.g. not allowed to edit wiki), propose necessary changes.
271
272
273Git Commit Messages
274===================
275
276Git commit messages should start with a short 50 character or less summary
277in a single paragraph. Ideally, it should start with a short prefix
278followed by a colon describing which part of the code it modifies
279e.g. "LibTestApp: extended AES-CBC tests".
280
281
282Development Workflow
283====================
284
285Clone a repository in the usual way, for example:
286
287git clone https://github.com/intel/intel-ipsec-mb
288
289Once your local repository is set up as above, you must use
290the following workflow.
291
292Make sure you have the latest upstream changes:
293
294git remote update
295git checkout master
296git pull origin master
297
298
299Committing a Change
300===================
301
302Make your changes, commit them, and submit them for review:
303
304git commit -a
305
306To see how to create pull requests on GitHub, please refer to "About pull
307requests" help page (https://help.github.com/articles/about-pull-requests/).
308
309Note: Please ensure that you have your username and email address set correctly
310to let other developers know about your contribution:
311
312git config --global user.name "Firstname Lastname"
313git config --global user.email "your_email@youremail.com"
314
315
316Licenses
317========
318
319The code in this repository is licensed under BSD license (see LICENSE file).