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
32 /* Default carrier state for created KNI network interfaces */
33 extern uint32_t dflt_carrier;
36 * A structure describing the private information for a kni device.
40 struct list_head list;
42 struct net_device_stats stats;
44 uint16_t group_id; /* Group ID of a group of KNI devices */
45 uint32_t core_id; /* Core ID to bind */
46 char name[RTE_KNI_NAMESIZE]; /* Network device name */
47 struct task_struct *pthread;
49 /* wait queue for req/resp */
51 struct mutex sync_lock;
57 struct net_device *net_dev;
58 struct net_device *lad_dev;
59 struct pci_dev *pci_dev;
61 /* queue for packets to be sent out */
64 /* queue for the packets received */
67 /* queue for the allocated mbufs those can be used to save sk buffs */
70 /* free queue for the mbufs to be freed */
88 /* synchro for request processing */
89 unsigned long synchro;
92 void *pa[MBUF_BURST_SZ];
93 void *va[MBUF_BURST_SZ];
94 void *alloc_pa[MBUF_BURST_SZ];
95 void *alloc_va[MBUF_BURST_SZ];
98 void kni_net_release_fifo_phy(struct kni_dev *kni);
99 void kni_net_rx(struct kni_dev *kni);
100 void kni_net_init(struct net_device *dev);
101 void kni_net_config_lo_mode(char *lo_str);
102 void kni_net_poll_resp(struct kni_dev *kni);
103 void kni_set_ethtool_ops(struct net_device *netdev);
105 int ixgbe_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
106 void ixgbe_kni_remove(struct pci_dev *pdev);
107 int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
108 void igb_kni_remove(struct pci_dev *pdev);