1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright(c) 2010-2014 Intel Corporation.
12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #define KNI_VERSION "1.0"
19 #include <linux/wait.h>
20 #ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
21 #include <linux/sched/signal.h>
23 #include <linux/sched.h>
25 #include <linux/netdevice.h>
26 #include <linux/spinlock.h>
27 #include <linux/list.h>
29 #include <rte_kni_common.h>
30 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
32 #define MBUF_BURST_SZ 32
34 /* Default carrier state for created KNI network interfaces */
35 extern uint32_t dflt_carrier;
38 * A structure describing the private information for a kni device.
42 struct list_head list;
44 uint32_t core_id; /* Core ID to bind */
45 char name[RTE_KNI_NAMESIZE]; /* Network device name */
46 struct task_struct *pthread;
48 /* wait queue for req/resp */
50 struct mutex sync_lock;
53 struct net_device *net_dev;
55 /* queue for packets to be sent out */
56 struct rte_kni_fifo *tx_q;
58 /* queue for the packets received */
59 struct rte_kni_fifo *rx_q;
61 /* queue for the allocated mbufs those can be used to save sk buffs */
62 struct rte_kni_fifo *alloc_q;
64 /* free queue for the mbufs to be freed */
65 struct rte_kni_fifo *free_q;
68 struct rte_kni_fifo *req_q;
71 struct rte_kni_fifo *resp_q;
83 void *pa[MBUF_BURST_SZ];
84 void *va[MBUF_BURST_SZ];
85 void *alloc_pa[MBUF_BURST_SZ];
86 void *alloc_va[MBUF_BURST_SZ];
89 void kni_net_release_fifo_phy(struct kni_dev *kni);
90 void kni_net_rx(struct kni_dev *kni);
91 void kni_net_init(struct net_device *dev);
92 void kni_net_config_lo_mode(char *lo_str);
93 void kni_net_poll_resp(struct kni_dev *kni);