4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution
19 * in the file called LICENSE.GPL.
21 * Contact Information:
29 #include <linux/wait.h>
30 #include <linux/sched.h>
31 #include <linux/netdevice.h>
32 #include <linux/spinlock.h>
33 #include <linux/list.h>
39 #include <exec-env/rte_kni_common.h>
40 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
43 * A structure describing the private information for a kni device.
48 struct list_head list;
50 struct net_device_stats stats;
52 uint16_t group_id; /* Group ID of a group of KNI devices */
53 unsigned core_id; /* Core ID to bind */
54 char name[RTE_KNI_NAMESIZE]; /* Network device name */
55 struct task_struct *pthread;
57 /* wait queue for req/resp */
59 struct mutex sync_lock;
65 struct net_device *net_dev;
66 struct net_device *lad_dev;
67 struct pci_dev *pci_dev;
69 /* queue for packets to be sent out */
72 /* queue for the packets received */
75 /* queue for the allocated mbufs those can be used to save sk buffs */
78 /* free queue for the mbufs to be freed */
96 /* synchro for request processing */
97 unsigned long synchro;
100 struct kni_vhost_queue* vhost_queue;
109 #define KNI_ERR(args...) printk(KERN_DEBUG "KNI: Error: " args)
110 #define KNI_PRINT(args...) printk(KERN_DEBUG "KNI: " args)
111 #ifdef RTE_KNI_KO_DEBUG
112 #define KNI_DBG(args...) printk(KERN_DEBUG "KNI: " args)
114 #define KNI_DBG(args...)
119 kni_poll(struct file *file, struct socket *sock, poll_table * wait);
120 int kni_chk_vhost_rx(struct kni_dev *kni);
121 int kni_vhost_init(struct kni_dev *kni);
122 int kni_vhost_backend_release(struct kni_dev *kni);
124 struct kni_vhost_queue {
131 struct sk_buff* cache;
132 struct rte_kni_fifo* fifo;
137 #ifdef RTE_KNI_VHOST_DEBUG_RX
138 #define KNI_DBG_RX(args...) printk(KERN_DEBUG "KNI RX: " args)
140 #define KNI_DBG_RX(args...)
143 #ifdef RTE_KNI_VHOST_DEBUG_TX
144 #define KNI_DBG_TX(args...) printk(KERN_DEBUG "KNI TX: " args)
146 #define KNI_DBG_TX(args...)