CNDP 22.08.0
Loading...
Searching...
No Matches
cnet.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016-2022 Intel Corporation
3 */
4
5#ifndef __CNET_H
6#define __CNET_H
7
12
13#include <cne_version.h>
14#include <cne_log.h>
15#include <cne_per_thread.h> // for CNE_PER_THREAD, CNE_DECLARE_PER_THREAD
16#include <cne_cycles.h>
17#include <cnet_const.h> // for cfunc_t, sfunc_t, cnet_assert, iofunc_t
18#include <cne_atomic.h> // for atomic_uint_least16_t, atomic_fetch_add
19#include <stdint.h> // for uint16_t, int32_t
20
21#include <cne_common.h> // for CNE_MAX_ETHPORTS, __cne_cache_aligned
22#include <uid.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28struct stk_s;
29struct drv_entry;
30struct cne_mempool;
31struct fib_info;
32
33struct cnet {
34 CNE_ATOMIC(uint_fast16_t) stk_order;
35 uint16_t nb_ports;
36 uint32_t num_chnls;
37 uint32_t num_routes;
38 uint32_t num_arps;
39 uint16_t flags;
40 u_id_t chnl_uids;
41 void **chnl_descriptors;
42 void *netlink_info;
43 struct stk_s **stks;
44 struct drv_entry **drvs;
45 struct netif **netifs;
46 struct cne_mempool *rt4_obj;
47 struct cne_mempool *arp_obj;
48 struct fib_info *rt4_finfo;
49 struct fib_info *arp_finfo;
50 struct fib_info *pcb_finfo;
51 struct fib_info *tcb_finfo;
53
54enum {
57};
58
65struct cnet *cnet_get(void);
66#define this_cnet cnet_get()
67
74CNDP_API int cnet_lock(void);
75
82CNDP_API void cnet_unlock(void);
83
96CNDP_API int cnet_preload(char **libs, int cnt, int flag);
97
108CNDP_API struct cnet *cnet_config_create(uint32_t num_chnls, uint32_t num_routes);
109
116CNDP_API struct cnet *cnet_create(void);
117
124CNDP_API void cnet_stop(void);
125
132CNDP_API void cnet_dump(void);
133
140CNDP_API int cnet_add_cli_cmds(void);
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* __CNET_H */
#define __cne_cache_aligned
Definition cne_common.h:379
CNDP_API int cnet_preload(char **libs, int cnt, int flag)
preload shared libraries for CNDP and CNET.
CNDP_API int cnet_add_cli_cmds(void)
Called to initialize the CLI commands for the CNET structure.
CNDP_API int cnet_lock(void)
Lock the cnet structure.
CNDP_API void cnet_unlock(void)
Lock the cnet structure data.
CNDP_API struct cnet * cnet_config_create(uint32_t num_chnls, uint32_t num_routes)
Configure and create the base cnet structure using a couple params.
CNDP_API struct cnet * cnet_create(void)
Create cnet structure and use default value, will call cnet_config_create().
CNDP_API void cnet_dump(void)
Dump out the CNET structure information.
CNDP_API void cnet_stop(void)
Stop and free resources of the cnet structure.
struct cnet * cnet_get(void)
Get the current cnet structure pointer.
@ CNET_PUNT_ENABLED
Definition cnet.h:55
@ CNET_TCP_ENABLED
Definition cnet.h:56
void * u_id_t
Definition uid.h:26