1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright(c) 2010-2014 Intel Corporation.
12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 #include <linux/wait.h>
18 #ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
19 #include <linux/sched/signal.h>
21 #include <linux/sched.h>
23 #include <linux/netdevice.h>
24 #include <linux/spinlock.h>
25 #include <linux/list.h>
27 #include <rte_kni_common.h>
28 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
30 #define MBUF_BURST_SZ 32
32 /* Default carrier state for created KNI network interfaces */
33 extern uint32_t dflt_carrier;
36 * A structure describing the private information for a kni device.
40 struct list_head list;
42 uint32_t core_id; /* Core ID to bind */
43 char name[RTE_KNI_NAMESIZE]; /* Network device name */
44 struct task_struct *pthread;
46 /* wait queue for req/resp */
48 struct mutex sync_lock;
51 struct net_device *net_dev;
53 /* queue for packets to be sent out */
54 struct rte_kni_fifo *tx_q;
56 /* queue for the packets received */
57 struct rte_kni_fifo *rx_q;
59 /* queue for the allocated mbufs those can be used to save sk buffs */
60 struct rte_kni_fifo *alloc_q;
62 /* free queue for the mbufs to be freed */
63 struct rte_kni_fifo *free_q;
66 struct rte_kni_fifo *req_q;
69 struct rte_kni_fifo *resp_q;
81 void *pa[MBUF_BURST_SZ];
82 void *va[MBUF_BURST_SZ];
83 void *alloc_pa[MBUF_BURST_SZ];
84 void *alloc_va[MBUF_BURST_SZ];
87 void kni_net_release_fifo_phy(struct kni_dev *kni);
88 void kni_net_rx(struct kni_dev *kni);
89 void kni_net_init(struct net_device *dev);
90 void kni_net_config_lo_mode(char *lo_str);
91 void kni_net_poll_resp(struct kni_dev *kni);