The NetBSD Project

CVS log for src/sys/dev/pci/if_wm.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / dev / pci

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.508.4.48 / (download) - annotate - [select for diffs], Mon Jan 23 14:01:25 2023 UTC (5 days, 16 hours ago) by martin
Branch: netbsd-8
Changes since 1.508.4.47: +62 -47 lines
Diff to previous 1.508.4.47 (colored) to branchpoint 1.508 (colored) next main 1.509 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1795:

	sys/dev/pci/if_wm.c				1.764-1.767 via patch
	sys/dev/pci/if_wmreg.h				1.128

- Workaround for some hypervisor environments. The environments
  cannot stop e1000 interrupt immediately.
- Rename nq_txdesc' member "nqrx_ctx" to "nqtx_ctx". No functional
  change.
- Add comment. Modify comment.
- KNF.

Revision 1.645.2.15 / (download) - annotate - [select for diffs], Mon Jan 23 13:59:04 2023 UTC (5 days, 16 hours ago) by martin
Branch: netbsd-9
Changes since 1.645.2.14: +62 -47 lines
Diff to previous 1.645.2.14 (colored) to branchpoint 1.645 (colored) next main 1.646 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1578:

	sys/dev/pci/if_wm.c				1.764-1.767 via patch
	sys/dev/pci/if_wmreg.h				1.128

- Workaround for some hypervisor environments. The environments
  cannot stop e1000 interrupt immediately.
- Rename nq_txdesc' member "nqrx_ctx" to "nqtx_ctx". No functional
  change.
- Add comment. Modify comment.
- KNF.

Revision 1.767 / (download) - annotate - [select for diffs], Thu Dec 8 08:14:28 2022 UTC (7 weeks, 2 days ago) by knakahara
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.766: +13 -6 lines
Diff to previous 1.766 (colored)

Workaround for some hypervisor environments.

The environments cannot stop e1000 interrupt immediately.

Revision 1.766 / (download) - annotate - [select for diffs], Wed Oct 26 06:36:39 2022 UTC (3 months ago) by msaitoh
Branch: MAIN
Changes since 1.765: +7 -2 lines
Diff to previous 1.765 (colored)

Add comment to ICH/PCH's lock stuff in wm_reset().

Revision 1.765 / (download) - annotate - [select for diffs], Wed Oct 19 06:37:25 2022 UTC (3 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.764: +6 -6 lines
Diff to previous 1.764 (colored)

Fix typo. No functional change. OK'd by knakahara.

Revision 1.508.4.47 / (download) - annotate - [select for diffs], Thu Sep 8 10:29:36 2022 UTC (4 months, 3 weeks ago) by martin
Branch: netbsd-8
Changes since 1.508.4.46: +17 -17 lines
Diff to previous 1.508.4.46 (colored) to branchpoint 1.508 (colored)

Undo accidental whitespace changes from applying the patch for
ticket #1759 by applying a patch from msaitoh (NFC).

Revision 1.764 / (download) - annotate - [select for diffs], Thu Sep 8 02:40:10 2022 UTC (4 months, 3 weeks ago) by msaitoh
Branch: MAIN
CVS Tags: bouyer-sunxi-drm-base, bouyer-sunxi-drm
Changes since 1.763: +46 -43 lines
Diff to previous 1.763 (colored)

KNF. Modify comment. No fucntional change.

Revision 1.508.4.46 / (download) - annotate - [select for diffs], Wed Sep 7 10:09:20 2022 UTC (4 months, 3 weeks ago) by martin
Branch: netbsd-8
Changes since 1.508.4.45: +488 -93 lines
Diff to previous 1.508.4.45 (colored) to branchpoint 1.508 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1759:

	sys/dev/pci/if_wm.c				1.741-1.749,1.753-1.757,
							1.762 via patch
	sys/dev/pci/if_wmreg.h				1.126-1.127

- Fix I219 workaround in wm_flush_desc_rings().
- Add more statistics counters.
- To avoid releasing mutex temporally, use new
  wm_set_mdio_slow_mode_hv_locked().
- No functional changes:
  - Turn a locking botch (shouldn't drop lock on error) into a KASSERT
    in wm_deferred_start_locked().
  - Remove unneeded header inclusion.
  - Use __BIT() a little.
  - Modify comment and debug messages.
  - Consistency use -1 instead of 1 for some error code.
  - KNF.

Revision 1.645.2.14 / (download) - annotate - [select for diffs], Wed Sep 7 10:05:42 2022 UTC (4 months, 3 weeks ago) by martin
Branch: netbsd-9
Changes since 1.645.2.13: +552 -138 lines
Diff to previous 1.645.2.13 (colored) to branchpoint 1.645 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1515:

	sys/dev/pci/if_wm.c				1.741-1.749,
							1.753-1.757,
							1.762 via patch
	sys/dev/pci/if_wmreg.h				1.126-1.127

- Fix I219 workaround in wm_flush_desc_rings().
- Add more statistics counters.
- To avoid releasing mutex temporally, use new
  wm_set_mdio_slow_mode_hv_locked().
- No functional changes:
  - Turn a locking botch (shouldn't drop lock on error) into a KASSERT
    in wm_deferred_start_locked().
  - Remove unneeded header inclusion.
  - Use __BIT() a little.
  - Modify comment and debug messages.
  - Consistency use -1 instead of 1 for some error code.
  - KNF.

Revision 1.763 / (download) - annotate - [select for diffs], Fri Aug 12 10:59:42 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.762: +41 -94 lines
Diff to previous 1.762 (colored)

wm(4): Remove the non-MP-safe scaffolding.

- Where we had #ifndef WM_MPSAFE splnet(), we also had WM_CORE_LOCK,
  which implies splnet, so just remove the conditional splnet.

- Make the core lock unconditional and remove macro indirections.

- Pass CALLOUT_MPSAFE, SOFTINT_MPSAFE, and WQ_MPSAFE directly without
  macro indirections.

Revision 1.762 / (download) - annotate - [select for diffs], Fri Aug 12 10:58:45 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.761: +24 -12 lines
Diff to previous 1.761 (colored)

wm(4): Audit sc->phy.acquire and sc->nvm.acquire.

The return value must be used, because some of the acquire/release
pairs hold a mutex from acquire to release, and failing to call
release, or calling release twice, leads to an inconsistent state.

Revision 1.761 / (download) - annotate - [select for diffs], Fri Aug 12 10:58:21 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.760: +76 -21 lines
Diff to previous 1.760 (colored)

wm: use a workqueue to reset the interface when wm_watchdog determines it needs a reset.


Author: Nick Hudson <skrll@netbsd.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>

Revision 1.760 / (download) - annotate - [select for diffs], Fri Aug 12 10:57:06 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.759: +26 -9 lines
Diff to previous 1.759 (colored)

wm(4): if_flags and IFNET_LOCK audit

Don't touch if_flags without IFNET_LOCK:

- If only core lock is held, use sc_if_flags.
- If only txq lock is held, use txq_stopping.
  => Verified all paths guarantee !txq_stopping, so assert.
- Make sure sc_if_flags is updated on stop.
- Make wm_init fail once we enter wm_detach.
- Sprinkle assertions.


Author: Taylor R Campbell <riastradh@NetBSD.org>

Revision 1.759 / (download) - annotate - [select for diffs], Fri Aug 12 10:55:01 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.758: +7 -15 lines
Diff to previous 1.758 (colored)

wm(4): Revert previous -- mistakenly committed unsquashed change part.

Revision 1.758 / (download) - annotate - [select for diffs], Fri Aug 12 10:50:37 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.757: +17 -9 lines
Diff to previous 1.757 (colored)

wm(4): if_flags and IFNET_LOCK audit

Don't touch if_flags without IFNET_LOCK:

- If only core lock is held, use sc_if_flags.
- If only txq lock is held, use txq_stopping.
  => Verified all paths guarantee !txq_stopping, so assert.
- Make sure sc_if_flags is updated on stop.
- Sprinkle assertions.

Revision 1.757 / (download) - annotate - [select for diffs], Mon Aug 8 08:55:42 2022 UTC (5 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.756: +29 -9 lines
Diff to previous 1.756 (colored)

To avoid releasing mutex temporally, use new wm_set_mdio_slow_mode_hv_locked().

Revision 1.756 / (download) - annotate - [select for diffs], Mon Aug 8 08:52:36 2022 UTC (5 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.755: +9 -9 lines
Diff to previous 1.755 (colored)

Consistency use -1 instead of 1 for some error code. Advised by knakahara.

Revision 1.755 / (download) - annotate - [select for diffs], Mon Aug 8 07:49:18 2022 UTC (5 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.754: +5 -4 lines
Diff to previous 1.754 (colored)

Pass an error code correctly if phy.acquire() failed.

This is not a real bug because the return value is not used.

Revision 1.754 / (download) - annotate - [select for diffs], Mon Aug 8 07:44:40 2022 UTC (5 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.753: +84 -61 lines
Diff to previous 1.753 (colored)

Pass an error code to the upper layer instead of -1. Advised by knakahara.

Revision 1.753 / (download) - annotate - [select for diffs], Mon Aug 8 05:45:29 2022 UTC (5 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.752: +4 -4 lines
Diff to previous 1.752 (colored)

Modify debug messages so that we can determine where it happened.

Revision 1.752 / (download) - annotate - [select for diffs], Fri Aug 5 05:50:54 2022 UTC (5 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.751: +5 -5 lines
Diff to previous 1.751 (colored)

Sprinkle const on splfoo call results.

Revision 1.751 / (download) - annotate - [select for diffs], Wed Aug 3 05:29:04 2022 UTC (5 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.750: +18 -10 lines
Diff to previous 1.750 (colored)

Add a KASSERT for the locking protocol in wm_ioctl.

Read the interface up/down status from sc_if_flags (under WM_CORE_LOCK)
when deciding if the multicast filter needs to be updated.

Discussed with msaitoh@, knakahara@ and riastradh@

Revision 1.750 / (download) - annotate - [select for diffs], Wed Aug 3 05:23:30 2022 UTC (5 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.749: +15 -4 lines
Diff to previous 1.749 (colored)

Add some KASSERTs around the locking protocol.

Discussed with msaitoh@, knakahara@ and riastradh@

Revision 1.749 / (download) - annotate - [select for diffs], Fri Jul 29 15:30:42 2022 UTC (6 months ago) by skrll
Branch: MAIN
Changes since 1.748: +4 -4 lines
Diff to previous 1.748 (colored)

Improve a couple of comments

Revision 1.748 / (download) - annotate - [select for diffs], Fri Jul 29 15:29:07 2022 UTC (6 months ago) by skrll
Branch: MAIN
Changes since 1.747: +3 -3 lines
Diff to previous 1.747 (colored)

Trailing whitespace

Revision 1.747 / (download) - annotate - [select for diffs], Thu Jul 28 09:22:25 2022 UTC (6 months ago) by skrll
Branch: MAIN
Changes since 1.746: +3 -3 lines
Diff to previous 1.746 (colored)

KNF the KNF

Revision 1.746 / (download) - annotate - [select for diffs], Fri Jul 22 05:23:50 2022 UTC (6 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.745: +390 -28 lines
Diff to previous 1.745 (colored)

Add more statistics countes.

 - Add many statics counters that the chip has.
 - Attach event counters only if available.

Revision 1.745 / (download) - annotate - [select for diffs], Tue Jul 19 08:22:34 2022 UTC (6 months, 1 week ago) by riastradh
Branch: MAIN
Changes since 1.744: +3 -4 lines
Diff to previous 1.744 (colored)

wm(4): Use CSR_WRITE_FLUSH, not bus_space_barrier.

The bus space is mapped non-prefetchable and non-cacheable, so there
is no need for bus_space_barrier and it might not even have any
effect -- bus_space_read/write are totally ordered for non-
prefetchable, non-cacheable mappings anyway.  Presumably the intent
here was to wait for acknowledgment of the write from the device --
which bus_space_barrier does not guarantee, and which I expect
requires a read transaction as CSR_WRITE_FLUSH performs.

ok msaitoh@, knakahara@

Revision 1.744 / (download) - annotate - [select for diffs], Tue Jul 19 08:21:02 2022 UTC (6 months, 1 week ago) by riastradh
Branch: MAIN
Changes since 1.743: +4 -4 lines
Diff to previous 1.743 (colored)

wm(4): Use bus_dmamap_sync, not bus_space_barrier, for tx desc.

The newly written tx descriptor needs to be visible to the device
before the TDT register is set.  There's no bus space mappings that
need any barriers, though -- nothing mapped prefetchable or cacheable
here.  So bus_dmamap_sync (via wm_cdtxsync) is necessary, not
bus_space_barrier.  By accident, bus_space_barrier implies the same
barrier instructions as bus_dmamap_sync on some architectures, but it
wouldn't work at all if we were bouncing.

ok msaitoh@, knakahara@

Revision 1.743 / (download) - annotate - [select for diffs], Tue Jul 19 06:50:34 2022 UTC (6 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.742: +15 -15 lines
Diff to previous 1.742 (colored)

KNF

Revision 1.742 / (download) - annotate - [select for diffs], Tue Jul 19 06:47:34 2022 UTC (6 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.741: +2 -3 lines
Diff to previous 1.741 (colored)

Don't need sys/malloc.h so remove the #include

Revision 1.741 / (download) - annotate - [select for diffs], Tue Jul 19 06:46:29 2022 UTC (6 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.740: +3 -7 lines
Diff to previous 1.740 (colored)

Turn a locking botch (shouldn't drop lock on error) into a KASSERT

Revision 1.508.4.45 / (download) - annotate - [select for diffs], Mon Jul 11 14:15:57 2022 UTC (6 months, 2 weeks ago) by martin
Branch: netbsd-8
Changes since 1.508.4.44: +181 -153 lines
Diff to previous 1.508.4.44 (colored) to branchpoint 1.508 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1751:

	sys/dev/pci/if_wmreg.h				1.122-1.125 via patch
	sys/dev/pci/if_wmvar.h				1.48
	sys/dev/pci/if_wm.c				1.719-1.720,1.722-1.725,
							1.727-1.740 via patch

- wm_tick: Add missing splx(s) when not WM_MPSAFE.
- Print DMA range info if the system is booting in the verbose mode.
- Micro optimization:
  - Call m_freem(m) only if m0 == NULL.
  - Call wm_xxeof() only when limit > 0.
  - Don't set the more flag when there is no packet to process.
- No functional changes:
  - Call txeof first, then rxeof for the consistency.
  - Remove duplicated break.
  - Remove stray semicolons from struct declaration.
  - Fix value return from void function.
  - Use macros.
  - Modify comment.
  - KNF.

Revision 1.645.2.13 / (download) - annotate - [select for diffs], Mon Jul 11 14:10:18 2022 UTC (6 months, 2 weeks ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE
Changes since 1.645.2.12: +185 -155 lines
Diff to previous 1.645.2.12 (colored) to branchpoint 1.645 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1477:

	sys/dev/pci/if_wmreg.h				1.122-1.125
	sys/dev/pci/if_wmvar.h				1.48
	sys/dev/pci/if_wm.c				1.719-1.720,
							1.722-1.725,
							1.727-1.740 via patch

- wm_tick: Add missing splx(s) when not WM_MPSAFE.
- Print DMA range info if the system is booting in the verbose mode.
- Micro optimization:
  - Call m_freem(m) only if m0 == NULL.
  - Call wm_xxeof() only when limit > 0.
  - Don't set the more flag when there is no packet to process.
- No functional changes:
  - Call txeof first, then rxeof for the consistency.
  - Remove duplicated break.
  - Remove stray semicolons from struct declaration.
  - Fix value return from void function.
  - Use macros.
  - Modify comment.
  - KNF.

Revision 1.740 / (download) - annotate - [select for diffs], Mon Jul 11 06:16:23 2022 UTC (6 months, 2 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.739: +50 -43 lines
Diff to previous 1.739 (colored)

KNF. No functional change.

Revision 1.739 / (download) - annotate - [select for diffs], Mon Jul 11 06:15:27 2022 UTC (6 months, 2 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.738: +25 -25 lines
Diff to previous 1.738 (colored)

Consistently use semicolon. No functional change.

Revision 1.738 / (download) - annotate - [select for diffs], Wed Jul 6 06:33:49 2022 UTC (6 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.737: +25 -24 lines
Diff to previous 1.737 (colored)

Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The MSI-X
interrupt function and the workqueue function call rxeof first, then rxeof.
For legacy interrupt. rxeof is called first. Modify it to match with other
two.

Revision 1.737 / (download) - annotate - [select for diffs], Wed Jul 6 05:49:46 2022 UTC (6 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.736: +5 -4 lines
Diff to previous 1.736 (colored)

Fix compile error if WM_DEBUG is set.

Revision 1.736 / (download) - annotate - [select for diffs], Mon Jul 4 15:09:12 2022 UTC (6 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.735: +4 -3 lines
Diff to previous 1.735 (colored)

Be less tautological and more explanatory in a comment.

Revision 1.735 / (download) - annotate - [select for diffs], Sat Jul 2 06:10:29 2022 UTC (6 months, 4 weeks ago) by skrll
Branch: MAIN
Changes since 1.734: +6 -6 lines
Diff to previous 1.734 (colored)

Use PRIxBIT instead of casts

Revision 1.734 / (download) - annotate - [select for diffs], Sat Jul 2 06:09:37 2022 UTC (6 months, 4 weeks ago) by skrll
Branch: MAIN
Changes since 1.733: +5 -2 lines
Diff to previous 1.733 (colored)

wm_tick: Add missing splx(s) when not WM_MPSAFE

Revision 1.733 / (download) - annotate - [select for diffs], Thu May 19 02:23:59 2022 UTC (8 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.732: +18 -18 lines
Diff to previous 1.732 (colored)

Don't set the more flag when there is no packet to process.

 Move the location of the loop limit check next to the DD bit test. This
change prevent from scheduling the next txrx_work that does nothing.

Revision 1.732 / (download) - annotate - [select for diffs], Thu May 19 02:22:59 2022 UTC (8 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.731: +26 -14 lines
Diff to previous 1.731 (colored)

Call wm_xxeof() only when limit > 0.

 It's not required to call wm_xxeof() when limit == 0. It means that
all xxeof processing will be done by softint or workqueue. Currently,
wm_xxeof() returns quickly before checking the descriptor head when
limit == 0 and return with ture to set the more flag.

Revision 1.731 / (download) - annotate - [select for diffs], Tue May 17 00:02:57 2022 UTC (8 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.730: +8 -6 lines
Diff to previous 1.730 (colored)

Call m_freem(m) only if m0 == NULL.

Revision 1.730 / (download) - annotate - [select for diffs], Tue May 3 00:23:33 2022 UTC (8 months, 3 weeks ago) by gutteridge
Branch: MAIN
Changes since 1.729: +29 -29 lines
Diff to previous 1.729 (colored)

if_wm.c: various spelling and grammar fixes

Revision 1.729 / (download) - annotate - [select for diffs], Sat Feb 26 15:04:39 2022 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.728: +6 -4 lines
Diff to previous 1.728 (colored)

if_wm.c: fix value return from void function

lint complained:
if_wm.c(10028): error:
    void function wm_txrxintr_disable cannot return value [213]
if_wm.c(10049): error:
    void function wm_txrxintr_enable cannot return value [213]

No functional change.

Revision 1.728 / (download) - annotate - [select for diffs], Sat Feb 26 14:53:05 2022 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.727: +6 -6 lines
Diff to previous 1.727 (colored)

if_wm.c: remove stray semicolons from struct declaration

C99 does not allow 'struct { int member;; }'.

No binary change.

Revision 1.727 / (download) - annotate - [select for diffs], Wed Feb 16 03:15:27 2022 UTC (11 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.726: +2 -3 lines
Diff to previous 1.726 (colored)

Remove duplicated break. No functional change.

Revision 1.726 / (download) - annotate - [select for diffs], Fri Dec 31 14:25:23 2021 UTC (12 months, 4 weeks ago) by riastradh
Branch: MAIN
Changes since 1.725: +3 -3 lines
Diff to previous 1.725 (colored)

sys: Use if_init wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.

Revision 1.725 / (download) - annotate - [select for diffs], Thu Dec 23 17:05:49 2021 UTC (13 months ago) by hannken
Branch: MAIN
Changes since 1.724: +4 -4 lines
Diff to previous 1.724 (colored)

Keep constants 32 bit, why does __BIT() return uintmax_t?

Revision 1.724 / (download) - annotate - [select for diffs], Mon Dec 20 13:19:09 2021 UTC (13 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.723: +7 -4 lines
Diff to previous 1.723 (colored)

aprint_verbose the DMA range used.

Revision 1.723 / (download) - annotate - [select for diffs], Mon Dec 20 12:56:25 2021 UTC (13 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.722: +3 -3 lines
Diff to previous 1.722 (colored)

whitespace in a comment

Revision 1.722 / (download) - annotate - [select for diffs], Sat Dec 11 17:05:50 2021 UTC (13 months, 2 weeks ago) by skrll
Branch: MAIN
Changes since 1.721: +3 -3 lines
Diff to previous 1.721 (colored)

Typo in comment

Revision 1.721 / (download) - annotate - [select for diffs], Fri Dec 10 05:55:06 2021 UTC (13 months, 2 weeks ago) by skrll
Branch: MAIN
Changes since 1.720: +4 -7 lines
Diff to previous 1.720 (colored)

Simplify.  Same code before and after.

Revision 1.720 / (download) - annotate - [select for diffs], Fri Dec 10 05:39:22 2021 UTC (13 months, 2 weeks ago) by skrll
Branch: MAIN
Changes since 1.719: +9 -9 lines
Diff to previous 1.719 (colored)

Trailing whitespace

Revision 1.719 / (download) - annotate - [select for diffs], Sun Dec 5 04:32:36 2021 UTC (13 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.718: +3 -3 lines
Diff to previous 1.718 (colored)

s/checkum/checksum/ in comment.

Revision 1.508.4.44 / (download) - annotate - [select for diffs], Sat Nov 20 15:11:31 2021 UTC (14 months, 1 week ago) by martin
Branch: netbsd-8
Changes since 1.508.4.43: +115 -18 lines
Diff to previous 1.508.4.43 (colored) to branchpoint 1.508 (colored)

Pull up the following, requested by msaitoh in ticket #1707:

	sys/dev/pci/if_wm.c				1.716-1.718 via patch
	sys/dev/pci/if_wmreg.h				1.121
	sys/dev/mii/ihphy.c				1.20

- Fix a bug that device timeout still happens when the link is down
  on ICH/PCH. Fixes PR kern/56478.
- Add some sysctl info for debugging.
- ihphy(4): Don't power down the PHY when the interface goes down.
- Use macro. Fix comment.

Revision 1.645.2.12 / (download) - annotate - [select for diffs], Sat Nov 20 14:59:04 2021 UTC (14 months, 1 week ago) by martin
Branch: netbsd-9
Changes since 1.645.2.11: +115 -18 lines
Diff to previous 1.645.2.11 (colored) to branchpoint 1.645 (colored)

Pull up the following, requested by msaitoh in ticket #1373:

	sys/dev/pci/if_wm.c				1.716-1.718 via patch
	sys/dev/pci/if_wmreg.h				1.121
	sys/dev/mii/ihphy.c				1.20

- Fix a bug that device timeout still happens when the link is down
  on ICH/PCH. Fixes PR kern/56478.
- Add some sysctl info for debugging.
- ihphy(4): Don't power down the PHY when the interface goes down.
- Use macro. Fix comment.

Revision 1.718 / (download) - annotate - [select for diffs], Fri Nov 5 05:52:49 2021 UTC (14 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.717: +30 -14 lines
Diff to previous 1.717 (colored)

Fix a bug that device timeout still happens on ICH/PCH. Fixes PR kern/56478.

 - if_wm.c rev. 1.695 for PR kern/40981 still had a problem. The workaround
   flag was unexpectedly cleared when a cable is not connected, SIOCINITIFADDR
   was called, or if_init was called. Fix it.
 - Add debug printf()s.

Revision 1.717 / (download) - annotate - [select for diffs], Fri Nov 5 01:49:14 2021 UTC (14 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.716: +4 -4 lines
Diff to previous 1.716 (colored)

 Use macro. No functional change.

Revision 1.716 / (download) - annotate - [select for diffs], Thu Nov 4 12:25:05 2021 UTC (14 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.715: +84 -3 lines
Diff to previous 1.715 (colored)

Add some sysctl info for debugging.

Revision 1.508.4.43 / (download) - annotate - [select for diffs], Sat Oct 23 11:49:22 2021 UTC (15 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.42: +523 -341 lines
Diff to previous 1.508.4.42 (colored) to branchpoint 1.508 (colored)

Pull up the following, requested by msaitoh in ticket #1701:

	share/man/man4/wm.4				1.42
	sys/dev/pci/files.pci				1.434
	sys/dev/pci/if_wm.c				1.686-1.687,1.692-1.693,
							1.697,1.699-1.703,
							1.706-1.715 via patch
	sys/dev/pci/if_wmvar.h				1.46

- Add missing drain for pcq in wm_stop_locked().
- Add support for I219V 15-19 and I219LM 16-19.
- Fix Tx stall.
- Use wm_flush_desc_rings() workaround more on I219.
- Change DMA physical address in wm_flush_desc_rings() to match other
  OSes.
- Check return value correctly in wm_lv_jumbo_workaround_ich8lan().
- Add new sysctl hw.wmN.debug_flags. This sysctl can be used if
  WM_DEBUG is set.
- Add some sysctl values for debugging TX/RX queues.
- WM_EVENT_COUNTER is enabled by default on 64 bit architectures.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxq->rxq_ptr updating.
- Stop legacy interrupts before calling softint.
- Disable printf()s in wm_flush_desc_rings() because the code is
  verified.
- Print I219's version number.
- Uniform INTx/MSI handler's Tx/Rx behavior to MSI-X's one.
- Fix return value of interrupt handler.
- Only print an error about missing I/O BARs for chips that need it.
- Do not return a void value from a void function.
- Add new flag named WM_F_CRC_STRIP and use it. No functional change.
- Whitespace fixes. Fix comments. No functional change.

Revision 1.645.2.11 / (download) - annotate - [select for diffs], Thu Oct 21 14:30:10 2021 UTC (15 months, 1 week ago) by martin
Branch: netbsd-9
Changes since 1.645.2.10: +511 -319 lines
Diff to previous 1.645.2.10 (colored) to branchpoint 1.645 (colored)

Pull up the following, requested by msaitoh in ticket #1363:

	share/man/man4/wm.4			1.42
	sys/dev/pci/files.pci			1.434
	sys/dev/pci/if_wm.c			1.690,1.692-1.693,1.697-1.704,
						1.706-1.715 via patch

- Add missing drain for pcq in wm_stop_locked().
- Add support for I219V 15-19 and I219LM 16-19.
- Fix Tx stall.
- Use wm_flush_desc_rings() workaround more on I219.
- Change DMA physical address in wm_flush_desc_rings() to match other
  OSes.
- Check return value correctly in wm_lv_jumbo_workaround_ich8lan().
- Add new sysctl hw.wmN.debug_flags. This sysctl can be used if
  WM_DEBUG is set.
- Add some sysctl values for debugging TX/RX queues.
- Use atomic_{load,store}_relaxed for evcnt 64 bit counter.
- WM_EVENT_COUNTER is enabled by default on 64 bit architectures.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxq->rxq_ptr updating.
- Stop legacy interrupts before calling softint.
- Disable printf()s in wm_flush_desc_rings() because the code is
  verified.
- Print I219's version number.
- Uniform INTx/MSI handler's Tx/Rx behavior to MSI-X's one.
- Fix return value of interrupt handler.
- Only print an error about missing I/O BARs for chips that need it.
- Do not return a void value from a void function.
- Fix comment.
- Whitespace fixes. No functional change.

Revision 1.715 / (download) - annotate - [select for diffs], Wed Oct 20 08:10:26 2021 UTC (15 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.714: +8 -4 lines
Diff to previous 1.714 (colored)

Use wm_flush_desc_rings() more.

 - Use wm_flush_desc_rings() for newer than PCH_SPT, too. Same as other OSes.
   It seems that some devices has no this errata, but we don't know how to
   identify it. So just use >= PCH_SPT.
 - Use wm_flush_desc_rings() before chip reset in wm_resume(), too.

Revision 1.714 / (download) - annotate - [select for diffs], Wed Oct 20 08:06:45 2021 UTC (15 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.713: +7 -4 lines
Diff to previous 1.713 (colored)

Disable printf()s in wm_flush_desc_rings() because the code is verified.

 The problem was very rare, so I added those printf()s as we can see.
Last week, knakahara and I found a procedure to reproduce the problem and
verified it worked correctly.

 To reproduce the problem:

 0) Use I219 V1 to V5. Not all of them have the problem and newer than V5 may
    have the problem. I used V2 for the test.
 1) Define WM_DEBUG or add printf in wm_flush_desc_rings() to see
    DESCRING_STATUS_FLUSH_REQ bit.
 2) Run "iperf -s" on the DUT.
 3) Run "iperf3 -R -u -c 192.168.1.110 -w 8m -b 1g" repeatedly on another
    machine. Note that kern.sbmax should be increased on both machines.
 4) run
 	while true; do
	ifconfig wm0 down up
	sleep 30
	done
 5) After DESCRING_STATUS_FLUSH_REQ is set, without wm_flush_desc_rings(),
    TX stalls and reboot is required to recover from it.
    With wm_flush_desc_rings(), no device hang.
 6) If you can't see the DESCRING_STATUS_FLUSH_REQ is set, change the media
    to 100BASE-T.

 Note that if_wm.c rev. 1.710 originally written by chuq is required for the
test. Without the change, the device becomes unrecoverable state before
wm_flush_desc_rings() and the function doesn't recover from the problem.

Revision 1.713 / (download) - annotate - [select for diffs], Wed Oct 20 08:02:07 2021 UTC (15 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.712: +24 -7 lines
Diff to previous 1.712 (colored)

Change DMA physical address in wm_flush_desc_rings() to match other OSes.

 - Even without this change, the workaround works with my machines.
 - Add comment.

Revision 1.712 / (download) - annotate - [select for diffs], Wed Oct 20 07:04:28 2021 UTC (15 months, 1 week ago) by knakahara
Branch: MAIN
Changes since 1.711: +7 -7 lines
Diff to previous 1.711 (colored)

Fix return value of interrupt handler, pointed out by msaitoh@n.o.

Even if stopping flag is set (and handler do nothing), the interrupt
itself should be assume to be processed when ICR is not zero.  If not,
interrupt count is not incremented correctly.

Revision 1.711 / (download) - annotate - [select for diffs], Wed Oct 20 02:12:36 2021 UTC (15 months, 1 week ago) by knakahara
Branch: MAIN
Changes since 1.710: +61 -64 lines
Diff to previous 1.710 (colored)

Uniform INTx/MSI handler's Tx/Rx behavior to MSI-X's one.

Because the difference has caused INTx/MSI own bugs.

Revision 1.710 / (download) - annotate - [select for diffs], Wed Oct 20 02:05:15 2021 UTC (15 months, 1 week ago) by knakahara
Branch: MAIN
Changes since 1.709: +5 -2 lines
Diff to previous 1.709 (colored)

Fix Tx stall, reported and implemented original patch by chs@n.o, thanks.

Check if_snd queue because if.c::if_transmit() doesn't call ifp->if_start()
when IFQ_ENQUEUE failed.

Reviewed and tested by chs@n.o and msaitoh@n.o.

Revision 1.709 / (download) - annotate - [select for diffs], Mon Oct 18 11:36:11 2021 UTC (15 months, 1 week ago) by jmcneill
Branch: MAIN
Changes since 1.708: +11 -4 lines
Diff to previous 1.708 (colored)

Only print an error about missing I/O BARs for chips that need it.

Revision 1.708 / (download) - annotate - [select for diffs], Wed Oct 13 08:12:36 2021 UTC (15 months, 2 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.707: +29 -2 lines
Diff to previous 1.707 (colored)

Add support for I219V 15-19 and I219LM 16-19.

Revision 1.707 / (download) - annotate - [select for diffs], Wed Oct 13 08:09:46 2021 UTC (15 months, 2 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.706: +28 -28 lines
Diff to previous 1.706 (colored)

Print I219's version number.

Revision 1.706 / (download) - annotate - [select for diffs], Tue Aug 3 01:08:18 2021 UTC (17 months, 3 weeks ago) by knakahara
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-futex2-base, thorpej-futex2
Changes since 1.705: +29 -5 lines
Diff to previous 1.705 (colored)

Fix locking against myself reported by rin@n.o.

In some machine, INTx interrupts occurs for some reason while holding
txq_lock in softint context.
e.g. https://dmesgd.nycbug.org/index.cgi?do=view&id=6139

The panic message is the following.
====================
[  50.1699480] panic: LOCKDEBUG: Mutex error: mutex_vector_enter,467: locking against myself
[  50.1800188] cpu0: Begin traceback...
[  50.1800188] 0xc7a29ac4: netbsd:db_panic+0xc
[  50.1900018] 0xc7a29adc: netbsd:vpanic+0x120
[  50.1999533] 0xc7a29af4: netbsd:aprint_debug
[  50.1999533] 0xc7a29b34: netbsd:lockdebug_abort1+0x18c
[  50.2099719] 0xc7a29b74: netbsd:lockdebug_wantlock+0x1e8
[  50.2199525] 0xc7a29bb4: netbsd:mutex_enter+0x288
[  50.2299642] 0xc7a29be4: netbsd:wm_intr_legacy+0x9c
[  50.2299642] 0xc7a29c2c: netbsd:i80321_intr_dispatch+0x138
[  50.2399631] 0xc7a29de4: netbsd:irq_entry+0x98
[  50.2499452] 0xc7a29e24: netbsd:entropy_enter+0x88
[  50.2599996] 0xc7a29e6c: netbsd:rnd_add_data_1+0x50
[  50.2699565] 0xc7a29ebc: netbsd:rnd_add_data+0x10c
[  50.2699565] 0xc7a29ed4: netbsd:rnd_add_uint32+0x28
[  50.2799524] 0xc7a29f1c: netbsd:wm_txeof+0x2c0
[  50.2899527] 0xc7a29f5c: netbsd:wm_handle_queue+0x44
[  50.3000257] 0xc7a29fac: netbsd:softint_thread+0x130
[  50.3100119] cpu0: End traceback...
====================

To fix this panic, stop wm(4) interrupts before calling softint.
This behavior is similar to MSI-X polling mode.

Reviewed by msaitoh@n.o, tested by rin@n.o, thanks.

Revision 1.702.4.2 / (download) - annotate - [select for diffs], Thu Jun 17 04:46:29 2021 UTC (19 months, 1 week ago) by thorpej
Branch: thorpej-i2c-spi-conf
Changes since 1.702.4.1: +3 -8 lines
Diff to previous 1.702.4.1 (colored) to branchpoint 1.702 (colored) next main 1.703 (colored)

Sync w/ HEAD.

Revision 1.705 / (download) - annotate - [select for diffs], Wed Jun 16 00:21:18 2021 UTC (19 months, 2 weeks ago) by riastradh
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf-base, thorpej-cfargs2-base, thorpej-cfargs2
Changes since 1.704: +3 -8 lines
Diff to previous 1.704 (colored)

if_attach and if_initialize cannot fail, don't test return value

These were originally made failable back in 2017 when if_initialize
allocated a softint in every interface for link state changes, so
that it could fail gracefully instead of panicking:

https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html

However, this spawned many seldom- or never-tested error branches,
which are risky to have around.  And that softint in every interface
has since been replaced by a single global workqueue, because link
state changes require thread context but not low latency or high
throughput:

https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html

So there is no longer any reason for if_initialize to fail.  (The
subroutine if_stats_init can't fail because percpu_alloc can't fail
either.)

There is a snag: the softint_establish in if_percpuq_create could
fail, potentially leading to bad consequences later on trying to use
the softint.  This change doesn't introduce any new bugs because of
the snag -- if_percpuq_attach was already broken.  However, the snag
can be better addressed without spawning error branches, either by
using a single softint or making softints less scarce.

(Separate commit will change the signatures of if_attach and
if_initialize to return void, scheduled to ride whatever is the next
convenient kernel bump.)

Patch and testing on amd64 and evbmips64-eb by maya@; commit message
soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.

Revision 1.703.2.1 / (download) - annotate - [select for diffs], Mon May 31 22:15:18 2021 UTC (19 months, 4 weeks ago) by cjep
Branch: cjep_staticlib_x
Changes since 1.703: +10 -2 lines
Diff to previous 1.703 (colored) next main 1.704 (colored)

sync with head

Revision 1.702.4.1 / (download) - annotate - [select for diffs], Thu May 13 00:47:31 2021 UTC (20 months, 2 weeks ago) by thorpej
Branch: thorpej-i2c-spi-conf
Changes since 1.702: +11 -3 lines
Diff to previous 1.702 (colored)

Sync with HEAD.

Revision 1.704 / (download) - annotate - [select for diffs], Wed May 12 10:16:12 2021 UTC (20 months, 2 weeks ago) by knakahara
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1
Changes since 1.703: +10 -2 lines
Diff to previous 1.703 (colored)

Fix i386 build failure with options WM_EVENT_COUNTERS.

pointed out by msaitoh@n.o.

Revision 1.703 / (download) - annotate - [select for diffs], Mon May 3 07:43:31 2021 UTC (20 months, 3 weeks ago) by rillig
Branch: MAIN
CVS Tags: cjep_staticlib_x-base
Branch point for: cjep_staticlib_x
Changes since 1.702: +3 -3 lines
Diff to previous 1.702 (colored)

if_wm: do not return a void value from a void function

This is a GCC extension.

Revision 1.694.2.2 / (download) - annotate - [select for diffs], Sat Apr 3 22:28:46 2021 UTC (21 months, 3 weeks ago) by thorpej
Branch: thorpej-futex
Changes since 1.694.2.1: +30 -34 lines
Diff to previous 1.694.2.1 (colored) next main 1.695 (colored)

Sync with HEAD.

Revision 1.702 / (download) - annotate - [select for diffs], Thu Mar 11 01:23:33 2021 UTC (22 months, 2 weeks ago) by msaitoh
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-cfargs-base, thorpej-cfargs
Branch point for: thorpej-i2c-spi-conf
Changes since 1.701: +16 -17 lines
Diff to previous 1.701 (colored)

Whitespace fixes. No functional change.

Revision 1.701 / (download) - annotate - [select for diffs], Mon Mar 1 04:50:17 2021 UTC (22 months, 4 weeks ago) by knakahara
Branch: MAIN
Changes since 1.700: +3 -9 lines
Diff to previous 1.700 (colored)

Refactor rxq->rxq_ptr updating.

Revision 1.700 / (download) - annotate - [select for diffs], Mon Mar 1 04:49:11 2021 UTC (22 months, 4 weeks ago) by knakahara
Branch: MAIN
Changes since 1.699: +3 -10 lines
Diff to previous 1.699 (colored)

Remove extra unlock/lock processing around if_percpuq_enqueue().

This temporary unlock/lock processing was required for direct calling
ifp->if_input.  After r1.391, wm(4) uses if_percpuq_enqueue() and it
does not hold any mutexes.

Revision 1.699 / (download) - annotate - [select for diffs], Wed Feb 17 08:15:43 2021 UTC (23 months, 1 week ago) by knakahara
Branch: MAIN
Changes since 1.698: +8 -2 lines
Diff to previous 1.698 (colored)

In 64 bit architectures, WM_EVENT_COUNTER is enabled by default.

No objection from tech-kern@n.o and tech-net@n.o.

ok'ed by msaitoh@n.o.

Revision 1.698 / (download) - annotate - [select for diffs], Wed Feb 17 08:10:33 2021 UTC (23 months, 1 week ago) by knakahara
Branch: MAIN
Changes since 1.697: +8 -4 lines
Diff to previous 1.697 (colored)

wm(4) use atomic_{load,store}_relaxed for evcnt 64 bit counter.

ok'ed by msaitoh@n.o.

Revision 1.694.2.1 / (download) - annotate - [select for diffs], Mon Dec 14 14:38:06 2020 UTC (2 years, 1 month ago) by thorpej
Branch: thorpej-futex
Changes since 1.694: +161 -9 lines
Diff to previous 1.694 (colored)

Sync w/ HEAD.

Revision 1.697 / (download) - annotate - [select for diffs], Thu Nov 19 02:36:30 2020 UTC (2 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.696: +39 -4 lines
Diff to previous 1.696 (colored)

 Add some sysctl values for debugging TX/RX queues.

Revision 1.645.2.10 / (download) - annotate - [select for diffs], Mon Nov 16 18:21:45 2020 UTC (2 years, 2 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-2-RELEASE
Changes since 1.645.2.9: +10 -6 lines
Diff to previous 1.645.2.9 (colored) to branchpoint 1.645 (colored)

Pull up following revision(s) (requested by rin in ticket #1133):

	sys/dev/pci/if_wm.c: revision 1.696

Fix little-endian dependence in wm_rxeof(), by which packets cannot be
received by 82574 and successors on big-endian machines.

Tested by aarch64eb with I210-T1 on ROCKPro64.

Thanks msaitoh for discussion!
XXX
pullup to netbsd-9 and netbsd-8

Revision 1.508.4.42 / (download) - annotate - [select for diffs], Mon Nov 16 18:18:14 2020 UTC (2 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.41: +10 -6 lines
Diff to previous 1.508.4.41 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by rin in ticket #1623):

	sys/dev/pci/if_wm.c: revision 1.696

Fix little-endian dependence in wm_rxeof(), by which packets cannot be
received by 82574 and successors on big-endian machines.

Tested by aarch64eb with I210-T1 on ROCKPro64.

Thanks msaitoh for discussion!
XXX
pullup to netbsd-9 and netbsd-8

Revision 1.696 / (download) - annotate - [select for diffs], Mon Nov 16 11:54:10 2020 UTC (2 years, 2 months ago) by rin
Branch: MAIN
Changes since 1.695: +10 -6 lines
Diff to previous 1.695 (colored)

Fix little-endian dependence in wm_rxeof(), by which packets cannot be
received by 82574 and successors on big-endian machines.

Tested by aarch64eb with I210-T1 on ROCKPro64.

Thanks msaitoh for discussion!

XXX
pullup to netbsd-9 and netbsd-8

Revision 1.508.4.41 / (download) - annotate - [select for diffs], Wed Nov 4 11:51:57 2020 UTC (2 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.40: +120 -4 lines
Diff to previous 1.508.4.40 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #1620):

	sys/dev/pci/if_wm.c: revision 1.694
	sys/dev/pci/if_wm.c: revision 1.695 (via patch)
	sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]

Revision 1.645.2.9 / (download) - annotate - [select for diffs], Wed Nov 4 11:48:26 2020 UTC (2 years, 2 months ago) by martin
Branch: netbsd-9
Changes since 1.645.2.8: +120 -4 lines
Diff to previous 1.645.2.8 (colored) to branchpoint 1.645 (colored)

Pull up following revision(s) (requested by knakahara in ticket #1126):

	sys/dev/pci/if_wm.c: revision 1.694
	sys/dev/pci/if_wm.c: revision 1.695 (via patch)
	sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]

Revision 1.695 / (download) - annotate - [select for diffs], Mon Nov 2 09:21:50 2020 UTC (2 years, 2 months ago) by knakahara
Branch: MAIN
Changes since 1.694: +116 -3 lines
Diff to previous 1.694 (colored)

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).

These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981

Reviewed and tested by msaitoh@n.o, thanks.

XXX pullup-[89]

Revision 1.694 / (download) - annotate - [select for diffs], Fri Oct 30 06:29:47 2020 UTC (2 years, 2 months ago) by msaitoh
Branch: MAIN
Branch point for: thorpej-futex
Changes since 1.693: +6 -3 lines
Diff to previous 1.693 (colored)

Add WMPHY_I350. Not used yet.

Revision 1.693 / (download) - annotate - [select for diffs], Fri Oct 30 06:23:39 2020 UTC (2 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.692: +247 -181 lines
Diff to previous 1.692 (colored)

 Add new sysctl hw.wmN.debug_flags. This sysctl can be used if WM_DEBUG is set.
OK'd by knakahara.

% sysctl -d hw.wm0.debug_flags
hw.wm0.debug_flags: Debug flags:
        0x01 LINK
        0x02 TX
        0x04 RX
        0x08 GMII
        0x10 MANAGE
        0x20 NVM
        0x40 INIT
        0x80 LOCK

Revision 1.692 / (download) - annotate - [select for diffs], Wed Oct 28 07:08:08 2020 UTC (2 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.691: +7 -2 lines
Diff to previous 1.691 (colored)

 Add missing drain for pcq in wm_stop_locked(). OK'd by knakahara.

This change fixes two problems:
 1. If the pcq is full and watchdog timer is fired, the full state of the
    pcq is kept and wm_transmit() returns with ENOBUFS.
 2. ifconfig down doesn't free mbufs in the pcq.

Revision 1.508.4.40 / (download) - annotate - [select for diffs], Fri Oct 16 08:06:02 2020 UTC (2 years, 3 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.39: +4 -3 lines
Diff to previous 1.508.4.39 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1617):

	sys/dev/pci/if_wm.c: revision 1.691

  Fixes a problem that the attach function reported
"wm_gmii_setup_phytype: Unknown PHY model. OUI=000000, model=0000" and
"PHY type is still unknown." Don't call wm_gmii_setup_phytype() three times if
the interface uses SGMII with internal MDIO.

  Tested with I354(Rangeley(SGMII(MDIO))) and I350(SERDES(SFP), SGMII(SFP)).

Revision 1.645.2.8 / (download) - annotate - [select for diffs], Fri Oct 16 08:03:36 2020 UTC (2 years, 3 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-1-RELEASE
Changes since 1.645.2.7: +4 -3 lines
Diff to previous 1.645.2.7 (colored) to branchpoint 1.645 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1114):

	sys/dev/pci/if_wm.c: revision 1.691

  Fixes a problem that the attach function reported
"wm_gmii_setup_phytype: Unknown PHY model. OUI=000000, model=0000" and
"PHY type is still unknown." Don't call wm_gmii_setup_phytype() three times if
the interface uses SGMII with internal MDIO.

  Tested with I354(Rangeley(SGMII(MDIO))) and I350(SERDES(SFP), SGMII(SFP)).

Revision 1.691 / (download) - annotate - [select for diffs], Fri Oct 16 05:53:39 2020 UTC (2 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.690: +4 -3 lines
Diff to previous 1.690 (colored)

 Fixes a problem that the attach function reported
"wm_gmii_setup_phytype: Unknown PHY model. OUI=000000, model=0000" and
"PHY type is still unknown." Don't call wm_gmii_setup_phytype() three times if
the interface uses SGMII with internal MDIO.

 Tested with I354(Rangeley(SGMII(MDIO))) and I350(SERDES(SFP), SGMII(SFP)).

Revision 1.690 / (download) - annotate - [select for diffs], Thu Sep 24 08:00:59 2020 UTC (2 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.689: +4 -4 lines
Diff to previous 1.689 (colored)

Small fixes from knakahara:

- Check return value correctly in wm_lv_jumbo_workaround_ich8lan().
- Fix comment.

Revision 1.645.2.7 / (download) - annotate - [select for diffs], Wed Sep 23 08:46:54 2020 UTC (2 years, 4 months ago) by martin
Branch: netbsd-9
Changes since 1.645.2.6: +240 -38 lines
Diff to previous 1.645.2.6 (colored) to branchpoint 1.645 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1093):

	sys/dev/pci/if_wmreg.h: revision 1.120
	sys/dev/pci/if_wmvar.h: revision 1.46
	sys/dev/pci/if_wm.c: revision 1.686
	sys/dev/pci/if_wm.c: revision 1.687
	sys/dev/mii/inbmphyreg.h: revision 1.20
	sys/dev/pci/if_wm.c: revision 1.688
	sys/dev/pci/if_wm.c: revision 1.689

s/ressource/resource/. Found by knakahara.

  Add new flag named WM_F_CRC_STRIP and use it. No functional change.

  This change also sets the RCTL_SECRC bit on I211 but it doesn't change
the behavior because I211 always strips CRC like I35[04] and I210.

  Add a workaround for jumbo frame on PCH2 and newer. Tested by chs@.

- Add wm_lv_jumbo_workaround_ich8lan() and use it. From FreeBSD.
   XXX For KUMCTRLSTA_OFFSET_HD_CTRL register modification, it's doubtful.
   FreeBSD and Linux do the same thing that they set the same value on both
   jumbo frame's enable case and the disable case. It seems the default value
   is 0x0b0c and it's not changed on the enable case, so it might be a bug
   on the enable case or the modification is not required.
- Rename I219_UNKNOWN1 to I82579_UNKNOWN1.
  Use 12K for packet buffer for jumbo frame on PCH2 and newer.

XXX Note that Linux Use 14K.

Revision 1.689 / (download) - annotate - [select for diffs], Wed Sep 16 15:04:57 2020 UTC (2 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.688: +4 -3 lines
Diff to previous 1.688 (colored)

 Use 12K for packet buffer for jumbo frame on PCH2 and newer.

XXX Note that Linux Use 14K.

Revision 1.688 / (download) - annotate - [select for diffs], Wed Sep 16 15:04:01 2020 UTC (2 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.687: +210 -11 lines
Diff to previous 1.687 (colored)

 Add a workaround for jumbo frame on PCH2 and newer. Tested by chs@.

- Add wm_lv_jumbo_workaround_ich8lan() and use it. From FreeBSD.

  XXX For KUMCTRLSTA_OFFSET_HD_CTRL register modification, it's doubtful.
  FreeBSD and Linux do the same thing that they set the same value on both
  jumbo frame's enable case and the disable case. It seems the default value
  is 0x0b0c and it's not changed on the enable case, so it might be a bug
  on the enable case or the modification is not required.

- Rename I219_UNKNOWN1 to I82579_UNKNOWN1.

Revision 1.687 / (download) - annotate - [select for diffs], Tue Sep 15 08:39:04 2020 UTC (2 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.686: +18 -16 lines
Diff to previous 1.686 (colored)

 Add new flag named WM_F_CRC_STRIP and use it. No functional change.

 This change also sets the RCTL_SECRC bit on I211 but it doesn't change
the behavior because I211 always strips CRC like I35[04] and I210.

Revision 1.686 / (download) - annotate - [select for diffs], Mon Aug 24 05:34:00 2020 UTC (2 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.685: +14 -14 lines
Diff to previous 1.685 (colored)

s/ressource/resource/. Found by knakahara.

Revision 1.508.4.39 / (download) - annotate - [select for diffs], Wed Aug 5 17:22:45 2020 UTC (2 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.38: +510 -143 lines
Diff to previous 1.508.4.38 (colored) to branchpoint 1.508 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1594:

	sys/dev/pci/if_wm.c			1.655-1.658, 1.660,
						1.662, 1.664-1.668,
						1.671-1.674, 1.678,
						1.680-1.685 via patch
	sys/dev/pci/if_wmreg.c			1.118-1.119 via patch
	sys/dev/pci/if_wmvar.c			1.45 via patch
	sys/dev/mii/igphy.c			1.35-1.36 via patch
	sys/dev/mii/igphyreg.h			1.12-1.13
	sys/dev/mii/makphy.c			1.66 via patch
	sys/dev/mii/makphyreg.h			1.11

- Add SFP support. Module insertion/removal is not supported yet.
  Currently, SFP detection is only done in the driver's attach phase.
- Detect the Media Auto Sense feature. Not supported yet.
- Fix SFF_SFP_ETH_FLAGS_100FX. It's not 0x10 but 0x20.
- Add extra delay in wm_serdes_power_up_link_82575().
- Add Intel I219 LM10-LM15 and V10-V14.
- wm(4) can use workqueue as deferred Rx/Tx handler).
  Set hw.wm*.txrx_workqueue=1 to use workqueue instead of softint.
  The default value of hw.wm*.txrx_workqueue is 0 which use softint
  as before.
- Unset RSS UDP flags like ixg(4) and other OSes. To handle IP
  fragmented UDP, first packet and second packet should be processed
  in the same Rx queue.
- It's useless to not to set PCI_PMCSR_PME_STS bit when writing because
  the bit is W1C. Instead, always write PCI_PMCSR_PME_STS bit to clear
  in case it's already set.
- Actually writing always the checksum offload context descriptor
  makes the HW do extra processing, avoid doing that if possible.
- Fix a bug that the WMREG_EEARBC_I210 register is incorrectly set if
  the system uses iNVM.
- "wmX: 0" on 82542 is difficult to understand, so don't print it.
- Explicitly cast from uint16_t to uint32_t before shifting 16bit left
  when printing Image Unique ID to avoid undefined behavior.
- Set if_baudrate for non-MII device.
- Rename some macros and function.
- KNF. Add comment.

Revision 1.645.2.6 / (download) - annotate - [select for diffs], Wed Aug 5 15:14:18 2020 UTC (2 years, 5 months ago) by martin
Branch: netbsd-9
Changes since 1.645.2.5: +62 -18 lines
Diff to previous 1.645.2.5 (colored) to branchpoint 1.645 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1040):

	sys/dev/mii/igphy.c: revision 1.35
	sys/dev/mii/igphy.c: revision 1.36
	sys/dev/mii/igphyreg.h: revision 1.12
	sys/dev/mii/igphyreg.h: revision 1.13
	sys/dev/mii/makphyreg.h: revision 1.11
	sys/dev/pci/if_wm.c: revision 1.682
	sys/dev/pci/if_wm.c: revision 1.683
	sys/dev/pci/if_wm.c: revision 1.684
	sys/dev/pci/if_wm.c: revision 1.685
	sys/dev/mii/makphy.c: revision 1.66

s/MII_IGPHY_/IGPHY_/. No functional change.

Rename PSSR_* to MAKPHY_PSSR_* and IGPHY_PSSR_* to avoid conflict.
No functional change.

  Setup PCS and SGMII for SFP correctly. It still doesn't support SFP
insertion/removal.

Copper:
wm2: SGMII(SFP)
wm2: 0x1043c440<SPI,IOH_VALID,PCIE,SGMII,NEWQUEUE,ASF_FIRM,EEE,SFP>
makphy0 at wm2 phy 6: Marvell 88E1111 Gigabit PHY, rev. 1

Fiber:
wm3: SERDES(SFP)
wm3: 0x10034440<SPI,IOH_VALID,PCIE,NEWQUEUE,ASF_FIRM,SFP>
wm3: 1000baseSX, 1000baseSX-FDX, auto

  Explicitly cast from uint16_t to uint32_t before shifting 16bit left
when printing Image Unique ID. Found by kUBSan.

  Set if_baudrate for non-MII device. Before this commit, it was 0.

Revision 1.685 / (download) - annotate - [select for diffs], Wed Aug 5 03:17:18 2020 UTC (2 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.684: +4 -2 lines
Diff to previous 1.684 (colored)

 Set if_baudrate for non-MII device. Before this commit, it was 0.

Revision 1.684 / (download) - annotate - [select for diffs], Wed Aug 5 01:58:42 2020 UTC (2 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.683: +4 -3 lines
Diff to previous 1.683 (colored)

 Explicitly cast from uint16_t to uint32_t before shifting 16bit left
when printing Image Unique ID. Found by kUBSan.

Revision 1.683 / (download) - annotate - [select for diffs], Mon Aug 3 10:52:08 2020 UTC (2 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.682: +45 -4 lines
Diff to previous 1.682 (colored)

 Setup PCS and SGMII for SFP correctly. It still doesn't support SFP
insertion/removal.

Copper:
wm2: SGMII(SFP)
wm2: 0x1043c440<SPI,IOH_VALID,PCIE,SGMII,NEWQUEUE,ASF_FIRM,EEE,SFP>
makphy0 at wm2 phy 6: Marvell 88E1111 Gigabit PHY, rev. 1

Fiber:
wm3: SERDES(SFP)
wm3: 0x10034440<SPI,IOH_VALID,PCIE,NEWQUEUE,ASF_FIRM,SFP>
wm3: 1000baseSX, 1000baseSX-FDX, auto

Revision 1.682 / (download) - annotate - [select for diffs], Mon Aug 3 07:16:51 2020 UTC (2 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.681: +15 -15 lines
Diff to previous 1.681 (colored)

s/MII_IGPHY_/IGPHY_/. No functional change.

Revision 1.645.2.5 / (download) - annotate - [select for diffs], Fri Jul 10 10:45:56 2020 UTC (2 years, 6 months ago) by martin
Branch: netbsd-9
Changes since 1.645.2.4: +439 -122 lines
Diff to previous 1.645.2.4 (colored) to branchpoint 1.645 (colored)

Pull up the following revisions, requested by msaitoh in ticket #994:

	sys/dev/pci/if_wm.c		1.655-1.658, 1.660, 1.662, 1.664-1.668,
					1.671-1.674, 1.678,1.680-1.681 via patch
	sys/dev/pci/if_wmreg.c		1.118-1.119
	sys/dev/pci/if_wmvar.c		1.45

- Add SFP support. Module insertion/removal is not supported yet.
  Currently, SFP detection is only done in the driver's attach phase.
- Detect the Media Auto Sense feature. Not supported yet.
- Fix SFF_SFP_ETH_FLAGS_100FX. It's not 0x10 but 0x20.
- Add extra delay in wm_serdes_power_up_link_82575().
- Add Intel I219 LM10-LM15 and V10-V14.
- wm(4) can use workqueue as deferred Rx/Tx handler.
  Set hw.wm*.txrx_workqueue=1 to use workqueue instead of softint.
  The default value of hw.wm*.txrx_workqueue is 0 which use softint
  as before.
- Unset RSS UDP flags like ixg(4) and other OSes. To handle IP
  fragmented UDP, first packet and second packet should be processed
  in the same Rx queue.
- It's useless to not to set PCI_PMCSR_PME_STS bit when writing because
  the bit is W1C. Instead, always write PCI_PMCSR_PME_STS bit to clear
  in case it's already set.
- Actually writing always the checksum offload context descriptor
  makes the HW do extra processing, avoid doing that if possible.
- Fix a bug that the WMREG_EEARBC_I210 register is incorrectly set if
  the system uses iNVM.
- "wmX: 0" on 82542 is difficult to understand, so don't print it.
- Rename some macros and function.
- KNF. Add comment.

Revision 1.681 / (download) - annotate - [select for diffs], Thu Jul 9 06:42:44 2020 UTC (2 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.680: +6 -4 lines
Diff to previous 1.680 (colored)

"wmX: 0" on 82542 is difficult to understand, so don't print it.

Revision 1.680 / (download) - annotate - [select for diffs], Mon Jul 6 07:51:09 2020 UTC (2 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.679: +17 -3 lines
Diff to previous 1.679 (colored)

 Fix a bug that the WMREG_EEARBC_I210 register is incorrectly set if the system
uses iNVM.

Revision 1.679 / (download) - annotate - [select for diffs], Sat Jun 27 13:32:00 2020 UTC (2 years, 7 months ago) by jmcneill
Branch: MAIN
Changes since 1.678: +3 -3 lines
Diff to previous 1.678 (colored)

prop_data_data_nocopy -> prop_data_value

Revision 1.678 / (download) - annotate - [select for diffs], Thu Jun 11 09:23:13 2020 UTC (2 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.677: +15 -15 lines
Diff to previous 1.677 (colored)

No functional change:

 - Rename some macros and function.
 - Add newline.

Revision 1.677 / (download) - annotate - [select for diffs], Thu Jun 11 02:39:30 2020 UTC (2 years, 7 months ago) by thorpej
Branch: MAIN
Changes since 1.676: +5 -5 lines
Diff to previous 1.676 (colored)

Update for proplib(3) API changes.

Revision 1.676 / (download) - annotate - [select for diffs], Thu Apr 30 03:42:10 2020 UTC (2 years, 9 months ago) by riastradh
Branch: MAIN
Changes since 1.675: +3 -3 lines
Diff to previous 1.675 (colored)

Make WM_NRXDESC unsigned.

Revision 1.675 / (download) - annotate - [select for diffs], Thu Apr 30 03:41:31 2020 UTC (2 years, 9 months ago) by riastradh
Branch: MAIN
Changes since 1.674: +16 -34 lines
Diff to previous 1.674 (colored)

Revert "- rnd_add_*() call must be serialized. Unserialized accesses broke the"

It is no longer necessary to serialize calls to rnd_add_data, so we
can use the same rndsource for every queue.

This also reverts some unrelated changes that were mixed in:

1. WM_NRXDESC was made unsigned
2. The specific samples were changed.

(1) will be redone in a separate commit.  (2) was buggy (wrote `='
where `|=' was meant) and is not needed; it's fine to do rnd_add_data
in a thread or softint too, not just in a hard interrupt handler.

Revision 1.670.2.1 / (download) - annotate - [select for diffs], Mon Apr 20 11:29:04 2020 UTC (2 years, 9 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.670: +65 -28 lines
Diff to previous 1.670 (colored) next main 1.671 (colored)

Sync with HEAD

Revision 1.583.2.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:04:26 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.583.2.1: +608 -259 lines
Diff to previous 1.583.2.1 (colored) to branchpoint 1.583 (colored) next main 1.584 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.674 / (download) - annotate - [select for diffs], Thu Apr 9 06:55:51 2020 UTC (2 years, 9 months ago) by jdolecek
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, bouyer-xenpvh-base2, bouyer-xenpvh-base1
Changes since 1.673: +31 -27 lines
Diff to previous 1.673 (colored)

adjust the condition for reusing checksum context, wm_tx_offload() can
be used even for multiqueue case

enable only when the chip supports exactly one queue (same as FreeBSD) -
anything multiqueue-capable later than 82574 should work, but I don't
have the hw to test

Revision 1.673 / (download) - annotate - [select for diffs], Wed Apr 8 21:57:24 2020 UTC (2 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.672: +12 -24 lines
Diff to previous 1.672 (colored)

wm_tx_offload() and wm_nq_tx_offload() actually always return 0, make them
return void and remove the check for their return value

Revision 1.672 / (download) - annotate - [select for diffs], Wed Apr 8 21:56:01 2020 UTC (2 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.671: +5 -5 lines
Diff to previous 1.671 (colored)

fixup field names in previous

Revision 1.671 / (download) - annotate - [select for diffs], Wed Apr 8 21:51:42 2020 UTC (2 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.670: +53 -8 lines
Diff to previous 1.670 (colored)

actually writing always the checksum offload context descriptor
makes the hw do extra processing, avoid doing that if possible -
on my computer with I219 this results in about 2% speedup in Tx performance

change adoped from FreeBSD

XXX should be also done for multiqueue case, but I don't have hw to test it

Revision 1.670 / (download) - annotate - [select for diffs], Sat Mar 21 16:47:05 2020 UTC (2 years, 10 months ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-20200406, bouyer-xenpvh-base
Branch point for: bouyer-xenpvh
Changes since 1.669: +5 -28 lines
Diff to previous 1.669 (colored)

Don't bother with IFF_OACTIVE.

Revision 1.669 / (download) - annotate - [select for diffs], Sun Mar 15 23:04:50 2020 UTC (2 years, 10 months ago) by thorpej
Branch: MAIN
Changes since 1.668: +50 -32 lines
Diff to previous 1.668 (colored)

Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
  access to media-related structures / hardware regsiters.  Converted
  drivers use the new ifmedia_init_with_lock() function for this.  The
  new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
  a compatibility lock to be used instead.  Several media-related entry
  points must be aware of this compatibility lock, and are able to acquire
  it recursively a limited number of times, if needed.  This is a SPIN
  mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
  MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex.  The mcx driver still needs to be fully converted to
NET_MPSAFE.

Revision 1.658.2.2 / (download) - annotate - [select for diffs], Sat Feb 29 20:19:11 2020 UTC (2 years, 10 months ago) by ad
Branch: ad-namecache
Changes since 1.658.2.1: +65 -52 lines
Diff to previous 1.658.2.1 (colored) to branchpoint 1.658 (colored) next main 1.659 (colored)

Sync with head.

Revision 1.668 / (download) - annotate - [select for diffs], Tue Feb 18 04:07:14 2020 UTC (2 years, 11 months ago) by msaitoh
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Changes since 1.667: +5 -4 lines
Diff to previous 1.667 (colored)

 It's useless to not to set PCI_PMCSR_PME_STS bit when writing because
the bit is W1C. Instead, always write PCI_PMCSR_PME_STS bit to clear in
case it's already set.

Revision 1.667 / (download) - annotate - [select for diffs], Tue Feb 18 03:48:22 2020 UTC (2 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.666: +3 -3 lines
Diff to previous 1.666 (colored)

 Whitespace fix. No functional change.

Revision 1.666 / (download) - annotate - [select for diffs], Fri Jan 31 12:09:13 2020 UTC (2 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.665: +6 -3 lines
Diff to previous 1.665 (colored)

wm(4) unset RSS UDP flags like ixg(4) and other OS's one.

To handle IP fragmented UDP first packet and second packet by the same
Rx queue.

I tested on I354.

Revision 1.665 / (download) - annotate - [select for diffs], Fri Jan 31 12:04:57 2020 UTC (2 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.664: +15 -2 lines
Diff to previous 1.664 (colored)

Fix missing workqueue_destroy().  ok by msaitoh@n.o

Revision 1.664 / (download) - annotate - [select for diffs], Fri Jan 31 12:03:23 2020 UTC (2 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.663: +21 -29 lines
Diff to previous 1.663 (colored)

Fix wm(4) create too many workqueue.  Pointed out by msaitoh@n.o

Revision 1.663 / (download) - annotate - [select for diffs], Wed Jan 29 06:44:27 2020 UTC (3 years ago) by thorpej
Branch: MAIN
Changes since 1.662: +26 -22 lines
Diff to previous 1.662 (colored)

Adopt <net/if_stats.h>.

Revision 1.645.2.4 / (download) - annotate - [select for diffs], Sun Jan 26 11:13:27 2020 UTC (3 years ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RELEASE, netbsd-9-0-RC2
Changes since 1.645.2.3: +28 -23 lines
Diff to previous 1.645.2.3 (colored) to branchpoint 1.645 (colored)

Pull up the following (via patch), requested by msaitoh in ticket #650:

	sys/dev/pci/if_wm.c			1.650, 1.652-1.654
	sys/dev/pci/if_wmreg.h			1.116-1.117

- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580
  port 1, 2, 3 and newer chips. This change fixes a bug that some
  fiber, serdes or SFP devices don't detect the link status correctly.
- Simplify code by using "struct mii_data *mii" more. No functional
  change.
- MSI-X doesn't use sc->sc_icr variable, so move the code into
  non-MSI-X part. No functional change intended.
- Modify debug printfs a bit.
- Rename macro.
- Use __BIT()
- Fix comment. Add comment.
- KNF.

Revision 1.658.2.1 / (download) - annotate - [select for diffs], Sat Jan 25 22:38:47 2020 UTC (3 years ago) by ad
Branch: ad-namecache
Changes since 1.658: +151 -23 lines
Diff to previous 1.658 (colored)

Sync with head.

Revision 1.508.4.38 / (download) - annotate - [select for diffs], Fri Jan 24 18:43:35 2020 UTC (3 years ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE
Changes since 1.508.4.37: +26 -20 lines
Diff to previous 1.508.4.37 (colored) to branchpoint 1.508 (colored)

Pull up the following, requested by msaitoh in ticket #1492:

	sys/dev/pci/if_wm.c			1.650, 1.652-1.654 via patch
	sys/dev/pci/if_wmreg.h			1.116-1.117

- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580
  port 1, 2, 3 and newer chips. This change fixes a bug that some
  fiber, serdes or SFP devices don't detect the link status correctly.
- Simplify code by using "struct mii_data *mii" more. No functional
  change.
- MSI-X doesn't use sc->sc_icr variable, so move the code into
  non-MSI-X part. No functional change intended.
- Modify debug printfs a bit.
- Rename macro.
- Use __BIT()
- Fix comment. Add comment.
- KNF.

Revision 1.662 / (download) - annotate - [select for diffs], Fri Jan 24 02:50:41 2020 UTC (3 years ago) by knakahara
Branch: MAIN
CVS Tags: ad-namecache-base2
Changes since 1.661: +115 -17 lines
Diff to previous 1.661 (colored)

wm(4) can use workqueue as deferred Rx/Tx handler like ixg(4).

Set hw.wm*.txrx_workqueue=1 to use workqueue instead of softint.
The default value of hw.wm*.txrx_workqueue is 0, that is, use softint
as before.

ok by msaitoh@n.o.

Revision 1.508.4.37 / (download) - annotate - [select for diffs], Thu Jan 23 10:17:41 2020 UTC (3 years ago) by martin
Branch: netbsd-8
Changes since 1.508.4.36: +5 -2 lines
Diff to previous 1.508.4.36 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #1488):

	sys/dev/pci/if_wm.c: revision 1.661

fix softint_disestablish() in wm_detach().

ok by msaitoh@n.o
XXX pullup-8, pullup-9

Revision 1.645.2.3 / (download) - annotate - [select for diffs], Thu Jan 23 10:10:57 2020 UTC (3 years ago) by martin
Branch: netbsd-9
Changes since 1.645.2.2: +5 -2 lines
Diff to previous 1.645.2.2 (colored) to branchpoint 1.645 (colored)

Pull up following revision(s) (requested by knakahara in ticket #643):

	sys/dev/pci/if_wm.c: revision 1.661

fix softint_disestablish() in wm_detach().

ok by msaitoh@n.o
XXX pullup-8, pullup-9

Revision 1.661 / (download) - annotate - [select for diffs], Thu Jan 23 07:49:57 2020 UTC (3 years ago) by knakahara
Branch: MAIN
Changes since 1.660: +5 -2 lines
Diff to previous 1.660 (colored)

fix softint_disestablish() in wm_detach().

ok by msaitoh@n.o

XXX pullup-8, pullup-9

Revision 1.660 / (download) - annotate - [select for diffs], Tue Jan 21 08:50:54 2020 UTC (3 years ago) by msaitoh
Branch: MAIN
Changes since 1.659: +35 -2 lines
Diff to previous 1.659 (colored)

 Add Intel I219 LM10-LM15 and V10-V14 from OpenBSD.

Revision 1.659 / (download) - annotate - [select for diffs], Mon Jan 20 19:45:27 2020 UTC (3 years ago) by thorpej
Branch: MAIN
Changes since 1.658: +2 -8 lines
Diff to previous 1.658 (colored)

No longer need to go to splnet() before calling ifmedia_ioctl()
in the NET_MPSAFE; ifmedia_ioctl() will do this for us, if needed.

Revision 1.658 / (download) - annotate - [select for diffs], Fri Dec 13 02:03:46 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
CVS Tags: ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.657: +12 -12 lines
Diff to previous 1.657 (colored)

 KNF. No functional change.

Revision 1.657 / (download) - annotate - [select for diffs], Thu Dec 12 11:47:30 2019 UTC (3 years, 1 month ago) by knakahara
Branch: MAIN
Changes since 1.656: +2 -4 lines
Diff to previous 1.656 (colored)

fix build failure. ok by msaitoh@n.o.

Revision 1.656 / (download) - annotate - [select for diffs], Thu Dec 12 09:32:54 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.655: +102 -45 lines
Diff to previous 1.655 (colored)

Add SFP support part 2.

 - Add code for 1000BASE-T SFP. It uses SGMII.
 - Add extra delay in wm_serdes_power_up_link_82575(). Same as other OSes.

TODO:
 - Module insertion/removal support. Currently, SFP detection is only done
  in the driver's attach phase.

Revision 1.645.2.2 / (download) - annotate - [select for diffs], Wed Dec 11 14:48:31 2019 UTC (3 years, 1 month ago) by martin
Branch: netbsd-9
Changes since 1.645.2.1: +3 -3 lines
Diff to previous 1.645.2.1 (colored) to branchpoint 1.645 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #541):

	sys/dev/pci/if_wm.c: revision 1.651

 Fix a bug that wm_sgmii_readreg_locked() may return error even if error isn't
occurred.

Revision 1.655 / (download) - annotate - [select for diffs], Wed Dec 11 10:28:19 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.654: +90 -21 lines
Diff to previous 1.654 (colored)

Add SFP support part 1. The code for SerDes and SGMII setting is not include
in this commit. SFP module removal interrupt detects but not used yet:
- Detect SFP's 1000BASE-SX, 1000BASE-LX, 100BASE-FX and 1000BASE-T correctly.
- Detect the Media Auto Sense feature. Not supported yet.
- Add comment.

Revision 1.654 / (download) - annotate - [select for diffs], Wed Dec 11 09:48:16 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.653: +7 -6 lines
Diff to previous 1.653 (colored)

- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580 port 1, 2, 3 and
  newer chips. This change fixes a bug that some fiber, serdes or SFP devices
  don't detect the link status correctly.
  XXX We should check for other NVM reads if they have the same problem. One of
  the solution to avoid this type of bug is to check the register layout
  in wm_nvm_read().
- Use __BIT()
- Add comment

Revision 1.653 / (download) - annotate - [select for diffs], Wed Dec 11 09:27:46 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.652: +15 -10 lines
Diff to previous 1.652 (colored)

- MSI-X doesn't use sc->sc_icr variable, so move the code into non-MSI-X part.
  No functional change intended. OK'd by knakahara.
- Modify debug printfs a bit.

Revision 1.652 / (download) - annotate - [select for diffs], Wed Dec 11 09:12:29 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.651: +4 -4 lines
Diff to previous 1.651 (colored)

No functional change:
 - Add defintion of CONNSW register and PCS_NPTX (not used yet).
 - Add some bit definitions of PCS_LCTL.
 - Renae macro.
 - Fix comment. Add comment.
 - KNF.

Revision 1.651 / (download) - annotate - [select for diffs], Mon Dec 9 02:30:30 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.650: +3 -3 lines
Diff to previous 1.650 (colored)

 Fix a bug that wm_sgmii_readreg_locked() may return error even if error isn't
occured.

Revision 1.650 / (download) - annotate - [select for diffs], Wed Dec 4 09:03:45 2019 UTC (3 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.649: +8 -9 lines
Diff to previous 1.649 (colored)

 Simplify. No functional change.

Revision 1.508.4.36 / (download) - annotate - [select for diffs], Wed Nov 6 10:23:06 2019 UTC (3 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.35: +31 -31 lines
Diff to previous 1.508.4.35 (colored) to branchpoint 1.508 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1428:

	sys/dev/pci/if_wm.c			1.647, 1.649 via patch

- Use device_printf() instead of printf().
- Fix typo in comment.

Revision 1.645.2.1 / (download) - annotate - [select for diffs], Wed Nov 6 10:07:42 2019 UTC (3 years, 2 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RC1
Changes since 1.645: +32 -32 lines
Diff to previous 1.645 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #404):

	sys/dev/pci/if_wm.c: revision 1.646
	sys/dev/pci/if_wm.c: revision 1.647
	sys/dev/pci/if_wm.c: revision 1.649

Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

printf -> device_printf

Fix typo in comment.

Revision 1.649 / (download) - annotate - [select for diffs], Thu Sep 26 04:16:03 2019 UTC (3 years, 4 months ago) by msaitoh
Branch: MAIN
CVS Tags: phil-wifi-20191119
Changes since 1.648: +5 -5 lines
Diff to previous 1.648 (colored)

 Fix typo in comment.

Revision 1.648 / (download) - annotate - [select for diffs], Fri Sep 13 07:55:07 2019 UTC (3 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.647: +5 -4 lines
Diff to previous 1.647 (colored)

 if_flags is neither int nor short. It's unsigned short.

Revision 1.647 / (download) - annotate - [select for diffs], Wed Sep 4 07:07:09 2019 UTC (3 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.646: +28 -28 lines
Diff to previous 1.646 (colored)

 printf -> device_printf

Revision 1.508.4.35 / (download) - annotate - [select for diffs], Sun Aug 4 10:59:19 2019 UTC (3 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.34: +6 -3 lines
Diff to previous 1.508.4.34 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1317):

	sys/dev/pci/if_wm.c: revision 1.646
	sys/dev/pci/if_wm.c: revision 1.612

Accept IFM_NONE.

 -

Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

Revision 1.646 / (download) - annotate - [select for diffs], Thu Aug 1 14:28:33 2019 UTC (3 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.645: +3 -3 lines
Diff to previous 1.645 (colored)

Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

Revision 1.508.4.34 / (download) - annotate - [select for diffs], Thu Aug 1 13:50:13 2019 UTC (3 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.33: +36 -17 lines
Diff to previous 1.508.4.33 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1312):

	sys/dev/pci/if_wm.c: revision 1.644
	sys/dev/pci/if_wm.c: revision 1.645
	sys/dev/pci/if_wmreg.h: revision 1.115

 Define RETA_ENTRY_MASK_Q(used in RSS redirection table) correctly.
Found by UBSan.

 Use aprint_debug_dev() instead of printf() in wm_ulp_disable().

- rnd_add_*() call must be serialized. Unserialized accesses broke the
  sc->rnd_source structure and caused off by one in kern_rndq.c's
  rnd_add_data_ts(). This problem was found by kUBSan. Make krndsource_t's
  data per queue-pair and call rnd_add_uint32() in wm_txrxintr_msix(). One of
  the reason why rnd_add_uint32() calls were moved from wm_{tx,rx}eof() is that
  rnd(9) manual page says "To allow the system to gather the timing information
  accurately, this call should be placed within the actual hardware interrupt
  service routine."

- Pass a better value to rnd_add_uint32() in wm_intr_legacy().
XXX pullup-8.

Revision 1.645 / (download) - annotate - [select for diffs], Tue Jul 30 04:42:29 2019 UTC (3 years, 6 months ago) by msaitoh
Branch: MAIN
CVS Tags: netbsd-9-base
Branch point for: netbsd-9
Changes since 1.644: +34 -16 lines
Diff to previous 1.644 (colored)

- rnd_add_*() call must be serialized. Unserialized accesses broke the
  sc->rnd_source structure and caused off by one in kern_rndq.c's
  rnd_add_data_ts(). This problem was found by kUBSan. Make krndsource_t's
  data per queue-pair and call rnd_add_uint32() in wm_txrxintr_msix(). One of
  the reason why rnd_add_uint32() calls were moved from wm_{tx,rx}eof() is that
  rnd(9) manual page says "To allow the system to gather the timing information
  accurately, this call should be placed within the actual hardware interrupt
  service routine."
- Pass a better value to rnd_add_uint32() in wm_intr_legacy().

XXX pullup-8.

Revision 1.644 / (download) - annotate - [select for diffs], Fri Jul 26 09:26:56 2019 UTC (3 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.643: +4 -3 lines
Diff to previous 1.643 (colored)

 Use aprint_debug_dev() instead of printf() in wm_ulp_disable().

Revision 1.643 / (download) - annotate - [select for diffs], Thu Jul 25 08:35:36 2019 UTC (3 years, 6 months ago) by tnn
Branch: MAIN
Changes since 1.642: +8 -4 lines
Diff to previous 1.642 (colored)

wm: change one bus_dmamap_load_mbuf() to bus_dmamap_load() equivalent

This makes wm work on aarch64, where the bus_dma implementation requires
the mbuf data pointer be immutable between bus_dmamap_load_mbuf and
bus_dmamap_sync. Fix suggested by thorpej@

Revision 1.508.4.33 / (download) - annotate - [select for diffs], Wed Jul 17 16:12:17 2019 UTC (3 years, 6 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.32: +171 -176 lines
Diff to previous 1.508.4.32 (colored) to branchpoint 1.508 (colored)

Pull up the following revisions (via patch), requested by msaitoh in
ticket #1298:

	sys/dev/pci/if_wm.c				1.633, 1.637-1.641
	sys/dev/pci/if_wmreg.h				1.114

- Use unsigned to avoid undefined behavior.
- Print ICH/PCH's NVM version.
- Fix typo in comment. u_int*_t -> uint*_t. Whitespace fix.

Revision 1.642 / (download) - annotate - [select for diffs], Tue Jul 9 08:46:59 2019 UTC (3 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.641: +5 -3 lines
Diff to previous 1.641 (colored)

 Don't automatically set ec_capenable's ETHERCAP_VLAN_HWTAGGING bit in
vlan_config() to make it user-controllable. Instead, set the bit in
xxx_attach().

Revision 1.641 / (download) - annotate - [select for diffs], Wed Jun 12 01:54:11 2019 UTC (3 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.640: +23 -2 lines
Diff to previous 1.640 (colored)

 Print ICH/PCH's NVM version.

Revision 1.583.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:07:16 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.583: +2423 -959 lines
Diff to previous 1.583 (colored)

Sync with HEAD

Revision 1.640 / (download) - annotate - [select for diffs], Fri Jun 7 04:39:15 2019 UTC (3 years, 7 months ago) by msaitoh
Branch: MAIN
CVS Tags: phil-wifi-20190609
Changes since 1.639: +8 -8 lines
Diff to previous 1.639 (colored)

 Use unsigned. Found by UBSan. OK'd by kamil.

Revision 1.639 / (download) - annotate - [select for diffs], Tue May 28 08:59:35 2019 UTC (3 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.638: +3 -3 lines
Diff to previous 1.638 (colored)

s/recieve/receive/

Revision 1.638 / (download) - annotate - [select for diffs], Thu May 23 13:10:52 2019 UTC (3 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.637: +5 -5 lines
Diff to previous 1.637 (colored)

 Whitespace fix (mainly tabify).

Revision 1.637 / (download) - annotate - [select for diffs], Thu May 23 10:57:28 2019 UTC (3 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.636: +38 -40 lines
Diff to previous 1.636 (colored)

-No functional change:
  - KNF
  - u_int*_t -> uint*_t.

Revision 1.636 / (download) - annotate - [select for diffs], Wed May 15 02:56:47 2019 UTC (3 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.635: +7 -4 lines
Diff to previous 1.635 (colored)

Store IFF_ALLMULTI in ec_flags instead of if_flags to avoid data races

IFF_ALLMULTI is set/unset to if_flags via if_mcast_op.  To avoid data races on
if_flags, IFNET_LOCK was added for if_mcast_op.  Unfortunately it produces
a deadlock so we want to remove added IFNET_LOCK by avoiding the data races by
another approach.

This fix introduces ec_flags to struct ethercom and stores IFF_ALLMULTI to it.
ec_flags is protected by ETHER_LOCK and thus IFNET_LOCK is no longer necessary
for if_mcast_op.  Note that the fix is applied only to MP-safe drivers that
the data races matter.

In the kernel, IFF_ALLMULTI is set by a driver and used by the driver itself.
So changing the storing place doesn't break anything.  One exception is
ioctl(SIOCGIFFLAGS); we have to include IFF_ALLMULTI in a result if needed to
export the flag as well as before.

A upcoming commit will remove IFNET_LOCK.

PR kern/54189

Revision 1.508.4.32 / (download) - annotate - [select for diffs], Tue May 14 11:40:41 2019 UTC (3 years, 8 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-1-RELEASE, netbsd-8-1-RC1
Changes since 1.508.4.31: +2 -3 lines
Diff to previous 1.508.4.31 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1267):

	sys/arch/arm/imx/if_enet.c: revision 1.19
	sys/dev/pci/if_wm.c: revision 1.634

SIOCS is 'S'et function and the ioctl argument is ifreq.
SIOCG is 'G'et function and the ioctl armument is ifmediareq.

Before this change, SIOCG modify sc->sc_flowflags unexpectedly.


Don't hook SIOCGIFMEDIA becauise this driver uses MII(4) and ether_ioctl has
the hook(if_ethersubr.c rev. 1.160).
real bug because the modification is overriden in ifmedia_ioctl().

 This driver might require some additional fixes for SIOCSIFMTU and other
ioctl()s.
XXX pullup-[78].

Revision 1.635 / (download) - annotate - [select for diffs], Tue May 14 09:43:55 2019 UTC (3 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.634: +3 -3 lines
Diff to previous 1.634 (colored)

Remove unnecessary checks of IFF_ALLMULTI

IFF_ALLMULTI is changed by only driver itself, so we don't need to check its
change on ec_ifflags_cb.

This is part of PR kern/54189. NFCI.

Revision 1.634 / (download) - annotate - [select for diffs], Wed Apr 24 11:18:20 2019 UTC (3 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.633: +2 -3 lines
Diff to previous 1.633 (colored)

SIOCS is 'S'et function and the ioctl argument is ifreq.
SIOCG is 'G'et function and the ioctl argument is ifmediareq.
Before this change, SIOCG modify sc->sc_flowflags unexpectedly.
Don't hook SIOCGIFMEDIA because this driver uses MII(4) and ether_ioctl has
the hook(if_ethersubr.c rev. 1.160). This driver might require some additional
fixes for SIOCSIFMTU and other ioctl()s.

XXX pullup-[78].

Revision 1.633 / (download) - annotate - [select for diffs], Wed Apr 24 10:21:22 2019 UTC (3 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.632: +111 -137 lines
Diff to previous 1.632 (colored)

 KNF. No functional change.

Revision 1.632 / (download) - annotate - [select for diffs], Mon Mar 25 05:32:01 2019 UTC (3 years, 10 months ago) by msaitoh
Branch: MAIN
CVS Tags: isaki-audio2-base, isaki-audio2
Changes since 1.631: +18 -16 lines
Diff to previous 1.631 (colored)

 Pass error status to the upper layer in wm_gmii_{i82544,i80003}*().

Revision 1.508.4.31 / (download) - annotate - [select for diffs], Thu Mar 7 17:11:53 2019 UTC (3 years, 10 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.30: +42 -23 lines
Diff to previous 1.508.4.30 (colored) to branchpoint 1.508 (colored)

Pull up the following, requested by msaitoh in ticket #1206:

	sys/dev/pci/if_wmreg.h			1.113
	sys/dev/pci/if_wmvar.h			1.43-1.44
	sys/dev/pci/if_wm.c			1.626-1.627, 1.629-1.636 via patch

- Add support for I210 SGMII Flash-less device.
- Add I219 variations for Cannon Lake.
- Add missing rnd_detach_source().
- Use  do { ... } while (0) for DPRINTF(x, y).
- Swap enumeration of 82578 and 82577 PHY in if_wmvar.h. No functional
  change.
- Add KASSERT.
- Update TODO list. Add comment. Fix typo in comment.

Revision 1.631 / (download) - annotate - [select for diffs], Tue Mar 5 03:49:06 2019 UTC (3 years, 10 months ago) by msaitoh
Branch: MAIN
Changes since 1.630: +30 -18 lines
Diff to previous 1.630 (colored)

 Add Intel I219 variations for Cannon Lake.

Revision 1.630 / (download) - annotate - [select for diffs], Mon Mar 4 05:28:48 2019 UTC (3 years, 10 months ago) by msaitoh
Branch: MAIN
Changes since 1.629: +3 -3 lines
Diff to previous 1.629 (colored)

 Use  do { ... } whille (0) for DPRINTF(x, y).

Revision 1.629 / (download) - annotate - [select for diffs], Thu Feb 28 16:56:35 2019 UTC (3 years, 11 months ago) by khorben
Branch: MAIN
Changes since 1.628: +3 -3 lines
Diff to previous 1.628 (colored)

Typo (s/vaule/value/)

Revision 1.628 / (download) - annotate - [select for diffs], Sat Feb 23 11:41:08 2019 UTC (3 years, 11 months ago) by kamil
Branch: MAIN
Changes since 1.627: +8 -6 lines
Diff to previous 1.627 (colored)

Fix GCC7 "avoid ambiguous 'else'" build error in if_wm.c

Detected with kUBSan NetBSD/i386 build.

Revision 1.627 / (download) - annotate - [select for diffs], Thu Feb 21 08:10:22 2019 UTC (3 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.626: +4 -2 lines
Diff to previous 1.626 (colored)

Fix panic when wm(4) is reattached. ok by msaitoh@n.o.

This panic occured after kern_rndq.c:r1.90.

Revision 1.508.4.30 / (download) - annotate - [select for diffs], Mon Feb 11 13:44:34 2019 UTC (3 years, 11 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.29: +7 -5 lines
Diff to previous 1.508.4.29 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1189):

	sys/dev/pci/if_wm.c: revision 1.622
	sys/dev/pci/if_wm.c: revision 1.624
	sys/dev/pci/if_wm.c: revision 1.625

 We now have IFM_2500_KX and IFM_1000_KX, so use them.

 -

 I21[01]'s RAL size is not 15 but 16(== 82575's value). Same as other OSes.

 -

 Fix a bug that WOL didn't work on some chips since if_wm.c rev. 1.610.

Set WUC_APME bit older than PCH. Will fixes PR kern/53945 reported by kardel@.
Tested with my own 82574 card.

Revision 1.626 / (download) - annotate - [select for diffs], Fri Feb 8 06:33:04 2019 UTC (3 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.625: +11 -6 lines
Diff to previous 1.625 (colored)

- Add support for I210 SGMII Flash-less device.
- Add KASSERT.
- Update TODO list.

Revision 1.625 / (download) - annotate - [select for diffs], Thu Feb 7 04:03:24 2019 UTC (3 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.624: +3 -3 lines
Diff to previous 1.624 (colored)

 Fix a bug that WOL didn't work on some chips since if_wm.c rev. 1.610.
Set WUC_APME bit older than PCH. Will fixes PR kern/53945 reported by kardel@.
Tested with my own 82574 card.

Revision 1.624 / (download) - annotate - [select for diffs], Wed Feb 6 07:20:13 2019 UTC (3 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.623: +4 -2 lines
Diff to previous 1.623 (colored)

 I21[01]'s RAL size is not 15 but 16(== 82575's value). Same as other OSes.

Revision 1.623 / (download) - annotate - [select for diffs], Thu Jan 31 15:30:23 2019 UTC (3 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.622: +33 -10 lines
Diff to previous 1.622 (colored)

 Add yet another PHY workaround. Disable generation of early preamble on 82577
PHY rev. 1 or 2 and 82578 PHY rev. 1.

Revision 1.508.4.29 / (download) - annotate - [select for diffs], Thu Jan 31 06:43:48 2019 UTC (3 years, 11 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.28: +693 -258 lines
Diff to previous 1.508.4.28 (colored) to branchpoint 1.508 (colored)

Pull up the following, requested by msaitoh in ticket #1179:

	sys/dev/pci/if_wm.c			1.603-1.605,1.607-1.611,
						1.613,1.615,1.618-1.620
						via patch
	sys/dev/pci/if_wmreg.h			1.110-1.111
	sys/dev/pci/if_wmvar.h			1.40-1.42
	sys/dev/mii/inbmphyreg.h		1.13-1.15

- Add some code for suspend/resume:
  - Rename wm_smbustopci() to wm_init_phy_workarounds_pchlan(). It will
    also called when resume.
  - Call wm_phy_resetisblocked() after PHY reset in
    wm_init_phy_workarounds_pchlan() to wait for the PHY to quiesce to
    an accessible state.
  - Add new wm_resume_workarounds_pchlan() function and use it in
    wm_resume(). This workaround is only for PCH2 and newer.
  - Don't call wm_disable_aspm() neither in wm_attach() nor in
    wm_resume() but in wm_reset().
  - Do some initialization in wm_resume() when IFF_UP is NOT set.
  - Don't continue when it failed to acquire semaphore in
    wm_ulp_disable().
- Print CLSEM workaround bit correctly.
- Fix availability detection of WoL on some chips.
- Print the WUS (WakeUp Status) register bits when resume.
- Don't setup WoL on non-WoL capable port.
- Setup PHY wakeup feature on PCH and newer. Tested on Thinkpad X220.
- Remove an extra register read in
  wm_kmrn_lock_loss_workaround_ich8lan().
- Don't leave the MDICNFG register modified when the Power Management
  capability offset can't get.
- Reduce indent level of wm_linkintr_gmii(). No functional change.
- 80003's SERDES is not the same as 82575's but the same as legacy
  devices. Use the old methods on 80003.
- Use __nothing for null DPRINTF().
- Rename functions. Add comment.

Revision 1.622 / (download) - annotate - [select for diffs], Thu Jan 31 05:48:32 2019 UTC (3 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.621: +4 -4 lines
Diff to previous 1.621 (colored)

 We now have IFM_2500_KX and IFM_1000_KX, so use them.

Revision 1.621 / (download) - annotate - [select for diffs], Thu Jan 31 05:20:49 2019 UTC (3 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.620: +209 -22 lines
Diff to previous 1.620 (colored)

Add some workarounds which use EMI register or EEE related:
 - PCH only: Add workaround for link disconnects on a busy hub in half duplex.
 - PCH and PCH2 only: Set MSE higher to enable link to stay up when noise is
   high.
 - PCH2 only: Drop link after 5 times MSE threshold was reached.
 - PCH2 only: Set EEE LPI Update Timer to 200usec.
 - For PCH2 and newer: When connected at 10Mbps half-duplex, some parts are
   excessively aggressive resulting in many collisions. To avoid this, increase
   the IPG and reduce Rx latency in the PHY.
 - For I21[789] and if EEE is enabled: Disable LPLU if both link partners
   support 100BaseT EEE and 100Full is advertised on both ends of the link, and
   enable Auto Enable LPI since there will be no driver to enable LPI while in
   Sx.

Revision 1.566.2.13 / (download) - annotate - [select for diffs], Sat Jan 26 22:00:07 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.566.2.12: +459 -377 lines
Diff to previous 1.566.2.12 (colored) to branchpoint 1.566 (colored) next main 1.567 (colored)

Sync with HEAD

Revision 1.620 / (download) - annotate - [select for diffs], Fri Jan 25 08:04:07 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-20190127
Changes since 1.619: +5 -5 lines
Diff to previous 1.619 (colored)

 80003's SERDES is not the same as 82575's but the same as legacy devices.
Use the old methods on 80003.

XXX The reason why this bug existed is that our order of WM_T_* was little
different from FreeBSD's enum e1000_mac_type. From 80003 to PCH_CNP and from
82575 to I211 are swapped. I carefully read through if_wm.c and knew only
serdes related test were wrong. When we change WM_T_* to match FreeBSD's,
additional changes also will be required.

Revision 1.619 / (download) - annotate - [select for diffs], Fri Jan 25 03:50:13 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
Changes since 1.618: +3 -3 lines
Diff to previous 1.618 (colored)

 Use __nothing (== ((void)0)) instead of "do {} while (/*CONSTCOND*/false)".

Revision 1.618 / (download) - annotate - [select for diffs], Thu Jan 24 04:50:04 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
Changes since 1.617: +125 -132 lines
Diff to previous 1.617 (colored)

No functional change intended:
- Use "do {} while (/*CONSTCOND*/false)" for null DPRINTF().
- Reduce indent level of wm_linkintr_gmii().

Revision 1.617 / (download) - annotate - [select for diffs], Tue Jan 22 03:42:27 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
Changes since 1.616: +333 -244 lines
Diff to previous 1.616 (colored)

 Change MII PHY read/write API from:

	int (*mii_readreg_t)(device_t, int, int);
	void (*mii_writereg_t)(device_t, int, int, int);
to:

	int (*mii_readreg_t)(device_t, int, int, uint16_t *);
	int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

 In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

 Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

	arm/at91/at91emac.c
	arm/ep93xx/epe.c
	arm/omap/omapl1x_emac.c
	mips/ralink/ralink_eth.c
	arch/powerpc/booke/dev/pq3etsec.c(read)
	dev/cadence/if_cemac.c <- hkenken
	dev/ic/lan9118.c


Tested with the following device:

	axe+ukphy
	axe+rgephy
	axen+rgephy	(tested by Andrius V)
	wm+atphy
	wm+ukphy
	wm+igphy
	wm+ihphy
	wm+makphy
	sk+makphy
	sk+brgphy
	sk+gentbi
	msk+makphy
	sip+icsphy
	sip+ukphy
	re+rgephy
	bge+brgphy
	bnx+brgphy
	gsip+gphyter
	rtk+rlphy
	fxp+inphy	(tested by Andrius V)
	tlp+acphy
	ex+exphy
	epic+qsphy
	vge+ciphy	(tested by Andrius V)
	vr+ukphy	(tested by Andrius V)
	vte+ukphy	(tested by Andrius V)

Not tested (MAC):
	arm:at91emac
	arm:cemac
	arm:epe
	arm:geminigmac
	arm:enet
	arm:cpsw
	arm:emac(omac)
	arm:emac(sunxi)
	arm:npe
	evbppc:temac
	macppc:bm
	macppc:gm
	mips:aumac
	mips:ae
	mips:cnmac
	mips:reth
	mips:sbmac
	playstation2:smap
	powerpc:tsec
	powerpc:emac(ibm4xx)
	sgimips:mec
	sparc:be
	sf
	ne(ax88190, dl10019)
	awge
	ep
	gem
	hme
	smsh
	mtd
	sm
	age
	alc
	ale
	bce
	cas
	et
	jme
	lii
	nfe
	pcn
	ste
	stge
	tl
	xi
	aue
	mue
	smsc
	udav
	url

Not tested (PHY):
	amhphy
	bmtphy
	dmphy
	etphy
	glxtphy
	ikphy
	iophy
	lxtphy
	nsphyter
	pnaphy
	rdcphy
	sqphy
	tlphy
	tqphy
	urlphy

Revision 1.566.2.12 / (download) - annotate - [select for diffs], Fri Jan 18 08:50:27 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.11: +279 -47 lines
Diff to previous 1.566.2.11 (colored) to branchpoint 1.566 (colored)

Synch with HEAD

Revision 1.616 / (download) - annotate - [select for diffs], Fri Jan 11 05:13:26 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-20190118
Changes since 1.615: +3 -3 lines
Diff to previous 1.615 (colored)

 Set I82579_LPI_CTRL register correctly in wm_set_eee_pchlan().

Revision 1.615 / (download) - annotate - [select for diffs], Wed Jan 9 08:28:22 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
Changes since 1.614: +7 -7 lines
Diff to previous 1.614 (colored)

- Remove an extra register read in wm_kmrn_lock_loss_workaround_ich8lan().
- Don't leave the MDICNFG register modified when the Power Management
  capability offset can't get.

Revision 1.614 / (download) - annotate - [select for diffs], Mon Jan 7 01:43:22 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
Changes since 1.613: +269 -41 lines
Diff to previous 1.613 (colored)

 Add EEE(802.3az) support for I350, I210, I211, PCH2 and newer.

 Not yet for I354(C2000). It'll be supported after implementing MI MII clause
45 register read/write API.

Revision 1.613 / (download) - annotate - [select for diffs], Thu Jan 3 08:46:03 2019 UTC (4 years ago) by msaitoh
Branch: MAIN
Changes since 1.612: +4 -3 lines
Diff to previous 1.612 (colored)

 Fix error check. reported by David Binderman in kern/53821.

Revision 1.612 / (download) - annotate - [select for diffs], Sun Dec 30 04:18:09 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.611: +5 -2 lines
Diff to previous 1.611 (colored)

 Accept IFM_NONE.

Revision 1.566.2.11 / (download) - annotate - [select for diffs], Wed Dec 26 14:01:50 2018 UTC (4 years, 1 month ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.10: +566 -127 lines
Diff to previous 1.566.2.10 (colored) to branchpoint 1.566 (colored)

Sync with HEAD, resolve a few conflicts

Revision 1.611 / (download) - annotate - [select for diffs], Fri Dec 21 08:29:22 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-1226
Changes since 1.610: +4 -4 lines
Diff to previous 1.610 (colored)

 Fix WoL detection once again.

Revision 1.610 / (download) - annotate - [select for diffs], Thu Dec 20 09:32:13 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.609: +325 -85 lines
Diff to previous 1.609 (colored)

- Don't setup WoL on non-WoL capable port.
- Setup PHY wakeup feature on PCH and newer. Tested on Thinkpad X220.

Revision 1.609 / (download) - annotate - [select for diffs], Thu Dec 20 08:59:22 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.608: +6 -4 lines
Diff to previous 1.608 (colored)

 Fix WoL capability detection on ICH and PCH.

Revision 1.608 / (download) - annotate - [select for diffs], Thu Dec 20 02:38:28 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.607: +21 -18 lines
Diff to previous 1.607 (colored)

 Rename functions. Add comment. No functional change.

Revision 1.508.4.28 / (download) - annotate - [select for diffs], Tue Dec 18 18:24:09 2018 UTC (4 years, 1 month ago) by martin
Branch: netbsd-8
Changes since 1.508.4.27: +3 -3 lines
Diff to previous 1.508.4.27 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #1138):

	sys/dev/pci/if_wm.c: revision 1.606

Fix txqueue assignment. Pointed out by yamaguchi@n.o, thanks.

E.g. When ncpu is six and nqueue is four, the sequence error occurs.

XXX pullup-8

Revision 1.607 / (download) - annotate - [select for diffs], Mon Dec 17 04:21:44 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.606: +4 -4 lines
Diff to previous 1.606 (colored)

 When sc->phy.acquire() failed, it's not required to call sc->phy.release().

Revision 1.606 / (download) - annotate - [select for diffs], Mon Dec 17 04:14:40 2018 UTC (4 years, 1 month ago) by knakahara
Branch: MAIN
Changes since 1.605: +3 -3 lines
Diff to previous 1.605 (colored)

Fix txqueue assignment. Pointed out by yamaguchi@n.o, thanks.

E.g. When ncpu is six and nqueue is four, the sequence error occurs.

XXX pullup-8

Revision 1.605 / (download) - annotate - [select for diffs], Sat Dec 15 05:40:10 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.604: +9 -5 lines
Diff to previous 1.604 (colored)

 Print and clear the wakeup status only when the WUS register != 0.

Revision 1.604 / (download) - annotate - [select for diffs], Fri Dec 14 09:47:40 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.603: +75 -9 lines
Diff to previous 1.603 (colored)

- Fix availability detection of WoL on some chips. This change has no effect
other than dmesg because WM_F_WOL is currently not used to change the behavior:
  - For ICH/PCH, check the capability not from NVM but from the WUC register.
    Check the value before clearing the register.
  - 82580 and newer have per-port NVM block, so read the area correctly.
    Note that 82580, I350 and I354 may have PCI function 2 and 3.
  - Some devices can't detect WoL capability neither from NVM nor from WUC.
    Use PCI device ID and the function number.
- Print the WUS (WakeUp Status) register bits when resume.

Revision 1.603 / (download) - annotate - [select for diffs], Wed Dec 12 08:49:33 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.602: +145 -21 lines
Diff to previous 1.602 (colored)

Add some code for suspend/resume:
- Rename wm_smbustopci() to wm_init_phy_workarounds_pchlan(). It will also
  called when resume.
- Call wm_phy_resetisblocked() after PHY reset in
  wm_init_phy_workarounds_pchlan() to wait for the PHY to quiesce to an
  accessible state.
- Add new wm_resume_workarounds_pchlan() function and use it in wm_resume().
  This workaround is only for PCH2 and newer.
- Don't call wm_disable_aspm() neither in wm_attach() nor in wm_resume()
  but in wm_reset().
- Do some initialization in wm_resume() when IFF_UP is NOT set.
- Don't continue when it failed to acquire semaphore in wm_ulp_disable().
- Add comment.

Revision 1.508.4.27 / (download) - annotate - [select for diffs], Tue Dec 4 11:21:32 2018 UTC (4 years, 1 month ago) by martin
Branch: netbsd-8
Changes since 1.508.4.26: +431 -111 lines
Diff to previous 1.508.4.26 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1117):

	sys/dev/pci/if_wmreg.h: revision 1.109
	sys/dev/pci/if_wm.c: revision 1.597
	sys/dev/pci/if_wm.c: revision 1.598
	sys/dev/mii/inbmphyreg.h: revision 1.12
	sys/dev/pci/if_wm.c: revision 1.600
	sys/dev/pci/if_wm.c: revision 1.601
	sys/dev/pci/if_wm.c: revision 1.602

- Add new wm_gmii_{hv,i82544}_{read,write}reg_locked() and use them in
   wm_gmii_{hv,i82544}_{read,write}reg(). *_locked() functions are not
   mii(4) API functions, so it's not required to keep the mii API. Change
   the PHY register type from int to uint16_t. It also change the usage of
   return value. It returns zero on success and non-zero on error.
- Check the return value of *_locked() function and treat it.
- Use *writereg_locked() function to reduce race condition in
   wm_init_lcd_from_nvm().
- Add comment.
- Control TX/RX descriptor snooping control bits on ICH8 and newer.
   Only on ICH8, No-snoop bits are opposite polarity. On my Thinkpad X61,
   the default value of this bits are all zero, so this commit changes
   the snoop function enable on the machine. I tested with some other
   PCH machines and those bits are all zero (enable snoop by default),
   so this commit won't affect to some machines.
- Disable relax ordering on 82546GB(Device ID 0x1099 and 0x10b5) or >= ICH8.
   Same as other OSes.
- Add wm_oem_bits_config_ich8lan() to control LPLU and GbE setting base on
   the NVM's info.
- Modify wm_enable_wakeup() to reduce difference against FreeBSD and Linux.
   This modification affects to ICH8 and newer devices. I217 Rapid Start
   Technology support have not written yet (it's TODO).
- Add wm_k1_workaround_lv() from FreeBSD. It's PCH2 specific:
     Workaround to set the K1 beacon duration for 82579 parts in 10Mbps.
     Disable K1 for 1000 and 100 speeds.
- Make wm_link_stall_workaround_hv() and move an 82578 specific code into it.
   Don't apply the workaround if BMCR_LOOP bit is set. Same as FreeBSD.
- Add comment. Modify comment.
  Fix comment. No functional change.

Revision 1.289.2.18 / (download) - annotate - [select for diffs], Wed Nov 28 16:26:31 2018 UTC (4 years, 2 months ago) by martin
Branch: netbsd-7
Changes since 1.289.2.17: +6 -5 lines
Diff to previous 1.289.2.17 (colored) to branchpoint 1.289 (colored) next main 1.290 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1656):

	sys/dev/pci/if_wm.c: revision 1.599

- Fix a bug that i82578 PHY can't detect correctly.
- Print PHY OUI and model number if a PHY's can't be identified.

XXX pullup-[78]

Revision 1.602 / (download) - annotate - [select for diffs], Wed Nov 28 08:19:19 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.601: +3 -3 lines
Diff to previous 1.601 (colored)

 Fix comment. No functional change.

Revision 1.508.4.26 / (download) - annotate - [select for diffs], Mon Nov 26 17:24:51 2018 UTC (4 years, 2 months ago) by snj
Branch: netbsd-8
Changes since 1.508.4.25: +6 -5 lines
Diff to previous 1.508.4.25 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1108):
	sys/dev/pci/if_wm.c: revision 1.599
- Fix a bug that i82578 PHY can't detect correctly.
- Print PHY OUI and model number if a PHY's can't be identified.

Revision 1.566.2.10 / (download) - annotate - [select for diffs], Mon Nov 26 01:52:32 2018 UTC (4 years, 2 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.9: +595 -152 lines
Diff to previous 1.566.2.9 (colored) to branchpoint 1.566 (colored)

Sync with HEAD, resolve a couple of conflicts

Revision 1.601 / (download) - annotate - [select for diffs], Thu Nov 22 15:09:46 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-1126
Changes since 1.600: +138 -21 lines
Diff to previous 1.600 (colored)

- Add wm_k1_workaround_lv() from FreeBSD. It's PCH2 specifc:
    Workaround to set the K1 beacon duration for 82579 parts in 10Mbps.
    Disable K1 for 1000 and 100 speeds.
- Make wm_link_stall_workaround_hv() and move an 82578 specific code into it.
  Don't apply the workaround if BMCR_LOOP bit is set. Same as FreeBSD.
- Add comment. Modify comment.

Revision 1.600 / (download) - annotate - [select for diffs], Tue Nov 20 04:04:42 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.599: +156 -35 lines
Diff to previous 1.599 (colored)

- Add wm_oem_bits_config_ich8lan() to control LPLU and GbE setting base on
  the NVM's info.
- Modify wm_enable_wakeup() to reduce difference against FreeBSD and Linux.
  This modification affects to ICH8 and newer devices. I217 Rapid Start
  Technology support have not written yet (it's TODO).

Revision 1.599 / (download) - annotate - [select for diffs], Tue Nov 20 03:52:03 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.598: +6 -5 lines
Diff to previous 1.598 (colored)

- Fix a bug that i82578 PHY can't detect correctly.
- Print PHY OUI and model number if a PHY's can't be identified.

XXX pullup-[78]

Revision 1.598 / (download) - annotate - [select for diffs], Mon Nov 19 06:38:58 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.597: +23 -2 lines
Diff to previous 1.597 (colored)

- Control TX/RX descriptor snooping control bits on ICH8 and newer.
  Only on ICH8, No-snoop bits are opposite polarity. On my Thinkpas X61,
  the default value of this bits are all zero, so this commit changes
  the snoop function enable on the machine. I tested with some other
  PCH machines and those bits are all zero (enable snoop by default),
  so this commit won't affect to some machines.
- Disable relax ordering on 82546GB(Device ID 0x1099 and 0x10b5) or >= ICH8.
  Same as other OSes.

Revision 1.597 / (download) - annotate - [select for diffs], Wed Nov 14 03:41:20 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.596: +120 -59 lines
Diff to previous 1.596 (colored)

- Add new wm_gmii_{hv,i82544}_{read,write}reg_locked() and use them in
  wm_gmii_{hv,i82544}_{read,write}reg(). *_locked() functions are not
  mii(4) API functions, so it's not required to keep the mii API. Change
  the PHY register type from int to uint16_t. It also change the usage of
  return value. It returns zero on success and non-zero on error.
- Check the return value of *_locked() function and treat it.
- Use *writereg_locked() function to reduce race condition in
  wm_init_lcd_from_nvm().
- Add comment.

Revision 1.289.2.17 / (download) - annotate - [select for diffs], Fri Nov 9 11:28:39 2018 UTC (4 years, 2 months ago) by sborrill
Branch: netbsd-7
Changes since 1.289.2.16: +205 -51 lines
Diff to previous 1.289.2.16 (colored) to branchpoint 1.289 (colored)

Pull up the following revisions(s) (requested by msaitoh in ticket #1648):
	sys/dev/mii/inbmphyreg.h		1.11
	sys/dev/pci/if_wm.c			1.586-1.588, 1.590-1.596 via patch
	sys/dev/pci/if_wmreg.h			1.108

- rename tu event counter to txunderrun.
- Try m_defrag() to reduce the number of DMA segment if bus_dmamap_load_mbuf()
   returned EFBIG. When m_defrag() is called, txqNNdefrag event counter is
   incremented. If the 2nd try of bus_dmamap_load_mbuf() failed, txqNNtoomanyseg
   event counter is incremented.
- Reduce the max number of DMA segments from 256 to 64 (it's the same value
   as other BSD's (EM_MAX_SCATTER) and more than before if_wm.c rev. 1.75's
   value (40)) because we do m_defrag() now.
- 82574 and newer document says the status field has neither EC
   (Excessive Collision) bit nor LC (Late Collision) bit (reserved), so
   don't check the bit.
- Add workaround for DMA hang problem which result in TX device timeout
   on PCH_LPT with I218. Same as FreeBSD and Linux. This workaround is
   only for device ID 0x155a, 0x15a2, 0x1559 and 0x15a3.
- Fix a PCH2 specific bug that wrong PHY register value can be read
   when boot. Same as FreeBSD and Linux.
- After writing MDIC register, don't read quickly the same register but
   do delay(50). Same as other OSes.
- Add missing wm_gate_hw_phy_config_ich8lan(false) in
   wm_phy_post_reset() on PCH2. wm_gate_hw_phy_config_ich8lan(true) is
   called in wm_reset(), so wm_gate_hw_phy_config_ich8lan(false) should
   be called after reset in wm_phy_post_reset().
- On PCH2, set the phy config counter to 50msec after (PHY) reset.
- KNF & Use macro.

Revision 1.508.4.25 / (download) - annotate - [select for diffs], Thu Nov 8 12:09:18 2018 UTC (4 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.24: +164 -42 lines
Diff to previous 1.508.4.24 (colored) to branchpoint 1.508 (colored)

Pull up the following, requested by msaitoh in tickt #1085:

	sys/dev/mii/inbmphyreg.h		1.11
	sys/dev/pci/if_wmreg.h			1.108
	sys/dev/pci/if_wm.c			1.590-1.596 via patch

- 82574 and newer document says the status field has neither EC
  (Excessive Collision) bit nor LC (Late Collision) bit (reserved), so
  don't check the bit.
- Add workaround for DMA hang problem which result in TX device timeout
  on PCH_LPT with I218. Same as FreeBSD and Linux. This workaround is
  only for device ID 0x155a, 0x15a2, 0x1559 and 0x15a3.
- Fix a PCH2 specific bug that wrong PHY register value can be read
  when boot. Same as FreeBSD and Linux.
- After writing MDIC register, don't read quickly the same register but
  do delay(50). Same as other OSes.
- Add missing wm_gate_hw_phy_config_ich8lan(false) in
  wm_phy_post_reset() on PCH2. wm_gate_hw_phy_config_ich8lan(true) is
  called in wm_reset(), so wm_gate_hw_phy_config_ich8lan(false) should
  be called after reset in wm_phy_post_reset().
- On PCH2, set the phy config counter to 50msec after (PHY) reset.
- KNF & Use macro.

Revision 1.596 / (download) - annotate - [select for diffs], Sat Nov 3 21:39:10 2018 UTC (4 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.595: +29 -34 lines
Diff to previous 1.595 (colored)

make this compile again (rv was uninitialized)

Revision 1.595 / (download) - annotate - [select for diffs], Fri Nov 2 08:26:32 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.594: +24 -28 lines
Diff to previous 1.594 (colored)

 KNF a bit. No functional change.

Revision 1.594 / (download) - annotate - [select for diffs], Fri Nov 2 08:16:49 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.593: +20 -3 lines
Diff to previous 1.593 (colored)

- Add missing wm_gate_hw_phy_config_ich8lan(false) in wm_phy_post_reset()
  on PCH2. wm_gate_hw_phy_config_ich8lan(true) is called in wm_reset(), so
  wm_phy_post_reset(false) should be called after reset.
- On PCH2, set the phy config counter to 50msec after (PHY) reset.

Revision 1.593 / (download) - annotate - [select for diffs], Fri Nov 2 08:09:21 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.592: +4 -4 lines
Diff to previous 1.592 (colored)

 After writing MDIC register, don't read quickly the same register but
do delay(50). Same as otehr OSes.

Revision 1.592 / (download) - annotate - [select for diffs], Fri Nov 2 08:04:42 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.591: +23 -6 lines
Diff to previous 1.591 (colored)

 Fix a PCH2 specific bug that wrong register value can be read when boot.
When a wrong value is read when boot, the read device ID was incorrect and
ukphy(3) is attached instead of ihphy(4). The bug might also result in
MDIC read/write error.

 How to reproduce:

  0) Boot Windows.
  1) Leave some minutes.
  2) Reboot to NetBSD.

 To fix this problem, adding extra 100us delay at the end of
wm_gmii_mdic_{read,write}reg() on PCH2. Same as FreeBSD and linux.

 Reported by David Brownlee a few days ago and also reported by jmcneill
a half year ago. Tested with my own Thinkpad X220.

XXX pullup-[78]

Revision 1.591 / (download) - annotate - [select for diffs], Fri Nov 2 03:22:19 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.590: +90 -7 lines
Diff to previous 1.590 (colored)

 Add workaround for DMA hang problem which result in TX device timeout on
PCH_LPT with I218. Same as FreeBSD and Linux. This woraround is only for
device ID 0x155a, 0x15a2, 0x1559 and 0x15a3. I observed this problem on my
Shuttle DS57U's I218 port six times in two months.

Revision 1.590 / (download) - annotate - [select for diffs], Wed Oct 31 06:04:48 2018 UTC (4 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.589: +18 -4 lines
Diff to previous 1.589 (colored)

- 82574 and newer's document says the status field has neither EC
  (Excessive Collision) bit nor LC (Late Collision) bit (reserved).
  Refer "PCIe GbE Controller Open Source Software Developer's Manual",
  82574 datasheet and newer.

  XXX I saw the LC bit was set on I218 even though the media was full duplex,
  so the bit might be used for other meaning ...(I have no document).
- Use macro.

Revision 1.508.4.24 / (download) - annotate - [select for diffs], Tue Oct 30 09:25:13 2018 UTC (4 years, 3 months ago) by sborrill
Branch: netbsd-8
Changes since 1.508.4.23: +4 -3 lines
Diff to previous 1.508.4.23 (colored) to branchpoint 1.508 (colored)

Pull up the following revisions(s) (requested by msaitoh in ticket #1075):
	sys/dev/pci/if_wm.c:	revision 1.589

Fix KASSERT to prevent panic on CNP (Intel 300 series + I219) with INTx
interrupt (Xen dom0 or pre netbsd-8)

Revision 1.289.2.16 / (download) - annotate - [select for diffs], Tue Oct 30 08:35:56 2018 UTC (4 years, 3 months ago) by sborrill
Branch: netbsd-7
Changes since 1.289.2.15: +4 -3 lines
Diff to previous 1.289.2.15 (colored) to branchpoint 1.289 (colored)

Pull up the following revisions(s) (requested by msaitoh in ticket #1647):
	sys/dev/pci/if_wm.c:	revision 1.589

Fix KASSERT to prevent panic on CNP (Intel 300 series + I219) with INTx
interrupt (Xen dom0 or pre netbsd-8)

Revision 1.566.2.9 / (download) - annotate - [select for diffs], Sat Oct 20 06:58:31 2018 UTC (4 years, 3 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.8: +4 -3 lines
Diff to previous 1.566.2.8 (colored) to branchpoint 1.566 (colored)

Sync with head

Revision 1.589 / (download) - annotate - [select for diffs], Fri Oct 5 08:23:58 2018 UTC (4 years, 3 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-1020
Changes since 1.588: +4 -3 lines
Diff to previous 1.588 (colored)

 Fix KASSERT to prevent panic on CNP(Intel 300 series + I219) with INTx
interrupt (Xen dom0 or pre netbsd-8).

XXX pullup-[78]

Revision 1.566.2.8 / (download) - annotate - [select for diffs], Sun Sep 30 01:45:50 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.7: +116 -80 lines
Diff to previous 1.566.2.7 (colored) to branchpoint 1.566 (colored)

Ssync with HEAD

Revision 1.508.4.23 / (download) - annotate - [select for diffs], Sun Sep 23 17:39:02 2018 UTC (4 years, 4 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.22: +116 -80 lines
Diff to previous 1.508.4.22 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1027):
	sys/dev/pci/if_wm.c: revision 1.586
	sys/dev/pci/if_wm.c: revision 1.587
	sys/dev/pci/if_wm.c: revision 1.588

- Split txdrop evcnt into pcqdrop and descdrop.
- Simplify evcnt name by removing duplicated "tx" or "rx".
- s/tu/underrun/

- Try m_defrag() to reduce the number of DMA segment if bus_dmamap_load_mbuf()
   returned EFBIG. When m_defrag() is called, txqNNdefrag event counter is
   incremented. If the 2nd try of bus_dmamap_load_mbuf() failed, txqNNtoomanyseg
   event counter is incremented.

- Reduce the max number of DMA segments from 256 to 64 (it's the same value
   as other BSD's (EM_MAX_SCATTER) and more than before if_wm.c rev. 1.75's
   value (40)) because we do m_defrag() now.

  Fix comment.

Revision 1.588 / (download) - annotate - [select for diffs], Wed Sep 12 05:03:05 2018 UTC (4 years, 4 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-0930
Changes since 1.587: +3 -3 lines
Diff to previous 1.587 (colored)

 Fix comment.

Revision 1.587 / (download) - annotate - [select for diffs], Wed Sep 12 04:59:26 2018 UTC (4 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.586: +43 -9 lines
Diff to previous 1.586 (colored)

- Try m_defrag() to reduce the number of DMA segment if bus_dmamap_load_mbuf()
  returned EFBIG. When m_defrag() is called, txqNNdefrag event counter is
  incremented. If the 2nd try of bus_dmamap_load_mbuf() failed, txqNNtoomanyseg
  event counter is incremented.

- Reduce the max number of DMA segemts from 256 to 64 (it's the same valuse
  as other BSD's (EM_MAX_SCATTER) and more than before if_wm.c rev. 1.75's
  value (40)) because we do m_defrag() now.

Revision 1.586 / (download) - annotate - [select for diffs], Wed Sep 12 04:37:18 2018 UTC (4 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.585: +76 -74 lines
Diff to previous 1.585 (colored)

- Split txdrop evcnt into pcqdrop and descdrop.
- Simplify evcnt name by removing duplicated "tx" or "rx".
- s/tu/underrun/

Revision 1.566.2.7 / (download) - annotate - [select for diffs], Thu Sep 6 06:55:51 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.6: +53 -31 lines
Diff to previous 1.566.2.6 (colored) to branchpoint 1.566 (colored)

Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.585 / (download) - annotate - [select for diffs], Mon Sep 3 16:29:32 2018 UTC (4 years, 4 months ago) by riastradh
Branch: MAIN
CVS Tags: pgoyette-compat-0906
Changes since 1.584: +6 -6 lines
Diff to previous 1.584 (colored)

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)

Revision 1.508.4.22 / (download) - annotate - [select for diffs], Sat Aug 11 14:47:31 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.21: +49 -27 lines
Diff to previous 1.508.4.21 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #969):

	sys/dev/pci/if_wm.c: revision 1.584
	sys/dev/pci/if_wmvar.h: revision 1.39

Add MDIC_WA and CLSEMWA to snprintb() string for WM_F_* flags.

Fix two bugs for non-SERDES fiber. Tested on 82544EI(0x1009), 82545GM(0x1027),
82546GB(0x107a), 82571GB(0x105f), 82572EI(0x107e). Tested on SERDES
82580(0x150e (Winyao SERDES SFP)) and 82580(0x150e) as regression test:

- Fix a bug that the link can't detect in link interrupt function for
   non-SERDES fiber. When the signal is detected & STATUS_LU == 0 & RXCW == 0,
   it's required to set CTRL_SLU and CTRL_FD bit. wm_check_for_link() is the
   function to do it. If a link status change interrupt occurred, call
   wm_check_for_link() before checking current link status.

- Fix a bug that 82542 misunderstand fiber's signal detection. CTRL_SWDPIN(1)
   is used for fiber's signal and it's value is reversed only on 82543 and
   82544. Simplify the code and move it into a new function wm_tbi_havesignal()
   and use it.

Revision 1.289.2.15 / (download) - annotate - [select for diffs], Sat Aug 11 13:34:20 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-2-RELEASE
Changes since 1.289.2.14: +1592 -823 lines
Diff to previous 1.289.2.14 (colored) to branchpoint 1.289 (colored)

Pull up the following, requested by msaitoh in ticket #1628:

share/man/man4/wm.4				1.40 via patch
sys/dev/mii/ihphyreg.h				1.2
sys/dev/mii/inbmphyreg.h			1.10
sys/dev/pci/if_wm.c				1.504, 1.506, 1.510-1.535, 1.539-1.540, 1.546, 1.548, 1.551-1.552, 1.558, 1.565-1.573, 1.575, 1.579, 1.582, 1.584 via patch
sys/dev/pci/if_wmreg.h				1.99-1.103, 1.106-1.107 via patch
sys/dev/pci/if_wmvar.h				1.34-1.39 via patch
sys/dev/pci/pcidevs				1.1327 via patch
sys/dev/pci/pcidevs.h				regen
sys/dev/pci/pcidevs_data.h			regen
sys/dev/pci/pcireg.h				patch

	Sync wm(4) up to 2018/08/08 except MSI/MSI-X and NET_MPSAFE:
	- remove extra "+"
	- Fix a bug that non-GMII devices don't send a routing message when
	  the link status is changed.
	- Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset(). Same as
	  other OSes.
	- If a interrupt is a spurious interrupt, don't print debug message.
	- Don't print the Image Unique ID if an NVM is iNVM (i210 and I211).
	- Print sc_flags with snprintb().
	- Fix a bug that a RAL was written at incorrect address when the index
	  number is more than 16 on 82544 and newer.
	- The layout of RAL on PCH* are different from others. Fix it.
	- Flush every MTA write. Same as Linux.
	- Move the location of calling wm_set_filter. Same as some other OSes.
	- Add CSR_WRITE_FLUSH() after writing WMREG_CTRL in
	  wm_gmii_mediachange().
	- Add missing "else" in wm_nvm_release().
	- Make new wm_phy_post_reset() and use this function at all location
	  after resetting phy.
	- Move the location of calling wm_get_hw_control. Same as Linux.
	- Add I219 specific wokaround for legacy interrupt. From OpenBSD.
	- Move the location of calling wm_lplu_d0_disable().
	- Fix latency calculation in wm_platform_pm_pch_lpt().
	- Set OBFF water mark and enable OBFF on PCH_LPT and newer.
	- Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too.	Before
	  this commit, above devices and non-PCIe devices accessed wrong
	  register.
	- Use device_printf() instead of aprint_error_dev() for PHY read/write
	  functions because those are used not only in device attach.
	- Fix a bug that wm_gmii_i82544_{read,write}reg() didn't take care of
	  page select. PHY access from igphy() automatically did it, but
	  accessing from wm(4) for wrokaround didn't work correctly. This
	  change affects 8254[17], 8257[12] ICH8, ICH9 and ICH10.
	- Call wm_kmrn_lock_loss_workaround_ich8lan() before any PHY access in
	  wm_linkintr_gmii().
	- Register access in wm_kmrn_lock_loss_workaround_ich8lan() now works
	  correctly. Enable this function.
	- Configure the LCD with the extended configuration region in NVM if
	  it's required.
	- If TX is not required to flush, RX is also not required to flush
	  in wm_flush_desc_rings(). Same as other OSes.
	- Remove wrong semaphore access in wm_nvm_{read,write}_{ich8,spt} to
	  prevent hangup. A semaphore is get/put in wm_nvm_{read,write}.
	- Move some initialization stuff in wm_attach() before wm_reset(). Some
	  flags and callback function are required to set correctly before
	  wm_reset() because wm_reset() and some helper functions refer them.
	- Add wm_write_smbus_addr() to set SMBus address by software.
	- Modify wm_gmii_hv_{read,write}reg_locked() to make them access
	  HV_SMB_ADDR correctly.
	- Use new nvm.{acquire,release}() for semaphore.
	- Our MII readreg/writereg API has not way to detect an error.
	  kmrn_{read,write}reg() are not used for MII API, so it's not required
	  for these functions to use the same API. So,
	  - Change return value as error code.
	  - Change register value from int to uint16_t.
	  - read: pass pointer for uint16_t as an argument.
	  - Check return value on caller side.
	- Check whether it's required to use MDIC workaround for 80003 or not
	  in wm_reset(). If the workaround isn't required, don't use the
	  workaround code in wm_gmii_i80003_{read,write}reg.
	- Add WM_F_WA_I210_CLSEM flag for a workaround. FreeBSD/Linux drivers
	  say "In rare circumstances, the SW semaphore may already be held
	  unintentionally on I21[01]". PXE boot is one of the case.
	- Qemu's e1000e emulation (82574L)'s SPI has only 64 words. I've never
	  seen on real 82574 hardware with such small SPI ROM. Check
	  sc->sc_nvm_wordsize before accessing higher address words to prevent
	  timeout.
	- Check some wm_nvm_read()'s return vale.
	- Print NVM offset and word count when EERD polling failed.
	- On I219, drop TARC0 bit 28 for DMA hang workaround (from Linux).
	- 82583 supports jumbo frame. Fixes PR#52773 reported by
	  Shinichi Doyashiki.
	- Fix typo in comment. Reported by Shinichi Doyashiki in PR#52885.
	- Add ASPM workaround for 8257[1234] and 82583 to prevent device
	  timeout or hangup. Fixes PR#52818 reported by Shinichi Doyashiki.
	- CID-1427779: Fix uninitialized variables.
	- Fix a bug that wm_pll_workaround_i210() is not called when
	  a) Chip is I211 or b) Chip is I210 and it uses iNVM (not FLASH).
	- Do wm_reset_mdicnfg_82580() on 82580 only.
	- Fix FLASH access on PCH_SPT and newer. Their FLASH access should be
	  done by 32bit. Especially for ICH_FLASH_HSFCTL register, it's located
	  at 0x0006, so it must be accessed via ICH_FLASH_HSFSTS(0x0004) and
	  use shift or mask.
	- Make wm_nvm_valid_bank_detect_ich8lan() the same as other OSes.
	- If the extended configuration size in the EXTCNFSIZE register is 0,
	  don't continue in wm_init_lcd_from_nvm().
	- Add PCH_CNP support (I219 with Intel 300 series chipset).
	- Enable I219 support.
	- I354 uses an external PHY, so don't use wm_set_eee_i350().
	- Fix a bug that the link can't detect in link interrupt function for
	  non-SERDES fiber.
	- Fix a bug that 82542 misunderstand fiber's signal detection.
	- Add debug printf()s.
	- Update comment.
	- Rename functions and variables.
	- Add diagnostic code.
	- Sort registers.
	- Lowercase hexadecimal values.
	- KNF.

Revision 1.584 / (download) - annotate - [select for diffs], Thu Aug 9 16:27:23 2018 UTC (4 years, 5 months ago) by msaitoh
Branch: MAIN
CVS Tags: jdolecek-ncqfixes-base, jdolecek-ncqfixes
Changes since 1.583: +49 -27 lines
Diff to previous 1.583 (colored)

Fix two bugs for non-SERDES fiber. Tested on 82544EI(0x1009), 82545GM(0x1027),
82546GB(0x107a), 82571GB(0x105f), 82572EI(0x107e). Tested on SERDES
82580(0x150e (Winyao SERDES SFP)) and 82580(0x150e) as regression test:

- Fix a bug that the link can't detect in link interrupt function for
  non-SERDES fiber. When the signal is detected & STATUS_LU == 0 & RXCW == 0,
  it's required to set CTRL_SLU and CTRL_FD bit. wm_check_for_link() is the
  function to do it. If a link status change interrupt occured, call
  wm_check_for_link() before checking current link staus.
- Fix a bug that 82542 misunderstand fiber's signal detection. CTRL_SWDPIN(1)
  is used for fiber's signal and it's value is reversed only on 82543 and
  82544. Simplify the code and move it into a new function wm_tbi_havesignal()
  and use it.

Revision 1.566.2.6 / (download) - annotate - [select for diffs], Sat Jul 28 04:37:46 2018 UTC (4 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.5: +4 -4 lines
Diff to previous 1.566.2.5 (colored) to branchpoint 1.566 (colored)

Sync with HEAD

Revision 1.508.4.21 / (download) - annotate - [select for diffs], Thu Jul 26 20:40:39 2018 UTC (4 years, 6 months ago) by snj
Branch: netbsd-8
Changes since 1.508.4.20: +214 -205 lines
Diff to previous 1.508.4.20 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #928):
	sys/dev/pci/if_wm.c: 1.573-1.576, 1.579 and 1.582 via patch
wm(4):
- Count timeout correctly. This change reduce timeout value for 80003
  as expected. Reported by mouse@.
- Print "device timeout (lost interrupt)"  when all descriptors in a
  queue are free.
- Rename txq_watchdog to txq_sending to make the meaning clear.
- KNF. No functional change.

Revision 1.583 / (download) - annotate - [select for diffs], Tue Jun 26 06:48:01 2018 UTC (4 years, 7 months ago) by msaitoh
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-0728
Branch point for: phil-wifi
Changes since 1.582: +4 -4 lines
Diff to previous 1.582 (colored)

 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.

Revision 1.566.2.5 / (download) - annotate - [select for diffs], Mon Jun 25 07:25:52 2018 UTC (4 years, 7 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.4: +131 -143 lines
Diff to previous 1.566.2.4 (colored) to branchpoint 1.566 (colored)

Sync with HEAD

Revision 1.582 / (download) - annotate - [select for diffs], Wed Jun 20 05:19:12 2018 UTC (4 years, 7 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-0625
Changes since 1.581: +128 -140 lines
Diff to previous 1.581 (colored)

 Style fix. No functional change.

Revision 1.508.4.20 / (download) - annotate - [select for diffs], Thu Jun 7 17:42:25 2018 UTC (4 years, 7 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RELEASE, netbsd-8-0-RC2
Changes since 1.508.4.19: +3 -3 lines
Diff to previous 1.508.4.19 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #843):

	sys/dev/pci/ixgbe/ixv.c: revision 1.101
	sys/net/if_bridge.c: revision 1.156
	sys/net/if_pppoe.c: revision 1.138
	sys/dev/pci/if_wm.c: revision 1.580
	sys/dev/pci/ixgbe/ixgbe.c: revision 1.156
	sys/net/if_gif.c: revision 1.142

Ensure to call if_register after interface initializations finish

Revision 1.581 / (download) - annotate - [select for diffs], Fri Jun 1 08:56:00 2018 UTC (4 years, 7 months ago) by maxv
Branch: MAIN
Changes since 1.580: +4 -4 lines
Diff to previous 1.580 (colored)

Rename

	M_CSUM_DATA_IPv6_HL -> M_CSUM_DATA_IPv6_IPHL
	M_CSUM_DATA_IPv6_HL_SET -> M_CSUM_DATA_IPv6_SET

Reduces the diff against IPv4. Also, clarify the definitions.

Revision 1.580 / (download) - annotate - [select for diffs], Fri May 25 04:40:26 2018 UTC (4 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.579: +3 -3 lines
Diff to previous 1.579 (colored)

Ensure to call if_register after interface initializations finish

Revision 1.566.2.4 / (download) - annotate - [select for diffs], Mon May 21 04:36:06 2018 UTC (4 years, 8 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.3: +15 -14 lines
Diff to previous 1.566.2.3 (colored) to branchpoint 1.566 (colored)

Sync with HEAD

Revision 1.508.4.19 / (download) - annotate - [select for diffs], Thu May 17 13:58:07 2018 UTC (4 years, 8 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.18: +4 -4 lines
Diff to previous 1.508.4.18 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #827):

	sys/dev/pci/if_wm.c: revision 1.577

rxipsum and rxtusum are not interrupt counter, so use EVCNT_TYPE_MISC
instead of EVCNT_TYPE_INTR.

Revision 1.579 / (download) - annotate - [select for diffs], Thu May 10 03:43:42 2018 UTC (4 years, 8 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-0521
Changes since 1.578: +12 -12 lines
Diff to previous 1.578 (colored)

 KNF. No binary change.

Revision 1.508.4.18 / (download) - annotate - [select for diffs], Wed May 9 15:28:44 2018 UTC (4 years, 8 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.17: +3 -2 lines
Diff to previous 1.508.4.17 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #816):

	sys/dev/pci/if_wm.c: revision 1.578

  Fix a bug that TX might stall because WM_TXQ_NO_SPACE is not cleared in
if_init() (though I've never seen this problem). Clear txq->txq_flags in
wm_init_tx_queue(). OK'd by knakahara.

Revision 1.578 / (download) - annotate - [select for diffs], Tue May 8 11:36:39 2018 UTC (4 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.577: +3 -2 lines
Diff to previous 1.577 (colored)

 Fix a bug that TX might stall because WM_TXQ_NO_SPACE is not cleared in
if_init() (though I've never seen this problem). Clear txq->txq_flags in
wm_init_tx_queue(). OK'd by knakahara.

Revision 1.577 / (download) - annotate - [select for diffs], Tue May 8 07:59:56 2018 UTC (4 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.576: +4 -4 lines
Diff to previous 1.576 (colored)

 rxipsum and rxtusum are not interrupt counter, so use EVCNT_TYPE_MISC
instead of EVCNT_TYPE_INTR.

Revision 1.566.2.3 / (download) - annotate - [select for diffs], Wed May 2 07:20:06 2018 UTC (4 years, 8 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.2: +18 -14 lines
Diff to previous 1.566.2.2 (colored) to branchpoint 1.566 (colored)

Synch with HEAD

Revision 1.576 / (download) - annotate - [select for diffs], Mon Apr 23 01:35:25 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-0502
Changes since 1.575: +16 -13 lines
Diff to previous 1.575 (colored)

- Backout if_wm.c rev.1.574 and print "device timeout (lost interrupt)"
 when all descriptors in a queue are free. When all descriptors are free after
 wm_txeof(), it's caused by lost interrupt (though I've never seen it). One
 possibility is chip bug and another possibility is software bug. We should
 reset in any cases. If we don't reset and don't print error message, TX
 processing is done intermittently and user might not noticed the problem.

- Rename txq_watchdog to txq_sending to make the meaning clear.

Revision 1.575 / (download) - annotate - [select for diffs], Mon Apr 23 01:29:23 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.574: +4 -3 lines
Diff to previous 1.574 (colored)

 Count timeout correctly. This change reduce timeout value for 80003 as
expected. Reported by mouse@.

Revision 1.566.2.2 / (download) - annotate - [select for diffs], Sun Apr 22 07:20:21 2018 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566.2.1: +67 -50 lines
Diff to previous 1.566.2.1 (colored) to branchpoint 1.566 (colored)

Sync with HEAD

Revision 1.574 / (download) - annotate - [select for diffs], Fri Apr 20 03:03:13 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-0422
Changes since 1.573: +5 -4 lines
Diff to previous 1.573 (colored)

 Fix watchdog timer. Without this change, watchdog timer is unnecessary
fired and device is initialized without any error message. OK'd by knakahara.

Revision 1.508.4.17 / (download) - annotate - [select for diffs], Mon Apr 16 14:25:49 2018 UTC (4 years, 9 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RC1
Changes since 1.508.4.16: +153 -51 lines
Diff to previous 1.508.4.16 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #764):

	sys/dev/pci/if_wm.c: revision 1.567
	sys/dev/pci/if_wm.c: revision 1.568
	sys/dev/pci/if_wm.c: revision 1.569
	sys/dev/pci/if_wmvar.h: revision 1.38
	sys/dev/pci/if_wm.c: revision 1.570
	sys/dev/pci/if_wm.c: revision 1.571
	sys/dev/pci/if_wm.c: revision 1.572
	share/man/man4/wm.4: revision 1.40
	sys/dev/pci/if_wmreg.h: revision 1.106
	sys/dev/pci/if_wmreg.h: revision 1.107

SW PHY Config Enable bit for ICH8 B0 stepping is not bit 1 but bit 0.

 No binary change:
- Sort registers.
- Lowercase hexadecimal value.

 On PCH_SPT (and newer), FLASH access should be done by 32bit.
Especially for ICH_FLASH_HSFCTL register, it's located at 0x0006, so
it should be accessed via ICH_FLASH_HSFSTS(0x0004) and use shift or mask.

 Our PCH_SPT part of wm_nvm_valid_bank_detect_ich8lan() was based on
FreeBSD r287467. After that, they reverted it and committed the different
code in r287762. r287762's bank detect code didn't work for us because our wm
dirver had a problem in flash access. The problem was fixed in if_wm.c rev.
1.567, so we can use the new way now.

 If the extended configration size in the EXTCNFSIZE register is 0, don't
continue.
 Add PCH_CNP support (I219 with Intel 300 series chipset).
It's required more test, so it's disabled by default.

 Enable I219.

 I354 uses an external PHY, so don't use wm_set_eee_i350().

Revision 1.573 / (download) - annotate - [select for diffs], Mon Apr 16 08:31:06 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.572: +64 -48 lines
Diff to previous 1.572 (colored)

 KNF. No functional change.

Revision 1.566.2.1 / (download) - annotate - [select for diffs], Mon Apr 16 01:59:58 2018 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.566: +153 -51 lines
Diff to previous 1.566 (colored)

Sync with HEAD, resolve some conflicts

Revision 1.572 / (download) - annotate - [select for diffs], Fri Apr 13 09:35:10 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-0415
Changes since 1.571: +8 -3 lines
Diff to previous 1.571 (colored)

 I354 uses an external PHY, so don't use wm_set_eee_i350().

Revision 1.571 / (download) - annotate - [select for diffs], Fri Apr 13 06:04:12 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.570: +2 -4 lines
Diff to previous 1.570 (colored)

 Enable I219.

Revision 1.570 / (download) - annotate - [select for diffs], Thu Apr 12 03:25:08 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.569: +65 -24 lines
Diff to previous 1.569 (colored)

 Add PCH_CNP support (I219 with Intel 300 series chipset).
It's required more test, so it's disabled by default.

Revision 1.569 / (download) - annotate - [select for diffs], Thu Apr 12 03:13:04 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.568: +4 -2 lines
Diff to previous 1.568 (colored)

 If the extended configration size in the EXTCNFSIZE register is 0, don't
continue.

Revision 1.568 / (download) - annotate - [select for diffs], Thu Apr 12 03:09:24 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.567: +29 -14 lines
Diff to previous 1.567 (colored)

 Our PCH_SPT part of wm_nvm_valid_bank_detect_ich8lan() was based on
FreeBSD r287467. After that, they reverted it and committed the different
code in r287762. r287762's bank detect code didn't work for us because our wm
dirver had a problem in flash access. The problem was fixed in if_wm.c rev.
1.567, so we can use the new way now.

Revision 1.567 / (download) - annotate - [select for diffs], Thu Apr 12 02:48:59 2018 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.566: +56 -15 lines
Diff to previous 1.566 (colored)

 On PCH_SPT (and newer), FLASH access should be done by 32bit.
Especially for ICH_FLASH_HSFCTL register, it's located at 0x0006, so
it should be accessed via ICH_FLASH_HSFSTS(0x0004) and use shift or mask.

Revision 1.508.4.16 / (download) - annotate - [select for diffs], Tue Mar 6 10:59:04 2018 UTC (4 years, 10 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.15: +21 -11 lines
Diff to previous 1.508.4.15 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #604):
	sys/dev/pci/if_wm.c: revision 1.565-1.566

- Fix a bug that wm_pll_workaround_i210() is not called on some cases.
   As I wrote in if_wm.c rev 1.329's commit message, There are three cases:
     a) Chip is I211
     b) Chip is I210 and it uses INVM (not FLASH)
     c) Chip is I210 (it uses FLASH) and NVM image version < 3.25
   Before this commit, the workaround function was not called on a) and b).

- Rename function.

Do wm_reset_mdicnfg_82580() on 82580 only.

Revision 1.566 / (download) - annotate - [select for diffs], Thu Mar 1 03:32:33 2018 UTC (4 years, 11 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.565: +4 -2 lines
Diff to previous 1.565 (colored)

 Do wm_reset_mdicnfg_82580() on 82580 only.

Revision 1.565 / (download) - annotate - [select for diffs], Thu Mar 1 03:30:12 2018 UTC (4 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.564: +19 -11 lines
Diff to previous 1.564 (colored)

- Fix a bug that wm_pll_workaround_i210() is not called on some cases.
  As I wrote in if_wm.c rev 1.329's commit message, There are three cases:

    a) Chip is I211
    b) Chip is I210 and it uses INVM (not FLASH)
    c) Chip is I210 (it uses FLASH) and NVM image version < 3.25

  Before this commit, the workaround function was not called on a) and b).

- Rename function.

Revision 1.508.4.15 / (download) - annotate - [select for diffs], Mon Feb 26 00:25:16 2018 UTC (4 years, 11 months ago) by snj
Branch: netbsd-8
Changes since 1.508.4.14: +6 -42 lines
Diff to previous 1.508.4.14 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #567):
	distrib/sets/lists/comp/mi: 1.2182-1.2183
	sys/dev/pci/if_wm.c: 1.564
	sys/dev/pci/ixgbe/ixgbe.c: 1.122
	sys/dev/pci/ixgbe/ixgbe_rss.h: 1.3
	sys/dev/pci/ixgbe/ixv.c: 1.78
	sys/net/Makefile: 1.35-1.36
	sys/net/files.net: 1.15
	sys/net/rss_config.c: 1.1
	sys/net/rss_config.h: 1.1
Introduce very simple Receive Side Scaling (RSS) utility.
ok by msaitoh@n.o.
--
Apply RSS utility to wm(4).
ok by msaitoh@n.o.
--
Apply RSS utility to ixg(4) and ixv(4).
ok by msaitoh@n.o.
--
Fix build failure, sorry.
--
Currently, it is not necessary to install rss_config.h. Pointed out by msaitoh@n.o.

Revision 1.508.4.14 / (download) - annotate - [select for diffs], Mon Feb 26 00:00:53 2018 UTC (4 years, 11 months ago) by snj
Branch: netbsd-8
Changes since 1.508.4.13: +38 -15 lines
Diff to previous 1.508.4.13 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #564):
	sys/dev/pci/if_wm.c: 1.563
Fix a bug that RX and TX may stall on heavy load on wm(4) like ixgbe.c:r1.121.
wm_rxeof() and wm_txeof() have loop limit and the function returns true
if a packet still exists.

Revision 1.564 / (download) - annotate - [select for diffs], Fri Feb 16 04:49:27 2018 UTC (4 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.563: +6 -42 lines
Diff to previous 1.563 (colored)

Apply RSS utility to wm(4).

ok by msaitoh@n.o.

Revision 1.563 / (download) - annotate - [select for diffs], Wed Feb 14 12:56:00 2018 UTC (4 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.562: +38 -15 lines
Diff to previous 1.562 (colored)

Fix a bug that RX and TX may stall on heavy load on wm(4) like ixgbe.c:r1.121.

wm_rxeof() and wm_txeof() have loop limit and the function returns true
if a packet still exists.

XXX need pullup-8

Revision 1.508.4.13 / (download) - annotate - [select for diffs], Mon Feb 5 15:07:30 2018 UTC (4 years, 11 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.12: +168 -56 lines
Diff to previous 1.508.4.12 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #529):
	sys/dev/pci/if_wm.c: revision 1.560
	sys/dev/pci/if_wm.c: revision 1.561
	sys/dev/pci/if_wm.c: revision 1.562
	share/man/man4/wm.4: revision 1.37
	share/man/man4/wm.4: revision 1.38
	sys/dev/pci/if_wm.c: revision 1.551
	sys/dev/pci/if_wm.c: revision 1.553
	sys/dev/pci/if_wm.c: revision 1.554
	sys/dev/pci/if_wm.c: revision 1.555
	sys/dev/pci/if_wm.c: revision 1.556
	sys/dev/pci/if_wm.c: revision 1.557
	sys/dev/pci/if_wm.c: revision 1.558
	sys/dev/pci/if_wm.c: revision 1.559
PR/52885 - Shinichi Doyashiki -- typo in comment
Fix legacy Tx descriptors printing when WM_DEBUG is enabled.
improve comments
Fix wm_watchdog_txq() lock region.
Not only wm_txeof() but also wm_watchdog_txq() itself requires txq_lock
as it reads Tx descriptor management variables such as "txq_free".
There is almost no influence on performance.
Fix duplicated "rxintr" evcnt counting. Pointed out by ozaki-r@n.o, thanks.
wm_txeof() can limit the loop count the same as wm_rxeof() now.
add WM_TX_PROCESS_LIMIT_DEFAULT and WM_TX_INTR_PROCESS_LIMIT_DEFAULT man.
More markup.
CID-1427779: Fix uninitialized variables
Fix 82574 MSI-X mode cannot receive packets after 82574 receives high rate traffic.
In short, 82574 MSI-X mode does not cause RXQ MSI-X vector when 82574's
phys FIFO overflows. I don't know why but 82574 causes not RXQ MSI-X vector
but OTHER MSI-X vector at the situation.
see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.15-rc9&id=4aea7a5c5e940c1723add439f4088844cd26196d
advised by msaitoh@n.o, thanks.
Fix if_wm.c:r1.557 merge miss, sorry.
Fix unmatched return type. The return value of wm_txeof() is not useded yet.
Make wm(4) watchdog MP-safe. There is almost no influence on performance.
wm(4) does not use ifp->if_watchdog now, that is, it does not touch
ifp->if_timer.
It also uses own callout(wm_tick) as watchdog now. The watchdog uses
per-queue counter to check timeout. So, global lock is not required.

Revision 1.562 / (download) - annotate - [select for diffs], Tue Jan 30 08:15:47 2018 UTC (4 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.561: +55 -27 lines
Diff to previous 1.561 (colored)

Make wm(4) watchdog MP-safe. There is almost no influence on performance.

wm(4) does not use ifp->if_watchdog now, that is, it does not touch
ifp->if_timer.
It also uses own callout(wm_tick) as watchdog now. The watchdog uses
per-queue counter to check timeout. So, global lock is not required.

Revision 1.561 / (download) - annotate - [select for diffs], Mon Jan 29 04:17:32 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.560: +3 -5 lines
Diff to previous 1.560 (colored)

Fix unmatched return type. The return value of wm_txeof() is not useded yet.

Revision 1.560 / (download) - annotate - [select for diffs], Mon Jan 29 03:42:30 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.559: +2 -4 lines
Diff to previous 1.559 (colored)

Fix if_wm.c:r1.557 merge miss, sorry.

Revision 1.559 / (download) - annotate - [select for diffs], Fri Jan 26 16:25:28 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.558: +50 -9 lines
Diff to previous 1.558 (colored)

Fix 82574 MSI-X mode cannot receive packets after 82574 receives high rate traffic.

In short, 82574 MSI-X mode does not cause RXQ MSI-X vector when 82574's
phys FIFO overflows. I don't know why but 82574 causes not RXQ MSI-X vector
but OTHER MSI-X vector at the situation.
see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.15-rc9&id=4aea7a5c5e940c1723add439f4088844cd26196d

advised by msaitoh@n.o, thanks.

Revision 1.558 / (download) - annotate - [select for diffs], Sun Jan 21 04:07:49 2018 UTC (5 years ago) by christos
Branch: MAIN
Changes since 1.557: +3 -3 lines
Diff to previous 1.557 (colored)

CID-1427779: Fix uninitialized variables

Revision 1.557 / (download) - annotate - [select for diffs], Thu Jan 18 09:36:26 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.556: +33 -14 lines
Diff to previous 1.556 (colored)

wm_txeof() can limit the loop count the same as wm_rxeof() now.

Revision 1.556 / (download) - annotate - [select for diffs], Wed Jan 17 02:16:07 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.555: +6 -3 lines
Diff to previous 1.555 (colored)

Fix duplicated "rxintr" evcnt counting. Pointed out by ozaki-r@n.o, thanks.

Revision 1.555 / (download) - annotate - [select for diffs], Tue Jan 16 07:23:13 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.554: +14 -4 lines
Diff to previous 1.554 (colored)

Fix wm_watchdog_txq() lock region.

Not only wm_txeof() but also wm_watchdog_txq() itself requires txq_lock
as it reads Tx descriptor management variables such as "txq_free".

There is almost no influence on performance.

Revision 1.554 / (download) - annotate - [select for diffs], Mon Jan 15 04:25:48 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.553: +6 -2 lines
Diff to previous 1.553 (colored)

improve comments

Revision 1.553 / (download) - annotate - [select for diffs], Mon Jan 15 04:09:58 2018 UTC (5 years ago) by knakahara
Branch: MAIN
Changes since 1.552: +18 -7 lines
Diff to previous 1.552 (colored)

Fix legacy Tx descriptors printing when WM_DEBUG is enabled.

Revision 1.508.4.12 / (download) - annotate - [select for diffs], Sat Jan 13 21:42:45 2018 UTC (5 years ago) by snj
Branch: netbsd-8
Changes since 1.508.4.11: +85 -10 lines
Diff to previous 1.508.4.11 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #491):
	sys/dev/pci/if_wm.c: 1.550, 1.552
 Don't use MSI-X if we can use only one queue to save interrupt resource.
Written by knakahara and tested by me.
--
 Add ASPM workaround for 8257[1234] and 82583 to prevent device timeout or
hangup. Fixes PR#52818 reported by Shinichi Doyashiki.

Revision 1.552 / (download) - annotate - [select for diffs], Thu Jan 4 09:43:27 2018 UTC (5 years ago) by msaitoh
Branch: MAIN
Changes since 1.551: +68 -2 lines
Diff to previous 1.551 (colored)

 Add ASPM workaround for 8257[1234] and 82583 to prevent device timeout or
hangup. Fixes PR#52818 reported by Shinichi Doyashiki.

Revision 1.508.4.11 / (download) - annotate - [select for diffs], Tue Jan 2 10:20:33 2018 UTC (5 years ago) by snj
Branch: netbsd-8
Changes since 1.508.4.10: +5 -5 lines
Diff to previous 1.508.4.10 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #456):
	sys/arch/arm/sunxi/sunxi_emac.c: 1.9
	sys/dev/ic/dwc_gmac.c: 1.43-1.44
	sys/dev/pci/if_iwm.c: 1.75
	sys/dev/pci/if_wm.c: 1.543
	sys/dev/pci/ixgbe/ixgbe.c: 1.112
	sys/dev/pci/ixgbe/ixv.c: 1.74
	sys/kern/sys_socket.c: 1.75
	sys/net/agr/if_agr.c: 1.43
	sys/net/bpf.c: 1.219
	sys/net/if.c: 1.397, 1.399, 1.401-1.403, 1.406-1.410, 1.412-1.416
	sys/net/if.h: 1.242-1.247, 1.250, 1.252-1.257
	sys/net/if_bridge.c: 1.140 via patch, 1.142-1.146
	sys/net/if_etherip.c: 1.40
	sys/net/if_ethersubr.c: 1.243, 1.246
	sys/net/if_faith.c: 1.57
	sys/net/if_gif.c: 1.132
	sys/net/if_l2tp.c: 1.15, 1.17
	sys/net/if_loop.c: 1.98-1.101
	sys/net/if_media.c: 1.35
	sys/net/if_pppoe.c: 1.131-1.132
	sys/net/if_spppsubr.c: 1.176-1.177
	sys/net/if_tun.c: 1.142
	sys/net/if_vlan.c: 1.107, 1.109, 1.114-1.121
	sys/net/npf/npf_ifaddr.c: 1.3
	sys/net/npf/npf_os.c: 1.8-1.9
	sys/net/rtsock.c: 1.230
	sys/netcan/if_canloop.c: 1.3-1.5
	sys/netinet/if_arp.c: 1.255
	sys/netinet/igmp.c: 1.65
	sys/netinet/in.c: 1.210-1.211
	sys/netinet/in_pcb.c: 1.180
	sys/netinet/ip_carp.c: 1.92, 1.94
	sys/netinet/ip_flow.c: 1.81
	sys/netinet/ip_input.c: 1.362
	sys/netinet/ip_mroute.c: 1.147
	sys/netinet/ip_output.c: 1.283, 1.285, 1.287
	sys/netinet6/frag6.c: 1.61
	sys/netinet6/in6.c: 1.251, 1.255
	sys/netinet6/in6_pcb.c: 1.162
	sys/netinet6/ip6_flow.c: 1.35
	sys/netinet6/ip6_input.c: 1.183
	sys/netinet6/ip6_output.c: 1.196
	sys/netinet6/mld6.c: 1.90
	sys/netinet6/nd6.c: 1.239-1.240
	sys/netinet6/nd6_nbr.c: 1.139
	sys/netinet6/nd6_rtr.c: 1.136
	sys/netipsec/ipsec_output.c: 1.65
	sys/rump/net/lib/libnetinet/netinet_component.c: 1.9-1.10
kmem_intr_free kmem_intr_[z]alloced memory
the underlying pools are the same but api-wise those should match
Unify IFEF_*_MPSAFE into IFEF_MPSAFE
There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.
Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).
Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.
Proposed on tech-kern@ and tech-net@
Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch
It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..."
scattered all over the source code and makes it easy to identify remaining
KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE.
No functional change
Hold KERNEL_LOCK on if_ioctl selectively based on IFEF_MPSAFE
If IFEF_MPSAFE is set, hold the lock and otherwise don't hold.
This change requires additions of KERNEL_LOCK to subsequence functions from
if_ioctl such as ifmedia_ioctl and ifioctl_common to protect non-MP-safe
components.
Proposed on tech-kern@ and tech-net@
Ensure to hold if_ioctl_lock when calling if_flags_set
Fix locking against myself on ifpromisc
vlan_unconfig_locked could be called with holding if_ioctl_lock.
Ensure to not turn on IFF_RUNNING of an interface until its initialization completes
And ensure to turn off it before destruction as per IFF_RUNNING's description
"resource allocated". (The description is a bit doubtful though, I believe the
change is still proper.)
Ensure to hold if_ioctl_lock on if_up and if_down
One exception for if_down is if_detach; in the case the lock isn't needed
because it's guaranteed that no other one can access ifp at that point.
Make if_link_queue MP-safe if IFEF_MPSAFE
if_link_queue is a queue to store events of link state changes, which is
used to pass events from (typically) an interrupt handler to
if_link_state_change softint. The queue was protected by KERNEL_LOCK so far,
but if IFEF_MPSAFE is enabled, it becomes unsafe because (perhaps) an interrupt
handler of an interface with IFEF_MPSAFE doesn't take KERNEL_LOCK. Protect it
by a spin mutex.
Additionally with this change KERNEL_LOCK of if_link_state_change softint is
omitted if NET_MPSAFE is enabled.
Note that the spin mutex is now ifp->if_snd.ifq_lock as well as the case of
if_timer (see the comment).
Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH
At that point no other one modifies the list so IFADDR_READER_FOREACH
is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though,
if we try to detect contract violations of pserialize, using it violates
the contract. So avoid using it makes life easy.
Ensure to call if_addr_init with holding if_ioctl_lock
Get rid of outdated comments
Fix build of kernels without ether
By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.
PR kern/52790
Rename IFNET_LOCK to IFNET_GLOBAL_LOCK
IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then).
Wrap if_ioctl_lock with IFNET_* macros (NFC)
Also if_ioctl_lock perhaps needs to be renamed to something because it's now
not just for ioctl...
Reorder some destruction routines in if_detach
- Destroy if_ioctl_lock at the end of the if_detach because it's used in various
  destruction routines
- Move psref_target_destroy after pr_purgeif because we want to use psref in
  pr_purgeif (otherwise destruction procedures can be tricky)
Ensure to call if_mcast_op with holding IFNET_LOCK
Note that CARP doesn't deal with IFNET_LOCK yet.
Remove IFNET_GLOBAL_LOCK where it's unnecessary because IFNET_LOCK is held
Describe which lock is used to protect each member variable of struct ifnet
Requested by skrll@
Write a guideline for converting an interface to IFEF_MPSAFE
Requested by skrll@
Note that IFNET_LOCK must not be held in softint
Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
Because recent investigations show that interfaces with IFEF_MPSAFE need to
follow additional restrictions to work with the flag safely. We should enable it
on an interface by default only if the interface surely satisfies the
restrictions, which are described in if.h.
Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because
the network stack is still serialized by the big kernel locks by default.

Revision 1.551 / (download) - annotate - [select for diffs], Mon Jan 1 08:33:28 2018 UTC (5 years ago) by jnemeth
Branch: MAIN
Changes since 1.550: +3 -3 lines
Diff to previous 1.550 (colored)

PR/52885 - Shinichi Doyashiki -- typo in comment

Revision 1.550 / (download) - annotate - [select for diffs], Thu Dec 28 06:13:50 2017 UTC (5 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.549: +19 -10 lines
Diff to previous 1.549 (colored)

 Don't use MSI-X if we can use only one queue to save interrupt resource.
Written by knakahara and tested by me.

Revision 1.508.4.10 / (download) - annotate - [select for diffs], Sun Dec 10 10:16:09 2017 UTC (5 years, 1 month ago) by snj
Branch: netbsd-8
Changes since 1.508.4.9: +14 -9 lines
Diff to previous 1.508.4.9 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #432):
	sys/dev/pci/if_wm.c: revision 1.548
Fix a bug that 8257[56] can't receive packet reported by Bert Kiers in
PR#52717. For 82575 and 82576, the RX descriptors must be initialized after
the setting of RCTL.EN in wm_set_filter(). This bug was added in if_wm.c
rev. 1.515.

Revision 1.508.4.9 / (download) - annotate - [select for diffs], Sun Dec 10 10:10:24 2017 UTC (5 years, 1 month ago) by snj
Branch: netbsd-8
Changes since 1.508.4.8: +8 -3 lines
Diff to previous 1.508.4.8 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #427):
	sys/arch/amiga/dev/if_bah_zbus.c: 1.17
	sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
	sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
	sys/arch/usermode/dev/if_veth.c: 1.9
	sys/dev/ic/an.c: 1.66
	sys/dev/ic/athn.c: 1.17
	sys/dev/ic/atw.c: 1.162
	sys/dev/ic/bwi.c: 1.33
	sys/dev/ic/dwc_gmac.c: 1.41-1.42
	sys/dev/ic/malo.c: 1.10
	sys/dev/ic/rt2560.c: 1.31
	sys/dev/ic/rt2661.c: 1.36
	sys/dev/ic/rt2860.c: 1.29
	sys/dev/ic/rtw.c: 1.127
	sys/dev/ic/rtwvar.h: 1.46
	sys/dev/ic/smc90cx6.c: 1.71
	sys/dev/ic/smc90cx6var.h: 1.12
	sys/dev/ic/wi.c: 1.244
	sys/dev/pci/if_ipw.c: 1.66
	sys/dev/pci/if_iwi.c: 1.104
	sys/dev/pci/if_iwm.c: 1.76
	sys/dev/pci/if_iwn.c: 1.86
	sys/dev/pci/if_rtwn.c: 1.13
	sys/dev/pci/if_wm.c: 1.541
	sys/dev/pci/if_wpi.c: 1.79
	sys/dev/pci/ixgbe/ixgbe.c: 1.106
	sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
	sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
	sys/dev/scsipi/if_se.c: 1.95
	sys/dev/usb/if_upl.c: 1.60
	sys/net/if.c: 1.396
	sys/net/if.h: 1.241
	sys/net/if_arc.h: 1.23
	sys/net/if_arcsubr.c: 1.78
	sys/net/if_bridge.c: 1.136-1.137
	sys/net/if_etherip.c: 1.39
	sys/net/if_faith.c: 1.56
	sys/net/if_gif.c: 1.131
	sys/net/if_loop.c: 1.96
	sys/net/if_mpls.c: 1.30
	sys/net/if_pppoe.c: 1.129
	sys/net/if_srt.c: 1.27
	sys/net/if_stf.c: 1.102
	sys/net/if_tap.c: 1.100
	sys/net/if_vlan.c: 1.105
	sys/netinet/ip_carp.c: 1.91
	sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
	sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
 if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
 Return if bah_attach_subr() failed.
 If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
 If error occured in bcmeth_ccb_attach(), free resources and return.
 If error occured in pq3etsec_attach(), free resources and return.
 If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
 If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
   failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
 If if_initialize() failed in the attach function, free resources and return.
 If if_attach() failed in the attach function, free resources and return.
 - If if_initialize() failed in the attach function, free resources and return.
 - KNF
 - If if_attach() failed in the attach function, free resources and return.
 - KNF
 Fix compile error.
 Fix compile error.
We don't need '&mii', but just 'mii' for mii_detach().
Don't free sc_rthash twice

Revision 1.508.4.8 / (download) - annotate - [select for diffs], Sun Dec 10 09:48:04 2017 UTC (5 years, 1 month ago) by snj
Branch: netbsd-8
Changes since 1.508.4.7: +11 -5 lines
Diff to previous 1.508.4.7 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #424):
	sys/dev/pci/if_wm.c: 1.545-1.546
  Don't allocate MSI-X interrupt on 82583. 82583 chip has a MSI-X capability in
the PCI configuration space but it doesn't support it. At least the document
doesn't say anything about MSI-X. Fixes PR#52767 reported by
Shinichi Doyashiki.
--
- 82583 supports jumbo frame. Fixes PR#52773 reported by Shinichi Doyashiki.
- Cleanup comment.

Revision 1.549 / (download) - annotate - [select for diffs], Fri Dec 8 05:22:23 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.548: +6 -6 lines
Diff to previous 1.548 (colored)

Revert "Make if_timer MP-safe if IFEF_MPSAFE"

Because it has decreased the performance of wm. And also I found that
wm_watchdog doesn't work well with if_watchdog framework at all. Sharing one
counter (if_timer) with multiple instances (hardware multi-queues) can't detect
a single (or some) stall of them because other instances reset the counter even
if the stalled one want the watchdog to fire.

Interfaces without IFEF_MPSAFE works safely with the original if_watchdog thanks
to KENREL_LOCK. OTOH, interfaces with IFEF_MPSAFE shouldn't use if_watchdog and
should implement their own watchdog timer that works with multiple instances.

Revision 1.548 / (download) - annotate - [select for diffs], Thu Dec 7 00:38:38 2017 UTC (5 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.547: +14 -9 lines
Diff to previous 1.547 (colored)

 Fix a bug that 8257[56] can't receive packet reported by Bert Kiers in
PR#52717. For 82575 and 82576, the RX descriptors must be initialized after
the setting of RCTL.EN in wm_set_filter(). This bug was added in if_wm.c
rev. 1.515.

Revision 1.547 / (download) - annotate - [select for diffs], Wed Dec 6 09:03:12 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.546: +6 -6 lines
Diff to previous 1.546 (colored)

Make if_timer MP-safe if IFEF_MPSAFE

if_timer, a counter used by if_watchdog (if_slowtimo), can be modified in
if_watchdog and if_start and/or interrupt handlers of some device drivers. All
such accesses were serialized by KERNEL_LOCK. If IFEF_MPSAFE is enabled,
KERNEL_LOCK of if_start (and perhaps interrupt handlers) is omitted and if_timer
becomes racy.

Fix the race condition by protecting if_timer by a spin mutex. if_watchdog_reset
and if_watchdog_stop are introduced to ensure to take the mutex on accessing
if_timer. Interface with IFEF_MPSAFE enabled must use the functions.

In addition, if_watchdog callout is now set CALLOUT_MPSAFE if IFEF_MPSAFE. It
means that if_watchdog implemented by a driver must be MP-safe if the driver is
set IFEF_MPSAFE.

Currenlty interfaces with IFEF_MPSAFE implementing if_watchdog and accessing
if_timer in if_start and interrupt handlers are only wm(4). wm is changed to
use the functions. (Its watchdog handler (wm_watchdog) is already MP-safe.

These contracts will be written somewhere in a further commit.

Note that the spin mutex is now ifp->if_snd.ifq_lock to avoid adding another
spin mutex to each interface. For now reusing it isn't problematic (see the
comment to know why) thought if that does matter in the future, feel free to
replace it with a new spin mutex. It's easy to do.

Revision 1.234.2.5 / (download) - annotate - [select for diffs], Sun Dec 3 11:37:08 2017 UTC (5 years, 1 month ago) by jdolecek
Branch: tls-maxphys
Changes since 1.234.2.4: +8307 -3091 lines
Diff to previous 1.234.2.4 (colored) next main 1.235 (colored)

update from HEAD

Revision 1.546 / (download) - annotate - [select for diffs], Thu Nov 30 09:24:18 2017 UTC (5 years, 2 months ago) by msaitoh
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202
Changes since 1.545: +4 -4 lines
Diff to previous 1.545 (colored)

- 82583 supports jumbo frame. Fixes PR#52773 reported by Shinichi Doyashiki.
- Cleanup comment.

Revision 1.545 / (download) - annotate - [select for diffs], Thu Nov 30 03:53:24 2017 UTC (5 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.544: +9 -3 lines
Diff to previous 1.544 (colored)

 Don't allocate MSI-X interrupt on 82583. 82583 chip has a MSI-X capability in
the PCI configuration space but it doesn't support it. At least the document
doesn't say anything about MSI-X. Fixes PR#52767 reported by
Shinichi Doyashiki.

XXX pullup-8.

Revision 1.508.4.7 / (download) - annotate - [select for diffs], Fri Nov 24 08:39:09 2017 UTC (5 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.6: +5 -5 lines
Diff to previous 1.508.4.6 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #389):
	sys/net/if_ether.h: revision 1.69
	sys/net/if_vlan.c: revision 1.108
	sys/dev/pci/if_bge.c: revision 1.313
	sys/net/if_vlanvar.h: revision 1.11
	sys/net/if_vlanvar.h: revision 1.12
	sys/net/if_ether.h: revision 1.70
	sys/net/if_vlan.c: revision 1.110
	sys/dev/pci/if_wm.c: revision 1.544
	sys/dev/pci/if_wmreg.h: revision 1.105
  Fix a bug that a vlan packet which has priority or CFI bit in the tag causes
panic.
  Revert part of if_bge.c 1.312. It's not required to mask other than VLAN ID
bits in VLAN tag.
  Revert if_wmreg.h 1.104 and if_wm.c 1.542. It's not required to mask other
than VLAN ID bits in VLAN tag.
No functional change:
  - u_int16_t -> uint16_t
  - u_short -> uint16_t
  - tag_hash_func -> vlan_tag_hash
  - 0 -> NULL because vlr_parent is a pointer.

Revision 1.508.4.6 / (download) - annotate - [select for diffs], Wed Nov 22 16:40:42 2017 UTC (5 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.508.4.5: +12 -4 lines
Diff to previous 1.508.4.5 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #379):
	sys/dev/pci/if_wm.c: revision 1.540
  On I219, drop TARC0 bit 28 for DMA hang workaround (from Linux).

Revision 1.544 / (download) - annotate - [select for diffs], Wed Nov 22 02:36:52 2017 UTC (5 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.543: +5 -5 lines
Diff to previous 1.543 (colored)

 Revert if_wmreg.h 1.104 and if_wm.c 1.542. It's not required to mask other
than VLAN ID bits in VLAN tag.

Revision 1.543 / (download) - annotate - [select for diffs], Thu Nov 16 03:07:18 2017 UTC (5 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.542: +5 -5 lines
Diff to previous 1.542 (colored)

Unify IFEF_*_MPSAFE into IFEF_MPSAFE

There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.

Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).

Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.

Proposed on tech-kern@ and tech-net@

Revision 1.508.4.5 / (download) - annotate - [select for diffs], Mon Nov 6 09:54:01 2017 UTC (5 years, 2 months ago) by snj
Branch: netbsd-8
CVS Tags: matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.508.4.4: +5 -5 lines
Diff to previous 1.508.4.4 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #348):
	sys/dev/pci/if_wm.c: revision 1.542
	sys/dev/pci/if_wmreg.h: revision 1.104
fix wm(4) vlan panic. Reported and tested by Tom Ivar Helbekkmo, thanks.
wm(4) used PRI bits and CFI bit as vlantag by mistake. It is found out
by if_ether.h:r1.67.

Revision 1.289.2.13.2.1 / (download) - annotate - [select for diffs], Mon Nov 6 09:21:48 2017 UTC (5 years, 2 months ago) by snj
Branch: netbsd-7-1
CVS Tags: netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE
Changes since 1.289.2.13: +3 -3 lines
Diff to previous 1.289.2.13 (colored) next main 1.289.2.14 (colored)

Pull up following revision(s) (requested by kardel in ticket #1385):
	sys/dev/pci/if_wm.c: revision 1.497
PR kern/52039: use same safeguard as for the 82578

Revision 1.508.4.4 / (download) - annotate - [select for diffs], Tue Oct 24 08:38:59 2017 UTC (5 years, 3 months ago) by snj
Branch: netbsd-8
Changes since 1.508.4.3: +9 -14 lines
Diff to previous 1.508.4.3 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by knakahara in ticket #302):
	sys/arch/powerpc/booke/dev/pq3etsec.c: 1.30-1.31
	sys/arch/x86/pci/if_vmx.c: 1.20
	sys/dev/ic/i82557.c: 1.148
	sys/dev/ic/rtl8169.c: 1.152
	sys/dev/pci/cxgb/cxgb_sge.c: 1.5
	sys/dev/pci/if_age.c: 1.51
	sys/dev/pci/if_alc.c: 1.25
	sys/dev/pci/if_ale.c: 1.23
	sys/dev/pci/if_bge.c: 1.311
	sys/dev/pci/if_bge.c: 1.312
	sys/dev/pci/if_bnx.c: 1.62
	sys/dev/pci/if_jme.c: 1.32
	sys/dev/pci/if_nfe.c: 1.64
	sys/dev/pci/if_sip.c: 1.167
	sys/dev/pci/if_stge.c: 1.63-1.64
	sys/dev/pci/if_ti.c: 1.102
	sys/dev/pci/if_txp.c: 1.48
	sys/dev/pci/if_vge.c: 1.61
	sys/dev/pci/if_wm.c: 1.538
	sys/dev/pci/ixgbe/ix_txrx.c: 1.29 via patch
	sys/net/agr/if_agrether_hash.c: 1.4
	sys/net/if_ether.h: 1.67-1.68
	sys/net/if_ethersubr.c: 1.244
	sys/net/if_vlan.c: 1.100
	sys/net80211/ieee80211_input.c: 1.89
	sys/net80211/ieee80211_output.c: 1.59
	sys/sys/mbuf.h: 1.171
VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.
I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html
--
only get vtag when we have vtag like the other drivers.
--
- only get the vtag if we have it like the other drivers
- mask the hardware vlan tag
--
- add a constant for the vlan mask.
- enforce that we have a tag before we get it.
only get vtag when we have vtag like the other drivers.
like if_bge.c:1.312 and if_stge.c:1.64.
fixed by s-yamaguchi@IIJ, thanks.

Revision 1.542 / (download) - annotate - [select for diffs], Mon Oct 23 23:29:38 2017 UTC (5 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.541: +5 -5 lines
Diff to previous 1.541 (colored)

fix wm(4) vlan panic. Reported and tested by Tom Ivar Helbekkmo, thanks.

wm(4) used PRI bits and CFI bit as vlantag by mistake. It is found out
by if_ether.h:r1.67.

XXX need pullup-8

Revision 1.541 / (download) - annotate - [select for diffs], Mon Oct 23 09:27:21 2017 UTC (5 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.540: +8 -3 lines
Diff to previous 1.540 (colored)

 If if_initialize() failed in the attach function, return.

Revision 1.540 / (download) - annotate - [select for diffs], Fri Oct 20 09:26:13 2017 UTC (5 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.539: +12 -4 lines
Diff to previous 1.539 (colored)

 On I219, drop TARC0 bit 28 for DMA hang workaround (from Linux).

Revision 1.508.4.3 / (download) - annotate - [select for diffs], Sun Oct 15 20:18:17 2017 UTC (5 years, 3 months ago) by snj
Branch: netbsd-8
Changes since 1.508.4.2: +5 -4 lines
Diff to previous 1.508.4.2 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #306):
	sys/dev/pci/if_wm.c: revision 1.539
- Correct NVM word size check in wm_nvm_version() to prevent
   "EERD polling failed" error on attach. if_wm.c rev. 1.534 was not perfect.
   Reported by ozaki-r@.
- Print NVM offset and word count when EERD polling failed.

Revision 1.539 / (download) - annotate - [select for diffs], Tue Sep 26 08:25:56 2017 UTC (5 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.538: +5 -4 lines
Diff to previous 1.538 (colored)

- Correct NVM word size check in wm_nvm_version() to prevent
  "EERD polling failed" error on attach. if_wm.c rev. 1.534 was not perfect.
  Reported by ozaki-r@.
- Print NVM offset and word count when EERD polling failed.

XXX pullup-8.

Revision 1.538 / (download) - annotate - [select for diffs], Tue Sep 26 07:42:06 2017 UTC (5 years, 4 months ago) by knakahara
Branch: MAIN
Changes since 1.537: +9 -14 lines
Diff to previous 1.537 (colored)

VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.

I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html

XXX need pullup to -8 branch

Revision 1.308.2.11 / (download) - annotate - [select for diffs], Mon Aug 28 17:52:05 2017 UTC (5 years, 5 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.10: +1691 -777 lines
Diff to previous 1.308.2.10 (colored) to branchpoint 1.308 (colored) next main 1.309 (colored)

Sync with HEAD

Revision 1.508.4.2 / (download) - annotate - [select for diffs], Tue Aug 1 23:33:18 2017 UTC (5 years, 5 months ago) by snj
Branch: netbsd-8
Changes since 1.508.4.1: +1189 -630 lines
Diff to previous 1.508.4.1 (colored) to branchpoint 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #173):
	sys/dev/pci/if_wmreg.h: 1.99-1.103
	sys/dev/pci/if_wmvar.h: 1.34-1.37
	sys/dev/pci/if_wm.c: 1.510-1.537
	sys/dev/mii/ihphyreg.h: 1.2
	sys/dev/mii/inbmphyreg.h: 1.10
	sys/dev/mii/igphy.c: 1.27
Sync wm(4) up to if_wm.c rev. 1.537:
- Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset().
- If a legacy interrupt is a spurious interrupt, don't print debug
  message.
- Don't print the Image Unique ID if an NVM is iNVM (i210 and I211).
- Fix a bug that a RAL was written at incorrect address when the index
  number is more than 16 on 82544 and newer.
- The layout of RAL on PCH* are different from others. Fix it.
- Flush every MTA write. Same as Linux.
- Move the location of calling wm_set_filter. Same as some other OSes.
- Flush writing WMREG_CTRL in wm_gmii_mediachange().
- Make new wm_phy_post_reset() and use this function at all location
  after resetting phy.
- Add I219 specific workaround for legacy interrupt. From OpenBSD.
- Move the location of calling wm_lplu_d0_disable().
- Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too. Before
  this commit, above devices and non-PCIe devices accessed wrong
  register.
- Fix latency calculation in wm_platform_pm_pch_lpt().
- Set OBFF water mark and enable OBFF on PCH_LPT and newer.
- Fix a bug that wm_gmii_i82544_{read,write}reg() didn't take care of
  page select. PHY access from igphy() automatically did it, but
  accessing from wm(4) for workaround didn't work correctly. This
  change affects 8254[17], 8257[12] ICH8, ICH9 and ICH10.
- Call wm_kmrn_lock_loss_workaround_ich8lan() before any PHY access in
  wm_linkintr_gmii().
- Register access in wm_kmrn_lock_loss_workaround_ich8lan() now works
  correctly. Enable this function.
- IF TX is not required to flush, RX is also not required to flush in
  wm_flush_desc_rings(). Same as other OSes.
- Remove wrong semaphore access in wm_nvm_{read,write}_{ich8,spt} to
  prevent hangup. A semaphore is get/put in wm_nvm_{read,write}.
- Move some initialization stuff in wm_attach() before wm_reset().
  Some flags and callback function is required to set correctly before
  wm_reset() because wm_reset() and some helper functions refer them.
- Add wm_write_smbus_addr() to set SMBus address by software.
- Modify wm_gmii_hv_{read,write}reg_locked() to make them access
  HV_SMB_ADDR correctly.
- Configure the LCD with the extended configuration region in NVM if
  it's required. Tested with Thinkpad X220.
- 8257[12]: Don't directly access SPI but use EERD register.
- 82575-I354: If the size of SPI ROM >= 32K words, use direct SPI
  access instead of EERD register access.
- Add wm_nvm_eec_clock_raise() and wm_nvm_eec_clock_lower() and use
  them for Microwire/SPI bus control. Same as Linux and FreeBSD.
- Reduce timeout value for 80003 in wm_get_swfw_semaphore(). Same as
  Linux and FreeBSD.
- Change API of kmrn_{read,write}reg() and check the return value.
- Check whether it's required to use MDIC workaround for 80003 or not
  in wm_reset(). If the workaround isn't required, don't use the
  workaround code in wm_gmii_i80003_{read,write}reg.
- Add WM_F_WA_I210_CLSEM flag for a workaround. FreeBSD/Linux drivers
  say "In rare circumstances, the SW semaphore may already be held
  unintentionally." on I21[01]. PXE boot is one of the case.
- Qemu's e1000e emulation (82574L)'s SPI has only 64 words. I've never
  seen on real 82574 hardware with such small SPI ROM. Check
  NVM word size before accessing higher address words to prevent
  timeout.
- Check some wm_nvm_read()'s return vale.
- Use device_printf() instead of aprint_error_dev() for PHY read/write
  functions because those are used not only in device attach.
- Print internal driver flags when attaching.
- Add debug printf()s.
- Rename variables.
- Add comment, update comment and remove wrong comment.

Revision 1.537 / (download) - annotate - [select for diffs], Mon Jul 31 06:41:01 2017 UTC (5 years, 6 months ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20170825
Changes since 1.536: +8 -8 lines
Diff to previous 1.536 (colored)

rename unclear functions. pointed out by msaitoh@n.o.

Revision 1.536 / (download) - annotate - [select for diffs], Fri Jul 28 10:34:58 2017 UTC (5 years, 6 months ago) by knakahara
Branch: MAIN
Changes since 1.535: +7 -2 lines
Diff to previous 1.535 (colored)

add comment about confusing wm_rxeof() calling.

pointed out by msaitoh@n.o.

Revision 1.535 / (download) - annotate - [select for diffs], Fri Jul 28 10:21:10 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.534: +18 -16 lines
Diff to previous 1.534 (colored)

 Check some wm_nvm_read()'s return vale.

Revision 1.534 / (download) - annotate - [select for diffs], Fri Jul 28 09:12:40 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.533: +16 -4 lines
Diff to previous 1.533 (colored)

 Qemu's e1000e emulation (82574L)'s SPI has only 64 words. I've never seen on
real 82574 hardware with such small SPI ROM. Check sc->sc_nvm_wordsize before
accessing higer address words to prevent timeout.

Revision 1.533 / (download) - annotate - [select for diffs], Thu Jul 27 03:21:42 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.532: +15 -2 lines
Diff to previous 1.532 (colored)

 Add WM_F_WA_I210_CLSEM flag for a workaround. FreeBSD/Linux drivers say
"In rare circumstances, the SW semaphore may already be held unintentionally."
on I21[01]. PXE boot is one of the case.

XXX pullup-[678].

Revision 1.532 / (download) - annotate - [select for diffs], Wed Jul 26 08:09:59 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.531: +9 -5 lines
Diff to previous 1.531 (colored)

 On 8254[17] with SPI ROM, wm_nvm_set_addrbits_size_eecd() calls wm_nvm_read(),
so it's required to set flags and functions before calling it. It was broken
again in if_wm.c rev. 1.530 (see also 1.313). Tested with Dell Power Edge 1850.

Revision 1.531 / (download) - annotate - [select for diffs], Wed Jul 26 06:48:49 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.530: +123 -61 lines
Diff to previous 1.530 (colored)

-  Our MII readreg/writereg API has not way to detect an error.
  kmrn_{read,write}reg() are not used for MII API, so it's not required for
  these functions to use the same API. So,
  - Change return value as error code.
  - Change register vaule from int to uint16_t.
  - read: pass pointer for uint16_t as an argument.
  - Check return value on caller side.
- Check whether it's required to use MDIC workaround for 80003 or not in
  wm_reset(). If the workaround isn't required, don't use the workaround code
  in wm_gmii_i80003_{read,write}reg.

Revision 1.530 / (download) - annotate - [select for diffs], Tue Jul 25 06:00:17 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.529: +308 -178 lines
Diff to previous 1.529 (colored)

 Use new nvm.{acquire,release}() for semaphore. Almost the same except the
following:
 - 8257[12]: Don't directly access SPI but use EERD register.
 - 82575-I354: If the size of SPI ROM >= 32K words, use direct SPI access
   instead of EERD register access.
 - Add wm_nvm_eec_clock_raise() and wm_nvm_eec_clock_lower() and use them for
   Microwire/SPI bus control. Same as Linux and FreeBSD.
 - Redude timeout value for 80003 in wm_get_swfw_semaphore(). Same as
   Linux and FreeBSD.

Revision 1.529 / (download) - annotate - [select for diffs], Thu Jul 20 10:00:25 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.528: +10 -15 lines
Diff to previous 1.528 (colored)

 Fix a bug that sc->sc_flags can't be passed to igphy(4). This bug was added
in if_wm.c rev 1.527.

Revision 1.528 / (download) - annotate - [select for diffs], Tue Jul 18 08:22:55 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.527: +66 -7 lines
Diff to previous 1.527 (colored)

- Add wm_write_smbus_addr() to set SMBus address by software.
- Modify wm_gmii_hv_{read,write}reg_locked() to make them access HV_SMB_ADDR
  correctly.
- Enable wm_init_lcd_from_nvm() again. Tested by Thinkpad X220.

Revision 1.527 / (download) - annotate - [select for diffs], Tue Jul 18 08:05:03 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.526: +15 -15 lines
Diff to previous 1.526 (colored)

 Move some initialization stuff in wm_attach() before wm_reset(). Some flags
and callback function is required to set correctly before wm_reset() because
wm_reset() and some helper functions refer them.

Revision 1.526 / (download) - annotate - [select for diffs], Tue Jul 18 08:01:07 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.525: +2 -18 lines
Diff to previous 1.525 (colored)

 Remove wrong semaphore access in wm_nvm_{read,write}_{ich8,spt} to prevent
hungup. A semaphore is get/put in wm_nvm_{read,write}.

Revision 1.525 / (download) - annotate - [select for diffs], Fri Jul 14 04:34:29 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Changes since 1.524: +4 -2 lines
Diff to previous 1.524 (colored)

 Calling wm_init_lcd_from_nvm() makes hang on some machines reported by
Brad Harder. Until fix this problem correctly, Disable whole of
wm_init_lcd_from_nvm().

Revision 1.524 / (download) - annotate - [select for diffs], Thu Jul 13 13:27:08 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.523: +56 -55 lines
Diff to previous 1.523 (colored)

 IF TX is not required to flush, RX is also not required to flush. Same as
other OSes.

Revision 1.523 / (download) - annotate - [select for diffs], Thu Jul 13 08:22:21 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.522: +117 -19 lines
Diff to previous 1.522 (colored)

- Call wm_kmrn_lock_loss_workaround_ich8lan() before any PHY access in
  wm_linkintr_gmii().
- Register access in wm_kmrn_lock_loss_workaround_ich8lan() now works
  correctly. Enable this function.
- Configure the LCD with the extended configuration region in NVM if it's
  required.
- Add debug printf.

Revision 1.522 / (download) - annotate - [select for diffs], Thu Jul 13 08:04:56 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.521: +62 -2 lines
Diff to previous 1.521 (colored)

- Fix a bug that wm_gmii_i82544_{read,write}reg() didn't take care of page
  select. PHY access from igphy() automatically did it, but accessing from
  wm(4) for wrokaround didn't work correctly. This change affects 8254[17],
  8257[12] ICH8, ICH9 and ICH10.
- Add diagnostic code.

Revision 1.521 / (download) - annotate - [select for diffs], Thu Jul 13 07:50:49 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.520: +116 -126 lines
Diff to previous 1.520 (colored)

- Use device_printf() instead of aprint_error_dev() for PHY read/write
  functions because those are used not only in device attach.
- Add debug printf.
- Rename variables.

Revision 1.520 / (download) - annotate - [select for diffs], Wed Jul 12 08:18:36 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.519: +2 -4 lines
Diff to previous 1.519 (colored)

Remove debug printf().

Revision 1.519 / (download) - annotate - [select for diffs], Wed Jul 12 08:15:31 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.518: +50 -27 lines
Diff to previous 1.518 (colored)

 Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too. Before this commit,
above devices and non-PCIe devices accessed wrong register.

Revision 1.518 / (download) - annotate - [select for diffs], Thu Jul 6 08:50:52 2017 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.517: +9 -6 lines
Diff to previous 1.517 (colored)

 Move the location of wm_get_hw_control() in wm_init_locked() again. Doing
it "after" wm_reset() is required for some AMT based machines to linkup
1Gbps. Tested with HP dc7700.

Revision 1.508.4.1 / (download) - annotate - [select for diffs], Tue Jul 4 14:57:19 2017 UTC (5 years, 6 months ago) by martin
Branch: netbsd-8
Changes since 1.508: +4 -4 lines
Diff to previous 1.508 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #81):
	sys/dev/pci/ixgbe/ixgbe.c: revision 1.89
	sys/dev/pci/if_wm.c: revision 1.509
	sys/dev/pci/ixgbe/ixgbe.c: revision 1.90
Use IFM_1000_KX and IFM_2500_KX.
 Use IFM_1000_KX more.

Revision 1.517 / (download) - annotate - [select for diffs], Mon Jun 26 04:22:46 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.516: +134 -66 lines
Diff to previous 1.516 (colored)

- Make new wm_phy_post_reset() and use this function at all location after
  reseting phy.
- Move the location of calling wm_get_hw_control. Same as Linux.
- Add I219 specific wokaround for legacy interrupt. From OpenBSD.
- Move the location of calling wm_lplu_d0_disable().
- Fix latency calculation in wm_platform_pm_pch_lpt().
- Set OBFF water mark and enable OBFF on PCH_LPT and newer.

Revision 1.516 / (download) - annotate - [select for diffs], Mon Jun 26 04:18:14 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.515: +3 -3 lines
Diff to previous 1.515 (colored)

 Add missing "else" in wm_nvm_release().

Revision 1.515 / (download) - annotate - [select for diffs], Mon Jun 26 04:15:06 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.514: +14 -7 lines
Diff to previous 1.514 (colored)

- Flush every MTA write. Same as Linux.
- Move the location of calling wm_set_filter. Same as some other OSes.
- Add CSR_WRITE_FLUSH() after writing WMREG_CTRL in wm_gmii_mediachange().

Revision 1.514 / (download) - annotate - [select for diffs], Mon Jun 26 04:09:02 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.513: +53 -11 lines
Diff to previous 1.513 (colored)

- Fix wm_set_ral():
 - Fix a bug that a RAL was written at incorrect address when the index number
   is more than 16 on 82544 and newer.
 - The layout of RAL on PCH* are different from others.
- Remove wrong comment.

Revision 1.513 / (download) - annotate - [select for diffs], Mon Jun 26 04:03:34 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.512: +5 -18 lines
Diff to previous 1.512 (colored)

 Print sc_flags with snprintb().

Revision 1.512 / (download) - annotate - [select for diffs], Fri Jun 23 06:10:31 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.511: +9 -4 lines
Diff to previous 1.511 (colored)

 Don't print the Image Unique ID if an NVM is iNVM (i210 and I211).

Revision 1.511 / (download) - annotate - [select for diffs], Tue Jun 20 10:10:36 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.510: +13 -4 lines
Diff to previous 1.510 (colored)

- Add debug printf()s.
- If a legacy interrupt is a spurious interrupt, don't print debug message.
- Add comment.

Revision 1.510 / (download) - annotate - [select for diffs], Mon Jun 19 10:59:01 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.509: +11 -11 lines
Diff to previous 1.509 (colored)

 Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset(). Same as other OSes.

Revision 1.509 / (download) - annotate - [select for diffs], Mon Jun 12 03:03:22 2017 UTC (5 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.508: +4 -4 lines
Diff to previous 1.508 (colored)

Use IFM_1000_KX and IFM_2500_KX.

Revision 1.416.2.4 / (download) - annotate - [select for diffs], Wed Apr 26 02:53:12 2017 UTC (5 years, 9 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.416.2.3: +103 -26 lines
Diff to previous 1.416.2.3 (colored) to branchpoint 1.416 (colored) next main 1.417 (colored)

Sync with HEAD

Revision 1.465.2.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:53:47 2017 UTC (5 years, 9 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.465: +1121 -354 lines
Diff to previous 1.465 (colored) next main 1.466 (colored)

Sync with HEAD

Revision 1.289.2.14 / (download) - annotate - [select for diffs], Wed Apr 19 17:06:21 2017 UTC (5 years, 9 months ago) by snj
Branch: netbsd-7
Changes since 1.289.2.13: +3 -3 lines
Diff to previous 1.289.2.13 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by kardel in ticket #1385):
	sys/dev/pci/if_wm.c: revision 1.497
PR kern/52039: use same safeguard as for the 82578

Revision 1.508 / (download) - annotate - [select for diffs], Thu Apr 13 10:37:36 2017 UTC (5 years, 9 months ago) by knakahara
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, netbsd-8-base, bouyer-socketcan-base1
Branch point for: netbsd-8
Changes since 1.507: +23 -2 lines
Diff to previous 1.507 (colored)

wm(4) can disable msi/msix by build option and ddb command.

suggested by nonaka@n.o.
reviewed by msaitoh@n.o and nonaka@n.o.

Revision 1.507 / (download) - annotate - [select for diffs], Wed Apr 12 05:08:00 2017 UTC (5 years, 9 months ago) by knakahara
Branch: MAIN
Changes since 1.506: +8 -4 lines
Diff to previous 1.506 (colored)

improve comments about the difference between legacy/msi and msix.

pointed out by msaitoh@n.o.

Revision 1.506 / (download) - annotate - [select for diffs], Wed Apr 5 10:44:35 2017 UTC (5 years, 9 months ago) by msaitoh
Branch: MAIN
CVS Tags: jdolecek-ncq-base, jdolecek-ncq
Changes since 1.505: +12 -2 lines
Diff to previous 1.505 (colored)

 Fix a bug that non-GMII devices don't send a routing message when the link
status is changed. Call if_link_state_change(). Tested with 82572EI(TBI) and
I350(SERDES).

XXX pullup-[67].

Revision 1.505 / (download) - annotate - [select for diffs], Fri Mar 24 10:39:10 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.504: +3 -3 lines
Diff to previous 1.504 (colored)

fix typo

pointed out by ozaki-r@n.o.

Revision 1.504 / (download) - annotate - [select for diffs], Fri Mar 24 10:18:55 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.503: +3 -3 lines
Diff to previous 1.503 (colored)

remove extra "+"

Revision 1.503 / (download) - annotate - [select for diffs], Fri Mar 24 10:02:35 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.502: +16 -5 lines
Diff to previous 1.502 (colored)

add comments about the situation wm(4) use MSI-X but does not use multiqueue.

Revision 1.502 / (download) - annotate - [select for diffs], Fri Mar 24 10:01:55 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.501: +29 -13 lines
Diff to previous 1.501 (colored)

make self-describing function the code reading sc->sc_nintrs or sc->sc_nqueues directly.

Revision 1.501 / (download) - annotate - [select for diffs], Fri Mar 24 09:59:05 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.500: +3 -2 lines
Diff to previous 1.500 (colored)

add prototype.

I have forgotten the fix by wm_softint_establish(). Thank you christos@n.o!

Revision 1.500 / (download) - annotate - [select for diffs], Wed Mar 22 08:44:41 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.499: +17 -2 lines
Diff to previous 1.499 (colored)

add comments about transmit context descriptor

Revision 1.499 / (download) - annotate - [select for diffs], Wed Mar 22 02:56:12 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.498: +3 -3 lines
Diff to previous 1.498 (colored)

missing M_CSUM_IPv4 checking. It does not cause problems, but it is wrong.

The implementations of M_CSUM_DATA_IPv4_IPHL() and M_CSUM_DATA_IPv6_HL()
is the same, so that does not cause problems.

Revision 1.498 / (download) - annotate - [select for diffs], Tue Mar 21 10:39:52 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.497: +7 -8 lines
Diff to previous 1.497 (colored)

fix PR kern/52068 (82574 Tx csum offload bug in not only i386 but also amd64).

The packets sent from txq[1] could not be enabled any tx offload.
This has been enbugged since r1.454.

Revision 1.416.2.3 / (download) - annotate - [select for diffs], Mon Mar 20 06:57:29 2017 UTC (5 years, 10 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.416.2.2: +1057 -354 lines
Diff to previous 1.416.2.2 (colored) to branchpoint 1.416 (colored)

Sync with HEAD

Revision 1.289.2.9.2.2 / (download) - annotate - [select for diffs], Mon Mar 13 07:41:27 2017 UTC (5 years, 10 months ago) by skrll
Branch: netbsd-7-nhusb
Changes since 1.289.2.9.2.1: +280 -100 lines
Diff to previous 1.289.2.9.2.1 (colored) to branchpoint 1.289.2.9 (colored) next main 1.289.2.10 (colored)

Sync with netbsd-7-1-RELEASE

Revision 1.289.2.13 / (download) - annotate - [select for diffs], Thu Mar 9 06:28:36 2017 UTC (5 years, 10 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-1-RELEASE
Branch point for: netbsd-7-1
Changes since 1.289.2.12: +280 -100 lines
Diff to previous 1.289.2.12 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1372):
	sys/dev/pci/if_wm.c: revisions 1.462, 1.464-1.465 1.474 via patch
	sys/dev/pci/if_wmreg.h: revision 1.97
	sys/dev/pci/if_wmvar.h: revision 1.33
- Set IPV6EXDIS bit in RFCTL register because of an Errata on 82575 and
  newer devices.
- Linux and FreeBSD defines 0x10f5 as E1000_DEV_ID_ICH9_IGP_M_AMT. In
  reality, This is not IGP but BM. Add new case to identify PHY type
  device. Fixes PR#51924 reported byJarle Greipsland.
- Use new wm_gmii_setup_phytype() function to setup sc_phytype and
  mii_{read|write}reg. This change improves detection of PHY type.
- Fix typo in comment.

Revision 1.497 / (download) - annotate - [select for diffs], Wed Mar 8 08:00:09 2017 UTC (5 years, 10 months ago) by kardel
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320
Changes since 1.496: +3 -3 lines
Diff to previous 1.496 (colored)

PR kern/52039: use same safeguard as for the 82578

Revision 1.496 / (download) - annotate - [select for diffs], Fri Mar 3 16:48:55 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.495: +6 -4 lines
Diff to previous 1.495 (colored)

fix r1.492 bug, sorry

Revision 1.495 / (download) - annotate - [select for diffs], Fri Mar 3 07:57:49 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.494: +96 -3 lines
Diff to previous 1.494 (colored)

implement AIM(Adaptive Interrupt Moderation), but not enable yet.

Currently, it causes performance degration if enabled.
More ITR calcuration tuning is required...

Revision 1.494 / (download) - annotate - [select for diffs], Fri Mar 3 07:38:52 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.493: +7 -2 lines
Diff to previous 1.493 (colored)

make kernel config option WM_RX_PROCESS_LIMIT_DEFAULT and WM_RX_INTR_PROCESS_LIMIT_DEFAULT

e.g. if
    - WM_RX_PROCESS_LIMIT_DEFAULT is set 0
    - WM_RX_INTR_PROCESS_LIMIT_DEFAULT is set -1 (means almost infinite)
that means wm(4) does not use polling mode.

Revision 1.493 / (download) - annotate - [select for diffs], Fri Mar 3 07:32:36 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.492: +24 -9 lines
Diff to previous 1.492 (colored)

implement polling mode for multiqueue. It can suppress performance degration at high load.

e.g. I354 IP forwarding throughput performance
    + before
      - 133Mbps forwarding performance at 200Mbps input load
      - 41Mbps forwarding performance at 800Mbps input load
    + after
      - 150Mbps forwarding performance at 200Mbps input load
      - 150Mbps forwarding performance at 800Mbps input load

Revision 1.492 / (download) - annotate - [select for diffs], Fri Mar 3 03:33:44 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.491: +7 -8 lines
Diff to previous 1.491 (colored)

IFEF_START_MPSAFE flag should be set only if WM_MPSAFE defined. some refactor.

pointed out and suggested by msaitoh@n.o, thanks.

Revision 1.491 / (download) - annotate - [select for diffs], Wed Mar 1 08:56:33 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.490: +46 -42 lines
Diff to previous 1.490 (colored)

refactor: functionalize ITR/EITR writing processing.

tested I354 and 82545(VMware e1000).

Revision 1.490 / (download) - annotate - [select for diffs], Wed Mar 1 08:31:06 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.489: +19 -15 lines
Diff to previous 1.489 (colored)

divide ITR/EITR value from wm_softc to wm_queue as EITR register is bound to each H/W queue.

Revision 1.489 / (download) - annotate - [select for diffs], Tue Feb 28 09:55:47 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.488: +42 -11 lines
Diff to previous 1.488 (colored)

fix EITR setting.

    + 82574
      - add EITR setting, that is MSI-X mode interrupt interval
    + 82575
      - fix EITR value. 82575's EITR usage is the same as legacy (not NEWQUEUE)
        controllers
      - apply workaround which 82575's EITR does not have CNT_INGR bit
    + other NEWQUEUE controllers
      - fix interrupt interval field. NEWQUEUE (include 82575) controllers'
        interrupt interval field is 2:14
      - use CNT_INGR bit which avoid to overwrite counter

tested 82574, 82575 and I354.
ok by msaitoh@n.o.

Revision 1.488 / (download) - annotate - [select for diffs], Mon Feb 27 09:27:27 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.487: +3 -3 lines
Diff to previous 1.487 (colored)

fix Tx queue assignment when the number of H/W queues is less than ncpu.

Revision 1.487 / (download) - annotate - [select for diffs], Fri Feb 24 10:09:21 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.486: +12 -2 lines
Diff to previous 1.486 (colored)

apply 82574 RFCTL workaround the same as FreeBSD and linux.

In fact, this workaround reduces interrupt count.

Revision 1.486 / (download) - annotate - [select for diffs], Fri Feb 24 10:07:33 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.485: +11 -6 lines
Diff to previous 1.485 (colored)

82574 should follow MSI-X mode IMS manner.

Howerver some legacy interrupts occur as MSI-X other interrupt yet...

Revision 1.485 / (download) - annotate - [select for diffs], Sat Feb 18 14:48:43 2017 UTC (5 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.484: +27 -16 lines
Diff to previous 1.484 (colored)

Establish a softint for legacy, otherwise BOOM!

Revision 1.484 / (download) - annotate - [select for diffs], Fri Feb 17 12:16:37 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.483: +56 -59 lines
Diff to previous 1.483 (colored)

unify Tx softint and Rx softint to uniform ixg(4) design.

Furthermore, that can remove wm_deferred_start() which holds all txq's
txq_lock, so it would reduce lock contention between Tx interrupt handler and
Tx softint handler.

Revision 1.483 / (download) - annotate - [select for diffs], Fri Feb 17 11:57:26 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.482: +14 -6 lines
Diff to previous 1.482 (colored)

rxq_ptr must be updated holding rxq_lock consistent with the Rx processing.

In previous implementation, wm_rxeof() temporarily unlock rxq->rxq_lock to
call if_percpuq_enqueue(), and then re-lock rxq->rxq_lock to update
rxq->rxq_ptr. So, if multiple CPUs share the same rxq, there is race e.g.
    - CPU A: lock rxq->rxq_lock
    - CPU A: Rx processing include increment local variable "i"
    - CPU A: unlock rxq->rxq_lock
    - CPU A: call if_percpuq_enqueue()
    - CPU B: lock rxq->rxq_lock
    - CPU B: Rx processing include increment local variable "i"
    - CPU B: unlock rxq->rxq_lock
    - CPU B: call if_percpuq_enqueue()
    - CPU B: lock rxq->rxq_lock
    - CPU B: update rxq->rxq_ptr, that is, set CPU B's local "i" to rxq->rxq_ptr
    - CPU B: unlock rxq->rxq_lock
    - CPU A: lock rxq->rxq_lock
    - CPU A: update rxq->rxq_ptr, that is, set CPU A's local "i" to rxq->rxq_ptr
    - CPU A: unlock rxq->rxq_lock

Revision 1.482 / (download) - annotate - [select for diffs], Fri Feb 17 07:21:28 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.481: +15 -15 lines
Diff to previous 1.481 (colored)

more fix about IFF_OACTIVE.

fix TODO of r1.479 and reduce IFF_OACTIVE manipulation.

Revision 1.481 / (download) - annotate - [select for diffs], Fri Feb 17 05:20:01 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.480: +31 -17 lines
Diff to previous 1.480 (colored)

refactor: functionize deferred_start code holding locks.

Revision 1.480 / (download) - annotate - [select for diffs], Fri Feb 17 04:51:01 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.479: +32 -14 lines
Diff to previous 1.479 (colored)

refactor: functionize txrxintr disable/enable code.

Revision 1.479 / (download) - annotate - [select for diffs], Thu Feb 16 05:36:41 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.478: +30 -9 lines
Diff to previous 1.478 (colored)

fix about IFF_OACTIVE.

It is required manipulate IFF_OACTIVE for old ethernet controllers and ALTQ
to use if_start. To avoid race, txq_lock of 0th txq is needed to write
IFF_OACTIVE.

TODO: read side refactor

Revision 1.478 / (download) - annotate - [select for diffs], Mon Feb 13 05:02:21 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.477: +3 -3 lines
Diff to previous 1.477 (colored)

fix typo

Revision 1.477 / (download) - annotate - [select for diffs], Thu Feb 9 23:30:46 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.476: +43 -2 lines
Diff to previous 1.476 (colored)

detach wm(4) evcnt.

pointed out by msaitoh@n.o, thanks.

Revision 1.308.2.10 / (download) - annotate - [select for diffs], Sun Feb 5 13:40:30 2017 UTC (5 years, 11 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.9: +788 -290 lines
Diff to previous 1.308.2.9 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.476 / (download) - annotate - [select for diffs], Thu Feb 2 10:29:10 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20170204
Changes since 1.475: +19 -17 lines
Diff to previous 1.475 (colored)

remove WM_CORE_LOCK in deferred start routine.

It is enough to check each txq's txq_stopping with
mutex_enter(not mutex_tryenter).

reviewed by ozaki-r@n.o.

Revision 1.475 / (download) - annotate - [select for diffs], Wed Feb 1 08:56:41 2017 UTC (5 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.474: +264 -99 lines
Diff to previous 1.474 (colored)

 Use new wm_gmii_setup_phytype() function to setup sc_phytype and
mii_{read|write}reg. This function is called twie.

 To identify PHY type, correct read/write function should be selected. To
select correct read/write function, PCI ID or MAC type are required without
accessing PHY registers.

 On the first call of this function, PHY ID is not known yet. Check PCI ID or
MAC type. The list of the PCI ID may not be perfect, so the result might be
incorrect.

 In the second call, PHY OUI and model are used to identify PHY type. It might
not be perfpect because of the lack of compared entry, but it would be better
than the first call.

 If the detected new result and previous assumption is different, diagnous
message will be printed.

Revision 1.474 / (download) - annotate - [select for diffs], Wed Feb 1 07:50:03 2017 UTC (5 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.473: +3 -2 lines
Diff to previous 1.473 (colored)

 Linux and FreeBSD defines 0x10f5 as E1000_DEV_ID_ICH9_IGP_M_AMT. In reality,
This is not IGP but BM. Add new case to identify PHY type correctly on this
device. Fixes PR#51924 reported byJarle Greipsland.

 This change fix only for 0x10f5. Need more work to be the best.

Revision 1.473 / (download) - annotate - [select for diffs], Wed Feb 1 03:54:49 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.472: +2 -14 lines
Diff to previous 1.472 (colored)

fix: wm(4) Rx descriptor is corrupted under high rate.

don't write descriptor which is not set DD bit.

Revision 1.472 / (download) - annotate - [select for diffs], Tue Jan 31 03:06:06 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.471: +2 -3 lines
Diff to previous 1.471 (colored)

remove obsolete comment. wm(4) vlan have already tested on I354.

Revision 1.471 / (download) - annotate - [select for diffs], Mon Jan 30 09:33:38 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.470: +10 -10 lines
Diff to previous 1.470 (colored)

fix endianness of "rsshash"(currently, used for debug message only) and tabify.

Revision 1.470 / (download) - annotate - [select for diffs], Fri Jan 27 05:04:47 2017 UTC (6 years ago) by knakahara
Branch: MAIN
Changes since 1.469: +12 -2 lines
Diff to previous 1.469 (colored)

add comment about txq->txq_lock contentions in wm_nq_transmit().

Revision 1.469 / (download) - annotate - [select for diffs], Thu Jan 26 10:14:52 2017 UTC (6 years ago) by knakahara
Branch: MAIN
Changes since 1.468: +9 -2 lines
Diff to previous 1.468 (colored)

fix memory leak at wm_detach.

pointed out and reviewed by msaitoh@n.o.

Revision 1.289.2.9.2.1 / (download) - annotate - [select for diffs], Wed Jan 18 08:46:27 2017 UTC (6 years ago) by skrll
Branch: netbsd-7-nhusb
Changes since 1.289.2.9: +1611 -530 lines
Diff to previous 1.289.2.9 (colored)

Sync with netbsd-5

Revision 1.468 / (download) - annotate - [select for diffs], Mon Jan 16 09:58:04 2017 UTC (6 years ago) by maya
Branch: MAIN
Changes since 1.467: +4 -6 lines
Diff to previous 1.467 (colored)

move declaration to #ifdef WM_DEBUG block as opposed to using __debugused
fixes build with DEBUG but without WM_DEBUG

ok martin

Revision 1.467 / (download) - annotate - [select for diffs], Mon Jan 16 00:14:04 2017 UTC (6 years ago) by knakahara
Branch: MAIN
Changes since 1.466: +3 -3 lines
Diff to previous 1.466 (colored)

update todo comment

Revision 1.466 / (download) - annotate - [select for diffs], Mon Jan 16 00:09:06 2017 UTC (6 years ago) by knakahara
Branch: MAIN
Changes since 1.465: +327 -85 lines
Diff to previous 1.465 (colored)

support {extended, advanced} receive descriptor for wm(4).

support below two receive descriptors.
    - extended descriptor (used by 82574 only)
    - advanced descriptor (used by 82575 and newer)

SPH(split header buffer) is not supported yet.

ok by msaitoh@n.o.

Revision 1.465 / (download) - annotate - [select for diffs], Tue Jan 10 08:57:39 2017 UTC (6 years ago) by msaitoh
Branch: MAIN
CVS Tags: bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.464: +2 -3 lines
Diff to previous 1.464 (colored)

remove debug printf().

Revision 1.464 / (download) - annotate - [select for diffs], Tue Jan 10 08:56:02 2017 UTC (6 years ago) by msaitoh
Branch: MAIN
Changes since 1.463: +10 -16 lines
Diff to previous 1.463 (colored)

 Fix previous. The last code wasn't called.

Revision 1.463 / (download) - annotate - [select for diffs], Tue Jan 10 08:22:43 2017 UTC (6 years ago) by knakahara
Branch: MAIN
Changes since 1.462: +3 -5 lines
Diff to previous 1.462 (colored)

sc->sc_core_stopping must be checked with holding sc_core_lock.

pointed out by ozaki-r@n.o, thanks.

Revision 1.416.2.2 / (download) - annotate - [select for diffs], Sat Jan 7 08:56:33 2017 UTC (6 years ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.416.2.1: +846 -293 lines
Diff to previous 1.416.2.1 (colored) to branchpoint 1.416 (colored)

Sync with HEAD.  (Note that most of these changes are simply $NetBSD$
tag issues.)

Revision 1.462 / (download) - annotate - [select for diffs], Fri Jan 6 08:05:26 2017 UTC (6 years ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107
Changes since 1.461: +26 -5 lines
Diff to previous 1.461 (colored)

- Set IPV6EXDIS bit in RFCTL register because of an Errata on 82575 and newer
  devices.
- Update comment in wm_init_rss().

Revision 1.461 / (download) - annotate - [select for diffs], Wed Jan 4 04:43:08 2017 UTC (6 years ago) by knakahara
Branch: MAIN
Changes since 1.460: +3 -3 lines
Diff to previous 1.460 (colored)

fix typo. pointed out by msaitoh@n.o.

Revision 1.460 / (download) - annotate - [select for diffs], Wed Dec 28 07:32:16 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.459: +5 -2 lines
Diff to previous 1.459 (colored)

Protect ec_multi* with mutex

The data can be accessed from sysctl, ioctl, interface watchdog
(if_slowtimo) and interrupt handlers. We need to protect the data against
parallel accesses from them.

Currently the mutex is applied to some drivers, we need to apply it to all
drivers in the future.

Note that the mutex is adaptive one for ease of implementation but some
drivers access the data in interrupt context so we cannot apply the mutex
to every drivers as is. We have two options: one is to replace the mutex
with a spin one, which requires some additional works (see
ether_multicast_sysctl), and the other is to modify the drivers to access
the data not in interrupt context somehow.

Revision 1.459 / (download) - annotate - [select for diffs], Mon Dec 26 07:55:00 2016 UTC (6 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.458: +3 -3 lines
Diff to previous 1.458 (colored)

0x10cb is not 82801H but 82801I. No functional change (The macro name
was changed but the vaule is the same).

Revision 1.289.2.12 / (download) - annotate - [select for diffs], Sun Dec 18 07:53:08 2016 UTC (6 years, 1 month ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-1-RC2, netbsd-7-1-RC1
Changes since 1.289.2.11: +110 -86 lines
Diff to previous 1.289.2.11 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1327):
	sys/dev/pci/if_wm.c: revision 1.457
	sys/dev/pci/if_wmreg.h: revision 1.94
- Change to use 2500Base-KX correctly on C2000(I354). It worked, but the
output of ifconfig and if_baudrate was not good. Tested by nils@:
   - The STATUS_TBIMODE bit in the STATUS register is deleted since 82575,
     so check for 82575 and newer first and then check for old devices.
   - Check the 2P5_SKU and 2P5_SKU_OVER bit for KX.
   - Set IFM_2500_SX instead of IFM_1000_SX for 2.5G.
- Check SERDES's speed directly from the PCS layer (PCS_LSTS register) for old
   devices.
- Style fix.

Revision 1.458 / (download) - annotate - [select for diffs], Thu Dec 15 09:28:05 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.457: +2 -7 lines
Diff to previous 1.457 (colored)

Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
  - Where/When if_ipackets is counted up
  - Note that some drivers still update packet statistics in their own
    way (periodical update)
- Moved bpf_mtap run in softint
  - This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net

Revision 1.457 / (download) - annotate - [select for diffs], Tue Dec 13 10:01:44 2016 UTC (6 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.456: +110 -86 lines
Diff to previous 1.456 (colored)

- Change to use 2500Base-KX correctly on C2000(I354). It worked, but the
output of ifconfig and if_baudrate was not good. Tested by nils@:
  - The STATUS_TBIMODE bit in the STATUS register is deleted since 82575,
    so check for 82575 and newer first and then check for old devices.
  - Check the 2P5_SKU and 2P5_SKU_OVER bit for KX.
  - Set IFM_2500_SX instead of IFM_1000_SX for 2.5G.
- Check SERDES's speed directly from the PCS layer (PCS_LSTS register) for old
  devices.
- Style fix.

Revision 1.289.2.11 / (download) - annotate - [select for diffs], Mon Dec 12 07:18:29 2016 UTC (6 years, 1 month ago) by snj
Branch: netbsd-7
Changes since 1.289.2.10: +1496 -439 lines
Diff to previous 1.289.2.10 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1302):
	sys/dev/mii/igphyreg.h: revisions 1.7-1.10
	sys/dev/mii/ikphyreg.h: revisions 1.3
	sys/dev/mii/inbmphyreg.h: revisions 1.4-1.9
	sys/dev/mii/mii.h: revisions 1.19-1.20
	sys/dev/pci/if_wm.c: revisions 1.390, 1.392-1.395, 1.397, 1.419-1.425, 1.427-1.428, 1.430-1.435, 1.437-1.453 via patch
	sys/dev/pci/if_wmreg.: revisions 1.89-1.93 via patch
	sys/dev/pci/if_wmvar.h: revisions 1.31-1.32
Update wm(4) up to if_wm.c rev. 1.453 except MSI/MSI-X, multiqueue and
NET_MPSAFE:
- Add I219 support. It's not stable so it's disabled by default.
- wm_gate_hw_phy_config_ich8lan() is for younger than PCH2.
- Drop the host wakeup bit after resetting PHY on PCH and newer
  devices.
- Increase delay while toggling LANPHYPC
- Move call of wm_reset() in wm_attach() after setting PHY and NVM
  related flags because those flags are used in wm_reset().
- Use mutex for NVM access on ICH8 and newer devices. Same as FreeBSD.
- Rewrite PHY related lock stuff. Almost the same as FreeBSD.
  This change will fix a bug that PHY read/write fail on some cases.
- Increase delay in wm_phy_resetisblocked(). Same as FreeBSD.
- Use semaphore in wm_hv_phy_workaround_ich8lan() and
  wm_k1_gig_workaround_hv()
- Use wm_gii_mdic_readreg/writereg() in wm_access_phy_wakeup_reg_bm()
  because these functions are called with taking lock.
- 82567V_3 is BME1000_E_2(bm). Tested with Advantech AIMB-212 1st
  Ethernet port.
- Use wm_gmii_82544_{read,write}reg() on non-82567 ICH8, 9 and 10.
- Remove an 82578 workaround which was for PCH rev < 3. FreeBSD
  removed this workaround in r228386.
- Add an 82578 workaround which is for PHY rev < 2. From FreeBSD and
  Linux.
- Fix wm(4) input drop packet counter. WMREG_RNBC is incremented when
  there is no available buffers in host memory. However, ethernet
  controller can receive packets in such case if there is space in
  phy's FIFO. That is, ethernet controller drops packet only if there
  is no available buffers *and* there is no space in phy's FIFO. So,
  the number of dropped packets should be added WMREG_MPC only.
- Use MII_ADDRMASK.
- Define WMPHY_I217, WMPHY_VF and WMPHY_210.
- Use BME1000_PHY_PAGE_SELECT in wm_gmii_bm_{read,write}reg(). This
  change has no effect because GG82563_PHY_PAGE_SELECT and
  BME1000_PHY_PAGE_SELECT have the same value.
- Fix PHY access on  82567(ICH8 or ICH10), 82574 and 82583:
  - Use wm_gmii_bm_{read,write}reg() on 82574 and 82573.
  - Issue page select correctly on BM PHYs.
- Fix workaround which did dummy read BM_WUC register. This code was
  changed to drop BM_WUC_HOST_WU_BIT of BM_PROT_GEN_CFG register in
  FreeBSD r228386. The code was added rev. 1.149, but the location was
  not the best.
- wm_gmii_hv_{read/write}reg*(): USE PHY address 1 for some special
  registers.
- Add check code for an 82578 workaround. Not completed yet.
- wm_release_hw_control(): Remove extra line. No any effect.
- Add "10/100" into non-gigabit devices' name.
- Call wm_enable_wakeup() in wm_detach() and wm_suspend(). Now wake on
  lan works on Thinkpad X61(ICH8).
- Fix wm_access_phy_wakeup_reg_bm(). This change has no effect because
  this function is used for WUC register and our driver currenlty
  doesn't access to it.
- Call wm_enable_phy_wakeup() on PCH2 and newer, too. Now these devices
  can do WOL. Tested with Thinkpad X220(PCH2).
- Set CTRL_MEHE correctly (PCH_{LPT,SPT} only).
- Add three workarounds for PCH_{LPT,SPT}.
- Fix a bug that 8257[56], 82580, I35[04] and I21[01] didn't use
  wm_{get,release}_hw_control() correctly.
- Sync wm_smbustopci() with Linux and FreeBSD. This change effects PCH
  and newer devices.
- Move the location of wm_smbustopci() call.
- Fix flag check in wm_get_wakeup()
  - 8254[17]* and 8257[124] should not set WM_F_ARC_SUBSYS_VALID.
  - Add missing WM_T_82541_2 and WM_T_82547_2.
- Fix WOL related setting of the WUC register for other than PCH* in
  wm_enable_wakeup(). Tested with 82567V(ICH8) and 82583V.
- Use common MII_ADDRMASK.
- igphy(4): No binary change:
  - s/IGPPHY/IGPHY/
  - Fix the definition of PLHR_VALID_CHANNEL_*
  - Fix the definition of MSE_CHANNEL_*
  - Add MII_IGPHY_POWER_MGMT.
- Add some KASSERT.
- Add comment. Modify comment.
- Add debug code.

Revision 1.289.2.10 / (download) - annotate - [select for diffs], Fri Dec 9 05:27:30 2016 UTC (6 years, 1 month ago) by snj
Branch: netbsd-7
Changes since 1.289.2.9: +5 -5 lines
Diff to previous 1.289.2.9 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1300):
	sys/dev/pci/pcidevs: revision 1.1270
	sys/dev/pci/if_wm.c: revision 1.426
i82567V-3 is not ICH9 but ICH8.
--
82567V-3 is not ICH9 but ICH8.

Revision 1.456 / (download) - annotate - [select for diffs], Thu Dec 8 01:12:01 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.455: +62 -10 lines
Diff to previous 1.455 (colored)

Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.

Revision 1.308.2.9 / (download) - annotate - [select for diffs], Mon Dec 5 10:55:03 2016 UTC (6 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.8: +1431 -517 lines
Diff to previous 1.308.2.8 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.455 / (download) - annotate - [select for diffs], Fri Dec 2 01:48:44 2016 UTC (6 years, 1 month ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20161204
Changes since 1.454: +24 -12 lines
Diff to previous 1.454 (colored)

fix: ifp->if_obytes and ifp->if_omcasts are not counted up for packets which is sent later.

pointed out by ozaki-r@n.o, thanks.

Revision 1.454 / (download) - annotate - [select for diffs], Thu Dec 1 02:36:50 2016 UTC (6 years, 1 month ago) by knakahara
Branch: MAIN
Changes since 1.453: +75 -20 lines
Diff to previous 1.453 (colored)

support Tx multiqueue for 82574(aka e1000e for VMware and QEMU).

Revision 1.453 / (download) - annotate - [select for diffs], Mon Nov 21 03:57:37 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.452: +10 -2 lines
Diff to previous 1.452 (colored)

Add note about kumeran registers. No functional change.

Revision 1.452 / (download) - annotate - [select for diffs], Fri Nov 18 11:46:04 2016 UTC (6 years, 2 months ago) by joerg
Branch: MAIN
Changes since 1.451: +3 -3 lines
Diff to previous 1.451 (colored)

Remove extra pair of braces.

Revision 1.451 / (download) - annotate - [select for diffs], Fri Nov 18 06:55:00 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.450: +3 -3 lines
Diff to previous 1.450 (colored)

 Fix WOL related setting of the WUC register for other than PCH*
in wm_enable_wakeup(). Tested with 82567V(ICH8) and 82583V.

Revision 1.450 / (download) - annotate - [select for diffs], Thu Nov 17 03:40:08 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.449: +5 -5 lines
Diff to previous 1.449 (colored)

8257[124] should not set WM_F_ARC_SUBSYS_VALID.

Revision 1.449 / (download) - annotate - [select for diffs], Thu Nov 17 03:36:23 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.448: +8 -5 lines
Diff to previous 1.448 (colored)

Fix flag check in wm_get_wakeup()
- 8254[17]* should not set WM_F_ARC_SUBSYS_VALID.
- Add missing WM_T_82541_2 and WM_T_82547_2
- Note that the setting of both Linux's FLAG_HAS_AMT and FreeBSD's has_amt
  flag is doubtful on 8257[34] and 82583.

Revision 1.448 / (download) - annotate - [select for diffs], Wed Nov 16 09:27:49 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.447: +7 -7 lines
Diff to previous 1.447 (colored)

Move the location of wm_smbustopci() call.

Revision 1.447 / (download) - annotate - [select for diffs], Wed Nov 16 08:56:17 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.446: +287 -21 lines
Diff to previous 1.446 (colored)

 Sync wm_smbustopci() with Linux and FreeBSD. This change effects PCH and
newer devices.

Revision 1.446 / (download) - annotate - [select for diffs], Wed Nov 16 08:14:39 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.445: +12 -66 lines
Diff to previous 1.445 (colored)

 Fix a bug that 8257[56], 82580, I35[04] and I21[01] didn't use
wm_{get,release}_hw_control() correctly.

Revision 1.445 / (download) - annotate - [select for diffs], Wed Nov 16 07:24:52 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.444: +126 -2 lines
Diff to previous 1.444 (colored)

Add three workarounds for PCH_{LPT,SPT}.

Revision 1.444 / (download) - annotate - [select for diffs], Mon Nov 14 05:38:39 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.443: +4 -5 lines
Diff to previous 1.443 (colored)

Set CTRL_MEHE correctly (PCH_{LPT,SPT} only).

Revision 1.443 / (download) - annotate - [select for diffs], Thu Nov 10 08:35:24 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.442: +83 -45 lines
Diff to previous 1.442 (colored)

- Move I219 DMA workaround into wm_flush_desc_rings() and call it before
  wm_reset().
- Rewite I219 TX DMA workaround based on OpenBSD's one.
- Add I219 RX DMA workaroud from OpenBSD.

Revision 1.442 / (download) - annotate - [select for diffs], Thu Nov 10 06:57:15 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.441: +4 -4 lines
Diff to previous 1.441 (colored)

 Call wm_enable_phy_wakeup() on PCH2 and newer, too. Now these devices
can do WOL. Tested with Thinkpad X220(PCH2).

Revision 1.441 / (download) - annotate - [select for diffs], Tue Nov 8 10:37:40 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.440: +21 -6 lines
Diff to previous 1.440 (colored)

 Fix wm_access_phy_wakeup_reg_bm(). This change has no effect because this
function is used for WUC register and our driver currenlty doesn't access
to it.

Revision 1.440 / (download) - annotate - [select for diffs], Tue Nov 8 09:38:36 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.439: +2 -5 lines
Diff to previous 1.439 (colored)

Remove debug printf which was added in rev. 1.437.

Revision 1.439 / (download) - annotate - [select for diffs], Tue Nov 8 08:54:30 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.438: +4 -9 lines
Diff to previous 1.438 (colored)

Call wm_enable_wakeup() in wm_detach() and wm_suspend(). Now wake on lan
works on Thinkpad X61(ICH8). Some workarounds will be required on PCH*.

Revision 1.438 / (download) - annotate - [select for diffs], Sun Nov 6 02:38:25 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.437: +8 -8 lines
Diff to previous 1.437 (colored)

Add "10/100" into non-gigabit devices' name.

Revision 1.416.2.1 / (download) - annotate - [select for diffs], Fri Nov 4 14:49:09 2016 UTC (6 years, 2 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.416: +820 -338 lines
Diff to previous 1.416 (colored)

Sync with HEAD

Revision 1.437 / (download) - annotate - [select for diffs], Wed Nov 2 10:14:04 2016 UTC (6 years, 2 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-localcount-20161104
Changes since 1.436: +45 -35 lines
Diff to previous 1.436 (colored)

- Fix workaround which did dummy read BM_WUC register. This code was changed to
  drop BM_WUC_HOST_WU_BIT of BM_PROT_GEN_CFG register in FreeBSD r228386. The
  code was added rev. 1.149, but the location was not the best.
  Now I219 doesn't hang quickly after "ifconfig up".
- wm_gmii_hv_{read/write}reg*(): USE PHY address 1 for some special registers.
- Add check code for an 82578 workaround. Not completed yet(check only).
- wm_release_hw_control(): Remove extra line. No any effect.

Revision 1.436 / (download) - annotate - [select for diffs], Mon Oct 31 02:44:54 2016 UTC (6 years, 2 months ago) by knakahara
Branch: MAIN
Changes since 1.435: +6 -6 lines
Diff to previous 1.435 (colored)

Fix locking against myself at wm_turn{on,off} when NET_MPSAFE is defined.

Pointed out by ozaki-r@n.o, thanks.

Revision 1.435 / (download) - annotate - [select for diffs], Fri Oct 28 09:16:02 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.434: +45 -10 lines
Diff to previous 1.434 (colored)

Fix PHY access on  82567(ICH8 or ICH10), 82574 and 82583:
- Use wm_gmii_bm_{read,write}reg() on 82574 and 82573.
- Issue page select correctly on BM PHYs.

Revision 1.434 / (download) - annotate - [select for diffs], Fri Oct 28 06:59:08 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.433: +15 -15 lines
Diff to previous 1.433 (colored)

Change debug flags to be better than before.

Revision 1.433 / (download) - annotate - [select for diffs], Fri Oct 28 06:27:11 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.432: +6 -4 lines
Diff to previous 1.432 (colored)

- Define WMPHY_I217, WMPHY_VF and WMPHY_210.
- Use BME1000_PHY_PAGE_SELECT in wm_gmii_bm_{read,write}reg(). This change has
  no effect because GG82563_PHY_PAGE_SELECT and BME1000_PHY_PAGE_SELECT have
  the same value.

Revision 1.432 / (download) - annotate - [select for diffs], Fri Oct 28 05:50:18 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.431: +10 -11 lines
Diff to previous 1.431 (colored)

- Use MII_ADDRMASK.
- Remove debug printf().

Revision 1.431 / (download) - annotate - [select for diffs], Fri Oct 28 05:29:11 2016 UTC (6 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.430: +12 -3 lines
Diff to previous 1.430 (colored)

Fix wm(4) input drop packet counter.

WMREG_RNBC is incremented when there is no available buffers in host
memory. However, ethernet controller can receive packets in such case
if there is space in phy's FIFO. That is, ethernet controller drops
packet only if there is no available buffers *and* there is no space
in phy's FIFO.
So, the number of dropped packets should be added WMREG_MPC only.

ok by msaitoh@n.o

Revision 1.430 / (download) - annotate - [select for diffs], Fri Oct 28 05:21:48 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.429: +25 -12 lines
Diff to previous 1.429 (colored)

- Remove an 82578 workaround which was for PCH rev < 3. FreeBSD removed this
  workaround in r228386.
- Add an 82578 workaround which is for PHY rev < 2. From FreeBSD and Linux.
- Add some DPRINTF()s.

Revision 1.429 / (download) - annotate - [select for diffs], Fri Oct 28 04:14:13 2016 UTC (6 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.428: +105 -36 lines
Diff to previous 1.428 (colored)

Fix sc_stopping race.

To scale, separate sc_stopping flag to wm_softc and each tx,rx queues.

Pointed out by skrll@n.o, thanks.

ok by msaitoh@n.o

Revision 1.428 / (download) - annotate - [select for diffs], Wed Oct 26 10:21:44 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.427: +7 -3 lines
Diff to previous 1.427 (colored)

Use wm_gmii_82544_{read,write}reg() on non-82567 ICH8, 9 and 10.

Revision 1.427 / (download) - annotate - [select for diffs], Wed Oct 26 07:22:14 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.426: +3 -2 lines
Diff to previous 1.426 (colored)

82567V_3 is BME1000_E_2(bm). Tested with Advantech AIMB-212 1st Ethernet port.

Revision 1.426 / (download) - annotate - [select for diffs], Wed Oct 26 06:51:35 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.425: +5 -5 lines
Diff to previous 1.425 (colored)

82567V-3 is not ICH9 but ICH8.

Revision 1.425 / (download) - annotate - [select for diffs], Fri Oct 21 08:30:48 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.424: +27 -12 lines
Diff to previous 1.424 (colored)

- Fix previous commit in wm_kmrn_readreg().
- Use wm_gii_mdic_readreg/writereg() in wm_access_phy_wakeup_reg_bm()
  because these functions are called with taking lock.
- Add some DPRINTF()s.

Revision 1.424 / (download) - annotate - [select for diffs], Fri Oct 21 04:41:09 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.423: +368 -222 lines
Diff to previous 1.423 (colored)

- Rewrite PHY related lock stuff. Almost the same as FreeBSD.
  This change will fix a bug that PHY read/write fail on some cases.
- Increase delay in wm_phy_resetisblocked(). Same as FreeBSD.
- Use semaphore in wm_hv_phy_workaround_ich8lan() and wm_k1_gig_workaround_hv()

Revision 1.423 / (download) - annotate - [select for diffs], Thu Oct 20 08:03:13 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.422: +39 -15 lines
Diff to previous 1.422 (colored)

- Move call of wm_reset() in wm_attach() after setting PHY and NVM related
  flags because those flags are used in wm_reset().
- Use mutex for NVM access on ICH8 and newer devices. Same as FreeBSD.

Revision 1.422 / (download) - annotate - [select for diffs], Thu Oct 20 05:53:27 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.421: +17 -2 lines
Diff to previous 1.421 (colored)

Add newer I219 devices (not enabled).

Revision 1.421 / (download) - annotate - [select for diffs], Thu Oct 20 04:06:53 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.420: +11 -2 lines
Diff to previous 1.420 (colored)

Add more DPRINTF()s.

Revision 1.420 / (download) - annotate - [select for diffs], Wed Oct 19 08:55:23 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.419: +112 -15 lines
Diff to previous 1.419 (colored)

No, functional change:
- Add WM_DEBUG_LOCK
- Add some KASSERT
- Modify comment.

Revision 1.419 / (download) - annotate - [select for diffs], Wed Oct 19 08:22:57 2016 UTC (6 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.418: +13 -4 lines
Diff to previous 1.418 (colored)

- Drop the host wakeup bit after resetting PHY on PCH and newer devices.
- Increase delay while toggling LANPHYPC

Revision 1.418 / (download) - annotate - [select for diffs], Tue Oct 11 15:48:17 2016 UTC (6 years, 3 months ago) by skrll
Branch: MAIN
Changes since 1.417: +4 -5 lines
Diff to previous 1.417 (colored)

Read sc_if_flags after taking core lock

Revision 1.308.2.8 / (download) - annotate - [select for diffs], Wed Oct 5 20:55:43 2016 UTC (6 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.7: +142 -109 lines
Diff to previous 1.308.2.7 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.227.2.20 / (download) - annotate - [select for diffs], Sat Sep 24 13:14:57 2016 UTC (6 years, 4 months ago) by bouyer
Branch: netbsd-6
Changes since 1.227.2.19: +3 -3 lines
Diff to previous 1.227.2.19 (colored) to branchpoint 1.227 (colored) next main 1.228 (colored)

Apply patch, requested by martin in ticket #1407:
	sys/dev/pci/if_wm.c	patch
fix evbppc build, where the older gcc wrongly warns about uninitialized
variable.

Revision 1.417 / (download) - annotate - [select for diffs], Wed Aug 10 04:52:40 2016 UTC (6 years, 5 months ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20161004, localcount-20160914
Changes since 1.416: +138 -105 lines
Diff to previous 1.416 (colored)

restructure wm(4) evcnt to support multiqueue evcnt.

ok by msaitou@n.o.

Revision 1.416 / (download) - annotate - [select for diffs], Mon Jul 11 06:14:51 2016 UTC (6 years, 6 months ago) by knakahara
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726
Branch point for: pgoyette-localcount
Changes since 1.415: +5 -5 lines
Diff to previous 1.415 (colored)

pci_intr_type() is required pci_chipset_tag_t argument by other than x86.

pointed out by nonaka@n.o.

Revision 1.308.2.7 / (download) - annotate - [select for diffs], Sat Jul 9 20:25:04 2016 UTC (6 years, 6 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.6: +57 -81 lines
Diff to previous 1.308.2.6 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.415 / (download) - annotate - [select for diffs], Mon Jun 20 08:34:59 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20160907
Changes since 1.414: +7 -2 lines
Diff to previous 1.414 (colored)

wm(4) can enable IFEF_START_MPSAFE now.

Revision 1.414 / (download) - annotate - [select for diffs], Tue Jun 14 17:09:20 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
Changes since 1.413: +3 -6 lines
Diff to previous 1.413 (colored)

fix: rxq->rxq_lock is uninitialized if NET_MPSAFE is not defined.

Revision 1.413 / (download) - annotate - [select for diffs], Tue Jun 14 09:07:22 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.412: +49 -75 lines
Diff to previous 1.412 (colored)

Simplify the code.

WM_[RT]X_* macros are removed and replaced with mutex_* calls directly.

OK from nakahara@ and msaitoh@

Revision 1.412 / (download) - annotate - [select for diffs], Fri Jun 10 13:27:14 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.411: +3 -3 lines
Diff to previous 1.411 (colored)

Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.

Revision 1.411 / (download) - annotate - [select for diffs], Mon May 30 03:54:12 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.410: +3 -3 lines
Diff to previous 1.410 (colored)

fix r1.409 mistake

Revision 1.308.2.6 / (download) - annotate - [select for diffs], Sun May 29 08:44:22 2016 UTC (6 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.5: +718 -441 lines
Diff to previous 1.308.2.5 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.410 / (download) - annotate - [select for diffs], Mon May 23 23:36:02 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529
Changes since 1.409: +3 -2 lines
Diff to previous 1.409 (colored)

Update TODO: evcnt

Revision 1.409 / (download) - annotate - [select for diffs], Mon May 23 04:07:29 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.408: +6 -3 lines
Diff to previous 1.408 (colored)

fix: ethernet controllers which use wiseman_txdesc_t (earlier than 82575) hang
possibly.

Revision 1.408 / (download) - annotate - [select for diffs], Mon May 23 03:30:40 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.407: +3 -6 lines
Diff to previous 1.407 (colored)

GENERIC kernel (disabled NET_MPSAFE kernel) also needs txq_lock to avoid race
between tx processing and tx interrupt handler.

Revision 1.407 / (download) - annotate - [select for diffs], Fri May 20 08:17:14 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.406: +4 -3 lines
Diff to previous 1.406 (colored)

Update TODO

    - "TX Multiqueue" -> "TX Multiqueue improvement"
    - add "Advanced Recieve Descriptor" (RX NEWQUEUE)

Revision 1.406 / (download) - annotate - [select for diffs], Thu May 19 08:35:03 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.405: +3 -3 lines
Diff to previous 1.405 (colored)

fix build failure by gcc 4.8.5

Revision 1.405 / (download) - annotate - [select for diffs], Thu May 19 08:27:57 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.404: +212 -350 lines
Diff to previous 1.404 (colored)

unify TX and RX interrupt handler to use MSI-X vector efficiently

Revision 1.404 / (download) - annotate - [select for diffs], Thu May 19 08:22:37 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.403: +21 -11 lines
Diff to previous 1.403 (colored)

user-friendly interrupt affinity offset

Revision 1.403 / (download) - annotate - [select for diffs], Thu May 19 08:20:06 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.402: +143 -31 lines
Diff to previous 1.402 (colored)

initial TX multiqueue support

Revision 1.402 / (download) - annotate - [select for diffs], Wed May 18 08:59:56 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.401: +5 -6 lines
Diff to previous 1.401 (colored)

Whether Tx interrupt handler kicks if_start() should not depend on wm_txeof()
return value.

Revision 1.401 / (download) - annotate - [select for diffs], Wed May 18 08:41:42 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.400: +8 -8 lines
Diff to previous 1.400 (colored)

rename WM_TXQ_WORKING to WM_TXQ_NO_SPACE

Revision 1.400 / (download) - annotate - [select for diffs], Wed May 18 07:49:34 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.399: +15 -6 lines
Diff to previous 1.399 (colored)

device drivers should not divert ifp->if_flags to manage H/W satatus.

Revision 1.399 / (download) - annotate - [select for diffs], Wed May 18 06:59:59 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.398: +11 -15 lines
Diff to previous 1.398 (colored)

refactor: eliminate "txq->txq_descs_size", use WM_TXDESCS_SIZE instead.

Revision 1.398 / (download) - annotate - [select for diffs], Wed May 18 06:55:51 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.397: +25 -20 lines
Diff to previous 1.397 (colored)

fix unmatched dma sync size for NEWQUEUE. This bug would have caused
wm_nq_tx_offload() not to work.

Revision 1.397 / (download) - annotate - [select for diffs], Wed May 11 04:37:09 2016 UTC (6 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.396: +4 -4 lines
Diff to previous 1.396 (colored)

Fix compile error on some archs (e.g. i386).

Revision 1.396 / (download) - annotate - [select for diffs], Wed May 11 03:46:06 2016 UTC (6 years, 8 months ago) by knakahara
Branch: MAIN
Changes since 1.395: +4 -4 lines
Diff to previous 1.395 (colored)

Interrupt handlers read wm_rxqueue or wm_txqueue, so they must be freed after
disestablishing interrupt handlers.

Revision 1.395 / (download) - annotate - [select for diffs], Wed May 11 02:23:50 2016 UTC (6 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.394: +7 -3 lines
Diff to previous 1.394 (colored)

Do I219 TX DMA workaround only when TDLEN(0) != 0

Revision 1.227.2.19 / (download) - annotate - [select for diffs], Fri May 6 18:43:34 2016 UTC (6 years, 8 months ago) by snj
Branch: netbsd-6
Changes since 1.227.2.18: +681 -155 lines
Diff to previous 1.227.2.18 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1366):
	sys/dev/pci/if_wm.c: 1.281, 1.318, 1.320, 1.324-1.332, 1.334, 1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.387, 1.389 via patch
	sys/dev/pci/if_wmreg.h: 1.68-1.70, 1.73-1.77, 1.79-1.80, 1.82, 1.86-1.88 via patch
	sys/dev/pci/if_wmvar.h: 1.22-1.23, 1.25-1.30 via patch
	sys/dev/mii/igphy.c: 1.25
	sys/dev/mii/ukphy.c: 1.48
Sync wm(4) as of if_wm.c rev 1.389 except SERDES, MSI/MSI-X, multiqueue
and NET_MPSAFE:
- Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more
  than 4096. Almost the same as other OSes.
- For 82576 and newer devices, the PBA register is deleted. Don't write
  PBA for those chips. Also change the calculation of RX packet buffer
  size in new way.
- Print NVM image version and option ROM version.
- Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
  workaround is required if the NVM image version < 3.25.
- Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
  "drvctl -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
- Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX
  packets" and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit.
  The NVM Image version 2.1.4 and newer have this workaround.
- Check PHY type correctly. This change is required to use igphy(4)
  device correctly.
- Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH*
  too.
- Call wm_get_hw_control() correctly. This change fixes a bug that some
  AMT based systems doesn't linkup at 1000BaseT. The problem was
  observed on HP Compaq dc7700. A lot of fixes have been done for wm(4)
  and igphy(4), so now PR#44893 should be fixed.
- Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
  check the existence of AMT correctly.
- Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
  wm_reset() on PCH2.
- Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix
  the behavior on suspend/resume.
- Fix logic of wm_check_reset_block() on ICH* and PCH*. This change
  might fix a problem that PHY's read/write functions can't get
  semaphore.
- On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed
  down.
- Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS
  sets this bit.
- Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the
  function checks the status correctly but it causes linkdown up to 10
  times, so it's disabled for the time being.
- PR/50527: David Binderman: Fix impossible code. Odd offsets need
  special treatment.
- Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
  determine the range of the RAL.
- Use sc->sc_itr instead of hard-coded number.
- Rename wm_tbi_check_link() to wm_tbi_tick() because this function
  acts as mii_tick().
- ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
  No binary change because this definition has not used yet.
- Add ACK data Disable bit's definition (not used yet).
- PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any
  effect by default because WM_WOL is not defined yet and
  m_kmrn_lock_loss_workaround_ich8lan() is broken.
- Fix wm_check_mng_mode_ich8lan(). This function is used only when
  WM_WOL is defined and it's disabled by default.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it
  returns bool. No functional change.
- Reorder function definitions and macro definitions. No functional
  change.
- Fix comment. Add comment. Update comment.
- KNF.

Revision 1.394 / (download) - annotate - [select for diffs], Fri May 6 10:56:04 2016 UTC (6 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.393: +35 -8 lines
Diff to previous 1.393 (colored)

- Modify wm_smbustopci() to reduce the diff against Linux and FreeBSD.
- wm_gate_hw_phy_config_ich8lan() is for younger than PCH2.
- Add debug code.

Revision 1.393 / (download) - annotate - [select for diffs], Fri May 6 08:57:43 2016 UTC (6 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.392: +49 -2 lines
Diff to previous 1.392 (colored)

Add some workaround code for I219. It still doesn't work.

Revision 1.392 / (download) - annotate - [select for diffs], Fri May 6 08:56:20 2016 UTC (6 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.391: +240 -36 lines
Diff to previous 1.391 (colored)

Basic support for I219. It doesn't work on I219, so it's disabled.

Revision 1.308.2.5 / (download) - annotate - [select for diffs], Sat Mar 19 11:30:10 2016 UTC (6 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.4: +169 -168 lines
Diff to previous 1.308.2.4 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.289.2.9 / (download) - annotate - [select for diffs], Fri Feb 26 22:08:17 2016 UTC (6 years, 11 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base
Branch point for: netbsd-7-nhusb
Changes since 1.289.2.8: +1140 -394 lines
Diff to previous 1.289.2.8 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1102):
	sys/dev/mii/igphy.c: 1.25
	sys/dev/mii/ukphy.c: 1.48
	sys/dev/pci/if_wm.c: revisions 1.308, 1.318, 1.320, 1.324-1.332, 1.334, 1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.389 via patch
	sys/dev/pci/if_wmreg.h: revisions 1.68-1.70, 1.73-1.77, 1.79-1.80, 1.82, 1.86-1.88 via patch
	sys/dev/pci/if_wmvar.h: revisions 1.22-1.23, 1.25-1.30 via patch
Sync wm(4) as of if_wm.c rev 1.389 except MSI/MSI-X, multiqueue and NET_MPSAFE:
- Add C2000 KX and 2.5G support.
- Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more than
  4096. Almost the same as other OSes.
- For 82576 and newer devices, the PBA register is deleted. Don't write PBA
  for those chips. Also change the calculation of RX packet buffer size in
  new way.
- Fix a lot of bugs to make 82575 and newer SERDES based systems work.
- Print NVM image version and option ROM version.
- Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
  workaround is required if the NVM image version < 3.25.
- Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
  "drvct -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
- Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX packets"
  and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit. The NVM Image
  version 2.1.4 and newer have this workaround.
- Check PHY type correctly. This change is required to use igphy(4) device
  correctly.
- Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.
- Call wm_get_hw_control() correctly. This change fixes a bug that some AMT
  based systems doesn't linkup at 1000BaseT. The problem was observed on HP
  Compaq dc7700. A lot of fixes have been done for wm(4) and igphy(4), so now
  PR#44893 should be fixed.
- Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
  check the existence of AMT correctly.
- Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
  wm_reset() on PCH2.
- Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix the
  behavior on suspend/resume.
- Fix logic of wm_check_reset_block() on ICH* and PCH*. This change might fix
  a problem that PHY's read/write functions can't get semaphore.
- On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed down.
- Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS sets
  this bit.
- Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the function
  checks the status correctly but it causes linkdown up to 10 times, so it's
  disabled for the time being.
- PR/50527: David Binderman: Fix impossible code. Odd offsets need special
  treatment.
- Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
  determine the range of the RAL.
- Use sc->sc_itr instead of hard-coded number.
- Rename wm_tbi_check_link() to wm_tbi_tick() because this function acts as
  mii_tick().
- ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
  No binary change because this definition has not used yet.
- Add ACK data Disable bit's definition (not used yet).
- PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any effect by
  default because WM_WOL is not defined yet and
  m_kmrn_lock_loss_workaround_ich8lan() is broken.
- Fix wm_check_mng_mode_ich8lan(). This function is used only when WM_WOL is
  defined and it's disabled by default.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it returns
  bool. No functional change.
- Reorder function definitions and macro definitions. No functional change.
- Fix comment. Add comment. Update comment.
- KNF.

Revision 1.391 / (download) - annotate - [select for diffs], Tue Feb 9 08:32:11 2016 UTC (6 years, 11 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20160422, nick-nhusb-base-20160319
Changes since 1.390: +9 -5 lines
Diff to previous 1.390 (colored)

Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!

Revision 1.390 / (download) - annotate - [select for diffs], Fri Feb 5 13:06:24 2016 UTC (6 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.389: +8 -8 lines
Diff to previous 1.389 (colored)

s/max/ralmax/. No functional change.

Revision 1.389 / (download) - annotate - [select for diffs], Fri Jan 29 11:30:03 2016 UTC (7 years ago) by msaitoh
Branch: MAIN
Changes since 1.388: +3 -6 lines
Diff to previous 1.388 (colored)

Remove debug message.

Revision 1.388 / (download) - annotate - [select for diffs], Thu Jan 7 10:08:18 2016 UTC (7 years ago) by msaitoh
Branch: MAIN
Changes since 1.387: +155 -155 lines
Diff to previous 1.387 (colored)

- printf->DPRINTF in wm_serdes_mediastatus().
- KNF.

Revision 1.308.2.4 / (download) - annotate - [select for diffs], Sun Dec 27 12:09:50 2015 UTC (7 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.3: +2024 -1132 lines
Diff to previous 1.308.2.3 (colored) to branchpoint 1.308 (colored)

Sync with HEAD (as of 26th Dec)

Revision 1.387 / (download) - annotate - [select for diffs], Fri Dec 25 05:45:40 2015 UTC (7 years, 1 month ago) by msaitoh
Branch: MAIN
CVS Tags: nick-nhusb-base-20151226
Changes since 1.386: +7 -3 lines
Diff to previous 1.386 (colored)

 Modify comment for 82544 Errata 9 "Certain register cannot be written with
particular alignments in PCI-X bus operation".

Revision 1.386 / (download) - annotate - [select for diffs], Fri Dec 25 04:50:16 2015 UTC (7 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.385: +44 -22 lines
Diff to previous 1.385 (colored)

- Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
  determine the range of the RAL.
- Fix typo in comment and modify comment by tnn@.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it returns
  bool. No functional change.

Revision 1.385 / (download) - annotate - [select for diffs], Tue Dec 22 02:17:21 2015 UTC (7 years, 1 month ago) by knakahara
Branch: MAIN
Changes since 1.384: +3 -3 lines
Diff to previous 1.384 (colored)

fix potentially bug

Revision 1.384 / (download) - annotate - [select for diffs], Tue Dec 22 02:10:25 2015 UTC (7 years, 1 month ago) by knakahara
Branch: MAIN
Changes since 1.383: +4 -6 lines
Diff to previous 1.383 (colored)

fix incorrect KASSERT

Revision 1.383 / (download) - annotate - [select for diffs], Fri Dec 18 09:57:57 2015 UTC (7 years, 1 month ago) by knakahara
Branch: MAIN
Changes since 1.382: +13 -6 lines
Diff to previous 1.382 (colored)

set Tx/Rx interrupts affinity to other than CPU#0 as much as possible

Revision 1.382 / (download) - annotate - [select for diffs], Sun Dec 13 19:06:43 2015 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.381: +3 -3 lines
Diff to previous 1.381 (colored)

PR/50527: David Binderman: Fix impossible code. Odd offsets need special
treatment.

Revision 1.381 / (download) - annotate - [select for diffs], Fri Oct 30 19:22:01 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.380: +13 -7 lines
Diff to previous 1.380 (colored)

- On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed down.
- Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS sets
  this bit.
- Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the function
  checks the status correctly but it causes linkdown up to 10 times, so it's
  disabled for the time being.

Revision 1.380 / (download) - annotate - [select for diffs], Fri Oct 30 18:52:15 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.379: +19 -12 lines
Diff to previous 1.379 (colored)

- Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in wm_reset()
  on PCH2.
- Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix the
  behavior on suspend/resume.
- Fix logic of wm_check_reset_block() on ICH* and PCH*. This change might fix
  a problem that PHY's read/write functions can't get semaphore.
- Fix wm_check_mng_mode_ich8lan(). This function is used only when WM_WOL is
  defined and it's disabled by default.
- KNF.

Revision 1.379 / (download) - annotate - [select for diffs], Fri Oct 30 18:29:08 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.378: +4 -3 lines
Diff to previous 1.378 (colored)

 Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT.

Revision 1.378 / (download) - annotate - [select for diffs], Fri Oct 30 18:23:37 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.377: +10 -4 lines
Diff to previous 1.377 (colored)

 Call wm_get_hw_control() correctly. This change fixes a bug that some AMT
based systems doesn't linkup at 1000BaseT. The problem was observed on
HP Compaq dc7700.

 A lot of fixes have been done to wm(4) and igphy(4). Now PR#44893 should be
fixed.

Revision 1.377 / (download) - annotate - [select for diffs], Fri Oct 30 07:44:52 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.376: +38 -17 lines
Diff to previous 1.376 (colored)

 Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.

Revision 1.376 / (download) - annotate - [select for diffs], Fri Oct 30 07:35:30 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.375: +5 -9 lines
Diff to previous 1.375 (colored)

igphy(4),ukphy(4): Set mii_mpd_* entries.
wm(4): check PHY type correctly.

Revision 1.375 / (download) - annotate - [select for diffs], Thu Oct 29 07:24:01 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.374: +18 -8 lines
Diff to previous 1.374 (colored)

 Fix a bug that the multiqueue setting is done in a multiqueue capabile
chip but can't use MSI-X on a machine. In that case, only one queue must
be used. Written by knakahara@ and tested by me.

 This change should be fix a problem which was reported by Robert Swindells.

Revision 1.374 / (download) - annotate - [select for diffs], Thu Oct 22 09:51:21 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.373: +2 -57 lines
Diff to previous 1.373 (colored)

if_wm uses pci_intr_alloc stubs now.

Revision 1.373 / (download) - annotate - [select for diffs], Thu Oct 22 07:00:05 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.372: +5 -2 lines
Diff to previous 1.372 (colored)

add CTASSERT and KNF.

Revision 1.372 / (download) - annotate - [select for diffs], Thu Oct 22 06:01:41 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.371: +42 -4 lines
Diff to previous 1.371 (colored)

initial port rss_getkey() from freebsd, and use it instead of random().

Revision 1.371 / (download) - annotate - [select for diffs], Wed Oct 14 07:16:04 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.370: +208 -206 lines
Diff to previous 1.370 (colored)

- Update TODO:
  - "Multiqueue" -> "TX Multiqueue" because RX Multiqueue was added.
  - Sort entries.
- Grouping functions.

Revision 1.370 / (download) - annotate - [select for diffs], Tue Oct 13 21:28:41 2015 UTC (7 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.369: +4 -4 lines
Diff to previous 1.369 (colored)

sprinkle __diagused

Revision 1.369 / (download) - annotate - [select for diffs], Tue Oct 13 10:26:21 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.368: +3 -3 lines
Diff to previous 1.368 (colored)

wm_linkintr_msix() should use WM_DEBUG_LINK instead of WM_DEBUG_TX.

Revision 1.368 / (download) - annotate - [select for diffs], Tue Oct 13 10:21:21 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.367: +6 -4 lines
Diff to previous 1.367 (colored)

recover if_wm.c:r1.348

Revision 1.367 / (download) - annotate - [select for diffs], Tue Oct 13 09:10:01 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.366: +59 -58 lines
Diff to previous 1.366 (colored)

fix: XEN3_DOM0(not defined __HAVE_PCI_MSI_MSIX) build

Revision 1.366 / (download) - annotate - [select for diffs], Tue Oct 13 09:03:58 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.365: +16 -16 lines
Diff to previous 1.365 (colored)

fix: WM_DEBUG build

Revision 1.365 / (download) - annotate - [select for diffs], Tue Oct 13 08:36:02 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.364: +182 -6 lines
Diff to previous 1.364 (colored)

support RX multiqueue.

ok by msaitoh@n.o

Revision 1.364 / (download) - annotate - [select for diffs], Tue Oct 13 08:33:12 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.363: +420 -242 lines
Diff to previous 1.363 (colored)

ready to support RX multiqueue.

ok by msaitoh@n.o

Revision 1.363 / (download) - annotate - [select for diffs], Tue Oct 13 08:29:44 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.362: +23 -19 lines
Diff to previous 1.362 (colored)

refactor: rearrange interrupt handlers argument

Revision 1.362 / (download) - annotate - [select for diffs], Tue Oct 13 08:27:11 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.361: +121 -130 lines
Diff to previous 1.361 (colored)

refactor: rearrange function arguments without interrupt handlers

Revision 1.361 / (download) - annotate - [select for diffs], Tue Oct 13 08:23:31 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.360: +30 -30 lines
Diff to previous 1.360 (colored)

change const value register macros to macro expressions to support multiqueue.

Revision 1.360 / (download) - annotate - [select for diffs], Tue Oct 13 08:20:02 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.359: +137 -102 lines
Diff to previous 1.359 (colored)

refactor: separate interrupts setup processing from wm_attach

Revision 1.359 / (download) - annotate - [select for diffs], Tue Oct 13 08:17:15 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.358: +9 -9 lines
Diff to previous 1.358 (colored)

allocating queues should be finished before establishing interrupts.

Revision 1.358 / (download) - annotate - [select for diffs], Tue Oct 13 08:14:27 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.357: +17 -7 lines
Diff to previous 1.357 (colored)

refactor: separate discriptors initialization and registers initialization

Revision 1.357 / (download) - annotate - [select for diffs], Tue Oct 13 08:11:31 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.356: +122 -82 lines
Diff to previous 1.356 (colored)

separete TX, RX queue mutex from wm_softc and rearrange WM_BOTH_LOCK.

ok by msaitoh@n.o

Revision 1.356 / (download) - annotate - [select for diffs], Tue Oct 13 08:08:03 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.355: +389 -300 lines
Diff to previous 1.355 (colored)

refactor: separate TX, RX queue variables from wm_softc (without mutex)

Revision 1.355 / (download) - annotate - [select for diffs], Tue Oct 13 08:03:59 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.354: +222 -133 lines
Diff to previous 1.354 (colored)

refactor: separate busdma initialize processing as functions

Revision 1.354 / (download) - annotate - [select for diffs], Tue Oct 13 08:00:15 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.353: +156 -81 lines
Diff to previous 1.353 (colored)

separate TX dma control data and RX dma control data.

ok by msaitoh@n.o

Revision 1.353 / (download) - annotate - [select for diffs], Tue Oct 13 07:53:02 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.352: +224 -123 lines
Diff to previous 1.352 (colored)

refactor: separate busdma allocate processing as functions.

Revision 1.352 / (download) - annotate - [select for diffs], Tue Oct 13 07:47:45 2015 UTC (7 years, 3 months ago) by knakahara
Branch: MAIN
Changes since 1.351: +88 -78 lines
Diff to previous 1.351 (colored)

refactor: change some macros to functions

change below macros to functions
    - WM_CDTXSYNC
    - WM_CDRXSYNC
    - WM_INIT_RXDESC

Revision 1.351 / (download) - annotate - [select for diffs], Thu Oct 8 09:28:13 2015 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.350: +5 -9 lines
Diff to previous 1.350 (colored)

 Fix a bug that LSC's interrupt storm occured when MSI-X is used.
It was observed only on 82575.

Revision 1.350 / (download) - annotate - [select for diffs], Wed Sep 30 04:28:04 2015 UTC (7 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.349: +18 -3 lines
Diff to previous 1.349 (colored)

-  Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX packets"
  and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit. The NVM Image
  version 2.1.4 and newer have this workaround.
- Print the NVM image version on 82583, too.

 Pointed out by joerg@.

Revision 1.349 / (download) - annotate - [select for diffs], Mon Sep 28 07:02:57 2015 UTC (7 years, 4 months ago) by knakahara
Branch: MAIN
Changes since 1.348: +17 -5 lines
Diff to previous 1.348 (colored)

When the driver uses MSI-X, it tunes RX's EITR the same as TX's.

ok by msaitoh@n.o

Revision 1.348 / (download) - annotate - [select for diffs], Mon Sep 28 06:04:04 2015 UTC (7 years, 4 months ago) by knakahara
Branch: MAIN
Changes since 1.347: +6 -4 lines
Diff to previous 1.347 (colored)

use sc->sc_itr instead of hard-coded number.

ok by msaitoh@n.o

Revision 1.308.2.3 / (download) - annotate - [select for diffs], Tue Sep 22 12:05:59 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.2: +604 -81 lines
Diff to previous 1.308.2.2 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.347 / (download) - annotate - [select for diffs], Mon Sep 7 15:19:05 2015 UTC (7 years, 4 months ago) by msaitoh
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921
Changes since 1.346: +35 -10 lines
Diff to previous 1.346 (colored)

- Check iNVM's image version and print it.
- Update TODO.

Revision 1.346 / (download) - annotate - [select for diffs], Mon Aug 17 06:16:03 2015 UTC (7 years, 5 months ago) by knakahara
Branch: MAIN
Changes since 1.345: +16 -8 lines
Diff to previous 1.345 (colored)

Add kernel code to support intrctl(8).

Revision 1.345 / (download) - annotate - [select for diffs], Tue Jul 28 07:15:03 2015 UTC (7 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.344: +7 -5 lines
Diff to previous 1.344 (colored)

 Print interrupt type correctly.

Revision 1.344 / (download) - annotate - [select for diffs], Thu Jul 23 08:29:58 2015 UTC (7 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.343: +4 -6 lines
Diff to previous 1.343 (colored)

 Fix a bug that I21[01] NVM revision >= 3.25 can't be attached.
Reported by MATSUI Yoshihiro.

Revision 1.343 / (download) - annotate - [select for diffs], Thu Jul 23 08:24:07 2015 UTC (7 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.342: +3 -3 lines
Diff to previous 1.342 (colored)

 The WM_F_EEPROM_EERDEEWR is not required on iNVM device.

Revision 1.342 / (download) - annotate - [select for diffs], Wed Jul 22 11:14:13 2015 UTC (7 years, 6 months ago) by knakahara
Branch: MAIN
Changes since 1.341: +3 -3 lines
Diff to previous 1.341 (colored)

fix typo

Revision 1.341 / (download) - annotate - [select for diffs], Wed Jul 22 08:22:55 2015 UTC (7 years, 6 months ago) by knakahara
Branch: MAIN
Changes since 1.340: +3 -5 lines
Diff to previous 1.340 (colored)

Sorry, if_wm turns MSI/MSI-X default off by my mistake.

Revision 1.340 / (download) - annotate - [select for diffs], Tue Jul 21 03:15:50 2015 UTC (7 years, 6 months ago) by knakahara
Branch: MAIN
Changes since 1.339: +122 -172 lines
Diff to previous 1.339 (colored)

mofity for if_wm and if_bge to use pci_intr_alloc()

Revision 1.339 / (download) - annotate - [select for diffs], Wed Jul 15 07:40:54 2015 UTC (7 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.338: +3 -5 lines
Diff to previous 1.338 (colored)

 Cleanup.

Revision 1.338 / (download) - annotate - [select for diffs], Wed Jul 15 07:36:01 2015 UTC (7 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.337: +3 -3 lines
Diff to previous 1.337 (colored)

 Enable MSI/MSI-X feature by default.

Revision 1.337 / (download) - annotate - [select for diffs], Wed Jul 15 04:03:16 2015 UTC (7 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.336: +8 -3 lines
Diff to previous 1.336 (colored)

 Don't use MSI on 8257[12] because of errata 63
"Byte Enables 2 and 3 are not set on MSI writes".

Revision 1.336 / (download) - annotate - [select for diffs], Fri Jun 26 06:57:17 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.335: +8 -4 lines
Diff to previous 1.335 (colored)

Fix a bug that wm_detach() didn't unmap the FLASH's area.
Now "drvctl -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.

Revision 1.335 / (download) - annotate - [select for diffs], Sat Jun 13 15:47:58 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.334: +539 -32 lines
Diff to previous 1.334 (colored)

 Add MSI/MSI-X support written by Kengo Nakahara. Some old devices' support
is written by me. It's disabled by default. If you'd like to use, define
WM_MSI_MSIX.

Tested with:
	8254[3405617] (INTx even if it has MSI CAP because of a errata)
	8257[12], 82583 ICH8, ICH10, PCH2, PCH_LPT(I21[78]) (MSI)
	8257[456], 82580, I35[04], I21[01] (MSI-X)

Not tested:
	82542, 82573, 80003, ICH9, PCH,

Revision 1.334 / (download) - annotate - [select for diffs], Fri Jun 12 04:40:28 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.333: +32 -9 lines
Diff to previous 1.333 (colored)

- Print NVM version on 8257[124], too.
- Modify NVM version string a bit.

Revision 1.289.2.8 / (download) - annotate - [select for diffs], Wed Jun 10 16:43:51 2015 UTC (7 years, 7 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Changes since 1.289.2.7: +12 -11 lines
Diff to previous 1.289.2.7 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #833):
	sys/dev/pci/if_wm.c: revisions 1.322, 1.323
	sys/dev/pci/if_wmreg.h: revision 1.72
- Currently, WM_F_EEE bit is not set on all chips. It's intened to not
  to use all of EEE fuctions but wm_set_eee_i350() leaves IPCNFG_10BASE_TE
  bit and it causes link negotiation problem on some old switches. Disable
  10BASE-Te function, too.
- Call wm_set_eee_i350() on some chips, too.
--
Fix a bug that flags related to semaphore were incorrectly checked in
wm_kmrn_{readreg,writereg}. i80003, ICH* and PCH* had this problem.

Revision 1.333 / (download) - annotate - [select for diffs], Wed Jun 10 12:14:59 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.332: +2 -5 lines
Diff to previous 1.332 (colored)

 Remove extra if_start() in wm_ioctl().

Revision 1.332 / (download) - annotate - [select for diffs], Mon Jun 8 03:45:19 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.331: +12 -10 lines
Diff to previous 1.331 (colored)

 Call wm_pll_workaround_i210() at the end of the wm_reset() function, too.

Revision 1.331 / (download) - annotate - [select for diffs], Sat Jun 6 17:36:50 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.330: +11 -8 lines
Diff to previous 1.330 (colored)

 Fix the output of the option ROM version.

Revision 1.308.2.2 / (download) - annotate - [select for diffs], Sat Jun 6 14:40:09 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308.2.1: +1040 -302 lines
Diff to previous 1.308.2.1 (colored) to branchpoint 1.308 (colored)

Sync with HEAD

Revision 1.330 / (download) - annotate - [select for diffs], Sat Jun 6 07:44:22 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.329: +33 -30 lines
Diff to previous 1.329 (colored)

 Cleanup.

Revision 1.329 / (download) - annotate - [select for diffs], Sat Jun 6 04:39:12 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
CVS Tags: nick-nhusb-base-20150606
Changes since 1.328: +179 -8 lines
Diff to previous 1.328 (colored)

- Add workaround for I210 Errata 25 and I211 Errata 10.
   - Add wm_gmii_gs40g_{read|write}reg() and use it to access non-standatrd
     page.
   - Add wm_pll_workaround_i210() and call it when
       chip is i211
       chip is i210 and it use INVM
       chip is i210 and NVM image version < 3.25
- Add comment
- Rename macros.

Revision 1.328 / (download) - annotate - [select for diffs], Sat Jun 6 03:38:40 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.327: +85 -7 lines
Diff to previous 1.327 (colored)

 Print NVM image version.

Revision 1.327 / (download) - annotate - [select for diffs], Sat Jun 6 03:37:01 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.326: +25 -572 lines
Diff to previous 1.326 (colored)

 Revert previos. Sorry, I committed in another working directory...

Revision 1.326 / (download) - annotate - [select for diffs], Sat Jun 6 03:33:37 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.325: +572 -25 lines
Diff to previous 1.325 (colored)

 Print NVM image version.

Revision 1.325 / (download) - annotate - [select for diffs], Tue Jun 2 14:19:26 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.324: +431 -97 lines
Diff to previous 1.324 (colored)

Fix a lot of bugs to make 82575 and newer's SERDES based systems work.
 - Add SERDES specific functions.
 - Fix IO pin configuration.
 - Reset autonego timer when link becomes up.

TODO:
 - Fix a bug that SFP ROM can't read.
 - Perhaps some work is required for 8257[12] serdes systems.
 - Remove duplicated code in TBI's link related functions.

Revision 1.324 / (download) - annotate - [select for diffs], Tue Jun 2 13:26:36 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.323: +132 -132 lines
Diff to previous 1.323 (colored)

No functional change:
 - Reorder functions.
 - Rename wm_tbi_check_link() to wm_tbi_tick() because this function acts as
   mii_tick().

Revision 1.323 / (download) - annotate - [select for diffs], Tue Jun 2 03:49:10 2015 UTC (7 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.322: +10 -10 lines
Diff to previous 1.322 (colored)

 Fix a bug that flags related to semaphore were incorrectly checked in
wm_kmrn_{readreg,writereg}. i80003, ICH* and PCH* had this problem.

Revision 1.322 / (download) - annotate - [select for diffs], Fri May 22 03:15:43 2015 UTC (7 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.321: +4 -3 lines
Diff to previous 1.321 (colored)

- Currently, WM_F_EEE bit is not set on all chips. it's intended to not
  to use all of EEE fuctions but wm_set_eee_i350() leaves IPCNFG_10BASE_TE
  bit and it causes link negotiation problem on some old switches. Disable
  10BASE-Te function, too.
- Call wm_set_eee_i350() on some chips, too.

Revision 1.289.2.7 / (download) - annotate - [select for diffs], Tue May 19 05:09:02 2015 UTC (7 years, 8 months ago) by snj
Branch: netbsd-7
Changes since 1.289.2.6: +130 -8 lines
Diff to previous 1.289.2.6 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #784):
	sys/dev/pci/if_wm.c: revision 1.321
	sys/dev/pci/if_wmreg.h: revision 1.71
	sys/dev/pci/if_wmvar.h: 1.24 via patch
Add support iNVM (integrated Non-Volatile Memory) for I21[01].
This change fixes a bug that a MAC address is wrongly set on
iNVM machines/NICs.

Revision 1.321 / (download) - annotate - [select for diffs], Sat May 16 22:41:59 2015 UTC (7 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.320: +130 -8 lines
Diff to previous 1.320 (colored)

 Add support iNVM (integrated Non-Volatile Memory) for I21[01]. This change
fixes a bug that a MAC address is wrongly set on iNVM machines and NICs.
Tested with Shuttle DS57U(iNVM based) and other non iNVM based I210 machines.

Revision 1.320 / (download) - annotate - [select for diffs], Mon May 4 10:10:42 2015 UTC (7 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.319: +38 -15 lines
Diff to previous 1.319 (colored)

 For 82576 and newer devices, the PBA register is deleted. Don't write PBA
for those chips. Also change the calculation of RX packet buffer size in
new way.

Revision 1.319 / (download) - annotate - [select for diffs], Mon May 4 08:46:09 2015 UTC (7 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.318: +42 -24 lines
Diff to previous 1.318 (colored)

Modify (E)ITR, TIDV and TADV related code:
 - ITR regiser are not documented in 82575 and newer devices'
   manual. The documets say "E"ITR(0) has no alias (to old ITR).
   But in reality, the alias really exists. When EITR(0) is
   written, the old ITR is changed. Before this commit, ITR was
   written after EITR was written. It causes that EITR's value
   (450) was overwritten with old ITR(1500). Set sc_itr first
   and use the value and don't set ITR if a device >= 82575
   (which has MSI-X multi queue function).
 - Older than 82540 devices have no TADV register.
 - 82575 and newer devices have no TIDV and TADV registers.

Revision 1.318 / (download) - annotate - [select for diffs], Mon May 4 06:51:08 2015 UTC (7 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.317: +4 -3 lines
Diff to previous 1.317 (colored)

 Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is
more than 4096. Almost the Same as other OSes

Revision 1.317 / (download) - annotate - [select for diffs], Mon May 4 06:44:13 2015 UTC (7 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.316: +2 -4 lines
Diff to previous 1.316 (colored)

 Remove WMREG_TQSA_LO and WMREG_TQSA_HIGH. Those registers
are not described in documents and other OS's drivers don't
access it.
(I have no the first chip(82542)'s document. Those registers
might be described in the document).

Revision 1.162.4.21 / (download) - annotate - [select for diffs], Thu Apr 30 20:00:26 2015 UTC (7 years, 9 months ago) by snj
Branch: netbsd-5
Changes since 1.162.4.20: +788 -316 lines
Diff to previous 1.162.4.20 (colored) to branchpoint 1.162 (colored) next main 1.163 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1962):
	sys/dev/pci/if_wm.c: revisions 1.259-1.266, 1.269, 1.271, 1.273-1.274, 1.277-1.278, 1.282, 1.284-1.285, 1.287, 1.290, 1.294, 1.297-1.298, 1.300-1.301, 1.304-1.307, 1.310, 1.312-1.314, 1.316 via patch
	sys/dev/pci/if_wmreg.c: revisions 1.54-1.57, 1.59-1.60, 1.62, 1.64-1.66 via patch
	sys/dev/pci/if_wmvar.c: revisions 1.17, 1.20-1.21 via patch
	sys/dev/pci/pcidevs: revisions 1.1172, 1.1195, 1.1201 via patch
- Fix "MDIC write error" bug for 82574 and 82583. For those chips, the
  semaphore must be released after chip reset. Found and tested by
  Mark Davies.
- Fix BMC related bugs.
- Fix yet another NVM bank detect problem in wm(4). Use bank 0 if the detect
  function failed. It's the same as FreeBSD. Observed and tested with
  Asus P8P67 Deluxe motherboard and tested by jnemeth.
- Add support for I354 DH89xxCC and some new I218 devices.
- Fix definition of CTRL_GIO_M_DIS bit.
- Insert completion barrier between register write and delay().
- Bump max TX DMA size to avoid pathological condition with TSO. From dyoung.
- Fix semaphore related bugs.
- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
  Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.
-  Fix fiber link problem (PR#44776 and PR#30880).
- WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD.
- Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and check
  the flag in wm_detach(). It will avoid to panic in wm_detach().
  Fixes PR#49102.
- It's not required to print "failed to detect NVM bank" with
  aprint_error_dev(). Use DPRINTF(). Same as {Free,Open}BSD.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
  when alt MAC address function is really used. This bug does not appear
  as real bug if the same MAC address is written in the default location
  and alt MAC address's location.
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
  Some of them are workaround code. From other *BSDs, Linux and documents.
- Fix a bug that wm_sgmii_writereg() function doesn't pass the "val" argument
  to the I2CCMD register. Reported by Bernard Merindol in PR#49789.
- Delete 82580ER related code. It was from FreeBSD and was removed
  in r203049.
- Remove extra debug message.
- Remove unused variable.
- Remove a duplicated error message.
- Cleanup comments.
- Fix debug message.

Revision 1.227.2.18 / (download) - annotate - [select for diffs], Thu Apr 30 19:53:28 2015 UTC (7 years, 9 months ago) by snj
Branch: netbsd-6
Changes since 1.227.2.17: +32 -16 lines
Diff to previous 1.227.2.17 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1296):
	sys/dev/pci/pcidevs: revision 1.1195 via patch
	sys/dev/pci/if_wm.c: revisions 1.290, 1.304 via patch
	sys/dev/pci/if_wmvar.h: revision 1.20 via patch
- Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and
  check the flag in wm_detach(). It will avoid to panic in wm_detach().
  Fixes PR#49102.
- Support DH89xxCC device.
- Add extra delay for 82580 and newer devices except DH89XXCC SGMII device.
  Same as FreeBSD.

Revision 1.162.4.20 / (download) - annotate - [select for diffs], Sun Apr 26 09:03:12 2015 UTC (7 years, 9 months ago) by martin
Branch: netbsd-5
Changes since 1.162.4.19: +3 -3 lines
Diff to previous 1.162.4.19 (colored) to branchpoint 1.162 (colored)

Apply patch, requested by msaitoh in ticket #1961:

	sys/dev/pci/if_wm.c:	(patch)

 Fix a bug (in the backport for #1850) that passed the wrong pointer as the
first argument of bpf_mtap() on 82575 and newer chip.

Revision 1.227.2.17 / (download) - annotate - [select for diffs], Sun Apr 19 17:01:50 2015 UTC (7 years, 9 months ago) by riz
Branch: netbsd-6
Changes since 1.227.2.16: +15 -21 lines
Diff to previous 1.227.2.16 (colored) to branchpoint 1.227 (colored)

Apply patch (requested by msaitoh in ticket #1292):
sys/dev/pci/if_wm.c				1.313-1.314 and 1.316 via patch

	Fix a bug that the first access to NVM is failed on 8254[17] which use
	SPI EEPROM. Observed on Dell PowerEdge [12]850.
	Thanks Tom Ivar Helbekkmo for debugging.

	Fix a bug that wm_sgmii_writereg() function doesn't pass the "val"
	argument to the I2CCMD register. Reported by Bernard Merindol
	in PR#49789.

	Fix a bug that newer revision of I218-{LM,V} use wrong PHY access
	functions. The problem only occured on devices that the PCI device ID
	was 0x15a[0123].
	[msaitoh, ticket #1292]

Revision 1.289.2.6 / (download) - annotate - [select for diffs], Sun Apr 19 06:50:22 2015 UTC (7 years, 9 months ago) by riz
Branch: netbsd-7
Changes since 1.289.2.5: +10 -18 lines
Diff to previous 1.289.2.5 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #698):
	sys/dev/pci/if_wm.c: revision 1.316
  Fix a bug that newer revision of I218-{LM,V} use wrong PHY access functions.
The problem only occured on devices that the PCI device ID was 0x15a[0123].

Revision 1.316 / (download) - annotate - [select for diffs], Fri Apr 17 02:54:15 2015 UTC (7 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.315: +10 -18 lines
Diff to previous 1.315 (colored)

 Fix a bug that newer revision of I218-{LM,V} use wrong PHY access functions.
The problem only occured on devices that the PCI device ID was 0x15a[0123].

Revision 1.227.2.16 / (download) - annotate - [select for diffs], Thu Apr 16 06:20:08 2015 UTC (7 years, 9 months ago) by snj
Branch: netbsd-6
Changes since 1.227.2.15: +204 -11 lines
Diff to previous 1.227.2.15 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1277):
	sys/dev/pci/if_wm.c: revision 1.312 via patch
	sys/dev/pci/if_wmreg.h: revision 1.66 via patch
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
  Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.

Revision 1.289.2.5 / (download) - annotate - [select for diffs], Thu Apr 16 06:10:43 2015 UTC (7 years, 9 months ago) by snj
Branch: netbsd-7
Changes since 1.289.2.4: +6 -4 lines
Diff to previous 1.289.2.4 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #694):
	sys/dev/pci/if_wm.c: revision 1.314
Fix a bug that wm_sgmii_writereg() function doesn't pass the "val" argument
to the I2CCMD register. Reported by Bernard Merindol in PR#49789.

Revision 1.315 / (download) - annotate - [select for diffs], Mon Apr 13 16:33:25 2015 UTC (7 years, 9 months ago) by riastradh
Branch: MAIN
Changes since 1.314: +3 -3 lines
Diff to previous 1.314 (colored)

Convert sys/dev to use <sys/rndsource.h>.

Revision 1.308.2.1 / (download) - annotate - [select for diffs], Mon Apr 6 15:18:10 2015 UTC (7 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.308: +246 -43 lines
Diff to previous 1.308 (colored)

Sync with HEAD

Revision 1.314 / (download) - annotate - [select for diffs], Sat Mar 28 17:35:59 2015 UTC (7 years, 10 months ago) by msaitoh
Branch: MAIN
CVS Tags: nick-nhusb-base-20150406
Changes since 1.313: +6 -4 lines
Diff to previous 1.313 (colored)

 Fix a bug that wm_sgmii_writereg() function doesn't pass the "val" argument
to the I2CCMD register. Reported by Bernard Merindol in PR#49789.

Revision 1.289.2.4 / (download) - annotate - [select for diffs], Wed Mar 18 04:39:15 2015 UTC (7 years, 10 months ago) by snj
Branch: netbsd-7
Changes since 1.289.2.3: +237 -40 lines
Diff to previous 1.289.2.3 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #614):
	sys/dev/pci/if_wm.c: revision 1.311-1.313
	sys/dev/pci/if_wmreg.h: revision 1.66
Fix a bug that sc_mediatype is evaluated incorrectly. The real problem
might be occured only on fiber and serdes cases.
#####
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
  Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.
#####
 Fix a bug that the first access to NVM is failed on 8254[17] which use
SPI EEPROM. Observed on Dell PowerEdge [12]850. Thanks Tom Ivar Helbekkmo
for debugging.

Revision 1.313 / (download) - annotate - [select for diffs], Mon Feb 16 00:25:52 2015 UTC (7 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.312: +3 -3 lines
Diff to previous 1.312 (colored)

 Fix a bug that the first access to NVM is failed on 8254[17] which use
SPI EEPROM. Observed on Dell PowerEdge [12]850. Thanks Tom Ivar Helbekkmo
for debugging.

Revision 1.312 / (download) - annotate - [select for diffs], Sun Feb 15 21:32:33 2015 UTC (7 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.311: +202 -9 lines
Diff to previous 1.311 (colored)

- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
  Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.

Revision 1.311 / (download) - annotate - [select for diffs], Fri Feb 13 09:00:50 2015 UTC (7 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.310: +34 -30 lines
Diff to previous 1.310 (colored)

 Fix a bug that sc_mediatype is evaluated incorrectly. The real problem
might be occured only on fiber and serdes cases.

Revision 1.227.2.15 / (download) - annotate - [select for diffs], Wed Feb 4 10:55:00 2015 UTC (7 years, 11 months ago) by martin
Branch: netbsd-6
Changes since 1.227.2.14: +3 -3 lines
Diff to previous 1.227.2.14 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1244):
	sys/dev/pci/if_wm.c: revision 1.310
  Fix a bug that a workaround for SWSM.SMBI bit doesn't work correctly.
This problem was only occured with old boot ROM on 8257[12].
XXX pullup to netbsd-[67]

Revision 1.289.2.3 / (download) - annotate - [select for diffs], Wed Feb 4 06:48:13 2015 UTC (7 years, 11 months ago) by snj
Branch: netbsd-7
Changes since 1.289.2.2: +3 -3 lines
Diff to previous 1.289.2.2 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #490):
	sys/dev/pci/if_wm.c: revision 1.310
  Fix a bug that a workaround for SWSM.SMBI bit doesn't work correctly.
This problem was only occured with old boot ROM on 8257[12].

Revision 1.310 / (download) - annotate - [select for diffs], Thu Jan 29 02:59:17 2015 UTC (8 years ago) by msaitoh
Branch: MAIN
Changes since 1.309: +3 -3 lines
Diff to previous 1.309 (colored)

 Fix a bug that a workaround for SWSM.SMBI bit doesn't work correctly.
This problem was only occured with old boot ROM on 8257[12].

XXX pullup to netbsd-[67]

Revision 1.309 / (download) - annotate - [select for diffs], Fri Jan 16 10:36:14 2015 UTC (8 years ago) by ozaki-r
Branch: MAIN
Changes since 1.308: +6 -2 lines
Diff to previous 1.308 (colored)

Introduce defflag for NET_MPSAFE

Revision 1.227.2.14 / (download) - annotate - [select for diffs], Thu Dec 4 06:04:07 2014 UTC (8 years, 1 month ago) by snj
Branch: netbsd-6
Changes since 1.227.2.13: +510 -366 lines
Diff to previous 1.227.2.13 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1203):
	sys/dev/pci/if_wm.c: revisions 1.271, 1.273-1.274, 1.277-1.278,
				       1.280, 1.282, 1.284-1.285, 1.287,
				       1.293-1.294, 1.297-1.298,
				       1.300-1.301, 1.305-1.307 via patch
	sys/dev/pci/if_wmreg.h: revisions 1.57-1.62, 1.64-1.65 via patch
	sys/dev/pci/if_wmvar.h: revisions 1.19, 1.21 via patch
- Acquire SW semaphore in wm_get_swsm_semaphore().
- Fix some bugs realted to semaphore. This change fixes a problem which
  was exposed in if_wm.c rev. 1.271. Tested by riastradh@.
  - Clear the SMBI bit in SWSM register before accessing NVM and PHY in
    wm_attach(). Same as FreeBSD.
  - Fix a bug that 82573 doesn't put the hardware semaphore. Same as
    FreeBSD r256200.
- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
  Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.
- Fix fiber link problem (PR#44776 and PR#30880). Tested with 82543GC, 82544EI,
  82545EM, 82546GB 82571EB and 82572EI fiber cards.
  - Don't use the RXCFG interrupt. It's not required and the interrupt is very
    heavy (a lot of interrupts). Same as {Free,Open}BSD.
  - Modify wm_tbi_mediachange() to be close to em_setup_fiber_serdes_link()
    of {Free,Open}BSD. At least, don't forget to set duplex setting.
  - WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD.
- Don't check SWSM_SMBI bit if WM_F_LOCK_SWSM isn't set. Fix a problem when
  using vmware with e1000"e". With e1000e which is regarded as 82574L,
  wm_gmii_init() fails with "could not acquire SWSM SMBI" message without
  this change. This problem doesn't occur with real 82574L card.
- Fix a bug that wm_get_swsm_semaphore() timed out when attaching device on
  some machines.
  - Calculate NVM word size correctly.
  - Determine timeout value based on the NVM word size.
- It's not required to print "failed to detect NVM bank" message.
  Only print while debugging. Same as {Free,Open}BSD.
- Add some new I218 devices.
- Delete 82580ER related code. It was from FreeBSD and was removed in r203049.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
  when alt MAC address function is really used. This bug does not appear
  as real bug if the same MAC address is written in the default location
  and alt MAC address's location.
- Move some NVM related macros from if_wm.c to if_wmreg.h.
- Sort definitions in if_wmreg.h
  - move NVM related values to the bottom.
  - sort in register's address' order.
- Simplify wm_read_mac_addr().
- Fix debug message.
- Add missing prototypes.
- Rename some functions for consistency and clarify.
- Rename some macros for consistency.
- Remove a duplicated error message.
- Fix typo in comment.
- Cleanup comments.
- KNF.

Revision 1.308 / (download) - annotate - [select for diffs], Sun Nov 16 09:47:35 2014 UTC (8 years, 2 months ago) by msaitoh
Branch: MAIN
CVS Tags: nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.307: +12 -3 lines
Diff to previous 1.307 (colored)

Add C2000 KX and 2.5G.

Revision 1.227.2.13 / (download) - annotate - [select for diffs], Sun Nov 9 12:13:15 2014 UTC (8 years, 2 months ago) by martin
Branch: netbsd-6
Changes since 1.227.2.12: +4 -2 lines
Diff to previous 1.227.2.12 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1189):
	sys/dev/pci/if_wm.c: revision 1.270
	sys/dev/mii/inphy.c: revision 1.53
	sys/dev/mii/glxtphy.c: revision 1.24
	sys/dev/mii/tlphy.c: revision 1.62
	sys/dev/mii/iophy.c: revision 1.37
	sys/dev/mii/brgphy.c: revision 1.70
	sys/dev/mii/ihphy.c: revision 1.8
	sys/dev/mii/bmtphy.c: revision 1.31
	sys/dev/mii/urlphy.c: revision 1.30
	sys/dev/mii/makphy.c: revision 1.40
	sys/dev/mii/qsphy.c: revision 1.48
	sys/dev/mii/igphy.c: revision 1.23
	sys/dev/mii/nsphy.c: revision 1.58
	sys/dev/mii/mvphy.c: revision 1.10
	sys/dev/pci/if_txp.c: revision 1.41
	sys/dev/mii/nsphy.c: revision 1.59
	sys/dev/mii/rlphy.c: revision 1.28
	sys/dev/mii/icsphy.c: revision 1.49
	sys/dev/mii/rlphy.c: revision 1.29
	sys/dev/mii/lxtphy.c: revision 1.49
	sys/dev/mii/ciphyreg.h: revision 1.5
	sys/dev/mii/nsphyter.c: revision 1.38
	sys/dev/mii/sqphy.c: revision 1.50
	sys/dev/mii/gentbi.c: revision 1.26
	sys/dev/mii/gentbi.c: revision 1.27
	sys/dev/mii/tqphy.c: revision 1.39
	sys/dev/mii/ikphy.c: revision 1.10
	sys/dev/mii/dmphy.c: revision 1.35
	sys/dev/mii/amhphy.c: revision 1.20
	sys/dev/mii/acphy.c: revision 1.24
	sys/dev/mii/ciphy.c: revision 1.25
	sys/dev/mii/brgphyreg.h: revision 1.8
	sys/dev/mii/ukphy_subr.c: revision 1.12
	sys/dev/ic/rtl80x9.c: revision 1.16
	sys/arch/mips/adm5120/dev/if_admsw.c: revision 1.12
	sys/dev/pci/if_kse.c: revision 1.28
	sys/dev/mii/ukphy_subr.c: revision 1.13
	sys/dev/mii/mii.h: revision 1.18
	sys/dev/mii/gphyter.c: revision 1.29
No functional change:
- Fix typo.
- Remove trailing white spaces.
- Capitalize comments.
- Tabify.
- KNF.
 IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not full
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set,
but not for others. Same as {Free|Open}BSD.

Revision 1.227.2.12 / (download) - annotate - [select for diffs], Sun Nov 9 12:03:18 2014 UTC (8 years, 2 months ago) by martin
Branch: netbsd-6
Changes since 1.227.2.11: +206 -44 lines
Diff to previous 1.227.2.11 (colored) to branchpoint 1.227 (colored)

Pullup the following revisions, requested by msaitoh in ticket #1188:
sys/dev/pci/pcidevs			1.1172
sys/dev/pci/if_wm.c			1.263-1.266 via patch
sys/dev/pci/if_wmreg.h			1.55-1.56
sys/dev/pci/if_wmvar.h			1.17
share/man/man4/wm.4			1.26-1.27 and 1.29 via patch

- Add I354 support.
- Insert completion barrier between register write and delay().
- Fix the definition of CTRL_GIO_M_DIS. This bit is not bit 3 but bit 2.
- Cleanup

Revision 1.289.2.2 / (download) - annotate - [select for diffs], Fri Nov 7 21:34:56 2014 UTC (8 years, 2 months ago) by snj
Branch: netbsd-7
Changes since 1.289.2.1: +538 -325 lines
Diff to previous 1.289.2.1 (colored) to branchpoint 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #190):
	sys/dev/pci/pcidevs			1.1201-1.1202 via patch
	sys/dev/pci/if_wm.c			1.291-1.301, 1.304, 1.306-1.307 via patch
	sys/dev/pci/if_wmreg.h			1.61-1.65 via patch
	sys/dev/pci/if_wmvar.h			1.21 via patch
	share/man/man4/wm.4			1.31 via patch
- Add Internal SERDES mode support newer than or equal to 82575.
- Add new I218 devices.
- Add DH89xxCC device.
- Add some old devices.
- Fix a bug that wm_get_swsm_semaphore() timed out when attaching device on
  some machines.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
  when alt MAC address function is really used. This bug does not appear
  as real bug if the same MAC address is written in the default location
  and alt MAC address's location.
- Don't print "failed to detect NVM bank" message.
- Delete 82580ER related code.
- Fix typo in comment.
- Fix debug message.
- Cleanup

Revision 1.307 / (download) - annotate - [select for diffs], Fri Oct 24 17:58:09 2014 UTC (8 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.306: +4 -20 lines
Diff to previous 1.306 (colored)

Simplify. No functional change.

Revision 1.306 / (download) - annotate - [select for diffs], Fri Oct 24 17:50:50 2014 UTC (8 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.305: +19 -40 lines
Diff to previous 1.305 (colored)

 Fix a bug that the offset of alt MAC address is wrongly calculated to 0
when alt MAC address function is really used. This bug does not appear
as real bug if the same MAC address is written in the default location
and alt MAC address's location.

Revision 1.305 / (download) - annotate - [select for diffs], Fri Oct 17 17:48:53 2014 UTC (8 years, 3 months ago) by snj
Branch: MAIN
Changes since 1.304: +3 -3 lines
Diff to previous 1.304 (colored)

There's an r in "determine"

Revision 1.304 / (download) - annotate - [select for diffs], Fri Oct 10 11:04:21 2014 UTC (8 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.303: +31 -7 lines
Diff to previous 1.303 (colored)

- Support DH89XXCC devices.
- Add extra delay for 82580 and newer devices except DH89XXCC SGMII device.
  Same as FreeBSD.

Revision 1.303 / (download) - annotate - [select for diffs], Tue Oct 7 08:45:02 2014 UTC (8 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.302: +8 -12 lines
Diff to previous 1.302 (colored)

Tidy up locking in wm_ioctl

Revision 1.302 / (download) - annotate - [select for diffs], Tue Oct 7 07:04:35 2014 UTC (8 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.301: +10 -2 lines
Diff to previous 1.301 (colored)

Don't call ifmedia_ioctl with holding locks

Revision 1.301 / (download) - annotate - [select for diffs], Mon Oct 6 07:52:50 2014 UTC (8 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.300: +4 -4 lines
Diff to previous 1.300 (colored)

Fix debug message.

Revision 1.300 / (download) - annotate - [select for diffs], Mon Oct 6 07:31:24 2014 UTC (8 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.299: +10 -33 lines
Diff to previous 1.299 (colored)

 Delete 82580ER related code. It was from FreeBSD and was removed in r203049.

Revision 1.299 / (download) - annotate - [select for diffs], Mon Oct 6 07:09:30 2014 UTC (8 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.298: +46 -6 lines
Diff to previous 1.298 (colored)

 Add some devices. Not tested because I have no any of these devices/cards.

Revision 1.298 / (download) - annotate - [select for diffs], Tue Sep 16 07:06:42 2014 UTC (8 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.297: +14 -2 lines
Diff to previous 1.297 (colored)

Add some new I218 devices.

Revision 1.297 / (download) - annotate - [select for diffs], Thu Sep 11 17:09:04 2014 UTC (8 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.296: +4 -4 lines
Diff to previous 1.296 (colored)

 It's not required to print "failed to detect NVM bank" with
aprint_error_dev(). Use DPRINTF(). Same as {Free,Open}BSD.

Revision 1.296 / (download) - annotate - [select for diffs], Thu Sep 4 02:34:32 2014 UTC (8 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.295: +2 -3 lines
Diff to previous 1.295 (colored)

Remove one obsolete TODO entry.

Revision 1.295 / (download) - annotate - [select for diffs], Wed Sep 3 14:30:04 2014 UTC (8 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.294: +88 -7 lines
Diff to previous 1.294 (colored)

Read SFF SFP ROM and configure driver from the value.

Revision 1.294 / (download) - annotate - [select for diffs], Mon Sep 1 16:42:27 2014 UTC (8 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.293: +114 -39 lines
Diff to previous 1.293 (colored)

 Fix a bug that wm_get_swsm_semaphore() timed out when attaching device on some
machines.
- Calculate NVM word size correctly.
- Determine timeout value based on the NVM word size.

Revision 1.293 / (download) - annotate - [select for diffs], Fri Aug 29 12:14:29 2014 UTC (8 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.292: +44 -51 lines
Diff to previous 1.292 (colored)

No binary change:
- Move some NVM related macros from if_wm.c to if_wmreg.h.
- Rename some macros for consistency.

Revision 1.289.2.1 / (download) - annotate - [select for diffs], Fri Aug 29 11:37:51 2014 UTC (8 years, 5 months ago) by martin
Branch: netbsd-7
Changes since 1.289: +13 -7 lines
Diff to previous 1.289 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #61):
	sys/dev/pci/if_wm.c: revision 1.290
	sys/dev/pci/if_wmvar.h: revision 1.20
Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and check
the flag in wm_detach(). It will avoid to panic in wm_detach().
Fixes PR#49102.

Revision 1.292 / (download) - annotate - [select for diffs], Thu Aug 28 16:22:59 2014 UTC (8 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.291: +90 -41 lines
Diff to previous 1.291 (colored)

 Add Internal SERDES mode support newer than or equal to 82575.
Currently, it supports fiber device only. If you use 1000BaseT SFP module,
it won't work. We have to write code to read SFP ROM and set SGMII mode
if the module is copper.

Revision 1.291 / (download) - annotate - [select for diffs], Tue Aug 26 14:44:00 2014 UTC (8 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.290: +114 -114 lines
Diff to previous 1.290 (colored)

Modify WMP_F_1000{X,T} to WMP_F_{FIBER,COPPER}. No binary change.

Revision 1.290 / (download) - annotate - [select for diffs], Sun Aug 24 21:15:35 2014 UTC (8 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.289: +13 -7 lines
Diff to previous 1.289 (colored)

 Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and check
the flag in wm_detach(). It will avoid to panic in wm_detach().
Fixes PR#49102.

Revision 1.234.2.4 / (download) - annotate - [select for diffs], Wed Aug 20 00:03:42 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-maxphys
Changes since 1.234.2.3: +4758 -4194 lines
Diff to previous 1.234.2.3 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.289 / (download) - annotate - [select for diffs], Sun Aug 10 16:44:36 2014 UTC (8 years, 5 months ago) by tls
Branch: MAIN
CVS Tags: tls-maxphys-base, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.288: +4 -3 lines
Diff to previous 1.288 (colored)

Merge tls-earlyentropy branch into HEAD.

Revision 1.268.2.2 / (download) - annotate - [select for diffs], Sun Aug 10 06:54:54 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.268.2.1: +4068 -3715 lines
Diff to previous 1.268.2.1 (colored) to branchpoint 1.268 (colored) next main 1.269 (colored)

Rebase.

Revision 1.288 / (download) - annotate - [select for diffs], Thu Aug 7 06:49:06 2014 UTC (8 years, 5 months ago) by msaitoh
Branch: MAIN
CVS Tags: tls-earlyentropy-base
Changes since 1.287: +3 -2 lines
Diff to previous 1.287 (colored)

Add one more TODO:
 - We should check XXX'ed comments.

Revision 1.287 / (download) - annotate - [select for diffs], Wed Aug 6 02:55:50 2014 UTC (8 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.286: +17 -14 lines
Diff to previous 1.286 (colored)

 Don't check SWSM_SMBI bit if WM_F_LOCK_SWSM isn't set. Fix a problem when
using vmware with e1000"e". With e1000e which is regarded as 82574L,
wm_gmii_init() fails with "could not acquire SWSM SMBI" message without
this change. This problem doesn't occur with real 82574L card.

TODO:
 - Change the function name. It's difficult to understand. The name was
  from old Intel original e1000 driver.
 - Read Intel original driver again and check ALL location where semaphore is
  used.

Revision 1.286 / (download) - annotate - [select for diffs], Tue Aug 5 18:13:46 2014 UTC (8 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.285: +7 -2 lines
Diff to previous 1.285 (colored)

Add some TODOs in comment.

Revision 1.285 / (download) - annotate - [select for diffs], Thu Jul 31 03:50:09 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.284: +37 -62 lines
Diff to previous 1.284 (colored)

 Fix fiber link problem (PR#44776 and PR#30880). Tested with 82543GC, 82544EI,
82545EM, 82546GB 82571EB and 82572EI fiber cards.
- Don't use the RXCFG interrupt. It's not required and the interrupt is very
  heavy (a lot of interrupts). Same as {Free,Open}BSD.
- Modify wm_tbi_mediachange() to be close to em_setup_fiber_serdes_link()
  of {Free,Open}BSD. At least, don't forget to set duplex setting.
- WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD. Tested with
  my own 82545EM card.

Revision 1.284 / (download) - annotate - [select for diffs], Thu Jul 31 02:54:46 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.283: +9 -4 lines
Diff to previous 1.283 (colored)

 Fix a bug that I added in rev. 1.273. Some old card stopped at the attach
function with ""Please update the Bootagent" message. The code to clear the
SWSM_SMBI bit is only for 8257[1234] and 82583.

Revision 1.283 / (download) - annotate - [select for diffs], Mon Jul 28 06:36:09 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.282: +65 -52 lines
Diff to previous 1.282 (colored)

Use two different mutexes for tx and rx

This change splits the mutex of wm into two: one for tx and the other
for rx. By doing so, lock contentions can be reduced. We lock both for
other operations that need locking, e.g., init, stop and ioctl.

The modification doesn't change the behavior of the driver.

Revision 1.282 / (download) - annotate - [select for diffs], Fri Jul 25 18:28:03 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.281: +15 -3 lines
Diff to previous 1.281 (colored)

- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
  Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.

Revision 1.281 / (download) - annotate - [select for diffs], Wed Jul 23 10:48:16 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.280: +5401 -5402 lines
Diff to previous 1.280 (colored)

No functional change:
- Grouping functions.
- KNF.

Revision 1.280 / (download) - annotate - [select for diffs], Wed Jul 23 09:44:52 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.279: +233 -149 lines
Diff to previous 1.279 (colored)

No functional change:
- Add missing prototypes.
- Rename functions for consistency and clarify.
- KNF.

Revision 1.279 / (download) - annotate - [select for diffs], Tue Jul 22 04:20:39 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.278: +37 -22 lines
Diff to previous 1.278 (colored)

 Add SERDES support from Matthias Drochner. Not all devices were tested but all
SERDES entries are enabled.

Revision 1.278 / (download) - annotate - [select for diffs], Mon Jul 14 05:00:18 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.277: +3 -3 lines
Diff to previous 1.277 (colored)

Cleanup comments. No functional change.

Revision 1.277 / (download) - annotate - [select for diffs], Mon Jul 14 01:24:58 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.276: +2 -4 lines
Diff to previous 1.276 (colored)

Remove a duplicated error message

Revision 1.276 / (download) - annotate - [select for diffs], Fri Jul 11 08:50:08 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.275: +10 -10 lines
Diff to previous 1.275 (colored)

Fix compile error.

Revision 1.275 / (download) - annotate - [select for diffs], Fri Jul 11 08:34:27 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.274: +34 -35 lines
Diff to previous 1.274 (colored)

Rename some WM_F_* flags to clarify. Renumbering flags. No functional change.

 WM_F_EEPROM_HANDSHAKE -> WM_F_LOCK_EECD
 WM_F_EEPROM_SEMAPHORE -> WM_F_LOCK_SWSM
 WM_F_SWFW_SYNC        -> WM_F_LOCK_SWFW
 WM_F_SWFWHW_SYNC      -> WM_F_LOCK_EXTCNF

Revision 1.274 / (download) - annotate - [select for diffs], Fri Jul 11 07:22:45 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.273: +4 -3 lines
Diff to previous 1.273 (colored)

 Restore the WM_F_EEPROM_SEMAPHORE flags for 82575-I354 and 80003 cases.
The flag was removed in last commit.

Revision 1.273 / (download) - annotate - [select for diffs], Fri Jul 11 02:23:44 2014 UTC (8 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.272: +34 -5 lines
Diff to previous 1.272 (colored)

Fix some bugs realted to semaphore. This change fixes a problem which
was exposed in if_wm.c rev. 1.271. Tested by riastradh@.
- Clear the SMBI bit in SWSM register before accessing NVM and PHY in
  wm_attach(). Same as FreeBSD.
- Fix a bug that 82573 doesn't put the hardware semaphore. Same as
  FreeBSD r256200.

Revision 1.272 / (download) - annotate - [select for diffs], Tue Jul 1 10:35:18 2014 UTC (8 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.271: +233 -38 lines
Diff to previous 1.271 (colored)

Make if_wm MPSAFE

- Make it MPSAFE only when NET_MPSAFE
  - otherwise, its instructions are almost same as before
  - the only change is IFQ_POLL/IFQ_DEQUEUE which
    is now single IFQ_DEQUEUE
- Protect driver operations with a lock
  - further work would make it separate
- Apply MPSAFE flag to
  - callout_init
  - pci_intr_establish
- Stop proceeding packets when the driver is likely
  to stop for graceful ifconfig down

Tested on Rangeley (I354) and KVM (e1000)
Reviewed by msaitoh@

Revision 1.271 / (download) - annotate - [select for diffs], Mon Jun 30 06:09:44 2014 UTC (8 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.270: +21 -4 lines
Diff to previous 1.270 (colored)

Acquire SW semaphore in wm_get_swsm_semaphore

It is required to serialize device drivers running on different CPUs.
The basic instructions are same as the official Intel driver.

ok msaitoh@

Revision 1.270 / (download) - annotate - [select for diffs], Mon Jun 16 16:48:16 2014 UTC (8 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.269: +4 -2 lines
Diff to previous 1.269 (colored)

 IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not full
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set,
but not for others. Same as {Free|Open}BSD.

Revision 1.227.2.3.2.1 / (download) - annotate - [select for diffs], Tue Jun 3 15:06:09 2014 UTC (8 years, 7 months ago) by msaitoh
Branch: netbsd-6-0
CVS Tags: netbsd-6-0-6-RELEASE
Changes since 1.227.2.3: +3 -3 lines
Diff to previous 1.227.2.3 (colored) next main 1.227.2.4 (colored)

Pull up following revision(s) (requested by tls in ticket #1070):
	sys/dev/pci/if_wm.c: revision 1.269
From dyoung@ -- bump max TX DMA size to avoid pathological condition with TSO.

Revision 1.227.2.8.2.1 / (download) - annotate - [select for diffs], Tue Jun 3 15:02:37 2014 UTC (8 years, 7 months ago) by msaitoh
Branch: netbsd-6-1
CVS Tags: netbsd-6-1-5-RELEASE
Changes since 1.227.2.8: +3 -3 lines
Diff to previous 1.227.2.8 (colored) next main 1.227.2.9 (colored)

Pull up following revision(s) (requested by tls in ticket #1070):
	sys/dev/pci/if_wm.c: revision 1.269
From dyoung@ -- bump max TX DMA size to avoid pathological condition with TSO.

Revision 1.227.2.11 / (download) - annotate - [select for diffs], Tue Jun 3 14:57:09 2014 UTC (8 years, 7 months ago) by msaitoh
Branch: netbsd-6
Changes since 1.227.2.10: +3 -3 lines
Diff to previous 1.227.2.10 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by tls in ticket #1070):
	sys/dev/pci/if_wm.c: revision 1.269
From dyoung@ -- bump max TX DMA size to avoid pathological condition with TSO.

Revision 1.269 / (download) - annotate - [select for diffs], Tue May 27 02:21:29 2014 UTC (8 years, 8 months ago) by tls
Branch: MAIN
Changes since 1.268: +3 -3 lines
Diff to previous 1.268 (colored)

From dyoung@ -- bump max TX DMA size to avoid pathological condition with TSO.

Revision 1.223.2.4 / (download) - annotate - [select for diffs], Thu May 22 11:40:25 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.223.2.3: +711 -217 lines
Diff to previous 1.223.2.3 (colored) to branchpoint 1.223 (colored) next main 1.224 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.261.2.2 / (download) - annotate - [select for diffs], Sun May 18 17:45:40 2014 UTC (8 years, 8 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.261.2.1: +210 -46 lines
Diff to previous 1.261.2.1 (colored) next main 1.262 (colored)

sync with head

Revision 1.268.2.1 / (download) - annotate - [select for diffs], Mon Apr 7 03:37:33 2014 UTC (8 years, 9 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.268: +4 -3 lines
Diff to previous 1.268 (colored)

Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
   RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
   and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
   places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
   that had stubbed out code, other minor cleanups.

Revision 1.268 / (download) - annotate - [select for diffs], Sat Mar 29 19:28:25 2014 UTC (8 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, rmind-smpnet-nbase, rmind-smpnet-base, riastradh-xf86-video-intel-2-7-1-pre-2-21-15
Branch point for: tls-earlyentropy
Changes since 1.267: +4 -3 lines
Diff to previous 1.267 (colored)

make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.

Revision 1.267 / (download) - annotate - [select for diffs], Tue Mar 25 16:19:13 2014 UTC (8 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.266: +4 -3 lines
Diff to previous 1.266 (colored)

kill sprintf

Revision 1.162.4.3.2.1.2.2 / (download) - annotate - [select for diffs], Sat Feb 15 03:22:27 2014 UTC (8 years, 11 months ago) by matt
Branch: matt-nb5-mips64
Changes since 1.162.4.3.2.1.2.1: +11 -11 lines
Diff to previous 1.162.4.3.2.1.2.1 (colored) to branchpoint 1.162.4.3.2.1 (colored) next main 1.162.4.4 (colored)

sync pcireg.h with HEAD.
update if_wm.c and ppb.c accordingly.

Revision 1.266 / (download) - annotate - [select for diffs], Tue Jan 7 13:14:39 2014 UTC (9 years ago) by msaitoh
Branch: MAIN
CVS Tags: riastradh-drm2-base3
Changes since 1.265: +47 -3 lines
Diff to previous 1.265 (colored)

 Insert completion barrier between register write and delay().
One exception is chip reset (to avoid hangup).

Revision 1.265 / (download) - annotate - [select for diffs], Sun Dec 29 21:28:41 2013 UTC (9 years, 1 month ago) by msaitoh
Branch: MAIN
Changes since 1.264: +151 -34 lines
Diff to previous 1.264 (colored)

Add support For I354(C2000 interna Ethernet controller):
 - Add I354 support.
 - Fix SGMII+MDIO case. SGMII+I2C is not supported yet.
 - Not tested well.
 - Sprinkle "XXX" to check later.

Revision 1.264 / (download) - annotate - [select for diffs], Fri Sep 13 21:22:10 2013 UTC (9 years, 4 months ago) by martin
Branch: MAIN
Changes since 1.263: +11 -8 lines
Diff to previous 1.263 (colored)

Remove unused variables

Revision 1.263 / (download) - annotate - [select for diffs], Sun Sep 8 03:17:02 2013 UTC (9 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.262: +3 -5 lines
Diff to previous 1.262 (colored)

Remove extra debug message.

Revision 1.162.4.19 / (download) - annotate - [select for diffs], Sat Sep 7 17:10:18 2013 UTC (9 years, 4 months ago) by bouyer
Branch: netbsd-5
Changes since 1.162.4.18: +259 -96 lines
Diff to previous 1.162.4.18 (colored) to branchpoint 1.162 (colored)

sys/dev/pci/if_wm.c				1.246-1.247, 1.249-1.258
sys/dev/pci/if_wmreg.h				1.51, 1.53
sys/dev/pci/if_wmvar.h				1.15-1.16
sys/dev/pci/pcidevs				1.1152-1.1153
sys/dev/pci/pcidevs.h				regen
sys/dev/pci/pcidevs_data.h			regen

	Add I21[0178] support.
	Fix a bug that wm_attach() may fail on some PCH2 or newer system.
	wm_valid_nvm_bank_detect_ich8lan() misunderstood the NVM's bank
	number. Fixes PR#47878.
	Fix a bug that the check of reset complete fails on Intel 8 series
	with "wm_lan_init_done: lan_init_done failed to complete" message.
	The broken code was used for ICH8, 9... and PCH2.
	The wm_linkintr_gmii() function is called from interrupt. That's
	not tick, so call mii_pollstat() instead of mii_tick().
	Add ECC support for the packet buffer. Only 82571 and I21[78] support
	ECC.
	Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.
	Add comments, fix some comments, use macros and remove trailing
	whitespaces.
	[msaitoh, ticket #1867]

Revision 1.261.2.1 / (download) - annotate - [select for diffs], Wed Aug 28 23:59:25 2013 UTC (9 years, 5 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.261: +5 -4 lines
Diff to previous 1.261 (colored)

sync with head

Revision 1.227.2.10 / (download) - annotate - [select for diffs], Mon Jul 29 20:24:04 2013 UTC (9 years, 6 months ago) by jdc
Branch: netbsd-6
Changes since 1.227.2.9: +90 -44 lines
Diff to previous 1.227.2.9 (colored) to branchpoint 1.227 (colored)

Pull up revisions:
  src/sys/dev/pci/if_wm.c revisions 1.259,1.260,1.261,1.262
  src/sys/dev/pci/if_wmreg.h revision 1.54
(requested by msaitoh in ticket #918).

 Fix "MDIC write error" bug for 82574 and 82583. For those chips, the semaphore
must be released after chip reset. Found and tested by Mark Davies.

 Sync the wm_enable_mng_pass_thru() function with FreeBSD. Don't check
MANC_EN_MAC_ADDR_FILTER bit. Add 82574 and 82583 specific check. This
modification may change the setting of WM_F_HAS_MANAGE flag on some machines.

 Sync the wm_release_manageablilty() fucntion with FreeBSD. Set MANC_ARP_EN.
This change enables HW ARP function when entering suspend.

 When the chip is 82580(ER) or I350, set WM_F_ASF_FIRMWARE_PRES flag and
check for the WM_F_ARC_SUBSYS_VALID flag. Same as FreeBSD.

 Move the location of wm_check_mng_mode() and wm_get_wakeup() in wm_attach().
Those functions access EEPROM, so they have to call after identifying EEPROM
access type. This modification may change the behavior of BMC(IPMI).

 Fix yet another NVM bank detect problem in wm(4). Use bank 0 if the detect
function failed. It's the same as FreeBSD. Observed and tested with Asus P8P67
Deluxe motherboard and tested by jnemeth.

Revision 1.262 / (download) - annotate - [select for diffs], Tue Jul 16 10:30:27 2013 UTC (9 years, 6 months ago) by msaitoh
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.261: +5 -4 lines
Diff to previous 1.261 (colored)

 Fix yet another NVM bank detect problem in wm(4). Use bank 0 if the detect
function failed. It's the same as FreeBSD. Observed and tested with Asus P8P67
Deluxe motherboard and tested by jnemeth.

Revision 1.227.2.9 / (download) - annotate - [select for diffs], Sun Jul 14 20:39:13 2013 UTC (9 years, 6 months ago) by riz
Branch: netbsd-6
Changes since 1.227.2.8: +340 -147 lines
Diff to previous 1.227.2.8 (colored) to branchpoint 1.227 (colored)

Apply changes (requested by msaitoh in ticket #907):

sys/dev/pci/if_wm.c				1.238, 1.244-1.247, 1.249-1.258
sys/dev/pci/if_wmreg.h				1.50-1.51, 1.53
sys/dev/pci/if_wmvar.h				1.15-1.16

	Various fixes to wm(4):
	Add I21[0178] support.
	Fix a bug that wm_attach() may fail on some PCH2 or newer system.
	wm_valid_nvm_bank_detect_ich8lan() misunderstood the NVM's bank
	number. Fixes PR#47878.
	Fix a bug that the check of reset complete fails on Intel 8 series
	with "wm_lan_init_done: lan_init_done failed to complete" message.
	The broken code was used for ICH8, 9... and PCH2.
	The wm_linkintr_gmii() function is called from interrupt. That's
	not tick, so call mii_pollstat() instead of mii_tick().
	Add ECC support for the packet buffer. Only 82571 and I21[78] support
	ECC.
	Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.
	Change style, add comments, fix some comments, use macros and
	remove trailing whitespaces.
	[msaitoh, ticket #907]

Revision 1.261 / (download) - annotate - [select for diffs], Thu Jun 27 09:57:49 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Branch point for: rmind-smpnet
Changes since 1.260: +26 -26 lines
Diff to previous 1.260 (colored)

 Move the location of wm_check_mng_mode() and wm_get_wakeup() in wm_attach().
Those functions access EEPROM, so they have to call after identifying EEPROM
access type. This modification may change the behavior of BMC(IPMI).

Revision 1.260 / (download) - annotate - [select for diffs], Tue Jun 25 17:38:38 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.259: +15 -6 lines
Diff to previous 1.259 (colored)

 Sync the wm_enable_mng_pass_thru() function with FreeBSD. Don't check
MANC_EN_MAC_ADDR_FILTER bit. Add 82574 and 82583 specific check. This
modification may change the setting of WM_F_HAS_MANAGE flag on some machines.

 Sync the wm_release_manageablilty() fucntion with FreeBSD. Set MANC_ARP_EN.
This change enables HW ARP function when entering suspend.

 When the chip is 82580(ER) or I350, set WM_F_ASF_FIRMWARE_PRES flag and
check for the WM_F_ARC_SUBSYS_VALID flag. Same as FreeBSD.

Revision 1.259 / (download) - annotate - [select for diffs], Tue Jun 25 02:34:00 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.258: +52 -16 lines
Diff to previous 1.258 (colored)

 Fix "MDIC write error" bug for 82574 and 82583. For those chips, the semaphore
must be released after chip reset. Found and tested by Mark Davies.

Revision 1.234.2.3 / (download) - annotate - [select for diffs], Sun Jun 23 06:20:18 2013 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.234.2.2: +271 -108 lines
Diff to previous 1.234.2.2 (colored)

resync from head

Revision 1.258 / (download) - annotate - [select for diffs], Wed Jun 19 10:53:24 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.257: +6 -6 lines
Diff to previous 1.257 (colored)

Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.

Revision 1.257 / (download) - annotate - [select for diffs], Wed Jun 19 10:38:51 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.256: +22 -2 lines
Diff to previous 1.256 (colored)

Add ECC support for the packet buffer. Only 82571 and I21[78] support ECC.

Revision 1.256 / (download) - annotate - [select for diffs], Wed Jun 19 10:27:08 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.255: +6 -5 lines
Diff to previous 1.255 (colored)

Fix some bugs on I21[78] to make those devices stable.

Revision 1.162.4.18 / (download) - annotate - [select for diffs], Wed Jun 19 07:50:15 2013 UTC (9 years, 7 months ago) by bouyer
Branch: netbsd-5
Changes since 1.162.4.17: +1792 -296 lines
Diff to previous 1.162.4.17 (colored) to branchpoint 1.162 (colored)

Pullup the following revisions via patch, requested by msaitoh in ticket #1850:
	sys/dev/pci/if_wm.c			1.201, 1.203-1.204,
						1.207-1.212, 1.215,
						1.217-1.218, 1.220-1.223,
						1.228, 1.232-245
	sys/dev/pci/if_wmreg.h			1.40-1.45, 1.47-1.48
	sys/dev/pci/if_wmvar.h			1.11-1.13
	sys/dev/pci/pcidevs			1.1074, 1.1077, 1.1117
	sys/dev/pci/pcidevs.h			regen
	sys/dev/pci/pcidevs_data.h		regen
	sys/dev/mii/igphyreg.h			1.6
	sys/dev/mii/ihphy.c			1.1-1.2
	sys/dev/mii/ihphyreg.h			1.1
	sys/dev/mii/inbmphyreg.h		1.3
	sys/dev/mii/files.mii			1.47 via patch
	sys/dev/mii/miidevs			1.97 and 1.100
	sys/dev/mii/miidevs.h			regen
	sys/dev/mii/miidevs_data.h		regen
	sys/arch/i386/conf/ALL			1.280
	sys/arch/i386/conf/GENERIC		1.1001
	sys/arch/i386/conf/INSTALL_FLOPPY	1.11
	sys/arch/i386/conf/XEN2_DOM0		patch
	sys/arch/amd64/conf/GENERIC		1.293
	sys/arch/amd64/conf/XEN3_DOM0		1.61
	share/man/man4/wm.4			1.21-1.24

Apply almost all fixes and improvements from netbsd-6 except for
the rev. 1.196's iqdrops' change.

- Add the detach code.
- Add code for WOL, ASF, IPMI and Intel AMT. WOL is disabled by default
- Add Yet another workaround for ICH8.
- 82576 is dual port, so check the FUNCID and increment the MAC address for
  the 2nd port.
- Fix the names of 82577L[MC] LAN controllers (for mobile).
- Fix CTRL_EXT_SWDPIN() and CTRL_EXT_SWDPIO() macros. The bit order of the
  SW definable pin is not 6543 but 3654!!!
- Rewrite the code to read MAC address from eeprom.
- Add 82580 support.
- 82571 quirk. Only 82571 shares port 0 of EEMNGCTL_CFGDONE.
- The document says that the TDH register must be set after
  TCL.EN is set on 82575 and newer devices.
- Fix some register names. No functional change.
- Omit U+00AE "REGISTERED SIGN" in a product name due to its non-ASCII nature.
- Stop wm(4) from needlessly resetting when you add or delete a vlan(4).
- Fix MAC address check on 8257[156] and 80003 case. Some cards have non 0xffff
  pointer but those don't use alternative MAC address in reality. So we check
  whether the broadcast bit is set or not like Intel's e1000 driver.
  Fixes PR kern/44072 reported by Jean-Yves Moulin.
- Add PCH2(and 82579) support. Fixes PR#46487
- Add yet another 82567V support.
- Add ICH10+HANKSVILL support.
- Add support Intel I350 Ethernet.
- Make vlan and all ip/ip6 checksum offload work for the I350.
- Fix compile error with  WM_DEBUG.
- Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.
- Add WM_DEBUG_NVM. If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.
- Skip 64bit BAR correctly.
- Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.
- Use 82580(and I350) specific PHY read/write functions. Fixes PR#47542.
- Style fix. Fix typo in comment. Fix comments. Add comments.

Revision 1.255 / (download) - annotate - [select for diffs], Tue Jun 11 14:39:35 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.254: +4 -3 lines
Diff to previous 1.254 (colored)

 Disable LPLU when the device is WM_T_PCH_LPT series (I21[78]).
This change fixes a bug that wm interface don't negotiate to 1000BaseT.

Revision 1.254 / (download) - annotate - [select for diffs], Tue Jun 11 10:07:09 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.253: +4 -4 lines
Diff to previous 1.253 (colored)

The wm_linkintr_gmii() function is called from interrupt, so call
mii_pollstat() instead of mii_tick().

Revision 1.253 / (download) - annotate - [select for diffs], Tue Jun 4 16:55:07 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.252: +12 -11 lines
Diff to previous 1.252 (colored)

 Fix a bug that the check of reset complete fails on Intel 8 series with
"wm_lan_init_done: lan_init_done failed to complete" message.
The broken code was used for ICH8, 9... and PCH2 but I've never seen the
problem.

Revision 1.252 / (download) - annotate - [select for diffs], Mon Jun 3 18:47:52 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.251: +10 -2 lines
Diff to previous 1.251 (colored)

Use wm_gmii_hv_{read,write}reg() for I21[78].

Revision 1.251 / (download) - annotate - [select for diffs], Mon Jun 3 01:31:37 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.250: +2 -5 lines
Diff to previous 1.250 (colored)

Cleanup. No functional change.

Revision 1.250 / (download) - annotate - [select for diffs], Sun Jun 2 17:23:33 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.249: +30 -27 lines
Diff to previous 1.249 (colored)

- Fix a bug that wm_attach() may fail on some PCH2 or newer system.
  wm_valid_nvm_bank_detect_ich8lan() misunderstood the NVM's bank number.
  Fixes PR#47878
- Remove a quick hack for NVM checksum that I added in last commit (rev. 1.249)

Revision 1.249 / (download) - annotate - [select for diffs], Sun Jun 2 09:36:22 2013 UTC (9 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.248: +86 -22 lines
Diff to previous 1.248 (colored)

Add I217 (and I218) support.
- The name of I217 is similar to I210, but the function is rather similar to
  PCH2.
- Not tested well. Tested with my own Intel DQ87PG which has I217LM onboard.
- It seems that PCH2 and PCH_LPT specific function for RAL should be written.
- Quick hack for the NVM checksum mismatch. if_wm.c currently has no
  wm_write_eeprom(), so it cannot update NVM's "updated bit". To avoid this
  problem, check only the last 12bits of the checksum. My own DQ87PG's
  updated bit is not set, and I could avoid the problem using with this
  hack.

Revision 1.248 / (download) - annotate - [select for diffs], Sun Apr 21 19:59:41 2013 UTC (9 years, 9 months ago) by msaitoh
Branch: MAIN
CVS Tags: khorben-n900
Changes since 1.247: +14 -14 lines
Diff to previous 1.247 (colored)

Delete "PCI_" from PCIX and PICE capability registers.

Revision 1.247 / (download) - annotate - [select for diffs], Thu Apr 18 12:42:03 2013 UTC (9 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.246: +77 -9 lines
Diff to previous 1.246 (colored)

Add support I21[01]. Only tested with my own I210-T1 Ethernet Server Adapter.

Revision 1.246 / (download) - annotate - [select for diffs], Sat Mar 30 03:21:08 2013 UTC (9 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.245: +33 -33 lines
Diff to previous 1.245 (colored)

remove trailing whitespace

Revision 1.234.2.2 / (download) - annotate - [select for diffs], Mon Feb 25 00:29:18 2013 UTC (9 years, 11 months ago) by tls
Branch: tls-maxphys
Changes since 1.234.2.1: +178 -57 lines
Diff to previous 1.234.2.1 (colored)

resync with head

Revision 1.227.2.8 / (download) - annotate - [select for diffs], Mon Feb 18 18:05:29 2013 UTC (9 years, 11 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE
Branch point for: netbsd-6-1
Changes since 1.227.2.7: +47 -10 lines
Diff to previous 1.227.2.7 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #824):
	sys/dev/pci/if_wm.c: revision 1.240
	sys/dev/pci/if_wm.c: revision 1.241
	sys/dev/pci/if_wm.c: revision 1.242
	sys/dev/pci/if_wmreg.h: revision 1.49
- Add WM_DEBUG_NVM.
- If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.
Skip 64bit BAR correctly. I don't know if this bug causes a real problem.
Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.

Revision 1.227.2.7 / (download) - annotate - [select for diffs], Mon Feb 18 17:57:57 2013 UTC (9 years, 11 months ago) by riz
Branch: netbsd-6
Changes since 1.227.2.6: +7 -7 lines
Diff to previous 1.227.2.6 (colored) to branchpoint 1.227 (colored)


sys/dev/pci/if_wm.c				1.235-1.236 via patch

	Use PRIx64 and explicitly cast to uint64_t to print a DMA address.
	This fixes a problem that if_wm.c can't compile with WM_DEBUG on
	non-64bit platforms.
	[msaitoh, ticket #823]

Revision 1.227.2.6 / (download) - annotate - [select for diffs], Thu Feb 14 22:08:28 2013 UTC (9 years, 11 months ago) by jdc
Branch: netbsd-6
Changes since 1.227.2.5: +60 -2 lines
Diff to previous 1.227.2.5 (colored) to branchpoint 1.227 (colored)

Pull up revisions:
  src/sys/dev/pci/if_wm.c revision 1.243
  src/sys/dev/pci/if_wmvar.h revision 1.14
(requested by msaitoh in ticket #820).

Use 82580(and I350) specific PHY read/write functions.
Fixes PR#47542.

Revision 1.245 / (download) - annotate - [select for diffs], Wed Feb 13 16:58:04 2013 UTC (9 years, 11 months ago) by msaitoh
Branch: MAIN
CVS Tags: agc-symver-base, agc-symver
Changes since 1.244: +11 -10 lines
Diff to previous 1.244 (colored)

No functional change.
 - Fix comment.
 - Use macro.

Revision 1.244 / (download) - annotate - [select for diffs], Wed Feb 13 12:28:23 2013 UTC (9 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.243: +65 -40 lines
Diff to previous 1.243 (colored)

No functional change.
- "struct mii_data *mii = &sc->sc_mii" and use it.
- Add comments.
- Fix some comments.

Revision 1.243 / (download) - annotate - [select for diffs], Tue Feb 12 03:11:43 2013 UTC (9 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.242: +60 -2 lines
Diff to previous 1.242 (colored)

Use 82580(and I350) specific PHY read/write functions.
Fixes PR#47542.

Revision 1.242 / (download) - annotate - [select for diffs], Thu Feb 7 15:38:42 2013 UTC (9 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.241: +13 -6 lines
Diff to previous 1.241 (colored)

Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.

Revision 1.241 / (download) - annotate - [select for diffs], Thu Feb 7 02:10:18 2013 UTC (9 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.240: +8 -5 lines
Diff to previous 1.240 (colored)

Skip 64bit BAR correctly. I don't know if this bug causes a real problem.

Revision 1.240 / (download) - annotate - [select for diffs], Wed Jan 30 14:20:53 2013 UTC (10 years ago) by msaitoh
Branch: MAIN
Changes since 1.239: +30 -3 lines
Diff to previous 1.239 (colored)

- Add WM_DEBUG_NVM.
- If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.

Revision 1.223.2.3 / (download) - annotate - [select for diffs], Wed Jan 16 05:33:18 2013 UTC (10 years ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.223.2.2: +22 -18 lines
Diff to previous 1.223.2.2 (colored) to branchpoint 1.223 (colored)

sync with (a bit old) head

Revision 1.227.2.5 / (download) - annotate - [select for diffs], Mon Dec 17 00:30:05 2012 UTC (10 years, 1 month ago) by riz
Branch: netbsd-6
Changes since 1.227.2.4: +3 -3 lines
Diff to previous 1.227.2.4 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #755):
	sys/dev/pci/if_wm.c: revision 1.239
- 82578DC is not PCH2 but PCH. 82579V is not PCH but PCH2. This bug was
   introduced in rev. 1.221. Reported by FUKAUMI Naoki.
- Fix comment.

Revision 1.239 / (download) - annotate - [select for diffs], Wed Dec 12 09:20:35 2012 UTC (10 years, 1 month ago) by msaitoh
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7
Changes since 1.238: +5 -5 lines
Diff to previous 1.238 (colored)

- 82578DC is not PCH2 but PCH. 82579V is not PCH but PCH2. This bug was
  introduced in rev. 1.221. Reported by FUKAUMI Naoki.
- Fix comment.

Revision 1.227.2.4 / (download) - annotate - [select for diffs], Fri Nov 23 16:35:21 2012 UTC (10 years, 2 months ago) by riz
Branch: netbsd-6
Changes since 1.227.2.3: +1 -1 lines
Diff to previous 1.227.2.3 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #697):
	sys/dev/pci/if_wm.c: revision 1.237
Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.

Revision 1.234.2.1 / (download) - annotate - [select for diffs], Tue Nov 20 03:02:18 2012 UTC (10 years, 2 months ago) by tls
Branch: tls-maxphys
Changes since 1.234: +24 -20 lines
Diff to previous 1.234 (colored)

Resync to 2012-11-19 00:00:00 UTC

Revision 1.238 / (download) - annotate - [select for diffs], Thu Nov 15 06:14:54 2012 UTC (10 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.237: +18 -14 lines
Diff to previous 1.237 (colored)

Change style a bit.

Revision 1.237 / (download) - annotate - [select for diffs], Wed Nov 7 08:17:18 2012 UTC (10 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.236: +3 -3 lines
Diff to previous 1.236 (colored)

Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.

Revision 1.227.2.2.2.1 / (download) - annotate - [select for diffs], Thu Nov 1 16:45:01 2012 UTC (10 years, 2 months ago) by matt
Branch: matt-nb6-plus
Changes since 1.227.2.2: +518 -14 lines
Diff to previous 1.227.2.2 (colored) next main 1.227.2.3 (colored)

sync with netbsd-6-0-RELEASE.

Revision 1.223.2.2 / (download) - annotate - [select for diffs], Tue Oct 30 17:21:34 2012 UTC (10 years, 3 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.223.2.1: +641 -38 lines
Diff to previous 1.223.2.1 (colored) to branchpoint 1.223 (colored)

sync with head

Revision 1.162.4.17 / (download) - annotate - [select for diffs], Wed Oct 17 20:46:37 2012 UTC (10 years, 3 months ago) by bouyer
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2
Changes since 1.162.4.16: +18 -2 lines
Diff to previous 1.162.4.16 (colored) to branchpoint 1.162 (colored)

Apply patch, requested by msaitoh in ticket 1800:
	sys/dev/pci/if_wm.c:	revision 1.230-1.231 via patch
Add workaround for QEMU and the variants that fail on
EEPROM access.
This problem was discovered a few years ago, but some variants
and cloud services still have the bug. This problem is not
NetBSD's bug but qemus' bug. For NetBSD users, existence of
buggy virtual machines is sad thing, so we add a workaroud.

Revision 1.236 / (download) - annotate - [select for diffs], Fri Oct 12 11:24:44 2012 UTC (10 years, 3 months ago) by msaitoh
Branch: MAIN
CVS Tags: yamt-pagecache-base6
Changes since 1.235: +8 -8 lines
Diff to previous 1.235 (colored)

Explicitly cast to uint64_t instead of using PRIxPADDR because
sizeof(paddr_t) != sizeof(bus_addr_t) on some architecture.

See:
  http://mail-index.netbsd.org/source-changes-d/2012/10/09/msg005353.html

Revision 1.235 / (download) - annotate - [select for diffs], Tue Oct 9 10:25:44 2012 UTC (10 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.234: +3 -3 lines
Diff to previous 1.234 (colored)

Use PRIxPADDR to print a DMA address. This fix a problem that if_wm.c
can't compile with WM_DEBUG on non-64bit platforms.

Revision 1.227.2.3 / (download) - annotate - [select for diffs], Mon Sep 3 19:09:41 2012 UTC (10 years, 4 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, matt-nb6-plus-nbase, matt-nb6-plus-base
Branch point for: netbsd-6-0
Changes since 1.227.2.2: +516 -12 lines
Diff to previous 1.227.2.2 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by bouyer in ticket #534):
	sys/dev/pci/if_wmreg.h: revision 1.48
	sys/dev/pci/if_wm.c: revision 1.232
	sys/dev/pci/if_wm.c: revision 1.233
	sys/dev/pci/if_wm.c: revision 1.234
Make vlan and all ip/ip6 checksum offload work for the I350.
On newer devices, when using the legacy TX descriptors, vlan-related flags
that were set on the last descriptor of a packet have to be set on the
first one.
For tso/checksum offloads, a new "advanced" descriptor format has to be
used.
Change wcd_txdescs to a union defining all types of descriptors (they
are all 16-bytes wide).
Define a new tx function wm_nq_start(), which handle newer devices.
There is some code duplication with wm_start(), but adding support to
the existing wm_start() would make it a if () {} else {} maze. This also
allows to get rid of some workaround for older chips that are not needed
here.
Use wm_nq_start() instead of wm_start() for the I350 (this should probably
be for all WM_F_NEWQUEUE devices, but I have no hardware but the I350 to
test). Call ifp->if_start() instead of wm_start() where is matters.
Tested on a I350, and a i80003 (which use the old format), both with and
without vlans, with and without checksum offloads.
Enable VLAN hardware tagging on all chips that have the new queue mechanism.
Tested with 82575{EB,GB}, 82576, 82580, I350 and ICH9.
Shut up gcc about some uninitialized variables.

Revision 1.234 / (download) - annotate - [select for diffs], Sat Sep 1 02:08:28 2012 UTC (10 years, 5 months ago) by matt
Branch: MAIN
Branch point for: tls-maxphys
Changes since 1.233: +7 -4 lines
Diff to previous 1.233 (colored)

Shut up gcc about some uninitialized variables.

Revision 1.233 / (download) - annotate - [select for diffs], Thu Aug 30 23:14:20 2012 UTC (10 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.232: +4 -6 lines
Diff to previous 1.232 (colored)

Enable VLAN hardware tagging on all chips that have the new queue mechanism.
Tested with 82575{EB,GB}, 82576, 82580, I350 and ICH9.

Revision 1.232 / (download) - annotate - [select for diffs], Wed Aug 29 20:39:24 2012 UTC (10 years, 5 months ago) by bouyer
Branch: MAIN
Changes since 1.231: +514 -11 lines
Diff to previous 1.231 (colored)

Make vlan and all ip/ip6 checksum offload work for the I350.

On newer devices, when using the legacy TX descriptors, vlan-related flags
that were set on the last descriptor of a packet have to be set on the
first one.
For tso/checksum offloads, a new "advanced" descriptor format has to be
used.

Change wcd_txdescs to a union defining all types of descriptors (they
are all 16-bytes wide).
Define a new tx function wm_nq_start(), which handle newer devices.
There is some code duplication with wm_start(), but adding support to
the existing wm_start() would make it a if () {} else {} maze. This also
allows to get rid of some workaround for older chips that are not needed
here.
Use wm_nq_start() instead of wm_start() for the I350 (this should probably
be for all WM_F_NEWQUEUE devices, but I have no hardware but the I350 to
test). Call ifp->if_start() instead of wm_start() where is matters.

Tested on a I350, and a i80003 (which use the old format), both with and
without vlans, with and without checksum offloads.

Revision 1.227.2.2 / (download) - annotate - [select for diffs], Thu Aug 9 08:00:55 2012 UTC (10 years, 5 months ago) by martin
Branch: netbsd-6
CVS Tags: netbsd-6-0-RC1
Branch point for: matt-nb6-plus
Changes since 1.227.2.1: +18 -2 lines
Diff to previous 1.227.2.1 (colored) to branchpoint 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #471):
	sys/dev/pci/if_wm.c: revision 1.230
	sys/dev/pci/if_wm.c: revision 1.231
  Add workaround for QEMU and the variants that fail on EEPROM access.
  This problem was discovered a few years ago, but some variants and
cloud services still have the bug. This problem is not NetBSD's bug
but qemus's bug. For NetBSD users, existence of buggy virtual machines
s sad thing, so we add a workaroud.
Fix the check of the device type in last commit.
Reported by Thomas Klausner.

Revision 1.231 / (download) - annotate - [select for diffs], Thu Aug 9 07:48:39 2012 UTC (10 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.230: +3 -3 lines
Diff to previous 1.230 (colored)

Fix the check of the device type in last commit.
Reported by Thomas Klausner.

Revision 1.230 / (download) - annotate - [select for diffs], Thu Aug 9 04:16:37 2012 UTC (10 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.229: +18 -2 lines
Diff to previous 1.229 (colored)

 Add workaround for QEMU and the variants that fail on EEPROM access.

 This problem was discovered a few years ago, but some variants and
cloud services still have the bug. This problem is not NetBSD's bug
but qemus' bug. For NetBSD users, existence of buggy virtual machines
is sad thing, so we add a workaroud.

Revision 1.229 / (download) - annotate - [select for diffs], Sun Jul 22 14:33:04 2012 UTC (10 years, 6 months ago) by matt
Branch: MAIN
Changes since 1.228: +7 -7 lines
Diff to previous 1.228 (colored)

Fix mii_statchg to take a 'struct ifnet *' instead of device_t.  This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.

Revision 1.227.2.1 / (download) - annotate - [select for diffs], Thu Jun 28 16:06:36 2012 UTC (10 years, 7 months ago) by riz
Branch: netbsd-6
Changes since 1.227: +102 -19 lines
Diff to previous 1.227 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #362):
sys/dev/pci/if_wm.c             1.228
        sys/dev/pci/if_wmreg.h          1.47
        sys/dev/pci/if_wmvar.h          1.13
        sys/dev/pci/pcidevs             1.1117
        sys/dev/pci/pcidevs.h           regen
        sys/dev/pci/pcidevs_data.h      regen
        share/man/man4/wm.4             1.22-1.25

                Add support for Intel I350 Ethernet.
                Update document.

Revision 1.225.2.2 / (download) - annotate - [select for diffs], Sat Jun 2 11:09:18 2012 UTC (10 years, 7 months ago) by mrg
Branch: jmcneill-usbmp
Changes since 1.225.2.1: +102 -19 lines
Diff to previous 1.225.2.1 (colored) to branchpoint 1.225 (colored) next main 1.226 (colored)

sync to latest -current.

Revision 1.228 / (download) - annotate - [select for diffs], Fri May 25 23:37:38 2012 UTC (10 years, 8 months ago) by msaitoh
Branch: MAIN
CVS Tags: jmcneill-usbmp-base10
Changes since 1.227: +102 -19 lines
Diff to previous 1.227 (colored)

Add support Intel I350 Ethernet.

Revision 1.223.2.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:07:49 2012 UTC (10 years, 9 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.223: +8 -18 lines
Diff to previous 1.223 (colored)

sync with head

Revision 1.225.2.1 / (download) - annotate - [select for diffs], Sat Feb 18 07:34:43 2012 UTC (10 years, 11 months ago) by mrg
Branch: jmcneill-usbmp
Changes since 1.225: +4 -16 lines
Diff to previous 1.225 (colored)

merge to -current.

Revision 1.227 / (download) - annotate - [select for diffs], Thu Feb 2 19:43:05 2012 UTC (10 years, 11 months ago) by tls
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4, netbsd-6-base, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2
Branch point for: netbsd-6
Changes since 1.226: +3 -14 lines
Diff to previous 1.226 (colored)

Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
   to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
   source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
   avoid expensive operations on disabled entropy sources; make the
   rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
   have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
   system events, and skew between clocks, with a sample implementation
   for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files).  Tested with release
builds on amd64 and evbarm and live testing on amd64.

Revision 1.226 / (download) - annotate - [select for diffs], Mon Jan 30 19:41:21 2012 UTC (11 years ago) by drochner
Branch: MAIN
Changes since 1.225: +3 -4 lines
Diff to previous 1.225 (colored)

Use pci_aprint_devinfo(9) instead of pci_devinfo+aprint_{normal,naive}
where it looks straightforward, and pci_aprint_devinfo_fancy in a few
others where drivers want to supply their own device names instead
of the pcidevs generated one. More complicated cases, where names
are composed at runtime, are left alone for now. It certainly makes
sense to simplify the drivers here rather than inventing a catch-all API.
This should serve as as example for new drivers, and also ensure
consistent output in the AB_QUIET ("boot -q") case. Also, it avoids
excessive stack usage where drivers attach child devices because the
buffer for the device name is not kept on the local stack anymore.

Revision 1.162.4.16 / (download) - annotate - [select for diffs], Wed Jan 25 18:02:17 2012 UTC (11 years ago) by riz
Branch: netbsd-5
Changes since 1.162.4.15: +5 -3 lines
Diff to previous 1.162.4.15 (colored) to branchpoint 1.162 (colored)

Pull up following revision(s) (requested by bouyer in ticket #1699):
	sys/dev/pci/if_wm.c: revision 1.225
There is problem with 82576 chips (and probably 82575 too) with hardware vlan
tagging: some packets are sent untagged on the wire.
Follow OpenBSD and disable hardware vlan tagging for these chips
(I couldn't find a hint in other open-source drivers at what could be
wrong ...)

Revision 1.225 / (download) - annotate - [select for diffs], Mon Nov 28 18:21:46 2011 UTC (11 years, 2 months ago) by bouyer
Branch: MAIN
CVS Tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base
Branch point for: jmcneill-usbmp
Changes since 1.224: +5 -3 lines
Diff to previous 1.224 (colored)

There is problem with 82576 chips (and probably 82575 too) with hardware vlan
tagging: some packets are sent untagged on the wire.
Follow OpenBSD and disable hardware vlan tagging for these chips
(I couldn't find a hint in other open-source drivers at what could be
wrong ...)

Revision 1.224 / (download) - annotate - [select for diffs], Sat Nov 19 22:51:23 2011 UTC (11 years, 2 months ago) by tls
Branch: MAIN
Changes since 1.223: +3 -3 lines
Diff to previous 1.223 (colored)

First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.

Revision 1.223 / (download) - annotate - [select for diffs], Fri Jul 1 07:45:39 2011 UTC (11 years, 7 months ago) by matt
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: yamt-pagecache
Changes since 1.222: +5 -3 lines
Diff to previous 1.222 (colored)

Fix uninitialized data warning found by gcc 4.5

Revision 1.217.2.1 / (download) - annotate - [select for diffs], Mon Jun 6 09:08:15 2011 UTC (11 years, 7 months ago) by jruoho
Branch: jruoho-x86intr
Changes since 1.217: +249 -81 lines
Diff to previous 1.217 (colored) next main 1.218 (colored)

Sync with HEAD.

Revision 1.205.2.4 / (download) - annotate - [select for diffs], Tue May 31 03:04:41 2011 UTC (11 years, 8 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.205.2.3: +154 -21 lines
Diff to previous 1.205.2.3 (colored) next main 1.206 (colored)

sync with head

Revision 1.222 / (download) - annotate - [select for diffs], Tue May 24 22:46:42 2011 UTC (11 years, 8 months ago) by msaitoh
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, cherry-xenmp
Changes since 1.221: +3 -2 lines
Diff to previous 1.221 (colored)

Fix invalid PBA setting on ICH{9,10}. This bug was introduced in the last
commit. I noticed this problem via mail from spz.

Revision 1.221 / (download) - annotate - [select for diffs], Fri May 20 00:57:42 2011 UTC (11 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.220: +155 -23 lines
Diff to previous 1.220 (colored)

- Add PCH2 support.
  - Add 82579 support.
  - Change PBA size for PCH from 10K to 26K as FreeBSD's em-7.1.7
- Add yet another 82567V support.
- Add ICH10+HANKSVILL support.
- Add 82580 quad-1000BaseX support.

Revision 1.162.4.13.2.1 / (download) - annotate - [select for diffs], Mon Mar 7 04:15:01 2011 UTC (11 years, 10 months ago) by riz
Branch: netbsd-5-1
CVS Tags: netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE
Changes since 1.162.4.13: +4 -4 lines
Diff to previous 1.162.4.13 (colored) next main 1.162.4.14 (colored)

Pull up following revision(s) (requested by bouyer in ticket #1544):
	sys/dev/pci/if_wm.c: revision 1.219
wm_gmii_reset(): restore generic reset delays to what they were before
rev 1.186. This makes the following hardware find its PHY again, and I can't
see how these larger delays could be a problem for other hardware:
wm0 at pci6 dev 7 function 0: Intel i82541GI 1000BASE-T Ethernet, rev. 5
wm0: interrupting at ioapic2 pin 0, event channel 5
wm0: 32-bit 66MHz PCI bus
wm0: 65536 word (16 address bits) SPI EEPROM
wm0: Ethernet address 00:13:72:54:ee:13
igphy0 at wm0 phy 1: Intel IGP01E1000 Gigabit PHY, rev. 0
igphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto

Revision 1.162.4.15 / (download) - annotate - [select for diffs], Mon Mar 7 04:14:19 2011 UTC (11 years, 10 months ago) by riz
Branch: netbsd-5
Changes since 1.162.4.14: +4 -4 lines
Diff to previous 1.162.4.14 (colored) to branchpoint 1.162 (colored)

Pull up following revision(s) (requested by bouyer in ticket #1544):
	sys/dev/pci/if_wm.c: revision 1.219
wm_gmii_reset(): restore generic reset delays to what they were before
rev 1.186. This makes the following hardware find its PHY again, and I can't
see how these larger delays could be a problem for other hardware:
wm0 at pci6 dev 7 function 0: Intel i82541GI 1000BASE-T Ethernet, rev. 5
wm0: interrupting at ioapic2 pin 0, event channel 5
wm0: 32-bit 66MHz PCI bus
wm0: 65536 word (16 address bits) SPI EEPROM
wm0: Ethernet address 00:13:72:54:ee:13
igphy0 at wm0 phy 1: Intel IGP01E1000 Gigabit PHY, rev. 0
igphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto

Revision 1.205.2.3 / (download) - annotate - [select for diffs], Sat Mar 5 20:53:45 2011 UTC (11 years, 10 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.205.2.2: +175 -117 lines
Diff to previous 1.205.2.2 (colored)

sync with head

Revision 1.217.4.2 / (download) - annotate - [select for diffs], Sat Mar 5 15:10:23 2011 UTC (11 years, 10 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.217.4.1: +3 -3 lines
Diff to previous 1.217.4.1 (colored) to branchpoint 1.217 (colored) next main 1.218 (colored)

Sync with HEAD

Revision 1.220 / (download) - annotate - [select for diffs], Tue Feb 22 21:19:30 2011 UTC (11 years, 11 months ago) by dyoung
Branch: MAIN
CVS Tags: bouyer-quota2-nbase
Changes since 1.219: +3 -3 lines
Diff to previous 1.219 (colored)

Use /*FALLTHROUGH*/.

Revision 1.217.4.1 / (download) - annotate - [select for diffs], Tue Feb 8 16:19:50 2011 UTC (11 years, 11 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.217: +94 -59 lines
Diff to previous 1.217 (colored)

Sync with HEAD

Revision 1.219 / (download) - annotate - [select for diffs], Sun Feb 6 16:23:00 2011 UTC (11 years, 11 months ago) by bouyer
Branch: MAIN
CVS Tags: bouyer-quota2-base
Changes since 1.218: +4 -4 lines
Diff to previous 1.218 (colored)

wm_gmii_reset(): restore generic reset delays to what they were before
rev 1.186. This makes the following hardware find its PHY again, and I can't
see how these larger delays could be a problem for other hardware:

wm0 at pci6 dev 7 function 0: Intel i82541GI 1000BASE-T Ethernet, rev. 5
wm0: interrupting at ioapic2 pin 0, event channel 5
wm0: 32-bit 66MHz PCI bus
wm0: 65536 word (16 address bits) SPI EEPROM
wm0: Ethernet address 00:13:72:54:ee:13
igphy0 at wm0 phy 1: Intel IGP01E1000 Gigabit PHY, rev. 0
igphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto

Revision 1.218 / (download) - annotate - [select for diffs], Wed Jan 26 00:25:34 2011 UTC (12 years ago) by msaitoh
Branch: MAIN
Changes since 1.217: +92 -57 lines
Diff to previous 1.217 (colored)

Fix MAC address check on 8257[156] and 80003 case. Some cards have non 0xffff
pointer but those don't use alternative MAC address in reality. So we check
whether the broadcast bit is set or not like Intel's e1000 driver.
Fixes PR kern/44072 reported by Jean-Yves Moulin.

Remove extra Warning for newer cards.

Revision 1.217 / (download) - annotate - [select for diffs], Tue Dec 14 02:51:46 2010 UTC (12 years, 1 month ago) by dyoung
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: jruoho-x86intr, bouyer-quota2
Changes since 1.216: +25 -14 lines
Diff to previous 1.216 (colored)

Stop wm(4) from needlessly resetting when you add or delete a vlan(4):

ifconfig vlan0 create vlan 2 vlanif wm0
ifconfig vlan0 destroy

It pays to avoid a reset because after a reset it can take about 30
seconds before wm0 is back on the net.

The patch garnered no objections on tech-net@.

Sponsored by CoyotePoint Systems Inc.

Revision 1.162.4.14 / (download) - annotate - [select for diffs], Fri Nov 19 23:40:28 2010 UTC (12 years, 2 months ago) by riz
Branch: netbsd-5
CVS Tags: matt-nb5-pq3-base, matt-nb5-pq3
Changes since 1.162.4.13: +593 -127 lines
Diff to previous 1.162.4.13 (colored) to branchpoint 1.162 (colored)

Pull up revisions (requested by msaitoh in ticket #1358):
	sys/dev/pci/if_wm.c		1.196-1.199,1.202,1.205
	sys/dev/pci/if_wmvar.h		1.9
	sys/dev/pci/if_wmreg.h		1.36-1.39
	sys/dev/pci/pcireg.h		1.61-1.64
	sys/dev/pci/pcidevs		1.1023
	sys/dev/pci/pcidevs.h		regen
	sys/dev/pci/pcidevs_data.h	regen
	mii/igphy.c			1.21
	mii/igphyvar.h			1.1
	mii/inbmphyreg.h		1.2

- Count Receive error, CRC error, Alignment error, Symbol error, Sequence
  error, Carrier extension error and Receive length error into ierror.
  Fixes PR#30349 reported by UMEZAWA Takeshi.
- Add support for 82575, 82576 and 82580(ER).
  - Apply the patch for 82575 from Wolfgang Stukenbrock (PR#42422). We use
    only one RX ring and with the legacy mode.
  - Add support for 82576.
  - Partial support for 82580.
  - Partial support for the serdes systems.
- Add two workarounds for ICH8 with igp3.
  - Workaround for 82566 Kumeran PCS lock loss.
  - WOL from S5 stops working.
- (pcireg.h) Add PCIe config register definitions.
- Note that the changes to count Missed packet (rx fifo overflow) and Receive
  no buffers (rx ring full) into iqdrops in rev. 1.196 of if_wm.c is not
  pulled up.

Revision 1.216 / (download) - annotate - [select for diffs], Sat Nov 13 13:52:07 2010 UTC (12 years, 2 months ago) by uebayasi
Branch: MAIN
Changes since 1.215: +2 -4 lines
Diff to previous 1.215 (colored)

Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants.  These are provided by sys/param.h now.

Revision 1.197.2.3 / (download) - annotate - [select for diffs], Fri Oct 22 07:22:05 2010 UTC (12 years, 3 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.197.2.2: +4 -4 lines
Diff to previous 1.197.2.2 (colored) to branchpoint 1.197 (colored) next main 1.198 (colored)

Sync with HEAD (-D20101022).

Revision 1.215 / (download) - annotate - [select for diffs], Sat Oct 16 06:31:49 2010 UTC (12 years, 3 months ago) by taca
Branch: MAIN
CVS Tags: uebayasi-xip-base4, uebayasi-xip-base3
Changes since 1.214: +6 -6 lines
Diff to previous 1.214 (colored)

- Change "else" + space + tab "if" to "else" + space + "if".
- A word "mechanism" was accidently separated in to "me" and "chanism"
  in comment.

No functional chanage and I found it while reading if_wm.c yesterday.

Revision 1.197.2.2 / (download) - annotate - [select for diffs], Tue Aug 17 06:46:26 2010 UTC (12 years, 5 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.197.2.1: +216 -72 lines
Diff to previous 1.197.2.1 (colored) to branchpoint 1.197 (colored)

Sync with HEAD.

Revision 1.158.4.7 / (download) - annotate - [select for diffs], Wed Aug 11 22:53:49 2010 UTC (12 years, 5 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.158.4.6: +220 -78 lines
Diff to previous 1.158.4.6 (colored) to branchpoint 1.158 (colored) next main 1.159 (colored)

sync with head.

Revision 1.214 / (download) - annotate - [select for diffs], Mon Jul 26 22:33:24 2010 UTC (12 years, 6 months ago) by jym
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base2
Changes since 1.213: +5 -5 lines
Diff to previous 1.213 (colored)

Add PAE to ALL kernel, so that most paddr_t format string errors get caught
during compilation.

While here, fix the compilation for ALL.

Revision 1.213 / (download) - annotate - [select for diffs], Wed Jul 21 15:35:39 2010 UTC (12 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.212: +25 -33 lines
Diff to previous 1.212 (colored)

Use ether_set_ifflags_cb()

Revision 1.212 / (download) - annotate - [select for diffs], Mon Jul 19 15:46:37 2010 UTC (12 years, 6 months ago) by jakllsch
Branch: MAIN
Changes since 1.211: +11 -6 lines
Diff to previous 1.211 (colored)

Omit U+00AE "REGISTERED SIGN" in a product name due to its non-ASCII nature.
wm_release_hw_control() in wm_detach() before we unmap the registers we need.
Unmap I/O space during detach.

Revision 1.211 / (download) - annotate - [select for diffs], Wed Jul 14 00:11:06 2010 UTC (12 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.210: +25 -8 lines
Diff to previous 1.210 (colored)

- s/TBDA/TDBA/. It stands for Transmit Descriptor Base Address.
- The document says that the TDH register must be set after
  TCL.EN is set on 82575 and newer devices.

TODO:
- ip4csum doesn't work on 82575 and newer devices (reported by Paul Goyette),
  so we have to fix it.

Revision 1.205.2.2 / (download) - annotate - [select for diffs], Sat Jul 3 01:19:37 2010 UTC (12 years, 7 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.205.2.1: +157 -27 lines
Diff to previous 1.205.2.1 (colored)

sync with head

Revision 1.210 / (download) - annotate - [select for diffs], Mon Jun 28 01:43:39 2010 UTC (12 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.209: +8 -9 lines
Diff to previous 1.209 (colored)

Fix a bug that wm_attach() fails after reading MAC address. Fixes PR#43533.

Fix an uninitialized value on some cases.

Revision 1.209 / (download) - annotate - [select for diffs], Fri Jun 25 04:35:54 2010 UTC (12 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.208: +7 -3 lines
Diff to previous 1.208 (colored)

Only 82571 shares port 0 of EEMNGCTL_CFGDONE.

Revision 1.208 / (download) - annotate - [select for diffs], Fri Jun 25 04:03:14 2010 UTC (12 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.207: +155 -28 lines
Diff to previous 1.207 (colored)

Add some code to support 82580[ER]. Tested on my own I340-T4.

 - Fix CTRL_EXT_SWDPIN() and CTRL_EXT_SWDPIO() macros. The bit order of the
   SW definable pin is not 6543 but 3654!!!

 - Rewrite the code to read MAC address from eeprom.

 - Add some code to support 82580.

TODO:
 - ukphy -> somephy

Revision 1.205.2.1 / (download) - annotate - [select for diffs], Sun May 30 05:17:35 2010 UTC (12 years, 8 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.205: +7 -9 lines
Diff to previous 1.205 (colored)

sync with head

Revision 1.207 / (download) - annotate - [select for diffs], Tue May 25 01:17:55 2010 UTC (12 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.206: +5 -5 lines
Diff to previous 1.206 (colored)

Fix the names of 82577L[MC] LAN controllers (for mobile).
Fix typo.

Revision 1.197.2.1 / (download) - annotate - [select for diffs], Fri Apr 30 14:43:38 2010 UTC (12 years, 9 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.197: +1070 -162 lines
Diff to previous 1.197 (colored)

Sync with HEAD.

Revision 1.162.4.3.2.1.2.1 / (download) - annotate - [select for diffs], Wed Apr 21 00:27:41 2010 UTC (12 years, 9 months ago) by matt
Branch: matt-nb5-mips64
CVS Tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Changes since 1.162.4.3.2.1: +1762 -537 lines
Diff to previous 1.162.4.3.2.1 (colored)

sync to netbsd-5

Revision 1.206 / (download) - annotate - [select for diffs], Mon Apr 5 07:20:28 2010 UTC (12 years, 9 months ago) by joerg
Branch: MAIN
CVS Tags: uebayasi-xip-base1
Changes since 1.205: +4 -6 lines
Diff to previous 1.205 (colored)

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.

Revision 1.158.4.6 / (download) - annotate - [select for diffs], Thu Mar 11 15:03:48 2010 UTC (12 years, 10 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.158.4.5: +2429 -700 lines
Diff to previous 1.158.4.5 (colored) to branchpoint 1.158 (colored)

sync with head

Revision 1.205 / (download) - annotate - [select for diffs], Wed Mar 10 15:04:04 2010 UTC (12 years, 10 months ago) by msaitoh
Branch: MAIN
Branch point for: rmind-uvmplock
Changes since 1.204: +4 -4 lines
Diff to previous 1.204 (colored)

82576 is dual port, so check the FUNCID and increment the MAC address for
the 2nd port.

Revision 1.204 / (download) - annotate - [select for diffs], Sun Mar 7 10:11:04 2010 UTC (12 years, 10 months ago) by msaitoh
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9
Changes since 1.203: +3 -3 lines
Diff to previous 1.203 (colored)

Fix the type of sc_ss. That is not bus_space_handle_t but bus_size_t.
Reported by jdc.

Revision 1.203 / (download) - annotate - [select for diffs], Sun Mar 7 09:05:19 2010 UTC (12 years, 10 months ago) by msaitoh
Branch: MAIN
Changes since 1.202: +396 -21 lines
Diff to previous 1.202 (colored)

- Add code for WOL, ASF, IPMI and Intel AMT.
    - wm_enable_wakeup() is disabled by default. If you want to use WOL with
      the Magic Packet, define WM_WOL.
    - Add the following flags:
        WM_F_ASF_FIRMWARE_PRESENT
        WM_F_ARC_SUBSYSTEM_VALID
        WM_F_HAS_AMT
        WM_F_HAS_MANAGE
        WM_F_WOL
    - Add wm_suspend() and wm_resume(). Give/get the control to/from the
      firmware.
    - Need more work for PCH. See wm_enable_phy_wakeup().
- Enable wm_get_hw_control() for 82574 and 82583.
- Add Yet another workaround for ICH8.
    - Add wm_igp3_phy_powerdown_workaround_ich8lan() for power down problem
      on D3.

Revision 1.202 / (download) - annotate - [select for diffs], Sun Mar 7 07:53:37 2010 UTC (12 years, 10 months ago) by msaitoh
Branch: MAIN
Changes since 1.201: +85 -3 lines
Diff to previous 1.201 (colored)

Add two workarounds for ICH8 with igp3.
- Workaround for 82566 Kumeran PCS lock loss.
- WOL from S5 stops working.

Revision 1.201 / (download) - annotate - [select for diffs], Sun Mar 7 07:09:00 2010 UTC (12 years, 10 months ago) by msaitoh
Branch: MAIN
Changes since 1.200: +94 -20 lines
Diff to previous 1.200 (colored)

Add the detach code.

Revision 1.200 / (download) - annotate - [select for diffs], Thu Feb 25 15:07:06 2010 UTC (12 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.199: +6 -6 lines
Diff to previous 1.199 (colored)

 Merge if_wm.c rev. 1.162.4.13 and if_wmvar.h rev. 1.2.46.3 into maintrunk.
Increase the timeout value to prevent timeout on 80003. The values are taken
from Intel's e1000 driver. Tested by spz and me.

Revision 1.162.4.13 / (download) - annotate - [select for diffs], Thu Feb 25 10:59:58 2010 UTC (12 years, 11 months ago) by sborrill
Branch: netbsd-5
CVS Tags: netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1
Branch point for: netbsd-5-1
Changes since 1.162.4.12: +6 -6 lines
Diff to previous 1.162.4.12 (colored) to branchpoint 1.162 (colored)

Fix regression caused by pullup #1277 requested by msaitoh.

Revision 1.199 / (download) - annotate - [select for diffs], Tue Feb 16 15:17:17 2010 UTC (12 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.198: +483 -100 lines
Diff to previous 1.198 (colored)

Add support for 82575, 82576 and 82580(ER).
- Apply the patch for 82575 from Wolfgang Stukenbrock (PR#42422). We use
  only one RX ring and with the legacy mode.
- Add support for 82576.
- Partial support for 82580.
- Partial support for the serdes systems.

Revision 1.198 / (download) - annotate - [select for diffs], Tue Feb 16 10:06:19 2010 UTC (12 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.197: +22 -26 lines
Diff to previous 1.197 (colored)

indent, tabify