diff options
author | hselasky <hselasky@FreeBSD.org> | 2014-09-22 08:27:27 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2014-09-22 08:27:27 +0000 |
commit | bdacf9ba4dd91cc0515199d29fd6debec10cee6a (patch) | |
tree | 0022e54c289be9c8abb1f440ebe83025dce57741 /sys/net/if_var.h | |
parent | 724af6b5c3e043d8c23475fb6fdb6767be220dcb (diff) | |
download | FreeBSD-src-bdacf9ba4dd91cc0515199d29fd6debec10cee6a.zip FreeBSD-src-bdacf9ba4dd91cc0515199d29fd6debec10cee6a.tar.gz |
Improve transmit sending offload, TSO, algorithm in general.
The current TSO limitation feature only takes the total number of
bytes in an mbuf chain into account and does not limit by the number
of mbufs in a chain. Some kinds of hardware is limited by two
factors. One is the fragment length and the second is the fragment
count. Both of these limits need to be taken into account when doing
TSO. Else some kinds of hardware might have to drop completely valid
mbuf chains because they cannot loaded into the given hardware's DMA
engine. The new way of doing TSO limitation has been made backwards
compatible as input from other FreeBSD developers and will use
defaults for values not set.
Reviewed by: adrian, rmacklem
Sponsored by: Mellanox Technologies
MFC after: 1 week
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r-- | sys/net/if_var.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 9daafdf..53bac32 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -119,6 +119,12 @@ typedef void (*if_qflush_fn_t)(if_t); typedef int (*if_transmit_fn_t)(if_t, struct mbuf *); typedef uint64_t (*if_get_counter_t)(if_t, ift_counter); +struct ifnet_hw_tsomax { + u_int tsomaxbytes; /* TSO total burst length limit in bytes */ + u_int tsomaxsegcount; /* TSO maximum segment count */ + u_int tsomaxsegsize; /* TSO maximum segment size in bytes */ +}; + /* * Structure defining a network interface. * @@ -222,10 +228,11 @@ struct ifnet { if_get_counter_t if_get_counter; /* get counter values */ /* Stuff that's only temporary and doesn't belong here. */ - u_int if_hw_tsomax; /* tso burst length limit, the minimum - * is (IP_MAXPACKET / 8). - * XXXAO: Have to find a better place - * for it eventually. */ + u_int if_hw_tsomax; /* TSO total burst length + * limit in bytes. A value of + * zero means no limit. Have + * to find a better place for + * it eventually. */ /* * Old, racy and expensive statistics, should not be used in * new drivers. @@ -243,6 +250,10 @@ struct ifnet { uint64_t if_oqdrops; /* dropped on output */ uint64_t if_noproto; /* destined for unsupported protocol */ + /* TSO fields for segment limits. If a field is zero below, there is no limit. */ + u_int if_hw_tsomaxsegcount; /* TSO maximum segment count */ + u_int if_hw_tsomaxsegsize; /* TSO maximum segment size in bytes */ + /* * Spare fields to be added before branching a stable branch, so * that structure can be enhanced without changing the kernel @@ -596,5 +607,9 @@ struct mbuf* drbr_dequeue_drv(if_t ifp, struct buf_ring *br); int drbr_needs_enqueue_drv(if_t ifp, struct buf_ring *br); int drbr_enqueue_drv(if_t ifp, struct buf_ring *br, struct mbuf *m); +/* TSO */ +void if_hw_tsomax_common(if_t ifp, struct ifnet_hw_tsomax *); +int if_hw_tsomax_update(if_t ifp, struct ifnet_hw_tsomax *); + #endif /* _KERNEL */ #endif /* !_NET_IF_VAR_H_ */ |