2 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 * Turns on byte packing, which is necessary for passing information from
39 * system to system over a network to ensure no padding by the compiler has
43 /****h* Component Library/Structure Packing
48 * The structure packing header files allow packing structures on byte
51 * Structure packing should be used whenever a structure is transmitted
52 * between systems, as different platforms pad structures differently if
53 * they are not packed. Packing a structure that is not transmitted between
54 * systems can be detrimental to performance, as fields in the structure may
55 * not align properly for some platforms. Care must be taken when creating
56 * packed structures that the alignment rules for all platforms are followed.
58 * To pack a structure, include ipackon.h before defining the structure, and
59 * include ipackoff.h after the structure definition. Multiple structures
60 * can be packed between the two include statements if desired.
62 * The structure definition itself must use the PACK_SUFFIX keyword.
65 * #include <complib/ipackon.h>
67 * typedef _my_struct_t
73 * } PACK_SUFFIX my_struct_t;
74 * #include <complib/ipackoff.h>
78 #define PACK_SUFFIX __attribute__((packed))
82 #pragma pack (push, 1)