DPDK 26.03.0-rc1
examples/flow_filtering/snippets/snippet_switch_granularity.c
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2022 NVIDIA Corporation & Affiliates
*/
#include <stdlib.h>
#include <rte_flow.h>
#include "../common.h"
#include "../jump_flow.h"
#include "snippet_switch_granularity.h"
static void
snippet_init_switch_granularity(void)
{
flow_attr.ingress = 0;
flow_attr.transfer = 1;
flow_attr.group = 1;
flow_attr.priority = 1;
}
static void
snippet_match_switch_granularity_create_actions(uint16_t port_id, struct rte_flow_action *action)
{
/* jump to group 1 */
struct rte_flow_error error;
create_jump_flow(port_id, 1, &error);
struct rte_flow_action_ethdev *represented_port = calloc(1,
sizeof(struct rte_flow_action_ethdev));
if (represented_port == NULL)
fprintf(stderr, "Failed to allocate memory for represented_port\n");
represented_port->port_id = 0;
action[0].conf = represented_port;
}
static void
snippet_match_switch_granularity_create_patterns(struct rte_flow_item *pattern)
{
/* Set the patterns. */
pattern[1].spec = NULL;
pattern[1].mask = NULL;
}
static struct rte_flow_template_table *
create_table_switch_granularity(__rte_unused uint16_t port_id,
{
return NULL;
}
#define __rte_unused
Definition: rte_common.h:248
@ RTE_FLOW_ACTION_TYPE_END
Definition: rte_flow.h:2597
@ RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
Definition: rte_flow.h:3177
@ RTE_FLOW_ITEM_TYPE_END
Definition: rte_flow.h:162
@ RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
Definition: rte_flow.h:602
@ RTE_FLOW_ITEM_TYPE_ETH
Definition: rte_flow.h:218
const void * conf
Definition: rte_flow.h:4292
enum rte_flow_action_type type
Definition: rte_flow.h:4291
const void * spec
Definition: rte_flow.h:2129
const void * mask
Definition: rte_flow.h:2131
enum rte_flow_item_type type
Definition: rte_flow.h:2128