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:
31 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
36 #include <linux/wait.h>
37 #ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
38 #include <linux/sched/signal.h>
40 #include <linux/sched.h>
42 #include <linux/netdevice.h>
43 #include <linux/spinlock.h>
44 #include <linux/list.h>
46 #include <exec-env/rte_kni_common.h>
47 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
49 #define MBUF_BURST_SZ 32
52 * A structure describing the private information for a kni device.
56 struct list_head list;
58 struct net_device_stats stats;
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;
65 /* wait queue for req/resp */
67 struct mutex sync_lock;
73 struct net_device *net_dev;
74 struct net_device *lad_dev;
75 struct pci_dev *pci_dev;
77 /* queue for packets to be sent out */
80 /* queue for the packets received */
83 /* queue for the allocated mbufs those can be used to save sk buffs */
86 /* free queue for the mbufs to be freed */
104 /* synchro for request processing */
105 unsigned long synchro;
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];
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);
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);