1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21bd758ebSJiri Pirko #ifndef _NET_FLOW_DISSECTOR_H 31bd758ebSJiri Pirko #define _NET_FLOW_DISSECTOR_H 41bd758ebSJiri Pirko 5c3f8eaebSJiri Pirko #include <linux/types.h> 6b924933cSJiri Pirko #include <linux/in6.h> 755667441SEric Dumazet #include <linux/siphash.h> 88a9093c7SJason Baron #include <linux/string.h> 967a900ccSJiri Pirko #include <uapi/linux/if_ether.h> 10c3f8eaebSJiri Pirko 11b27f7bb5SJakub Sitnicki struct bpf_prog; 12b27f7bb5SJakub Sitnicki struct net; 135dec597eSMatteo Croce struct sk_buff; 145dec597eSMatteo Croce 15fbff949eSJiri Pirko /** 1642aecaa9STom Herbert * struct flow_dissector_key_control: 1742aecaa9STom Herbert * @thoff: Transport header offset 1842aecaa9STom Herbert */ 1942aecaa9STom Herbert struct flow_dissector_key_control { 2042aecaa9STom Herbert u16 thoff; 21c3f83241STom Herbert u16 addr_type; 224b36993dSDavid S. Miller u32 flags; 2342aecaa9STom Herbert }; 2442aecaa9STom Herbert 254b36993dSDavid S. Miller #define FLOW_DIS_IS_FRAGMENT BIT(0) 264b36993dSDavid S. Miller #define FLOW_DIS_FIRST_FRAG BIT(1) 274b36993dSDavid S. Miller #define FLOW_DIS_ENCAPSULATION BIT(2) 284b36993dSDavid S. Miller 293a1214e8STom Herbert enum flow_dissect_ret { 303a1214e8STom Herbert FLOW_DISSECT_RET_OUT_GOOD, 313a1214e8STom Herbert FLOW_DISSECT_RET_OUT_BAD, 323a1214e8STom Herbert FLOW_DISSECT_RET_PROTO_AGAIN, 333a1214e8STom Herbert FLOW_DISSECT_RET_IPPROTO_AGAIN, 343a1214e8STom Herbert FLOW_DISSECT_RET_CONTINUE, 353a1214e8STom Herbert }; 363a1214e8STom Herbert 3742aecaa9STom Herbert /** 38fbff949eSJiri Pirko * struct flow_dissector_key_basic: 39fbff949eSJiri Pirko * @n_proto: Network header protocol (eg. IPv4/IPv6) 40fbff949eSJiri Pirko * @ip_proto: Transport header protocol (eg. TCP/UDP) 41fbff949eSJiri Pirko */ 42fbff949eSJiri Pirko struct flow_dissector_key_basic { 43fbff949eSJiri Pirko __be16 n_proto; 44fbff949eSJiri Pirko u8 ip_proto; 4542aecaa9STom Herbert u8 padding; 46fbff949eSJiri Pirko }; 47fbff949eSJiri Pirko 48d34af823STom Herbert struct flow_dissector_key_tags { 49f6a66927SHadar Hen Zion u32 flow_label; 50f6a66927SHadar Hen Zion }; 51f6a66927SHadar Hen Zion 52f6a66927SHadar Hen Zion struct flow_dissector_key_vlan { 53a82055afSPablo Neira Ayuso union { 54d1746d1eSPetr Machata struct { 55f6a66927SHadar Hen Zion u16 vlan_id:12, 56f0d2ca15SMaxime Chevallier vlan_dei:1, 57f6a66927SHadar Hen Zion vlan_priority:3; 58d1746d1eSPetr Machata }; 59a82055afSPablo Neira Ayuso __be16 vlan_tci; 60a82055afSPablo Neira Ayuso }; 612064c3d4SJianbo Liu __be16 vlan_tpid; 62d34af823STom Herbert }; 63d34af823STom Herbert 6458cff782SGuillaume Nault struct flow_dissector_mpls_lse { 65029c1ecbSBenjamin LaHaise u32 mpls_ttl:8, 66029c1ecbSBenjamin LaHaise mpls_bos:1, 67029c1ecbSBenjamin LaHaise mpls_tc:3, 68029c1ecbSBenjamin LaHaise mpls_label:20; 69029c1ecbSBenjamin LaHaise }; 70029c1ecbSBenjamin LaHaise 7158cff782SGuillaume Nault #define FLOW_DIS_MPLS_MAX 7 7258cff782SGuillaume Nault struct flow_dissector_key_mpls { 7358cff782SGuillaume Nault struct flow_dissector_mpls_lse ls[FLOW_DIS_MPLS_MAX]; /* Label Stack */ 7458cff782SGuillaume Nault u8 used_lses; /* One bit set for each Label Stack Entry in use */ 7558cff782SGuillaume Nault }; 7658cff782SGuillaume Nault 7758cff782SGuillaume Nault static inline void dissector_set_mpls_lse(struct flow_dissector_key_mpls *mpls, 7858cff782SGuillaume Nault int lse_index) 7958cff782SGuillaume Nault { 8058cff782SGuillaume Nault mpls->used_lses |= 1 << lse_index; 8158cff782SGuillaume Nault } 8258cff782SGuillaume Nault 8392e2c405SSimon Horman #define FLOW_DIS_TUN_OPTS_MAX 255 8492e2c405SSimon Horman /** 8592e2c405SSimon Horman * struct flow_dissector_key_enc_opts: 8692e2c405SSimon Horman * @data: tunnel option data 8792e2c405SSimon Horman * @len: length of tunnel option data 8892e2c405SSimon Horman * @dst_opt_type: tunnel option type 8992e2c405SSimon Horman */ 9092e2c405SSimon Horman struct flow_dissector_key_enc_opts { 9192e2c405SSimon Horman u8 data[FLOW_DIS_TUN_OPTS_MAX]; /* Using IP_TUNNEL_OPTS_MAX is desired 9292e2c405SSimon Horman * here but seems difficult to #include 9392e2c405SSimon Horman */ 9492e2c405SSimon Horman u8 len; 9592e2c405SSimon Horman __be16 dst_opt_type; 9692e2c405SSimon Horman }; 9792e2c405SSimon Horman 981fdd512cSTom Herbert struct flow_dissector_key_keyid { 991fdd512cSTom Herbert __be32 keyid; 1001fdd512cSTom Herbert }; 1011fdd512cSTom Herbert 102fbff949eSJiri Pirko /** 103c3f83241STom Herbert * struct flow_dissector_key_ipv4_addrs: 104c3f83241STom Herbert * @src: source ip address 105c3f83241STom Herbert * @dst: destination ip address 106fbff949eSJiri Pirko */ 107c3f83241STom Herbert struct flow_dissector_key_ipv4_addrs { 108fbff949eSJiri Pirko /* (src,dst) must be grouped, in the same way than in IP header */ 109fbff949eSJiri Pirko __be32 src; 110fbff949eSJiri Pirko __be32 dst; 111fbff949eSJiri Pirko }; 112fbff949eSJiri Pirko 113fbff949eSJiri Pirko /** 114c3f83241STom Herbert * struct flow_dissector_key_ipv6_addrs: 115c3f83241STom Herbert * @src: source ip address 116c3f83241STom Herbert * @dst: destination ip address 117c3f83241STom Herbert */ 118c3f83241STom Herbert struct flow_dissector_key_ipv6_addrs { 119c3f83241STom Herbert /* (src,dst) must be grouped, in the same way than in IP header */ 120c3f83241STom Herbert struct in6_addr src; 121c3f83241STom Herbert struct in6_addr dst; 122c3f83241STom Herbert }; 123c3f83241STom Herbert 124c3f83241STom Herbert /** 1258d6e79d3SJon Maloy * struct flow_dissector_key_tipc: 1268d6e79d3SJon Maloy * @key: source node address combined with selector 1279f249089STom Herbert */ 1288d6e79d3SJon Maloy struct flow_dissector_key_tipc { 1298d6e79d3SJon Maloy __be32 key; 1309f249089STom Herbert }; 1319f249089STom Herbert 1329f249089STom Herbert /** 133c3f83241STom Herbert * struct flow_dissector_key_addrs: 134c3f83241STom Herbert * @v4addrs: IPv4 addresses 135c3f83241STom Herbert * @v6addrs: IPv6 addresses 136c3f83241STom Herbert */ 137c3f83241STom Herbert struct flow_dissector_key_addrs { 138c3f83241STom Herbert union { 139c3f83241STom Herbert struct flow_dissector_key_ipv4_addrs v4addrs; 140c3f83241STom Herbert struct flow_dissector_key_ipv6_addrs v6addrs; 1418d6e79d3SJon Maloy struct flow_dissector_key_tipc tipckey; 142c3f83241STom Herbert }; 143c3f83241STom Herbert }; 144c3f83241STom Herbert 145c3f83241STom Herbert /** 14655733350SSimon Horman * flow_dissector_key_arp: 14755733350SSimon Horman * @ports: Operation, source and target addresses for an ARP header 14855733350SSimon Horman * for Ethernet hardware addresses and IPv4 protocol addresses 14955733350SSimon Horman * sip: Sender IP address 15055733350SSimon Horman * tip: Target IP address 15155733350SSimon Horman * op: Operation 15255733350SSimon Horman * sha: Sender hardware address 15355733350SSimon Horman * tpa: Target hardware address 15455733350SSimon Horman */ 15555733350SSimon Horman struct flow_dissector_key_arp { 15655733350SSimon Horman __u32 sip; 15755733350SSimon Horman __u32 tip; 15855733350SSimon Horman __u8 op; 15955733350SSimon Horman unsigned char sha[ETH_ALEN]; 16055733350SSimon Horman unsigned char tha[ETH_ALEN]; 16155733350SSimon Horman }; 16255733350SSimon Horman 16355733350SSimon Horman /** 164fbff949eSJiri Pirko * flow_dissector_key_tp_ports: 165fbff949eSJiri Pirko * @ports: port numbers of Transport header 16659346afeSJiri Pirko * src: source port number 16759346afeSJiri Pirko * dst: destination port number 168fbff949eSJiri Pirko */ 169fbff949eSJiri Pirko struct flow_dissector_key_ports { 170fbff949eSJiri Pirko union { 171fbff949eSJiri Pirko __be32 ports; 17259346afeSJiri Pirko struct { 17359346afeSJiri Pirko __be16 src; 17459346afeSJiri Pirko __be16 dst; 17559346afeSJiri Pirko }; 176fbff949eSJiri Pirko }; 177fbff949eSJiri Pirko }; 178fbff949eSJiri Pirko 179972d3876SSimon Horman /** 180972d3876SSimon Horman * flow_dissector_key_icmp: 181972d3876SSimon Horman * type: ICMP type 182972d3876SSimon Horman * code: ICMP code 1835dec597eSMatteo Croce * id: session identifier 184972d3876SSimon Horman */ 185972d3876SSimon Horman struct flow_dissector_key_icmp { 186972d3876SSimon Horman struct { 187972d3876SSimon Horman u8 type; 188972d3876SSimon Horman u8 code; 189972d3876SSimon Horman }; 1905dec597eSMatteo Croce u16 id; 191972d3876SSimon Horman }; 192b924933cSJiri Pirko 19367a900ccSJiri Pirko /** 19467a900ccSJiri Pirko * struct flow_dissector_key_eth_addrs: 19567a900ccSJiri Pirko * @src: source Ethernet address 19667a900ccSJiri Pirko * @dst: destination Ethernet address 19767a900ccSJiri Pirko */ 19867a900ccSJiri Pirko struct flow_dissector_key_eth_addrs { 19967a900ccSJiri Pirko /* (dst,src) must be grouped, in the same way than in ETH header */ 20067a900ccSJiri Pirko unsigned char dst[ETH_ALEN]; 20167a900ccSJiri Pirko unsigned char src[ETH_ALEN]; 20267a900ccSJiri Pirko }; 20367a900ccSJiri Pirko 204ac4bb5deSJiri Pirko /** 205ac4bb5deSJiri Pirko * struct flow_dissector_key_tcp: 206ac4bb5deSJiri Pirko * @flags: flags 207ac4bb5deSJiri Pirko */ 208ac4bb5deSJiri Pirko struct flow_dissector_key_tcp { 209ac4bb5deSJiri Pirko __be16 flags; 210ac4bb5deSJiri Pirko }; 211ac4bb5deSJiri Pirko 212518d8a2eSOr Gerlitz /** 213518d8a2eSOr Gerlitz * struct flow_dissector_key_ip: 214518d8a2eSOr Gerlitz * @tos: tos 215518d8a2eSOr Gerlitz * @ttl: ttl 216518d8a2eSOr Gerlitz */ 217518d8a2eSOr Gerlitz struct flow_dissector_key_ip { 218518d8a2eSOr Gerlitz __u8 tos; 219518d8a2eSOr Gerlitz __u8 ttl; 220518d8a2eSOr Gerlitz }; 221518d8a2eSOr Gerlitz 22282828b88SJiri Pirko /** 22382828b88SJiri Pirko * struct flow_dissector_key_meta: 22482828b88SJiri Pirko * @ingress_ifindex: ingress ifindex 2258819efc9SPablo Neira Ayuso * @ingress_iftype: ingress interface type 22682828b88SJiri Pirko */ 22782828b88SJiri Pirko struct flow_dissector_key_meta { 22882828b88SJiri Pirko int ingress_ifindex; 2298819efc9SPablo Neira Ayuso u16 ingress_iftype; 23082828b88SJiri Pirko }; 23182828b88SJiri Pirko 23275a56758SPaul Blakey /** 23375a56758SPaul Blakey * struct flow_dissector_key_ct: 23475a56758SPaul Blakey * @ct_state: conntrack state after converting with map 23575a56758SPaul Blakey * @ct_mark: conttrack mark 23675a56758SPaul Blakey * @ct_zone: conntrack zone 23775a56758SPaul Blakey * @ct_labels: conntrack labels 23875a56758SPaul Blakey */ 23975a56758SPaul Blakey struct flow_dissector_key_ct { 24075a56758SPaul Blakey u16 ct_state; 24175a56758SPaul Blakey u16 ct_zone; 24275a56758SPaul Blakey u32 ct_mark; 24375a56758SPaul Blakey u32 ct_labels[4]; 24475a56758SPaul Blakey }; 24575a56758SPaul Blakey 2460cb09affSAriel Levkovich /** 2470cb09affSAriel Levkovich * struct flow_dissector_key_hash: 2480cb09affSAriel Levkovich * @hash: hash value 2490cb09affSAriel Levkovich */ 2500cb09affSAriel Levkovich struct flow_dissector_key_hash { 2510cb09affSAriel Levkovich u32 hash; 2520cb09affSAriel Levkovich }; 2530cb09affSAriel Levkovich 254fbff949eSJiri Pirko enum flow_dissector_key_id { 25542aecaa9STom Herbert FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */ 256fbff949eSJiri Pirko FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */ 257c3f83241STom Herbert FLOW_DISSECTOR_KEY_IPV4_ADDRS, /* struct flow_dissector_key_ipv4_addrs */ 258c3f83241STom Herbert FLOW_DISSECTOR_KEY_IPV6_ADDRS, /* struct flow_dissector_key_ipv6_addrs */ 259fbff949eSJiri Pirko FLOW_DISSECTOR_KEY_PORTS, /* struct flow_dissector_key_ports */ 2608ffb055bSYoshiki Komachi FLOW_DISSECTOR_KEY_PORTS_RANGE, /* struct flow_dissector_key_ports */ 261972d3876SSimon Horman FLOW_DISSECTOR_KEY_ICMP, /* struct flow_dissector_key_icmp */ 26267a900ccSJiri Pirko FLOW_DISSECTOR_KEY_ETH_ADDRS, /* struct flow_dissector_key_eth_addrs */ 2638d6e79d3SJon Maloy FLOW_DISSECTOR_KEY_TIPC, /* struct flow_dissector_key_tipc */ 26455733350SSimon Horman FLOW_DISSECTOR_KEY_ARP, /* struct flow_dissector_key_arp */ 26591c45956SEdward Cree FLOW_DISSECTOR_KEY_VLAN, /* struct flow_dissector_key_vlan */ 26691c45956SEdward Cree FLOW_DISSECTOR_KEY_FLOW_LABEL, /* struct flow_dissector_key_tags */ 2671fdd512cSTom Herbert FLOW_DISSECTOR_KEY_GRE_KEYID, /* struct flow_dissector_key_keyid */ 268b3baa0fbSTom Herbert FLOW_DISSECTOR_KEY_MPLS_ENTROPY, /* struct flow_dissector_key_keyid */ 2699ba6a9a9SHadar Hen Zion FLOW_DISSECTOR_KEY_ENC_KEYID, /* struct flow_dissector_key_keyid */ 2709ba6a9a9SHadar Hen Zion FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS, /* struct flow_dissector_key_ipv4_addrs */ 2719ba6a9a9SHadar Hen Zion FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS, /* struct flow_dissector_key_ipv6_addrs */ 2729ba6a9a9SHadar Hen Zion FLOW_DISSECTOR_KEY_ENC_CONTROL, /* struct flow_dissector_key_control */ 273f4d997fdSHadar Hen Zion FLOW_DISSECTOR_KEY_ENC_PORTS, /* struct flow_dissector_key_ports */ 274029c1ecbSBenjamin LaHaise FLOW_DISSECTOR_KEY_MPLS, /* struct flow_dissector_key_mpls */ 275ac4bb5deSJiri Pirko FLOW_DISSECTOR_KEY_TCP, /* struct flow_dissector_key_tcp */ 276518d8a2eSOr Gerlitz FLOW_DISSECTOR_KEY_IP, /* struct flow_dissector_key_ip */ 27791c45956SEdward Cree FLOW_DISSECTOR_KEY_CVLAN, /* struct flow_dissector_key_vlan */ 2785544adb9SOr Gerlitz FLOW_DISSECTOR_KEY_ENC_IP, /* struct flow_dissector_key_ip */ 27992e2c405SSimon Horman FLOW_DISSECTOR_KEY_ENC_OPTS, /* struct flow_dissector_key_enc_opts */ 28082828b88SJiri Pirko FLOW_DISSECTOR_KEY_META, /* struct flow_dissector_key_meta */ 28175a56758SPaul Blakey FLOW_DISSECTOR_KEY_CT, /* struct flow_dissector_key_ct */ 2820cb09affSAriel Levkovich FLOW_DISSECTOR_KEY_HASH, /* struct flow_dissector_key_hash */ 28392e2c405SSimon Horman 284fbff949eSJiri Pirko FLOW_DISSECTOR_KEY_MAX, 285fbff949eSJiri Pirko }; 286fbff949eSJiri Pirko 287807e165dSTom Herbert #define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0) 2881cc26450SStanislav Fomichev #define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(1) 2891cc26450SStanislav Fomichev #define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(2) 290*6de6e46dSYoshiki Komachi #define FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP BIT(3) 291807e165dSTom Herbert 292fbff949eSJiri Pirko struct flow_dissector_key { 293fbff949eSJiri Pirko enum flow_dissector_key_id key_id; 294fbff949eSJiri Pirko size_t offset; /* offset of struct flow_dissector_key_* 295fbff949eSJiri Pirko in target the struct */ 296fbff949eSJiri Pirko }; 297fbff949eSJiri Pirko 298fbff949eSJiri Pirko struct flow_dissector { 299fbff949eSJiri Pirko unsigned int used_keys; /* each bit repesents presence of one key id */ 300fbff949eSJiri Pirko unsigned short int offset[FLOW_DISSECTOR_KEY_MAX]; 301fbff949eSJiri Pirko }; 302fbff949eSJiri Pirko 30372a338bcSPaolo Abeni struct flow_keys_basic { 30472a338bcSPaolo Abeni struct flow_dissector_key_control control; 30572a338bcSPaolo Abeni struct flow_dissector_key_basic basic; 30672a338bcSPaolo Abeni }; 30772a338bcSPaolo Abeni 30806635a35SJiri Pirko struct flow_keys { 30942aecaa9STom Herbert struct flow_dissector_key_control control; 31042aecaa9STom Herbert #define FLOW_KEYS_HASH_START_FIELD basic 31155667441SEric Dumazet struct flow_dissector_key_basic basic __aligned(SIPHASH_ALIGNMENT); 312d34af823STom Herbert struct flow_dissector_key_tags tags; 313f6a66927SHadar Hen Zion struct flow_dissector_key_vlan vlan; 31424c590e3SJianbo Liu struct flow_dissector_key_vlan cvlan; 3151fdd512cSTom Herbert struct flow_dissector_key_keyid keyid; 31642aecaa9STom Herbert struct flow_dissector_key_ports ports; 3175dec597eSMatteo Croce struct flow_dissector_key_icmp icmp; 31898298e6cSMatteo Croce /* 'addrs' must be the last member */ 31942aecaa9STom Herbert struct flow_dissector_key_addrs addrs; 32006635a35SJiri Pirko }; 32106635a35SJiri Pirko 32242aecaa9STom Herbert #define FLOW_KEYS_HASH_OFFSET \ 32342aecaa9STom Herbert offsetof(struct flow_keys, FLOW_KEYS_HASH_START_FIELD) 32442aecaa9STom Herbert 325c3f83241STom Herbert __be32 flow_get_u32_src(const struct flow_keys *flow); 326c3f83241STom Herbert __be32 flow_get_u32_dst(const struct flow_keys *flow); 327c3f83241STom Herbert 32806635a35SJiri Pirko extern struct flow_dissector flow_keys_dissector; 32972a338bcSPaolo Abeni extern struct flow_dissector flow_keys_basic_dissector; 33006635a35SJiri Pirko 3311bd758ebSJiri Pirko /* struct flow_keys_digest: 3321bd758ebSJiri Pirko * 3331bd758ebSJiri Pirko * This structure is used to hold a digest of the full flow keys. This is a 3341bd758ebSJiri Pirko * larger "hash" of a flow to allow definitively matching specific flows where 3351bd758ebSJiri Pirko * the 32 bit skb->hash is not large enough. The size is limited to 16 bytes so 33653bc017fSWolfram Sang * that it can be used in CB of skb (see sch_choke for an example). 3371bd758ebSJiri Pirko */ 3381bd758ebSJiri Pirko #define FLOW_KEYS_DIGEST_LEN 16 3391bd758ebSJiri Pirko struct flow_keys_digest { 3401bd758ebSJiri Pirko u8 data[FLOW_KEYS_DIGEST_LEN]; 3411bd758ebSJiri Pirko }; 3421bd758ebSJiri Pirko 3431bd758ebSJiri Pirko void make_flow_keys_digest(struct flow_keys_digest *digest, 3441bd758ebSJiri Pirko const struct flow_keys *flow); 3451bd758ebSJiri Pirko 34666fdd05eSGao Feng static inline bool flow_keys_have_l4(const struct flow_keys *keys) 347bcc83839STom Herbert { 348bcc83839STom Herbert return (keys->ports.ports || keys->tags.flow_label); 349bcc83839STom Herbert } 350bcc83839STom Herbert 351c6cc1ca7STom Herbert u32 flow_hash_from_keys(struct flow_keys *keys); 3525dec597eSMatteo Croce void skb_flow_get_icmp_tci(const struct sk_buff *skb, 3535dec597eSMatteo Croce struct flow_dissector_key_icmp *key_icmp, 354f96533cdSAlexander Lobakin const void *data, int thoff, int hlen); 355c6cc1ca7STom Herbert 3568de2d793SAmir Vadai static inline bool dissector_uses_key(const struct flow_dissector *flow_dissector, 3578de2d793SAmir Vadai enum flow_dissector_key_id key_id) 3588de2d793SAmir Vadai { 3598de2d793SAmir Vadai return flow_dissector->used_keys & (1 << key_id); 3608de2d793SAmir Vadai } 3618de2d793SAmir Vadai 3628de2d793SAmir Vadai static inline void *skb_flow_dissector_target(struct flow_dissector *flow_dissector, 3638de2d793SAmir Vadai enum flow_dissector_key_id key_id, 3648de2d793SAmir Vadai void *target_container) 3658de2d793SAmir Vadai { 3668de2d793SAmir Vadai return ((char *)target_container) + flow_dissector->offset[key_id]; 3678de2d793SAmir Vadai } 3688de2d793SAmir Vadai 369089b19a9SStanislav Fomichev struct bpf_flow_dissector { 370089b19a9SStanislav Fomichev struct bpf_flow_keys *flow_keys; 371089b19a9SStanislav Fomichev const struct sk_buff *skb; 372dac06b32SAlexander Lobakin const void *data; 373dac06b32SAlexander Lobakin const void *data_end; 374089b19a9SStanislav Fomichev }; 375089b19a9SStanislav Fomichev 3768a9093c7SJason Baron static inline void 3778a9093c7SJason Baron flow_dissector_init_keys(struct flow_dissector_key_control *key_control, 3788a9093c7SJason Baron struct flow_dissector_key_basic *key_basic) 3798a9093c7SJason Baron { 3808a9093c7SJason Baron memset(key_control, 0, sizeof(*key_control)); 3818a9093c7SJason Baron memset(key_basic, 0, sizeof(*key_basic)); 3828a9093c7SJason Baron } 3838a9093c7SJason Baron 384b27f7bb5SJakub Sitnicki #ifdef CONFIG_BPF_SYSCALL 3853b701699SJakub Sitnicki int flow_dissector_bpf_prog_attach_check(struct net *net, 3863b701699SJakub Sitnicki struct bpf_prog *prog); 387b27f7bb5SJakub Sitnicki #endif /* CONFIG_BPF_SYSCALL */ 388b27f7bb5SJakub Sitnicki 3891bd758ebSJiri Pirko #endif 390