History log of /freebsd-current/sys/dev/nfe/if_nfe.c
Revision Date Author Comments
# 2a371643 21-Jul-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Retire if_etherbpfmtap() and if_bpfmtap()

Summary:
These came in the original DrvAPI commits in 2014, and are obsoleted by
bpf_mtap_if() and ether_bpf_mtap_if(). The `_if` suffix, rather than
prefix, conveys that it's operating on the bpf of the interface, instead
than the interface itself.

Reviewed by: glebius
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41146


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 108252d8 06-May-2022 John Baldwin <jhb@FreeBSD.org>

nfe: Remove unused devclass argument to DRIVER_MODULE.


# 3e38757d 19-Apr-2022 John Baldwin <jhb@FreeBSD.org>

Remove unused miibus_devclass and miibus_fdt_devclass.


# bc02034c 10-Dec-2021 Mateusz Guzik <mjg@FreeBSD.org>

nfe: plug set-but-not-unused vars

Sponsored by: Rubicon Communications, LLC ("Netgate")


# 4dd5edf3 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

nfe: clean up empty lines in .c and .h files


# 7029da5c 26-Feb-2020 Pawel Biernacki <kaktus@FreeBSD.org>

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718


# 6c3e93cb 11-Feb-2020 Gleb Smirnoff <glebius@FreeBSD.org>

Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process
incoming packets in taskqueue context.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23518


# 2db0e8ff 21-Oct-2019 Gleb Smirnoff <glebius@FreeBSD.org>

Convert to if_foreach_llmaddr() KPI.


# 8b2de3f0 14-Dec-2018 Mark Johnston <markj@FreeBSD.org>

Add support for the nForce MCP89 adapter.

PR: 234015
Submitted by: Andrejs Bogdanovs <sinchiroca86@gmail.com>
MFC after: 1 week


# 73a1170a 19-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: use our nitems() macro when it is avaliable through param.h.

No functional change, only trivial cases are done in this sweep,
Drivers that can get further enhancements will be done independently.

Discussed in: freebsd-current


# 74b8d63d 10-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

Cleanup unnecessary semicolons from the kernel.

Found with devel/coccinelle.


# cbc4d2db 01-Mar-2016 John Baldwin <jhb@FreeBSD.org>

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


# 2be111bf 16-Oct-2014 Davide Italiano <davide@FreeBSD.org>

Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by: kmacy
Tested by: make universe


# 6ad1954b 13-Oct-2014 Robert Watson <rwatson@FreeBSD.org>

Eliminate unnecessary checking for M_EXT on mbufs returned by m_getjcl().

Reviewed by: bz, glebius, yongari
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D938


# bd071d4d 28-Sep-2014 Gleb Smirnoff <glebius@FreeBSD.org>

- Remove empty wrappers ether_poll_[de]register_drv(). [1]
- Move polling(9) declarations out of ifq.h back to if_var.h
they are absolutely unrelated to queues.

Submitted by: Mikhail <mp lenta.ru> [1]


# df360178 18-Sep-2014 Gleb Smirnoff <glebius@FreeBSD.org>

- Use if_inc_counter() to increment various counters.
- Do not ever set a counter to a value. For those counters
that we don't increment, but return directly from hardware
create cases in if_get_counter() method.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 09a8241f 30-Aug-2014 Gleb Smirnoff <glebius@FreeBSD.org>

It is actually possible to have if_t a typedef to non-void type,
and keep both converted to drvapi and non-converted drivers
compilable.

o Make if_t typedef to struct ifnet *.
o Remove shim functions.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 2ea1fcce 03-Aug-2014 Marcel Moolenaar <marcel@FreeBSD.org>

Fix multicast, broken by the conversion of the nfe(4) driver to the
driver API.

Submitted by: Mikhail <mp@lenta.ru>


# 59578ee0 02-Jul-2014 Sergey Kandaurov <pluknet@FreeBSD.org>

Fixed build with DEVICE_POLLING.


# c2df7334 01-Jul-2014 Marcel Moolenaar <marcel@FreeBSD.org>

Convert nfe(4) to use the driver API.

Submitted by: Mikhail <mp@lenta.ru>


# a2677ff2 17-Jun-2014 John Baldwin <jhb@FreeBSD.org>

Don't bother clearing maps for static DMA allocations to NULL. Instead,
leave them as purely opaque values that are only set by bus_dmamem_alloc().


# 73aa8b9a 16-May-2014 Christian Brueffer <brueffer@FreeBSD.org>

Remove some unused variables.

Found with: Clang Static Analyzer
MFC after: 2 weeks


# a173db2d 08-Apr-2014 Pyun YongHyeon <yongari@FreeBSD.org>

Add workaround for MCP61 Ethernet controller found on MSI K9
motherboard. PHY hardware used for the controller responded at
all possible addresses which in turn resulted in having 32 PHYs
for the controller. If driver detects "MSI K9N6PGM2-V2 (MS-7309)"
motherboard, tell miibus(4) PHY is located at 0.

Tested by: Chris H


# 76039bc8 26-Oct-2013 Gleb Smirnoff <glebius@FreeBSD.org>

The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 2067877e 03-Oct-2013 Pyun YongHyeon <yongari@FreeBSD.org>

Fix clearing MAC stats registers. Previously it cleared every
fourth register.

Submitted by: Paul A. Patience <paul-a.patience@polymtl.ca>
Approved by: re (gjb)


# 040f9b1e 17-Sep-2013 Xin LI <delphij@FreeBSD.org>

Fix a typo when accounting for tx_broadcast statistics.

Submitted by: Paul A. Patience <paul-a patience polymtl ca>
MFC after: 2 weeks
Approved by: re (hrs)


# edd26b66 24-Aug-2013 Andre Oppermann <andre@FreeBSD.org>

Change local variable tso_segsz to tsosegsz to avoid mbuf.h macro conflicts.

Sponsored by: The FreeBSD Foundation


# c6499ecc 04-Dec-2012 Gleb Smirnoff <glebius@FreeBSD.org>

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.


# 5bbe0c53 07-Jan-2012 Kevin Lo <kevlo@FreeBSD.org>

ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it again

Reviewed by: yongari


# 4b7ec270 22-Nov-2011 Marius Strobl <marius@FreeBSD.org>

- There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
(bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
since r52045) but even recently added device drivers do this unnecessarily.
Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
Discussed with: jhb
- Also while at it, use __FBSDID.


# 57c81d92 17-Oct-2011 Pyun YongHyeon <yongari@FreeBSD.org>

Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
Because driver is accessing a common MII structure in
mii_pollstat(), updating user supplied structure should be done
before dropping a driver lock.

Reported by: Karim (fodillemlinkarimi <> gmail dot com)


# 20e43c4a 31-May-2011 Pyun YongHyeon <yongari@FreeBSD.org>

If driver is not running, disable interrupts and do not try to
process received frames. Previously it was possible to handle RX
interrupts even if controller is not fully initialized. This
resulted in non-working driver after system is up and running.

Reported by: hselasky
Tested by: hselasky


# 3fcb7a53 03-May-2011 Marius Strobl <marius@FreeBSD.org>

- Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP
(reporting IFM_LOOP based on BMCR_LOOP is left in place though as
it might provide useful for debugging). For most mii(4) drivers it
was unclear whether the PHYs driven by them actually support
loopback or not. Moreover, typically loopback mode also needs to
be activated on the MAC, which none of the Ethernet drivers using
mii(4) implements. Given that loopback media has no real use (and
obviously hardly had a chance to actually work) besides for driver
development (which just loopback mode should be sufficient for
though, i.e one doesn't necessary need support for loopback media)
support for it is just dropped as both NetBSD and OpenBSD already
did quite some time ago.
- Let mii_phy_add_media() also announce the support of IFM_NONE.
- Restructure the PHY entry points to use a structure of entry points
instead of discrete function pointers, and extend this to include
a "reset" entry point. Make sure any PHY-specific reset routine is
always used, and provide one for lxtphy(4) which disables MII
interrupts (as is done for a few other PHYs we have drivers for).
This includes changing NIC drivers which previously just called the
generic mii_phy_reset() to now actually call the PHY-specific reset
routine, which might be crucial in some cases. While at it, the
redundant checks in these NIC drivers for mii->mii_instance not being
zero before calling the reset routines were removed because as soon
as one PHY driver attaches mii->mii_instance is incremented and we
hardly can end up in their media change callbacks etc if no PHY driver
has attached as mii_attach() would have failed in that case and not
attach a miibus(4) instance.
Consequently, NIC drivers now no longer should call mii_phy_reset()
directly, so it was removed from EXPORT_SYMS.
- Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe().
The purpose of that function is to perform the common steps to attach
a PHY driver instance and to hook it up to the miibus(4) instance and to
optionally also handle the probing, addition and initialization of the
supported media. So all a PHY driver without any special requirements
has to do in its bus attach method is to call mii_phy_dev_attach()
along with PHY-specific MIIF_* flags, a pointer to its PHY functions
and the add_media set to one. All PHY drivers were updated to take
advantage of mii_phy_dev_attach() as appropriate. Along with these
changes the capability mask was added to the mii_softc structure so
PHY drivers taking advantage of mii_phy_dev_attach() but still
handling media on their own do not need to fiddle with the MII attach
arguments anyway.
- Keep track of the PHY offset in the mii_softc structure. This is done
for compatibility with NetBSD/OpenBSD.
- Keep track of the PHY's OUI, model and revision in the mii_softc
structure. Several PHY drivers require this information also after
attaching and previously had to wrap their own softc around mii_softc.
NetBSD/OpenBSD also keep track of the model and revision on their
mii_softc structure. All PHY drivers were updated to take advantage
as appropriate.
- Convert the mebers of the MII data structure to unsigned where
appropriate. This is partly inspired by NetBSD/OpenBSD.
- According to IEEE 802.3-2002 the bits actually have to be reversed
when mapping an OUI to the MII ID registers. All PHY drivers and
miidevs where changed as necessary. Actually this now again allows to
largely share miidevs with NetBSD, which fixed this problem already
9 years ago. Consequently miidevs was synced as far as possible.
- Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that
weren't explicitly converted to support flow control before. It's
unclear whether flow control actually works with these but typically
it should and their net behavior should be more correct with these
changes in place than without if the MAC driver sets MIIF_DOPAUSE.

Obtained from: NetBSD (partially)
Reviewed by: yongari (earlier version), silence on arch@ and net@


# 3b0a4aef 23-Mar-2011 John Baldwin <jhb@FreeBSD.org>

Do a sweep of the tree replacing calls to pci_find_extcap() with calls to
pci_find_cap() instead.


# 4de89d86 24-Jan-2011 Pyun YongHyeon <yongari@FreeBSD.org>

Reinitialize driver when MTU is changed and driver is running.

Reported by: Huang, Yusheng ( yusheng.huang <> bluecoat com )


# 6dc7dc9a 12-Jan-2011 Matthew D Fleming <mdf@FreeBSD.org>

sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.

Commit the rest of the devices.


# 32341ad6 03-Jan-2011 John Baldwin <jhb@FreeBSD.org>

Add a 'locked' variant of the foo_start() routine and call it directly
from interrupt handlers and watchdog routines instead of queueing a task
to call foo_start().

Reviewed by: yongari
MFC after: 1 month


# 2f4fcd48 17-Nov-2010 Pyun YongHyeon <yongari@FreeBSD.org>

MCP55 is the only NVIDIA controller that supports VLAN tag
insertion/stripping and it also supports TSO over VLAN. Implement
TSO over VLAN support for MCP55 controller.

While I'm here clean up SIOCSIFCAP ioctl handler. Since nfe(4)
sets ifp capabilities based on various hardware flags in device
attach, there is no need to check hardware flags again in
SIOCSIFCAP ioctl handler. Also fix a bug which toggled both TX and
RX checksum offloading even if user requested either TX or RX
checksum configuration change.

Tested by: Rob Farmer ( rfarmer <> predatorlabs dot net )


# b0630da9 15-Nov-2010 Pyun YongHyeon <yongari@FreeBSD.org>

Plug memory leakage introduced in r215327.

Submitted by: jkim


# 7e7a45ce 14-Nov-2010 Pyun YongHyeon <yongari@FreeBSD.org>

P5N32-SLI PREMIUM from ASUSTeK is known to have MSI/MSI-X issue
such that nfe(4) does not work with MSI-X. When MSI-X support was
introduced, I remember MCP55 controller worked without problems so
the issue could be either PCI bridge or BIOS issue. But I also
noticed snd_hda(4) disabled MSI on all MCP55 chipset so I'm still
not sure this is generic issue of MCP55 chipset. If this was PCI
bridge issue we would have added it to a system wide black-list
table but it's not clear to me at this moment whether it was caused
by either broken BIOS or silicon bug of MCP55 chipset.

To workaround the issue, maintain a MSI/MSI-X black-list table in
driver and lookup base board manufacturer and product name from the
table before attempting to use MSI-X. If driver find an matching
entry, nfe(4) will not use MSI/MSI-X and fall back on traditional
INTx mode. This approach should be the last resort since it relies
on smbios and if another instance of MSI/MSI-X breakage is reported
with different maker/product, we may have to get the PCI bridge
black-listed instead of adding an new entry.

PR: kern/152150


# efd4fc3f 14-Nov-2010 Marius Strobl <marius@FreeBSD.org>

o Flesh out the generic IEEE 802.3 annex 31B full duplex flow control
support in mii(4):
- Merge generic flow control advertisement (which can be enabled by
passing by MIIF_DOPAUSE to mii_attach(9)) and parsing support from
NetBSD into mii_physubr.c and ukphy_subr.c. Unlike as in NetBSD,
IFM_FLOW isn't implemented as a global option via the "don't care
mask" but instead as a media specific option this. This has the
following advantages:
o allows flow control advertisement with autonegotiation to be
turned on and off via ifconfig(8) with the default typically
being off (though MIIF_FORCEPAUSE has been added causing flow
control to be always advertised, allowing to easily MFC this
changes for drivers that previously used home-grown support for
flow control that behaved that way without breaking POLA)
o allows to deal with PHY drivers where flow control advertisement
with manual selection doesn't work or at least isn't implemented,
like it's the case with brgphy(4), e1000phy(4) and ip1000phy(4),
by setting MIIF_NOMANPAUSE
o the available combinations of media options are readily available
from the `ifconfig -m` output
- Add IFM_FLOW to IFM_SHARED_OPTION_DESCRIPTIONS and IFM_ETH_RXPAUSE
and IFM_ETH_TXPAUSE to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so
these are understood by ifconfig(8).
o Make the master/slave support in mii(4) actually usable:
- Change IFM_ETH_MASTER from being implemented as a global option via
the "don't care mask" to a media specific one as it actually is only
applicable to IFM_1000_T to date.
- Let mii_phy_setmedia() set GTCR_MAN_MS in IFM_1000_T slave mode to
actually configure manually selected slave mode (like we also do in
the PHY specific implementations).
- Add IFM_ETH_MASTER to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so it
is understood by ifconfig(8).
o Switch bge(4), bce(4), msk(4), nfe(4) and stge(4) along with brgphy(4),
e1000phy(4) and ip1000phy(4) to use the generic flow control support
instead of home-grown solutions via IFM_FLAGs. This includes changing
these PHY drivers and smcphy(4) to no longer unconditionally advertise
support for flow control but only if the selected media has IFM_FLOW
set (or MIIF_FORCEPAUSE is set) and implemented for these media variants,
i.e. typically only for copper.
o Switch brgphy(4), ciphy(4), e1000phy(4) and ip1000phy(4) to report and
set IFM_1000_T master mode via IFM_ETH_MASTER instead of via IFF_LINK0
and some IFM_FLAGn.
o Switch brgphy(4) to add at least the the supported copper media based on
the contents of the BMSR via mii_phy_add_media() instead of hardcoding
them. The latter approach seems to have developed historically, besides
causing unnecessary code duplication it was also undesirable because
brgphy_mii_phy_auto() already based the capability advertisement on the
contents of the BMSR though.
o Let brgphy(4) set IFM_1000_T master mode on all supported PHY and not
just BCM5701. Apparently this was a misinterpretation of a workaround
in the Linux tg3 driver; BCM5701 seem to require RGPHY_1000CTL_MSE and
BRGPHY_1000CTL_MSC to be set when configuring autonegotiation but
this doesn't mean we can't set these as well on other PHYs for manual
media selection.
o Let ukphy_status() report IFM_1000_T master mode via IFM_ETH_MASTER so
IFM_1000_T master mode support now is generally available with all PHY
drivers.
o Don't let e1000phy(4) set master/slave bits for IFM_1000_SX as it's
not applicable there.

Reviewed by: yongari (plus additional testing)
Obtained from: NetBSD (partially), OpenBSD (partially)
MFC after: 2 weeks


# 603b8e29 12-Nov-2010 Pyun YongHyeon <yongari@FreeBSD.org>

Fix regression introduced in r215132. Caller always holds a driver
lock before accessing mii, so locking is not needed here.

Reported by: Rob Farmer (rfarmer <> predatorlabs dot net)


# 52a1393e 11-Nov-2010 Pyun YongHyeon <yongari@FreeBSD.org>

Add basic WOL support for MCP ethernet controllers. It seems the
controller does not perform automatic switching from 1000Mbps link
to 10/100Mbps link when WOL is activated. Implement establishing
10/100Mps link with auto-negotiation in driver. Link status change
handler was modified to remove taskqueue based approach since driver
now needs synchronous handling for link establishment.

Submitted by: Yamagi Burmeister (lists <> yamagi.org ) (initial version)
Tested by: Yamagi Burmeister (lists <> yamagi.org )
MFC after: 1 week


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# d6c65d27 15-Oct-2010 Marius Strobl <marius@FreeBSD.org>

Converted the remainder of the NIC drivers to use the mii_attach()
introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these
are only straight forward conversions though.

Reviewed by: yongari


# ed0af45a 26-Apr-2010 Pyun YongHyeon <yongari@FreeBSD.org>

MFC r206876:
With r206844, CSUM_TCP is also set for CSUM_TSO case. Modify
drivers to take into account for the change. Basically CSUM_TSO
should be checked before checking CSUM_TCP.


# 6da6d0a9 19-Apr-2010 Pyun YongHyeon <yongari@FreeBSD.org>

With r206844, CSUM_TCP is also set for CSUM_TSO case. Modify
drivers to take into account for the change. Basically CSUM_TSO
should be checked before checking CSUM_TCP.


# e1b17582 06-Nov-2009 John Baldwin <jhb@FreeBSD.org>

Take a step towards removing if_watchdog/if_timer. Don't explicitly set
if_watchdog/if_timer to NULL/0 when initializing an ifnet. if_alloc()
sets those members to NULL/0 already.


# eb956cd0 26-Jun-2009 Robert Watson <rwatson@FreeBSD.org>

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs. This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by: re (kib)
MFC after: 6 weeks


# 1abcdbd1 30-May-2009 Attilio Rao <attilio@FreeBSD.org>

When user_frac in the polling subsystem is low it is going to busy the
CPU for too long period than necessary. Additively, interfaces are kept
polled (in the tick) even if no more packets are available.
In order to avoid such situations a new generic mechanism can be
implemented in proactive way, keeping track of the time spent on any
packet and fragmenting the time for any tick, stopping the processing
as soon as possible.

In order to implement such mechanism, the polling handler needs to
change, returning the number of packets processed.
While the intended logic is not part of this patch, the polling KPI is
broken by this commit, adding an int return value and the new flag
IFCAP_POLLING_NOCOUNT (which will signal that the return value is
meaningless for the installed handler and checking should be skipped).

Bump __FreeBSD_version in order to signal such situation.

Reviewed by: emaste
Sponsored by: Sandvine Incorporated


# 767fb36c 24-May-2009 Pyun YongHyeon <yongari@FreeBSD.org>

NVIDIA MCP controllers have no Rx buffer alignment restrictions.
Remove PAGE_SIZE alignment used in Rx buffer DMA tag creation. The
alignment restriction was used in old local jumbo allocator and
nfe(4) switched to UMA backed page allocator for jumbo frame.

This change should fix jumbo buffer allocation failure.

Reported by: Pascal Braun ( pascal.braun <> continum dot net )


# 69d6a6aa 19-Dec-2008 Pyun YongHyeon <yongari@FreeBSD.org>

Fix a typo.

Submitted by: clemens fischer via Shigeaki Tagashira


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 17d022be 02-Oct-2008 Pyun YongHyeon <yongari@FreeBSD.org>

Add hardware MAC statistics support. Register information was
obtained from Linux forcedeth driver.
While I'm here move creating a sysctl node for process_limit to
function nfe_sysctl_node().

Tested by: "Arno J. Klaassen" < arno <at> heho dot snv dot jussieu dot fr >


# be38e61a 30-Sep-2008 Pyun YongHyeon <yongari@FreeBSD.org>

Add device ids for MCP77/79 and set appropriate support flags.

Obtained from: OpenBSD
PR: kern/127529


# b7e548dc 09-Apr-2008 Pyun YongHyeon <yongari@FreeBSD.org>

Add support for MCP73 chips.

Tested by: "Daan Vreeken [PA4DAN]" ( Danovitsch AT vitsch DOT net )
MFC after: 1 week


# 3a5d5a69 05-Mar-2008 Pyun YongHyeon <yongari@FreeBSD.org>

Nuke local jumbo allocator and switch to use of UMA backed page
allocator for jumbo frame. Also remove unneeded jlist lock which
is no longer required to protect jumbo buffers.
With these changes jumbo frame performance of nfe(4) was slightly
increased and users should not encounter jumbo buffer allocation
failure anymore.


# cf827063 01-Feb-2008 Poul-Henning Kamp <phk@FreeBSD.org>

Give MEXTADD() another argument to make both void pointers to the
free function controlable, instead of passing the KVA of the buffer
storage as the first argument.

Fix all conventional users of the API to pass the KVA of the buffer
as the first argument, to make this a no-op commit.

Likely break the only non-convetional user of the API, after informing
the relevant committer.

Update the mbuf(9) manual page, which was already out of sync on
this point.

Bump __FreeBSD_version to 800016 as there is no way to tell how
many arguments a CPP macro needs any other way.

This paves the way for giving sendfile(9) a way to wait for the
passed storage to have been accessed before returning.

This does not affect the memory layout or size of mbufs.

Parental oversight by: sam and rwatson.

No MFC is anticipated.


# 304a4c6f 17-Jan-2008 John Baldwin <jhb@FreeBSD.org>

- Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), and
re_defrag() and use m_collapse() instead.
- Replace a reference to ath_defrag() in a comment in if_wpi.c with
m_collapse().


# 6a087a87 21-Nov-2007 Pyun YongHyeon <yongari@FreeBSD.org>

Fix function prototype for device_shutdown method.


# cbb1d39d 16-Nov-2007 Sam Leffler <sam@FreeBSD.org>

use the private task q thread instead of the shared system thread

Reviewed by: yongari
MFC after: 1 week


# 144e07f0 05-Nov-2007 Pyun YongHyeon <yongari@FreeBSD.org>

Apparently some NVIDIA NICs store ethernet address in reverse order
while other variants have inorder ethernet address for the same
chipset. Override ethernet address ordering if we already know how
it was stored. This fixes the use of inversed ethernet address on
MCP67.

Submitted by: ariff
MFC after: 3 days


# 0142a9b1 13-Sep-2007 Pyun YongHyeon <yongari@FreeBSD.org>

During boot(before setting IP address) PHY can generate link state
change interrupt if the link is established with link parter. However
interrupt handler didn't acknowledge the interrupt if nfe(4) was not
running at the time of interrupt delivery. This caused endless
interrupt generation. Fix the bug by acknowledging the interrupt
regardless of running state of the driver.

PR: kern/116295
Submitted by: Mark Derbyshire (mark At taom dot com)
Approved by: re (kensmith)


# 50c55b29 13-Sep-2007 Pyun YongHyeon <yongari@FreeBSD.org>

Fix typo.

Pointed out: marius
Approved by: re (bmah)


# 8b590ad2 23-Jul-2007 Pyun YongHyeon <yongari@FreeBSD.org>

Don't fail on device attach if jumbo frame support was unsuccessful.
Because nfe(4) hardware doesn't support SG on Rx path, supporting
jumbo frame requires very large contiguous kernel memory(i.e. several
mega bytes). In case of lack of contiguous kernel memory that
allocation request may always fail. However nfe(4) can operate on normal
sized MTU frames, so go ahead and just disable jumbo frame support.
While I'm here add a new tunable "hw.nfe.jumbo_disable" to disable
jumbo frame support.
In nfe_poll, make sure to invoke correct Rx handler.

Approved by: re (kensmith)


# 1c889016 11-Jun-2007 Pyun YongHyeon <yongari@FreeBSD.org>

Increase a maximum segment size of DMA to 4096. Previously it used
MCLBYTES for the segment size but it used too many Tx descriptors in
TSO case.
While I'm here adjust maximum size of the sum of all segment lengths
in a given DMA mapping to 65535, the maximum size, in bytes, of a IP
packet.


# aab5582f 11-Jun-2007 Pyun YongHyeon <yongari@FreeBSD.org>

Bring overhauled nfe(4) into tree.

o s/printf/device_printf/g
o Nuke OpenBSDism.
o Nuke NetBSD/OpenBSD specific DMA sync operations.(we don't have a way
to sync a single descriptor within a DMA map.)
o Remove recursive mutex.
o bus_dma(9) clean up.
o 40bit DMA address support.
o Add protection for Rx map load failure.
o Fix a long standing bug for watchdog timeout. [1]
o Add additional protections, missing Tx completion interrupt, losing
start Tx command, for watchdog timeout.
o Switch to taskqueue(9) API to handle interrupts.
o Use our own timer for watchdog instead of if_watchdog/if_timer
interface.
o Advertise VLAN header length/capability correctly to upper layer.
o Remove excessive kernel stack consumption in nfe_encap().
o Handle highly fragmented mbuf chains correctly.
o Enable etherenet address reprogramming with ifconfig(8).
o Add ALTQ/TSO, MSI/MSIX support.
o Increased Rx ring to 256 descriptors from 128.
o Align Tx/Rx descriptor ring on sizeof(struct nfe_desc64) boundary.
o Remove alignment restrictions on Tx/Rx buffers.
o Rewritten jumbo frame support code.
o Add support for hardware assistend VLAN tag insertion/stripping.
o Add support for Tx/Rx flow control based on patches from Peer Chen. [2]
o Add a routine that detects whether ethernet address swap routines is
required. [3]
o Add a workaround that take MAC/PHY out of power down mode.
o Add suspend/resume support.
o style(9) and code clean up.

Special thanks to Shigeaki Tagashira, the original porter of nfe(4),
who submitted lots of patches, performed uncountable number of
regression tests and maintained nfe(4) for a long time. Without his
enthusiastic help and support I could never have completed this
overhauling task.

The only weak point of nfe(4) compared to nve(4) is instability of
manual half-duplex media selection on certain hardwares(auto sensing
media type should work for all cases, though). This was a long
standing bug of nfe(4) and I still have no idea why it doesn't work
on some hardwares.

Obtained from: OpenBSD [1]
Submitted by: Peer Chen < pchen at nvidia dot com > [2], [3]
Reviewed by: Shigeaki Tagashira < shigeaki AT se DOT hiroshima-u DOT ac DOT jp >
Tested by: Shigeaki Tagashira, current
Discussed with: current
Silence from: obrien


# 59a0d28b 03-Mar-2007 Christian S.J. Peron <csjp@FreeBSD.org>

Catch up the rest of the drivers with the ether_vlan_mtap modifications.
If these drivers are setting M_VLANTAG because they are stripping the
layer 2 802.1Q headers, then they need to be re-inserting them so any
bpf(4) peers can properly decode them.

It should be noted that this is compiled tested only.

MFC after: 3 weeks


# ef544f63 22-Feb-2007 Paolo Pisati <piso@FreeBSD.org>

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@


# 7597761a 26-Nov-2006 David E. O'Brien <obrien@FreeBSD.org>

Fix TX/RX checksum offload.

Submitted by: Peer Chen at nVIDIA


# 30ce3a12 26-Nov-2006 David E. O'Brien <obrien@FreeBSD.org>

Reformat to KNF after revision 1.12.


# 6124fe21 26-Nov-2006 David E. O'Brien <obrien@FreeBSD.org>

Fix the jumbo frame support.

Submitted by: Peer Chen at nVIDIA (reworked by me)


# a0f9e922 26-Nov-2006 David E. O'Brien <obrien@FreeBSD.org>

Grrr. new .vimrc file is really giving me trouble.. get the whitespace right.


# 96058696 26-Nov-2006 David E. O'Brien <obrien@FreeBSD.org>

Fix editor fatfingering in rev 1.9.


# 9565e1fa 26-Nov-2006 David E. O'Brien <obrien@FreeBSD.org>

nfe_stop() requires lock to be held when calling.


# 9ae2249d 17-Nov-2006 David E. O'Brien <obrien@FreeBSD.org>

Missed two nits in rev 1.7.


# 2c3adf61 19-Oct-2006 David E. O'Brien <obrien@FreeBSD.org>

style(9) cleanup.


# 6bec3967 16-Oct-2006 David E. O'Brien <obrien@FreeBSD.org>

Try to be more precise in identifying the various nForce networking adapters.


# 78ba57b9 17-Sep-2006 Andre Oppermann <andre@FreeBSD.org>

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


# 3e232000 11-Sep-2006 David E. O'Brien <obrien@FreeBSD.org>

Add support for MCP61 and MCP65 adaptors.

Submitted by: Peer Chen at nVIDIA


# d0220c83 14-Aug-2006 Ruslan Ermilov <ru@FreeBSD.org>

Fix alignment of RX bufs DMA map to be realistic. Maybe it works on
i386 (I don't know) but on amd64 at hand here, it paniced early at
boot.

(I'm pretty sure that PAGE_SIZE here was miscopied from another place
during porting, where in OpenBSD bus_dmamem_alloc() is used, but there
PAGE_SIZE means completely different thing.)


# bfc788c2 26-Jun-2006 David E. O'Brien <obrien@FreeBSD.org>

Add a pure open source nForce Ethernet driver, under BSDL.
This driver was ported from OpenBSD by Shigeaki Tagashira
<shigeaki@se.hiroshima-u.ac.jp> and posted at
http://www.se.hiroshima-u.ac.jp/~shigeaki/software/freebsd-nfe.html
It was additionally cleaned up by me.
It is still a work-in-progress and thus is purposefully not in GENERIC.
And it conflicts with nve(4), so only one should be loaded.


# 257c5577 26-Jun-2006 David E. O'Brien <obrien@FreeBSD.org>

Import the nfe (nForce Ethernet) driver from OpenBSD.
This is a pure open source NIC driver with a BSD license.
These bits were taken from the OpenBSD public CVS repository on 1-May-06.