uint32_t counter;
uint64_t encap_data;
uint64_t decap_data;
+ uint16_t dst_port;
uint8_t core_idx;
bool unique_data;
};
static void
add_port_id(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_port_id port_id = {
.id = PORT_ID_DST,
};
+ port_id.id = para.dst_port;
actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
actions[actions_counter].conf = &port_id;
}
fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
uint32_t counter, uint16_t next_table, uint16_t hairpinq,
uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
- bool unique_data, uint8_t rx_queues_count)
+ bool unique_data, uint8_t rx_queues_count, uint16_t dst_port)
{
struct additional_para additional_para_data;
uint8_t actions_counter = 0;
.decap_data = decap_data,
.core_idx = core_idx,
.unique_data = unique_data,
+ .dst_port = dst_port,
};
if (hairpinq != 0) {
static uint8_t items_idx, actions_idx, attrs_idx;
static uint64_t ports_mask;
+static uint16_t dst_ports[RTE_MAX_ETHPORTS];
static volatile bool force_quit;
static bool dump_iterations;
static bool delete_flag;
{ "icmpv4", 0, 0, 0 },
{ "icmpv6", 0, 0, 0 },
/* Actions */
- { "port-id", 0, 0, 0 },
+ { "port-id", 2, 0, 0 },
{ "rss", 0, 0, 0 },
{ "queue", 0, 0, 0 },
{ "jump", 0, 0, 0 },
RTE_ETH_FOREACH_DEV(i)
ports_mask |= 1 << i;
+ for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+ dst_ports[i] = PORT_ID_DST;
+
hairpin_queues_num = 0;
argvopt = argv;
rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
ports_mask = pm;
}
+ if (strcmp(lgopts[opt_idx].name,
+ "port-id") == 0) {
+ uint16_t port_idx = 0;
+ char *token;
+
+ token = strtok(optarg, ",");
+ while (token != NULL) {
+ dst_ports[port_idx++] = atoi(token);
+ token = strtok(NULL, ",");
+ }
+ }
if (strcmp(lgopts[opt_idx].name, "rxq") == 0) {
n = atoi(optarg);
rx_queues_count = (uint8_t) n;
}
static struct rte_flow **
-insert_flows(int port_id, uint8_t core_id)
+insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id)
{
struct rte_flow **flows_list;
struct rte_flow_error error;
*/
flow = generate_flow(port_id, 0, flow_attrs,
global_items, global_actions,
- flow_group, 0, 0, 0, 0, core_id, rx_queues_count,
- unique_data, &error);
+ flow_group, 0, 0, 0, 0, dst_port_id, core_id,
+ rx_queues_count, unique_data, &error);
if (flow == NULL) {
print_flow_error(error);
flow = generate_flow(port_id, flow_group,
flow_attrs, flow_items, flow_actions,
JUMP_ACTION_TABLE, counter,
- hairpin_queues_num,
- encap_data, decap_data,
+ hairpin_queues_num, encap_data,
+ decap_data, dst_port_id,
core_id, rx_queues_count,
unique_data, &error);
flows_handler(uint8_t core_id)
{
struct rte_flow **flows_list;
+ uint16_t port_idx = 0;
uint16_t nr_ports;
int port_id;
mc_pool.last_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
if (has_meter())
meters_handler(port_id, core_id, METER_CREATE);
- flows_list = insert_flows(port_id, core_id);
+ flows_list = insert_flows(port_id, core_id,
+ dst_ports[port_idx++]);
if (flows_list == NULL)
rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n");
mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout);