]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/kernel/linux/kni/kni_dev.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / dpdk / kernel / linux / kni / kni_dev.h
CommitLineData
11fdf7f2
TL
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright(c) 2010-2014 Intel Corporation.
7c673cae
FG
4 */
5
6#ifndef _KNI_DEV_H_
7#define _KNI_DEV_H_
8
9#ifdef pr_fmt
10#undef pr_fmt
11#endif
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
11fdf7f2
TL
14#include "compat.h"
15
7c673cae
FG
16#include <linux/if.h>
17#include <linux/wait.h>
11fdf7f2
TL
18#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
19#include <linux/sched/signal.h>
20#else
7c673cae 21#include <linux/sched.h>
11fdf7f2 22#endif
7c673cae
FG
23#include <linux/netdevice.h>
24#include <linux/spinlock.h>
25#include <linux/list.h>
26
9f95a23c 27#include <rte_kni_common.h>
7c673cae
FG
28#define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */
29
30#define MBUF_BURST_SZ 32
31
9f95a23c
TL
32/* Default carrier state for created KNI network interfaces */
33extern uint32_t dflt_carrier;
34
7c673cae
FG
35/**
36 * A structure describing the private information for a kni device.
37 */
38struct kni_dev {
39 /* kni list */
40 struct list_head list;
41
42 struct net_device_stats stats;
43 int status;
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;
48
49 /* wait queue for req/resp */
50 wait_queue_head_t wq;
51 struct mutex sync_lock;
52
53 /* PCI device id */
54 uint16_t device_id;
55
56 /* kni device */
57 struct net_device *net_dev;
58 struct net_device *lad_dev;
59 struct pci_dev *pci_dev;
60
61 /* queue for packets to be sent out */
62 void *tx_q;
63
64 /* queue for the packets received */
65 void *rx_q;
66
67 /* queue for the allocated mbufs those can be used to save sk buffs */
68 void *alloc_q;
69
70 /* free queue for the mbufs to be freed */
71 void *free_q;
72
73 /* request queue */
74 void *req_q;
75
76 /* response queue */
77 void *resp_q;
78
79 void *sync_kva;
80 void *sync_va;
81
82 void *mbuf_kva;
83 void *mbuf_va;
84
85 /* mbuf size */
86 uint32_t mbuf_size;
87
88 /* synchro for request processing */
89 unsigned long synchro;
90
7c673cae
FG
91 /* buffers */
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];
96};
97
11fdf7f2 98void kni_net_release_fifo_phy(struct kni_dev *kni);
7c673cae
FG
99void kni_net_rx(struct kni_dev *kni);
100void kni_net_init(struct net_device *dev);
101void kni_net_config_lo_mode(char *lo_str);
102void kni_net_poll_resp(struct kni_dev *kni);
103void kni_set_ethtool_ops(struct net_device *netdev);
104
105int ixgbe_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
106void ixgbe_kni_remove(struct pci_dev *pdev);
107int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev);
108void igb_kni_remove(struct pci_dev *pdev);
109
110#endif