[VNIC] Initial checkin of VNIC code. Not yet fully functional.
[mirror/winof/.git] / ulp / inic / kernel / vnic_controlpkt.h
1 /*\r
2  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.\r
3  *\r
4  * This software is available to you under the OpenIB.org BSD license\r
5  * below:\r
6  *\r
7  *     Redistribution and use in source and binary forms, with or\r
8  *     without modification, are permitted provided that the following\r
9  *     conditions are met:\r
10  *\r
11  *      - Redistributions of source code must retain the above\r
12  *        copyright notice, this list of conditions and the following\r
13  *        disclaimer.\r
14  *\r
15  *      - Redistributions in binary form must reproduce the above\r
16  *        copyright notice, this list of conditions and the following\r
17  *        disclaimer in the documentation and/or other materials\r
18  *        provided with the distribution.\r
19  *\r
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
24  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
25  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
26  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
27  * SOFTWARE.\r
28  *\r
29  * $Id$\r
30  */\r
31 \r
32 #ifndef _VNIC_CONTROLPKT_H_\r
33 #define _VNIC_CONTROLPKT_H_\r
34 \r
35 #include <complib/cl_packon.h>\r
36 typedef struct Inic_ConnectionData {\r
37         uint64_t        pathId;\r
38         uint8_t         inicInstance;\r
39         uint8_t         pathNum;\r
40         uint8_t         nodename[65];\r
41         uint8_t         reserved;\r
42         uint32_t        featuresSupported;\r
43 } Inic_ConnectionData_t;\r
44         \r
45 typedef struct Inic_ControlHeader {\r
46         uint8_t         pktType;\r
47         uint8_t         pktCmd;\r
48         uint8_t         pktSeqNum;\r
49         uint8_t         pktRetryCount;\r
50         uint32_t        reserved;       /* for 64-bit alignmnet */\r
51 } Inic_ControlHeader_t;\r
52 \r
53 /* ptkType values */\r
54 #define TYPE_INFO       0\r
55 #define TYPE_REQ        1\r
56 #define TYPE_RSP        2\r
57 #define TYPE_ERR        3\r
58 \r
59 /* ptkCmd values */\r
60 #define CMD_INIT_INIC                   1\r
61 #define CMD_CONFIG_DATA_PATH    2\r
62 #define CMD_EXCHANGE_POOLS              3\r
63 #define CMD_CONFIG_ADDRESSES    4\r
64 #define CMD_CONFIG_LINK                 5\r
65 #define CMD_REPORT_STATISTICS   6\r
66 #define CMD_CLEAR_STATISTICS    7\r
67 #define CMD_REPORT_STATUS               8\r
68 #define CMD_RESET                               9\r
69 #define CMD_HEARTBEAT                   10\r
70 \r
71 #define MAC_ADDR_LEN                    HW_ADDR_LEN\r
72 \r
73 /* pktCmd CMD_INIT_INIC, pktType TYPE_REQ data format */\r
74 typedef struct Inic_CmdInitInicReq {\r
75         uint16_t        inicMajorVersion;\r
76         uint16_t        inicMinorVersion;\r
77         uint8_t         inicInstance;\r
78         uint8_t         numDataPaths;\r
79         uint16_t        numAddressEntries;\r
80 } Inic_CmdInitInicReq_t;\r
81 \r
82 /* pktCmd CMD_INIT_INIC, pktType TYPE_RSP subdata format */\r
83 typedef struct Inic_LanSwitchAttributes {\r
84         uint8_t         lanSwitchNum;\r
85         uint8_t         numEnetPorts;\r
86         uint16_t        defaultVlan;\r
87         uint8_t         hwMacAddress[MAC_ADDR_LEN];\r
88 } Inic_LanSwitchAttributes_t;\r
89 \r
90 /* pktCmd CMD_INIT_INIC, pktType TYPE_RSP data format */\r
91 typedef struct Inic_CmdInitInicRsp {\r
92         uint16_t        inicMajorVersion;\r
93         uint16_t        inicMinorVersion;\r
94         uint8_t         numLanSwitches;\r
95         uint8_t         numDataPaths;\r
96         uint16_t        numAddressEntries;\r
97         uint32_t        featuresSupported;\r
98         Inic_LanSwitchAttributes_t lanSwitch[1];\r
99 } Inic_CmdInitInicRsp_t;\r
100 \r
101 /* featuresSupported values */\r
102 #define INIC_FEAT_IPV4_HEADERS                  0x00000001\r
103 #define INIC_FEAT_IPV6_HEADERS                  0x00000002\r
104 #define INIC_FEAT_IPV4_CSUM_RX                  0x00000004\r
105 #define INIC_FEAT_IPV4_CSUM_TX                  0x00000008\r
106 #define INIC_FEAT_TCP_CSUM_RX                   0x00000010\r
107 #define INIC_FEAT_TCP_CSUM_TX                   0x00000020\r
108 #define INIC_FEAT_UDP_CSUM_RX                   0x00000040\r
109 #define INIC_FEAT_UDP_CSUM_TX                   0x00000080\r
110 #define INIC_FEAT_TCP_SEGMENT                   0x00000100\r
111 #define INIC_FEAT_IPV4_IPSEC_OFFLOAD    0x00000200\r
112 #define INIC_FEAT_IPV6_IPSEC_OFFLOAD    0x00000400\r
113 #define INIC_FEAT_FCS_PROPAGATE                 0x00000800\r
114 #define INIC_FEAT_PF_KICK                               0x00001000\r
115 #define INIC_FEAT_PF_FORCE_ROUTE                0x00002000\r
116 #define INIC_FEAT_CHASH_OFFLOAD                 0x00004000\r
117 #define INIC_FEAT_RDMA_IMMED                    0x00008000 \r
118 #define INIC_FEAT_IGNORE_VLAN                   0x00010000\r
119 \r
120 /* pktCmd CMD_CONFIG_DATA_PATH subdata format */\r
121 typedef struct  Inic_RecvPoolConfig {\r
122         uint32_t        sizeRecvPoolEntry;\r
123         uint32_t        numRecvPoolEntries;\r
124         uint32_t        timeoutBeforeKick;\r
125         uint32_t        numRecvPoolEntriesBeforeKick;\r
126         uint32_t        numRecvPoolBytesBeforeKick;\r
127         uint32_t        freeRecvPoolEntriesPerUpdate;\r
128 } Inic_RecvPoolConfig_t;\r
129 \r
130 /* pktCmd CMD_CONFIG_DATA_PATH data format */\r
131 typedef struct Inic_CmdConfigDataPath {\r
132         uint64_t        pathIdentifier;\r
133         uint8_t         dataPath;\r
134         uint8_t         reserved[3];\r
135         Inic_RecvPoolConfig_t  hostRecvPoolConfig;\r
136         Inic_RecvPoolConfig_t  eiocRecvPoolConfig;\r
137 } Inic_CmdConfigDataPath_t;\r
138 \r
139 /* pktCmd CMD_EXCHANGE_POOLS data format */\r
140 typedef struct Inic_CmdExchangePools {\r
141         uint8_t dataPath;\r
142         uint8_t reserved[3];\r
143         uint32_t        poolRKey;\r
144         uint64_t        poolAddr;\r
145 } Inic_CmdExchangePools_t;\r
146 \r
147 /* pktCmd CMD_CONFIG_ADDRESSES subdata format */\r
148 typedef struct Inic_AddressOp {\r
149         uint16_t        index;\r
150         uint8_t operation;\r
151         uint8_t valid;\r
152         uint8_t address[6];\r
153         uint16_t        vlan;\r
154 } Inic_AddressOp_t;\r
155 \r
156 /* operation values */\r
157 #define INIC_OP_SET_ENTRY       0x01\r
158 #define INIC_OP_GET_ENTRY       0x02\r
159 \r
160 /* pktCmd CMD_CONFIG_ADDRESSES data format */\r
161 typedef struct Inic_CmdConfigAddresses {\r
162         uint8_t numAddressOps;\r
163         uint8_t lanSwitchNum;\r
164         Inic_AddressOp_t        listAddressOps[1];\r
165 } Inic_CmdConfigAddresses_t;\r
166 \r
167 /* CMD_CONFIG_LINK data format */\r
168 typedef struct Inic_CmdConfigLink {\r
169         uint8_t cmdFlags;\r
170         uint8_t lanSwitchNum;\r
171         uint16_t   mtuSize;\r
172         uint16_t        defaultVlan;\r
173         uint8_t hwMacAddress[6];\r
174 } Inic_CmdConfigLink_t;\r
175 \r
176 /* cmdFlags values */\r
177 #define INIC_FLAG_ENABLE_NIC            0x01\r
178 #define INIC_FLAG_DISABLE_NIC           0x02\r
179 #define INIC_FLAG_ENABLE_MCAST_ALL      0x04\r
180 #define INIC_FLAG_DISABLE_MCAST_ALL     0x08\r
181 #define INIC_FLAG_ENABLE_PROMISC        0x10\r
182 #define INIC_FLAG_DISABLE_PROMISC       0x20\r
183 #define INIC_FLAG_SET_MTU                       0x40\r
184 \r
185 /* pktCmd CMD_REPORT_STATISTICS, pktType TYPE_REQ data format */\r
186 typedef struct Inic_CmdReportStatisticsReq {\r
187         uint8_t lanSwitchNum;\r
188 } Inic_CmdReportStatisticsReq_t;\r
189 \r
190 /* pktCmd CMD_REPORT_STATISTICS, pktType TYPE_RSP data format */\r
191 typedef struct Inic_CmdReportStatisticsRsp {\r
192         uint8_t lanSwitchNum;\r
193         uint8_t reserved[7]; /* for 64-bit alignment */\r
194         uint64_t        ifInBroadcastPkts;\r
195         uint64_t        ifInMulticastPkts;\r
196         uint64_t        ifInOctets;\r
197         uint64_t        ifInUcastPkts;\r
198         uint64_t        ifInNUcastPkts; /* ifInBroadcastPkts + ifInMulticastPkts */\r
199         uint64_t        ifInUnderrun; /* (OID_GEN_RCV_NO_BUFFER) */\r
200         uint64_t        ifInErrors; /* (OID_GEN_RCV_ERROR) */\r
201         uint64_t        ifOutErrors; /* (OID_GEN_XMIT_ERROR) */\r
202         uint64_t        ifOutOctets;\r
203         uint64_t        ifOutUcastPkts;\r
204         uint64_t        ifOutMulticastPkts;\r
205         uint64_t        ifOutBroadcastPkts;\r
206         uint64_t        ifOutNUcastPkts; /* ifOutBroadcastPkts + ifOutMulticastPkts */\r
207         uint64_t        ifOutOk; /* ifOutNUcastPkts + ifOutUcastPkts (OID_GEN_XMIT_OK)*/\r
208         uint64_t        ifInOk; /* ifInNUcastPkts + ifInUcastPkts (OID_GEN_RCV_OK) */\r
209         uint64_t        ifOutUcastBytes; /* (OID_GEN_DIRECTED_BYTES_XMT) */\r
210         uint64_t        ifOutMulticastBytes; /* (OID_GEN_MULTICAST_BYTES_XMT) */\r
211         uint64_t        ifOutBroadcastBytes; /* (OID_GEN_BROADCAST_BYTES_XMT) */\r
212         uint64_t        ifInUcastBytes; /* (OID_GEN_DIRECTED_BYTES_RCV) */\r
213         uint64_t        ifInMulticastBytes; /* (OID_GEN_MULTICAST_BYTES_RCV) */\r
214         uint64_t        ifInBroadcastBytes; /* (OID_GEN_BROADCAST_BYTES_RCV) */\r
215         uint64_t        ethernetStatus; /* OID_GEN_MEDIA_CONNECT_STATUS) */\r
216 } Inic_CmdReportStatisticsRsp_t;\r
217 \r
218 /* pktCmd CMD_CLEAR_STATISTICS data format */\r
219 typedef struct Inic_CmdClearStatistics {\r
220         uint8_t lanSwitchNum;\r
221 } Inic_CmdClearStatistics_t;\r
222 \r
223 /* pktCmd CMD_REPORT_STATUS data format */\r
224 typedef struct Inic_CmdReportStatus {\r
225         uint8_t lanSwitchNum;\r
226         uint8_t isFatal;\r
227         uint8_t reserved[2]; /* for 32-bit alignment */\r
228         uint32_t        statusNumber;\r
229         uint32_t        statusInfo;\r
230         uint8_t         fileName[32];\r
231         uint8_t routine[32];\r
232         uint32_t        lineNum;\r
233         uint32_t        errorParameter;\r
234         uint8_t descText[128];\r
235 } Inic_CmdReportStatus_t;\r
236 \r
237 /* pktCmd CMD_HEARTBEAT data format */\r
238 typedef struct Inic_CmdHeartbeat {\r
239         uint32_t        hbInterval;\r
240 } Inic_CmdHeartbeat_t;\r
241 \r
242 #define INIC_STATUS_LINK_UP                             1\r
243 #define INIC_STATUS_LINK_DOWN                   2\r
244 #define INIC_STATUS_ENET_AGGREGATION_CHANGE     3\r
245 #define INIC_STATUS_EIOC_SHUTDOWN               4\r
246 #define INIC_STATUS_CONTROL_ERROR               5\r
247 #define INIC_STATUS_EIOC_ERROR                  6\r
248 \r
249 #define INIC_MAX_CONTROLPKTSZ   256\r
250 #define INIC_MAX_CONTROLDATASZ \\r
251                 (INIC_MAX_CONTROLPKTSZ - sizeof(Inic_ControlHeader_t))\r
252 \r
253 typedef struct Inic_ControlPacket {\r
254         Inic_ControlHeader_t hdr;\r
255         union {\r
256                 Inic_CmdInitInicReq_t initInicReq;\r
257                 Inic_CmdInitInicRsp_t initInicRsp;\r
258                 Inic_CmdConfigDataPath_t configDataPathReq;\r
259                 Inic_CmdConfigDataPath_t configDataPathRsp;\r
260                 Inic_CmdExchangePools_t exchangePoolsReq;\r
261                 Inic_CmdExchangePools_t exchangePoolsRsp;\r
262                 Inic_CmdConfigAddresses_t configAddressesReq;\r
263                 Inic_CmdConfigAddresses_t configAddressesRsp;\r
264                 Inic_CmdConfigLink_t configLinkReq;\r
265                 Inic_CmdConfigLink_t configLinkRsp;\r
266                 Inic_CmdReportStatisticsReq_t reportStatisticsReq;\r
267                 Inic_CmdReportStatisticsRsp_t reportStatisticsRsp;\r
268                 Inic_CmdClearStatistics_t clearStatisticsReq;\r
269                 Inic_CmdClearStatistics_t clearStatisticsRsp;\r
270                 Inic_CmdReportStatus_t reportStatus;\r
271                 Inic_CmdHeartbeat_t heartbeatReq;\r
272                 Inic_CmdHeartbeat_t heartbeatRsp;\r
273                 char cmdData[INIC_MAX_CONTROLDATASZ];\r
274         } cmd;\r
275 } Inic_ControlPacket_t;\r
276 /*\r
277 typedef struct _mac_addr\r
278 {\r
279         uint8_t         addr[MAC_ADDR_LEN];\r
280 }       PACK_SUFFIX mac_addr_t;\r
281 */\r
282 #include <complib/cl_packoff.h>\r
283 \r
284 #endif /* _VNIC_CONTROLPKT_H_ */