kni: remove KNI vhost support
[dpdk.git] / lib / librte_eal / linuxapp / kni / kni_dev.h
1 /*-
2  * GPL LICENSE SUMMARY
3  *
4  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5  *
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.
9  *
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.
14  *
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.
20  *
21  *   Contact Information:
22  *   Intel Corporation
23  */
24
25 #ifndef _KNI_DEV_H_
26 #define _KNI_DEV_H_
27
28 #ifdef pr_fmt
29 #undef pr_fmt
30 #endif
31 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
32
33 #include <linux/if.h>
34 #include <linux/wait.h>
35 #include <linux/sched.h>
36 #include <linux/netdevice.h>
37 #include <linux/spinlock.h>
38 #include <linux/list.h>
39
40 #include <exec-env/rte_kni_common.h>
41 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
42
43 #define MBUF_BURST_SZ 32
44
45 /**
46  * A structure describing the private information for a kni device.
47  */
48 struct kni_dev {
49         /* kni list */
50         struct list_head list;
51
52         struct net_device_stats stats;
53         int status;
54         uint16_t group_id;           /* Group ID of a group of KNI devices */
55         uint32_t core_id;            /* Core ID to bind */
56         char name[RTE_KNI_NAMESIZE]; /* Network device name */
57         struct task_struct *pthread;
58
59         /* wait queue for req/resp */
60         wait_queue_head_t wq;
61         struct mutex sync_lock;
62
63         /* PCI device id */
64         uint16_t device_id;
65
66         /* kni device */
67         struct net_device *net_dev;
68         struct net_device *lad_dev;
69         struct pci_dev *pci_dev;
70
71         /* queue for packets to be sent out */
72         void *tx_q;
73
74         /* queue for the packets received */
75         void *rx_q;
76
77         /* queue for the allocated mbufs those can be used to save sk buffs */
78         void *alloc_q;
79
80         /* free queue for the mbufs to be freed */
81         void *free_q;
82
83         /* request queue */
84         void *req_q;
85
86         /* response queue */
87         void *resp_q;
88
89         void *sync_kva;
90         void *sync_va;
91
92         void *mbuf_kva;
93         void *mbuf_va;
94
95         /* mbuf size */
96         uint32_t mbuf_size;
97
98         /* synchro for request processing */
99         unsigned long synchro;
100
101         /* buffers */
102         void *pa[MBUF_BURST_SZ];
103         void *va[MBUF_BURST_SZ];
104         void *alloc_pa[MBUF_BURST_SZ];
105         void *alloc_va[MBUF_BURST_SZ];
106 };
107
108 void kni_net_rx(struct kni_dev *kni);
109 void kni_net_init(struct net_device *dev);
110 void kni_net_config_lo_mode(char *lo_str);
111 void kni_net_poll_resp(struct kni_dev *kni);
112 void kni_set_ethtool_ops(struct net_device *netdev);
113
114 int ixgbe_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
115 void ixgbe_kni_remove(struct pci_dev *pdev);
116 int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
117 void igb_kni_remove(struct pci_dev *pdev);
118
119 #endif