Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
0002 /* Copyright 2013-2015 Freescale Semiconductor Inc.
0003  */
0004 #ifndef __FSL_DPKG_H_
0005 #define __FSL_DPKG_H_
0006 
0007 #include <linux/types.h>
0008 
0009 /* Data Path Key Generator API
0010  * Contains initialization APIs and runtime APIs for the Key Generator
0011  */
0012 
0013 /** Key Generator properties */
0014 
0015 /**
0016  * DPKG_NUM_OF_MASKS - Number of masks per key extraction
0017  */
0018 #define DPKG_NUM_OF_MASKS       4
0019 
0020 /**
0021  * DPKG_MAX_NUM_OF_EXTRACTS - Number of extractions per key profile
0022  */
0023 #define DPKG_MAX_NUM_OF_EXTRACTS    10
0024 
0025 /**
0026  * enum dpkg_extract_from_hdr_type - Selecting extraction by header types
0027  * @DPKG_FROM_HDR: Extract selected bytes from header, by offset
0028  * @DPKG_FROM_FIELD: Extract selected bytes from header, by offset from field
0029  * @DPKG_FULL_FIELD: Extract a full field
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  * enum dpkg_extract_type - Enumeration for selecting extraction type
0039  * @DPKG_EXTRACT_FROM_HDR: Extract from the header
0040  * @DPKG_EXTRACT_FROM_DATA: Extract from data not in specific header
0041  * @DPKG_EXTRACT_FROM_PARSE: Extract from parser-result;
0042  *  e.g. can be used to extract header existence;
0043  *  please refer to 'Parse Result definition' section in the parser BG
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  * struct dpkg_mask - A structure for defining a single extraction mask
0053  * @mask: Byte mask for the extracted content
0054  * @offset: Offset within the extracted content
0055  */
0056 struct dpkg_mask {
0057     u8 mask;
0058     u8 offset;
0059 };
0060 
0061 /* Protocol fields */
0062 
0063 /* Ethernet fields */
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 /* VLAN fields */
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 /* IP (generic) fields */
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 /* IPV4 fields */
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 /* IPV6 fields */
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 /* ICMP fields */
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 /* IGMP fields */
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 /* TCP fields */
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 /* UDP fields */
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 /* UDP-lite fields */
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 /* UDP-encap-ESP fields */
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 /* SCTP fields */
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 /* DCCP fields */
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 /* IPHC fields */
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 /* SCTP fields */
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 /* L2TPV2 fields */
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 /* L2TPV3 fields */
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 /* PPP fields */
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 /* PPPoE fields */
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 /* PPP-Mux fields */
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 /* PPP-Mux sub-frame fields */
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 /* LLC fields */
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 /* NLPID fields */
0277 #define NH_FLD_NLPID_NLPID          BIT(0)
0278 #define NH_FLD_NLPID_ALL_FIELDS         (BIT(1) - 1)
0279 
0280 /* SNAP fields */
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 /* LLC SNAP fields */
0286 #define NH_FLD_LLC_SNAP_TYPE            BIT(0)
0287 #define NH_FLD_LLC_SNAP_ALL_FIELDS      (BIT(1) - 1)
0288 
0289 /* ARP fields */
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 /* RFC2684 fields */
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 /* User defined fields */
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 /* Payload fields */
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 /* GRE fields */
0325 #define NH_FLD_GRE_TYPE             BIT(0)
0326 #define NH_FLD_GRE_ALL_FIELDS           (BIT(1) - 1)
0327 
0328 /* MINENCAP fields */
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 /* IPSEC AH fields */
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 /* IPSEC ESP fields */
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 /* MPLS fields */
0345 #define NH_FLD_MPLS_LABEL_STACK         BIT(0)
0346 #define NH_FLD_MPLS_LABEL_STACK_ALL_FIELDS  (BIT(1) - 1)
0347 
0348 /* MACSEC fields */
0349 #define NH_FLD_MACSEC_SECTAG            BIT(0)
0350 #define NH_FLD_MACSEC_ALL_FIELDS        (BIT(1) - 1)
0351 
0352 /* GTP fields */
0353 #define NH_FLD_GTP_TEID             BIT(0)
0354 
0355 /* Supported protocols */
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, /* RFC 3948 */
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  * struct dpkg_extract - A structure for defining a single extraction
0412  * @type: Determines how the union below is interpreted:
0413  *  DPKG_EXTRACT_FROM_HDR: selects 'from_hdr';
0414  *  DPKG_EXTRACT_FROM_DATA: selects 'from_data';
0415  *  DPKG_EXTRACT_FROM_PARSE: selects 'from_parse'
0416  * @extract: Selects extraction method
0417  * @extract.from_hdr: Used when 'type = DPKG_EXTRACT_FROM_HDR'
0418  * @extract.from_data: Used when 'type = DPKG_EXTRACT_FROM_DATA'
0419  * @extract.from_parse:  Used when 'type = DPKG_EXTRACT_FROM_PARSE'
0420  * @extract.from_hdr.prot: Any of the supported headers
0421  * @extract.from_hdr.type: Defines the type of header extraction:
0422  *  DPKG_FROM_HDR: use size & offset below;
0423  *  DPKG_FROM_FIELD: use field, size and offset below;
0424  *  DPKG_FULL_FIELD: use field below
0425  * @extract.from_hdr.field: One of the supported fields (NH_FLD_)
0426  * @extract.from_hdr.size: Size in bytes
0427  * @extract.from_hdr.offset: Byte offset
0428  * @extract.from_hdr.hdr_index: Clear for cases not listed below;
0429  *  Used for protocols that may have more than a single
0430  *  header, 0 indicates an outer header;
0431  *  Supported protocols (possible values):
0432  *  NET_PROT_VLAN (0, HDR_INDEX_LAST);
0433  *  NET_PROT_MPLS (0, 1, HDR_INDEX_LAST);
0434  *  NET_PROT_IP(0, HDR_INDEX_LAST);
0435  *  NET_PROT_IPv4(0, HDR_INDEX_LAST);
0436  *  NET_PROT_IPv6(0, HDR_INDEX_LAST);
0437  * @extract.from_data.size: Size in bytes
0438  * @extract.from_data.offset: Byte offset
0439  * @extract.from_parse.size: Size in bytes
0440  * @extract.from_parse.offset: Byte offset
0441  * @num_of_byte_masks: Defines the number of valid entries in the array below;
0442  *      This is also the number of bytes to be used as masks
0443  * @masks: Masks parameters
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  * struct dpkg_profile_cfg - A structure for defining a full Key Generation
0472  *              profile (rule)
0473  * @num_extracts: Defines the number of valid entries in the array below
0474  * @extracts: Array of required extractions
0475  */
0476 struct dpkg_profile_cfg {
0477     u8 num_extracts;
0478     struct dpkg_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS];
0479 };
0480 
0481 #endif /* __FSL_DPKG_H_ */