43 uint32_t src_ip, uint32_t src_mask,
44 uint32_t dest_ip, uint32_t dest_mask,
45 struct rte_flow_error *
error)
48 struct rte_flow_attr attr;
51 struct rte_flow *flow = NULL;
52 struct rte_flow_action_queue queue = { .index = rx_q };
53 struct rte_flow_item_ipv4 ip_spec;
54 struct rte_flow_item_ipv4 ip_mask;
58 memset(pattern, 0,
sizeof(pattern));
59 memset(action, 0,
sizeof(action));
62 memset(&attr, 0,
sizeof(
struct rte_flow_attr));
69 action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
70 action[0].conf = &queue;
71 action[1].type = RTE_FLOW_ACTION_TYPE_END;
88 memset(&ip_spec, 0,
sizeof(
struct rte_flow_item_ipv4));
89 memset(&ip_mask, 0,
sizeof(
struct rte_flow_item_ipv4));
90 ip_spec.hdr.dst_addr = htonl(dest_ip);
91 ip_mask.hdr.dst_addr = 0;
92 ip_spec.hdr.src_addr = htonl(src_ip);
93 ip_mask.hdr.src_addr = src_mask;
95 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
97 pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
98 pattern[1].spec = &ip_spec;
99 pattern[1].mask = &ip_mask;
102 pattern[2].type = RTE_FLOW_ITEM_TYPE_END;
105 res = rte_flow_validate(port_id, &attr, pattern, action,
error);
107 flow = rte_flow_create(port_id, &attr, pattern, action,
error);
117 struct rte_flow_attr attr;
120 struct rte_flow *flow = NULL;
123 memset(pattern, 0,
sizeof(pattern));
124 memset(action, 0,
sizeof(action));
127 memset(&attr, 0,
sizeof(
struct rte_flow_attr));
136 action[0].type = RTE_FLOW_ACTION_TYPE_DROP;
137 action[1].type = RTE_FLOW_ACTION_TYPE_END;
146 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
155 pattern[1].type = RTE_FLOW_ITEM_TYPE_END;
158 res = rte_flow_validate(port_id, &attr, pattern, action,
error);
160 flow = rte_flow_create(port_id, &attr, pattern, action,
error);
170 struct rte_flow_attr attr;
173 struct rte_flow *flow = NULL;
174 struct rte_flow_action_queue queue = { .index = rx_q };
177 memset(pattern, 0,
sizeof(pattern));
178 memset(action, 0,
sizeof(action));
181 memset(&attr, 0,
sizeof(
struct rte_flow_attr));
187 action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
188 action[0].conf = &queue;
189 action[1].type = RTE_FLOW_ACTION_TYPE_END;
192 struct rte_flow_item_eth item_eth_mask = {};
193 struct rte_flow_item_eth item_eth_spec = {};
195 item_eth_spec.hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_ARP);
196 item_eth_mask.hdr.ether_type = RTE_BE16(0xFFFF);
198 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
199 pattern[0].mask = &item_eth_mask;
200 pattern[0].spec = &item_eth_spec;
201 pattern[1].type = RTE_FLOW_ITEM_TYPE_END;
204 res = rte_flow_validate(port_id, &attr, pattern, action,
error);
206 flow = rte_flow_create(port_id, &attr, pattern, action,
error);
struct rte_flow * generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, uint32_t src_ip, uint32_t src_mask, uint32_t dest_ip, uint32_t dest_mask, struct rte_flow_error *error)