DPDK 25.11.0-rc1
examples/flow_filtering/jump_flow.c
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2022 NVIDIA Corporation & Affiliates
*/
#include <stdlib.h>
#include <rte_flow.h>
#include "jump_flow.h"
struct rte_flow *
create_jump_flow(uint16_t port_id, uint16_t group_id, struct rte_flow_error *error)
{
struct rte_flow_action actions[2] = {0};
struct rte_flow_item patterns[2] = {0};
struct rte_flow *flow = NULL;
struct rte_flow_attr flow_attr = {
.ingress = 1,
.group = 0,
};
struct rte_flow_action_jump jump = {
.group = group_id,
};
/* Set up jump action to target group */
actions[0].conf = &jump;
/* match on ethernet */
/* Validate the rule and create it. */
if (rte_flow_validate(port_id, &flow_attr, patterns, actions, error) == 0)
flow = rte_flow_create(port_id, &flow_attr, patterns, actions, error);
return flow;
}
int rte_flow_validate(uint16_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
@ RTE_FLOW_ACTION_TYPE_END
Definition: rte_flow.h:2597
@ RTE_FLOW_ACTION_TYPE_JUMP
Definition: rte_flow.h:2622
struct rte_flow * rte_flow_create(uint16_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
@ RTE_FLOW_ITEM_TYPE_END
Definition: rte_flow.h:162
@ RTE_FLOW_ITEM_TYPE_ETH
Definition: rte_flow.h:218
const void * conf
Definition: rte_flow.h:4293
enum rte_flow_action_type type
Definition: rte_flow.h:4292
uint32_t ingress
Definition: rte_flow.h:105
enum rte_flow_item_type type
Definition: rte_flow.h:2128