18 #ifndef _AVF_ADVANCED_FLOW_H_ 19 #define _AVF_ADVANCED_FLOW_H_ 21 #define AVF_SUCCESS (0) 22 #define AVF_FAILURE (-1) 24 #define BIT(a) (1UL << (a)) 25 #define BIT_ULL(a) (1ULL << (a)) 32 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) \ 33 enum virtchnl_static_assert_enum_##X \ 35 virtchnl_static_assert_##X = (n) / ((sizeof (struct X) == (n)) ? 1 : 0) \ 37 #define VIRTCHNL_CHECK_UNION_LEN(n, X) \ 38 enum virtchnl_static_asset_enum_##X \ 40 virtchnl_static_assert_##X = (n) / ((sizeof (union X) == (n)) ? 1 : 0) \ 44 #define AVF_ETHER_TYPE_IPV4 0x0800 45 #define AVF_ETHER_TYPE_IPV6 0x86DD 47 #define VIRTCHNL_MAX_NUM_PROTO_HDRS 32 48 #define PROTO_HDR_SHIFT 5 49 #define PROTO_HDR_FIELD_START(proto_hdr_type) \ 50 (proto_hdr_type << PROTO_HDR_SHIFT) 51 #define PROTO_HDR_FIELD_MASK ((1UL << PROTO_HDR_SHIFT) - 1) 60 #define VIRTCHNL_ADD_PROTO_HDR_FIELD(hdr, field) \ 61 ((hdr)->field_selector |= BIT ((field) &PROTO_HDR_FIELD_MASK)) 62 #define VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr, field) \ 63 ((hdr)->field_selector &= ~BIT ((field) &PROTO_HDR_FIELD_MASK)) 64 #define VIRTCHNL_TEST_PROTO_HDR_FIELD(hdr, val) \ 65 ((hdr)->field_selector & BIT ((val) &PROTO_HDR_FIELD_MASK)) 66 #define VIRTCHNL_GET_PROTO_HDR_FIELD(hdr) ((hdr)->field_selector) 68 #define VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, hdr_type, field) \ 69 (VIRTCHNL_ADD_PROTO_HDR_FIELD (hdr, VIRTCHNL_PROTO_HDR_##hdr_type##_##field)) 70 #define VIRTCHNL_DEL_PROTO_HDR_FIELD_BIT(hdr, hdr_type, field) \ 71 (VIRTCHNL_DEL_PROTO_HDR_FIELD (hdr, VIRTCHNL_PROTO_HDR_##hdr_type##_##field)) 73 #define VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, hdr_type) \ 74 ((hdr)->type = VIRTCHNL_PROTO_HDR_##hdr_type) 75 #define VIRTCHNL_GET_PROTO_HDR_TYPE(hdr) (((hdr)->type) >> PROTO_HDR_SHIFT) 76 #define VIRTCHNL_TEST_PROTO_HDR_TYPE(hdr, val) \ 77 ((hdr)->type == ((val) >> PROTO_HDR_SHIFT)) 78 #define VIRTCHNL_TEST_PROTO_HDR(hdr, val) \ 79 (VIRTCHNL_TEST_PROTO_HDR_TYPE (hdr, val) && \ 80 VIRTCHNL_TEST_PROTO_HDR_FIELD (hdr, val)) 84 #define AVF_PROT_MAC_INNER (1ULL << 1) 85 #define AVF_PROT_MAC_OUTER (1ULL << 2) 86 #define AVF_PROT_VLAN_INNER (1ULL << 3) 87 #define AVF_PROT_VLAN_OUTER (1ULL << 4) 88 #define AVF_PROT_IPV4_INNER (1ULL << 5) 89 #define AVF_PROT_IPV4_OUTER (1ULL << 6) 90 #define AVF_PROT_IPV6_INNER (1ULL << 7) 91 #define AVF_PROT_IPV6_OUTER (1ULL << 8) 92 #define AVF_PROT_TCP_INNER (1ULL << 9) 93 #define AVF_PROT_TCP_OUTER (1ULL << 10) 94 #define AVF_PROT_UDP_INNER (1ULL << 11) 95 #define AVF_PROT_UDP_OUTER (1ULL << 12) 96 #define AVF_PROT_SCTP_INNER (1ULL << 13) 97 #define AVF_PROT_SCTP_OUTER (1ULL << 14) 98 #define AVF_PROT_ICMP4_INNER (1ULL << 15) 99 #define AVF_PROT_ICMP4_OUTER (1ULL << 16) 100 #define AVF_PROT_ICMP6_INNER (1ULL << 17) 101 #define AVF_PROT_ICMP6_OUTER (1ULL << 18) 102 #define AVF_PROT_VXLAN (1ULL << 19) 103 #define AVF_PROT_NVGRE (1ULL << 20) 104 #define AVF_PROT_GTPU (1ULL << 21) 105 #define AVF_PROT_ESP (1ULL << 22) 106 #define AVF_PROT_AH (1ULL << 23) 107 #define AVF_PROT_L2TPV3OIP (1ULL << 24) 108 #define AVF_PROT_PFCP (1ULL << 25) 112 #define AVF_SMAC (1ULL << 63) 113 #define AVF_DMAC (1ULL << 62) 114 #define AVF_ETHERTYPE (1ULL << 61) 115 #define AVF_IP_SRC (1ULL << 60) 116 #define AVF_IP_DST (1ULL << 59) 117 #define AVF_IP_PROTO (1ULL << 58) 118 #define AVF_IP_TTL (1ULL << 57) 119 #define AVF_IP_TOS (1ULL << 56) 120 #define AVF_SPORT (1ULL << 55) 121 #define AVF_DPORT (1ULL << 54) 122 #define AVF_ICMP_TYPE (1ULL << 53) 123 #define AVF_ICMP_CODE (1ULL << 52) 124 #define AVF_VXLAN_VNI (1ULL << 51) 125 #define AVF_NVGRE_TNI (1ULL << 50) 126 #define AVF_GTPU_TEID (1ULL << 49) 127 #define AVF_GTPU_QFI (1ULL << 48) 128 #define AVF_ESP_SPI (1ULL << 47) 129 #define AVF_AH_SPI (1ULL << 46) 130 #define AVF_L2TPV3OIP_SESSION_ID (1ULL << 45) 131 #define AVF_PFCP_S_FIELD (1ULL << 44) 132 #define AVF_PFCP_SEID (1ULL << 43) 136 #define AVF_INSET_NONE 0ULL 140 #define AVF_INSET_SMAC (AVF_PROT_MAC_OUTER | AVF_SMAC) 141 #define AVF_INSET_DMAC (AVF_PROT_MAC_OUTER | AVF_DMAC) 142 #define AVF_INSET_VLAN_INNER (AVF_PROT_VLAN_INNER) 143 #define AVF_INSET_VLAN_OUTER (AVF_PROT_VLAN_OUTER) 144 #define AVF_INSET_ETHERTYPE (AVF_ETHERTYPE) 146 #define AVF_INSET_IPV4_SRC (AVF_PROT_IPV4_OUTER | AVF_IP_SRC) 147 #define AVF_INSET_IPV4_DST (AVF_PROT_IPV4_OUTER | AVF_IP_DST) 148 #define AVF_INSET_IPV4_TOS (AVF_PROT_IPV4_OUTER | AVF_IP_TOS) 149 #define AVF_INSET_IPV4_PROTO (AVF_PROT_IPV4_OUTER | AVF_IP_PROTO) 150 #define AVF_INSET_IPV4_TTL (AVF_PROT_IPV4_OUTER | AVF_IP_TTL) 151 #define AVF_INSET_IPV6_SRC (AVF_PROT_IPV6_OUTER | AVF_IP_SRC) 152 #define AVF_INSET_IPV6_DST (AVF_PROT_IPV6_OUTER | AVF_IP_DST) 153 #define AVF_INSET_IPV6_NEXT_HDR (AVF_PROT_IPV6_OUTER | AVF_IP_PROTO) 154 #define AVF_INSET_IPV6_HOP_LIMIT (AVF_PROT_IPV6_OUTER | AVF_IP_TTL) 155 #define AVF_INSET_IPV6_TC (AVF_PROT_IPV6_OUTER | AVF_IP_TOS) 157 #define AVF_INSET_TCP_SRC_PORT (AVF_PROT_TCP_OUTER | AVF_SPORT) 158 #define AVF_INSET_TCP_DST_PORT (AVF_PROT_TCP_OUTER | AVF_DPORT) 159 #define AVF_INSET_UDP_SRC_PORT (AVF_PROT_UDP_OUTER | AVF_SPORT) 160 #define AVF_INSET_UDP_DST_PORT (AVF_PROT_UDP_OUTER | AVF_DPORT) 161 #define AVF_INSET_SCTP_SRC_PORT (AVF_PROT_SCTP_OUTER | AVF_SPORT) 162 #define AVF_INSET_SCTP_DST_PORT (AVF_PROT_SCTP_OUTER | AVF_DPORT) 163 #define AVF_INSET_ICMP4_SRC_PORT (AVF_PROT_ICMP4_OUTER | AVF_SPORT) 164 #define AVF_INSET_ICMP4_DST_PORT (AVF_PROT_ICMP4_OUTER | AVF_DPORT) 165 #define AVF_INSET_ICMP6_SRC_PORT (AVF_PROT_ICMP6_OUTER | AVF_SPORT) 166 #define AVF_INSET_ICMP6_DST_PORT (AVF_PROT_ICMP6_OUTER | AVF_DPORT) 167 #define AVF_INSET_ICMP4_TYPE (AVF_PROT_ICMP4_OUTER | AVF_ICMP_TYPE) 168 #define AVF_INSET_ICMP4_CODE (AVF_PROT_ICMP4_OUTER | AVF_ICMP_CODE) 169 #define AVF_INSET_ICMP6_TYPE (AVF_PROT_ICMP6_OUTER | AVF_ICMP_TYPE) 170 #define AVF_INSET_ICMP6_CODE (AVF_PROT_ICMP6_OUTER | AVF_ICMP_CODE) 171 #define AVF_INSET_GTPU_TEID (AVF_PROT_GTPU | AVF_GTPU_TEID) 172 #define AVF_INSET_GTPU_QFI (AVF_PROT_GTPU | AVF_GTPU_QFI) 173 #define AVF_INSET_ESP_SPI (AVF_PROT_ESP | AVF_ESP_SPI) 174 #define AVF_INSET_AH_SPI (AVF_PROT_AH | AVF_AH_SPI) 175 #define AVF_INSET_L2TPV3OIP_SESSION_ID \ 176 (AVF_PROT_L2TPV3OIP | AVF_L2TPV3OIP_SESSION_ID) 177 #define AVF_INSET_PFCP_S_FIELD (AVF_PROT_PFCP | AVF_PFCP_S_FIELD) 178 #define AVF_INSET_PFCP_SEID (AVF_PROT_PFCP | AVF_PFCP_S_FIELD | AVF_PFCP_SEID) 398 #define VIRTCHNL_MAX_NUM_ACTIONS 8 571 #define AVF_ETHER_ADDR_LEN 6 575 } __attribute__ ((__aligned__ (2)));
599 } __attribute__ ((__packed__));
612 } __attribute__ ((__packed__));
628 } __attribute__ ((__packed__));
639 } __attribute__ ((__packed__));
660 } __attribute__ ((__packed__));
716 } __attribute__ ((__packed__));
791 void *in,
u32 in_len,
void *out,
u32 out_len);
1047 const char *message);
const void * cause
Object responsible for the error.
u32 id
Integer value to return with packets.
const void * mask
Bit-mask applied to spec and last.
int avf_fdir_parse_action_qregion(struct avf_fdir_conf *rcfg, const struct avf_flow_action *act, int act_idx, struct avf_flow_error *error)
Set action as to queue group, conflict with drop action.
u16 payload_len
IP packet length - includes header size.
#define VIRTCHNL_MAX_NUM_PROTO_HDRS
int avf_fdir_rcfg_set_hdr(struct avf_fdir_conf *rcfg, int layer, enum virtchnl_proto_hdr_type hdr)
Set match potocol header on specific layer, it will overwrite is already be set.
Matches a L2TPv3 over IP header.
int avf_fdir_parse_action(const struct avf_flow_action actions[], struct avf_fdir_conf *rcfg, struct avf_flow_error *error)
u16 dst_port
TCP destination port.
int avf_fdir_rcfg_validate(struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg)
Validate a flow rule cfg, check with PF driver if the rule cfg is supportted or not.
int avf_fdir_rcfg_create(struct avf_fdir_conf **rcfg, int tunnel_level, u16 vsi, u16 nrxq)
Create a rule cfg object.
int count
specify where protocol header start from.
int avf_fdir_rcfg_act_queue(struct avf_fdir_conf *rcfg, int queue, int size, int act_idx)
Set action as to queue(group), conflict with drop action.
u8 v_pt_rsv_flags
Version (3b), protocol type (1b), reserved (1b), Extension header flag (1b), Sequence number flag (1b...
u8 time_to_live
time to live
int avf_flow_error_set(struct avf_flow_error *error, int code, enum avf_flow_error_type type, const void *cause, const char *message)
Initialize flow error structure.
avf_flow_error_type
Those headers used temporary, maybe OS packet definition can replace.
avf_eth_hash_function
Hash function types.
u16 src_port
UDP source port.
Verbose error structure definition.
u8 version_ihl
version and header length
#define PROTO_HDR_FIELD_START(proto_hdr_type)
u8 proto
Protocol, next header.
const void * conf
Pointer to action configuration object.
u32 vtc_flow
IP version, traffic class & flow label.
u32 spi
Security Parameters Index.
u8 qfi
QoS flow identifier.
u16 total_length
length of packet
int avf_fdir_rcfg_act_mark(struct avf_fdir_conf *rcfg, const u32 mark, int act_idx)
Set action as mark, it can co-exist with to queue(group) or drop action.
int(* avf_fdir_vc_op_t)(void *vc_hdl, enum virthnl_adv_ops vc_op, void *in, u32 in_len, void *out, u32 out_len)
u16 rx_win
RX flow control window.
u32 seq
packet sequence number
u16 tcp_urp
TCP urgent pointer, if any.
virtchnl_fdir_prgm_status
const void * spec
Pointer to item specification structure.
u16 dst_port
UDP destination port.
vl_api_mac_address_t src_addr
int avf_fdir_rcfg_destroy(struct avf_fdir_conf *rcfg)
Destroy a rule cfg object.
u16 src_port
TCP source port.
u16 dgram_len
UDP datagram length.
u16 fragment_offset
fragmentation offset
u16 type
EtherType or TPID.
u32 sent_seq
TX data sequence number.
u32 recv_ack
RX data acknowledgment sequence number.
vl_api_mac_address_t dst_addr
u32 session_id
Session ID.
#define VIRTCHNL_CHECK_STRUCT_LEN(n, X)
u8 next_proto_id
protocol ID
u32 dst_addr
destination address
u16 index
Queue index to use.
Symmetric Toeplitz: src, dst will be replaced by xor(src, dst).
Matches a GTP PDU extension header with type 0x85.
u8 type_of_service
type of service
char * avf_fdir_prgm_error_decode(int err_no)
u32 teid
Tunnel endpoint identifier.
int avf_fdir_rcfg_set_field(struct avf_fdir_conf *rcfg, int layer, struct avf_flow_item *item, struct avf_flow_error *error)
Set a match field on specific protocol layer, if any match field already be set on this layer...
u16 hdr_checksum
header checksum
int avf_fdir_rule_create(struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg)
Create a flow rule, a FDIR rule is expected to be programmed into hardware if return success...
Item specification range.
#define AVF_ETHER_ADDR_LEN
#define VIRTCHNL_MAX_NUM_ACTIONS
int avf_fdir_parse_pattern(struct avf_fdir_conf *rcfg, struct avf_flow_item avf_items[], struct avf_flow_error *error)
int avf_fdir_rule_destroy(struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg)
Destroy a flow rule.
const char * message
Human-readable error message.
u32 src_addr
source address
u16 msg_len
Message length.
u16 dgram_cksum
UDP datagram checksum.
enum virtchnl_proto_hdr_type type
Match IP Authentication Header (AH), RFC 4302.
int avf_fdir_rcfg_act_drop(struct avf_fdir_conf *rcfg, int act_idx)
Set action as as drop, conflict with to queue(gropu) action.