summaryrefslogtreecommitdiff
path: root/service/include/sc_node.h
blob: 6a60dbca18de95455f5aa601d04f3d30ef9ade0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#include <rte_config.h>
#include <rte_graph.h>
#include <rte_graph_worker.h>
#include <rte_malloc.h>
#include <rte_node_eth_api.h>

#include <common.h>
#include <sc_common.h>

struct graph_handlers
{
    char graph_symbol[MR_SYMBOL_MAX];
    unsigned int graph_id;
    unsigned int lcore_id;
    struct rte_graph * graph_handle;
};

struct node_setup_desc
{
    TAILQ_ENTRY(node_setup_desc) entries;
    char node_symbol[MR_SYMBOL_MAX];
};

struct node_manager_main
{
    /* workers */
    unsigned int nr_workers;

    /* node configration for physical devices */
    struct rte_node_ethdev_config node_ethdev_config[RTE_MAX_ETHPORTS];
    unsigned int nr_node_ethdev_config;

    /* node descs for each workers */
    TAILQ_HEAD(node_setup_desc_head, node_setup_desc) node_setup_descs[RTE_MAX_LCORE];
    unsigned int nr_node_setup_descs[RTE_MAX_LCORE];

    /* graph handlers for each worker */
    struct graph_handlers graph_handlers[RTE_MAX_LCORE];
};

struct node_mbuf_shared_ctx
{
    struct
    {
        uint64_t port_ingress_is_shmdev : 1;
        uint64_t port_egress_is_shmdev : 1;
    };

    uint16_t port_ingress;
    uint16_t port_egress;
    uint16_t lb_group_id;
    uint32_t si;
};

extern int node_mbuf_shared_ctx_offset;
static __rte_always_inline struct node_mbuf_shared_ctx * to_node_mbuf_shared_ctx(struct rte_mbuf * m)
{
    return RTE_MBUF_DYNFIELD(m, node_mbuf_shared_ctx_offset, struct node_mbuf_shared_ctx *);
}

void node_setup_desc_add_for_all_workers(struct node_manager_main * node_mgr_main, const char * node_sym);