Linux 4.17.12
[linux/fpc-iii.git] / arch / um / drivers / vector_kern.h
blob0b0a767b90760a6f5d1298f13c618b1eefb6856e
1 /*
2 * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
6 #ifndef __UM_VECTOR_KERN_H
7 #define __UM_VECTOR_KERN_H
9 #include <linux/netdevice.h>
10 #include <linux/platform_device.h>
11 #include <linux/skbuff.h>
12 #include <linux/socket.h>
13 #include <linux/list.h>
14 #include <linux/ctype.h>
15 #include <linux/workqueue.h>
16 #include <linux/interrupt.h>
17 #include "vector_user.h"
19 /* Queue structure specially adapted for multiple enqueue/dequeue
20 * in a mmsgrecv/mmsgsend context
23 /* Dequeue method */
25 #define QUEUE_SENDMSG 0
26 #define QUEUE_SENDMMSG 1
28 #define VECTOR_RX 1
29 #define VECTOR_TX (1 << 1)
30 #define VECTOR_BPF (1 << 2)
31 #define VECTOR_QDISC_BYPASS (1 << 3)
33 #define ETH_MAX_PACKET 1500
34 #define ETH_HEADER_OTHER 32 /* just in case someone decides to go mad on QnQ */
36 struct vector_queue {
37 struct mmsghdr *mmsg_vector;
38 void **skbuff_vector;
39 /* backlink to device which owns us */
40 struct net_device *dev;
41 spinlock_t head_lock;
42 spinlock_t tail_lock;
43 int queue_depth, head, tail, max_depth, max_iov_frags;
44 short options;
47 struct vector_estats {
48 uint64_t rx_queue_max;
49 uint64_t rx_queue_running_average;
50 uint64_t tx_queue_max;
51 uint64_t tx_queue_running_average;
52 uint64_t rx_encaps_errors;
53 uint64_t tx_timeout_count;
54 uint64_t tx_restart_queue;
55 uint64_t tx_kicks;
56 uint64_t tx_flow_control_xon;
57 uint64_t tx_flow_control_xoff;
58 uint64_t rx_csum_offload_good;
59 uint64_t rx_csum_offload_errors;
60 uint64_t sg_ok;
61 uint64_t sg_linearized;
64 #define VERIFY_HEADER_NOK -1
65 #define VERIFY_HEADER_OK 0
66 #define VERIFY_CSUM_OK 1
68 struct vector_private {
69 struct list_head list;
70 spinlock_t lock;
71 struct net_device *dev;
73 int unit;
75 /* Timeout timer in TX */
77 struct timer_list tl;
79 /* Scheduled "remove device" work */
80 struct work_struct reset_tx;
81 struct vector_fds *fds;
83 struct vector_queue *rx_queue;
84 struct vector_queue *tx_queue;
86 int rx_irq;
87 int tx_irq;
89 struct arglist *parsed;
91 void *transport_data; /* transport specific params if needed */
93 int max_packet;
94 int req_size; /* different from max packet - used for TSO */
95 int headroom;
97 int options;
99 /* remote address if any - some transports will leave this as null */
101 int header_size;
102 int rx_header_size;
103 int coalesce;
105 void *header_rxbuffer;
106 void *header_txbuffer;
108 int (*form_header)(uint8_t *header,
109 struct sk_buff *skb, struct vector_private *vp);
110 int (*verify_header)(uint8_t *header,
111 struct sk_buff *skb, struct vector_private *vp);
113 spinlock_t stats_lock;
115 struct tasklet_struct tx_poll;
116 bool rexmit_scheduled;
117 bool opened;
118 bool in_write_poll;
120 /* ethtool stats */
122 struct vector_estats estats;
123 void *bpf;
125 char user[0];
128 extern int build_transport_data(struct vector_private *vp);
130 #endif