DPDK 26.03.0-rc1
examples/flow_filtering/snippets/snippet_match_roce_ib_bth.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_match_roce_ib_bth.h"
static void
snippet_init_roce_ib_bth(void)
{
flow_attr.ingress = 1;
flow_attr.group = 1;
flow_attr.priority = 1;
}
static void
snippet_match_roce_ib_bth_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);
/* Create one action that moves the packet to the selected queue. */
struct rte_flow_action_queue *queue = calloc(1, sizeof(struct rte_flow_action_queue));
if (queue == NULL)
fprintf(stderr, "Failed to allocate memory for queue\n");
/* Set the selected queue. */
queue->index = 1;
/* Set the action move packet to the selected queue. */
action[0].conf = queue;
}
static void
snippet_match_roce_ib_bth_create_patterns(struct rte_flow_item *pattern)
{
struct rte_flow_item_ib_bth *bth;
bth = calloc(1, sizeof(struct rte_flow_item_ib_bth));
if (bth == NULL)
fprintf(stderr, "Failed to allocate memory for bth\n");
bth->hdr.opcode = 0x81;
bth->hdr.dst_qp[0] = 0x0;
bth->hdr.dst_qp[1] = 0xab;
bth->hdr.dst_qp[2] = 0xd4;
/* Set the patterns. */
pattern[3].spec = bth;
}
static struct rte_flow_template_table *
snippet_match_roce_ib_bth_create_table(__rte_unused uint16_t port_id,
{
return NULL;
}
#define __rte_unused
Definition: rte_common.h:248
@ RTE_FLOW_ACTION_TYPE_QUEUE
Definition: rte_flow.h:2653
@ RTE_FLOW_ACTION_TYPE_END
Definition: rte_flow.h:2597
@ RTE_FLOW_ITEM_TYPE_IPV4
Definition: rte_flow.h:232
@ RTE_FLOW_ITEM_TYPE_END
Definition: rte_flow.h:162
@ RTE_FLOW_ITEM_TYPE_IB_BTH
Definition: rte_flow.h:698
@ RTE_FLOW_ITEM_TYPE_ETH
Definition: rte_flow.h:218
@ RTE_FLOW_ITEM_TYPE_UDP
Definition: rte_flow.h:253
const void * conf
Definition: rte_flow.h:4292
enum rte_flow_action_type type
Definition: rte_flow.h:4291
struct rte_ib_bth hdr
Definition: rte_flow.h:2062
const void * spec
Definition: rte_flow.h:2129
enum rte_flow_item_type type
Definition: rte_flow.h:2128
uint8_t dst_qp[3]
Definition: rte_ib.h:48
uint8_t opcode
Definition: rte_ib.h:26