Commit Graph

29 Commits

Author SHA1 Message Date
Kenneth D. Merry
931eeffaa2 A number of netfront fixes and stability improvements:
- Re-enable TSO.  This was broken previously due to CSUM_TSO clearing the
   CSUM_TCP flag, so our checksum flags were incorrectly set going to the
   netback driver.  That was fixed in r206844 in tcp_output.c, so we can
   turn TSO back on here.

 - Fix the way transmit slots are calculated, so that we can't overfill
   the ring.

 - Avoid sending packets with more fragments/segments than netback can
   handle.  The Linux netback code can only handle packets of
   MAX_SKB_FRAGS, which turns out to be 18 on machines with 4K pages.  We
   can easily generate packets with 32 or so fragments with TSO turned on.
   Right now the solution is just to drop the packets (since netback
   doesn't seem to handle it gracefully), but we should come up with a way
   to allow a driver to tell the TCP stack the maximum number of fragments
   it can handle in a single packet.

 - Fix the way the consumer is tracked in the receive path.  It could get
   out of sync fairly easily.

 - Use standard Xen ring macros to make it clearer how netfront is using
   the rings.

 - Get rid of Linux-ish negative errno return values.

 - Added more documentation to the driver.

 - Refactored code to make it easier to read.

 - Some other minor fixes.

Reviewed by:	gibbs

Reviewed by:	gibbs
Sponsored by:	Spectra Logic
MFC after:	7 days
2010-06-08 03:13:26 +00:00
Joel Dahl
8e0ad55abb Switch to our preferred 2-clause BSD license.
Approved by:	kmacy
2010-05-05 20:39:02 +00:00
Kip Macy
227ca25786 - make printf conditional
- fix witness warnings by making configuration lock a mutex
2010-02-21 01:11:39 +00:00
Justin T. Gibbs
0e5098428f Add media ioctl support and link notifications so that devd will attempt
to run dhclient on a netfront (xn) device that is setup for DHCP in
/etc/rc.conf.

PR:		kern/136251 (fixed differently than the submitted patch)
2009-12-01 17:29:25 +00:00
John Baldwin
dbd69bc565 Remove commented out reference to if_watchdog and an assignment of zero to
if_timer.

Reviewed by:	scottl
2009-11-19 20:59:40 +00:00
Kip Macy
cfed37836e update backend_changed to reflect .m prototype 2009-06-13 21:55:08 +00:00
Adrian Chadd
8cb079923f Fix compilation when compiled w/out WITNESS.
Submitted by:	Edwin Shao <poleris@gmail.com>
2009-06-07 05:52:22 +00:00
Adrian Chadd
3552092bb2 Delete useless #ifdef; make it more obvious if setting TSO fails. 2009-05-27 19:31:50 +00:00
Adrian Chadd
d76e4550e9 Clear IFF_DRV_OACTIVE if at least one TX xen/mbuf ring slot has been freed. 2009-05-27 13:59:17 +00:00
Adrian Chadd
7c66482c29 Enforce that there are actually enough xenbus TX ring descriptors available
before attempting to queue the packet.
2009-05-27 06:04:38 +00:00
Adrian Chadd
3fb28bbb67 Comment tidyup; comment where the next explicit check should
appear.
2009-05-27 05:37:04 +00:00
Adrian Chadd
a4ec37f59e Ensure that there are enough TX mbuf ring slots available before beginning
to dequeue a packet.

The tx path was trying to ensure that enough Xenbus TX ring slots existed but
it didn't check to see whether the mbuf TX ring slots were also available.
They get freed in xn_txeof() which occurs after transmission, rather than earlier
on in the process. (The same happens under Linux too.)

Due to whatever reason (CPU use, scheduling, memory constraints, whatever) the
mbuf TX ring may not have enough slots free and would allocate slot 0. This is
used as the freelist head pointer to represent "free" mbuf TX ring slots; setting
this to an actual mbuf value rather than an id crashes the code.

This commit introduces some basic code to track the TX mbuf ring use and then
(hopefully!) ensures that enough slots are free in said TX mbuf ring before it
enters the actual work loop.

A few notes:

* Similar logic needs to be introduced to check there are enough actual slots
  available in the xenbuf TX ring. There's some logic which is invoked earlier
  but it doesn't hard-check against the number of available ring slots.
  Its trivial to do; I'll do it in a subsequent commit.

* As I've now commented in the source, it is likely possible to deadlock the
  driver under certain conditions where the rings aren't receiving any changes
  (which I should enumerate) and thus Xen doesn't send any further software
  interrupts. I need to make sure that the timer(s) are running right and
  the queues are periodically kicked.

PR:		134926
2009-05-27 02:49:08 +00:00
Adrian Chadd
2d8fae9867 Do the invariant check before the mbuf is dereferenced. 2009-05-27 01:56:37 +00:00
Adrian Chadd
c099cafa14 Flesh out some inline documentation which hopefully reflect the intended
reality of these functions.
2009-05-27 01:54:26 +00:00
Adrian Chadd
0e6993e4a7 Add in some INVARIANT checks in the TX mbuf descriptor "freelist" management code.
Slot 0 must always remain "free" and be a pointer to the first free entry in the
mbuf descriptor list. It is thus an error to have code allocate or push slot 0
back into the list.
2009-05-27 01:45:23 +00:00
Adrian Chadd
3a5391225b The merge in r189699 reverted part of the work done in a previous commit
(r188036.)

Re-revert that change so the Xen networking functions again.
2009-05-18 04:56:37 +00:00
Doug Rabson
1267802438 Merge in support for Xen HVM on amd64 architecture. 2009-03-11 15:30:12 +00:00
Kip Macy
532700bd00 fix non-witness compile 2009-02-05 21:18:39 +00:00
Kip Macy
a392a2719c break out of loop if we run out of mbufs 2009-02-02 23:04:20 +00:00
Kip Macy
3a6d1fcf9c merge 186535, 186537, and 186538 from releng_7_xen
Log:
 - merge in latest xenbus from dfr's xenhvm
 - fix race condition in xs_read_reply by converting tsleep to mtx_sleep

Log:
 unmask evtchn in bind_{virq, ipi}_to_irq

Log:
 - remove code for handling case of not being able to sleep
 - eliminate tsleep - make sleeps atomic
2008-12-29 06:31:03 +00:00
Kip Macy
23dc562170 Integrate 185578 from dfr
Use newbus to managed devices
2008-12-04 07:59:05 +00:00
Doug Rabson
499062187b Don't call ether_ioctl() with locks held. Loop in xn_rxeof() until the backend
stops adding stuff to the ring otherwise we miss RX interrupts which kills
performance.
2008-11-30 12:21:46 +00:00
Kip Macy
920ba15bf9 Update xen/interface includes to the latest in mercurial
MFC after:	1 month
2008-09-26 05:29:39 +00:00
Kip Macy
646787d94f reflect header change in netfront
MFC after:	1 month
2008-09-25 07:02:00 +00:00
Kip Macy
83b92f6e47 For reasons that I have not delved in to Xen 3.2 netback now does header splitting
so packets > 128 bytes are now split in to multiple buffer. This fixes netfront
to handle multiple buffers per rx packet.

MFC after:	1 month
2008-08-21 02:40:26 +00:00
Kip Macy
6ae0e31bcc change netfront to match xen31_6
fix console locking
2008-08-20 09:47:49 +00:00
Kip Macy
980c717846 include vmparam.h for KERNBASE and fix typo 2008-08-20 09:11:58 +00:00
Kip Macy
7a5048f10c register netfront before xenbus does its probing
MFC after: 	1 month
2008-08-20 09:03:23 +00:00
Kip Macy
89e0f4d24c Import Xen paravirtual drivers.
MFC after:	2 weeks
2008-08-12 20:01:57 +00:00