update copyright date to 2013
[dpdk.git] / lib / librte_eal / linuxapp / kni / kni_dev.h
1 /*-
2  * GPL LICENSE SUMMARY
3  * 
4  *   Copyright(c) 2010-2013 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
26 #ifndef _KNI_DEV_H_
27 #define _KNI_DEV_H_
28
29 #include <linux/if.h>
30 #include <linux/wait.h>
31 #include <linux/sched.h>
32 #include <linux/netdevice.h>
33 #include <linux/spinlock.h>
34
35 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 10 /* us */
36
37 /**
38  * A structure describing the private information for a kni device.
39  */
40 struct kni_dev {
41         struct net_device_stats stats;
42         int status;
43         int idx;
44
45         /* wait queue for req/resp */
46         wait_queue_head_t wq;
47         struct mutex sync_lock;
48
49         /* PCI device id */
50         uint16_t device_id;
51
52         /* kni device */
53         struct net_device *net_dev;
54         struct net_device *lad_dev;
55         struct pci_dev *pci_dev;
56
57         /* queue for packets to be sent out */
58         void *tx_q;
59
60         /* queue for the packets received */
61         void *rx_q;
62
63         /* queue for the allocated mbufs those can be used to save sk buffs */
64         void *alloc_q;
65
66         /* free queue for the mbufs to be freed */
67         void *free_q;
68
69         /* request queue */
70         void *req_q;
71
72         /* response queue */
73         void *resp_q;
74
75         void * sync_kva;
76         void *sync_va;
77
78         void *mbuf_kva;
79         void *mbuf_va;
80
81         /* mbuf size */
82         unsigned mbuf_size;
83
84         /* synchro for request processing */
85         unsigned long synchro;
86 };
87
88 #define DEBUG_KNI
89
90 #define KNI_ERR(args...) printk(KERN_DEBUG "KNI: Error: " args)
91 #define KNI_PRINT(args...) printk(KERN_DEBUG "KNI: " args)
92 #ifdef DEBUG_KNI
93         #define KNI_DBG(args...) printk(KERN_DEBUG "KNI: " args)
94 #else
95         #define KNI_DBG(args...)
96 #endif
97
98 #endif