OpenFlow Data Plane Abstraction (OF-DPA) API Guide and Reference Manual
ofdpa_datatypes.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * (C) Copyright Broadcom Corporation 2003-2014
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename ofdpa_datatypes.h
28 *
29 * @purpose OF-DPA datatypes header
30 *
31 * @component OF-DPA
32 *
33 * @note none
34 *
35 * @create 27 June 2013
36 *
37 * @end
38 *
39 **********************************************************************/
40 #ifndef INCLUDE_OFDPA_DATATYPES_H
41 #define INCLUDE_OFDPA_DATATYPES_H
42 
43 #include <stdint.h>
44 #include <sys/time.h>
45 #include <netinet/in.h>
46 
48 typedef enum
49 {
53  OFDPA_E_RPC = -20,
61  OFDPA_E_FULL = -24,
67  OFDPA_E_FAIL = -27,
77 
79 #define OFDPA_MAC_ADDR_LEN 6
80 
82 #define OFDPA_MAC_ADDR_IS_NULL(mac) \
83  ((mac[0] == 0) && (mac[1] == 0) && (mac[2] == 0) && \
84  (mac[3] == 0) && (mac[4] == 0) && (mac[5] == 0))
85 
87 #define OFDPA_PORT_CONTROLLER 0xfffffffdu
88 
90 #define OFDPA_VID_FIELD_MASK 0x0000
91 
92 #define OFDPA_VID_EXACT_MASK 0x0fff
93 
95 #define OFDPA_VID_NONE 0x0000
96 
97 #define OFDPA_VID_PRESENT 0x1000
98 
99 typedef enum
100 {
106 
108 typedef struct ofdpaMacAddr_s
109 {
113 
114 
128 typedef struct
129 {
131  uint32_t size;
133  char *pstart;
135 
136 /*
137  * Debugging and Logging definitions
138  */
139 
141 typedef enum
142 {
145 
148 
150 
152 typedef enum
153 {
166 
170 
172 typedef enum
173 {
184 
188 
190 #define OFDPA_INPORT_EXACT_MASK 0xffffffffu
191 
192 #define OFDPA_INPORT_FIELD_MASK 0x00000000u
193 
194 #define OFDPA_INPORT_INDEX_MASK 0x0000ffffu
195 
196 #define OFDPA_INPORT_TYPE_MASK 0xffff0000u
197 
199 #define OFDPA_IPV4_ADDR_EXACT_MASK 0xffffffffu
200 
201 #define OFDPA_IPV4_ADDR_FIELD_MASK 0x00000000u
202 
203 /* Flow Tables.
204 */
205 
207 typedef enum
208 {
218 
220 #define OFDPA_FLOW_TABLE_ID_SA_LOOKUP 254
221 
224 {
226  uint32_t inPort;
228  uint32_t inPortMask;
230 
233 {
236 
237  /* flow instructions */
241 
243 
244 /*------------------------------------------------------------------------------------*/
245 
247 typedef struct ofdpaVlanFlowMatch_s
248 {
250  uint32_t inPort;
251 
252  uint16_t vlanId;
253  uint16_t vlanIdMask;
254 
256 
258 typedef struct ofdpaVlanFlowEntry_s
259 {
262 
263  /* flow instructions */
264 
268 
271  uint16_t newVlanId;
272 
274 
275 /*------------------------------------------------------------------------------------*/
278 {
280  uint32_t inPort;
281 
283  uint32_t inPortMask;
284 
286  uint16_t etherType;
287 
290 
293 
295  uint16_t vlanId;
297  uint16_t vlanIdMask;
298 
300 
303 {
306 
307  /* flow instructions */
308 
313 
315  /* If specified, must be CONTROLLER, set to 0 otherwise */
316 
317  uint32_t outputPort;
318 
320 
321 /*------------------------------------------------------------------------------------*/
322 
325 {
326  uint16_t vlanId;
327  uint16_t tunnelId;
328 
333 
335 
338 {
341 
342  /* flow instructions */
348 
352  uint32_t groupID;
355 
359  uint32_t outputPort;
360 
362 
363 /*------------------------------------------------------------------------------------*/
364 
367 {
369  uint16_t etherType;
370 
372  in_addr_t dstIp4;
373 
375  in_addr_t dstIp4Mask;
376 
378  struct in6_addr dstIp6;
379 
381  struct in6_addr dstIp6Mask;
382 
384 
387 {
390 
391  /* flow instructions */
396 
400  uint32_t groupID;
401 
403 
404 /*------------------------------------------------------------------------------------*/
405 
408 {
410  uint16_t etherType;
411 
413  uint16_t vlanId;
414 
416  in_addr_t srcIp4;
417 
419  in_addr_t srcIp4Mask;
420 
422  in_addr_t dstIp4;
423 
425  struct in6_addr srcIp6;
426 
428  struct in6_addr srcIp6Mask;
429 
431  struct in6_addr dstIp6;
432 
434 
437 {
440 
441  /* flow instructions */
446 
449  uint32_t groupID;
450 
452 
453 /*------------------------------------------------------------------------------------*/
454 
457 {
459  uint32_t inPort;
460 
462  uint32_t inPortMask;
463 
466 
469 
472 
475 
478  uint16_t etherType;
479 
481  uint16_t vlanId;
482 
484  uint16_t vlanIdMask;
485 
487  uint16_t vlanPcp;
488 
490  uint16_t vlanPcpMask;
491 
493  uint32_t tunnelId;
494 
496  in_addr_t sourceIp4;
497 
499  in_addr_t sourceIp4Mask;
500 
502  in_addr_t destIp4;
503 
505  in_addr_t destIp4Mask;
506 
508  struct in6_addr sourceIp6;
509 
511  struct in6_addr sourceIp6Mask;
512 
514  struct in6_addr destIp6;
515 
517  struct in6_addr destIp6Mask;
518 
520  uint32_t ipv4ArpSpa;
521 
523  uint32_t ipv4ArpSpaMask;
524 
526  uint16_t ipProto;
527 
529  uint16_t ipProtoMask;
530 
532  uint16_t dscp;
533 
535  uint16_t dscpMask;
536 
538  uint16_t ecn;
539 
541  uint16_t ecnMask;
542 
544  uint32_t srcL4Port;
545 
547  uint32_t srcL4PortMask;
548 
550  uint32_t destL4Port;
551 
553  uint32_t destL4PortMask;
554 
556  uint8_t icmpType;
557 
559  uint8_t icmpTypeMask;
560 
562  uint8_t icmpCode;
563 
565  uint8_t icmpCodeMask;
566 
568  uint32_t ipv6FlowLabel;
569 
572 
574 
575 /* NOTE: ACL Flow Table entries are indexed by the priority value.
576  * This indexing establishes the rule precedence in the TCAM.
577  */
578 
581 {
584 
585  /* flow instructions */
586 
590  uint32_t groupID;
591 
593  uint8_t queueIDAction;
594 
596  uint8_t queueID;
597 
599  uint8_t vlanPcpAction;
600 
602  uint8_t vlanPcp;
603 
605  uint8_t dscpAction;
606 
608  uint8_t dscp;
609 
612 
616  uint32_t outputPort;
617 
620  uint32_t clearActions;
621 
623 
624 
627 typedef struct ofdpaFlowEntry_s
628 {
631 
633  uint32_t priority;
634 
635  union
636  {
639 
642 
645 
648 
651 
654 
657  } flowData;
658 
660  uint32_t hard_time;
661 
663  uint32_t idle_time;
664 
666  uint64_t cookie;
667 
669 
671 typedef struct ofdpaFlowEntryStats_s
672 {
674  uint32_t durationSec;
675 
678  uint64_t receivedPackets;
679 
682  uint64_t receivedBytes;
683 
685 
686 /*------------------------------------------------------------------------------------*/
687 /* group table APIs */
688 
690 typedef enum
691 {
710 
714 
716 typedef enum
717 {
726 
728 
751 typedef struct ofdpaGroupEntry_s
752 {
754  uint32_t groupId;
755 
757 
760 {
762  uint32_t refCount;
763 
765  uint32_t duration;
766 
768  uint32_t bucketCount;
770 
771 /*
772  Group Table entries contain one or more Action Buckets depending on their type.
773  The Group Bucket Table stores these references. It is indexed by groupId and referenceGroupId. The presence
774  of an entry in this table creates a referral by the Group Table entry specified in groupId to the Group Table
775  entry specified in referenceGroupId. Restrictions on the number of references and the allowable type of the
776  referenced Group Table entries varies by entry type.
777 */
778 
781 {
786  uint32_t outputPort;
787 
792  uint32_t popVlanTag;
793 
795 
798 {
802  uint32_t vlanId;
803  ofdpaMacAddr_t srcMac;
804 
806 
809 {
814  ofdpaMacAddr_t dstMac;
815  uint32_t vlanId;
816 
818 
819 typedef struct
820 {
821  /* bucket action set */
822  uint32_t outputPort; /* controller responsible for assuring data in outputPort
823  and the port identifier data encoded in the groupId are equal */
824  /* only Access and Tunnel Endpoint Logical ports are accepted */
826 
827 
830 {
835  ofdpaMacAddr_t dstMac;
836  uint32_t vlanId;
837 
839 
842 {
844  uint32_t groupId;
845 
847  uint32_t bucketIndex;
848 
853 
854  union
855  {
866  } bucketData;
867 
869 
871 typedef struct ofdpaGroupTableInfo_s
872 {
874  uint32_t numGroupEntries;
875 
877  uint32_t maxGroupEntries;
878 
881 
883 
884 
885 /*------------------------------------------------------------------------------------*/
886 /* Port Table */
887 
889 #define OFDPA_PORT_NAME_STRING_SIZE 16
890 
895 typedef enum
896 {
900 
904 typedef enum
905 {
909 
911 typedef enum
912 {
915 
918 
921 
924 
927 
930 
933 
936 
939 
942 
945 
948 
951 
954 
957 
961 
964 typedef struct ofdpaPortFeature_s
965 {
968 
971 
974 
978 
980 typedef struct ofdpaPortStats_s
981 {
983  uint64_t rx_packets;
984 
986  uint64_t tx_packets;
987 
989  uint64_t rx_bytes;
990 
992  uint64_t tx_bytes;
993 
995  uint64_t rx_errors;
996 
998  uint64_t tx_errors;
999 
1001  uint64_t rx_drops;
1002 
1004  uint64_t tx_drops;
1005 
1007  uint64_t rx_frame_err;
1008 
1010  uint64_t rx_over_err;
1011 
1013  uint64_t rx_crc_err;
1014 
1016  uint64_t collisions;
1017 
1021 
1023 #define OFDPA_PKT_LOOKUP 1
1024 
1026 typedef enum
1027 {
1034 
1036 
1038 typedef struct ofdpaPacket_s
1039 {
1042 
1045 
1047  uint32_t inPortNum;
1048 
1051 } ofdpaPacket_t;
1052 
1053 /* Asynchronous Control Events */
1054 
1056 typedef enum
1057 {
1060 
1063 
1066 
1068 
1070 typedef struct ofdpaPortEvent_s
1071 {
1074 
1076  uint32_t portNum;
1077 
1081 
1083 typedef enum
1084 {
1087 
1090 
1092 
1094 typedef struct ofdpaFlowEvent_s
1095 {
1098 
1101 
1103 
1104 /*------------------------------------------------------------------------------------*/
1105 /* Tunnel Logical Port APIs */
1106 
1107 typedef enum
1108 {
1113 
1115 
1116 typedef enum
1117 {
1122 
1124 
1125 typedef struct
1126 {
1129  uint16_t initiatorUdpDstPort;
1130 
1131  uint16_t udpSrcPortIfNoEntropy;
1132  uint16_t useEntropy;
1133 
1135 
1136 typedef struct
1137 {
1138  uint16_t useEntropyInKey;
1139 
1141 
1142 typedef struct
1143 {
1144  uint32_t physicalPortNum;
1145  uint16_t vlanId;
1146  uint16_t etag;
1147  uint16_t untagged;
1148  uint16_t useEtag;
1149 
1151 
1152 typedef struct
1153 {
1154  in_addr_t remoteEndpoint;
1155  in_addr_t localEndpoint;
1156  uint32_t ttl;
1157  uint32_t ecmp;
1158 
1159  uint32_t nextHopId;
1160 
1161  union
1162  {
1163  ofdpaVxlanProtoInfo_t vxlan;
1164  ofdpaNvgreProtoInfo_t nvgre;
1165  } protocolInfo;
1166 
1168 
1169 typedef struct
1170 {
1172  OFDPA_TUNNEL_PROTO_t tunnelProtocol;
1173 
1174  union
1175  {
1176  ofdpaAccessPortConfig_t access;
1177  ofdpaEndpointConfig_t endpoint;
1178  } configData;
1180 
1181 typedef struct
1182 {
1183  uint32_t refCount;
1184  uint32_t tenantCount;
1185 
1187 
1188 typedef struct
1189 {
1190  uint32_t refCount;
1191 
1193 
1194 typedef struct
1195 {
1196  OFDPA_TUNNEL_PROTO_t protocol;
1197  uint32_t virtualNetworkId;
1198 
1199  in_addr_t mcastIp;
1200  uint32_t mcastNextHopId;
1201 
1203 
1204 typedef struct
1205 {
1206  uint32_t refCount;
1207 
1209 
1210 typedef struct
1211 {
1212  OFDPA_TUNNEL_PROTO_t protocol;
1213  ofdpaMacAddr_t srcAddr;
1214  ofdpaMacAddr_t dstAddr;
1215  uint32_t physicalPortNum;
1216  uint16_t vlanId;
1217 
1219 
1220 typedef struct
1221 {
1222  uint32_t refCount;
1223 
1225 
1226 typedef struct
1227 {
1228  OFDPA_TUNNEL_PROTO_t protocol;
1229 
1231 
1232 typedef struct
1233 {
1234  uint32_t refCount;
1235  uint32_t memberCount;
1236 
1238 
1239 /*------------------------------------------------------------------------------------*/
1240 /* Table APIs */
1241 
1243 #define OFDPA_TABLE_NAME_LEN 32
1244 
1246 typedef struct ofdpaFlowTableInfo_s
1247 {
1249  uint32_t numEntries;
1250 
1252  uint32_t maxEntries;
1253 
1254  /* Not supporting any features etc as they will be well documented in programmers
1255  guide
1256  */
1258 
1259 /*------------------------------------------------------------------------------------*/
1260 /* Queue APIs */
1261 
1264 {
1266  uint64_t txBytes;
1267 
1269  uint64_t txPkts;
1270 
1273 
1275 
1276 /*------------------------------------------------------------------------------------*/
1277 /* Vendor Extension APIs */
1278 
1281 {
1284  uint32_t destPortNum;
1285 }
1287 
1288 #endif /* INCLUDE_OFDPA_DATATYPES_H */
1289