#include <stdlib.h>
#include "../common.h"
#include "snippet_match_port_affinity.h"
void
snippet_init_match_port_affinity(void)
{
init_default_snippet();
}
static void
map_tx_queue_to_aggregated_port(uint16_t port_id)
{
int ret;
uint16_t queues[] = {0, 1, 2, 3};
uint16_t affinities[] = {1, 1, 2, 2};
int i;
if (ret < 0)
"rte_eth_dev_stop:err=%d, port=%u\n",
ret, port_id);
if (ret < 0) {
printf("Failed to count the aggregated ports: (%s)\n",
strerror(-ret));
return;
}
for (i = 0; i < NR_QUEUES; i++) {
if (ret != 0) {
printf("Failed to map tx queue with an aggregated port: %s\n",
return;
}
printf(":: tx queue %d mapped to aggregated port %d with affinity %d\n",
queues[i], port_id, affinities[i]);
}
if (ret < 0)
"rte_eth_dev_start:err=%d, port=%u\n",
ret, port_id);
}
void
snippet_match_port_affinity_create_actions(uint16_t port_id,
struct rte_flow_action *action)
{
map_tx_queue_to_aggregated_port(port_id);
if (queue == NULL) {
printf("Failed to allocate memory for queue\n");
return;
}
}
void
snippet_match_port_affinity_create_patterns(
struct rte_flow_item *pattern)
{
if (affinity_spec == NULL) {
fprintf(stderr, "Failed to allocate memory for affinity_spec\n");
return;
}
if (affinity_mask == NULL) {
fprintf(stderr, "Failed to allocate memory for affinity_mask\n");
return;
}
pattern[1].
spec = affinity_spec;
pattern[1].
mask = affinity_mask;
}
struct rte_flow_template_table *
snippet_match_port_affinity_create_table(
__rte_unused uint16_t port_id,
{
return NULL;
}
__rte_noreturn void rte_exit(int exit_code, const char *format,...) __rte_format_printf(2
const char * rte_strerror(int errnum)
__rte_experimental int rte_eth_dev_map_aggr_tx_affinity(uint16_t port_id, uint16_t tx_queue_id, uint8_t affinity)
__rte_experimental int rte_eth_dev_count_aggr_ports(uint16_t port_id)
int rte_eth_dev_stop(uint16_t port_id)
int rte_eth_dev_start(uint16_t port_id)
@ RTE_FLOW_ACTION_TYPE_QUEUE
@ RTE_FLOW_ACTION_TYPE_END
@ RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY
enum rte_flow_action_type type
enum rte_flow_item_type type