Commit Graph

216 Commits

Author SHA1 Message Date
Jack F Vogel
20e8415eb4 This delta has a few important items:
PR 122839 is fixed in both em and in igb

Second, the issue on building modules since the static kernel
build changes is now resolved. I was not able to get the fancier
directory hierarchy working, but this works, both em and igb
build as modules now.

Third, there is now support in em for two new NICs, Hartwell
(or 82574) is a low cost PCIE dual port adapter that has MSIX,
for this release it uses 3 vectors only, RX, TX, and LINK. In
the next release I will add a second TX and RX queue. Also, there
is support here for ICH10, the followon to ICH9. Both of these are
early releases, general availability will follow soon.

Fourth: On Hartwell and ICH10 we now have IEEE 1588 PTP support,
I have implemented this in a provisional way so that early adopters
may try and comment on the functionality. The IOCTL structure may
change. This feature is off by default, you need to edit the Makefile
and add the EM_TIMESYNC define to get the code.

Enjoy all!!
2008-04-25 21:19:41 +00:00
Jack F Vogel
e9d8b9c383 This update primarily addresses the ability to have both the em
and the igb driver static in the kernel. But it also reflects
some other bug fixes in my development stream at Intel.
PR 122373 is also fixed in this code.
2008-04-02 22:00:36 +00:00
Jack F Vogel
3773a7013f Need to add define of FAST interrupts as default 2008-02-29 22:38:12 +00:00
Jack F Vogel
f75ef9e44f This change introduces a split to the Intel E1000 driver, now rather than
just em, there is an igb driver (this follows behavior with our Linux drivers).
All adapters up to the 82575 are supported in em, and new client/desktop support
will continue to be in that adapter.

The igb driver is for new server NICs like the 82575 and its followons.
Advanced features for virtualization and performance will be in this driver.

Also, both drivers now have shared code that is up to the latest we have
released. Some stylistic changes as well.

Enjoy :)
2008-02-29 21:50:11 +00:00
Jack F Vogel
2635265800 Add COHERENT to descriptor mem allocation for the
benefit of ARM (request from Olivier Houchard), its
a noop on most architectures and goodness on those
that use it.
2007-11-28 23:04:11 +00:00
Jack F Vogel
fd4ae6dcff A minor issue with lock names, WITNESS complains
when the two locks are the same...
2007-11-28 19:14:06 +00:00
Jack F Vogel
abcc80c87a Fix for a reported panic in certain circumstances. When
calling em_stop() now make sure the TX lock is held as
well as CORE.
2007-11-26 19:47:03 +00:00
Ruslan Ermilov
c87e4fcd08 Take out em_poll() prototype from under EM_FAST_IRQ control.
Reported by:	tindebox compiling a LINT kernel
2007-11-21 12:55:33 +00:00
Jack F Vogel
559930e525 One nit, FAST handling is now in #ifdef's for compatibility
between RELEASES, but we want it on by default in 7 and later,
add that define, and take out a fragment left from a workaround
being removed.
2007-11-20 22:06:01 +00:00
Jack F Vogel
f6b1d9cab8 Driver version 6.7.3
- Bring HEAD up to the latest shared code
 - Fix TSO problem using limited MSS and forwarding
 - Dual lock implementation
 - New device support
 - For my ease, this code can compile in either 6.x or later
 - brings this driver in sync with the 6.3
2007-11-20 21:41:22 +00:00
Jack F Vogel
b979e69bf6 A number of small fixes:
- duplicate #define in header, thanks to Kevin Lo for pointing out.
	- incorrect BUSMASTER enable logic, thanks Patrick Oeschger
	- 82543 fails due to bogus IO BAR logic
	- Allow 82571 to use MSI interrupts
	- Checksum Offload for UDP not working on 82575

Approved by:re
2007-09-10 21:50:40 +00:00
Robert Watson
0bf686c125 Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which
previously conditionally acquired Giant based on debug.mpsafenet.  As that
has now been removed, they are no longer required.  Removing them
significantly simplifies error-handling in the socket layer, eliminated
quite a bit of unwinding of locking in error cases.

While here clean up the now unneeded opt_net.h, which previously was used
for the NET_WITH_GIANT kernel option.  Clean up some related gotos for
consistency.

Reviewed by:	bz, csjp
Tested by:	kris
Approved by:	re (kensmith)
2007-08-06 14:26:03 +00:00
Olivier Houchard
a9b444d065 Use coherent mapping for DMA on arm. This is propably suitable for the
other archs, but I can't test it so I made it conditionnal on __arm__
for now.

Approved by:	re (blanket)
2007-07-27 14:48:05 +00:00
Jack F Vogel
4f3349076d Couple of the fixes needed revising. The ICH8 autoneg was still broken,
this change both simplifies the code and plugs a hole where the devise
was reset without keeping the management controller at bay :) Second,
the 82571 LAA reset problem was incomplete, this addition is necessary.
Just one of those days :)
2007-05-31 23:36:21 +00:00
Jack F Vogel
46dc55b582 A few small but significant fixes:
- Coverity Prevent(tm) CID 1906 a bogus use of bzero where unneeded.
 - ICH8 systems autoneg to 100 rather than 1000, this can also be
   seen in 82573, the logic was backwards.
 - On new 82575 quadports half duplex tx speed is slow... this was due
   to overwriting TCTL reg rather than adding bits.
2007-05-30 23:32:21 +00:00
Jack F Vogel
8a4787401a Fix for PR 112937, thanks to Ruslan Ermilov. I am still
a bit confused how the 'link flap' was connected to the
'get' rather than 'set' address, but this seems the right
thing to do here.
2007-05-24 18:11:11 +00:00
Jack F Vogel
ca2a8b584f Two minor fixes, keep old 82542 from using jumbo frames, and add
missing htole64 in encap code.

Reviewed by:Pdeuskar
Approved by:Pdeuskar
2007-05-23 20:41:20 +00:00
Jack F Vogel
481dd885f8 Couple of changes, back down on last TSO change, instead make old
adapter list still capable, but only PCI-E adapters are now enabled.
The user can enable older PCI-X or PCI adapters using ifconfig.
Secondly, Arthur Hartwig pointed out my MSI change was not working
correctly, changed to something that now does. Thanks Arthur.
There was also a fundamental bug in the 82575 MSIX code, the MSIX
registers had to be mapped, opps :)

Rubber-stamped by: Pdeuskar
2007-05-17 00:14:03 +00:00
Jack F Vogel
0ac5a4cc2b This delta adds two bug fixes: one that makes HW Offload logic in
legacy codepath match the 82575, without this we were seeing bridging
fail on 82546 adapters. Secondly, I have limited TSO to PCI Express
adapters, I meant to do this and it got dropped in the earlier delta.
Next, I am dropping in the latest shared code from our development
team, consensus was that this should be done frequently, so I am :)

Approved by: pdeuskar
2007-05-16 00:14:23 +00:00
Jack F Vogel
4e341d7ed1 Mistake in the logic deciding what adapters need
to map the IO BAR. Causing the driver to fail on
th 82542.

Reviewed by:pdeuskar
Approved by:pdeuskar
2007-05-11 21:36:08 +00:00
Jack F Vogel
9d483ba8a9 A couple bug fixes that I've had internally at Intel. First is a long
time workaround for problems with 82571 adapters and LAAs, one port
getting reset can cause the other to have its RAR[0] also reset,
thus overwriting an LAA. This fix works around it by also keeping
the address in the last array member.

The other bug is specific to the new 575 adapter, its transmit code
logic in handling hwassists was too crude, it broken when doing
bridges. I am much happier with the new logic,we may want to change
the legacy path at some point to something similar.

Reviewed by:	pdeuskar
Approved by:	pdeuskar
2007-05-09 00:41:45 +00:00
Robert Watson
c018682fbf $FreeBSD$ tags are not compilable C code; wrap in either __FBSDID() or
in comments for .c and .h files respectively.  Jack may want to clean up
style or other aspects once he's up and about again, but this gets the
kernel compiling.
2007-05-04 13:30:44 +00:00
Jack F Vogel
89290aa383 Merge in the new driver (6.5.0) of Intel. This has a new
shared code infrastructure that is family specific and
modular. There is also support for our latest gigabit
nic, the 82575 that is MSI/X and multiqueue capable.

The new shared code changes some interfaces to the core
code but testing at Intel has been going on for months,
it is fairly stable.

I have attempted to be careful in retaining any fixes that
CURRENT had and we did not, I apologize in advance if any
thing gets clobbered, I'm sure I'll hear about it :)

Approved by pdeuskar
2007-05-04 00:00:12 +00:00
Ruslan Ermilov
9620e9dd97 Revert previous change and take back a pointy hat. 2007-02-28 09:04:46 +00:00
Ruslan Ermilov
7b6b0e6d24 Fix panic on boot caused by setting up a NULL interrupt handler.
Submitted by:	Goran Gajic
Pointy hat to:	piso
2007-02-28 05:29:23 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Kip Macy
3d229d50ab remove no longer correct comment above em_read_pcie_cap_reg 2006-11-23 05:48:13 +00:00
Kip Macy
21e3069792 Move magic PCIe workaround constant to header - add appropriate comment
Suggested by: jfvogel
2006-11-23 05:43:39 +00:00
Kip Macy
af088c45e8 Fix TSO support on sun4v
- incorporate csjp's fix for a mishandled endian conversion
- convert PAGE_SIZE to 4096 for PCIe adapter workaround (my page size is not 4k)
- implement em_read_pcie_cap_reg where we set the max read size on pcie to 4k (taken from mxge)

Reviewed by: scottl and jfvogel
2006-11-23 00:52:52 +00:00
Christian S.J. Peron
90d4d36094 Implement new ETHER_BPF_MTAP macro. Roll back the various changes
made to accommodate the chip being in promiscuous mode while
offloading VLAN tag processing to the hardware.  We can now
properly handle the absence of VLAN tags from hardware stripping.

Reviewed by:	rwatson, andre
MFC after:	1 month
2006-11-18 23:18:43 +00:00
John Baldwin
280388afe5 Add MSI support to em(4), bce(4), and mpt(4). For now, we only support
devices that support a maximum of 1 message, and we use that 1 message
instead of the INTx rid 0 IRQ with the same interrupt handler, etc.
2006-11-15 20:04:57 +00:00
Gleb Smirnoff
c1a9c63621 Instead of using the legacy if_timer/if_watchdog interface create
our own watchdog that piggybacks on the em_local_timer() routine.

We suppose that the if_timer/if_watchdog interface should be
obsoleted, since it doesn't fit the modern SMP network stack.
NIC drivers should create their own watchdogs, that check and
clear the timers always holding driver's lock.

In collaboration with:	jfv, scottl
2006-11-09 16:00:18 +00:00
John Baldwin
186d340f75 Fix compile botch in the last panic botch fix. :(
Pointy hat:	jhb
Reported by:	brueffer
2006-11-01 18:24:12 +00:00
John Baldwin
8d7b3b9566 Fix botch in last commit (I tested on 6.x which doesn't have TSO):
- Test the mac_type rather than if_hwassist (since ifp doesn't exist yet)
  to determine if the adapter supports TSO and thus to change the sizes
  for the bus_dma tag.

Reviewed by:	glebius
2006-11-01 15:36:47 +00:00
John Baldwin
77cae244f8 Allocate receive and transmit data structures during attach() and free them
during detach() similar to other NIC drivers rather than allocating them
during init() and freeing them during stop():
- Move creation of tx bus_dma tag amd maps and tx_buffer_area from
  em_setup_transmit_structures() to em_allocate_transmit_structures().
- Call em_allocate_xxx_structures() in em_attach().
- Only call em_free_xxx_structures() in em_detach().
- Change em_setup_xxx_structures() to free any existing tx or rx buffers
  and in the case of rx repopulate the ring with newer buffers.

Reviewed by:	jfv
2006-10-31 17:21:14 +00:00
John Baldwin
7b2d1aabb1 - Use callout_init_mtx() to close various callout-related races.
- Drain the two timers in detach.
- Check IFF_DRV_RUNNING in the link task and bail w/o doing anything if
  it is clear.

Reviewed by:	jfv, scottl
2006-10-31 17:05:02 +00:00
Gleb Smirnoff
72f0301fef Rework the transmit register handling. In em_encap() store index of
the EOP descriptor in the first descriptor of the packet. And then
in em_txeof() search for DD bits set only in the EOP descriptors,
embedding the cleanup of all packet's descriptors into inner loop.

This change is important for future chips, where DD bit is going
to be set only on the EOP descriptors.

Submitted by:	jfv
2006-10-31 16:19:21 +00:00
Gleb Smirnoff
7c007dd329 Merge new vendor release - 6.2.9.
Details:
o if_em.c changes:
  - Added several new PCI ids.
  - Check em_check_phy_reset_block() before doing SIOCSIFMEDIA ioctl.
  - Don't touch TARC registers, they are now handled in shared
    code in if_em_hw.c.
  - Move RDH and RDT setting to the end of
    em_initialize_receive_unit().
  - Declare em_read_pcie_cap_reg(), now empty.
o if_em_hw.c dropped in from vendor, then restored rev. 1.15.
o if_em_hw.h dropped in from vendor, then modified:
  - Added RX overrun interrupt flag to interrupt enable mask.
  - Remove declarations of em_io_read(), em_io_write().

Approved by:	jfv
2006-10-31 15:00:14 +00:00
Jack F Vogel
9251ddbfe7 Backout bogus checkin to HEAD
Approved by: scottl
2006-10-28 08:11:07 +00:00
Jack F Vogel
52f92a311c This is the merge of the Intel 6.2.9 driver. It provides all new shared code,
new device support, and it is hoped a more stable driver for 6.2. RELEASE.
This checkin was discussed and approved today by RE, scottl, jhb, and pdeuskar
2006-10-28 00:47:55 +00:00
Andre Oppermann
1038b3fbdc Back out rev. 1.152 as it was breaking vlan tag insertion when vlan tag
stripping was disabled due to being in promisc mode.  This is a hardware
bug.  Update comment to explicitly state the reason the manual vlan tag
insertion in this case.  See rev. 1.53 for further information as well.

Noticed by:	jhb
2006-09-29 21:38:12 +00:00
Andre Oppermann
bb2690b330 Small style and comment adjustments.
Reviewed by:	jfv
2006-09-29 13:54:04 +00:00
Andre Oppermann
7a6e967aa0 Remove manual vlan header insertion in em_encap(). It is unnecessary as the
generic vlan_start() takes care of it when vlan hardware insertion is disabled.

In em_set_promisc() add a note that BPF may also be enabled without going into
promisc mode.

Reviewed by:	jfv
2006-09-29 13:47:38 +00:00
Andre Oppermann
299b40dcd5 Change em_transmit_checksum_setup() to deal with already inserted vlan headers,
IP options and add skeleton IPv6 support.  The new code structure can also be
easily enhanced to support new/more protocols (SCTP) in the future.

Reviewed by:	jfv
2006-09-29 13:37:26 +00:00
Andre Oppermann
404138281a Change em_tso_setup() to deal with already inserted vlan headers, IP options
and add skeleton IPv6 support.  The new code structure can also be easily
enhanced to support new/more protocols (SCTP) and IP fragmentation in the
future.

In em_encap() only try to do TSO if 'dotso' is true.

Reviewed by:	jfv
2006-09-29 13:33:30 +00:00
Andre Oppermann
6c9d400d37 Only advertize IFCAP_TSO4 capabilities. IPv6 is not yet supported.
Reviewed by:	jfv
2006-09-29 13:17:16 +00:00
Andre Oppermann
5c335b1cc8 Handle all error cases from bus_dmamap_load_mbuf_sg(). Those are:
- EFBIG means the mbuf chain was too long and bus_dma ran out of segments.
   Defragment the mbuf chain and try again. (Already existed, not changed.)
 - ENOMEM means bus_dma could not obtain enough bounce buffers at this point
   in time.  Defer sending and try again later.
 - All other errors, in particular EINVAL, are fatal and prevent the mbuf
   chain from ever going through.  Drop it and report error.
 - Checking (nsegs == 0) is unnecessary as bus_dmamap_load_mbuf_sg() always
   reports an error if it is < 1.

This prevents broken packets from clogging the interface queue indefinately.

Discussed with:	scottl
Reviewed by:	jfv
2006-09-29 13:12:38 +00:00
Andre Oppermann
ba04adb0f9 Move the initialization of the hardware capabilities in em_init_locked()
before em_setup_transmit_structures() as it needs this information to
properly set up TSO parameters.

Reviewed by:	jfv
2006-09-21 19:14:51 +00:00
Andre Oppermann
9fd7a4e705 Don't forget to add curly braces when doing more than one line of actions
after a 'if' statement.

Pointy hat to:	andre
2006-09-18 23:44:12 +00:00
Andre Oppermann
78ba57b9e1 Move ethernet VLAN tags from mtags to its own mbuf packet header field
m_pkthdr.ether_vlan.  The presence of the M_VLANTAG flag on the mbuf
signifies the presence and validity of its content.

Drivers that support hardware VLAN tag stripping fill in the received
VLAN tag (containing both vlan and priority information) into the
ether_vtag mbuf packet header field:

	m->m_pkthdr.ether_vtag = vlan_id;	/* ntohs()? */
	m->m_flags |= M_VLANTAG;

to mark the packet m with the specified VLAN tag.

On output the driver should check the mbuf for the M_VLANTAG flag to
see if a VLAN tag is present and valid:

	if (m->m_flags & M_VLANTAG) {
		... = m->m_pkthdr.ether_vtag;	/* htons()? */
		... pass tag to hardware ...
	}

VLAN tags are stored in host byte order.  Byte swapping may be necessary.

(Note: This driver conversion was mechanic and did not add or remove any
byte swapping in the drivers.)

Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition.  No more tag
memory allocation have to be done.

Reviewed by:	thompsa, yar
Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-09-17 13:33:30 +00:00