Commit Graph

226 Commits

Author SHA1 Message Date
George V. Neville-Neil
7529967798 Partial reversion of previous commit. The CXGB_SHUTDOWN flag does NOT
need to be inverted when doing an ifconfig down of an interface.

Pointed out by:	Navdeep Parhar
MFC after: 1 week
2009-05-22 18:26:47 +00:00
George V. Neville-Neil
c2009a4c90 Fix a possible panic cxgb_controller_attach() routine that would occur
only if prepping the adapter failed.

Slight adjustment to comments.

Fix a bug whereby downing the interface didn't preven it from
processing packets.

Submitted by:	Navdeep Parhar
MFC after:	1 week
2009-05-22 15:06:03 +00:00
George V. Neville-Neil
0bbdea7776 Integrate three changes from Chelsio.
1) Add a sysctl that will say what type of PHYs exist on the card.
2) Fix a bug that occurs when an AEL 2005 PHY resets without a transciever
in the card.
3) Unify the PHY link detection code.

Obtained from:	Navdeep Parhar
MFC after:	10 days
2009-05-21 15:08:03 +00:00
George V. Neville-Neil
3cf138bb79 Modified the attach and detach routines to handle bringing ports up
and down more cleanly.  This addresses a problem where if we have the
link flap during boot the driver would lock up the system.

Reviewed by:	jhb
MFC after:	1 week
2009-05-21 14:43:12 +00:00
Warner Losh
00b4e54ae7 We no longer need to use d_thread_t, migrate to struct thread *. 2009-05-20 17:29:21 +00:00
Kip Macy
24df53962e fix bug introduced by last change
Submitted by:	Navdeep Parhar
2009-05-12 03:30:25 +00:00
Marko Zec
21ca7b57bd Change the curvnet variable from a global const struct vnet *,
previously always pointing to the default vnet context, to a
dynamically changing thread-local one.  The currvnet context
should be set on entry to networking code via CURVNET_SET() macros,
and reverted to previous state via CURVNET_RESTORE().  Recursions
on curvnet are permitted, though strongly discuouraged.

This change should have no functional impact on nooptions VIMAGE
kernel builds, where CURVNET_* macros expand to whitespace.

The curthread->td_vnet (aka curvnet) variable's purpose is to be an
indicator of the vnet context in which the current network-related
operation takes place, in case we cannot deduce the current vnet
context from any other source, such as by looking at mbuf's
m->m_pkthdr.rcvif->if_vnet, sockets's so->so_vnet etc.  Moreover, so
far curvnet has turned out to be an invaluable consistency checking
aid: it helps to catch cases when sockets, ifnets or any other
vnet-aware structures may have leaked from one vnet to another.

The exact placement of the CURVNET_SET() / CURVNET_RESTORE() macros
was a result of an empirical iterative process, whith an aim to
reduce recursions on CURVNET_SET() to a minimum, while still reducing
the scope of CURVNET_SET() to networking only operations - the
alternative would be calling CURVNET_SET() on each system call entry.
In general, curvnet has to be set in three typicall cases: when
processing socket-related requests from userspace or from within the
kernel; when processing inbound traffic flowing from device drivers
to upper layers of the networking stack, and when executing
timer-driven networking functions.

This change also introduces a DDB subcommand to show the list of all
vnet instances.

Approved by:	julian (mentor)
2009-05-05 10:56:12 +00:00
Kip Macy
bf541f371e simplify by removing dead code 2009-04-27 22:54:30 +00:00
Robert Watson
78b5071407 Update stats in struct tcpstat using two new macros, TCPSTAT_ADD() and
TCPSTAT_INC(), rather than directly manipulating the fields across the
kernel.  This will make it easier to change the implementation of
these statistics, such as using per-CPU versions of the data structures.

MFC after:	3 days
2009-04-11 22:07:19 +00:00
Kip Macy
80cb9f211a Import "flowid" support for serializing flows across transmit queues
Reviewed by:	rwatson and jeli
2009-04-10 06:16:14 +00:00
George V. Neville-Neil
0c1ff9c605 Minor updates to the Chelsio driver, including removing an LOR.
Submitted by:	Navdeep Parhar at Chelsio
Reviewed by:	gnn
MFC after: 	3 weeks
2009-03-23 19:58:26 +00:00
George V. Neville-Neil
6b6e256ae1 Fix a bug in the recent update to the Chelsio driver.
The tick routine was not being restarted in the init_locked routine
which could resulted in loss of carrier when updating the MTU.

Submitted by:	Navdeep Parhar at Chelsio
MFC after:	3 weeks
2009-03-21 17:09:00 +00:00
Robert Watson
a6c19108c5 Prefer ENETDOWN to ENXIO when returning queuing errors due to a link
down, interface down, etc, with if_cxgb's if_transmit routine.

MFC after:	3 days
Reviewed by:	kmacy
2009-03-10 22:35:45 +00:00
George V. Neville-Neil
f2d8ff04fe Update the Chelsio driver to the latest bits from Chelsio
Firmware upgraded to 7.1.0 (from 5.0.0).
T3C EEPROM and SRAM added; Code to update eeprom/sram fixed.
fl_empty and rx_fifo_ovfl counters can be observed via sysctl.
Two new cxgbtool commands to get uP logic analyzer info and uP IOQs
Synced up with Chelsio's "common code" (as of 03/03/09)

Submitted by:	 Navdeep Parhar at Chelsio
Reviewed by:	gnn
MFC after:	2 weeks
2009-03-10 19:22:45 +00:00
Bjoern A. Zeeb
33553d6e99 For all files including net/vnet.h directly include opt_route.h and
net/route.h.

Remove the hidden include of opt_route.h and net/route.h from net/vnet.h.

We need to make sure that both opt_route.h and net/route.h are included
before net/vnet.h because of the way MRT figures out the number of FIBs
from the kernel option. If we do not, we end up with the default number
of 1 when including net/vnet.h and array sizes are wrong.

This does not change the list of files which depend on opt_route.h
but we can identify them now more easily.
2009-02-27 14:12:05 +00:00
George V. Neville-Neil
837f41b067 Check in the actual module recognition code for the Chelsio
driver.

Obtained from:	Chelsio Inc.
2008-12-18 14:21:35 +00:00
Bjoern A. Zeeb
dcdb4371ca Use inc_flags instead of the inc_isipv6 alias which so far
had been the only flag with random usage patterns.
Switch inc_flags to be used as a real bit field by using
INC_ISIPV6 with bitops to check for the 'isipv6' condition.

While here fix a place or two where in case of v4 inc_flags
were not properly initialized before.[1]

Found by:	rwatson during review [1]
Discussed with:	rwatson
Reviewed by:	rwatson
MFC after:	4 weeks
2008-12-17 12:52:34 +00:00
Qing Li
6e6b3f7cbc This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
   possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,

The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.

Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:

- Kip Macy revised the locking code completely, thus completing
  the last piece of the puzzle, Kip has also been conducting
  active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
  provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
  me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
George V. Neville-Neil
7f15419bb7 Bug fix to support N310 version of Chelsio cards (board ID 1088).
Obtained from:	Chelsio Inc.
MFC after:	3 days
2008-12-06 02:10:53 +00:00
George V. Neville-Neil
5197f3abd7 Re submit code to print the part and serial number for Chelsio cards.
The original code was accidentally removed in another commit.

MFC after: 1 day
2008-12-05 21:40:11 +00:00
George V. Neville-Neil
9036240993 Fix a bug with the ael1006 PHY. The bug shows up as persistent but incomplete
packet loss, of between 10-30%. The fix is to put the PHY into
and take it out of local loopback mode when resetting the interface.

Obtained from:	Chelsio Inc.
MFC after:	3 days
2008-12-04 20:32:53 +00:00
Bjoern A. Zeeb
4b79449e2f Rather than using hidden includes (with cicular dependencies),
directly include only the header files needed. This reduces the
unneeded spamming of various headers into lots of files.

For now, this leaves us with very few modules including vnet.h
and thus needing to depend on opt_route.h.

Reviewed by:	brooks, gnn, des, zec, imp
Sponsored by:	The FreeBSD Foundation
2008-12-02 21:37:28 +00:00
George V. Neville-Neil
c9c0c99f30 Bug fix from Chelsio which addresses the issue of the device resetting
when it sees only received packets.  In some cases where a device only
recieves data it mistakenly thinks that its transmitting side is broken
and resets the device.

Obtained from:	Chelsio Inc.
MFC after:	3 days
2008-12-02 15:42:47 +00:00
Kip Macy
f3c713fdaf - fix bug where dnsperf would stop transmitting after a few seconds
- break complex conditionals in to multiple lines to avoid wrapping
- remove copious unused debug statements
- be more aggressive about cleaning in the calling thread
- eliminate usage of ENOSPC
- increase number of iterations that cxgbsp can do
- eliminate "initerr" usage to simplify ENOBUFS handling
- when coalescing pass all packets to BPF
- always set overrun if hardware queue is full
2008-12-02 07:01:18 +00:00
Kip Macy
e44730ed21 The pkthdr field is flowid not rss_hash 2008-12-02 00:51:56 +00:00
Kip Macy
6b9003b6e6 - fix multiqueue conditional
- don't leak mbuf tags in the non-conditional case

Found by: Navdeep Parhar
2008-12-02 00:48:08 +00:00
Kip Macy
6b58e3f4db integrate use after free fixes from private branch
Found by: kkenn@
2008-12-02 00:39:50 +00:00
Kip Macy
69c4b66c6d null out m_next when marshalling a packet 2008-12-01 05:44:08 +00:00
Kip Macy
f35c2d6551 Update internal mac stats every time the tick task is called
if we don't do this "netstat -w 1" will frequently see negative
differences in packets sent
2008-12-01 05:43:30 +00:00
Kip Macy
45839f4aeb don't manually track statistics 2008-12-01 04:42:39 +00:00
Kip Macy
ceac50eb77 Proper fix for tracking ifnet statistics 2008-12-01 04:41:45 +00:00
Kip Macy
5eba27fe0c Add backward compatibility ifdefs for non-multiq kernels 2008-11-23 07:30:07 +00:00
Kip Macy
5d96be4eb8 work around periodic leak on queue overrun by enabling coalescing of packets in to
work requests by default
2008-11-23 00:22:52 +00:00
Kip Macy
098fb9b469 intr_machdep.h breaks build on some arches and is not needed 2008-11-23 00:13:25 +00:00
Kip Macy
a02573bc06 - enable multiple transmit queues
- invert sense of hw.cxgb.singleq tunable to hw.cxgb.multiq
- don't wake up transmitting thread by default
- add per tx queue ifaltq to handle ALTQ
- remove several unused functions in cxgb_multiq.c
- add several sysctls: multiq_tx_enable, coalesce_tx_enable,
  and wakeup_tx_thread
- this obsoletes the hw.cxgb.snd_queue_len as ifq is replaced
  by a buf_ring
2008-11-22 08:05:05 +00:00
Kip Macy
db7f0b974f - bump __FreeBSD version to reflect added buf_ring, memory barriers,
and ifnet functions

- add memory barriers to <machine/atomic.h>
- update drivers to only conditionally define their own

- add lockless producer / consumer ring buffer
- remove ring buffer implementation from cxgb and update its callers

- add if_transmit(struct ifnet *ifp, struct mbuf *m) to ifnet to
  allow drivers to efficiently manage multiple hardware queues
  (i.e. not serialize all packets through one ifq)
- expose if_qflush to allow drivers to flush any driver managed queues

This work was supported by Bitgravity Inc. and Chelsio Inc.
2008-11-22 05:55:56 +00:00
George V. Neville-Neil
2a1b9f07fc Several small additions to the Chelsio 10G driver.
1) Fix a bug in dealing with the Alerus 1006 PHY which prevented the
device from ever coming back up once it had been set to down.

2) Add a kernel tunable (hw.cxgb.snd_queue_len) which makes it possible
to give the device more than IFQ_MAXLEN entries in its send queue.  The
default remains 50.

3) Add code to place the card'd identification and serial number into
its description (%desc) so that users can tell which card they have
installed.
2008-11-21 19:22:25 +00:00
Marko Zec
44e33a0758 Change the initialization methodology for global variables scheduled
for virtualization.

Instead of initializing the affected global variables at instatiation,
assign initial values to them in initializer functions.  As a rule,
initialization at instatiation for such variables should never be
introduced again from now on.  Furthermore, enclose all instantiations
of such global variables in #ifdef VIMAGE_GLOBALS blocks.

Essentialy, this change should have zero functional impact.  In the next
phase of merging network stack virtualization infrastructure from
p4/vimage branch, the new initialization methology will allow us to
switch between using global variables and their counterparts residing in
virtualization containers with minimum code churn, and in the long run
allow us to intialize multiple instances of such container structures.

Discussed at:	devsummit Strassburg
Reviewed by:	bz, julian
Approved by:	julian (mentor)
Obtained from:	//depot/projects/vimage-commit2/...
X-MFC after:	never
Sponsored by:	NLnet Foundation, The FreeBSD Foundation
2008-11-19 09:39:34 +00:00
Kip Macy
d1340303b9 Update firmware version check
make ddp a tunable

Obtained from:	Chelsio Inc.
MFC after:	3 days
2008-11-12 04:45:09 +00:00
Bjoern A. Zeeb
ca6bc428e7 For now our LRO code (tcp_lro.c) only supports IPv4 properly thus
only enable if INET is on.

Reviewed by:	kmacy
MFC after:	2 months
2008-11-06 10:35:46 +00:00
Bjoern A. Zeeb
34627f9384 Hide AF_INET specific ioctl handling under #ifdef INET.
Reviewed by:	kmacy
MFC after:	2 months
2008-11-06 10:17:57 +00:00
Kip Macy
9762ac4204 Track number of packets transmitted and number of packets received
PR:	125806
MFC after:	3 days
2008-10-17 07:04:29 +00:00
Kip Macy
5ec372d1fa Fix bug in LRO on T304 whereby a packet could be sent to the wrong interface's ifp.
Submitted by:	Chelsio Inc.
MFC after:	1 day
2008-10-03 00:50:26 +00:00
Marko Zec
8b615593fc Step 1.5 of importing the network stack virtualization infrastructure
from the vimage project, as per plan established at devsummit 08/08:
http://wiki.freebsd.org/Image/Notes200808DevSummit

Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator
macros, and CURVNET_SET() context setting macros, all currently
resolving to NOPs.

Prepare for virtualization of selected SYSCTL objects by introducing a
family of SYSCTL_V_*() macros, currently resolving to their global
counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT().

Move selected #defines from sys/sys/vimage.h to newly introduced header
files specific to virtualized subsystems (sys/net/vnet.h,
sys/netinet/vinet.h etc.).

All the changes are verified to have zero functional impact at this
point in time by doing MD5 comparision between pre- and post-change
object files(*).

(*) netipsec/keysock.c did not validate depending on compile time options.

Implemented by:	julian, bz, brooks, zec
Reviewed by:	julian, bz, brooks, kris, rwatson, ...
Approved by:	julian (mentor)
Obtained from:	//depot/projects/vimage-commit2/...
X-MFC after:	never
Sponsored by:	NLnet Foundation, The FreeBSD Foundation
2008-10-02 15:37:58 +00:00
Kip Macy
1cfe52493f update callers of vm_fault_hold_user_pages
MFC after:	1 week
2008-09-30 23:45:22 +00:00
Kip Macy
7585919a7f Refactor vm_fault_hold_user_pages:
- simplify page hold logic
- allow pages for processes other than that of curthread to
  have pages held
- normalize the interface to more closely resemble the functions in
  sys/vm

MFC after:	1 week
2008-09-30 23:44:44 +00:00
Kip Macy
41509ecd3a Make sure that optical PHYs work ...
Submitted by:	Chelsio Inc.
MFC after:	1 day
2008-09-30 21:21:52 +00:00
Kip Macy
e2b2d0e9d5 vm_fault_hold_user_pages will not return if an address in the range passed in is mapped RO
but an RW mapping exists for the underlying page. This change fixes the bug by using the
page / NULL returned from pmap_extract_and_hold to determine whether or not vm_fault needs
to be called.

The bug was pointed out by alc.

MFC after:	3 days
2008-09-29 22:13:29 +00:00
Kip Macy
82c2cf3b05 fix insta-panic:
- determine which ext_arg offsets to use based on the version number

Submitted by:	Chelsio Inc.
MFC after:	1 day
2008-09-25 06:46:28 +00:00
Kip Macy
a7db7fbd35 - Remove default NIC dependency on ulp headers
- make toe module build dependent on kernel support

Submitted by:	Chelsio Inc.
MFC after:	1 week
2008-09-24 01:19:08 +00:00