1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright(c) 2010-2014 Intel Corporation.
12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 #include <linux/wait.h>
18 #ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
19 #include <linux/sched/signal.h>
21 #include <linux/sched.h>
23 #include <linux/netdevice.h>
24 #include <linux/spinlock.h>
25 #include <linux/list.h>
27 #include <exec-env/rte_kni_common.h>
28 #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
30 #define MBUF_BURST_SZ 32
33 * A structure describing the private information for a kni device.
37 struct list_head list;
39 struct net_device_stats stats;
41 uint16_t group_id; /* Group ID of a group of KNI devices */
42 uint32_t core_id; /* Core ID to bind */
43 char name[RTE_KNI_NAMESIZE]; /* Network device name */
44 struct task_struct *pthread;
46 /* wait queue for req/resp */
48 struct mutex sync_lock;
54 struct net_device *net_dev;
55 struct net_device *lad_dev;
56 struct pci_dev *pci_dev;
58 /* queue for packets to be sent out */
61 /* queue for the packets received */
64 /* queue for the allocated mbufs those can be used to save sk buffs */
67 /* free queue for the mbufs to be freed */
85 /* synchro for request processing */
86 unsigned long synchro;
89 void *pa[MBUF_BURST_SZ];
90 void *va[MBUF_BURST_SZ];
91 void *alloc_pa[MBUF_BURST_SZ];
92 void *alloc_va[MBUF_BURST_SZ];
95 void kni_net_release_fifo_phy(struct kni_dev *kni);
96 void kni_net_rx(struct kni_dev *kni);
97 void kni_net_init(struct net_device *dev);
98 void kni_net_config_lo_mode(char *lo_str);
99 void kni_net_poll_resp(struct kni_dev *kni);
100 void kni_set_ethtool_ops(struct net_device *netdev);
102 int ixgbe_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
103 void ixgbe_kni_remove(struct pci_dev *pdev);
104 int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
105 void igb_kni_remove(struct pci_dev *pdev);