Commit Graph

142 Commits

Author SHA1 Message Date
Pyun YongHyeon
388214e4f2 Implement Rx checksum offloading for Yukon EC, Yukon Ultra,
Yukon FE and Yukon Ultra2. These controllers provide very simple
checksum computation mechanism and it requires additional pseudo
header checksum computation in upper stack. Even though I couldn't
see much performance difference with/without Rx checksum offloading
it may help notebook based controllers.

Actually controller can compute two checksum value by giving
different starting position of checksum computation on received
frame. However, for long time, Marvell's checksum offloading engine
have been known to have several silicon bugs so don't blindly trust
computed partial checksum value. Instead, compute partial checksum
twice by giving the same checksum computation position and compare
the result. If the value is different it's clear indication of
hardware bug. This configuration lose IP checksum offloading
capability but I think it's better to take safe route.
Note, Rx checksum offloading for Yukon XL was still disabled due to
known silicon bug.
2010-03-12 18:41:41 +00:00
Pyun YongHyeon
c876b43f42 Remove taskqueue based interrupt handling. After r204541 msk(4)
does not generate excessive interrupts any more so we don't need
to have two copies of interrupt handler.
While I'm here remove two STAT_PUT_IDX register accesses in LE
status event handler. After r204539 msk(4) always sync status LEs
so there is no need to resort to reading STAT_PUT_IDX register to
know the end of status LE processing. Just trust status LE's
ownership bit.
2010-03-02 01:45:02 +00:00
Pyun YongHyeon
cf570c1f34 Implement rudimentary interrupt moderation with programmable
countdown timer register. The timer resolution may vary among
controllers but the value would be represented by core clock
cycles. msk(4) will automatically computes number of required clock
cycles from given micro-seconds unit.
The default interrupt holdoff timer value is 100us which will
ensure less than 10k interrupts under load. The timer value can be
changed with dev.mskc.0.int_holdoff sysctl node.

Note, the interrupt moderation is shared resource on dual-port
controllers so you can't use separate interrupt moderation value
for each port. This means we can't stop interrupt moderation in
driver stop routine. Also have msk_tick() reclaim transmitted Tx
buffers as safety belt. With this change there is no need to check
missing Tx completion interrupt in watchdog handler, so remove it.
2010-03-01 23:39:43 +00:00
Pyun YongHyeon
42f3ea9fc2 Make sure to enable flow-control only if established link is
full-duplex. Previously msk(4) used to allow flow-control on
1000baseT half-duplex media. Also GMAC pause is enabled if link
partner is capable of handling it.
While I'm here use IFM_OPTIONS instead of using IFM_GMASK to check
optional flags of link.
2010-03-01 22:55:35 +00:00
Pyun YongHyeon
17f6f326e9 Properly sync status LEs after processing. 2010-03-01 22:43:22 +00:00
Pyun YongHyeon
8c1643b6db Remove trailing white spaces. 2010-02-26 19:38:12 +00:00
Pyun YongHyeon
c72f075a24 Allocate single MSI message. msk(4) used to allocate 2 MSI messages
for controllers like 88E8053 which reports two MSI messages.
Because we don't get anything useful things with 2 MSI messages,
allocating 1 MSI message would be more sane approach.
While I'm here, enable MSI for dual-port controllers too. Because
status block is shared for dual-port controllers, I don't think
msk(4) will encounter problem for using MSI on dual-port
controllers.
2010-02-26 19:37:03 +00:00
Pyun YongHyeon
7420e9dc9d Don't hardcod register offset to set PCIe max read request size.
The register offset is not valid on 88E8072 controller. Also don't
blindly increase max read request size to 4096, instead, use 2048
which seems to be more sane value and only change the value if the
hardware default size(512) was used on that register.
For PCIX controllers, use system defined constant rather than using
magic value.
While I'm here stop showing negotiated link width.
2010-02-26 19:18:29 +00:00
Pyun YongHyeon
1b7757c024 Optimize inserting LE for TX checksum computation. Controller does
not require checksum LE configuration if checksum start and write
position is the same as before. So keep track last checksum start
and write position and insert new LE whenever the position is
changed. This reduces number of LEs used in TX path as well as
slightly enhance TX performance.
2010-02-26 18:18:02 +00:00
Pyun YongHyeon
4858893b6e Add TSO support on VLANs. Controller requires VLAN hardware tagging
to make TSO work over VLANs.
2010-02-26 17:33:43 +00:00
Pyun YongHyeon
d06930af52 Reuse the configured LE for VLAN if new LE was created for TSO.
Only old controllers need to create new LE for TSO. This change
makes TSO work over VLANs.
2010-02-26 17:27:16 +00:00
Pyun YongHyeon
cf5756a6bf Correct inversed programming of ethernet hardware address on
big-endian architecture.

Submitted by:	C. Jayachandran <c.jayachandran at gmail dot com> (initial version)
2010-02-20 22:24:24 +00:00
Pyun YongHyeon
84e3651eb3 Yukon Ultra2 has 126MHz clock. 2010-01-22 20:15:49 +00:00
Pyun YongHyeon
a91981e4ba s/Mhz/MHz/g
Submitted by:	N.J. Mann <njm <> njm dot me dot uk >
2010-01-22 20:10:12 +00:00
Pyun YongHyeon
77e6010f24 It seems generation of link state change of e1000phy(4) is not
reliable on some Marvell PHYs. If msk(4) know it still does not
have established link check whether msk(4) missed the link state
change by looking into polled link state.

Reported by:	Mel Flynn < mel.flynn+fbsd.current <> mailing.thruhere dot net >,
		Gleb Kurtsou <gleb.kurtsou <> gmail dot com >
Tested by:	Gleb Kurtsou <gleb.kurtsou <> gmail dot com >
2009-11-17 18:19:45 +00:00
Pyun YongHyeon
76202a1601 Add preliminary Yukon Ultra 2 support(88E8057). The controller
looks very similar to Yukon EC Ultra.

Tested by:	 kalin m ( kalin <> el dot net )
2009-11-07 01:14:09 +00:00
John Baldwin
f802264db1 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.

(Missed this driver in the earlier commit.)
2009-11-06 20:07:16 +00:00
Pyun YongHyeon
ff08021657 It's normal to see Rx FIFO overruns under high network load and
showing the message creates other side-effects. Remove the Rx
FIFO overrun message in interrupt handler. msk(4) should recover
from the FIFO overruns without any user intervention. Users can
still check the Rx FIFO overrun counter from MAC MIB statistics
maintained in driver(dev.msk.0.stats.rx.overflows).
2009-11-06 18:51:05 +00:00
Pyun YongHyeon
56964c4c9f Remove unnecessary header file. 2009-11-06 18:36:09 +00:00
Ulf Lilleengen
0e0ed74fcc - Add support for Marvell Yukon 88E8042 device.
Submitted by:	Mario Lobo <mlobo -at- digiart.art.br>
Approved by:	yongari
2009-10-25 21:46:38 +00:00
Pyun YongHyeon
60d3251abb Add DGE-560SX(Yukon XL) to the supported device list. Many thanks
to "Eugene Perevyazko <john <> dnepro dot net>" who kindly gave
remote access to system with DGE-560SX.
2009-09-28 21:11:31 +00:00
Pyun YongHyeon
cde64af338 Add workaround for Yukon XL which has hardware bug that can't flush
FIFO.
2009-09-28 21:07:19 +00:00
Pyun YongHyeon
fcb62a8b01 Add hack to pass controller specific information to phy driver.
Unlike most other PHYs there is no easy way to know which media
type the PHY supports on Marvell PHYs. MIIF_HAVEFIBER flags is now
passed via bus-specific instance variable of a device. While I'm
here add 88E1112 specific work around to set SIGDET polarity low.
Many thanks "Eugene Perevyazko <john <> dnepro dot net>" who kindly
gave remote access to system with DGE-560SX.
2009-09-28 21:03:28 +00:00
Pyun YongHyeon
40d7192b1c Fix MIB statistics clear routine. This should fix alignment errors on sparc64.
Reported by:	Garrett Damore < gdamore <> opensolaris dot org >
2009-09-28 20:03:37 +00:00
Poul-Henning Kamp
6778431478 Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
2009-09-08 13:19:05 +00:00
Poul-Henning Kamp
b34421bf9c Add necessary include. 2009-09-08 13:16:55 +00:00
Robert Watson
eb956cd041 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
2009-06-26 11:45:06 +00:00
Pyun YongHyeon
a56fe1f085 Add Yukon Extreme device ids, 88E8071 and 88E8072.
While I'm here correct description of 88E8070. 88E8070 is Yukon
Extreme and have gigabit PHY.
2009-06-02 05:08:57 +00:00
Pyun YongHyeon
efb74172a5 Add Rx checksum offloading support for Yukon FE+ and Yukon Extreme.
These controllers use newer descriptor format and the new descriptor
format uses status LE to indicate the status of checksum. Rx
checksummed value used in previous controllers were very cryptic
and I failed to understand how to use them. In addition most
controllers in previous generations had Rx checksum offloading bug.

While I'm here introduce a MSK_FLAG_NORX_CSUM flag to bypass
checking Rx checksum offloading as Yukon FE+ A0 has status LE bug.
2009-06-02 04:59:29 +00:00
Pyun YongHyeon
ebb25bfab5 Add frame parser capability of Yukon FE+ and Yukon Extreme. With
this feature hardware automatically computes TCP/UDP payload
offset. Introduce MSK_FLAG_AUTOTX_CSUM to mark the capability.
Yukon Extreme B0 revision is known to have a silicon for the
feature so disable it. Yukon Extreme B0 still can do Tx checksum
offloading but CPU have to compute TCP/UDP payload offset. To
enable traditional checksum offloading, disable automatic Tx
checksum calculation capability.
Yukon Extreme A0 revision could not use store-and-forward mode for
jumbo frames(silicon bug) so disable Tx checksum offloading for
jumbo frames.

I believe controllers that have MSK_FLAG_AUTOTX_CSUM capability or
new descriptor format do not have Tx checksum offload bug so
disable checksum offloading workaround for for short frames.

Tested by:	jhb, Warren Block ( wblock <> wonkity dot com )
2009-06-02 04:35:44 +00:00
Pyun YongHyeon
daf292270b Add preliminary Yukon Extreme support and register definitions.
Yukon Extreme uses new descriptor format for TSO and has Tx frame
parser which greatly reduces CPU cycles spent in computing TCP/UDP
payload offset calculation in Tx checksum offloading path. The new
descriptor format also removed TCP/UDP payload computation for TSO
which in turn results in better TSO performance. It seems Yukon
Extreme has a lot of new (unknown) features but only basic
offloading is supported at this time. So far there are two known
issues.
 o Sometimes Rx overrun errors happen when pulling data over
   gigabit link. Running over 100Mbps seem to ok.
 o Ethernet hardware address shows all-zeroed value on 88E8070.
   Assigning ethernet address with ifconfig is necessary to make it
   work.
Support for Yukon Extreme is not perfect but it would be better
than having a non-working device. Special thanks to jbh who fixed
several bugs of initial patch.

Tested by:	jhb, Warren Block ( wblock <> wonkity dot com )
2009-06-02 04:00:17 +00:00
Pyun YongHyeon
f972d4c6fb Correct controller description for 88E8035, 88E8036, 88E8038 and
88E8039. These are fast ethernet controllers.
2009-05-25 08:26:39 +00:00
Pyun YongHyeon
b7e1e144e9 Simplify SIOCSIFFLAGS handler. 2009-05-25 08:02:05 +00:00
Pyun YongHyeon
98e02aebef Be consistent with other capability checking. 2009-05-25 07:59:30 +00:00
Pyun YongHyeon
89e2266651 Don't reinitialize controller when interface is already running. 2009-05-25 07:56:14 +00:00
Pyun YongHyeon
6f5a0d1f39 If interface is not UP, don't return media status. 2009-05-25 07:50:14 +00:00
Pyun YongHyeon
1290998502 Add device ids for Yukon FE+(88E8040, 88E8040T, 88E8048 and 88E8070). 2009-05-25 07:48:00 +00:00
Pyun YongHyeon
224003b7ba Add workaround for Yukon FE+ A0. This controller is known to have
severe silicon bugs that can't handle VLAN hardware tagging as well
as status LE writeback bug. The status LE writeback bug is so
critical we can't trust status word of received frame. To accept
frames on Yukon FE+ A0 msk(4) just do minimal check for received
frames and pass them to upper stack. This means msk(4) can pass
corrupted frames to upper layer. You have been warned!
Also I supposed RX_GMF_FL_THR to be 32bits register but Linux
driver treated it as 16bit register so follow their leads. At least
this does not seem to break msk(4) on Yukon FE+.

Tested by:	bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com )
		Bruce Cran ( bruce <> cran dot org dot uk )
		Michael Reifenberger ( mike <> reifenberger dot com )
		Stephen Montgomery-Smith ( stephen <> missouri dot edu )
2009-05-25 07:31:18 +00:00
Pyun YongHyeon
61708f4cb2 Add preliminary Yukon FE+ support and register definitions.
Yukon FE+ is fast ethernet controller and uses new descriptor
format. Since I don't have this controller, the support code was
written from guess and various feedback from enthusiastic users.
Thanks to all users who patiently tested my initial patches.
Special thanks to Tanguy Bouzeloc who fixed critical bug of initial
patch.

Tested by:	bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com )
		Bruce Cran ( bruce <> cran dot org dot uk )
		Michael Reifenberger ( mike <> reifenberger dot com )
		Stephen Montgomery-Smith ( stephen <> missouri dot edu )
2009-05-25 07:06:10 +00:00
Pyun YongHyeon
e6e23ffecb Explicitly reset GMAC Controls and initialize GM_GP_CTRL register.
The GM_GP_CTRL register may have stale content from previous link
information so clearing it will make hardware update the register
correctly when it established a valid link.
While I'm here remove stale comment.
2009-05-25 06:39:48 +00:00
Pyun YongHyeon
846e6d79e5 Disable HW WOL for Yukon EC Ultra. While I'm here use switch
statement over if-else statement. This change will make it easy to
add newer Yukon controllers.
2009-05-25 06:29:02 +00:00
Pyun YongHyeon
6c4d62e1d6 Explicitly check resolved speed/duplex. Just checking IFM_ACTIVE
does not guarantee established link. Also 1000baseT link report for
fast ethernet controller is not valid one so make sure gigabit link
is allowed for this controller.
Whenever we lost link, check whether Rx/Tx MACs were enabled. If both
MAC are not active, do not try to disable it again.
2009-05-25 06:19:36 +00:00
Pyun YongHyeon
262e9dcf36 Add support for newer descriptor format. This format is used on
Yukon FE+, Yukon Extreme and Yukon Supreme.
2009-05-25 06:09:18 +00:00
Pyun YongHyeon
40d6bed8a7 Oops, add missing ~ operator. 2009-05-25 04:27:12 +00:00
Pyun YongHyeon
4b76fe63d9 Caller already hold a driver lock in mii callback, assert it. 2009-05-25 04:25:08 +00:00
Pyun YongHyeon
e2b166039a Rather than checking every chip revision, introduce more flags to
mark controller's capability. Controllers that have jumbo frame
support sets MSK_FLAG_JUMBO, and controllers that does not support
checksum offloading for jumbo frames will set MSK_FLAG_JUMBO_NOCSUM.
For Fast Ethernet controllers it will set MSK_FLAG_FASTETHER and it
would be used in link state handling.

While here, disable Tx checksum offloading if jumbo frame is used
on controllers that does not have Tx checksum offloading capability
for jumbo frame(e.g. Yukon EC Ultra).
2009-05-25 04:22:27 +00:00
Pyun YongHyeon
325c534e4a Correctly return the result of mii_mediachg(). Previously it always
used to return success.
2009-05-25 03:53:12 +00:00
Pyun YongHyeon
7a76e8a489 Use bit definition to represent MSI and detach state instead of
using separate variables in softc.
2009-05-25 03:49:43 +00:00
Pyun YongHyeon
ab7df1e420 Use bit definition to represent link state, device suspend instead
of using separate variables in softc.
2009-05-25 03:42:33 +00:00
Pyun YongHyeon
19585f4549 Remove link handling taskqueue and use mii callback directly. While
I'm here also checks driver running state.
2009-05-25 03:24:47 +00:00
Pyun YongHyeon
79dd979a7d Fix typo. 2009-03-25 07:05:23 +00:00
Pyun YongHyeon
6d6588a152 Togging ALLMULTI does not require controller reset so have Rx
filtering handle this. Introduce a new function msk_rxfilter that
handles Rx filter configuration and multicast setup as well as
promiscuous mode. This simplifies code a lot.
Promiscuous mode always have preference to any other Rx
filtering so don't disable the mode when ALLMULTI is set.
2009-03-23 05:46:28 +00:00
Pyun YongHyeon
3a91ee716b Add hardware MAC statistics support. Also added some reserved
statistics register definition. Users can get current MAC
statistics from dev.msk.%d.stats sysctl node(%d is unit number of
a device).
2009-01-16 08:06:55 +00:00
Pyun YongHyeon
85b340cb24 Remove local jumbo locator and switch to UMA backed page allocator
for jumbo frame.
  o Nuke unneeded jlist lock which was used to protect jumbo buffer
    management in local allocator.
  o Added a new tunable hw.mskc.jumbo_disable to disable jumbo
    frame support for the driver. The tunable could be set for
    systems that do not need to use jumbo frames and it would
    save (9K * number of Rx descriptors) bytes kernel memory.
  o Jumbo buffer allocation failure is no longer critical error
    for the operation of msk(4). If msk(4) encounter the allocation
    failure it just disables jumbo frame support and continues to
    work without your intervention.

Using local allocator had several drawbacks such as requirement of
large amount of continuous kernel memory and fixed (small) number
of available buffers. The need for large continuous memory resulted
in failure of loading driver with kldload on running systems.
Also small number of buffer used in local allocator showed poor
performance for some applications.
2009-01-14 05:08:52 +00:00
Pyun YongHyeon
f9ad2b2f3c Correct frame length argument of in_cksum_skip. While I'm here
remove intermediate variable csum.

Reported by:	Kim Culhan < w8hdkim <> gmail DOT com >
Tested by:	Kim Culhan < w8hdkim <> gmail DOT com >
2009-01-14 04:47:04 +00:00
Pyun YongHyeon
e48163252e Save the value read from TX queue CSR, so we don't test against a
stale one.

Submitted by:	sephe
2008-11-24 02:21:50 +00:00
Pyun YongHyeon
ad415775a1 If mbuf is not writable get a writable copy before invoking
m_pullup(9).

Tested by:	Garrett Cooper < yanefbsd <at> gmail dot com >
2008-09-30 04:52:30 +00:00
Pyun YongHyeon
925da971b8 Always pullup mbuf prior to accessing TCP header.
This should fix occasional Tx checksum corruption issue.

Reported by:	Garrett Cooper < yanefbsd <at> gmail dot com >
Tested by:	Garrett Cooper < yanefbsd <at> gmail dot com >
2008-09-30 04:47:49 +00:00
Pyun YongHyeon
83c04c93b6 Add another hardware bug workaround for Yukon II controllers that
have hardware ram buffer. The silicon bug seem to be triggered by
pause frames if receive buffer is not aligned on FIFO word(8 bytes).
To workaround the issue, make sure to align Rx buffers on 8 bytes.
Unfortunately this workaround requires yet another Rx fixup for
strict alignment architecture machines to align IP header.

For newer hardwares that lacks ram buffer may not have this bug so
check number of available ram buffer size to see the existence of
ram buffer.

Reported by:	Ian Freislich (ianf <at> clue dot co dot za), das
Tested by:	Ian Freislich (ianf <at> clue dot co dot za)
2008-09-25 07:31:45 +00:00
Pyun YongHyeon
2b71cf8696 Move comments block 1 line up to remark on the setting
if_capabilities. This would make comments clear.

Suggested by:	yar
2008-03-11 02:39:52 +00:00
Pyun YongHyeon
06ff094490 To overcome hardware checksum offload bug msk(4) used to compute
TCP/UDP checksum in driver for short frames. For frames that requires
hardware VLAN tag insertion, the checksum offload trick does not
work due to changes of checksum offset in mbuf after the VLAN tag.

Disable hardware checksum offload for VLAN interface to fix the bug.

Reported by:	Christopher Cowart < ccowart AT rescomp DOT berkeley DOT edu >
Tested by:	Christopher Cowart < ccowart AT rescomp DOT berkeley DOT edu >
MFC after:	5 days
2008-03-07 04:55:58 +00:00
Pyun YongHyeon
d5d601648c Workaround GMAC hardware hang of Yukon II on the receipt of pause
frames. This bug seems to happen on certain hardware model/revision
(e.g. 88E8053) but it's not identified which hardwares are affected.
Revision 1.4 of if_mskreg.h was not enough to workaround the bug.
To workaround it, inrease GMAC FIFO threshold by one FIFO word to
flush received pause frames.

Reported by:	das, Kirill Nuzhdin < kirill.nuzhdin AT rad dot chem dot msu dot ru >
Tested by:	das, Kirill Nuzhdin
2008-02-29 03:38:12 +00:00
Poul-Henning Kamp
cf827063a9 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.
2008-02-01 19:36:27 +00:00
John Baldwin
304a4c6fb1 - 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().
2008-01-17 23:37:47 +00:00
Remko Lodder
28d34c0e95 Bring in support for: Marvell Yukon 8039
PR:		118401
Submitted by:	Skip Ford <skip at menantico dot com>
Approved by:	imp (mentor), yongari
MFC After:	3 days
2007-12-05 09:41:58 +00:00
Pyun YongHyeon
6a087a8722 Fix function prototype for device_shutdown method. 2007-11-22 02:45:00 +00:00
Pyun YongHyeon
8463d7a051 Add MSI support for 88E8058(Yukon EC Ultra). Unlike other Yukon II
family 88E8058 supports only one MSI message. Teach msk(4) to handle
that case.

Tested by:	Ed Schouten < ed AT fxq DOT nl >
2007-11-21 00:42:42 +00:00
Pyun YongHyeon
75ef16df96 Add device id for 88E8058(Yukon EC Ultra) which is found on 3rd
generation MacBooks.
Unfortunately 88E8058 supports one MSI message so msk(4) needs more
generic way to handle the MSI capability.

PR:	118110
2007-11-20 07:47:32 +00:00
Pyun YongHyeon
431e606d74 Make phy respond only at address 0. This makes phy driver attached
only at address 0 which is supposed to be the only valid phy address
on Marvell PHY. The more correct solution would be masking PHY
address ranges allowable in PHY probe routine. Unfortunately,
FreeBSD has no way to retrict the PHY address ranges or to pass special
flags to PHY driver.
This change assumes that PHY hardwares attached to msk(4) would be
Marvell made 88E11xx PHY.

With this changes the phantom phys attached on 88E8036(Yukon FE)
should disappear.

Reported by:	Oleg Lomaka  < oleg AT lomaka DOT org DOT ua >
Tested by:	Oleg Lomaka  < oleg AT lomaka DOT org DOT ua >
2007-11-20 07:33:01 +00:00
Pyun YongHyeon
e4a5f4e04b o Don't hardcode that Yukon FE has 16KB SRAM. In fact, Yukon FE has
only 4KB SRAM.
 o Rework setting Tx/Rx RAM buffer size. Give receiver 2/3 of memory
   and round it down to the multiple of 1024. The RAM buffer size of
   Yukon II should be multiple of 1024. This fixes bogus RAM buffer
   configuration used in Yukon FE.

Reported by:	Oleg Lomaka  < oleg AT lomaka DOT org DOT ua >
Tested by:	Oleg Lomaka  < oleg AT lomaka DOT org DOT ua >
2007-11-20 07:07:33 +00:00
Pyun YongHyeon
cfd540e7db Drop maintaing hardware feature(bug) lists for Yukon II. We don't have
publicly available datasheet for Yukon II and don't know what
bug/workaround exist for the specific hardware revision. Also I don't
think the vendor will release hardware errata in near future.
The hardware feature lists were not used at all except setting water
mark registers. Since msk(4) should know exact chip model/revision
number to decide which hardware capability could be used the extra
feature lists were redundant.
2007-11-20 06:52:29 +00:00
Pyun YongHyeon
a109c74fc9 Various fixes for EC Ultra.
o Enable jumbo frame support for EC Ultra and disable jumbo frame
   for FE.
 o Enable store and forward mode for standard MTU sized frame.
 o Enable TSO for EC Ultra. However TSO/checksum offload is disabled
   for jumbo frame case. Because EC Ultra can't use store and forward
   mode for jumbo frame TSO/checksum offload is not available.
 o Adjust Tx GMAC almost empty threshold value and add a jumbo frame
   water mark. The maic value was obtained from Marvell's sk98lin
   driver.
 o Fix EC Ultra chip revision number.
2007-11-20 06:20:02 +00:00
Pyun YongHyeon
53dcfbd18b Add legacy interrupt handler which would be more appropriate for
interrupt that is shared with other devices(e.g. USB) in system and
provide a new tunable "hw.msk.legacy_intr" to activate the legacy
interrupt handler. Setting the tunable automatically disables MSI
for msk(4). Previously msk(4) used adoptive polling with taskqueue(9)
as all msk(4) hardwares I know supports MSI. However, there are cases
that MSI couldn't be used on some hardwares due to bugs in MSI
implementatins.

Tested by:	Li-Lun Wang < llwang AT infor DOT org >
Approved by:	re (kensmith)
2007-07-20 00:25:20 +00:00
Pyun YongHyeon
a272ea16ed The maximum size of the sum of all segment lengths in a given DMA mapping
should be 65535 + link layer headers.

Pointed out by:	gallatin
2007-06-12 10:51:47 +00:00
Pyun YongHyeon
8b51df84e9 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.
2007-06-11 02:00:50 +00:00
Pyun YongHyeon
cf7a67bf4b Disable automatic IP ID increment. Due to a hardware bug the automatic
IP ID increment in TSO case generated corrupted IP packets.
This change brings back TSO capability.
2007-06-11 01:55:09 +00:00
Pyun YongHyeon
dd936d524b Work around GMAC hardware hang bug.
It seems that valid pause frames(Tx flow control) cause GMAC to hang
such that it resulted in watchdog timeout. As a work around don't
flush Rx MAC FIFO if we've received pause frames.

Tested by:	Harald Schmalzbauer (h DOT schmalzbauer AT omnisec DOT de)
2007-04-25 01:20:31 +00:00
Pyun YongHyeon
b2313f5861 Disable TSO support.
Under certain circumtances, if TSO is active, Yukon II generates
corrupted IP packets. All corrupted IP packets I noticed were the the
last segmented packet in a TSO request. The corrupted packet resulted
in retransmission of the damaged packet which in turn decreased network
performance dramatically.
Unfortunately it seems that there is no way to workaround this bug
as TSO is completely handled in hardware. Disable TSO until we find a
working workaround or a new silicon revision that doesn't have this
hardware bug.
2007-04-25 01:17:44 +00:00
Pyun YongHyeon
3326191f71 Fix TCP header size calculation logic which is used for setting
TSO MTU.
2007-04-25 01:13:38 +00:00
Pyun YongHyeon
b5898b804f Add work around for hardware Tx checksum offload bug in Yukon II.
Yukon II generated corrupted TCP checksum for short TCP packets
that's less than 60 bytes in size(e.g. window probe packet, pure ACK
packet etc). Padding the frame with zeros to make the frame minimum
ethernet frame size didn't work at all. Instead of dropping Tx
checksum offload support we calculate TCP checksum with S/W method
when we encounter short TCP frames.
Fortunately it seems that short UDP datagrams appear to be handled
correctly by Yukon II.

While I'm here simplify ethernet/VLAN header size calculation logic.

PR:	111384
2007-04-11 00:47:29 +00:00
Pyun YongHyeon
ad6d01d151 If we've encountered unrecognized chipset don't access hardware
anymore. Previously it tried to access interrupt register to disable
interrupts which could result in hang if the hardware was not
properly initialized by system BIOS/ACPI.

Tested by:	Benjamin Hansmann (benjamin.hansmann AT rub dot de)
MFC after:	3 days
2007-04-06 02:02:07 +00:00
Christian S.J. Peron
59a0d28bac 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
2007-03-04 03:38:08 +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
Pyun YongHyeon
71e8866707 Unbreak non-H/W VLAN extraction case.
Unlike other GigEs Yukon II always set VLAN bit when it detects VLAN
tagged packet regardless of H/W VLAN processing configuration state.
So it need to check IFCAP_VLAN_HWTAGGING bit to know whether driver
is configured to take advantage of H/W VLAN processing. If H/W VLAN
processing was disabled don't adjust received packet length such that
subsequent validation logic works for software VLAN processing.

Reported by:	bms
Tested by:	bms
2007-02-15 06:21:34 +00:00
Pyun YongHyeon
6ec27c17e7 Remove duplicated legacy SYS_RES_IRQ resources assignment.
Noticed by:	jhb
2007-01-09 01:31:22 +00:00
Pyun YongHyeon
303cb7331b Fix a typo which blindly enabled TSO capability without respect to
chip type.
2007-01-08 01:03:18 +00:00
Pyun YongHyeon
bf59599fcb Don't rely on GM_GP_CTRL register contents when mii(4) layer reports
link state changes. Instead, build new speed/duplex/flow-control
settings from the values reported from PHY.
This should fix speed/duplex/flow-control mismatches between GMAC and
PHY which resulted in very poor Rx performance due to lots of
out-of-order packet delivery.

Reported by:	Arno J. Klaassen <arno AT heho DOT snv DOT jussieu DOT fr>
Tested by:	Arno J. Klaassen <arno AT heho DOT snv DOT jussieu DOT fr>
2007-01-08 00:58:00 +00:00
Pyun YongHyeon
a485f97a1b Initialize legacy SYS_RES_IRQ resources before attempting to use MSI.
This fixes legacy SYS_RES_IRQ resource allocation failure when MSI is
disabled.

Reported by:	rrs
Tested by:	rrs
2007-01-08 00:19:53 +00:00
Pyun YongHyeon
2271eac77c Piggyback watchdog timer handling with msk_tick which is called every
hz. This will result in slightly faster Tx processing as it does not
need lock operations for callouts in msk_start/msk_txeof.
2006-12-29 04:55:38 +00:00
Pyun YongHyeon
b55031fd1a Fix interrupt handling on a dual port card. Previously it ignored
the second port interrupt if the first port was in down state.
Since I don't have a dual port card it's just guess work.

Noticed by:	jhb
2006-12-29 03:56:29 +00:00
Pyun YongHyeon
298946a985 Fix MSI support. Now it correctly allocates SYS_RES_IRQ resources
on Yukon II which reports it can handle two messages.

Submitted by:	jhb
Tested by:	bms
2006-12-29 03:33:33 +00:00
Pyun YongHyeon
0dbe28b3fb Add msk(4), a driver for Marvell/SysKonnect Yukon II Gigabit Ethernet
controller. Due to lack of documentation, this driver is based on the
code from sk(4) and Marvell's myk(4) driver for FreeBSD. I've also
adopted the OpenBSD interface name, msk(4) in order to reduce naming
differences between BSDs.
The msk(4) driver supports the following Gigabit Ethernet adapters.

o SysKonnect SK-9Sxx Gigabit Ethernet
o SysKonnect SK-9Exx Gigabit Ethernet
o Marvell Yukon 88E8021CU Gigabit Ethernet
o Marvell Yukon 88E8021 SX/LX Gigabit Ethernet
o Marvell Yukon 88E8022CU Gigabit Ethernet
o Marvell Yukon 88E8022 SX/LX Gigabit Ethernet
o Marvell Yukon 88E8061CU Gigabit Ethernet
o Marvell Yukon 88E8061 SX/LX Gigabit Ethernet
o Marvell Yukon 88E8062CU Gigabit Ethernet
o Marvell Yukon 88E8062 SX/LX Gigabit Ethernet
o Marvell Yukon 88E8035 Gigabit Ethernet
o Marvell Yukon 88E8036 Gigabit Ethernet
o Marvell Yukon 88E8038 Gigabit Ethernet
o Marvell Yukon 88E8050 Gigabit Ethernet
o Marvell Yukon 88E8052 Gigabit Ethernet
o Marvell Yukon 88E8053 Gigabit Ethernet
o Marvell Yukon 88E8055 Gigabit Ethernet
o Marvell Yukon 88E8056 Gigabit Ethernet
o D-Link 550SX Gigabit Ethernet
o D-Link 560T Gigabit Ethernet

Unlike OpenBSD/NetBSD msk(4), the msk(4) driver supports all hardware
features including TCP/UDP checksum offload for transmit, MSI, TCP
segmentation offload(TSO), hardware VLAN tag stripping/insertion,
and jumbo frames(up to 9022 bytes). The only unsupported hardware
feature except RLMT is Rx checksum offload which I don't know how to
make it work reliably.

Known Issues:
 It seems msk(4) does not work on the second port of dual port NIC.
 (The first port works without problems.)

Thanks to Marvell for releasing the BSD licensed myk(4) driver and
thanks to all users helped fixing bugs.

Tested by:	bz, philip, bms,
		YAMAMOTO Shigeru < shigeru AT iij DOT ad DOT jp >,
		Dmitry Pryanishnikov < dmitry AT atlantis DOT dp DOT ua >,
		Jia-Shiun Li < jiashiun AT gmail DOT com >,
		David Duchscher < daved AT tamu DOT edu >,
		Arno J. Klaassen < arno AT heho DOT snv DOT jussieu DOT fr>,
		Nicolae Namolovan < adrenalinup AT gmail DOT com>,
		Andre Guibert de Bruet < andy AT siliconlandmark DOT com >
		current ML
Tested on:	i386, amd64
2006-12-13 02:30:11 +00:00