|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
21 #define AVF_FDIR_IPV6_TC_OFFSET 20
22 #define AVF_IPV6_TC_MASK (0xFF << AVF_FDIR_IPV6_TC_OFFSET)
23 #define AVF_FDIR_MAX_QREGION_SIZE 128
37 const u16 *w = (
const u16 *) ea;
39 return (w[0] | w[1] | w[2]) == 0;
54 (*rcfg)->add_fltr.rule_cfg.proto_hdrs.tunnel_level = tunnel_level;
56 (*rcfg)->nb_rx_queues = nrxq;
107 u8 ipv6_addr_mask[16] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
108 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
116 eth_spec =
item->spec;
117 eth_mask =
item->mask;
121 if (eth_spec && eth_mask)
128 "Invalid MAC_addr mask.");
134 if (eth_mask->
type != 0xffff)
138 "Invalid type mask.");
144 if (eth_spec && eth_mask && eth_mask->
type)
146 ether_type = clib_net_to_host_u16 (eth_spec->
type);
152 "Unsupported ether_type.");
164 ipv4_spec =
item->spec;
165 ipv4_mask =
item->mask;
168 if (ipv4_spec && ipv4_mask)
176 "Invalid IPv4 mask.");
198 if (ipv4_mask->
src_addr == 0xffffffff)
204 if (ipv4_mask->
dst_addr == 0xffffffff)
215 ipv6_spec =
item->spec;
216 ipv6_mask =
item->mask;
219 if (ipv6_spec && ipv6_mask)
225 "Invalid IPv6 mask");
237 if (ipv6_mask->
proto == 0xff)
268 udp_spec =
item->spec;
269 udp_mask =
item->mask;
272 if (udp_spec && udp_mask)
299 tcp_spec =
item->spec;
300 tcp_mask =
item->mask;
303 if (tcp_spec && tcp_mask)
333 sctp_spec =
item->spec;
334 sctp_mask =
item->mask;
337 if (sctp_spec && sctp_mask)
339 if (sctp_mask->
cksum)
364 gtp_spec =
item->spec;
365 gtp_mask =
item->mask;
368 if (gtp_spec && gtp_mask)
379 if (gtp_mask->
teid == 0xffffffff)
391 gtp_psc_spec =
item->spec;
392 gtp_psc_mask =
item->mask;
395 if (gtp_psc_spec && gtp_psc_mask)
397 if (gtp_psc_mask->
qfi == 0xff)
409 l2tpv3oip_spec =
item->spec;
410 l2tpv3oip_mask =
item->mask;
413 if (l2tpv3oip_spec && l2tpv3oip_mask)
426 esp_spec =
item->spec;
427 esp_mask =
item->mask;
430 if (esp_spec && esp_mask)
432 if (esp_mask->
spi == 0xffffffff)
443 ah_spec =
item->spec;
444 ah_mask =
item->mask;
447 if (ah_spec && ah_mask)
449 if (ah_mask->
spi == 0xffffffff)
460 pfcp_spec =
item->spec;
461 pfcp_mask =
item->mask;
464 if (pfcp_spec && pfcp_mask)
466 if (pfcp_mask->
s_field == 0xff)
478 item,
"Invalid pattern item.");
521 act,
"Queue region size can't be 0 or 1.");
532 act,
"Discontinuous queue region");
540 act,
"Invalid queue region indexes.");
549 "The region size should be any of the"
550 "following values: 1, 2, 4, 8, 16, 32"
551 ", 64, 128 as long as the total number of"
552 "queues do not exceed the VSI allocation");
604 sizeof (rcfg->
add_fltr), &fdir_ret, sizeof (fdir_ret));
629 sizeof (rcfg->
add_fltr), &fdir_ret, sizeof (fdir_ret));
656 sizeof (rcfg->
del_fltr), &fdir_ret, sizeof (fdir_ret));
676 int act_idx = 0, ret = 0;
714 "Invalid queue for FDIR.");
758 actions,
"Unsupported action combination");
765 actions,
"Too many mark actions");
769 if (dest_num + mark_num == 0)
835 return "Failed to program the rule due to other reasons";
841 s =
"Succeed in programming rule request by PF";
844 s =
"Failed to add rule request due to no hardware resource";
847 s =
"Failed to add rule request due to the rule is already existed";
850 s =
"Failed to add rule request due to the rule is conflict with "
854 s =
"Failed to delete rule request due to this rule doesn't exist";
857 s =
"Failed to add rule request due to the hardware doesn't support";
860 s =
"Failed to add rule request due to time out for programming";
863 s =
"Succeed in programming rule request by PF";
866 s =
"Failed to program the rule due to other reasons";
#define VIRTCHNL_MAX_NUM_ACTIONS
u16 dst_port
UDP destination port.
@ VIRTCHNL_FDIR_FAILURE_MAX
struct virtchnl_proto_hdrs proto_hdrs
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.
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,...
u8 type_of_service
type of service
u8 qfi
QoS flow identifier.
int avf_fdir_parse_action(const struct avf_flow_action actions[], struct avf_fdir_conf *rcfg, struct avf_flow_error *error)
#define AVF_INSET_IPV4_TTL
@ VIRTCHNL_FDIR_FAILURE_RULE_TIMEOUT
#define AVF_INSET_ETHERTYPE
@ VIRTCHNL_PROTO_HDR_GTPU_IP
@ VIRTCHNL_ACTION_PASSTHRU
@ VIRTCHNL_ACTION_Q_REGION
#define clib_memcpy(d, s, n)
#define VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, hdr_type, field)
u16 fragment_offset
fragmentation offset
#define clib_memcmp(s1, s2, m1)
@ VIRTCHNL_FDIR_FAILURE_QUERY_INVALID
const void * cause
Object responsible for the error.
static void clib_mem_free(void *p)
#define count_leading_zeros(x)
TCP(sport=80, dport=6872)
#define AVF_INSET_IPV6_TC
u32 dst_addr
destination address
enum virtchnl_action type
u16 index
Queue index to use.
#define AVF_L2TPV3OIP_SESSION_ID
avf_flow_error_type
Those headers used temporary, maybe OS packet definition can replace.
#define AVF_INSET_TCP_SRC_PORT
u32 sent_seq
TX data sequence number.
Matches a GTP PDU extension header with type 0x85.
enum avf_flow_error_type type
Cause field and error types.
#define AVF_INSET_GTPU_QFI
#define AVF_INSET_SCTP_SRC_PORT
@ VIRTCHNL_PROTO_HDR_GTPU_EH
u32 vtc_flow
IP version, traffic class & flow label.
#define AVF_INSET_UDP_SRC_PORT
Match IP Authentication Header (AH), RFC 4302.
static int fls_u32(u32 x)
u32 src_addr
source address
@ VIRTCHNL_ADV_OP_DEL_FDIR_FILTER
@ VIRTCHNL_PROTO_HDR_IPV4
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 dgram_len
UDP datagram length.
#define VIRTCHNL_MAX_NUM_PROTO_HDRS
u16 type
EtherType or TPID.
u16 hdr_checksum
header checksum
int avf_fdir_parse_pattern(struct avf_fdir_conf *rcfg, struct avf_flow_item avf_items[], struct avf_flow_error *error)
u8 next_proto_id
protocol ID
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.
u32 session_id
Session ID.
int count
specify where protocol header start from.
@ VIRTCHNL_PROTO_HDR_IPV6
u8 version_ihl
version and header length
#define AVF_INSET_SCTP_DST_PORT
enum virtchnl_fdir_prgm_status status
@ VIRTCHNL_PROTO_HDR_L2TPV3
u16 msg_len
Message length.
struct virtchnl_filter_action actions[VIRTCHNL_MAX_NUM_ACTIONS]
u32 spi
Security Parameters Index.
#define AVF_INSET_ESP_SPI
u32 id
Integer value to return with packets.
union virtchnl_filter_action::@32 act_conf
#define AVF_INSET_GTPU_TEID
u8 v_pt_rsv_flags
Version (3b), protocol type (1b), reserved (1b), Extension header flag (1b), Sequence number flag (1b...
@ VIRTCHNL_PROTO_HDR_SCTP
#define AVF_FDIR_MAX_QREGION_SIZE
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.
#define AVF_INSET_TCP_DST_PORT
virtchnl_fdir_prgm_status
@ VIRTCHNL_PROTO_HDR_PFCP
@ AVF_FLOW_ERROR_TYPE_ACTION
Specific action.
u16 src_port
UDP source port.
Verbose error structure definition.
struct virtchnl_fdir_rule rule_cfg
struct avf_ether_addr dst
Destination MAC.
int avf_fdir_rule_destroy(struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg)
Destroy a flow rule.
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.
int avf_fdir_rcfg_create(struct avf_fdir_conf **rcfg, int tunnel_level, u16 vsi, u16 nrxq)
Create a rule cfg object.
#define AVF_INSET_IPV6_HOP_LIMIT
Matches a L2TPv3 over IP header.
u8 src_addr[16]
IP address of source host.
@ AVF_FLOW_ERROR_TYPE_ITEM
Specific pattern item.
static int ether_addr_is_zero(const struct avf_ether_addr *ea)
char * avf_fdir_prgm_error_decode(int err_no)
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.
enum virtchnl_fdir_prgm_status status
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.
u16 src_port
TCP source port.
u16 dgram_cksum
UDP datagram checksum.
u8 time_to_live
time to live
#define AVF_INSET_IPV6_NEXT_HDR
@ VIRTCHNL_FDIR_FAILURE_RULE_CONFLICT
struct virtchnl_proto_hdr proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS]
#define AVF_INSET_IPV4_DST
#define AVF_INSET_IPV4_PROTO
#define AVF_INSET_IPV4_SRC
@ VIRTCHNL_PROTO_HDR_NONE
int avf_fdir_rcfg_destroy(struct avf_fdir_conf *rcfg)
Destroy a rule cfg object.
vl_api_flow_action_t actions
#define AVF_INSET_UDP_DST_PORT
#define AVF_ETHER_TYPE_IPV6
IPv6 Protocol.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
@ VIRTCHNL_FDIR_FAILURE_RULE_INVALID
const void * conf
Pointer to action configuration object.
struct avf_ether_addr src
Source MAC.
#define AVF_INSET_IPV6_SRC
u32 teid
Tunnel endpoint identifier.
@ VIRTCHNL_FDIR_FAILURE_RULE_NONEXIST
u16 total_length
length of packet
struct virtchnl_fdir_add add_fltr
@ VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE
#define AVF_INSET_PFCP_S_FIELD
u16 rx_win
RX flow control window.
u16 tcp_urp
TCP urgent pointer, if any.
@ VIRTCHNL_FDIR_FAILURE_RULE_EXIST
struct virtchnl_fdir_del del_fltr
struct virtchnl_filter_action::@32::@33 queue
u32 recv_ack
RX data acknowledgment sequence number.
static uword is_pow2(uword x)
enum virtchnl_proto_hdr_type type
#define AVF_INSET_IPV6_DST
u8 dst_addr[16]
IP address of destination host(s).
u16 payload_len
IP packet length - includes header size.
u16 dst_port
TCP destination port.
static void * clib_mem_alloc(uword size)
vl_api_fib_path_type_t type
const char * message
Human-readable error message.
u8 proto
Protocol, next header.
@ VIRTCHNL_ADV_OP_ADD_FDIR_FILTER
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.
#define AVF_INSET_IPV4_TOS
#define AVF_ETHER_TYPE_IPV4
IPv4 Protocol.
struct virtchnl_filter_action_set action_set