Commit Graph

95 Commits

Author SHA1 Message Date
Roger Pau Monné
6567125372 xen-netfront: fix initialization
A couple of mostly cosmetic fixes for the final initialization of netfront:

 - Switch to "connected" state before starting to kick the rings.
 - Correctly use "rxq" in the initialization loop (previously rxq was not
   updated in the loop, and netfront would kick np->rxq[N] several times).
 - Declare and define xn_connect as static, it's not used outside of this
   file.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6657
2016-06-06 15:01:24 +00:00
Roger Pau Monné
bf7b50db15 xen-netfront: use callout_reset_curcpu instead of callout_reset
This should help distribute the load of the callbacks.

Suggested by:	hps
Sponsored by:	Citrix Systems R&D
2016-06-02 14:25:10 +00:00
Roger Pau Monné
c2d12e5e0d xen-netfront: perform an interface reset when changing options
The PV backend will only pick the new options when the interface is detached
and reattached again, so perform a full reset when changing options. This is
very fast, and should not be noticeable by the user.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6658
2016-06-02 11:21:00 +00:00
Roger Pau Monné
d039b0700b xen-netfront: release grant references used for the shared rings
Just calling gnttab_end_foreign_access_ref doesn't free the references,
instead call gnttab_end_foreign_access with a NULL page argument in order to
have the grant references freed. The code that maps the ring
(xenbus_map_ring) already uses gnttab_grant_foreign_access which takes care
of allocating a grant reference.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6608
2016-06-02 11:19:16 +00:00
Roger Pau Monné
c21b47d8c9 xen-netfront: fix two hotplug related issues
This patch fixes two issues seen on hot-unplug. The first one is a panic
caused by calling ether_ifdetach after freeing the internal netfront queue
structures. ether_ifdetach will call xn_qflush, and this needs to be done
before freeing the queues. This prevents the following panic:

Fatal trap 9: general protection fault while in kernel mode
cpuid = 2; apic id = 04
instruction pointer	= 0x20:0xffffffff80b1687f
stack pointer	        = 0x28:0xfffffe009239e770
frame pointer	        = 0x28:0xfffffe009239e780
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 0 (thread taskq)
[ thread pid 0 tid 100015 ]
Stopped at      strlen+0x1f:    movq    (%rcx),%rax
db> bt
Tracing pid 0 tid 100015 td 0xfffff800038a6000
strlen() at strlen+0x1f/frame 0xfffffe009239e780
kvprintf() at kvprintf+0xfa0/frame 0xfffffe009239e890
vsnprintf() at vsnprintf+0x31/frame 0xfffffe009239e8b0
kassert_panic() at kassert_panic+0x5a/frame 0xfffffe009239e920
__mtx_lock_flags() at __mtx_lock_flags+0x164/frame 0xfffffe009239e970
xn_qflush() at xn_qflush+0x59/frame 0xfffffe009239e9b0
if_detach() at if_detach+0x17e/frame 0xfffffe009239ea10
netif_free() at netif_free+0x97/frame 0xfffffe009239ea30
netfront_detach() at netfront_detach+0x11/frame 0xfffffe009239ea40
[...]

Another panic can be triggered by hot-plugging a NIC:

Fatal trap 18: integer divide fault while in kernel mode
cpuid = 0; apic id = 00
instruction pointer	= 0x20:0xffffffff80902203
stack pointer	        = 0x28:0xfffffe00508d3660
frame pointer	        = 0x28:0xfffffe00508d36a0
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 2960 (ifconfig)
[ thread pid 2960 tid 100088 ]
Stopped at      xn_txq_mq_start+0x33:   divl    %esi,%eax
db> bt
Tracing pid 2960 tid 100088 td 0xfffff8000850aa00
xn_txq_mq_start() at xn_txq_mq_start+0x33/frame 0xfffffe00508d36a0
ether_output() at ether_output+0x570/frame 0xfffffe00508d3720
arprequest() at arprequest+0x433/frame 0xfffffe00508d3820
arp_ifinit() at arp_ifinit+0x49/frame 0xfffffe00508d3850
xn_ioctl() at xn_ioctl+0x1a2/frame 0xfffffe00508d3890
in_control() at in_control+0x882/frame 0xfffffe00508d3910
ifioctl() at ifioctl+0xda1/frame 0xfffffe00508d39a0
kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe00508d3a00
sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe00508d3ae0
amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe00508d3bf0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe00508d3bf0
--- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x8011e185a, rsp =
0x7fffffffe478, rbp = 0x7fffffffe4c0 ---

This is caused by marking the driver as active before it's fully
initialized, and thus calling xn_txq_mq_start with num_queues set to 0.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6646
2016-06-02 11:18:02 +00:00
Roger Pau Monné
da695b059d xen-netfront: switch to using an interrupt handler
In order to use custom taskqueues we would have to mask the interrupt, which
is basically what is already done for an interrupt handler, or else we risk
loosing interrupts. This switches netfront to the same interrupt handling
that was done before multiqueue support was added.

Reviewed by:	Wei Liu <wei.liu2@citrix.com>
Sponsored by:	Citrix Systems R&D
2016-06-02 11:16:35 +00:00
Roger Pau Monné
2568ee6747 xen-netfront: always keep the Rx ring full of requests
This is based on Linux commit 1f3c2eba1e2d866ef99bb9b10ade4096e3d7607c from
David Vrabel:

A full Rx ring only requires 1 MiB of memory.  This is not enough memory
that it is useful to dynamically scale the number of Rx requests in the ring
based on traffic rates, because:

a) Even the full 1 MiB is a tiny fraction of a typically modern Linux
   VM (for example, the AWS micro instance still has 1 GiB of memory).

b) Netfront would have used up to 1 MiB already even with moderate
   data rates (there was no adjustment of target based on memory
   pressure).

c) Small VMs are going to typically have one VCPU and hence only one
   queue.

Keeping the ring full of Rx requests handles bursty traffic better than
trying to converge on an optimal number of requests to keep filled.

Reviewed by:	Wei Liu <wei.liu2@citrix.com>
Sponsored by:	Citrix Systems R&D
2016-06-02 11:14:26 +00:00
Roger Pau Monné
d9a66b6ded xen-netfront: fix receiving TSO packets
Currently FreeBSD is not properly fetching the TSO information from the Xen
PV ring, and thus the received packets didn't have all the necessary
information, like the segment size or even the TSO flag set.

Sponsored by: Citrix Systems R&D
2016-06-02 11:12:11 +00:00
Roger Pau Monné
107cfbb743 xen-netfront: fix feature detection
Current netfront code relies on xs_scanf returning a value < 0 on error,
which is not right, xs_scanf returns a positive value on error.

MFC after:	3 days
Tested by:	Stephen Jones <StephenJo@LivingComputerMuseum.org>
Sponsored by:	Citrix Systems R&D
2016-05-12 16:18:02 +00:00
Sepherosa Ziehau
6dd38b8716 tcp/lro: Use tcp_lro_flush_all in device drivers to avoid code duplication
And factor out tcp_lro_rx_done, which deduplicates the same logic with
netinet/tcp_lro.c

Reviewed by:	gallatin (1st version), hps, zbb, np, Dexuan Cui <decui microsoft com>
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5725
2016-04-01 06:28:33 +00:00
John Baldwin
cbc4d2db75 Remove taskqueue_enqueue_fast().
taskqueue_enqueue() was changed to support both fast and non-fast
taskqueues 10 years ago in r154167.  It has been a compat shim ever
since.  It's time for the compat shim to go.

Submitted by:	Howard Su <howard0su@gmail.com>
Reviewed by:	sephe
Differential Revision:	https://reviews.freebsd.org/D5131
2016-03-01 17:47:32 +00:00
Roger Pau Monné
8f28a42ee7 xen-netfront: remove useless NULL check in netif_free
xn_ifp is allocated in create_netdev with if_alloc(IFT_ETHER).
According to the current arrangement it can't be NULL.

Coverity ID:		1349805
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D5252
2016-02-11 11:57:12 +00:00
Roger Pau Monné
d4dae2b1fb xen-netfront: rearrange error paths in setup_txqs
Coverity spotted double free errors in error path. Fix that by
removing the extraneous calls.

Coverity ID:		1349798
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D5251
2016-02-11 11:53:32 +00:00
Roger Pau Monné
7803499440 xen-netfront: remove pointless assignment in xn_ioctl
The variable error is assigned to 0 before entering the switch.
Assigning error to 0 before break pointless rewrites the real error
value that should be returned.

Coverity ID:		1304974
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D5250
2016-02-11 11:50:31 +00:00
Roger Pau Monné
96375eac94 xen-netfront: add multiqueue support
Add support for multiple TX and RX queue pairs. The default number of queues
is set to 4, but can be easily changed from the sysctl node hw.xn.num_queues.

Also heavily refactor netfront driver: break out a bunch of helper
functions and different structures. Use threads to handle TX and RX.
Remove some dead code and fix quite a few bugs as I go along.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Relnotes:		Yes
Differential Revision:	https://reviews.freebsd.org/D4193
2016-01-20 15:02:43 +00:00
Roger Pau Monné
d5b4f139f5 xen-netfront: remove unused header files
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Differential Revision:	https://reviews.freebsd.org/D4079
2015-11-05 14:37:17 +00:00
Simon J. Gerraty
ce8df48b73 Do not FALLTHROUGH for SIOC{ADD,DEL}MULTI
ifmedia_ioctl() returns EINVAL

Differential Revision:	3897
Submitted by:	aronen@juniper.net
Reviewed by:	marcel
2015-10-30 17:12:15 +00:00
Roger Pau Monné
3778878d7c netfront: fix LINT-NOIP
r289587 broke LINT-NOIP kernels because the lro and queued local variables
are defined but not used. Add preprocessor guards around them.

Reported by:	emaste
Sponsored by:	Citrix Systems R&D
2015-10-21 13:53:07 +00:00
Roger Pau Monné
2f9ec994bc xen: Code cleanup and small bug fixes
xen/hypervisor.h:
 - Remove unused helpers: MULTI_update_va_mapping, is_initial_xendomain,
   is_running_on_xen
 - Remove unused define CONFIG_X86_PAE
 - Remove unused variable xen_start_info: note that it's used inpcifront
   which is not built at all
 - Remove forward declaration of HYPERVISOR_crash

xen/xen-os.h:
 - Remove unused define CONFIG_X86_PAE
 - Drop unused helpers: test_and_clear_bit, clear_bit,
   force_evtchn_callback
 - Implement a generic version (based on ofed/include/linux/bitops.h) of
   set_bit and test_bit and prefix them by xen_ to avoid any use by other
   code than Xen. Note that It would be worth to investigate a generic
   implementation in FreeBSD.
 - Replace barrier() by __compiler_membar()
 - Replace cpu_relax() by cpu_spinwait(): it's exactly the same as rep;nop
   = pause

xen/xen_intr.h:
 - Move the prototype of xen_intr_handle_upcall in it: Use by all the
   platform

x86/xen/xen_intr.c:
 - Use BITSET* for the enabledbits: Avoid to use custom helpers
 - test_bit/set_bit has been renamed to xen_test_bit/xen_set_bit
 - Don't export the variable xen_intr_pcpu

dev/xen/blkback/blkback.c:
 - Fix the string format when XBB_DEBUG is enabled: host_addr is typed
   uint64_t

dev/xen/balloon/balloon.c:
 - Remove set but not used variable
 - Use the correct type for frame_list: xen_pfn_t represents the frame
   number on any architecture

dev/xen/control/control.c:
 - Return BUS_PROBE_WILDCARD in xs_probe: Returning 0 in a probe callback
   means the driver can handle this device. If by any chance xenstore is the
   first driver, every new device with the driver is unset will use
   xenstore.

dev/xen/grant-table/grant_table.c:
 - Remove unused cmpxchg
 - Drop unused include opt_pmap.h: Doesn't exist on ARM64 and it doesn't
   contain anything required for the code on x86

dev/xen/netfront/netfront.c:
 - Use the correct type for rx_pfn_array: xen_pfn_t represents the frame
   number on any architecture

dev/xen/netback/netback.c:
 - Use the correct type for gmfn: xen_pfn_t represents the frame number on
   any architecture

dev/xen/xenstore/xenstore.c:
 - Return BUS_PROBE_WILDCARD in xctrl_probe: Returning 0 in a probe callback
   means the driver can handle this device. If by any chance xenstore is the
  first driver, every new device with the driver is unset will use xenstore.

Note that with the changes, x86/include/xen/xen-os.h doesn't contain anymore
arch-specific code. Although, a new series will add some helpers that differ
between x86 and ARM64, so I've kept the headers for now.

Submitted by:		Julien Grall <julien.grall@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3921
Sponsored by:		Citrix Systems R&D
2015-10-21 10:44:07 +00:00
Roger Pau Monné
4955cbf300 xen-netfront: use "netfront" in lock description
Missed from r289585.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3937
Sponsored by:		Citrix Systems R&D
2015-10-19 15:34:24 +00:00
Roger Pau Monné
1a2928b740 xen-netfront: fix netfront create_dev error path
The failure path for allocating rx grant refs should not try to free tx
grant refs because tx grant refs were allocated after that. Also fix the
error path for xen_net_read_mac.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3891
Sponsored by:		Citrix Systems R&D
2015-10-19 14:47:37 +00:00
Roger Pau Monné
b31a0d731b xen-netfront: no need to set if_output
This is redundant because ether_ifattach will set that field.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3918
Sponsored by:		Citrix Systems R&D
2015-10-19 14:37:17 +00:00
Roger Pau Monné
08c9c2e0a1 xen-netfront: remove a bunch of FreeBSD version check
We're way beyond FreeBSD 7 at this point.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3892
Sponsored by:		Citrix Systems R&D
2015-10-19 14:34:45 +00:00
Roger Pau Monné
177e3f1366 xen-netfront: remove XN_LOCK_{INIT,DESTROY}
Multiqueue feature will make the number of queues dynamic, so XN_LOCK_INIT
won't be that useful. Remove the macro and call mtx_init directly.

XN_LOCK_DESTROY is just dead code.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3890
Sponsored by:		Citrix Systems R&D
2015-10-19 14:26:40 +00:00
Roger Pau Monné
9a7f9feaf5 xen-netfront: clean up netfront stats structure
Rename it with netfront_ prefix and purge a bunch of unused fields.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3889
Sponsored by:		Citrix Systems R&D
2015-10-19 14:22:57 +00:00
Roger Pau Monné
d0f3a8b902 xen-netfront: purge page flipping support
Currently neither Linux nor FreeBSD netback supports page flipping. NetBSD
still supports that. It is not sure how many people actually use page
flipping, but page flipping is supposed to be slower than copying nowadays.
It will also shatter frontend / backend address space.

Overall this feature is more of a burden than a benefit.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3888
Sponsored by:		Citrix Systems R&D
2015-10-19 14:20:06 +00:00
Roger Pau Monné
17374b6c3b xen-netfront: delete all trailing white spaces
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3886
Sponsored by:		Citrix Systems R&D
2015-10-19 14:12:15 +00:00
Marcelo Araujo
f0c2f5e202 Code cleanup unused-but-set-variable spotted by gcc.
Reviewed by:	royger
Approved by:	bapt (mentor)
Differential Revision:	D3476
2015-08-25 15:34:28 +00:00
Roger Pau Monné
f8f1bb83f7 xen: allow disabling PV disks and nics
Introduce two new loader tunnables that can be used to disable PV disks and
PV nics at boot time. They default to 0 and should be set to 1 (or any
number different than 0) in order to disable the PV devices:

hw.xen.disable_pv_disks=1
hw.xen.disable_pv_nics=1

In /boot/loader.conf will disable both PV disks and nics.

Sponsored by:	Citrix Systems R&D
Tested by:	Karl Pielorz <kpielorz_lst@tdx.co.uk>
MFC after:	1 week
2015-08-21 15:53:08 +00:00
John Baldwin
3ebe4c01f7 Remove another remnant of PV domU support and assume that we always run
with an automatically translated physmap under XEN.

Reviewed by:	royger (earlier version)
Differential Revision:	https://reviews.freebsd.org/D3325
2015-08-14 18:38:39 +00:00
John Baldwin
3c790178c5 Remove some more vestiges of the Xen PV domu support. Specifically,
use vtophys() directly instead of vtomach() and retire the no-longer-used
headers <machine/xenfunc.h> and <machine/xenvar.h>.

Reported by:	bde (stale bits in <machine/xenfunc.h>)
Reviewed by:	royger (earlier version)
Differential Revision:	https://reviews.freebsd.org/D3266
2015-08-06 17:07:21 +00:00
Roger Pau Monné
6a8e9695ba netfront: preserve configuration across migrations
Try to preserve the xn configuration when migrating. This is not always
possible since the backend might not have the same set of options
available, in which case we will try to preserve as many as possible.

MFC after:    2 weeks
PR:           183139
Reported by:  mcdouga9@egr.msu.edu
Sponsored by: Citrix Systems R&D
2015-07-03 12:09:05 +00:00
Jung-uk Kim
fd90e2ed54 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
2015-05-22 17:05:21 +00:00
Roger Pau Monné
dbf82bde19 netfront: wait for backend to connect before sending ARP
Netfront has to wait for the backend to switch to state XenbusStateConnected
before sending the ARP request, or else the backend might not be connected
and thus the packet will be lost.

Sponsored by: Citrix Systems R&D
MFC after: 1 week
2015-05-14 16:29:11 +00:00
John Baldwin
ed95805e90 Remove support for Xen PV domU kernels. Support for HVM domU kernels
remains.  Xen is planning to phase out support for PV upstream since it
is harder to maintain and has more overhead.  Modern x86 CPUs include
virtualization extensions that support HVM guests instead of PV guests.
In addition, the PV code was i386 only and not as well maintained recently
as the HVM code.
- Remove the i386-only NATIVE option that was used to disable certain
  components for PV kernels.  These components are now standard as they
  are on amd64.
- Remove !XENHVM bits from PV drivers.
- Remove various shims required for XEN (e.g. PT_UPDATES_FLUSH, LOAD_CR3,
  etc.)
- Remove duplicate copy of <xen/features.h>.
- Remove unused, i386-only xenstored.h.

Differential Revision:	https://reviews.freebsd.org/D2362
Reviewed by:	royger
Tested by:	royger (i386/amd64 HVM domU and amd64 PVH dom0)
Relnotes:	yes
2015-04-30 15:48:48 +00:00
Marcelo Araujo
d8edb414c9 Remove unused variable.
Differential Revision:	D2333
Reviewed by:		royger
2015-04-20 17:30:13 +00:00
Gleb Smirnoff
c2d9c6f035 Use m_getjcl() instead of old mbuf(9) KPIs.
Tested by:	royger
2015-02-27 19:12:35 +00:00
Gleb Smirnoff
49e6be9c3d Previous version of mbufq were fine initialized by M_ZERO, while
new one require explicti initialization.

Reported by:	royger
2015-02-23 18:55:26 +00:00
Gleb Smirnoff
c578b6aca0 Provide a set of inline functions to manage simple mbuf(9) queues, based
on queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
grown implementations.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-02-19 01:19:42 +00:00
Xin LI
25baf019f1 Use the common codepath to handle SIOCGIFADDR.
Before this change, the current code handles SIOCGIFADDR the same
way with SIOCSIFADDR, which involves full arp_ifinit, et al.  They
should be unnecessary for SIOCGIFADDR case.

Differential Revision: https://reviews.freebsd.org/D1508
Reviewed by:	glebius
MFC after:	2 weeks
2015-01-13 05:32:51 +00:00
Robert Watson
2a8c860fe3 In order to reduce use of M_EXT outside of the mbuf allocator and
socket-buffer implementations, introduce a return value for MCLGET()
(and m_cljget() that underlies it) to allow the caller to avoid testing
M_EXT itself.  Update all callers to use the return value.

With this change, very few network device drivers remain aware of
M_EXT; the primary exceptions lie in mbuf-chain pretty printers for
debugging, and in a few cases, custom mbuf and cluster allocation
implementations.

NB: This is a difficult-to-test change as it touches many drivers for
which I don't have physical devices.  Instead we've gone for intensive
review, but further post-commit review would definitely be appreciated
to spot errors where changes could not easily be made mechanically,
but were largely mechanical in nature.

Differential Revision:	https://reviews.freebsd.org/D1440
Reviewed by:	adrian, bz, gnn
Sponsored by:	EMC / Isilon Storage Division
2015-01-06 12:59:37 +00:00
Hans Petter Selasky
f0188618f2 Fix multiple incorrect SYSCTL arguments in the kernel:
- Wrong integer type was specified.

- Wrong or missing "access" specifier. The "access" specifier
sometimes included the SYSCTL type, which it should not, except for
procedural SYSCTL nodes.

- Logical OR where binary OR was expected.

- Properly assert the "access" argument passed to all SYSCTL macros,
using the CTASSERT macro. This applies to both static- and dynamically
created SYSCTLs.

- Properly assert the the data type for both static and dynamic
SYSCTLs. In the case of static SYSCTLs we only assert that the data
pointed to by the SYSCTL data pointer has the correct size, hence
there is no easy way to assert types in the C language outside a
C-function.

- Rewrote some code which doesn't pass a constant "access" specifier
when creating dynamic SYSCTL nodes, which is now a requirement.

- Updated "EXAMPLES" section in SYSCTL manual page.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-21 07:31:21 +00:00
Hans Petter Selasky
9fd573c39d 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
2014-09-22 08:27:27 +00:00
Gleb Smirnoff
c8dfaf382f Mechanically convert to if_inc_counter(). 2014-09-19 03:51:26 +00:00
Hans Petter Selasky
72f3100047 Revert r271504. A new patch to solve this issue will be made.
Suggested by:	adrian @
2014-09-13 20:52:01 +00:00
Hans Petter Selasky
eb93b77ae4 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.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2014-09-13 08:26:09 +00:00
Gleb Smirnoff
c6b15dd50d Fix typo in r257515.
Submitted by:	az
2013-11-10 09:36:51 +00:00
Gleb Smirnoff
f909bbb4db Somehow fix LINT-NOIP. 2013-11-01 18:42:03 +00:00
Gleb Smirnoff
6483a98b43 Remove dead function show_device(). It isn't buildable if DEBUG is
defined, due to unknown field "xn_ifno".  The field wasn't known
since beginning of history of this file.
2013-10-28 21:09:59 +00:00
Gleb Smirnoff
77374386a2 Include if_var.h. 2013-10-28 21:08:04 +00:00