dpkg.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2. /* Copyright 2013-2015 Freescale Semiconductor Inc.
  3. */
  4. #ifndef __FSL_DPKG_H_
  5. #define __FSL_DPKG_H_
  6. #include <linux/types.h>
  7. /* Data Path Key Generator API
  8. * Contains initialization APIs and runtime APIs for the Key Generator
  9. */
  10. /** Key Generator properties */
  11. /**
  12. * DPKG_NUM_OF_MASKS - Number of masks per key extraction
  13. */
  14. #define DPKG_NUM_OF_MASKS 4
  15. /**
  16. * DPKG_MAX_NUM_OF_EXTRACTS - Number of extractions per key profile
  17. */
  18. #define DPKG_MAX_NUM_OF_EXTRACTS 10
  19. /**
  20. * enum dpkg_extract_from_hdr_type - Selecting extraction by header types
  21. * @DPKG_FROM_HDR: Extract selected bytes from header, by offset
  22. * @DPKG_FROM_FIELD: Extract selected bytes from header, by offset from field
  23. * @DPKG_FULL_FIELD: Extract a full field
  24. */
  25. enum dpkg_extract_from_hdr_type {
  26. DPKG_FROM_HDR = 0,
  27. DPKG_FROM_FIELD = 1,
  28. DPKG_FULL_FIELD = 2
  29. };
  30. /**
  31. * enum dpkg_extract_type - Enumeration for selecting extraction type
  32. * @DPKG_EXTRACT_FROM_HDR: Extract from the header
  33. * @DPKG_EXTRACT_FROM_DATA: Extract from data not in specific header
  34. * @DPKG_EXTRACT_FROM_PARSE: Extract from parser-result;
  35. * e.g. can be used to extract header existence;
  36. * please refer to 'Parse Result definition' section in the parser BG
  37. */
  38. enum dpkg_extract_type {
  39. DPKG_EXTRACT_FROM_HDR = 0,
  40. DPKG_EXTRACT_FROM_DATA = 1,
  41. DPKG_EXTRACT_FROM_PARSE = 3
  42. };
  43. /**
  44. * struct dpkg_mask - A structure for defining a single extraction mask
  45. * @mask: Byte mask for the extracted content
  46. * @offset: Offset within the extracted content
  47. */
  48. struct dpkg_mask {
  49. u8 mask;
  50. u8 offset;
  51. };
  52. /* Protocol fields */
  53. /* Ethernet fields */
  54. #define NH_FLD_ETH_DA BIT(0)
  55. #define NH_FLD_ETH_SA BIT(1)
  56. #define NH_FLD_ETH_LENGTH BIT(2)
  57. #define NH_FLD_ETH_TYPE BIT(3)
  58. #define NH_FLD_ETH_FINAL_CKSUM BIT(4)
  59. #define NH_FLD_ETH_PADDING BIT(5)
  60. #define NH_FLD_ETH_ALL_FIELDS (BIT(6) - 1)
  61. /* VLAN fields */
  62. #define NH_FLD_VLAN_VPRI BIT(0)
  63. #define NH_FLD_VLAN_CFI BIT(1)
  64. #define NH_FLD_VLAN_VID BIT(2)
  65. #define NH_FLD_VLAN_LENGTH BIT(3)
  66. #define NH_FLD_VLAN_TYPE BIT(4)
  67. #define NH_FLD_VLAN_ALL_FIELDS (BIT(5) - 1)
  68. #define NH_FLD_VLAN_TCI (NH_FLD_VLAN_VPRI | \
  69. NH_FLD_VLAN_CFI | \
  70. NH_FLD_VLAN_VID)
  71. /* IP (generic) fields */
  72. #define NH_FLD_IP_VER BIT(0)
  73. #define NH_FLD_IP_DSCP BIT(2)
  74. #define NH_FLD_IP_ECN BIT(3)
  75. #define NH_FLD_IP_PROTO BIT(4)
  76. #define NH_FLD_IP_SRC BIT(5)
  77. #define NH_FLD_IP_DST BIT(6)
  78. #define NH_FLD_IP_TOS_TC BIT(7)
  79. #define NH_FLD_IP_ID BIT(8)
  80. #define NH_FLD_IP_ALL_FIELDS (BIT(9) - 1)
  81. /* IPV4 fields */
  82. #define NH_FLD_IPV4_VER BIT(0)
  83. #define NH_FLD_IPV4_HDR_LEN BIT(1)
  84. #define NH_FLD_IPV4_TOS BIT(2)
  85. #define NH_FLD_IPV4_TOTAL_LEN BIT(3)
  86. #define NH_FLD_IPV4_ID BIT(4)
  87. #define NH_FLD_IPV4_FLAG_D BIT(5)
  88. #define NH_FLD_IPV4_FLAG_M BIT(6)
  89. #define NH_FLD_IPV4_OFFSET BIT(7)
  90. #define NH_FLD_IPV4_TTL BIT(8)
  91. #define NH_FLD_IPV4_PROTO BIT(9)
  92. #define NH_FLD_IPV4_CKSUM BIT(10)
  93. #define NH_FLD_IPV4_SRC_IP BIT(11)
  94. #define NH_FLD_IPV4_DST_IP BIT(12)
  95. #define NH_FLD_IPV4_OPTS BIT(13)
  96. #define NH_FLD_IPV4_OPTS_COUNT BIT(14)
  97. #define NH_FLD_IPV4_ALL_FIELDS (BIT(15) - 1)
  98. /* IPV6 fields */
  99. #define NH_FLD_IPV6_VER BIT(0)
  100. #define NH_FLD_IPV6_TC BIT(1)
  101. #define NH_FLD_IPV6_SRC_IP BIT(2)
  102. #define NH_FLD_IPV6_DST_IP BIT(3)
  103. #define NH_FLD_IPV6_NEXT_HDR BIT(4)
  104. #define NH_FLD_IPV6_FL BIT(5)
  105. #define NH_FLD_IPV6_HOP_LIMIT BIT(6)
  106. #define NH_FLD_IPV6_ID BIT(7)
  107. #define NH_FLD_IPV6_ALL_FIELDS (BIT(8) - 1)
  108. /* ICMP fields */
  109. #define NH_FLD_ICMP_TYPE BIT(0)
  110. #define NH_FLD_ICMP_CODE BIT(1)
  111. #define NH_FLD_ICMP_CKSUM BIT(2)
  112. #define NH_FLD_ICMP_ID BIT(3)
  113. #define NH_FLD_ICMP_SQ_NUM BIT(4)
  114. #define NH_FLD_ICMP_ALL_FIELDS (BIT(5) - 1)
  115. /* IGMP fields */
  116. #define NH_FLD_IGMP_VERSION BIT(0)
  117. #define NH_FLD_IGMP_TYPE BIT(1)
  118. #define NH_FLD_IGMP_CKSUM BIT(2)
  119. #define NH_FLD_IGMP_DATA BIT(3)
  120. #define NH_FLD_IGMP_ALL_FIELDS (BIT(4) - 1)
  121. /* TCP fields */
  122. #define NH_FLD_TCP_PORT_SRC BIT(0)
  123. #define NH_FLD_TCP_PORT_DST BIT(1)
  124. #define NH_FLD_TCP_SEQ BIT(2)
  125. #define NH_FLD_TCP_ACK BIT(3)
  126. #define NH_FLD_TCP_OFFSET BIT(4)
  127. #define NH_FLD_TCP_FLAGS BIT(5)
  128. #define NH_FLD_TCP_WINDOW BIT(6)
  129. #define NH_FLD_TCP_CKSUM BIT(7)
  130. #define NH_FLD_TCP_URGPTR BIT(8)
  131. #define NH_FLD_TCP_OPTS BIT(9)
  132. #define NH_FLD_TCP_OPTS_COUNT BIT(10)
  133. #define NH_FLD_TCP_ALL_FIELDS (BIT(11) - 1)
  134. /* UDP fields */
  135. #define NH_FLD_UDP_PORT_SRC BIT(0)
  136. #define NH_FLD_UDP_PORT_DST BIT(1)
  137. #define NH_FLD_UDP_LEN BIT(2)
  138. #define NH_FLD_UDP_CKSUM BIT(3)
  139. #define NH_FLD_UDP_ALL_FIELDS (BIT(4) - 1)
  140. /* UDP-lite fields */
  141. #define NH_FLD_UDP_LITE_PORT_SRC BIT(0)
  142. #define NH_FLD_UDP_LITE_PORT_DST BIT(1)
  143. #define NH_FLD_UDP_LITE_ALL_FIELDS (BIT(2) - 1)
  144. /* UDP-encap-ESP fields */
  145. #define NH_FLD_UDP_ENC_ESP_PORT_SRC BIT(0)
  146. #define NH_FLD_UDP_ENC_ESP_PORT_DST BIT(1)
  147. #define NH_FLD_UDP_ENC_ESP_LEN BIT(2)
  148. #define NH_FLD_UDP_ENC_ESP_CKSUM BIT(3)
  149. #define NH_FLD_UDP_ENC_ESP_SPI BIT(4)
  150. #define NH_FLD_UDP_ENC_ESP_SEQUENCE_NUM BIT(5)
  151. #define NH_FLD_UDP_ENC_ESP_ALL_FIELDS (BIT(6) - 1)
  152. /* SCTP fields */
  153. #define NH_FLD_SCTP_PORT_SRC BIT(0)
  154. #define NH_FLD_SCTP_PORT_DST BIT(1)
  155. #define NH_FLD_SCTP_VER_TAG BIT(2)
  156. #define NH_FLD_SCTP_CKSUM BIT(3)
  157. #define NH_FLD_SCTP_ALL_FIELDS (BIT(4) - 1)
  158. /* DCCP fields */
  159. #define NH_FLD_DCCP_PORT_SRC BIT(0)
  160. #define NH_FLD_DCCP_PORT_DST BIT(1)
  161. #define NH_FLD_DCCP_ALL_FIELDS (BIT(2) - 1)
  162. /* IPHC fields */
  163. #define NH_FLD_IPHC_CID BIT(0)
  164. #define NH_FLD_IPHC_CID_TYPE BIT(1)
  165. #define NH_FLD_IPHC_HCINDEX BIT(2)
  166. #define NH_FLD_IPHC_GEN BIT(3)
  167. #define NH_FLD_IPHC_D_BIT BIT(4)
  168. #define NH_FLD_IPHC_ALL_FIELDS (BIT(5) - 1)
  169. /* SCTP fields */
  170. #define NH_FLD_SCTP_CHUNK_DATA_TYPE BIT(0)
  171. #define NH_FLD_SCTP_CHUNK_DATA_FLAGS BIT(1)
  172. #define NH_FLD_SCTP_CHUNK_DATA_LENGTH BIT(2)
  173. #define NH_FLD_SCTP_CHUNK_DATA_TSN BIT(3)
  174. #define NH_FLD_SCTP_CHUNK_DATA_STREAM_ID BIT(4)
  175. #define NH_FLD_SCTP_CHUNK_DATA_STREAM_SQN BIT(5)
  176. #define NH_FLD_SCTP_CHUNK_DATA_PAYLOAD_PID BIT(6)
  177. #define NH_FLD_SCTP_CHUNK_DATA_UNORDERED BIT(7)
  178. #define NH_FLD_SCTP_CHUNK_DATA_BEGGINING BIT(8)
  179. #define NH_FLD_SCTP_CHUNK_DATA_END BIT(9)
  180. #define NH_FLD_SCTP_CHUNK_DATA_ALL_FIELDS (BIT(10) - 1)
  181. /* L2TPV2 fields */
  182. #define NH_FLD_L2TPV2_TYPE_BIT BIT(0)
  183. #define NH_FLD_L2TPV2_LENGTH_BIT BIT(1)
  184. #define NH_FLD_L2TPV2_SEQUENCE_BIT BIT(2)
  185. #define NH_FLD_L2TPV2_OFFSET_BIT BIT(3)
  186. #define NH_FLD_L2TPV2_PRIORITY_BIT BIT(4)
  187. #define NH_FLD_L2TPV2_VERSION BIT(5)
  188. #define NH_FLD_L2TPV2_LEN BIT(6)
  189. #define NH_FLD_L2TPV2_TUNNEL_ID BIT(7)
  190. #define NH_FLD_L2TPV2_SESSION_ID BIT(8)
  191. #define NH_FLD_L2TPV2_NS BIT(9)
  192. #define NH_FLD_L2TPV2_NR BIT(10)
  193. #define NH_FLD_L2TPV2_OFFSET_SIZE BIT(11)
  194. #define NH_FLD_L2TPV2_FIRST_BYTE BIT(12)
  195. #define NH_FLD_L2TPV2_ALL_FIELDS (BIT(13) - 1)
  196. /* L2TPV3 fields */
  197. #define NH_FLD_L2TPV3_CTRL_TYPE_BIT BIT(0)
  198. #define NH_FLD_L2TPV3_CTRL_LENGTH_BIT BIT(1)
  199. #define NH_FLD_L2TPV3_CTRL_SEQUENCE_BIT BIT(2)
  200. #define NH_FLD_L2TPV3_CTRL_VERSION BIT(3)
  201. #define NH_FLD_L2TPV3_CTRL_LENGTH BIT(4)
  202. #define NH_FLD_L2TPV3_CTRL_CONTROL BIT(5)
  203. #define NH_FLD_L2TPV3_CTRL_SENT BIT(6)
  204. #define NH_FLD_L2TPV3_CTRL_RECV BIT(7)
  205. #define NH_FLD_L2TPV3_CTRL_FIRST_BYTE BIT(8)
  206. #define NH_FLD_L2TPV3_CTRL_ALL_FIELDS (BIT(9) - 1)
  207. #define NH_FLD_L2TPV3_SESS_TYPE_BIT BIT(0)
  208. #define NH_FLD_L2TPV3_SESS_VERSION BIT(1)
  209. #define NH_FLD_L2TPV3_SESS_ID BIT(2)
  210. #define NH_FLD_L2TPV3_SESS_COOKIE BIT(3)
  211. #define NH_FLD_L2TPV3_SESS_ALL_FIELDS (BIT(4) - 1)
  212. /* PPP fields */
  213. #define NH_FLD_PPP_PID BIT(0)
  214. #define NH_FLD_PPP_COMPRESSED BIT(1)
  215. #define NH_FLD_PPP_ALL_FIELDS (BIT(2) - 1)
  216. /* PPPoE fields */
  217. #define NH_FLD_PPPOE_VER BIT(0)
  218. #define NH_FLD_PPPOE_TYPE BIT(1)
  219. #define NH_FLD_PPPOE_CODE BIT(2)
  220. #define NH_FLD_PPPOE_SID BIT(3)
  221. #define NH_FLD_PPPOE_LEN BIT(4)
  222. #define NH_FLD_PPPOE_SESSION BIT(5)
  223. #define NH_FLD_PPPOE_PID BIT(6)
  224. #define NH_FLD_PPPOE_ALL_FIELDS (BIT(7) - 1)
  225. /* PPP-Mux fields */
  226. #define NH_FLD_PPPMUX_PID BIT(0)
  227. #define NH_FLD_PPPMUX_CKSUM BIT(1)
  228. #define NH_FLD_PPPMUX_COMPRESSED BIT(2)
  229. #define NH_FLD_PPPMUX_ALL_FIELDS (BIT(3) - 1)
  230. /* PPP-Mux sub-frame fields */
  231. #define NH_FLD_PPPMUX_SUBFRM_PFF BIT(0)
  232. #define NH_FLD_PPPMUX_SUBFRM_LXT BIT(1)
  233. #define NH_FLD_PPPMUX_SUBFRM_LEN BIT(2)
  234. #define NH_FLD_PPPMUX_SUBFRM_PID BIT(3)
  235. #define NH_FLD_PPPMUX_SUBFRM_USE_PID BIT(4)
  236. #define NH_FLD_PPPMUX_SUBFRM_ALL_FIELDS (BIT(5) - 1)
  237. /* LLC fields */
  238. #define NH_FLD_LLC_DSAP BIT(0)
  239. #define NH_FLD_LLC_SSAP BIT(1)
  240. #define NH_FLD_LLC_CTRL BIT(2)
  241. #define NH_FLD_LLC_ALL_FIELDS (BIT(3) - 1)
  242. /* NLPID fields */
  243. #define NH_FLD_NLPID_NLPID BIT(0)
  244. #define NH_FLD_NLPID_ALL_FIELDS (BIT(1) - 1)
  245. /* SNAP fields */
  246. #define NH_FLD_SNAP_OUI BIT(0)
  247. #define NH_FLD_SNAP_PID BIT(1)
  248. #define NH_FLD_SNAP_ALL_FIELDS (BIT(2) - 1)
  249. /* LLC SNAP fields */
  250. #define NH_FLD_LLC_SNAP_TYPE BIT(0)
  251. #define NH_FLD_LLC_SNAP_ALL_FIELDS (BIT(1) - 1)
  252. /* ARP fields */
  253. #define NH_FLD_ARP_HTYPE BIT(0)
  254. #define NH_FLD_ARP_PTYPE BIT(1)
  255. #define NH_FLD_ARP_HLEN BIT(2)
  256. #define NH_FLD_ARP_PLEN BIT(3)
  257. #define NH_FLD_ARP_OPER BIT(4)
  258. #define NH_FLD_ARP_SHA BIT(5)
  259. #define NH_FLD_ARP_SPA BIT(6)
  260. #define NH_FLD_ARP_THA BIT(7)
  261. #define NH_FLD_ARP_TPA BIT(8)
  262. #define NH_FLD_ARP_ALL_FIELDS (BIT(9) - 1)
  263. /* RFC2684 fields */
  264. #define NH_FLD_RFC2684_LLC BIT(0)
  265. #define NH_FLD_RFC2684_NLPID BIT(1)
  266. #define NH_FLD_RFC2684_OUI BIT(2)
  267. #define NH_FLD_RFC2684_PID BIT(3)
  268. #define NH_FLD_RFC2684_VPN_OUI BIT(4)
  269. #define NH_FLD_RFC2684_VPN_IDX BIT(5)
  270. #define NH_FLD_RFC2684_ALL_FIELDS (BIT(6) - 1)
  271. /* User defined fields */
  272. #define NH_FLD_USER_DEFINED_SRCPORT BIT(0)
  273. #define NH_FLD_USER_DEFINED_PCDID BIT(1)
  274. #define NH_FLD_USER_DEFINED_ALL_FIELDS (BIT(2) - 1)
  275. /* Payload fields */
  276. #define NH_FLD_PAYLOAD_BUFFER BIT(0)
  277. #define NH_FLD_PAYLOAD_SIZE BIT(1)
  278. #define NH_FLD_MAX_FRM_SIZE BIT(2)
  279. #define NH_FLD_MIN_FRM_SIZE BIT(3)
  280. #define NH_FLD_PAYLOAD_TYPE BIT(4)
  281. #define NH_FLD_FRAME_SIZE BIT(5)
  282. #define NH_FLD_PAYLOAD_ALL_FIELDS (BIT(6) - 1)
  283. /* GRE fields */
  284. #define NH_FLD_GRE_TYPE BIT(0)
  285. #define NH_FLD_GRE_ALL_FIELDS (BIT(1) - 1)
  286. /* MINENCAP fields */
  287. #define NH_FLD_MINENCAP_SRC_IP BIT(0)
  288. #define NH_FLD_MINENCAP_DST_IP BIT(1)
  289. #define NH_FLD_MINENCAP_TYPE BIT(2)
  290. #define NH_FLD_MINENCAP_ALL_FIELDS (BIT(3) - 1)
  291. /* IPSEC AH fields */
  292. #define NH_FLD_IPSEC_AH_SPI BIT(0)
  293. #define NH_FLD_IPSEC_AH_NH BIT(1)
  294. #define NH_FLD_IPSEC_AH_ALL_FIELDS (BIT(2) - 1)
  295. /* IPSEC ESP fields */
  296. #define NH_FLD_IPSEC_ESP_SPI BIT(0)
  297. #define NH_FLD_IPSEC_ESP_SEQUENCE_NUM BIT(1)
  298. #define NH_FLD_IPSEC_ESP_ALL_FIELDS (BIT(2) - 1)
  299. /* MPLS fields */
  300. #define NH_FLD_MPLS_LABEL_STACK BIT(0)
  301. #define NH_FLD_MPLS_LABEL_STACK_ALL_FIELDS (BIT(1) - 1)
  302. /* MACSEC fields */
  303. #define NH_FLD_MACSEC_SECTAG BIT(0)
  304. #define NH_FLD_MACSEC_ALL_FIELDS (BIT(1) - 1)
  305. /* GTP fields */
  306. #define NH_FLD_GTP_TEID BIT(0)
  307. /* Supported protocols */
  308. enum net_prot {
  309. NET_PROT_NONE = 0,
  310. NET_PROT_PAYLOAD,
  311. NET_PROT_ETH,
  312. NET_PROT_VLAN,
  313. NET_PROT_IPV4,
  314. NET_PROT_IPV6,
  315. NET_PROT_IP,
  316. NET_PROT_TCP,
  317. NET_PROT_UDP,
  318. NET_PROT_UDP_LITE,
  319. NET_PROT_IPHC,
  320. NET_PROT_SCTP,
  321. NET_PROT_SCTP_CHUNK_DATA,
  322. NET_PROT_PPPOE,
  323. NET_PROT_PPP,
  324. NET_PROT_PPPMUX,
  325. NET_PROT_PPPMUX_SUBFRM,
  326. NET_PROT_L2TPV2,
  327. NET_PROT_L2TPV3_CTRL,
  328. NET_PROT_L2TPV3_SESS,
  329. NET_PROT_LLC,
  330. NET_PROT_LLC_SNAP,
  331. NET_PROT_NLPID,
  332. NET_PROT_SNAP,
  333. NET_PROT_MPLS,
  334. NET_PROT_IPSEC_AH,
  335. NET_PROT_IPSEC_ESP,
  336. NET_PROT_UDP_ENC_ESP, /* RFC 3948 */
  337. NET_PROT_MACSEC,
  338. NET_PROT_GRE,
  339. NET_PROT_MINENCAP,
  340. NET_PROT_DCCP,
  341. NET_PROT_ICMP,
  342. NET_PROT_IGMP,
  343. NET_PROT_ARP,
  344. NET_PROT_CAPWAP_DATA,
  345. NET_PROT_CAPWAP_CTRL,
  346. NET_PROT_RFC2684,
  347. NET_PROT_ICMPV6,
  348. NET_PROT_FCOE,
  349. NET_PROT_FIP,
  350. NET_PROT_ISCSI,
  351. NET_PROT_GTP,
  352. NET_PROT_USER_DEFINED_L2,
  353. NET_PROT_USER_DEFINED_L3,
  354. NET_PROT_USER_DEFINED_L4,
  355. NET_PROT_USER_DEFINED_L5,
  356. NET_PROT_USER_DEFINED_SHIM1,
  357. NET_PROT_USER_DEFINED_SHIM2,
  358. NET_PROT_DUMMY_LAST
  359. };
  360. /**
  361. * struct dpkg_extract - A structure for defining a single extraction
  362. * @type: Determines how the union below is interpreted:
  363. * DPKG_EXTRACT_FROM_HDR: selects 'from_hdr';
  364. * DPKG_EXTRACT_FROM_DATA: selects 'from_data';
  365. * DPKG_EXTRACT_FROM_PARSE: selects 'from_parse'
  366. * @extract: Selects extraction method
  367. * @extract.from_hdr: Used when 'type = DPKG_EXTRACT_FROM_HDR'
  368. * @extract.from_data: Used when 'type = DPKG_EXTRACT_FROM_DATA'
  369. * @extract.from_parse: Used when 'type = DPKG_EXTRACT_FROM_PARSE'
  370. * @extract.from_hdr.prot: Any of the supported headers
  371. * @extract.from_hdr.type: Defines the type of header extraction:
  372. * DPKG_FROM_HDR: use size & offset below;
  373. * DPKG_FROM_FIELD: use field, size and offset below;
  374. * DPKG_FULL_FIELD: use field below
  375. * @extract.from_hdr.field: One of the supported fields (NH_FLD_)
  376. * @extract.from_hdr.size: Size in bytes
  377. * @extract.from_hdr.offset: Byte offset
  378. * @extract.from_hdr.hdr_index: Clear for cases not listed below;
  379. * Used for protocols that may have more than a single
  380. * header, 0 indicates an outer header;
  381. * Supported protocols (possible values):
  382. * NET_PROT_VLAN (0, HDR_INDEX_LAST);
  383. * NET_PROT_MPLS (0, 1, HDR_INDEX_LAST);
  384. * NET_PROT_IP(0, HDR_INDEX_LAST);
  385. * NET_PROT_IPv4(0, HDR_INDEX_LAST);
  386. * NET_PROT_IPv6(0, HDR_INDEX_LAST);
  387. * @extract.from_data.size: Size in bytes
  388. * @extract.from_data.offset: Byte offset
  389. * @extract.from_parse.size: Size in bytes
  390. * @extract.from_parse.offset: Byte offset
  391. * @num_of_byte_masks: Defines the number of valid entries in the array below;
  392. * This is also the number of bytes to be used as masks
  393. * @masks: Masks parameters
  394. */
  395. struct dpkg_extract {
  396. enum dpkg_extract_type type;
  397. union {
  398. struct {
  399. enum net_prot prot;
  400. enum dpkg_extract_from_hdr_type type;
  401. u32 field;
  402. u8 size;
  403. u8 offset;
  404. u8 hdr_index;
  405. } from_hdr;
  406. struct {
  407. u8 size;
  408. u8 offset;
  409. } from_data;
  410. struct {
  411. u8 size;
  412. u8 offset;
  413. } from_parse;
  414. } extract;
  415. u8 num_of_byte_masks;
  416. struct dpkg_mask masks[DPKG_NUM_OF_MASKS];
  417. };
  418. /**
  419. * struct dpkg_profile_cfg - A structure for defining a full Key Generation
  420. * profile (rule)
  421. * @num_extracts: Defines the number of valid entries in the array below
  422. * @extracts: Array of required extractions
  423. */
  424. struct dpkg_profile_cfg {
  425. u8 num_extracts;
  426. struct dpkg_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS];
  427. };
  428. #endif /* __FSL_DPKG_H_ */