0001
0002
0003
0004 #ifndef __FSL_DPKG_H_
0005 #define __FSL_DPKG_H_
0006
0007 #include <linux/types.h>
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #define DPKG_NUM_OF_MASKS 4
0019
0020
0021
0022
0023 #define DPKG_MAX_NUM_OF_EXTRACTS 10
0024
0025
0026
0027
0028
0029
0030
0031 enum dpkg_extract_from_hdr_type {
0032 DPKG_FROM_HDR = 0,
0033 DPKG_FROM_FIELD = 1,
0034 DPKG_FULL_FIELD = 2
0035 };
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 enum dpkg_extract_type {
0046 DPKG_EXTRACT_FROM_HDR = 0,
0047 DPKG_EXTRACT_FROM_DATA = 1,
0048 DPKG_EXTRACT_FROM_PARSE = 3
0049 };
0050
0051
0052
0053
0054
0055
0056 struct dpkg_mask {
0057 u8 mask;
0058 u8 offset;
0059 };
0060
0061
0062
0063
0064 #define NH_FLD_ETH_DA BIT(0)
0065 #define NH_FLD_ETH_SA BIT(1)
0066 #define NH_FLD_ETH_LENGTH BIT(2)
0067 #define NH_FLD_ETH_TYPE BIT(3)
0068 #define NH_FLD_ETH_FINAL_CKSUM BIT(4)
0069 #define NH_FLD_ETH_PADDING BIT(5)
0070 #define NH_FLD_ETH_ALL_FIELDS (BIT(6) - 1)
0071
0072
0073 #define NH_FLD_VLAN_VPRI BIT(0)
0074 #define NH_FLD_VLAN_CFI BIT(1)
0075 #define NH_FLD_VLAN_VID BIT(2)
0076 #define NH_FLD_VLAN_LENGTH BIT(3)
0077 #define NH_FLD_VLAN_TYPE BIT(4)
0078 #define NH_FLD_VLAN_ALL_FIELDS (BIT(5) - 1)
0079
0080 #define NH_FLD_VLAN_TCI (NH_FLD_VLAN_VPRI | \
0081 NH_FLD_VLAN_CFI | \
0082 NH_FLD_VLAN_VID)
0083
0084
0085 #define NH_FLD_IP_VER BIT(0)
0086 #define NH_FLD_IP_DSCP BIT(2)
0087 #define NH_FLD_IP_ECN BIT(3)
0088 #define NH_FLD_IP_PROTO BIT(4)
0089 #define NH_FLD_IP_SRC BIT(5)
0090 #define NH_FLD_IP_DST BIT(6)
0091 #define NH_FLD_IP_TOS_TC BIT(7)
0092 #define NH_FLD_IP_ID BIT(8)
0093 #define NH_FLD_IP_ALL_FIELDS (BIT(9) - 1)
0094
0095
0096 #define NH_FLD_IPV4_VER BIT(0)
0097 #define NH_FLD_IPV4_HDR_LEN BIT(1)
0098 #define NH_FLD_IPV4_TOS BIT(2)
0099 #define NH_FLD_IPV4_TOTAL_LEN BIT(3)
0100 #define NH_FLD_IPV4_ID BIT(4)
0101 #define NH_FLD_IPV4_FLAG_D BIT(5)
0102 #define NH_FLD_IPV4_FLAG_M BIT(6)
0103 #define NH_FLD_IPV4_OFFSET BIT(7)
0104 #define NH_FLD_IPV4_TTL BIT(8)
0105 #define NH_FLD_IPV4_PROTO BIT(9)
0106 #define NH_FLD_IPV4_CKSUM BIT(10)
0107 #define NH_FLD_IPV4_SRC_IP BIT(11)
0108 #define NH_FLD_IPV4_DST_IP BIT(12)
0109 #define NH_FLD_IPV4_OPTS BIT(13)
0110 #define NH_FLD_IPV4_OPTS_COUNT BIT(14)
0111 #define NH_FLD_IPV4_ALL_FIELDS (BIT(15) - 1)
0112
0113
0114 #define NH_FLD_IPV6_VER BIT(0)
0115 #define NH_FLD_IPV6_TC BIT(1)
0116 #define NH_FLD_IPV6_SRC_IP BIT(2)
0117 #define NH_FLD_IPV6_DST_IP BIT(3)
0118 #define NH_FLD_IPV6_NEXT_HDR BIT(4)
0119 #define NH_FLD_IPV6_FL BIT(5)
0120 #define NH_FLD_IPV6_HOP_LIMIT BIT(6)
0121 #define NH_FLD_IPV6_ID BIT(7)
0122 #define NH_FLD_IPV6_ALL_FIELDS (BIT(8) - 1)
0123
0124
0125 #define NH_FLD_ICMP_TYPE BIT(0)
0126 #define NH_FLD_ICMP_CODE BIT(1)
0127 #define NH_FLD_ICMP_CKSUM BIT(2)
0128 #define NH_FLD_ICMP_ID BIT(3)
0129 #define NH_FLD_ICMP_SQ_NUM BIT(4)
0130 #define NH_FLD_ICMP_ALL_FIELDS (BIT(5) - 1)
0131
0132
0133 #define NH_FLD_IGMP_VERSION BIT(0)
0134 #define NH_FLD_IGMP_TYPE BIT(1)
0135 #define NH_FLD_IGMP_CKSUM BIT(2)
0136 #define NH_FLD_IGMP_DATA BIT(3)
0137 #define NH_FLD_IGMP_ALL_FIELDS (BIT(4) - 1)
0138
0139
0140 #define NH_FLD_TCP_PORT_SRC BIT(0)
0141 #define NH_FLD_TCP_PORT_DST BIT(1)
0142 #define NH_FLD_TCP_SEQ BIT(2)
0143 #define NH_FLD_TCP_ACK BIT(3)
0144 #define NH_FLD_TCP_OFFSET BIT(4)
0145 #define NH_FLD_TCP_FLAGS BIT(5)
0146 #define NH_FLD_TCP_WINDOW BIT(6)
0147 #define NH_FLD_TCP_CKSUM BIT(7)
0148 #define NH_FLD_TCP_URGPTR BIT(8)
0149 #define NH_FLD_TCP_OPTS BIT(9)
0150 #define NH_FLD_TCP_OPTS_COUNT BIT(10)
0151 #define NH_FLD_TCP_ALL_FIELDS (BIT(11) - 1)
0152
0153
0154 #define NH_FLD_UDP_PORT_SRC BIT(0)
0155 #define NH_FLD_UDP_PORT_DST BIT(1)
0156 #define NH_FLD_UDP_LEN BIT(2)
0157 #define NH_FLD_UDP_CKSUM BIT(3)
0158 #define NH_FLD_UDP_ALL_FIELDS (BIT(4) - 1)
0159
0160
0161 #define NH_FLD_UDP_LITE_PORT_SRC BIT(0)
0162 #define NH_FLD_UDP_LITE_PORT_DST BIT(1)
0163 #define NH_FLD_UDP_LITE_ALL_FIELDS (BIT(2) - 1)
0164
0165
0166 #define NH_FLD_UDP_ENC_ESP_PORT_SRC BIT(0)
0167 #define NH_FLD_UDP_ENC_ESP_PORT_DST BIT(1)
0168 #define NH_FLD_UDP_ENC_ESP_LEN BIT(2)
0169 #define NH_FLD_UDP_ENC_ESP_CKSUM BIT(3)
0170 #define NH_FLD_UDP_ENC_ESP_SPI BIT(4)
0171 #define NH_FLD_UDP_ENC_ESP_SEQUENCE_NUM BIT(5)
0172 #define NH_FLD_UDP_ENC_ESP_ALL_FIELDS (BIT(6) - 1)
0173
0174
0175 #define NH_FLD_SCTP_PORT_SRC BIT(0)
0176 #define NH_FLD_SCTP_PORT_DST BIT(1)
0177 #define NH_FLD_SCTP_VER_TAG BIT(2)
0178 #define NH_FLD_SCTP_CKSUM BIT(3)
0179 #define NH_FLD_SCTP_ALL_FIELDS (BIT(4) - 1)
0180
0181
0182 #define NH_FLD_DCCP_PORT_SRC BIT(0)
0183 #define NH_FLD_DCCP_PORT_DST BIT(1)
0184 #define NH_FLD_DCCP_ALL_FIELDS (BIT(2) - 1)
0185
0186
0187 #define NH_FLD_IPHC_CID BIT(0)
0188 #define NH_FLD_IPHC_CID_TYPE BIT(1)
0189 #define NH_FLD_IPHC_HCINDEX BIT(2)
0190 #define NH_FLD_IPHC_GEN BIT(3)
0191 #define NH_FLD_IPHC_D_BIT BIT(4)
0192 #define NH_FLD_IPHC_ALL_FIELDS (BIT(5) - 1)
0193
0194
0195 #define NH_FLD_SCTP_CHUNK_DATA_TYPE BIT(0)
0196 #define NH_FLD_SCTP_CHUNK_DATA_FLAGS BIT(1)
0197 #define NH_FLD_SCTP_CHUNK_DATA_LENGTH BIT(2)
0198 #define NH_FLD_SCTP_CHUNK_DATA_TSN BIT(3)
0199 #define NH_FLD_SCTP_CHUNK_DATA_STREAM_ID BIT(4)
0200 #define NH_FLD_SCTP_CHUNK_DATA_STREAM_SQN BIT(5)
0201 #define NH_FLD_SCTP_CHUNK_DATA_PAYLOAD_PID BIT(6)
0202 #define NH_FLD_SCTP_CHUNK_DATA_UNORDERED BIT(7)
0203 #define NH_FLD_SCTP_CHUNK_DATA_BEGGINING BIT(8)
0204 #define NH_FLD_SCTP_CHUNK_DATA_END BIT(9)
0205 #define NH_FLD_SCTP_CHUNK_DATA_ALL_FIELDS (BIT(10) - 1)
0206
0207
0208 #define NH_FLD_L2TPV2_TYPE_BIT BIT(0)
0209 #define NH_FLD_L2TPV2_LENGTH_BIT BIT(1)
0210 #define NH_FLD_L2TPV2_SEQUENCE_BIT BIT(2)
0211 #define NH_FLD_L2TPV2_OFFSET_BIT BIT(3)
0212 #define NH_FLD_L2TPV2_PRIORITY_BIT BIT(4)
0213 #define NH_FLD_L2TPV2_VERSION BIT(5)
0214 #define NH_FLD_L2TPV2_LEN BIT(6)
0215 #define NH_FLD_L2TPV2_TUNNEL_ID BIT(7)
0216 #define NH_FLD_L2TPV2_SESSION_ID BIT(8)
0217 #define NH_FLD_L2TPV2_NS BIT(9)
0218 #define NH_FLD_L2TPV2_NR BIT(10)
0219 #define NH_FLD_L2TPV2_OFFSET_SIZE BIT(11)
0220 #define NH_FLD_L2TPV2_FIRST_BYTE BIT(12)
0221 #define NH_FLD_L2TPV2_ALL_FIELDS (BIT(13) - 1)
0222
0223
0224 #define NH_FLD_L2TPV3_CTRL_TYPE_BIT BIT(0)
0225 #define NH_FLD_L2TPV3_CTRL_LENGTH_BIT BIT(1)
0226 #define NH_FLD_L2TPV3_CTRL_SEQUENCE_BIT BIT(2)
0227 #define NH_FLD_L2TPV3_CTRL_VERSION BIT(3)
0228 #define NH_FLD_L2TPV3_CTRL_LENGTH BIT(4)
0229 #define NH_FLD_L2TPV3_CTRL_CONTROL BIT(5)
0230 #define NH_FLD_L2TPV3_CTRL_SENT BIT(6)
0231 #define NH_FLD_L2TPV3_CTRL_RECV BIT(7)
0232 #define NH_FLD_L2TPV3_CTRL_FIRST_BYTE BIT(8)
0233 #define NH_FLD_L2TPV3_CTRL_ALL_FIELDS (BIT(9) - 1)
0234
0235 #define NH_FLD_L2TPV3_SESS_TYPE_BIT BIT(0)
0236 #define NH_FLD_L2TPV3_SESS_VERSION BIT(1)
0237 #define NH_FLD_L2TPV3_SESS_ID BIT(2)
0238 #define NH_FLD_L2TPV3_SESS_COOKIE BIT(3)
0239 #define NH_FLD_L2TPV3_SESS_ALL_FIELDS (BIT(4) - 1)
0240
0241
0242 #define NH_FLD_PPP_PID BIT(0)
0243 #define NH_FLD_PPP_COMPRESSED BIT(1)
0244 #define NH_FLD_PPP_ALL_FIELDS (BIT(2) - 1)
0245
0246
0247 #define NH_FLD_PPPOE_VER BIT(0)
0248 #define NH_FLD_PPPOE_TYPE BIT(1)
0249 #define NH_FLD_PPPOE_CODE BIT(2)
0250 #define NH_FLD_PPPOE_SID BIT(3)
0251 #define NH_FLD_PPPOE_LEN BIT(4)
0252 #define NH_FLD_PPPOE_SESSION BIT(5)
0253 #define NH_FLD_PPPOE_PID BIT(6)
0254 #define NH_FLD_PPPOE_ALL_FIELDS (BIT(7) - 1)
0255
0256
0257 #define NH_FLD_PPPMUX_PID BIT(0)
0258 #define NH_FLD_PPPMUX_CKSUM BIT(1)
0259 #define NH_FLD_PPPMUX_COMPRESSED BIT(2)
0260 #define NH_FLD_PPPMUX_ALL_FIELDS (BIT(3) - 1)
0261
0262
0263 #define NH_FLD_PPPMUX_SUBFRM_PFF BIT(0)
0264 #define NH_FLD_PPPMUX_SUBFRM_LXT BIT(1)
0265 #define NH_FLD_PPPMUX_SUBFRM_LEN BIT(2)
0266 #define NH_FLD_PPPMUX_SUBFRM_PID BIT(3)
0267 #define NH_FLD_PPPMUX_SUBFRM_USE_PID BIT(4)
0268 #define NH_FLD_PPPMUX_SUBFRM_ALL_FIELDS (BIT(5) - 1)
0269
0270
0271 #define NH_FLD_LLC_DSAP BIT(0)
0272 #define NH_FLD_LLC_SSAP BIT(1)
0273 #define NH_FLD_LLC_CTRL BIT(2)
0274 #define NH_FLD_LLC_ALL_FIELDS (BIT(3) - 1)
0275
0276
0277 #define NH_FLD_NLPID_NLPID BIT(0)
0278 #define NH_FLD_NLPID_ALL_FIELDS (BIT(1) - 1)
0279
0280
0281 #define NH_FLD_SNAP_OUI BIT(0)
0282 #define NH_FLD_SNAP_PID BIT(1)
0283 #define NH_FLD_SNAP_ALL_FIELDS (BIT(2) - 1)
0284
0285
0286 #define NH_FLD_LLC_SNAP_TYPE BIT(0)
0287 #define NH_FLD_LLC_SNAP_ALL_FIELDS (BIT(1) - 1)
0288
0289
0290 #define NH_FLD_ARP_HTYPE BIT(0)
0291 #define NH_FLD_ARP_PTYPE BIT(1)
0292 #define NH_FLD_ARP_HLEN BIT(2)
0293 #define NH_FLD_ARP_PLEN BIT(3)
0294 #define NH_FLD_ARP_OPER BIT(4)
0295 #define NH_FLD_ARP_SHA BIT(5)
0296 #define NH_FLD_ARP_SPA BIT(6)
0297 #define NH_FLD_ARP_THA BIT(7)
0298 #define NH_FLD_ARP_TPA BIT(8)
0299 #define NH_FLD_ARP_ALL_FIELDS (BIT(9) - 1)
0300
0301
0302 #define NH_FLD_RFC2684_LLC BIT(0)
0303 #define NH_FLD_RFC2684_NLPID BIT(1)
0304 #define NH_FLD_RFC2684_OUI BIT(2)
0305 #define NH_FLD_RFC2684_PID BIT(3)
0306 #define NH_FLD_RFC2684_VPN_OUI BIT(4)
0307 #define NH_FLD_RFC2684_VPN_IDX BIT(5)
0308 #define NH_FLD_RFC2684_ALL_FIELDS (BIT(6) - 1)
0309
0310
0311 #define NH_FLD_USER_DEFINED_SRCPORT BIT(0)
0312 #define NH_FLD_USER_DEFINED_PCDID BIT(1)
0313 #define NH_FLD_USER_DEFINED_ALL_FIELDS (BIT(2) - 1)
0314
0315
0316 #define NH_FLD_PAYLOAD_BUFFER BIT(0)
0317 #define NH_FLD_PAYLOAD_SIZE BIT(1)
0318 #define NH_FLD_MAX_FRM_SIZE BIT(2)
0319 #define NH_FLD_MIN_FRM_SIZE BIT(3)
0320 #define NH_FLD_PAYLOAD_TYPE BIT(4)
0321 #define NH_FLD_FRAME_SIZE BIT(5)
0322 #define NH_FLD_PAYLOAD_ALL_FIELDS (BIT(6) - 1)
0323
0324
0325 #define NH_FLD_GRE_TYPE BIT(0)
0326 #define NH_FLD_GRE_ALL_FIELDS (BIT(1) - 1)
0327
0328
0329 #define NH_FLD_MINENCAP_SRC_IP BIT(0)
0330 #define NH_FLD_MINENCAP_DST_IP BIT(1)
0331 #define NH_FLD_MINENCAP_TYPE BIT(2)
0332 #define NH_FLD_MINENCAP_ALL_FIELDS (BIT(3) - 1)
0333
0334
0335 #define NH_FLD_IPSEC_AH_SPI BIT(0)
0336 #define NH_FLD_IPSEC_AH_NH BIT(1)
0337 #define NH_FLD_IPSEC_AH_ALL_FIELDS (BIT(2) - 1)
0338
0339
0340 #define NH_FLD_IPSEC_ESP_SPI BIT(0)
0341 #define NH_FLD_IPSEC_ESP_SEQUENCE_NUM BIT(1)
0342 #define NH_FLD_IPSEC_ESP_ALL_FIELDS (BIT(2) - 1)
0343
0344
0345 #define NH_FLD_MPLS_LABEL_STACK BIT(0)
0346 #define NH_FLD_MPLS_LABEL_STACK_ALL_FIELDS (BIT(1) - 1)
0347
0348
0349 #define NH_FLD_MACSEC_SECTAG BIT(0)
0350 #define NH_FLD_MACSEC_ALL_FIELDS (BIT(1) - 1)
0351
0352
0353 #define NH_FLD_GTP_TEID BIT(0)
0354
0355
0356 enum net_prot {
0357 NET_PROT_NONE = 0,
0358 NET_PROT_PAYLOAD,
0359 NET_PROT_ETH,
0360 NET_PROT_VLAN,
0361 NET_PROT_IPV4,
0362 NET_PROT_IPV6,
0363 NET_PROT_IP,
0364 NET_PROT_TCP,
0365 NET_PROT_UDP,
0366 NET_PROT_UDP_LITE,
0367 NET_PROT_IPHC,
0368 NET_PROT_SCTP,
0369 NET_PROT_SCTP_CHUNK_DATA,
0370 NET_PROT_PPPOE,
0371 NET_PROT_PPP,
0372 NET_PROT_PPPMUX,
0373 NET_PROT_PPPMUX_SUBFRM,
0374 NET_PROT_L2TPV2,
0375 NET_PROT_L2TPV3_CTRL,
0376 NET_PROT_L2TPV3_SESS,
0377 NET_PROT_LLC,
0378 NET_PROT_LLC_SNAP,
0379 NET_PROT_NLPID,
0380 NET_PROT_SNAP,
0381 NET_PROT_MPLS,
0382 NET_PROT_IPSEC_AH,
0383 NET_PROT_IPSEC_ESP,
0384 NET_PROT_UDP_ENC_ESP,
0385 NET_PROT_MACSEC,
0386 NET_PROT_GRE,
0387 NET_PROT_MINENCAP,
0388 NET_PROT_DCCP,
0389 NET_PROT_ICMP,
0390 NET_PROT_IGMP,
0391 NET_PROT_ARP,
0392 NET_PROT_CAPWAP_DATA,
0393 NET_PROT_CAPWAP_CTRL,
0394 NET_PROT_RFC2684,
0395 NET_PROT_ICMPV6,
0396 NET_PROT_FCOE,
0397 NET_PROT_FIP,
0398 NET_PROT_ISCSI,
0399 NET_PROT_GTP,
0400 NET_PROT_USER_DEFINED_L2,
0401 NET_PROT_USER_DEFINED_L3,
0402 NET_PROT_USER_DEFINED_L4,
0403 NET_PROT_USER_DEFINED_L5,
0404 NET_PROT_USER_DEFINED_SHIM1,
0405 NET_PROT_USER_DEFINED_SHIM2,
0406
0407 NET_PROT_DUMMY_LAST
0408 };
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445 struct dpkg_extract {
0446 enum dpkg_extract_type type;
0447 union {
0448 struct {
0449 enum net_prot prot;
0450 enum dpkg_extract_from_hdr_type type;
0451 u32 field;
0452 u8 size;
0453 u8 offset;
0454 u8 hdr_index;
0455 } from_hdr;
0456 struct {
0457 u8 size;
0458 u8 offset;
0459 } from_data;
0460 struct {
0461 u8 size;
0462 u8 offset;
0463 } from_parse;
0464 } extract;
0465
0466 u8 num_of_byte_masks;
0467 struct dpkg_mask masks[DPKG_NUM_OF_MASKS];
0468 };
0469
0470
0471
0472
0473
0474
0475
0476 struct dpkg_profile_cfg {
0477 u8 num_extracts;
0478 struct dpkg_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS];
0479 };
0480
0481 #endif