2 * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
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
25 #define QUEUE_SENDMSG 0
26 #define QUEUE_SENDMMSG 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 */
37 struct mmsghdr
*mmsg_vector
;
39 /* backlink to device which owns us */
40 struct net_device
*dev
;
43 int queue_depth
, head
, tail
, max_depth
, max_iov_frags
;
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
;
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
;
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
;
71 struct net_device
*dev
;
75 /* Timeout timer in TX */
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
;
89 struct arglist
*parsed
;
91 void *transport_data
; /* transport specific params if needed */
94 int req_size
; /* different from max packet - used for TSO */
99 /* remote address if any - some transports will leave this as null */
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
;
122 struct vector_estats estats
;
128 extern int build_transport_data(struct vector_private
*vp
);