]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/lib/librte_eal/linuxapp/kni/kni_dev.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / seastar / dpdk / 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 "compat.h"
34
35 #include <linux/if.h>
36 #include <linux/wait.h>
37 #ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
38 #include <linux/sched/signal.h>
39 #else
40 #include <linux/sched.h>
41 #endif
42 #include <linux/netdevice.h>
43 #include <linux/spinlock.h>
44 #include <linux/list.h>
45
46 #include <exec-env/rte_kni_common.h>
47 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
48
49 #define MBUF_BURST_SZ 32
50
51 /**
52 * A structure describing the private information for a kni device.
53 */
54 struct kni_dev {
55 /* kni list */
56 struct list_head list;
57
58 struct net_device_stats stats;
59 int status;
60 uint16_t group_id; /* Group ID of a group of KNI devices */
61 uint32_t core_id; /* Core ID to bind */
62 char name[RTE_KNI_NAMESIZE]; /* Network device name */
63 struct task_struct *pthread;
64
65 /* wait queue for req/resp */
66 wait_queue_head_t wq;
67 struct mutex sync_lock;
68
69 /* PCI device id */
70 uint16_t device_id;
71
72 /* kni device */
73 struct net_device *net_dev;
74 struct net_device *lad_dev;
75 struct pci_dev *pci_dev;
76
77 /* queue for packets to be sent out */
78 void *tx_q;
79
80 /* queue for the packets received */
81 void *rx_q;
82
83 /* queue for the allocated mbufs those can be used to save sk buffs */
84 void *alloc_q;
85
86 /* free queue for the mbufs to be freed */
87 void *free_q;
88
89 /* request queue */
90 void *req_q;
91
92 /* response queue */
93 void *resp_q;
94
95 void *sync_kva;
96 void *sync_va;
97
98 void *mbuf_kva;
99 void *mbuf_va;
100
101 /* mbuf size */
102 uint32_t mbuf_size;
103
104 /* synchro for request processing */
105 unsigned long synchro;
106
107 /* buffers */
108 void *pa[MBUF_BURST_SZ];
109 void *va[MBUF_BURST_SZ];
110 void *alloc_pa[MBUF_BURST_SZ];
111 void *alloc_va[MBUF_BURST_SZ];
112 };
113
114 void kni_net_rx(struct kni_dev *kni);
115 void kni_net_init(struct net_device *dev);
116 void kni_net_config_lo_mode(char *lo_str);
117 void kni_net_poll_resp(struct kni_dev *kni);
118 void kni_set_ethtool_ops(struct net_device *netdev);
119
120 int ixgbe_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
121 void ixgbe_kni_remove(struct pci_dev *pdev);
122 int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
123 void igb_kni_remove(struct pci_dev *pdev);
124
125 #endif