DPDK
25.11.0
Toggle main menu visibility
Loading...
Searching...
No Matches
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].type =
RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
;
action[0].conf = represented_port;
action[1].type =
RTE_FLOW_ACTION_TYPE_END
;
}
static
void
snippet_match_switch_granularity_create_patterns(
struct
rte_flow_item
*pattern)
{
/* Set the patterns. */
pattern[0].
type
=
RTE_FLOW_ITEM_TYPE_ETH
;
pattern[1].
type
=
RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
;
pattern[1].
spec
= NULL;
pattern[1].
mask
= NULL;
pattern[2].
type
=
RTE_FLOW_ITEM_TYPE_END
;
}
static
struct
rte_flow_template_table *
create_table_switch_granularity(
__rte_unused
uint16_t port_id,
__rte_unused
struct
rte_flow_error
*error)
{
return
NULL;
}
__rte_unused
#define __rte_unused
Definition
rte_common.h:248
rte_flow.h
RTE_FLOW_ACTION_TYPE_END
@ RTE_FLOW_ACTION_TYPE_END
Definition
rte_flow.h:2597
RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
@ RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
Definition
rte_flow.h:3177
RTE_FLOW_ITEM_TYPE_END
@ RTE_FLOW_ITEM_TYPE_END
Definition
rte_flow.h:162
RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
@ RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
Definition
rte_flow.h:602
RTE_FLOW_ITEM_TYPE_ETH
@ RTE_FLOW_ITEM_TYPE_ETH
Definition
rte_flow.h:218
rte_flow_action_ethdev
Definition
rte_flow.h:4116
rte_flow_action_ethdev::port_id
uint16_t port_id
Definition
rte_flow.h:4117
rte_flow_action
Definition
rte_flow.h:4291
rte_flow_error
Definition
rte_flow.h:4378
rte_flow_item
Definition
rte_flow.h:2127
rte_flow_item::spec
const void * spec
Definition
rte_flow.h:2129
rte_flow_item::mask
const void * mask
Definition
rte_flow.h:2131
rte_flow_item::type
enum rte_flow_item_type type
Definition
rte_flow.h:2128
Generated by
1.17.0