examples/multi_process: build with meson
[dpdk.git] / kernel / linux / kni / kni_dev.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright(c) 2010-2014 Intel Corporation.
4  */
5
6 #ifndef _KNI_DEV_H_
7 #define _KNI_DEV_H_
8
9 #ifdef pr_fmt
10 #undef pr_fmt
11 #endif
12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
14 #include "compat.h"
15
16 #include <linux/if.h>
17 #include <linux/wait.h>
18 #ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
19 #include <linux/sched/signal.h>
20 #else
21 #include <linux/sched.h>
22 #endif
23 #include <linux/netdevice.h>
24 #include <linux/spinlock.h>
25 #include <linux/list.h>
26
27 #include <rte_kni_common.h>
28 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
29
30 #define MBUF_BURST_SZ 32
31
32 /* Default carrier state for created KNI network interfaces */
33 extern uint32_t dflt_carrier;
34
35 /**
36  * A structure describing the private information for a kni device.
37  */
38 struct kni_dev {
39         /* kni list */
40         struct list_head list;
41
42         struct net_device_stats stats;
43         int status;
44         uint16_t group_id;           /* Group ID of a group of KNI devices */
45         uint32_t core_id;            /* Core ID to bind */
46         char name[RTE_KNI_NAMESIZE]; /* Network device name */
47         struct task_struct *pthread;
48
49         /* wait queue for req/resp */
50         wait_queue_head_t wq;
51         struct mutex sync_lock;
52
53         /* PCI device id */
54         uint16_t device_id;
55
56         /* kni device */
57         struct net_device *net_dev;
58
59         /* queue for packets to be sent out */
60         void *tx_q;
61
62         /* queue for the packets received */
63         void *rx_q;
64
65         /* queue for the allocated mbufs those can be used to save sk buffs */
66         void *alloc_q;
67
68         /* free queue for the mbufs to be freed */
69         void *free_q;
70
71         /* request queue */
72         void *req_q;
73
74         /* response queue */
75         void *resp_q;
76
77         void *sync_kva;
78         void *sync_va;
79
80         void *mbuf_kva;
81         void *mbuf_va;
82
83         /* mbuf size */
84         uint32_t mbuf_size;
85
86         /* synchro for request processing */
87         unsigned long synchro;
88
89         /* buffers */
90         void *pa[MBUF_BURST_SZ];
91         void *va[MBUF_BURST_SZ];
92         void *alloc_pa[MBUF_BURST_SZ];
93         void *alloc_va[MBUF_BURST_SZ];
94 };
95
96 void kni_net_release_fifo_phy(struct kni_dev *kni);
97 void kni_net_rx(struct kni_dev *kni);
98 void kni_net_init(struct net_device *dev);
99 void kni_net_config_lo_mode(char *lo_str);
100 void kni_net_poll_resp(struct kni_dev *kni);
101
102 #endif