Commit Graph

82 Commits

Author SHA1 Message Date
Robert Watson
13f4c340ae Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags.  Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags.  This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by:	pjd, bz
MFC after:	7 days
2005-08-09 10:20:02 +00:00
Robert Watson
13b203d0d7 Modify device drivers supporting multicast addresses to lock if_addr_mtx
over iteration of their multicast address lists when synchronizing the
hardware address filter with the network stack-maintained list.

Problem reported by:	Ed Maste (emaste at phaedrus dot sandvine dot ca>
MFC after:		1 week
2005-08-03 00:18:35 +00:00
Ruslan Ermilov
b34b221d77 Add missing ether_poll_deregister(). This is still not enough to
kldunload/kldload without a panic.  The same (but worse) problem
is also present in ixgb(4).
2005-08-02 08:44:45 +00:00
Xin LI
5b7ff138f0 Correct a minor typo.
Pointed out by:	Xuefeng DENG <dengxf at dengh com>
Approved by:	re (scottl)
2005-07-11 02:33:25 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Tony Ackerman
54fa8c991d Latest README to correspond to latest Intel version 2.1.7 2005-05-26 23:33:24 +00:00
Tony Ackerman
7e518cf0e8 Changes to update driver with latest Intel driver version 2.1.7
- Changed from using explicit devices id to using descriptive labels.
- Added support for 82573 and 82546 Quad adapters.
- Corrected support for 82547EI and 82541ER (mac_type was not assigned)
- Removed #ifdef DBG_STATS and extraneous code.

if_em_hw.c/if_em_hw.h
- Added support for 82573 and 82546 Quad adapters.
- Brought forward Intel's most current mac and phy changes.
2005-05-26 23:32:02 +00:00
Gleb Smirnoff
4369bfad31 Run em_local_timer() once per second instead of running it once per 2 seconds.
This makes gathering of error stats more precise, and netstat(1) output look
right.

Reviewed by:	tackerman
2005-04-05 07:06:47 +00:00
Warner Losh
538565c4a5 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:30:12 +00:00
Gleb Smirnoff
e5d73ca252 Call if_link_state_change() when link status changes.
PR:		kern/76890
Reviewed by:	rwatson, sam
2005-02-04 18:36:04 +00:00
Yaroslav Tykhiy
c96a57bbf5 Respect the current setting of IFCAP_VLAN_HWTAGGING on
the interface when going to toggle VLAN support for
internal reasons.  If the IFCAP_VLAN_HWTAGGING bit is
cleared, we should rely on the (re)init routine to turn
VLAN support off and never touch the relevant hardware bits.

This applies to other capability bits, too.  The user
obviously has a reason for clearing a capability bit,
e.g., if his particular NIC is buggy and hangs if a
certain hardware capability is turned on even for a
fraction of a second.

The flag adapter->em_insert_vlan_header still is set or
reset irrespective of the IFCAP_VLAN_HWTAGGING setting,
as before, in order to handle the case when a user sets
promiscuous mode on an interface first and later turns
its IFCAP_VLAN_HWTAGGING bit on.

This change might look orthogonal to rev#1.85, but in fact
it is not.  It introduces bugfixes that hopefully will make
implementing the general scheme mentioned in the commit
message of rev#1.85 easier.
2005-01-26 13:44:47 +00:00
Robert Watson
de13c80e9b Disable use of hardware VLAN tagging and stripping in if_em in the default
configuration: it appears to work properly in the non-promiscuous case, but
we've not yet implemented a more general solution that maintains full
functionality with promiscuous mode enabled.  While my hope is that we can
get one implemented soon, this will improve functionality substantially in
the mean time.

MFC after:	3 days
2005-01-26 11:40:58 +00:00
Scott Long
0ab6412830 Convert if_em to the new bus_dmamap_load_sg() interface. The old callback
was really just a waste of cycles, so this streamlines it considerably.
2005-01-15 20:52:15 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Tony Ackerman
b1ffdfc7c2 Corrected a workaround that should only be applied to one adapter. Workaround
was causing device hangs when incorrectly applied to other adapters.

PR:		kern/66634
2005-01-01 19:57:23 +00:00
Tony Ackerman
66fe651294 Added device id support for Intel 82541ER and 82546GB dual port PCIE adapter.
PR:		 None
2005-01-01 19:54:39 +00:00
Robert Watson
1eef0330d9 Further refine the if_em vlan fix in if_em.c:1.53:
- Because em_encap() can now fail in a way that leaves us without an
  mbuf chain, potentially set *m_headp to NULL if that happens, so that
  the caller can do the right thing.  This case can occur when we try
  to prepend the vlan header mbuf but can't allocate additional memory.

- Modify the caller of em_encap() to detect a NULL m_head and not try
  to queue the mbuf if that happens.

- When em_encap() fails, make sure to call bus_dmamap_destroy() to
  clean up.
2004-11-14 20:20:28 +00:00
Robert Watson
16142b2b03 Correct a bug in the if_em driver relating to the use of vlans with
promiscuous mode introduced in 1.45, which programs the em card not
to strip or prepend tags when in promiscuous mode without also
modifying behavior to manually prepend a vlan header in the event
that the card isn't doing it on transmit.  Due to a feature of card
operation, if the global VLAN prepend/strip register isn't set,
setting the VLAN tag flag on individual packet descriptors will
cause the packet to be transmitted using ISL encapsulation rather
than 802.1Q VLAN encapsulation.

This fix causes em_encap() to prepend the header by tracking whether
the card is configured to temporarily disable prepending/stripping
due to promiscuous mode.  As a result, entering promiscuous mode on
the parent em interface no longer causes vlans to appear to "wedge"
or transmit ISL-encapsulated frames, which typically will not be
configured/spoken by the other endpoints on the VLAN trunk.  This
bug may also exist in other drivers, and the additional vlan
encapsulation logic should be abstracted and centralized in
if_vlan.c if so.

RELENG_5_3 candidate.

MFC after:	1 week
Tested by:	pjd, rwatson
Reported by:	astesin at ukrtelecom dot net
Reported by:	Mike Tancsa <mike at sentex dot net>
Reported by:	Iasen Kostov <tbyte at OTEL dot net>
2004-11-12 11:03:07 +00:00
Dag-Erling Smørgrav
611f86ee5f Unbreak the build.
Pointy hat to:	bms
2004-11-11 19:00:51 +00:00
Bruce M Simpson
a1d77c4e01 Remove now-unused sysctl members. 2004-11-11 15:33:40 +00:00
Bruce M Simpson
97fa91743c Move per-instance sysctls under the per-device-instance tree.
Reviewed by:	mux
Prodded by:	rwatson
2004-11-11 15:31:38 +00:00
Poul-Henning Kamp
5b410dcf85 Put the "Link is up/down" printfs behind bootverbose. gigE is not so uncommon
that we need to tell people about every cable in the network anymore.  It can
be enabled for debugging purposes with "boot -v".
2004-11-03 14:11:18 +00:00
Maxime Henrion
2534c4f99c Add missing bus_dmamap_sync() calls. If you are using an architecture
with a weak memory model or x86 + PAE (or more specifically, your
driver is using bounce pages) and you have had problems with em(4),
this may fix it.  At least this is needed to have em(4) work properly
on FreeBSD/arm.

Original version by:	cognet
Reviewed by:		tackerman
Tested by:		cognet
2004-10-19 23:31:44 +00:00
Scott Long
25ba7fd287 Use an alignment of 1 instead of PAGE_SIZE for the rx and tx buffer tags.
Since the e1000 DMA engines hava no constraints on the alignment of buffer
transfers, there is no reason to tell busdma that there is.  This save a
minimum of 1 malloc call per packet, which translates to eliminating 4 locks.
It also means that buffers are not needlessly bounced when transfered.  The
end result is a 38% improvement in pps in a 4 way bridging environment.

Obtained from: Sandvine, Inc.
2004-10-19 02:39:27 +00:00
Scott Long
2f93f011ec Don't count RNBC (internal buffer full) towards the RX error count since it's
not really an error.

Submitted by: Gerrit Nagelhout
2004-10-09 07:27:03 +00:00
Max Laier
a8b4525f63 Fix typeo. Should read ***!***IFQ_DRV_IS_EMPTY.
This might fix some of the trouble around em(4) filling up its buffers.

Submitted by:	mtm
Pointy hat to:	mlaier
MFC after:	2 days
2004-09-29 18:28:28 +00:00
Olivier Houchard
2ae0fcd220 Do not use the IO-mapping to issue the reset on the 82546 on arm. For some
reason, it results in corrupted descriptors.
2004-09-23 22:57:53 +00:00
Prafulla Deuskar
9821d34f43 Added support for Intel PRO/1000 GT Desktop Adapter(Device ID 8086 107C)
Removed support for Intel 82541ER
Added fix for 82547 which corrects an issue with Jumbo frames larger than 10k.
Added fix for vlan tagged frames not being properly bridged.
Corrected TBI workaround.
Corrected incorrect LED operation issues

Submitted by:	tackerman (Tony Ackerman)
MFC after:	2 weeks
2004-09-01 23:22:41 +00:00
Max Laier
7929aa036c Bring in the first chunk of altq driver modifications. This covers the
following drivers: bfe(4), em(4), fxp(4), lnc(4), tun(4), de(4) rl(4),
sis(4) and xl(4)

More patches are pending on: http://peoples.freebsd.org/~mlaier/ Please take
a look and tell me if "your" driver is missing, so I can fix this.

Tested-by:	many
No-objection:	-current, -net
2004-07-02 12:16:02 +00:00
Yaroslav Tykhiy
3e4482412b Implement support for controlling VLAN_HWTAGGING through ioctl(SIOCSIFCAP).
This includes not only toggling the flag in if_capenable, but also really
reconfiguring the hardware.

Approved by:	tackerman (as the em(4) maintainer)
2004-06-04 16:57:18 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Maxime Henrion
866a788cc2 We don't need to initialize if_output, ether_ifattach() does it
for us.
2004-05-23 16:11:53 +00:00
Yaroslav Tykhiy
1df1a82541 Stylistic changes around the previous commit:
- since the number of supported capabilities is growing,
  set bits in if_cap* in a consistent way;

- unexpand(1) leading SPACE characters.
2004-05-20 11:04:09 +00:00
Yaroslav Tykhiy
388305aceb Set the VLAN bits in if_capenable as well as in if_capabilities
because VLAN hardware features are enabled in em(4) by default.

Note: Currently vlan(4) has a bug that it consults
if_capabilities, not if_capenable.  This will be fixed
after all the network drivers set VLAN bits in
if_capenable properly.
2004-05-20 10:57:33 +00:00
Ruslan Ermilov
6707138161 Implemented per-interface polling(4) control. 2004-04-11 21:01:12 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Prafulla Deuskar
b81490427d Only reset the phy when it is absolutely required.
This should fix the issues with long *init* times when
you do ifconfig em0 alias.

MFC after:	3 days
2004-02-10 21:31:09 +00:00
Daniel Eischen
f850af3016 Don't call em_stop() from the watchdog since it requires the controller
mutex to be locked.  It is redundant since em_init() is called and this
correctly locks the mutex and calls em_stop().

5.2 release candidate since this can cause a panic if the watchdog
expires.

Tested by:	kuriyama
2003-12-07 06:50:04 +00:00
Prafulla Deuskar
20109fa046 Use if_flags to check for IFF_POLLING instead of if_ipending.
Submitted by:	jroberson (Jeff Roberson)
Approved by:	re (scottl)
2003-12-02 22:13:08 +00:00
Prafulla Deuskar
3c2ef4e7e2 - Code cleanup
- In the receive routine handle the case where last descriptor could have
  less than 4 bytes of data.
- Handle race between detach/ioctl routine.

MFC after:	3 days
2003-11-14 18:02:25 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Daniel Eischen
0bea487cfa Add a wrapper for a function that takes and releases the adapter
lock around a call to the original function.  Make the timeout
function in callout_reset() use the wrapped function to avoid a
lock assertion panic.

Reviewed by:	sam
Reported by:	cgiordano@ids.net
2003-10-15 05:34:41 +00:00
Sam Leffler
7f59ff24d8 locking fixups:
o correct recursive locking when polling and in em_82547_move_tail
o destroy mutex on detach
o add EM_LOCK_ASSERT and similar macros for creating+deleteing the mtx

Submitted by:	Daniel Eischen <eischen@vigrid.com>
2003-10-10 23:14:21 +00:00
Sam Leffler
266f0707bb add locking
Reviewed by:	Prafulla Deuskar <pdeuskar@FreeBSD.ORG>
Sponsored by:	FreeBSD Foundation
2003-09-23 00:18:25 +00:00
Prafulla Deuskar
3a47a99d78 Add support for new devices.
Bug Fixes:
	- Allow users to use LAA
	- Remember promiscuous mode settings while bridging
	- Allow gratuitous arp's to be sent

PR:		52966/54488
MFC after:	1 week
2003-08-27 21:52:37 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
4fbd232c86 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 05:54:52 +00:00
John Polstra
515d4440fe Add facilities for tuning the "em" driver's interrupt delays without
recompiling the driver.  See the comments near the top of "if_em.h"
for descriptions of these delays.  Four new loader tunables control
the system-wide default values:

    hw.em.tx_int_delay
    hw.em.rx_int_delay
    hw.em.tx_abs_int_delay
    hw.em.rx_abs_int_delay

The tunables are specified in microseconds.  The valid range is
0-67108 usec., and 0 means that the timer is disabled.

There are also four new sysctls (actually, a set of four for each
"em" device in the system) to query and change the interrupt delays
after the system is up:

    hw.em0.tx_int_delay
    hw.em0.rx_int_delay
    hw.em0.tx_abs_int_delay (not present for 82542/3/4 adapters)
    hw.em0.rx_abs_int_delay (not present for 82542/3/4 adapters)

It seems to be OK to change these values even while the adapter is
passing traffic.

Approved by:	Prafulla Deuskar <pdeuskar@FreeBSD.ORG>
MFC after:	4 weeks
2003-08-01 17:33:59 +00:00
John Polstra
c7cc6a4d9f Correct comments to indicate that the EM_RADV and EM_TADV parameters
are not applicable to the 82544.
2003-07-17 19:02:34 +00:00
Maxime Henrion
dbe4792865 The em(4) driver has been converted to busdma and doesn't use
vtophys() anymore, so remove the alpha hack which defines
vtophys() to alpha_XXX_dmamap().
2003-07-04 10:15:16 +00:00