2013-05-03 02:03:36 +00:00
|
|
|
/*-
|
2016-04-22 05:01:43 +00:00
|
|
|
* Copyright (c) 2009-2012,2016 Microsoft Corp.
|
2013-05-03 02:03:36 +00:00
|
|
|
* Copyright (c) 2010-2012 Citrix Inc.
|
|
|
|
* Copyright (c) 2012 NetApp Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice unmodified, this list of conditions, and the following
|
|
|
|
* disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2013-10-12 00:32:34 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
2013-05-03 02:03:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __HV_NET_VSC_H__
|
|
|
|
#define __HV_NET_VSC_H__
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
2016-01-26 09:42:13 +00:00
|
|
|
#include <sys/kernel.h>
|
2013-05-03 02:03:36 +00:00
|
|
|
#include <sys/lock.h>
|
2015-06-24 06:01:29 +00:00
|
|
|
#include <sys/malloc.h>
|
2016-01-25 05:01:32 +00:00
|
|
|
#include <sys/queue.h>
|
2016-01-26 09:42:13 +00:00
|
|
|
#include <sys/taskqueue.h>
|
2016-07-28 06:46:10 +00:00
|
|
|
#include <sys/sema.h>
|
2013-05-03 02:03:36 +00:00
|
|
|
#include <sys/sx.h>
|
2016-01-12 01:41:34 +00:00
|
|
|
|
2016-01-25 05:01:32 +00:00
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/bus_dma.h>
|
|
|
|
|
hyperv/hn: Implement LRO
- Implement the LRO using tcp_lro APIs, and LRO is enabled by default.
- Add several stats sysctl nodes.
- Check IP/TCP length before sending the packet to tcp_lro_rx(), if host
does not provide RX csum information (*); and add an option through
sysctl to always trust host TCP segment csum checks (default is off).
- Add sysctl to control the LRO entry depth; it is disabled by default.
It is used to avoid holding too much TCP segments in driver. Limiting
the LRO entry depth helps a lot in a one/two streams RX test.
This one 3x the RX performance on my local test (3Gbps -> 10Gbps), and
~2x the RX performance over a directly connected 40Ge network (5Gbps ->
9Gbps).
(*) It seems the host stops supplying csum information, once the network
load is high. This still needs investigation...
Reviewed by: Hongjiang Zhang <honzhan microsoft com>,
Dexuan Cui <decui microsoft com>,
Jun Su <junsu microsoft com>,
delphij
Tested by: me (local),
Hongjiang Zhang <honzhan microsoft com>
(directly connected 40Ge)
Approved by: delphij (mentor), adrian (mentor, no objection)
With feedback from: delphij, Hongjiang Zhang <honzhan microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4824
2016-01-12 01:30:51 +00:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp_lro.h>
|
2013-05-03 02:03:36 +00:00
|
|
|
|
2016-07-20 05:03:04 +00:00
|
|
|
#include <net/ethernet.h>
|
2016-01-12 01:41:34 +00:00
|
|
|
#include <net/if.h>
|
|
|
|
#include <net/if_media.h>
|
|
|
|
|
2013-05-03 02:03:36 +00:00
|
|
|
#include <dev/hyperv/include/hyperv.h>
|
2016-07-15 08:06:48 +00:00
|
|
|
#include <dev/hyperv/include/hyperv_busdma.h>
|
2016-07-15 06:29:19 +00:00
|
|
|
#include <dev/hyperv/include/vmbus.h>
|
2013-05-03 02:03:36 +00:00
|
|
|
|
2016-08-29 05:35:35 +00:00
|
|
|
#include <dev/hyperv/netvsc/ndis.h>
|
|
|
|
|
2013-05-03 02:03:36 +00:00
|
|
|
#endif /* __HV_NET_VSC_H__ */
|
|
|
|
|