~ubuntu-branches/ubuntu/raring/ibutils/raring-proposed

« back to all changes in this revision

Viewing changes to ibmgtsim/src/ib_types_extend.h

  • Committer: Bazaar Package Importer
  • Author(s): Benoit Mortier
  • Date: 2010-01-11 22:22:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100111222200-53kum2et5nh13rv3
Tags: upstream-1.2-OFED-1.4.2
ImportĀ upstreamĀ versionĀ 1.2-OFED-1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2004 Mellanox Technologies LTD. All rights reserved.
 
3
 *
 
4
 * This software is available to you under a choice of one of two
 
5
 * licenses.  You may choose to be licensed under the terms of the GNU
 
6
 * General Public License (GPL) Version 2, available from the file
 
7
 * COPYING in the main directory of this source tree, or the
 
8
 * OpenIB.org BSD license below:
 
9
 *
 
10
 *     Redistribution and use in source and binary forms, with or
 
11
 *     without modification, are permitted provided that the following
 
12
 *     conditions are met:
 
13
 *
 
14
 *      - Redistributions of source code must retain the above
 
15
 *        copyright notice, this list of conditions and the following
 
16
 *        disclaimer.
 
17
 *
 
18
 *      - Redistributions in binary form must reproduce the above
 
19
 *        copyright notice, this list of conditions and the following
 
20
 *        disclaimer in the documentation and/or other materials
 
21
 *        provided with the distribution.
 
22
 *
 
23
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
24
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
25
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
26
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 
27
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 
28
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
29
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
30
 * SOFTWARE.
 
31
 *
 
32
 * $Id$
 
33
 */
 
34
 
 
35
#ifndef IB_TYPES_EXTEND
 
36
#define IB_TYPES_EXTEND
 
37
 
 
38
#include <complib/cl_packon.h>
 
39
typedef struct _ib_pm_counters {
 
40
  ib_mad_t mad_header;
 
41
  ib_net32_t reserved0[10];
 
42
  uint8_t reserved1;
 
43
  uint8_t port_select;
 
44
  ib_net16_t counter_select;
 
45
  ib_net16_t symbol_error_counter;
 
46
  uint8_t link_error_recovery_counter;
 
47
  uint8_t link_down_counter;
 
48
  ib_net16_t port_rcv_errors;
 
49
  ib_net16_t port_rcv_remote_physical_errors;
 
50
  ib_net16_t port_rcv_switch_relay_errors;
 
51
  ib_net16_t port_xmit_discard;
 
52
  uint8_t port_xmit_constraint_errors;
 
53
  uint8_t port_rcv_constraint_errors;
 
54
  uint8_t reserved2;
 
55
  uint8_t lli_errors_exc_buf_errors;
 
56
  ib_net16_t reserved3;
 
57
  ib_net16_t vl15_dropped;
 
58
  ib_net32_t port_xmit_data;
 
59
  ib_net32_t port_rcv_data;
 
60
  ib_net32_t port_xmit_pkts;
 
61
  ib_net32_t port_rcv_pkts;
 
62
  ib_net32_t reserved5[38];
 
63
} PACK_SUFFIX ib_pm_counters_t;
 
64
#include <complib/cl_packoff.h>
 
65
 
 
66
/****f* IBA Base: Types_extend/ib_switch_info_set_state_change
 
67
* NAME
 
68
*       ib_switch_info_set_state_change
 
69
*
 
70
* DESCRIPTION
 
71
*       Sets the switch's state change bit.
 
72
*
 
73
* SYNOPSIS
 
74
*/
 
75
static inline void
 
76
ib_switch_info_set_state_change(
 
77
        IN      ib_switch_info_t* const         p_si )
 
78
{
 
79
        p_si->life_state = (uint8_t)(p_si->life_state | 0x04);
 
80
}
 
81
/*
 
82
* PARAMETERS
 
83
*       p_ni
 
84
*               [in] Pointer to a SwitchInfo attribute.
 
85
*
 
86
* RETURN VALUES
 
87
*       no returned value.
 
88
*
 
89
* NOTES
 
90
*
 
91
* SEE ALSO
 
92
*   ib_switch_info_get_state_change, ib_switch_info_clear_state_change
 
93
*********/
 
94
 
 
95
/****f* IBA Base: Types_extend/ib_node_info_set_local_port_num
 
96
* NAME
 
97
*       ib_node_info_set_local_port_num
 
98
*
 
99
* DESCRIPTION
 
100
*       Sets a the local port number In the NodeInfo attribute.
 
101
*
 
102
* SYNOPSIS
 
103
*/
 
104
static inline void
 
105
ib_node_info_set_local_port_num(
 
106
        IN      ib_node_info_t*         p_ni,
 
107
    IN      uint8_t             inPort)
 
108
{
 
109
    p_ni->port_num_vendor_id = cl_hton32(((cl_ntoh32(p_ni->port_num_vendor_id) & 0x00ffffff) |
 
110
                                (inPort << 24)));
 
111
}
 
112
/*
 
113
* PARAMETERS
 
114
*       p_ni
 
115
*               [in] Pointer to a NodeInfo attribute.
 
116
*   inPort
 
117
*       [in] Port which SMA came on
 
118
*
 
119
* RETURN VALUES
 
120
*
 
121
* NOTES
 
122
*
 
123
* SEE ALSO
 
124
*       ib_node_info_t
 
125
*********/
 
126
 
 
127
/****f* IBA Base: Types_extend/ib_port_info_get_smsl
 
128
* NAME
 
129
*       ib_port_info_get_smsl
 
130
*
 
131
* DESCRIPTION
 
132
*       Returns the encoded value for the Master SM SL at this port.
 
133
*
 
134
* SYNOPSIS
 
135
*/
 
136
static inline uint8_t
 
137
ib_port_info_get_smsl(
 
138
        IN const ib_port_info_t* const p_pi )
 
139
{
 
140
        return( (uint8_t)(p_pi->mtu_smsl & 0x0F));
 
141
}
 
142
/*
 
143
* PARAMETERS
 
144
*       p_pi
 
145
*               [in] Pointer to a PortInfo attribute.
 
146
*
 
147
* RETURN VALUES
 
148
*       Returns the encoded value for the Master SM SL at this port.
 
149
*
 
150
* NOTES
 
151
*
 
152
* SEE ALSO
 
153
*********/
 
154
 
 
155
/****f* IBA Base: Types/ib_port_info_set_smsl
 
156
* NAME
 
157
*       ib_port_info_set_smsl
 
158
*
 
159
* DESCRIPTION
 
160
*       Sets the Master SM SL value in the PortInfo attribute.
 
161
*
 
162
* SYNOPSIS
 
163
*/
 
164
static inline void
 
165
ib_port_info_set_smsl(
 
166
        IN                              ib_port_info_t* const           p_pi,
 
167
        IN              const   uint8_t                                         mSmSl )
 
168
{
 
169
        p_pi->mtu_smsl = (uint8_t)((p_pi->mtu_smsl & 0xF0) | mSmSl);
 
170
}
 
171
/*
 
172
* PARAMETERS
 
173
*       p_pi
 
174
*               [in] Pointer to a PortInfo attribute.
 
175
*
 
176
*       mSmSl
 
177
*               [in] Encoded Master SM SL value to set
 
178
*
 
179
* RETURN VALUES
 
180
*       None.
 
181
*
 
182
* NOTES
 
183
*
 
184
* SEE ALSO
 
185
*********/
 
186
 
 
187
/****f* IBA Base: Types_extend/ib_port_info_set_vl_cap
 
188
* NAME
 
189
*       ib_port_info_set_vl_cap
 
190
*
 
191
* DESCRIPTION
 
192
*       Sets the VL Capability of a port.
 
193
*
 
194
* SYNOPSIS
 
195
*/
 
196
static inline void
 
197
ib_port_info_set_vl_cap(
 
198
        IN  ib_port_info_t*     p_pi,
 
199
    IN  const   uint8_t         vlCap )
 
200
{
 
201
    p_pi->vl_cap = (p_pi->vl_cap & 0x0F) | (vlCap << 4);
 
202
}
 
203
/*
 
204
* PARAMETERS
 
205
*       p_pi
 
206
*               [in] Pointer to a PortInfo attribute.
 
207
*
 
208
* RETURN VALUES
 
209
*       VL_CAP field
 
210
*
 
211
* NOTES
 
212
*
 
213
* SEE ALSO
 
214
*********/
 
215
 
 
216
/****s* IBA Base: Types extend /ib_mft_table_t
 
217
* NAME
 
218
*       ib_mft_table_t
 
219
*
 
220
* DESCRIPTION
 
221
*       IBA defined MFT table.
 
222
*
 
223
* SYNOPSIS
 
224
*/
 
225
 
 
226
#include <complib/cl_packon.h>
 
227
typedef struct _ib_mft_table
 
228
{
 
229
        ib_net16_t                      mft_entry[IB_MCAST_BLOCK_SIZE];
 
230
 
 
231
}       PACK_SUFFIX ib_mft_table_t;
 
232
#include <complib/cl_packoff.h>
 
233
/************/
 
234
#endif