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


Keyword substitution: kv
Default branch: MAIN


Revision 1.801: download - view: text, markup, annotated - select for diffs
Sun Nov 10 11:46:24 2024 UTC (4 weeks, 2 days ago) by mlelstv
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.800: preferred, colored
Changes since revision 1.800: +3 -2 lines
Add MBUFTRACE

Revision 1.800: download - view: text, markup, annotated - select for diffs
Fri Jul 5 04:31:51 2024 UTC (5 months ago) by rin
Branches: MAIN
Diff to: previous 1.799: preferred, colored
Changes since revision 1.799: +3 -4 lines
sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@

Revision 1.799: download - view: text, markup, annotated - select for diffs
Sat Jun 29 12:11:12 2024 UTC (5 months, 1 week ago) by riastradh
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs
Diff to: previous 1.798: preferred, colored
Changes since revision 1.798: +9 -9 lines
if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377

Revision 1.508.4.55: download - view: text, markup, annotated - select for diffs
Thu Feb 29 10:46:27 2024 UTC (9 months, 1 week ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-3-RELEASE
Diff to: previous 1.508.4.54: preferred, colored; branchpoint 1.508: preferred, colored; next MAIN 1.509: preferred, colored
Changes since revision 1.508.4.54: +55 -18 lines
Pull up the following, requested by msaitoh in ticket #1938:

	sys/dev/pci/if_wm.c			1.792,1.794-1.798 via patch
	sys/dev/pci/if_wmreg.h			1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue system.
- Improve dmesg output.
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).
- Fix comment.

Revision 1.645.2.21: download - view: text, markup, annotated - select for diffs
Fri Feb 23 19:45:40 2024 UTC (9 months, 2 weeks ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-4-RELEASE
Diff to: previous 1.645.2.20: preferred, colored; branchpoint 1.645: preferred, colored; next MAIN 1.646: preferred, colored
Changes since revision 1.645.2.20: +52 -15 lines
Pull up the following, requested by msaitoh in ticket #1802:

	sys/dev/pci/if_wm.c			1.794-1.798 via patch
	sys/dev/pci/if_wmreg.h			1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue
  system.
- Improve dmesg output:
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).

Revision 1.767.2.8: download - view: text, markup, annotated - select for diffs
Fri Feb 23 18:54:36 2024 UTC (9 months, 2 weeks ago) by martin
Branches: netbsd-10
CVS tags: netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5
Diff to: previous 1.767.2.7: preferred, colored; branchpoint 1.767: preferred, colored; next MAIN 1.768: preferred, colored
Changes since revision 1.767.2.7: +40 -8 lines
Pull up following revision(s) (requested by msaitoh in ticket #607):

	sys/dev/pci/if_wm.c: revision 1.795
	sys/dev/pci/if_wm.c: revision 1.796
	sys/dev/pci/if_wm.c: revision 1.797
	sys/dev/pci/if_wmreg.h: revision 1.131

wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

 The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

 Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.

wm(4): Drop frames if the RX descriptor ring has no room on multiqueue system.

 Drop frames if the RX descriptor ring has no room. This is enabled only on
multiqueue system to avoid bad influence to other queues. The drop count
can be seen by the RQDPC counter (wmN rxqXXdrop evcnt).

wm(4): Fix compile error without WM_EVENT_COUNTERS.

Revision 1.767.2.7: download - view: text, markup, annotated - select for diffs
Fri Feb 23 18:45:46 2024 UTC (9 months, 2 weeks ago) by martin
Branches: netbsd-10
Diff to: previous 1.767.2.6: preferred, colored; branchpoint 1.767: preferred, colored
Changes since revision 1.767.2.6: +14 -9 lines
Pull up following revision(s) (requested by msaitoh in ticket #606):

	sys/dev/pci/if_wm.c: revision 1.794
	sys/dev/pci/if_wm.c: revision 1.798

wm(4): Print RX packet buffer size.

wm(4): Fix upper 16bit of Image Unique ID(EtrackID).

 Don't override uid1 variable while reading option ROM version
to print Image Unique ID correctly.

Revision 1.798: download - view: text, markup, annotated - select for diffs
Wed Feb 21 12:23:52 2024 UTC (9 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.797: preferred, colored
Changes since revision 1.797: +10 -9 lines
wm(4): Fix upper 16bit of Image Unique ID(EtrackID).

 Don't override uid1 variable while reading option ROM version
to print Image Unique ID correctly.

Revision 1.508.4.54: download - view: text, markup, annotated - select for diffs
Sat Feb 3 12:04:06 2024 UTC (10 months, 1 week ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.53: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.53: +14 -2 lines
Pull up following revision(s) (requested by msaitoh in ticket #1932):

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

Add Intel I219-{LM,V}(20,21) support.

Revision 1.645.2.20: download - view: text, markup, annotated - select for diffs
Sat Feb 3 12:02:58 2024 UTC (10 months, 1 week ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.19: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.19: +14 -2 lines
Pull up following revision(s) (requested by msaitoh in ticket #1791):

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

Add Intel I219-{LM,V}(20,21) support.

Revision 1.767.2.6: download - view: text, markup, annotated - select for diffs
Sat Feb 3 12:01:59 2024 UTC (10 months, 1 week ago) by martin
Branches: netbsd-10
CVS tags: netbsd-10-0-RC4
Diff to: previous 1.767.2.5: preferred, colored; branchpoint 1.767: preferred, colored
Changes since revision 1.767.2.5: +14 -2 lines
Pull up following revision(s) (requested by msaitoh in ticket #564):

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

Add Intel I219-{LM,V}(20,21) support.

Revision 1.797: download - view: text, markup, annotated - select for diffs
Mon Jan 29 06:24:51 2024 UTC (10 months, 1 week ago) by msaitoh
Branches: MAIN
Diff to: previous 1.796: preferred, colored
Changes since revision 1.796: +5 -4 lines
wm(4): Fix compile error without WM_EVENT_COUNTERS.

Revision 1.796: download - view: text, markup, annotated - select for diffs
Mon Jan 29 06:05:11 2024 UTC (10 months, 1 week ago) by msaitoh
Branches: MAIN
Diff to: previous 1.795: preferred, colored
Changes since revision 1.795: +15 -5 lines
wm(4): Drop frames if the RX descriptor ring has no room on multiqueue system.

 Drop frames if the RX descriptor ring has no room. This is enabled only on
multiqueue system to avoid bad influence to other queues. The drop count
can be seen by the RQDPC counter (wmN rxqXXdrop evcnt).

Revision 1.795: download - view: text, markup, annotated - select for diffs
Mon Jan 29 05:02:06 2024 UTC (10 months, 1 week ago) by msaitoh
Branches: MAIN
Diff to: previous 1.794: preferred, colored
Changes since revision 1.794: +26 -5 lines
wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

 The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

 Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.

Revision 1.794: download - view: text, markup, annotated - select for diffs
Fri Jan 26 03:23:36 2024 UTC (10 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.793: preferred, colored
Changes since revision 1.793: +6 -2 lines
wm(4): Print RX packet buffer size.

Revision 1.793: download - view: text, markup, annotated - select for diffs
Thu Jan 18 03:16:44 2024 UTC (10 months, 3 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.792: preferred, colored
Changes since revision 1.792: +14 -2 lines
Add Intel I219-{LM,V}(20,21) support.

Revision 1.792: download - view: text, markup, annotated - select for diffs
Tue Nov 21 23:09:40 2023 UTC (12 months, 2 weeks ago) by gutteridge
Branches: MAIN
Diff to: previous 1.791: preferred, colored
Changes since revision 1.791: +5 -5 lines
if_wm.c: fix spelling and grammar in a comment

Revision 1.508.4.53: download - view: text, markup, annotated - select for diffs
Wed Oct 18 14:41:54 2023 UTC (13 months, 3 weeks ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.52: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.52: +86 -34 lines
Pull up the following, requested by msaitoh in ticket #1915:

	sys/dev/pci/pcidevs			1.1497
	sys/dev/pci/if_wm.c			1.689,1.790-1.791 via patch
	sys/dev/pci/if_wmreg.h			1.120 via patch
	sys/dev/pci/if_wmvar.h			1.51

- Use 12K for packet buffer for jumbo frame on PCH2 and newer.
- Add new workaround for Tiger Lake and newer to avoid packet loss.
- Add I219{V,LM}({22,23}) devices (Raptor Lake).

Revision 1.645.2.19: download - view: text, markup, annotated - select for diffs
Wed Oct 18 14:29:18 2023 UTC (13 months, 3 weeks ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.18: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.18: +86 -35 lines
Pull up following revision(s) (requested by msaitoh in ticket #1754):

	sys/dev/pci/pcidevs: revision 1.1497
	sys/dev/pci/if_wm.c: revision 1.790
	sys/dev/pci/if_wm.c: revision 1.791
	sys/dev/pci/if_wmvar.h: revision 1.51

pcidevs: Add Intel I219{V,LM}({22,23})

wm(4): Add a new workaround for Tiger Lake and newer.
 - Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
   Note that we don't define WM_T_PCH_ADP because we have no any
   Alder Lake specific workaround yet.
 - Add new workaround for Tiger Lake (and newer) in wm_init_locked()
   to avoid packet loss.

wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).

Revision 1.767.2.5: download - view: text, markup, annotated - select for diffs
Wed Oct 18 14:27:38 2023 UTC (13 months, 3 weeks ago) by martin
Branches: netbsd-10
CVS tags: netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Diff to: previous 1.767.2.4: preferred, colored; branchpoint 1.767: preferred, colored
Changes since revision 1.767.2.4: +86 -35 lines
Pull up following revision(s) (requested by msaitoh in ticket #421):

	sys/dev/pci/pcidevs: revision 1.1497
	sys/dev/pci/if_wm.c: revision 1.790
	sys/dev/pci/if_wm.c: revision 1.791
	sys/dev/pci/if_wmvar.h: revision 1.51

pcidevs: Add Intel I219{V,LM}({22,23})

wm(4): Add a new workaround for Tiger Lake and newer.
 - Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
   Note that we don't define WM_T_PCH_ADP because we have no any
   Alder Lake specific workaround yet.
 - Add new workaround for Tiger Lake (and newer) in wm_init_locked()
   to avoid packet loss.

wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).

Revision 1.791: download - view: text, markup, annotated - select for diffs
Wed Oct 11 15:14:28 2023 UTC (14 months ago) by msaitoh
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation
Diff to: previous 1.790: preferred, colored
Changes since revision 1.790: +14 -2 lines
wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).

Revision 1.790: download - view: text, markup, annotated - select for diffs
Wed Oct 11 15:05:26 2023 UTC (14 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.789: preferred, colored
Changes since revision 1.789: +74 -35 lines
wm(4): Add a new workaround for Tiger Lake and newer.

 - Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
   Note that we don't define WM_T_PCH_ADP because we have no any
   Alder Lake specific workaround yet.
 - Add new workaround for Tiger Lake (and newer) in wm_init_locked()
   to avoid packet loss.

Revision 1.508.4.52: download - view: text, markup, annotated - select for diffs
Sun Oct 8 15:31:17 2023 UTC (14 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.51: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.51: +38 -34 lines
Pull up following revision(s) (requested by msaitoh in ticket #1910):

	sys/dev/pci/if_wm.c: revision 1.785
	sys/dev/pci/if_wm.c: revision 1.786
	sys/dev/pci/if_wm.c: revision 1.787
	sys/dev/pci/if_wm.c: revision 1.788
	sys/dev/pci/if_wm.c: revision 1.789

wm(4): Use SCVPC and HRMPC for 82575 and newer.
  The SCVPC(SerDes/SGMII Code Violation Packet Count) register and the HRMPC
  (Header Redirection Missed Packet Count) register were added in if_wm.c
  rev. 1.776 but the location in the code were incorrect. Fix them.

wm(4): Add some info to some event counters.
 - The difference between the RUC(Rx Undersize) and RFC(Rx Fragment) is whether
   the CRC is valid or not.
 - The difference between the ROC(Rx Oversize) and RJC(Rx Jabber) is whether
   the CRC is valid or not.
 - LENERRS(Length Errors) is for the length/type field <= 1500.

wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.

wm(4): Modify descriptions of flow control related event counters.

wm(4): Replace /* nothing */ to __nothing for evcnt macros
Prevent empty if bodies for !WM_EVENT_COUNTERS.

Revision 1.645.2.18: download - view: text, markup, annotated - select for diffs
Sun Oct 8 15:28:49 2023 UTC (14 months ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.17: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.17: +38 -34 lines
Pull up following revision(s) (requested by msaitoh in ticket #1746):

	sys/dev/pci/if_wm.c: revision 1.785
	sys/dev/pci/if_wm.c: revision 1.786
	sys/dev/pci/if_wm.c: revision 1.787
	sys/dev/pci/if_wm.c: revision 1.788
	sys/dev/pci/if_wm.c: revision 1.789

wm(4): Use SCVPC and HRMPC for 82575 and newer.
  The SCVPC(SerDes/SGMII Code Violation Packet Count) register and the HRMPC
  (Header Redirection Missed Packet Count) register were added in if_wm.c
  rev. 1.776 but the location in the code were incorrect. Fix them.

wm(4): Add some info to some event counters.
 - The difference between the RUC(Rx Undersize) and RFC(Rx Fragment) is whether
   the CRC is valid or not.
 - The difference between the ROC(Rx Oversize) and RJC(Rx Jabber) is whether
   the CRC is valid or not.
 - LENERRS(Length Errors) is for the length/type field <= 1500.

wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.

wm(4): Modify descriptions of flow control related event counters.

wm(4): Replace /* nothing */ to __nothing for evcnt macros
Prevent empty if bodies for !WM_EVENT_COUNTERS.

Revision 1.767.2.4: download - view: text, markup, annotated - select for diffs
Sun Oct 8 15:23:26 2023 UTC (14 months ago) by martin
Branches: netbsd-10
Diff to: previous 1.767.2.3: preferred, colored; branchpoint 1.767: preferred, colored
Changes since revision 1.767.2.3: +38 -34 lines
Pull up following revision(s) (requested by msaitoh in ticket #396):

	sys/dev/pci/if_wm.c: revision 1.785
	sys/dev/pci/if_wm.c: revision 1.786
	sys/dev/pci/if_wm.c: revision 1.787
	sys/dev/pci/if_wm.c: revision 1.788
	sys/dev/pci/if_wm.c: revision 1.789

wm(4): Use SCVPC and HRMPC for 82575 and newer.
  The SCVPC(SerDes/SGMII Code Violation Packet Count) register and the HRMPC
  (Header Redirection Missed Packet Count) register were added in if_wm.c
  rev. 1.776 but the location in the code were incorrect. Fix them.

wm(4): Add some info to some event counters.
 - The difference between the RUC(Rx Undersize) and RFC(Rx Fragment) is whether
   the CRC is valid or not.
 - The difference between the ROC(Rx Oversize) and RJC(Rx Jabber) is whether
   the CRC is valid or not.
 - LENERRS(Length Errors) is for the length/type field <= 1500.

wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.

wm(4): Modify descriptions of flow control related event counters.

wm(4): Replace /* nothing */ to __nothing for evcnt macros
Prevent empty if bodies for !WM_EVENT_COUNTERS.

Revision 1.789: download - view: text, markup, annotated - select for diffs
Mon Sep 25 09:15:48 2023 UTC (14 months, 2 weeks ago) by rin
Branches: MAIN
Diff to: previous 1.788: preferred, colored
Changes since revision 1.788: +9 -9 lines
wm(4): Replace /* nothing */ to __nothing for evcnt macros

Prevent empty if bodies for !WM_EVENT_COUNTERS.

Revision 1.788: download - view: text, markup, annotated - select for diffs
Mon Sep 25 08:18:13 2023 UTC (14 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.787: preferred, colored
Changes since revision 1.787: +7 -7 lines
wm(4): Modify descriptions of flow control related event counters.

Revision 1.787: download - view: text, markup, annotated - select for diffs
Mon Sep 25 07:12:25 2023 UTC (14 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.786: preferred, colored
Changes since revision 1.786: +11 -7 lines
wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.

Revision 1.786: download - view: text, markup, annotated - select for diffs
Mon Sep 25 07:11:08 2023 UTC (14 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.785: preferred, colored
Changes since revision 1.785: +7 -7 lines
wm(4): Add some info to some event counters.

 - The difference between the RUC(Rx Undersize) and RFC(Rx Fragment) is whether
   the CRC is valid or not.
 - The difference between the ROC(Rx Oversize) and RJC(Rx Jabber) is whether
   the CRC is valid or not.
 - LENERRS(Length Errors) is for the length/type field <= 1500.

Revision 1.785: download - view: text, markup, annotated - select for diffs
Mon Sep 25 06:18:09 2023 UTC (14 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.784: preferred, colored
Changes since revision 1.784: +12 -12 lines
wm(4): Use SCVPC and HRMPC for 82575 and newer.

  The SCVPC(SerDes/SGMII Code Violation Packet Count) register and the HRMPC
  (Header Redirection Missed Packet Count) register were added in if_wm.c
  rev. 1.776 but the location in the code were incorrect. Fix them.

Revision 1.508.4.51: download - view: text, markup, annotated - select for diffs
Mon Sep 4 17:57:49 2023 UTC (15 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.50: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.50: +127 -26 lines
Pull up following revision(s) (requested by msaitoh in ticket #1894):

	sys/dev/pci/if_wmvar.h: revision 1.50
	sys/dev/pci/if_wm.c: revision 1.783,1.784 via patch

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

 Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.

Revision 1.645.2.17: download - view: text, markup, annotated - select for diffs
Mon Sep 4 17:55:24 2023 UTC (15 months ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.16: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.16: +142 -28 lines
Pull up following revision(s) (requested by msaitoh in ticket #344):

	sys/dev/pci/if_wmvar.h: revision 1.50
	sys/dev/pci/if_wm.c: revision 1.783,1.784 via patch

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

 Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.

Revision 1.767.2.3: download - view: text, markup, annotated - select for diffs
Mon Sep 4 17:45:24 2023 UTC (15 months ago) by martin
Branches: netbsd-10
Diff to: previous 1.767.2.2: preferred, colored; branchpoint 1.767: preferred, colored
Changes since revision 1.767.2.2: +142 -28 lines
Pull up following revision(s) (requested by msaitoh in ticket #344):

	sys/dev/pci/if_wmvar.h: revision 1.50
	sys/dev/pci/if_wm.c: revision 1.783
	sys/dev/pci/if_wm.c: revision 1.784

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

 Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.

Revision 1.784: download - view: text, markup, annotated - select for diffs
Fri Aug 25 09:38:50 2023 UTC (15 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.783: preferred, colored
Changes since revision 1.783: +26 -22 lines
Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.

Revision 1.783: download - view: text, markup, annotated - select for diffs
Fri Aug 25 08:14:14 2023 UTC (15 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.782: preferred, colored
Changes since revision 1.782: +118 -8 lines
Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

 Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Revision 1.508.4.50: download - view: text, markup, annotated - select for diffs
Tue Jun 27 18:36:53 2023 UTC (17 months, 2 weeks ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.49: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.49: +645 -261 lines
Pull up the following revisions, requested by msaitoh in #1847:

	sys/dev/pci/if_wm.c				1.768-1.782 via patch
	sys/dev/pci/if_wmreg.h				1.129-1.130
	sys/dev/pci/if_wmvar.h				1.49

wm(4):
- Rework for event counters:
  - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
  - Rearrange the order of the registers so that they are roughly
    in ascending order.
  - Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach()
    to match.
  - IC{TX,RX}*C registers are for older than 82575.
  - Fix a bug that the transmit underrun counter is incorrectly
    counted.
  - Don't add "Count" for event counter's description.
  - Some statistics registers were replaced with new counters on newer
    chips. Treat 0x403c(CEXTERR->HTDPMC), 0x40fc(TSCTFC->CBRMPC),
    0x4124(ICRXOC->HTCBDPC) and from 0x4104 to 0x4124.
  - Add some new counters:
    - Circuit Breaker TX Manageability Packet
    - Circuit Breaker RX Dropped Packet
    - Host Good Octets RX
    - Host Good Octets TX
    - Length Errors
    - SerDes/SGMII Code Violation Packet
    - Header Redirection Missed Packet
    - EEE TX LPI
    - EEE RX LPI
  - Fix prc511's comment and description.
- Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
- Use WM_IS_ICHPCH(). No functional change.
- Fix typo. s/ictxact/ictxatc/. No functional change.
- Add comment.

Revision 1.645.2.16: download - view: text, markup, annotated - select for diffs
Tue Jun 27 18:32:46 2023 UTC (17 months, 2 weeks ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.15: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.15: +648 -261 lines
Pull up the following revisions, requested by msaitoh in #1656:

	sys/dev/pci/if_wm.c				1.768-1.782 via patch
	sys/dev/pci/if_wmreg.h				1.129-1.130
	sys/dev/pci/if_wmvar.h				1.49

wm(4):
- Rework for event counters:
  - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
  - Rearrange the order of the registers so that they are roughly
    in ascending order.
  - Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach()
    to match.
  - IC{TX,RX}*C registers are for older than 82575.
  - Fix a bug that the transmit underrun counter is incorrectly
    counted.
  - Don't add "Count" for event counter's description.
  - Some statistics registers were replaced with new counters on newer
    chips. Treat 0x403c(CEXTERR->HTDPMC), 0x40fc(TSCTFC->CBRMPC),
    0x4124(ICRXOC->HTCBDPC) and from 0x4104 to 0x4124.
  - Add some new counters:
    - Circuit Breaker TX Manageability Packet
    - Circuit Breaker RX Dropped Packet
    - Host Good Octets RX
    - Host Good Octets TX
    - Length Errors
    - SerDes/SGMII Code Violation Packet
    - Header Redirection Missed Packet
    - EEE TX LPI
    - EEE RX LPI
  - Fix prc511's comment and description.
- Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
- Use WM_IS_ICHPCH(). No functional change.
- Fix typo. s/ictxact/ictxatc/. No functional change.
- Add comment.

Revision 1.767.2.2: download - view: text, markup, annotated - select for diffs
Tue Jun 27 18:24:18 2023 UTC (17 months, 2 weeks ago) by martin
Branches: netbsd-10
Diff to: previous 1.767.2.1: preferred, colored; branchpoint 1.767: preferred, colored
Changes since revision 1.767.2.1: +4 -2 lines
Pull up following revision(s) (requested by msaitoh in ticket #216):

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

Add missing read to count Circuit Breaker Rx Dropped Packet correctly.

Revision 1.782: download - view: text, markup, annotated - select for diffs
Fri Jun 23 05:36:28 2023 UTC (17 months, 2 weeks ago) by msaitoh
Branches: MAIN
Diff to: previous 1.781: preferred, colored
Changes since revision 1.781: +4 -2 lines
Add missing read to count Circuit Breaker Rx Dropped Packet correctly.

Revision 1.767.2.1: download - view: text, markup, annotated - select for diffs
Thu Jun 22 08:14:35 2023 UTC (17 months, 2 weeks ago) by martin
Branches: netbsd-10
Diff to: previous 1.767: preferred, colored
Changes since revision 1.767: +646 -261 lines
Pull up following revision(s) (requested by msaitoh in ticket #213):

	sys/dev/pci/if_wm.c: revision 1.770
	sys/dev/pci/if_wm.c: revision 1.771
	sys/dev/pci/if_wm.c: revision 1.772
	sys/dev/pci/if_wm.c: revision 1.773
	sys/dev/pci/if_wm.c: revision 1.774
	sys/dev/pci/if_wm.c: revision 1.775
	sys/dev/pci/if_wm.c: revision 1.776
	sys/dev/pci/if_wmreg.h: revision 1.129
	sys/dev/pci/if_wm.c: revision 1.777
	sys/dev/pci/if_wm.c: revision 1.778
	sys/dev/pci/if_wmvar.h: revision 1.49
	sys/dev/pci/if_wm.c: revision 1.779
	sys/dev/pci/if_wm.c: revision 1.768
	sys/dev/pci/if_wm.c: revision 1.769
	sys/dev/pci/if_wmreg.h: revision 1.130
	sys/dev/pci/if_wm.c: revision 1.780
	sys/dev/pci/if_wm.c: revision 1.781

Count some 64bit counters correctly.
 - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
 - Found by knakahara.

Add note for the TORL register.

The TOR register includes error, flow control and broadcast rejected.

Sort lines. No functional change.

 Rearrange the order of the registers so that they are roughly in ascending
order.

Sort lines. No functional change.

Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach() to match.
IC{TX,RX}*C registers are for older than 82575.

Fix a bug that the transmit underrun counter is incorrectly counted.
 The transmit underrun bit in the transmit status filed is only for 82544
(and older?), so don't use the counter for newer chips. The bit is reserved
for newer chips, but the bit sometimes set on 82575 at least.

Don't add "Count" for event counter's description.

 Some statistics registers were replaced with new counters.
 - 0x403c was CEXTERR(Carrier Extension Error). 82575 and newer except 80003,
   ICHs and PCHs have HTDPMC(Host Tx Discarded Packets by MAC). I don't really
   know for 82575. The 82575 datasheet say nothing about it.
 - The following two are changed for circuit breaker. Only 82576's datasheet
   describes abut it, so the registers might be only for 82576.
   Use those registers for 82575 and newer except 80003, ICHs and PCHs just in
   case.
   - 0x40fc was TSCTFC(TCP Segmentation Context Tx Fail). It was replaced by
     the CBRMPC(Circuit Breaker Rx Manageability Packet) register.
   - 0x4124 was ICRXOC(Interrupt Cause Receiver Overrun). It was replaced by
     the HTCBDPC(Host Tx Circuit Breaker Dropped Packet) register.
 - From 0x4104 to 0x4124:
   - For 0x4124, 82575's datasheet says it's not changed(ICRXOC).
     I don't know if it's correct. We use new HTCBDPC register for 82575.
   - 82576 and newer changed the meaning.
   - I don't know for 80003, ICHs and PCHs. Don't count those registers.
     At least, those registers in PCH2 and PCH_CNP are all zero.

Add some new event counters.

Add the following counters for 82575 and newer except 80003, ICHs and PCHs:
    - Only 82576 document describes about the circuit breaker,
      so the following two might be only for 82575:
        - Circuit Breaker TX Manageability Packet
        - Circuit Breaker RX Dropped Packet
    - 82575's document doesn't describe the following two, but we can see
      the same value as GO{T,R}C have:
        - Host Good Octets RX
        - Host Good Octets TX
    - 82575's document doesn't describe the LENERRS (Length Errors) counter.
      I don't know if it has.
    - Perhaps Non-SerDes/SGMII devices don't have SCVPC
      (SerDes/SGMII Code Violation Packet) register. We don't care if
      it's SerDes/SGMII or not for now.
    - HRMPC (Header Redirection Missed Packet) appears only once
      in 8257[56]'s datasheet. FreeBSD's igb counts it, so we do, too.
    - Count the following two for I350 and newer. I don't know if PCHs have:
        - EEE TX LPI
        - EEE RX LPI

 Move statistics updating code from wm_tick() to new wm_update_stats().
 - To reuse.
 - No functional change.

Add SOICZIFDATA (ifconfig -z) support for evcnt(9).

 First update the statistics data, then clear the event counters,
and finally copy and clear if_data via ether_ioctl().

Fix prc511's comment and description.

 Use WM_IS_ICHPCH(). No functional change.

Fix typo. s/ictxact/ictxatc/. No functional change.

Revision 1.508.4.49: download - view: text, markup, annotated - select for diffs
Wed Jun 21 21:29:57 2023 UTC (17 months, 2 weeks ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.48: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.48: +4 -4 lines
Apply patch, requested by riastradh in ticket #1842:

	sys/dev/pci/if_wm.c			(apply patch)

Fix a bug introduced in ticket #1795.

Revision 1.781: download - view: text, markup, annotated - select for diffs
Thu May 11 07:47:14 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.780: preferred, colored
Changes since revision 1.780: +7 -7 lines
Fix typo. s/ictxact/ictxatc/. No functional change.

Revision 1.780: download - view: text, markup, annotated - select for diffs
Thu May 11 07:45:04 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.779: preferred, colored
Changes since revision 1.779: +3 -3 lines
 Use WM_IS_ICHPCH(). No functional change.

Revision 1.779: download - view: text, markup, annotated - select for diffs
Thu May 11 07:43:11 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.778: preferred, colored
Changes since revision 1.778: +4 -4 lines
Fix prc511's comment and description.

Revision 1.778: download - view: text, markup, annotated - select for diffs
Thu May 11 07:38:30 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.777: preferred, colored
Changes since revision 1.777: +184 -2 lines
Add SOICZIFDATA (ifconfig -z) support for evcnt(9).

 First update the statistics data, then clear the event counters,
and finally copy and clear if_data via ether_ioctl().

Revision 1.777: download - view: text, markup, annotated - select for diffs
Thu May 11 07:27:09 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.776: preferred, colored
Changes since revision 1.776: +187 -178 lines
 Move statistics updating code from wm_tick() to new wm_update_stats().

 - To reuse.
 - No functional change.

Revision 1.776: download - view: text, markup, annotated - select for diffs
Thu May 11 07:19:02 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.775: preferred, colored
Changes since revision 1.775: +82 -16 lines
Add some new event counters.

Add the following counters for 82575 and newer except 80003, ICHs and PCHs:
    - Only 82576 document describes about the circuit breaker,
      so the following two might be only for 82575:
        - Circuit Breaker TX Manageability Packet
        - Circuit Breaker RX Dropped Packet
    - 82575's document doesn't describe the following two, but we can see
      the same value as GO{T,R}C have:
        - Host Good Octets RX
        - Host Good Octets TX
    - 82575's document doesn't describe the LENERRS (Length Errors) counter.
      I don't know if it has.
    - Perhaps Non-SerDes/SGMII devices don't have SCVPC
      (SerDes/SGMII Code Violation Packet) register. We don't care if
      it's SerDes/SGMII or not for now.
    - HRMPC (Header Redirection Missed Packet) appears only once
      in 8257[56]'s datasheet. FreeBSD's igb counts it, so we do, too.
    - Count the following two for I350 and newer. I don't know if PCHs have:
        - EEE TX LPI
        - EEE RX LPI

Revision 1.775: download - view: text, markup, annotated - select for diffs
Thu May 11 07:14:46 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.774: preferred, colored
Changes since revision 1.774: +128 -16 lines
 Some statistics registers were replaced with new counters.

 - 0x403c was CEXTERR(Carrier Extension Error). 82575 and newer except 80003,
   ICHs and PCHs have HTDPMC(Host Tx Discarded Packets by MAC). I don't really
   know for 82575. The 82575 datasheet say nothing about it.
 - The following two are changed for circuit breaker. Only 82576's datasheet
   describes abut it, so the registers might be only for 82576.
   Use those registers for 82575 and newer except 80003, ICHs and PCHs just in
   case.
   - 0x40fc was TSCTFC(TCP Segmentation Context Tx Fail). It was replaced by
     the CBRMPC(Circuit Breaker Rx Manageability Packet) register.
   - 0x4124 was ICRXOC(Interrupt Cause Receiver Overrun). It was replaced by
     the HTCBDPC(Host Tx Circuit Breaker Dropped Packet) register.
 - From 0x4104 to 0x4124:
   - For 0x4124, 82575's datasheet says it's not changed(ICRXOC).
     I don't know if it's correct. We use new HTCBDPC register for 82575.
   - 82576 and newer changed the meaning.
   - I don't know for 80003, ICHs and PCHs. Don't count those registers.
     At least, those registers in PCH2 and PCH_CNP are all zero.

Revision 1.774: download - view: text, markup, annotated - select for diffs
Thu May 11 07:08:47 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.773: preferred, colored
Changes since revision 1.773: +4 -4 lines
Don't add "Count" for event counter's description.

Revision 1.773: download - view: text, markup, annotated - select for diffs
Thu May 11 07:07:08 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.772: preferred, colored
Changes since revision 1.772: +8 -11 lines
Fix a bug that the transmit underrun counter is incorrectly counted.

 The transmit underrun bit in the transmit status filed is only for 82544
(and older?), so don't use the counter for newer chips. The bit is reserved
for newer chips, but the bit sometimes set on 82575 at least.

Revision 1.772: download - view: text, markup, annotated - select for diffs
Thu May 11 07:04:06 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.771: preferred, colored
Changes since revision 1.771: +42 -35 lines
IC{TX,RX}*C registers are for older than 82575.

Revision 1.771: download - view: text, markup, annotated - select for diffs
Thu May 11 07:01:57 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.770: preferred, colored
Changes since revision 1.770: +98 -98 lines
Sort lines. No functional change.

Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach() to match.

Revision 1.770: download - view: text, markup, annotated - select for diffs
Thu May 11 06:59:31 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.769: preferred, colored
Changes since revision 1.769: +36 -35 lines
Sort lines. No functional change.

 Rearrange the order of the registers so that they are roughly in ascending
order.

Revision 1.769: download - view: text, markup, annotated - select for diffs
Thu May 11 06:56:49 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.768: preferred, colored
Changes since revision 1.768: +9 -2 lines
Add note for the TORL register.

The TOR register includes error, flow control and broadcast rejected.

Revision 1.768: download - view: text, markup, annotated - select for diffs
Thu May 11 06:54:23 2023 UTC (19 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.767: preferred, colored
Changes since revision 1.767: +10 -6 lines
Count some 64bit counters correctly.

 - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
 - Found by knakahara.

Revision 1.508.4.48: download - view: text, markup, annotated - select for diffs
Mon Jan 23 14:01:25 2023 UTC (22 months, 2 weeks ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.47: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.47: +62 -47 lines
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 - view: text, markup, annotated - select for diffs
Mon Jan 23 13:59:04 2023 UTC (22 months, 2 weeks ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.14: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.14: +62 -47 lines
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 - view: text, markup, annotated - select for diffs
Thu Dec 8 08:14:28 2022 UTC (2 years ago) by knakahara
Branches: MAIN
CVS tags: netbsd-10-base
Branch point for: netbsd-10
Diff to: previous 1.766: preferred, colored
Changes since revision 1.766: +13 -6 lines
Workaround for some hypervisor environments.

The environments cannot stop e1000 interrupt immediately.

Revision 1.766: download - view: text, markup, annotated - select for diffs
Wed Oct 26 06:36:39 2022 UTC (2 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.765: preferred, colored
Changes since revision 1.765: +7 -2 lines
Add comment to ICH/PCH's lock stuff in wm_reset().

Revision 1.765: download - view: text, markup, annotated - select for diffs
Wed Oct 19 06:37:25 2022 UTC (2 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.764: preferred, colored
Changes since revision 1.764: +6 -6 lines
Fix typo. No functional change. OK'd by knakahara.

Revision 1.508.4.47: download - view: text, markup, annotated - select for diffs
Thu Sep 8 10:29:36 2022 UTC (2 years, 3 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.46: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.46: +17 -17 lines
Undo accidental whitespace changes from applying the patch for
ticket #1759 by applying a patch from msaitoh (NFC).

Revision 1.764: download - view: text, markup, annotated - select for diffs
Thu Sep 8 02:40:10 2022 UTC (2 years, 3 months ago) by msaitoh
Branches: MAIN
CVS tags: bouyer-sunxi-drm-base, bouyer-sunxi-drm
Diff to: previous 1.763: preferred, colored
Changes since revision 1.763: +46 -43 lines
KNF. Modify comment. No fucntional change.

Revision 1.508.4.46: download - view: text, markup, annotated - select for diffs
Wed Sep 7 10:09:20 2022 UTC (2 years, 3 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.45: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.45: +488 -93 lines
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 - view: text, markup, annotated - select for diffs
Wed Sep 7 10:05:42 2022 UTC (2 years, 3 months ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.13: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.13: +552 -138 lines
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 - view: text, markup, annotated - select for diffs
Fri Aug 12 10:59:42 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.762: preferred, colored
Changes since revision 1.762: +41 -94 lines
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 - view: text, markup, annotated - select for diffs
Fri Aug 12 10:58:45 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.761: preferred, colored
Changes since revision 1.761: +24 -12 lines
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 - view: text, markup, annotated - select for diffs
Fri Aug 12 10:58:21 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.760: preferred, colored
Changes since revision 1.760: +76 -21 lines
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 - view: text, markup, annotated - select for diffs
Fri Aug 12 10:57:06 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.759: preferred, colored
Changes since revision 1.759: +26 -9 lines
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 - view: text, markup, annotated - select for diffs
Fri Aug 12 10:55:01 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.758: preferred, colored
Changes since revision 1.758: +7 -15 lines
wm(4): Revert previous -- mistakenly committed unsquashed change part.

Revision 1.758: download - view: text, markup, annotated - select for diffs
Fri Aug 12 10:50:37 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.757: preferred, colored
Changes since revision 1.757: +17 -9 lines
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 - view: text, markup, annotated - select for diffs
Mon Aug 8 08:55:42 2022 UTC (2 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.756: preferred, colored
Changes since revision 1.756: +29 -9 lines
To avoid releasing mutex temporally, use new wm_set_mdio_slow_mode_hv_locked().

Revision 1.756: download - view: text, markup, annotated - select for diffs
Mon Aug 8 08:52:36 2022 UTC (2 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.755: preferred, colored
Changes since revision 1.755: +9 -9 lines
Consistency use -1 instead of 1 for some error code. Advised by knakahara.

Revision 1.755: download - view: text, markup, annotated - select for diffs
Mon Aug 8 07:49:18 2022 UTC (2 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.754: preferred, colored
Changes since revision 1.754: +5 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Aug 8 07:44:40 2022 UTC (2 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.753: preferred, colored
Changes since revision 1.753: +84 -61 lines
Pass an error code to the upper layer instead of -1. Advised by knakahara.

Revision 1.753: download - view: text, markup, annotated - select for diffs
Mon Aug 8 05:45:29 2022 UTC (2 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.752: preferred, colored
Changes since revision 1.752: +4 -4 lines
Modify debug messages so that we can determine where it happened.

Revision 1.752: download - view: text, markup, annotated - select for diffs
Fri Aug 5 05:50:54 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.751: preferred, colored
Changes since revision 1.751: +5 -5 lines
Sprinkle const on splfoo call results.

Revision 1.751: download - view: text, markup, annotated - select for diffs
Wed Aug 3 05:29:04 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.750: preferred, colored
Changes since revision 1.750: +18 -10 lines
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 - view: text, markup, annotated - select for diffs
Wed Aug 3 05:23:30 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.749: preferred, colored
Changes since revision 1.749: +15 -4 lines
Add some KASSERTs around the locking protocol.

Discussed with msaitoh@, knakahara@ and riastradh@

Revision 1.749: download - view: text, markup, annotated - select for diffs
Fri Jul 29 15:30:42 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.748: preferred, colored
Changes since revision 1.748: +4 -4 lines
Improve a couple of comments

Revision 1.748: download - view: text, markup, annotated - select for diffs
Fri Jul 29 15:29:07 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.747: preferred, colored
Changes since revision 1.747: +3 -3 lines
Trailing whitespace

Revision 1.747: download - view: text, markup, annotated - select for diffs
Thu Jul 28 09:22:25 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.746: preferred, colored
Changes since revision 1.746: +3 -3 lines
KNF the KNF

Revision 1.746: download - view: text, markup, annotated - select for diffs
Fri Jul 22 05:23:50 2022 UTC (2 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.745: preferred, colored
Changes since revision 1.745: +390 -28 lines
Add more statistics countes.

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

Revision 1.745: download - view: text, markup, annotated - select for diffs
Tue Jul 19 08:22:34 2022 UTC (2 years, 4 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.744: preferred, colored
Changes since revision 1.744: +3 -4 lines
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 - view: text, markup, annotated - select for diffs
Tue Jul 19 08:21:02 2022 UTC (2 years, 4 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.743: preferred, colored
Changes since revision 1.743: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Tue Jul 19 06:50:34 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.742: preferred, colored
Changes since revision 1.742: +15 -15 lines
KNF

Revision 1.742: download - view: text, markup, annotated - select for diffs
Tue Jul 19 06:47:34 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.741: preferred, colored
Changes since revision 1.741: +2 -3 lines
Don't need sys/malloc.h so remove the #include

Revision 1.741: download - view: text, markup, annotated - select for diffs
Tue Jul 19 06:46:29 2022 UTC (2 years, 4 months ago) by skrll
Branches: MAIN
Diff to: previous 1.740: preferred, colored
Changes since revision 1.740: +3 -7 lines
Turn a locking botch (shouldn't drop lock on error) into a KASSERT

Revision 1.508.4.45: download - view: text, markup, annotated - select for diffs
Mon Jul 11 14:15:57 2022 UTC (2 years, 5 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.44: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.44: +181 -153 lines
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 - view: text, markup, annotated - select for diffs
Mon Jul 11 14:10:18 2022 UTC (2 years, 5 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-3-RELEASE
Diff to: previous 1.645.2.12: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.12: +185 -155 lines
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 - view: text, markup, annotated - select for diffs
Mon Jul 11 06:16:23 2022 UTC (2 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.739: preferred, colored
Changes since revision 1.739: +50 -43 lines
KNF. No functional change.

Revision 1.739: download - view: text, markup, annotated - select for diffs
Mon Jul 11 06:15:27 2022 UTC (2 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.738: preferred, colored
Changes since revision 1.738: +25 -25 lines
Consistently use semicolon. No functional change.

Revision 1.738: download - view: text, markup, annotated - select for diffs
Wed Jul 6 06:33:49 2022 UTC (2 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.737: preferred, colored
Changes since revision 1.737: +25 -24 lines
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 - view: text, markup, annotated - select for diffs
Wed Jul 6 05:49:46 2022 UTC (2 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.736: preferred, colored
Changes since revision 1.736: +5 -4 lines
Fix compile error if WM_DEBUG is set.

Revision 1.736: download - view: text, markup, annotated - select for diffs
Mon Jul 4 15:09:12 2022 UTC (2 years, 5 months ago) by skrll
Branches: MAIN
Diff to: previous 1.735: preferred, colored
Changes since revision 1.735: +4 -3 lines
Be less tautological and more explanatory in a comment.

Revision 1.735: download - view: text, markup, annotated - select for diffs
Sat Jul 2 06:10:29 2022 UTC (2 years, 5 months ago) by skrll
Branches: MAIN
Diff to: previous 1.734: preferred, colored
Changes since revision 1.734: +6 -6 lines
Use PRIxBIT instead of casts

Revision 1.734: download - view: text, markup, annotated - select for diffs
Sat Jul 2 06:09:37 2022 UTC (2 years, 5 months ago) by skrll
Branches: MAIN
Diff to: previous 1.733: preferred, colored
Changes since revision 1.733: +5 -2 lines
wm_tick: Add missing splx(s) when not WM_MPSAFE

Revision 1.733: download - view: text, markup, annotated - select for diffs
Thu May 19 02:23:59 2022 UTC (2 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.732: preferred, colored
Changes since revision 1.732: +18 -18 lines
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 - view: text, markup, annotated - select for diffs
Thu May 19 02:22:59 2022 UTC (2 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.731: preferred, colored
Changes since revision 1.731: +26 -14 lines
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 - view: text, markup, annotated - select for diffs
Tue May 17 00:02:57 2022 UTC (2 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.730: preferred, colored
Changes since revision 1.730: +8 -6 lines
Call m_freem(m) only if m0 == NULL.

Revision 1.730: download - view: text, markup, annotated - select for diffs
Tue May 3 00:23:33 2022 UTC (2 years, 7 months ago) by gutteridge
Branches: MAIN
Diff to: previous 1.729: preferred, colored
Changes since revision 1.729: +29 -29 lines
if_wm.c: various spelling and grammar fixes

Revision 1.729: download - view: text, markup, annotated - select for diffs
Sat Feb 26 15:04:39 2022 UTC (2 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.728: preferred, colored
Changes since revision 1.728: +6 -4 lines
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 - view: text, markup, annotated - select for diffs
Sat Feb 26 14:53:05 2022 UTC (2 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.727: preferred, colored
Changes since revision 1.727: +6 -6 lines
if_wm.c: remove stray semicolons from struct declaration

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

No binary change.

Revision 1.727: download - view: text, markup, annotated - select for diffs
Wed Feb 16 03:15:27 2022 UTC (2 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.726: preferred, colored
Changes since revision 1.726: +2 -3 lines
Remove duplicated break. No functional change.

Revision 1.726: download - view: text, markup, annotated - select for diffs
Fri Dec 31 14:25:23 2021 UTC (2 years, 11 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.725: preferred, colored
Changes since revision 1.725: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Thu Dec 23 17:05:49 2021 UTC (2 years, 11 months ago) by hannken
Branches: MAIN
Diff to: previous 1.724: preferred, colored
Changes since revision 1.724: +4 -4 lines
Keep constants 32 bit, why does __BIT() return uintmax_t?

Revision 1.724: download - view: text, markup, annotated - select for diffs
Mon Dec 20 13:19:09 2021 UTC (2 years, 11 months ago) by skrll
Branches: MAIN
Diff to: previous 1.723: preferred, colored
Changes since revision 1.723: +7 -4 lines
aprint_verbose the DMA range used.

Revision 1.723: download - view: text, markup, annotated - select for diffs
Mon Dec 20 12:56:25 2021 UTC (2 years, 11 months ago) by skrll
Branches: MAIN
Diff to: previous 1.722: preferred, colored
Changes since revision 1.722: +3 -3 lines
whitespace in a comment

Revision 1.722: download - view: text, markup, annotated - select for diffs
Sat Dec 11 17:05:50 2021 UTC (3 years ago) by skrll
Branches: MAIN
Diff to: previous 1.721: preferred, colored
Changes since revision 1.721: +3 -3 lines
Typo in comment

Revision 1.721: download - view: text, markup, annotated - select for diffs
Fri Dec 10 05:55:06 2021 UTC (3 years ago) by skrll
Branches: MAIN
Diff to: previous 1.720: preferred, colored
Changes since revision 1.720: +4 -7 lines
Simplify.  Same code before and after.

Revision 1.720: download - view: text, markup, annotated - select for diffs
Fri Dec 10 05:39:22 2021 UTC (3 years ago) by skrll
Branches: MAIN
Diff to: previous 1.719: preferred, colored
Changes since revision 1.719: +9 -9 lines
Trailing whitespace

Revision 1.719: download - view: text, markup, annotated - select for diffs
Sun Dec 5 04:32:36 2021 UTC (3 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.718: preferred, colored
Changes since revision 1.718: +3 -3 lines
s/checkum/checksum/ in comment.

Revision 1.508.4.44: download - view: text, markup, annotated - select for diffs
Sat Nov 20 15:11:31 2021 UTC (3 years ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.43: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.43: +115 -18 lines
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 - view: text, markup, annotated - select for diffs
Sat Nov 20 14:59:04 2021 UTC (3 years ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.11: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.11: +115 -18 lines
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 - view: text, markup, annotated - select for diffs
Fri Nov 5 05:52:49 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.717: preferred, colored
Changes since revision 1.717: +30 -14 lines
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 - view: text, markup, annotated - select for diffs
Fri Nov 5 01:49:14 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.716: preferred, colored
Changes since revision 1.716: +4 -4 lines
 Use macro. No functional change.

Revision 1.716: download - view: text, markup, annotated - select for diffs
Thu Nov 4 12:25:05 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.715: preferred, colored
Changes since revision 1.715: +84 -3 lines
Add some sysctl info for debugging.

Revision 1.508.4.43: download - view: text, markup, annotated - select for diffs
Sat Oct 23 11:49:22 2021 UTC (3 years, 1 month ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.42: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.42: +523 -341 lines
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 - view: text, markup, annotated - select for diffs
Thu Oct 21 14:30:10 2021 UTC (3 years, 1 month ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.10: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.10: +511 -319 lines
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 - view: text, markup, annotated - select for diffs
Wed Oct 20 08:10:26 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.714: preferred, colored
Changes since revision 1.714: +8 -4 lines
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 - view: text, markup, annotated - select for diffs
Wed Oct 20 08:06:45 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.713: preferred, colored
Changes since revision 1.713: +7 -4 lines
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 - view: text, markup, annotated - select for diffs
Wed Oct 20 08:02:07 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.712: preferred, colored
Changes since revision 1.712: +24 -7 lines
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 - view: text, markup, annotated - select for diffs
Wed Oct 20 07:04:28 2021 UTC (3 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.711: preferred, colored
Changes since revision 1.711: +7 -7 lines
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 - view: text, markup, annotated - select for diffs
Wed Oct 20 02:12:36 2021 UTC (3 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.710: preferred, colored
Changes since revision 1.710: +61 -64 lines
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 - view: text, markup, annotated - select for diffs
Wed Oct 20 02:05:15 2021 UTC (3 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.709: preferred, colored
Changes since revision 1.709: +5 -2 lines
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 - view: text, markup, annotated - select for diffs
Mon Oct 18 11:36:11 2021 UTC (3 years, 1 month ago) by jmcneill
Branches: MAIN
Diff to: previous 1.708: preferred, colored
Changes since revision 1.708: +11 -4 lines
Only print an error about missing I/O BARs for chips that need it.

Revision 1.708: download - view: text, markup, annotated - select for diffs
Wed Oct 13 08:12:36 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.707: preferred, colored
Changes since revision 1.707: +29 -2 lines
Add support for I219V 15-19 and I219LM 16-19.

Revision 1.707: download - view: text, markup, annotated - select for diffs
Wed Oct 13 08:09:46 2021 UTC (3 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.706: preferred, colored
Changes since revision 1.706: +28 -28 lines
Print I219's version number.

Revision 1.706: download - view: text, markup, annotated - select for diffs
Tue Aug 3 01:08:18 2021 UTC (3 years, 4 months ago) by knakahara
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-futex2-base, thorpej-futex2
Diff to: previous 1.705: preferred, colored
Changes since revision 1.705: +29 -5 lines
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 - view: text, markup, annotated - select for diffs
Thu Jun 17 04:46:29 2021 UTC (3 years, 5 months ago) by thorpej
Branches: thorpej-i2c-spi-conf
Diff to: previous 1.702.4.1: preferred, colored; branchpoint 1.702: preferred, colored; next MAIN 1.703: preferred, colored
Changes since revision 1.702.4.1: +3 -8 lines
Sync w/ HEAD.

Revision 1.705: download - view: text, markup, annotated - select for diffs
Wed Jun 16 00:21:18 2021 UTC (3 years, 5 months ago) by riastradh
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf-base, thorpej-cfargs2-base, thorpej-cfargs2
Diff to: previous 1.704: preferred, colored
Changes since revision 1.704: +3 -8 lines
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 - view: text, markup, annotated - select for diffs
Mon May 31 22:15:18 2021 UTC (3 years, 6 months ago) by cjep
Branches: cjep_staticlib_x
Diff to: previous 1.703: preferred, colored; next MAIN 1.704: preferred, colored
Changes since revision 1.703: +10 -2 lines
sync with head

Revision 1.702.4.1: download - view: text, markup, annotated - select for diffs
Thu May 13 00:47:31 2021 UTC (3 years, 6 months ago) by thorpej
Branches: thorpej-i2c-spi-conf
Diff to: previous 1.702: preferred, colored
Changes since revision 1.702: +11 -3 lines
Sync with HEAD.

Revision 1.704: download - view: text, markup, annotated - select for diffs
Wed May 12 10:16:12 2021 UTC (3 years, 7 months ago) by knakahara
Branches: MAIN
CVS tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1
Diff to: previous 1.703: preferred, colored
Changes since revision 1.703: +10 -2 lines
Fix i386 build failure with options WM_EVENT_COUNTERS.

pointed out by msaitoh@n.o.

Revision 1.703: download - view: text, markup, annotated - select for diffs
Mon May 3 07:43:31 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
CVS tags: cjep_staticlib_x-base
Branch point for: cjep_staticlib_x
Diff to: previous 1.702: preferred, colored
Changes since revision 1.702: +3 -3 lines
if_wm: do not return a void value from a void function

This is a GCC extension.

Revision 1.694.2.2: download - view: text, markup, annotated - select for diffs
Sat Apr 3 22:28:46 2021 UTC (3 years, 8 months ago) by thorpej
Branches: thorpej-futex
Diff to: previous 1.694.2.1: preferred, colored; next MAIN 1.695: preferred, colored
Changes since revision 1.694.2.1: +30 -34 lines
Sync with HEAD.

Revision 1.702: download - view: text, markup, annotated - select for diffs
Thu Mar 11 01:23:33 2021 UTC (3 years, 9 months ago) by msaitoh
Branches: MAIN
CVS tags: thorpej-futex-base, thorpej-cfargs-base, thorpej-cfargs
Branch point for: thorpej-i2c-spi-conf
Diff to: previous 1.701: preferred, colored
Changes since revision 1.701: +16 -17 lines
Whitespace fixes. No functional change.

Revision 1.701: download - view: text, markup, annotated - select for diffs
Mon Mar 1 04:50:17 2021 UTC (3 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.700: preferred, colored
Changes since revision 1.700: +3 -9 lines
Refactor rxq->rxq_ptr updating.

Revision 1.700: download - view: text, markup, annotated - select for diffs
Mon Mar 1 04:49:11 2021 UTC (3 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.699: preferred, colored
Changes since revision 1.699: +3 -10 lines
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 - view: text, markup, annotated - select for diffs
Wed Feb 17 08:15:43 2021 UTC (3 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.698: preferred, colored
Changes since revision 1.698: +8 -2 lines
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 - view: text, markup, annotated - select for diffs
Wed Feb 17 08:10:33 2021 UTC (3 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.697: preferred, colored
Changes since revision 1.697: +8 -4 lines
wm(4) use atomic_{load,store}_relaxed for evcnt 64 bit counter.

ok'ed by msaitoh@n.o.

Revision 1.694.2.1: download - view: text, markup, annotated - select for diffs
Mon Dec 14 14:38:06 2020 UTC (3 years, 11 months ago) by thorpej
Branches: thorpej-futex
Diff to: previous 1.694: preferred, colored
Changes since revision 1.694: +161 -9 lines
Sync w/ HEAD.

Revision 1.697: download - view: text, markup, annotated - select for diffs
Thu Nov 19 02:36:30 2020 UTC (4 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.696: preferred, colored
Changes since revision 1.696: +39 -4 lines
 Add some sysctl values for debugging TX/RX queues.

Revision 1.645.2.10: download - view: text, markup, annotated - select for diffs
Mon Nov 16 18:21:45 2020 UTC (4 years ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-2-RELEASE
Diff to: previous 1.645.2.9: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.9: +10 -6 lines
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 - view: text, markup, annotated - select for diffs
Mon Nov 16 18:18:14 2020 UTC (4 years ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.41: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.41: +10 -6 lines
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 - view: text, markup, annotated - select for diffs
Mon Nov 16 11:54:10 2020 UTC (4 years ago) by rin
Branches: MAIN
Diff to: previous 1.695: preferred, colored
Changes since revision 1.695: +10 -6 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 4 11:51:57 2020 UTC (4 years, 1 month ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.40: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.40: +120 -4 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 4 11:48:26 2020 UTC (4 years, 1 month ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.8: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.8: +120 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Nov 2 09:21:50 2020 UTC (4 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.694: preferred, colored
Changes since revision 1.694: +116 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 30 06:29:47 2020 UTC (4 years, 1 month ago) by msaitoh
Branches: MAIN
Branch point for: thorpej-futex
Diff to: previous 1.693: preferred, colored
Changes since revision 1.693: +6 -3 lines
Add WMPHY_I350. Not used yet.

Revision 1.693: download - view: text, markup, annotated - select for diffs
Fri Oct 30 06:23:39 2020 UTC (4 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.692: preferred, colored
Changes since revision 1.692: +247 -181 lines
 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 - view: text, markup, annotated - select for diffs
Wed Oct 28 07:08:08 2020 UTC (4 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.691: preferred, colored
Changes since revision 1.691: +7 -2 lines
 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 - view: text, markup, annotated - select for diffs
Fri Oct 16 08:06:02 2020 UTC (4 years, 1 month ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.39: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.39: +4 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 16 08:03:36 2020 UTC (4 years, 1 month ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-1-RELEASE
Diff to: previous 1.645.2.7: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.7: +4 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 16 05:53:39 2020 UTC (4 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.690: preferred, colored
Changes since revision 1.690: +4 -3 lines
 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 - view: text, markup, annotated - select for diffs
Thu Sep 24 08:00:59 2020 UTC (4 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.689: preferred, colored
Changes since revision 1.689: +4 -4 lines
Small fixes from knakahara:

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

Revision 1.645.2.7: download - view: text, markup, annotated - select for diffs
Wed Sep 23 08:46:54 2020 UTC (4 years, 2 months ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.6: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.6: +240 -38 lines
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 - view: text, markup, annotated - select for diffs
Wed Sep 16 15:04:57 2020 UTC (4 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.688: preferred, colored
Changes since revision 1.688: +4 -3 lines
 Use 12K for packet buffer for jumbo frame on PCH2 and newer.

XXX Note that Linux Use 14K.

Revision 1.688: download - view: text, markup, annotated - select for diffs
Wed Sep 16 15:04:01 2020 UTC (4 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.687: preferred, colored
Changes since revision 1.687: +210 -11 lines
 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 - view: text, markup, annotated - select for diffs
Tue Sep 15 08:39:04 2020 UTC (4 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.686: preferred, colored
Changes since revision 1.686: +18 -16 lines
 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 - view: text, markup, annotated - select for diffs
Mon Aug 24 05:34:00 2020 UTC (4 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.685: preferred, colored
Changes since revision 1.685: +14 -14 lines
s/ressource/resource/. Found by knakahara.

Revision 1.508.4.39: download - view: text, markup, annotated - select for diffs
Wed Aug 5 17:22:45 2020 UTC (4 years, 4 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.38: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.38: +510 -143 lines
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 - view: text, markup, annotated - select for diffs
Wed Aug 5 15:14:18 2020 UTC (4 years, 4 months ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.5: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.5: +62 -18 lines
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 - view: text, markup, annotated - select for diffs
Wed Aug 5 03:17:18 2020 UTC (4 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.684: preferred, colored
Changes since revision 1.684: +4 -2 lines
 Set if_baudrate for non-MII device. Before this commit, it was 0.

Revision 1.684: download - view: text, markup, annotated - select for diffs
Wed Aug 5 01:58:42 2020 UTC (4 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.683: preferred, colored
Changes since revision 1.683: +4 -3 lines
 Explicitly cast from uint16_t to uint32_t before shifting 16bit left
when printing Image Unique ID. Found by kUBSan.

Revision 1.683: download - view: text, markup, annotated - select for diffs
Mon Aug 3 10:52:08 2020 UTC (4 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.682: preferred, colored
Changes since revision 1.682: +45 -4 lines
 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 - view: text, markup, annotated - select for diffs
Mon Aug 3 07:16:51 2020 UTC (4 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.681: preferred, colored
Changes since revision 1.681: +15 -15 lines
s/MII_IGPHY_/IGPHY_/. No functional change.

Revision 1.645.2.5: download - view: text, markup, annotated - select for diffs
Fri Jul 10 10:45:56 2020 UTC (4 years, 5 months ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.4: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.4: +439 -122 lines
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 - view: text, markup, annotated - select for diffs
Thu Jul 9 06:42:44 2020 UTC (4 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.680: preferred, colored
Changes since revision 1.680: +6 -4 lines
"wmX: 0" on 82542 is difficult to understand, so don't print it.

Revision 1.680: download - view: text, markup, annotated - select for diffs
Mon Jul 6 07:51:09 2020 UTC (4 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.679: preferred, colored
Changes since revision 1.679: +17 -3 lines
 Fix a bug that the WMREG_EEARBC_I210 register is incorrectly set if the system
uses iNVM.

Revision 1.679: download - view: text, markup, annotated - select for diffs
Sat Jun 27 13:32:00 2020 UTC (4 years, 5 months ago) by jmcneill
Branches: MAIN
Diff to: previous 1.678: preferred, colored
Changes since revision 1.678: +3 -3 lines
prop_data_data_nocopy -> prop_data_value

Revision 1.678: download - view: text, markup, annotated - select for diffs
Thu Jun 11 09:23:13 2020 UTC (4 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.677: preferred, colored
Changes since revision 1.677: +15 -15 lines
No functional change:

 - Rename some macros and function.
 - Add newline.

Revision 1.677: download - view: text, markup, annotated - select for diffs
Thu Jun 11 02:39:30 2020 UTC (4 years, 6 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.676: preferred, colored
Changes since revision 1.676: +5 -5 lines
Update for proplib(3) API changes.

Revision 1.676: download - view: text, markup, annotated - select for diffs
Thu Apr 30 03:42:10 2020 UTC (4 years, 7 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.675: preferred, colored
Changes since revision 1.675: +3 -3 lines
Make WM_NRXDESC unsigned.

Revision 1.675: download - view: text, markup, annotated - select for diffs
Thu Apr 30 03:41:31 2020 UTC (4 years, 7 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.674: preferred, colored
Changes since revision 1.674: +16 -34 lines
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 - view: text, markup, annotated - select for diffs
Mon Apr 20 11:29:04 2020 UTC (4 years, 7 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.670: preferred, colored; next MAIN 1.671: preferred, colored
Changes since revision 1.670: +65 -28 lines
Sync with HEAD

Revision 1.583.2.2: download - view: text, markup, annotated - select for diffs
Mon Apr 13 08:04:26 2020 UTC (4 years, 7 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.583.2.1: preferred, colored; branchpoint 1.583: preferred, colored; next MAIN 1.584: preferred, colored
Changes since revision 1.583.2.1: +608 -259 lines
Mostly merge changes from HEAD upto 20200411

Revision 1.674: download - view: text, markup, annotated - select for diffs
Thu Apr 9 06:55:51 2020 UTC (4 years, 8 months ago) by jdolecek
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, bouyer-xenpvh-base2, bouyer-xenpvh-base1
Diff to: previous 1.673: preferred, colored
Changes since revision 1.673: +31 -27 lines
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 - view: text, markup, annotated - select for diffs
Wed Apr 8 21:57:24 2020 UTC (4 years, 8 months ago) by jdolecek
Branches: MAIN
Diff to: previous 1.672: preferred, colored
Changes since revision 1.672: +12 -24 lines
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 - view: text, markup, annotated - select for diffs
Wed Apr 8 21:56:01 2020 UTC (4 years, 8 months ago) by jdolecek
Branches: MAIN
Diff to: previous 1.671: preferred, colored
Changes since revision 1.671: +5 -5 lines
fixup field names in previous

Revision 1.671: download - view: text, markup, annotated - select for diffs
Wed Apr 8 21:51:42 2020 UTC (4 years, 8 months ago) by jdolecek
Branches: MAIN
Diff to: previous 1.670: preferred, colored
Changes since revision 1.670: +53 -8 lines
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 - view: text, markup, annotated - select for diffs
Sat Mar 21 16:47:05 2020 UTC (4 years, 8 months ago) by thorpej
Branches: MAIN
CVS tags: phil-wifi-20200406, bouyer-xenpvh-base
Branch point for: bouyer-xenpvh
Diff to: previous 1.669: preferred, colored
Changes since revision 1.669: +5 -28 lines
Don't bother with IFF_OACTIVE.

Revision 1.669: download - view: text, markup, annotated - select for diffs
Sun Mar 15 23:04:50 2020 UTC (4 years, 8 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.668: preferred, colored
Changes since revision 1.668: +50 -32 lines
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 - view: text, markup, annotated - select for diffs
Sat Feb 29 20:19:11 2020 UTC (4 years, 9 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.658.2.1: preferred, colored; branchpoint 1.658: preferred, colored; next MAIN 1.659: preferred, colored
Changes since revision 1.658.2.1: +65 -52 lines
Sync with head.

Revision 1.668: download - view: text, markup, annotated - select for diffs
Tue Feb 18 04:07:14 2020 UTC (4 years, 9 months ago) by msaitoh
Branches: MAIN
CVS tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Diff to: previous 1.667: preferred, colored
Changes since revision 1.667: +5 -4 lines
 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 - view: text, markup, annotated - select for diffs
Tue Feb 18 03:48:22 2020 UTC (4 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.666: preferred, colored
Changes since revision 1.666: +3 -3 lines
 Whitespace fix. No functional change.

Revision 1.666: download - view: text, markup, annotated - select for diffs
Fri Jan 31 12:09:13 2020 UTC (4 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.665: preferred, colored
Changes since revision 1.665: +6 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Jan 31 12:04:57 2020 UTC (4 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.664: preferred, colored
Changes since revision 1.664: +15 -2 lines
Fix missing workqueue_destroy().  ok by msaitoh@n.o

Revision 1.664: download - view: text, markup, annotated - select for diffs
Fri Jan 31 12:03:23 2020 UTC (4 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.663: preferred, colored
Changes since revision 1.663: +21 -29 lines
Fix wm(4) create too many workqueue.  Pointed out by msaitoh@n.o

Revision 1.663: download - view: text, markup, annotated - select for diffs
Wed Jan 29 06:44:27 2020 UTC (4 years, 10 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.662: preferred, colored
Changes since revision 1.662: +26 -22 lines
Adopt <net/if_stats.h>.

Revision 1.645.2.4: download - view: text, markup, annotated - select for diffs
Sun Jan 26 11:13:27 2020 UTC (4 years, 10 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-0-RELEASE, netbsd-9-0-RC2
Diff to: previous 1.645.2.3: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.3: +28 -23 lines
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 - view: text, markup, annotated - select for diffs
Sat Jan 25 22:38:47 2020 UTC (4 years, 10 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.658: preferred, colored
Changes since revision 1.658: +151 -23 lines
Sync with head.

Revision 1.508.4.38: download - view: text, markup, annotated - select for diffs
Fri Jan 24 18:43:35 2020 UTC (4 years, 10 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-2-RELEASE
Diff to: previous 1.508.4.37: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.37: +26 -20 lines
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 - view: text, markup, annotated - select for diffs
Fri Jan 24 02:50:41 2020 UTC (4 years, 10 months ago) by knakahara
Branches: MAIN
CVS tags: ad-namecache-base2
Diff to: previous 1.661: preferred, colored
Changes since revision 1.661: +115 -17 lines
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 - view: text, markup, annotated - select for diffs
Thu Jan 23 10:17:41 2020 UTC (4 years, 10 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.36: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.36: +5 -2 lines
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 - view: text, markup, annotated - select for diffs
Thu Jan 23 10:10:57 2020 UTC (4 years, 10 months ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.2: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.2: +5 -2 lines
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 - view: text, markup, annotated - select for diffs
Thu Jan 23 07:49:57 2020 UTC (4 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.660: preferred, colored
Changes since revision 1.660: +5 -2 lines
fix softint_disestablish() in wm_detach().

ok by msaitoh@n.o

XXX pullup-8, pullup-9

Revision 1.660: download - view: text, markup, annotated - select for diffs
Tue Jan 21 08:50:54 2020 UTC (4 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.659: preferred, colored
Changes since revision 1.659: +35 -2 lines
 Add Intel I219 LM10-LM15 and V10-V14 from OpenBSD.

Revision 1.659: download - view: text, markup, annotated - select for diffs
Mon Jan 20 19:45:27 2020 UTC (4 years, 10 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.658: preferred, colored
Changes since revision 1.658: +2 -8 lines
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 - view: text, markup, annotated - select for diffs
Fri Dec 13 02:03:46 2019 UTC (4 years, 11 months ago) by msaitoh
Branches: MAIN
CVS tags: ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Diff to: previous 1.657: preferred, colored
Changes since revision 1.657: +12 -12 lines
 KNF. No functional change.

Revision 1.657: download - view: text, markup, annotated - select for diffs
Thu Dec 12 11:47:30 2019 UTC (5 years ago) by knakahara
Branches: MAIN
Diff to: previous 1.656: preferred, colored
Changes since revision 1.656: +2 -4 lines
fix build failure. ok by msaitoh@n.o.

Revision 1.656: download - view: text, markup, annotated - select for diffs
Thu Dec 12 09:32:54 2019 UTC (5 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.655: preferred, colored
Changes since revision 1.655: +102 -45 lines
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 - view: text, markup, annotated - select for diffs
Wed Dec 11 14:48:31 2019 UTC (5 years ago) by martin
Branches: netbsd-9
Diff to: previous 1.645.2.1: preferred, colored; branchpoint 1.645: preferred, colored
Changes since revision 1.645.2.1: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Wed Dec 11 10:28:19 2019 UTC (5 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.654: preferred, colored
Changes since revision 1.654: +90 -21 lines
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 - view: text, markup, annotated - select for diffs
Wed Dec 11 09:48:16 2019 UTC (5 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.653: preferred, colored
Changes since revision 1.653: +7 -6 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Dec 11 09:27:46 2019 UTC (5 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.652: preferred, colored
Changes since revision 1.652: +15 -10 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Dec 11 09:12:29 2019 UTC (5 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.651: preferred, colored
Changes since revision 1.651: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Dec 9 02:30:30 2019 UTC (5 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.650: preferred, colored
Changes since revision 1.650: +3 -3 lines
 Fix a bug that wm_sgmii_readreg_locked() may return error even if error isn't
occured.

Revision 1.650: download - view: text, markup, annotated - select for diffs
Wed Dec 4 09:03:45 2019 UTC (5 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.649: preferred, colored
Changes since revision 1.649: +8 -9 lines
 Simplify. No functional change.

Revision 1.508.4.36: download - view: text, markup, annotated - select for diffs
Wed Nov 6 10:23:06 2019 UTC (5 years, 1 month ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.35: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.35: +31 -31 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 6 10:07:42 2019 UTC (5 years, 1 month ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-0-RC1
Diff to: previous 1.645: preferred, colored
Changes since revision 1.645: +32 -32 lines
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 - view: text, markup, annotated - select for diffs
Thu Sep 26 04:16:03 2019 UTC (5 years, 2 months ago) by msaitoh
Branches: MAIN
CVS tags: phil-wifi-20191119
Diff to: previous 1.648: preferred, colored
Changes since revision 1.648: +5 -5 lines
 Fix typo in comment.

Revision 1.648: download - view: text, markup, annotated - select for diffs
Fri Sep 13 07:55:07 2019 UTC (5 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.647: preferred, colored
Changes since revision 1.647: +5 -4 lines
 if_flags is neither int nor short. It's unsigned short.

Revision 1.647: download - view: text, markup, annotated - select for diffs
Wed Sep 4 07:07:09 2019 UTC (5 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.646: preferred, colored
Changes since revision 1.646: +28 -28 lines
 printf -> device_printf

Revision 1.508.4.35: download - view: text, markup, annotated - select for diffs
Sun Aug 4 10:59:19 2019 UTC (5 years, 4 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.34: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.34: +6 -3 lines
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 - view: text, markup, annotated - select for diffs
Thu Aug 1 14:28:33 2019 UTC (5 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.645: preferred, colored
Changes since revision 1.645: +3 -3 lines
Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

Revision 1.508.4.34: download - view: text, markup, annotated - select for diffs
Thu Aug 1 13:50:13 2019 UTC (5 years, 4 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.33: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.33: +36 -17 lines
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 - view: text, markup, annotated - select for diffs
Tue Jul 30 04:42:29 2019 UTC (5 years, 4 months ago) by msaitoh
Branches: MAIN
CVS tags: netbsd-9-base
Branch point for: netbsd-9
Diff to: previous 1.644: preferred, colored
Changes since revision 1.644: +34 -16 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Jul 26 09:26:56 2019 UTC (5 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.643: preferred, colored
Changes since revision 1.643: +4 -3 lines
 Use aprint_debug_dev() instead of printf() in wm_ulp_disable().

Revision 1.643: download - view: text, markup, annotated - select for diffs
Thu Jul 25 08:35:36 2019 UTC (5 years, 4 months ago) by tnn
Branches: MAIN
Diff to: previous 1.642: preferred, colored
Changes since revision 1.642: +8 -4 lines
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 - view: text, markup, annotated - select for diffs
Wed Jul 17 16:12:17 2019 UTC (5 years, 4 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.32: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.32: +171 -176 lines
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 - view: text, markup, annotated - select for diffs
Tue Jul 9 08:46:59 2019 UTC (5 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.641: preferred, colored
Changes since revision 1.641: +5 -3 lines
 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 - view: text, markup, annotated - select for diffs
Wed Jun 12 01:54:11 2019 UTC (5 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.640: preferred, colored
Changes since revision 1.640: +23 -2 lines
 Print ICH/PCH's NVM version.

Revision 1.583.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:07:16 2019 UTC (5 years, 6 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.583: preferred, colored
Changes since revision 1.583: +2423 -959 lines
Sync with HEAD

Revision 1.640: download - view: text, markup, annotated - select for diffs
Fri Jun 7 04:39:15 2019 UTC (5 years, 6 months ago) by msaitoh
Branches: MAIN
CVS tags: phil-wifi-20190609
Diff to: previous 1.639: preferred, colored
Changes since revision 1.639: +8 -8 lines
 Use unsigned. Found by UBSan. OK'd by kamil.

Revision 1.639: download - view: text, markup, annotated - select for diffs
Tue May 28 08:59:35 2019 UTC (5 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.638: preferred, colored
Changes since revision 1.638: +3 -3 lines
s/recieve/receive/

Revision 1.638: download - view: text, markup, annotated - select for diffs
Thu May 23 13:10:52 2019 UTC (5 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.637: preferred, colored
Changes since revision 1.637: +5 -5 lines
 Whitespace fix (mainly tabify).

Revision 1.637: download - view: text, markup, annotated - select for diffs
Thu May 23 10:57:28 2019 UTC (5 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.636: preferred, colored
Changes since revision 1.636: +38 -40 lines
-No functional change:
  - KNF
  - u_int*_t -> uint*_t.

Revision 1.636: download - view: text, markup, annotated - select for diffs
Wed May 15 02:56:47 2019 UTC (5 years, 6 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.635: preferred, colored
Changes since revision 1.635: +7 -4 lines
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 - view: text, markup, annotated - select for diffs
Tue May 14 11:40:41 2019 UTC (5 years, 6 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-1-RELEASE, netbsd-8-1-RC1
Diff to: previous 1.508.4.31: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.31: +2 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue May 14 09:43:55 2019 UTC (5 years, 6 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.634: preferred, colored
Changes since revision 1.634: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Wed Apr 24 11:18:20 2019 UTC (5 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.633: preferred, colored
Changes since revision 1.633: +2 -3 lines
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 - view: text, markup, annotated - select for diffs
Wed Apr 24 10:21:22 2019 UTC (5 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.632: preferred, colored
Changes since revision 1.632: +111 -137 lines
 KNF. No functional change.

Revision 1.632: download - view: text, markup, annotated - select for diffs
Mon Mar 25 05:32:01 2019 UTC (5 years, 8 months ago) by msaitoh
Branches: MAIN
CVS tags: isaki-audio2-base, isaki-audio2
Diff to: previous 1.631: preferred, colored
Changes since revision 1.631: +18 -16 lines
 Pass error status to the upper layer in wm_gmii_{i82544,i80003}*().

Revision 1.508.4.31: download - view: text, markup, annotated - select for diffs
Thu Mar 7 17:11:53 2019 UTC (5 years, 9 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.30: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.30: +42 -23 lines
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 - view: text, markup, annotated - select for diffs
Tue Mar 5 03:49:06 2019 UTC (5 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.630: preferred, colored
Changes since revision 1.630: +30 -18 lines
 Add Intel I219 variations for Cannon Lake.

Revision 1.630: download - view: text, markup, annotated - select for diffs
Mon Mar 4 05:28:48 2019 UTC (5 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.629: preferred, colored
Changes since revision 1.629: +3 -3 lines
 Use  do { ... } whille (0) for DPRINTF(x, y).

Revision 1.629: download - view: text, markup, annotated - select for diffs
Thu Feb 28 16:56:35 2019 UTC (5 years, 9 months ago) by khorben
Branches: MAIN
Diff to: previous 1.628: preferred, colored
Changes since revision 1.628: +3 -3 lines
Typo (s/vaule/value/)

Revision 1.628: download - view: text, markup, annotated - select for diffs
Sat Feb 23 11:41:08 2019 UTC (5 years, 9 months ago) by kamil
Branches: MAIN
Diff to: previous 1.627: preferred, colored
Changes since revision 1.627: +8 -6 lines
Fix GCC7 "avoid ambiguous 'else'" build error in if_wm.c

Detected with kUBSan NetBSD/i386 build.

Revision 1.627: download - view: text, markup, annotated - select for diffs
Thu Feb 21 08:10:22 2019 UTC (5 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.626: preferred, colored
Changes since revision 1.626: +4 -2 lines
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 - view: text, markup, annotated - select for diffs
Mon Feb 11 13:44:34 2019 UTC (5 years, 10 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.29: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.29: +7 -5 lines
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 - view: text, markup, annotated - select for diffs
Fri Feb 8 06:33:04 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.625: preferred, colored
Changes since revision 1.625: +11 -6 lines
- Add support for I210 SGMII Flash-less device.
- Add KASSERT.
- Update TODO list.

Revision 1.625: download - view: text, markup, annotated - select for diffs
Thu Feb 7 04:03:24 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.624: preferred, colored
Changes since revision 1.624: +3 -3 lines
 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 - view: text, markup, annotated - select for diffs
Wed Feb 6 07:20:13 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.623: preferred, colored
Changes since revision 1.623: +4 -2 lines
 I21[01]'s RAL size is not 15 but 16(== 82575's value). Same as other OSes.

Revision 1.623: download - view: text, markup, annotated - select for diffs
Thu Jan 31 15:30:23 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.622: preferred, colored
Changes since revision 1.622: +33 -10 lines
 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 - view: text, markup, annotated - select for diffs
Thu Jan 31 06:43:48 2019 UTC (5 years, 10 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.28: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.28: +693 -258 lines
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 - view: text, markup, annotated - select for diffs
Thu Jan 31 05:48:32 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.621: preferred, colored
Changes since revision 1.621: +4 -4 lines
 We now have IFM_2500_KX and IFM_1000_KX, so use them.

Revision 1.621: download - view: text, markup, annotated - select for diffs
Thu Jan 31 05:20:49 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.620: preferred, colored
Changes since revision 1.620: +209 -22 lines
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 - view: text, markup, annotated - select for diffs
Sat Jan 26 22:00:07 2019 UTC (5 years, 10 months ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.566.2.12: preferred, colored; branchpoint 1.566: preferred, colored; next MAIN 1.567: preferred, colored
Changes since revision 1.566.2.12: +459 -377 lines
Sync with HEAD

Revision 1.620: download - view: text, markup, annotated - select for diffs
Fri Jan 25 08:04:07 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-20190127
Diff to: previous 1.619: preferred, colored
Changes since revision 1.619: +5 -5 lines
 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 - view: text, markup, annotated - select for diffs
Fri Jan 25 03:50:13 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.618: preferred, colored
Changes since revision 1.618: +3 -3 lines
 Use __nothing (== ((void)0)) instead of "do {} while (/*CONSTCOND*/false)".

Revision 1.618: download - view: text, markup, annotated - select for diffs
Thu Jan 24 04:50:04 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.617: preferred, colored
Changes since revision 1.617: +125 -132 lines
No functional change intended:
- Use "do {} while (/*CONSTCOND*/false)" for null DPRINTF().
- Reduce indent level of wm_linkintr_gmii().

Revision 1.617: download - view: text, markup, annotated - select for diffs
Tue Jan 22 03:42:27 2019 UTC (5 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.616: preferred, colored
Changes since revision 1.616: +333 -244 lines
 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 - view: text, markup, annotated - select for diffs
Fri Jan 18 08:50:27 2019 UTC (5 years, 10 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.11: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.11: +279 -47 lines
Synch with HEAD

Revision 1.616: download - view: text, markup, annotated - select for diffs
Fri Jan 11 05:13:26 2019 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-20190118
Diff to: previous 1.615: preferred, colored
Changes since revision 1.615: +3 -3 lines
 Set I82579_LPI_CTRL register correctly in wm_set_eee_pchlan().

Revision 1.615: download - view: text, markup, annotated - select for diffs
Wed Jan 9 08:28:22 2019 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.614: preferred, colored
Changes since revision 1.614: +7 -7 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Jan 7 01:43:22 2019 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.613: preferred, colored
Changes since revision 1.613: +269 -41 lines
 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 - view: text, markup, annotated - select for diffs
Thu Jan 3 08:46:03 2019 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.612: preferred, colored
Changes since revision 1.612: +4 -3 lines
 Fix error check. reported by David Binderman in kern/53821.

Revision 1.612: download - view: text, markup, annotated - select for diffs
Sun Dec 30 04:18:09 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.611: preferred, colored
Changes since revision 1.611: +5 -2 lines
 Accept IFM_NONE.

Revision 1.566.2.11: download - view: text, markup, annotated - select for diffs
Wed Dec 26 14:01:50 2018 UTC (5 years, 11 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.10: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.10: +566 -127 lines
Sync with HEAD, resolve a few conflicts

Revision 1.611: download - view: text, markup, annotated - select for diffs
Fri Dec 21 08:29:22 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-1226
Diff to: previous 1.610: preferred, colored
Changes since revision 1.610: +4 -4 lines
 Fix WoL detection once again.

Revision 1.610: download - view: text, markup, annotated - select for diffs
Thu Dec 20 09:32:13 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.609: preferred, colored
Changes since revision 1.609: +325 -85 lines
- 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 - view: text, markup, annotated - select for diffs
Thu Dec 20 08:59:22 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.608: preferred, colored
Changes since revision 1.608: +6 -4 lines
 Fix WoL capability detection on ICH and PCH.

Revision 1.608: download - view: text, markup, annotated - select for diffs
Thu Dec 20 02:38:28 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.607: preferred, colored
Changes since revision 1.607: +21 -18 lines
 Rename functions. Add comment. No functional change.

Revision 1.508.4.28: download - view: text, markup, annotated - select for diffs
Tue Dec 18 18:24:09 2018 UTC (5 years, 11 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.27: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.27: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Mon Dec 17 04:21:44 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.606: preferred, colored
Changes since revision 1.606: +4 -4 lines
 When sc->phy.acquire() failed, it's not required to call sc->phy.release().

Revision 1.606: download - view: text, markup, annotated - select for diffs
Mon Dec 17 04:14:40 2018 UTC (5 years, 11 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.605: preferred, colored
Changes since revision 1.605: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Sat Dec 15 05:40:10 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.604: preferred, colored
Changes since revision 1.604: +9 -5 lines
 Print and clear the wakeup status only when the WUS register != 0.

Revision 1.604: download - view: text, markup, annotated - select for diffs
Fri Dec 14 09:47:40 2018 UTC (5 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.603: preferred, colored
Changes since revision 1.603: +75 -9 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Dec 12 08:49:33 2018 UTC (6 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.602: preferred, colored
Changes since revision 1.602: +145 -21 lines
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 - view: text, markup, annotated - select for diffs
Tue Dec 4 11:21:32 2018 UTC (6 years ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.26: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.26: +431 -111 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 28 16:26:31 2018 UTC (6 years ago) by martin
Branches: netbsd-7
Diff to: previous 1.289.2.17: preferred, colored; branchpoint 1.289: preferred, colored; next MAIN 1.290: preferred, colored
Changes since revision 1.289.2.17: +6 -5 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 28 08:19:19 2018 UTC (6 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.601: preferred, colored
Changes since revision 1.601: +3 -3 lines
 Fix comment. No functional change.

Revision 1.508.4.26: download - view: text, markup, annotated - select for diffs
Mon Nov 26 17:24:51 2018 UTC (6 years ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.25: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.25: +6 -5 lines
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 - view: text, markup, annotated - select for diffs
Mon Nov 26 01:52:32 2018 UTC (6 years ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.9: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.9: +595 -152 lines
Sync with HEAD, resolve a couple of conflicts

Revision 1.601: download - view: text, markup, annotated - select for diffs
Thu Nov 22 15:09:46 2018 UTC (6 years ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-1126
Diff to: previous 1.600: preferred, colored
Changes since revision 1.600: +138 -21 lines
- 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 - view: text, markup, annotated - select for diffs
Tue Nov 20 04:04:42 2018 UTC (6 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.599: preferred, colored
Changes since revision 1.599: +156 -35 lines
- 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 - view: text, markup, annotated - select for diffs
Tue Nov 20 03:52:03 2018 UTC (6 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.598: preferred, colored
Changes since revision 1.598: +6 -5 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Nov 19 06:38:58 2018 UTC (6 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.597: preferred, colored
Changes since revision 1.597: +23 -2 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Nov 14 03:41:20 2018 UTC (6 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.596: preferred, colored
Changes since revision 1.596: +120 -59 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Nov 9 11:28:39 2018 UTC (6 years, 1 month ago) by sborrill
Branches: netbsd-7
Diff to: previous 1.289.2.16: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.16: +205 -51 lines
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 - view: text, markup, annotated - select for diffs
Thu Nov 8 12:09:18 2018 UTC (6 years, 1 month ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.24: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.24: +164 -42 lines
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 - view: text, markup, annotated - select for diffs
Sat Nov 3 21:39:10 2018 UTC (6 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.595: preferred, colored
Changes since revision 1.595: +29 -34 lines
make this compile again (rv was uninitialized)

Revision 1.595: download - view: text, markup, annotated - select for diffs
Fri Nov 2 08:26:32 2018 UTC (6 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.594: preferred, colored
Changes since revision 1.594: +24 -28 lines
 KNF a bit. No functional change.

Revision 1.594: download - view: text, markup, annotated - select for diffs
Fri Nov 2 08:16:49 2018 UTC (6 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.593: preferred, colored
Changes since revision 1.593: +20 -3 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Nov 2 08:09:21 2018 UTC (6 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.592: preferred, colored
Changes since revision 1.592: +4 -4 lines
 After writing MDIC register, don't read quickly the same register but
do delay(50). Same as otehr OSes.

Revision 1.592: download - view: text, markup, annotated - select for diffs
Fri Nov 2 08:04:42 2018 UTC (6 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.591: preferred, colored
Changes since revision 1.591: +23 -6 lines
 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 - view: text, markup, annotated - select for diffs
Fri Nov 2 03:22:19 2018 UTC (6 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.590: preferred, colored
Changes since revision 1.590: +90 -7 lines
 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 - view: text, markup, annotated - select for diffs
Wed Oct 31 06:04:48 2018 UTC (6 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.589: preferred, colored
Changes since revision 1.589: +18 -4 lines
- 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 - view: text, markup, annotated - select for diffs
Tue Oct 30 09:25:13 2018 UTC (6 years, 1 month ago) by sborrill
Branches: netbsd-8
Diff to: previous 1.508.4.23: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.23: +4 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue Oct 30 08:35:56 2018 UTC (6 years, 1 month ago) by sborrill
Branches: netbsd-7
Diff to: previous 1.289.2.15: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.15: +4 -3 lines
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 - view: text, markup, annotated - select for diffs
Sat Oct 20 06:58:31 2018 UTC (6 years, 1 month ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.8: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.8: +4 -3 lines
Sync with head

Revision 1.589: download - view: text, markup, annotated - select for diffs
Fri Oct 5 08:23:58 2018 UTC (6 years, 2 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-1020
Diff to: previous 1.588: preferred, colored
Changes since revision 1.588: +4 -3 lines
 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 - view: text, markup, annotated - select for diffs
Sun Sep 30 01:45:50 2018 UTC (6 years, 2 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.7: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.7: +116 -80 lines
Ssync with HEAD

Revision 1.508.4.23: download - view: text, markup, annotated - select for diffs
Sun Sep 23 17:39:02 2018 UTC (6 years, 2 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.22: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.22: +116 -80 lines
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 - view: text, markup, annotated - select for diffs
Wed Sep 12 05:03:05 2018 UTC (6 years, 3 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-0930
Diff to: previous 1.587: preferred, colored
Changes since revision 1.587: +3 -3 lines
 Fix comment.

Revision 1.587: download - view: text, markup, annotated - select for diffs
Wed Sep 12 04:59:26 2018 UTC (6 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.586: preferred, colored
Changes since revision 1.586: +43 -9 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Sep 12 04:37:18 2018 UTC (6 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.585: preferred, colored
Changes since revision 1.585: +76 -74 lines
- 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 - view: text, markup, annotated - select for diffs
Thu Sep 6 06:55:51 2018 UTC (6 years, 3 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.6: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.6: +53 -31 lines
Sync with HEAD

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

Revision 1.585: download - view: text, markup, annotated - select for diffs
Mon Sep 3 16:29:32 2018 UTC (6 years, 3 months ago) by riastradh
Branches: MAIN
CVS tags: pgoyette-compat-0906
Diff to: previous 1.584: preferred, colored
Changes since revision 1.584: +6 -6 lines
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 - view: text, markup, annotated - select for diffs
Sat Aug 11 14:47:31 2018 UTC (6 years, 4 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.21: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.21: +49 -27 lines
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 - view: text, markup, annotated - select for diffs
Sat Aug 11 13:34:20 2018 UTC (6 years, 4 months ago) by martin
Branches: netbsd-7
CVS tags: netbsd-7-2-RELEASE
Diff to: previous 1.289.2.14: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.14: +1592 -823 lines
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 - view: text, markup, annotated - select for diffs
Thu Aug 9 16:27:23 2018 UTC (6 years, 4 months ago) by msaitoh
Branches: MAIN
CVS tags: jdolecek-ncqfixes-base, jdolecek-ncqfixes
Diff to: previous 1.583: preferred, colored
Changes since revision 1.583: +49 -27 lines
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 - view: text, markup, annotated - select for diffs
Sat Jul 28 04:37:46 2018 UTC (6 years, 4 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.5: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.5: +4 -4 lines
Sync with HEAD

Revision 1.508.4.21: download - view: text, markup, annotated - select for diffs
Thu Jul 26 20:40:39 2018 UTC (6 years, 4 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.20: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.20: +214 -205 lines
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 - view: text, markup, annotated - select for diffs
Tue Jun 26 06:48:01 2018 UTC (6 years, 5 months ago) by msaitoh
Branches: MAIN
CVS tags: phil-wifi-base, pgoyette-compat-0728
Branch point for: phil-wifi
Diff to: previous 1.582: preferred, colored
Changes since revision 1.582: +4 -4 lines
 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 - view: text, markup, annotated - select for diffs
Mon Jun 25 07:25:52 2018 UTC (6 years, 5 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.4: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.4: +131 -143 lines
Sync with HEAD

Revision 1.582: download - view: text, markup, annotated - select for diffs
Wed Jun 20 05:19:12 2018 UTC (6 years, 5 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-0625
Diff to: previous 1.581: preferred, colored
Changes since revision 1.581: +128 -140 lines
 Style fix. No functional change.

Revision 1.508.4.20: download - view: text, markup, annotated - select for diffs
Thu Jun 7 17:42:25 2018 UTC (6 years, 6 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-0-RELEASE, netbsd-8-0-RC2
Diff to: previous 1.508.4.19: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.19: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Jun 1 08:56:00 2018 UTC (6 years, 6 months ago) by maxv
Branches: MAIN
Diff to: previous 1.580: preferred, colored
Changes since revision 1.580: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Fri May 25 04:40:26 2018 UTC (6 years, 6 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.579: preferred, colored
Changes since revision 1.579: +3 -3 lines
Ensure to call if_register after interface initializations finish

Revision 1.566.2.4: download - view: text, markup, annotated - select for diffs
Mon May 21 04:36:06 2018 UTC (6 years, 6 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.3: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.3: +15 -14 lines
Sync with HEAD

Revision 1.508.4.19: download - view: text, markup, annotated - select for diffs
Thu May 17 13:58:07 2018 UTC (6 years, 6 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.18: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.18: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Thu May 10 03:43:42 2018 UTC (6 years, 7 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-0521
Diff to: previous 1.578: preferred, colored
Changes since revision 1.578: +12 -12 lines
 KNF. No binary change.

Revision 1.508.4.18: download - view: text, markup, annotated - select for diffs
Wed May 9 15:28:44 2018 UTC (6 years, 7 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.17: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.17: +3 -2 lines
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 - view: text, markup, annotated - select for diffs
Tue May 8 11:36:39 2018 UTC (6 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.577: preferred, colored
Changes since revision 1.577: +3 -2 lines
 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 - view: text, markup, annotated - select for diffs
Tue May 8 07:59:56 2018 UTC (6 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.576: preferred, colored
Changes since revision 1.576: +4 -4 lines
 rxipsum and rxtusum are not interrupt counter, so use EVCNT_TYPE_MISC
instead of EVCNT_TYPE_INTR.

Revision 1.566.2.3: download - view: text, markup, annotated - select for diffs
Wed May 2 07:20:06 2018 UTC (6 years, 7 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.2: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.2: +18 -14 lines
Synch with HEAD

Revision 1.576: download - view: text, markup, annotated - select for diffs
Mon Apr 23 01:35:25 2018 UTC (6 years, 7 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-0502
Diff to: previous 1.575: preferred, colored
Changes since revision 1.575: +16 -13 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Apr 23 01:29:23 2018 UTC (6 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.574: preferred, colored
Changes since revision 1.574: +4 -3 lines
 Count timeout correctly. This change reduce timeout value for 80003 as
expected. Reported by mouse@.

Revision 1.566.2.2: download - view: text, markup, annotated - select for diffs
Sun Apr 22 07:20:21 2018 UTC (6 years, 7 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566.2.1: preferred, colored; branchpoint 1.566: preferred, colored
Changes since revision 1.566.2.1: +67 -50 lines
Sync with HEAD

Revision 1.574: download - view: text, markup, annotated - select for diffs
Fri Apr 20 03:03:13 2018 UTC (6 years, 7 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-0422
Diff to: previous 1.573: preferred, colored
Changes since revision 1.573: +5 -4 lines
 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 - view: text, markup, annotated - select for diffs
Mon Apr 16 14:25:49 2018 UTC (6 years, 7 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-0-RC1
Diff to: previous 1.508.4.16: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.16: +153 -51 lines
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 - view: text, markup, annotated - select for diffs
Mon Apr 16 08:31:06 2018 UTC (6 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.572: preferred, colored
Changes since revision 1.572: +64 -48 lines
 KNF. No functional change.

Revision 1.566.2.1: download - view: text, markup, annotated - select for diffs
Mon Apr 16 01:59:58 2018 UTC (6 years, 7 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.566: preferred, colored
Changes since revision 1.566: +153 -51 lines
Sync with HEAD, resolve some conflicts

Revision 1.572: download - view: text, markup, annotated - select for diffs
Fri Apr 13 09:35:10 2018 UTC (6 years, 8 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-0415
Diff to: previous 1.571: preferred, colored
Changes since revision 1.571: +8 -3 lines
 I354 uses an external PHY, so don't use wm_set_eee_i350().

Revision 1.571: download - view: text, markup, annotated - select for diffs
Fri Apr 13 06:04:12 2018 UTC (6 years, 8 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.570: preferred, colored
Changes since revision 1.570: +2 -4 lines
 Enable I219.

Revision 1.570: download - view: text, markup, annotated - select for diffs
Thu Apr 12 03:25:08 2018 UTC (6 years, 8 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.569: preferred, colored
Changes since revision 1.569: +65 -24 lines
 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 - view: text, markup, annotated - select for diffs
Thu Apr 12 03:13:04 2018 UTC (6 years, 8 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.568: preferred, colored
Changes since revision 1.568: +4 -2 lines
 If the extended configration size in the EXTCNFSIZE register is 0, don't
continue.

Revision 1.568: download - view: text, markup, annotated - select for diffs
Thu Apr 12 03:09:24 2018 UTC (6 years, 8 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.567: preferred, colored
Changes since revision 1.567: +29 -14 lines
 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 - view: text, markup, annotated - select for diffs
Thu Apr 12 02:48:59 2018 UTC (6 years, 8 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.566: preferred, colored
Changes since revision 1.566: +56 -15 lines
 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 - view: text, markup, annotated - select for diffs
Tue Mar 6 10:59:04 2018 UTC (6 years, 9 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.15: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.15: +21 -11 lines
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 - view: text, markup, annotated - select for diffs
Thu Mar 1 03:32:33 2018 UTC (6 years, 9 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-base, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Diff to: previous 1.565: preferred, colored
Changes since revision 1.565: +4 -2 lines
 Do wm_reset_mdicnfg_82580() on 82580 only.

Revision 1.565: download - view: text, markup, annotated - select for diffs
Thu Mar 1 03:30:12 2018 UTC (6 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.564: preferred, colored
Changes since revision 1.564: +19 -11 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Feb 26 00:25:16 2018 UTC (6 years, 9 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.14: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.14: +6 -42 lines
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 - view: text, markup, annotated - select for diffs
Mon Feb 26 00:00:53 2018 UTC (6 years, 9 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.13: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.13: +38 -15 lines
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 - view: text, markup, annotated - select for diffs
Fri Feb 16 04:49:27 2018 UTC (6 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.563: preferred, colored
Changes since revision 1.563: +6 -42 lines
Apply RSS utility to wm(4).

ok by msaitoh@n.o.

Revision 1.563: download - view: text, markup, annotated - select for diffs
Wed Feb 14 12:56:00 2018 UTC (6 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.562: preferred, colored
Changes since revision 1.562: +38 -15 lines
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 - view: text, markup, annotated - select for diffs
Mon Feb 5 15:07:30 2018 UTC (6 years, 10 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.12: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.12: +168 -56 lines
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 - view: text, markup, annotated - select for diffs
Tue Jan 30 08:15:47 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.561: preferred, colored
Changes since revision 1.561: +55 -27 lines
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 - view: text, markup, annotated - select for diffs
Mon Jan 29 04:17:32 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.560: preferred, colored
Changes since revision 1.560: +3 -5 lines
Fix unmatched return type. The return value of wm_txeof() is not useded yet.

Revision 1.560: download - view: text, markup, annotated - select for diffs
Mon Jan 29 03:42:30 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.559: preferred, colored
Changes since revision 1.559: +2 -4 lines
Fix if_wm.c:r1.557 merge miss, sorry.

Revision 1.559: download - view: text, markup, annotated - select for diffs
Fri Jan 26 16:25:28 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.558: preferred, colored
Changes since revision 1.558: +50 -9 lines
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 - view: text, markup, annotated - select for diffs
Sun Jan 21 04:07:49 2018 UTC (6 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.557: preferred, colored
Changes since revision 1.557: +3 -3 lines
CID-1427779: Fix uninitialized variables

Revision 1.557: download - view: text, markup, annotated - select for diffs
Thu Jan 18 09:36:26 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.556: preferred, colored
Changes since revision 1.556: +33 -14 lines
wm_txeof() can limit the loop count the same as wm_rxeof() now.

Revision 1.556: download - view: text, markup, annotated - select for diffs
Wed Jan 17 02:16:07 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.555: preferred, colored
Changes since revision 1.555: +6 -3 lines
Fix duplicated "rxintr" evcnt counting. Pointed out by ozaki-r@n.o, thanks.

Revision 1.555: download - view: text, markup, annotated - select for diffs
Tue Jan 16 07:23:13 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.554: preferred, colored
Changes since revision 1.554: +14 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Jan 15 04:25:48 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.553: preferred, colored
Changes since revision 1.553: +6 -2 lines
improve comments

Revision 1.553: download - view: text, markup, annotated - select for diffs
Mon Jan 15 04:09:58 2018 UTC (6 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.552: preferred, colored
Changes since revision 1.552: +18 -7 lines
Fix legacy Tx descriptors printing when WM_DEBUG is enabled.

Revision 1.508.4.12: download - view: text, markup, annotated - select for diffs
Sat Jan 13 21:42:45 2018 UTC (6 years, 10 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.11: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.11: +85 -10 lines
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 - view: text, markup, annotated - select for diffs
Thu Jan 4 09:43:27 2018 UTC (6 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.551: preferred, colored
Changes since revision 1.551: +68 -2 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jan 2 10:20:33 2018 UTC (6 years, 11 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.10: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.10: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Mon Jan 1 08:33:28 2018 UTC (6 years, 11 months ago) by jnemeth
Branches: MAIN
Diff to: previous 1.550: preferred, colored
Changes since revision 1.550: +3 -3 lines
PR/52885 - Shinichi Doyashiki -- typo in comment

Revision 1.550: download - view: text, markup, annotated - select for diffs
Thu Dec 28 06:13:50 2017 UTC (6 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.549: preferred, colored
Changes since revision 1.549: +19 -10 lines
 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 - view: text, markup, annotated - select for diffs
Sun Dec 10 10:16:09 2017 UTC (7 years ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.9: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.9: +14 -9 lines
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 - view: text, markup, annotated - select for diffs
Sun Dec 10 10:10:24 2017 UTC (7 years ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.8: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.8: +8 -3 lines
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 - view: text, markup, annotated - select for diffs
Sun Dec 10 09:48:04 2017 UTC (7 years ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.7: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.7: +11 -5 lines
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 - view: text, markup, annotated - select for diffs
Fri Dec 8 05:22:23 2017 UTC (7 years ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.548: preferred, colored
Changes since revision 1.548: +6 -6 lines
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 - view: text, markup, annotated - select for diffs
Thu Dec 7 00:38:38 2017 UTC (7 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.547: preferred, colored
Changes since revision 1.547: +14 -9 lines
 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 - view: text, markup, annotated - select for diffs
Wed Dec 6 09:03:12 2017 UTC (7 years ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.546: preferred, colored
Changes since revision 1.546: +6 -6 lines
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 - view: text, markup, annotated - select for diffs
Sun Dec 3 11:37:08 2017 UTC (7 years ago) by jdolecek
Branches: tls-maxphys
Diff to: previous 1.234.2.4: preferred, colored; next MAIN 1.235: preferred, colored
Changes since revision 1.234.2.4: +8307 -3091 lines
update from HEAD

Revision 1.546: download - view: text, markup, annotated - select for diffs
Thu Nov 30 09:24:18 2017 UTC (7 years ago) by msaitoh
Branches: MAIN
CVS tags: tls-maxphys-base-20171202
Diff to: previous 1.545: preferred, colored
Changes since revision 1.545: +4 -4 lines
- 82583 supports jumbo frame. Fixes PR#52773 reported by Shinichi Doyashiki.
- Cleanup comment.

Revision 1.545: download - view: text, markup, annotated - select for diffs
Thu Nov 30 03:53:24 2017 UTC (7 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.544: preferred, colored
Changes since revision 1.544: +9 -3 lines
 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 - view: text, markup, annotated - select for diffs
Fri Nov 24 08:39:09 2017 UTC (7 years ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.6: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.6: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 22 16:40:42 2017 UTC (7 years ago) by martin
Branches: netbsd-8
Diff to: previous 1.508.4.5: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.5: +12 -4 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 22 02:36:52 2017 UTC (7 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.543: preferred, colored
Changes since revision 1.543: +5 -5 lines
 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 - view: text, markup, annotated - select for diffs
Thu Nov 16 03:07:18 2017 UTC (7 years ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.542: preferred, colored
Changes since revision 1.542: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Mon Nov 6 09:54:01 2017 UTC (7 years, 1 month ago) by snj
Branches: netbsd-8
CVS tags: matt-nb8-mediatek-base, matt-nb8-mediatek
Diff to: previous 1.508.4.4: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.4: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Mon Nov 6 09:21:48 2017 UTC (7 years, 1 month ago) by snj
Branches: netbsd-7-1
CVS tags: netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE
Diff to: previous 1.289.2.13: preferred, colored; next MAIN 1.289.2.14: preferred, colored
Changes since revision 1.289.2.13: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue Oct 24 08:38:59 2017 UTC (7 years, 1 month ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.3: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.3: +9 -14 lines
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 - view: text, markup, annotated - select for diffs
Mon Oct 23 23:29:38 2017 UTC (7 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.541: preferred, colored
Changes since revision 1.541: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Mon Oct 23 09:27:21 2017 UTC (7 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.540: preferred, colored
Changes since revision 1.540: +8 -3 lines
 If if_initialize() failed in the attach function, return.

Revision 1.540: download - view: text, markup, annotated - select for diffs
Fri Oct 20 09:26:13 2017 UTC (7 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.539: preferred, colored
Changes since revision 1.539: +12 -4 lines
 On I219, drop TARC0 bit 28 for DMA hang workaround (from Linux).

Revision 1.508.4.3: download - view: text, markup, annotated - select for diffs
Sun Oct 15 20:18:17 2017 UTC (7 years, 1 month ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.2: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.2: +5 -4 lines
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 - view: text, markup, annotated - select for diffs
Tue Sep 26 08:25:56 2017 UTC (7 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.538: preferred, colored
Changes since revision 1.538: +5 -4 lines
- 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 - view: text, markup, annotated - select for diffs
Tue Sep 26 07:42:06 2017 UTC (7 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.537: preferred, colored
Changes since revision 1.537: +9 -14 lines
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 - view: text, markup, annotated - select for diffs
Mon Aug 28 17:52:05 2017 UTC (7 years, 3 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.10: preferred, colored; branchpoint 1.308: preferred, colored; next MAIN 1.309: preferred, colored
Changes since revision 1.308.2.10: +1691 -777 lines
Sync with HEAD

Revision 1.508.4.2: download - view: text, markup, annotated - select for diffs
Tue Aug 1 23:33:18 2017 UTC (7 years, 4 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.508.4.1: preferred, colored; branchpoint 1.508: preferred, colored
Changes since revision 1.508.4.1: +1189 -630 lines
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 - view: text, markup, annotated - select for diffs
Mon Jul 31 06:41:01 2017 UTC (7 years, 4 months ago) by knakahara
Branches: MAIN
CVS tags: nick-nhusb-base-20170825
Diff to: previous 1.536: preferred, colored
Changes since revision 1.536: +8 -8 lines
rename unclear functions. pointed out by msaitoh@n.o.

Revision 1.536: download - view: text, markup, annotated - select for diffs
Fri Jul 28 10:34:58 2017 UTC (7 years, 4 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.535: preferred, colored
Changes since revision 1.535: +7 -2 lines
add comment about confusing wm_rxeof() calling.

pointed out by msaitoh@n.o.

Revision 1.535: download - view: text, markup, annotated - select for diffs
Fri Jul 28 10:21:10 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.534: preferred, colored
Changes since revision 1.534: +18 -16 lines
 Check some wm_nvm_read()'s return vale.

Revision 1.534: download - view: text, markup, annotated - select for diffs
Fri Jul 28 09:12:40 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.533: preferred, colored
Changes since revision 1.533: +16 -4 lines
 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 - view: text, markup, annotated - select for diffs
Thu Jul 27 03:21:42 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.532: preferred, colored
Changes since revision 1.532: +15 -2 lines
 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 - view: text, markup, annotated - select for diffs
Wed Jul 26 08:09:59 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.531: preferred, colored
Changes since revision 1.531: +9 -5 lines
 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 - view: text, markup, annotated - select for diffs
Wed Jul 26 06:48:49 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.530: preferred, colored
Changes since revision 1.530: +123 -61 lines
-  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 - view: text, markup, annotated - select for diffs
Tue Jul 25 06:00:17 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.529: preferred, colored
Changes since revision 1.529: +308 -178 lines
 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 - view: text, markup, annotated - select for diffs
Thu Jul 20 10:00:25 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.528: preferred, colored
Changes since revision 1.528: +10 -15 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jul 18 08:22:55 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.527: preferred, colored
Changes since revision 1.527: +66 -7 lines
- 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 - view: text, markup, annotated - select for diffs
Tue Jul 18 08:05:03 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.526: preferred, colored
Changes since revision 1.526: +15 -15 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jul 18 08:01:07 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.525: preferred, colored
Changes since revision 1.525: +2 -18 lines
 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 - view: text, markup, annotated - select for diffs
Fri Jul 14 04:34:29 2017 UTC (7 years, 4 months ago) by msaitoh
Branches: MAIN
CVS tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Diff to: previous 1.524: preferred, colored
Changes since revision 1.524: +4 -2 lines
 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 - view: text, markup, annotated - select for diffs
Thu Jul 13 13:27:08 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.523: preferred, colored
Changes since revision 1.523: +56 -55 lines
 IF TX is not required to flush, RX is also not required to flush. Same as
other OSes.

Revision 1.523: download - view: text, markup, annotated - select for diffs
Thu Jul 13 08:22:21 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.522: preferred, colored
Changes since revision 1.522: +117 -19 lines
- 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 - view: text, markup, annotated - select for diffs
Thu Jul 13 08:04:56 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.521: preferred, colored
Changes since revision 1.521: +62 -2 lines
- 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 - view: text, markup, annotated - select for diffs
Thu Jul 13 07:50:49 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.520: preferred, colored
Changes since revision 1.520: +116 -126 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Jul 12 08:18:36 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.519: preferred, colored
Changes since revision 1.519: +2 -4 lines
Remove debug printf().

Revision 1.519: download - view: text, markup, annotated - select for diffs
Wed Jul 12 08:15:31 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.518: preferred, colored
Changes since revision 1.518: +50 -27 lines
 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 - view: text, markup, annotated - select for diffs
Thu Jul 6 08:50:52 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.517: preferred, colored
Changes since revision 1.517: +9 -6 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jul 4 14:57:19 2017 UTC (7 years, 5 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.508: preferred, colored
Changes since revision 1.508: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Jun 26 04:22:46 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.516: preferred, colored
Changes since revision 1.516: +134 -66 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Jun 26 04:18:14 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.515: preferred, colored
Changes since revision 1.515: +3 -3 lines
 Add missing "else" in wm_nvm_release().

Revision 1.515: download - view: text, markup, annotated - select for diffs
Mon Jun 26 04:15:06 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.514: preferred, colored
Changes since revision 1.514: +14 -7 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Jun 26 04:09:02 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.513: preferred, colored
Changes since revision 1.513: +53 -11 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Jun 26 04:03:34 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.512: preferred, colored
Changes since revision 1.512: +5 -18 lines
 Print sc_flags with snprintb().

Revision 1.512: download - view: text, markup, annotated - select for diffs
Fri Jun 23 06:10:31 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.511: preferred, colored
Changes since revision 1.511: +9 -4 lines
 Don't print the Image Unique ID if an NVM is iNVM (i210 and I211).

Revision 1.511: download - view: text, markup, annotated - select for diffs
Tue Jun 20 10:10:36 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.510: preferred, colored
Changes since revision 1.510: +13 -4 lines
- Add debug printf()s.
- If a legacy interrupt is a spurious interrupt, don't print debug message.
- Add comment.

Revision 1.510: download - view: text, markup, annotated - select for diffs
Mon Jun 19 10:59:01 2017 UTC (7 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.509: preferred, colored
Changes since revision 1.509: +11 -11 lines
 Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset(). Same as other OSes.

Revision 1.509: download - view: text, markup, annotated - select for diffs
Mon Jun 12 03:03:22 2017 UTC (7 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.508: preferred, colored
Changes since revision 1.508: +4 -4 lines
Use IFM_1000_KX and IFM_2500_KX.

Revision 1.416.2.4: download - view: text, markup, annotated - select for diffs
Wed Apr 26 02:53:12 2017 UTC (7 years, 7 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.416.2.3: preferred, colored; branchpoint 1.416: preferred, colored; next MAIN 1.417: preferred, colored
Changes since revision 1.416.2.3: +103 -26 lines
Sync with HEAD

Revision 1.465.2.1: download - view: text, markup, annotated - select for diffs
Fri Apr 21 16:53:47 2017 UTC (7 years, 7 months ago) by bouyer
Branches: bouyer-socketcan
Diff to: previous 1.465: preferred, colored; next MAIN 1.466: preferred, colored
Changes since revision 1.465: +1121 -354 lines
Sync with HEAD

Revision 1.289.2.14: download - view: text, markup, annotated - select for diffs
Wed Apr 19 17:06:21 2017 UTC (7 years, 7 months ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.13: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.13: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Thu Apr 13 10:37:36 2017 UTC (7 years, 8 months ago) by knakahara
Branches: 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
Diff to: previous 1.507: preferred, colored
Changes since revision 1.507: +23 -2 lines
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 - view: text, markup, annotated - select for diffs
Wed Apr 12 05:08:00 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.506: preferred, colored
Changes since revision 1.506: +8 -4 lines
improve comments about the difference between legacy/msi and msix.

pointed out by msaitoh@n.o.

Revision 1.506: download - view: text, markup, annotated - select for diffs
Wed Apr 5 10:44:35 2017 UTC (7 years, 8 months ago) by msaitoh
Branches: MAIN
CVS tags: jdolecek-ncq-base, jdolecek-ncq
Diff to: previous 1.505: preferred, colored
Changes since revision 1.505: +12 -2 lines
 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 - view: text, markup, annotated - select for diffs
Fri Mar 24 10:39:10 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.504: preferred, colored
Changes since revision 1.504: +3 -3 lines
fix typo

pointed out by ozaki-r@n.o.

Revision 1.504: download - view: text, markup, annotated - select for diffs
Fri Mar 24 10:18:55 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.503: preferred, colored
Changes since revision 1.503: +3 -3 lines
remove extra "+"

Revision 1.503: download - view: text, markup, annotated - select for diffs
Fri Mar 24 10:02:35 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.502: preferred, colored
Changes since revision 1.502: +16 -5 lines
add comments about the situation wm(4) use MSI-X but does not use multiqueue.

Revision 1.502: download - view: text, markup, annotated - select for diffs
Fri Mar 24 10:01:55 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.501: preferred, colored
Changes since revision 1.501: +29 -13 lines
make self-describing function the code reading sc->sc_nintrs or sc->sc_nqueues directly.

Revision 1.501: download - view: text, markup, annotated - select for diffs
Fri Mar 24 09:59:05 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.500: preferred, colored
Changes since revision 1.500: +3 -2 lines
add prototype.

I have forgotten the fix by wm_softint_establish(). Thank you christos@n.o!

Revision 1.500: download - view: text, markup, annotated - select for diffs
Wed Mar 22 08:44:41 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.499: preferred, colored
Changes since revision 1.499: +17 -2 lines
add comments about transmit context descriptor

Revision 1.499: download - view: text, markup, annotated - select for diffs
Wed Mar 22 02:56:12 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.498: preferred, colored
Changes since revision 1.498: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue Mar 21 10:39:52 2017 UTC (7 years, 8 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.497: preferred, colored
Changes since revision 1.497: +7 -8 lines
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 - view: text, markup, annotated - select for diffs
Mon Mar 20 06:57:29 2017 UTC (7 years, 8 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.416.2.2: preferred, colored; branchpoint 1.416: preferred, colored
Changes since revision 1.416.2.2: +1057 -354 lines
Sync with HEAD

Revision 1.289.2.9.2.2: download - view: text, markup, annotated - select for diffs
Mon Mar 13 07:41:27 2017 UTC (7 years, 9 months ago) by skrll
Branches: netbsd-7-nhusb
Diff to: previous 1.289.2.9.2.1: preferred, colored; branchpoint 1.289.2.9: preferred, colored; next MAIN 1.289.2.10: preferred, colored
Changes since revision 1.289.2.9.2.1: +280 -100 lines
Sync with netbsd-7-1-RELEASE

Revision 1.289.2.13: download - view: text, markup, annotated - select for diffs
Thu Mar 9 06:28:36 2017 UTC (7 years, 9 months ago) by snj
Branches: netbsd-7
CVS tags: netbsd-7-1-RELEASE
Branch point for: netbsd-7-1
Diff to: previous 1.289.2.12: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.12: +280 -100 lines
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 - view: text, markup, annotated - select for diffs
Wed Mar 8 08:00:09 2017 UTC (7 years, 9 months ago) by kardel
Branches: MAIN
CVS tags: pgoyette-localcount-20170320
Diff to: previous 1.496: preferred, colored
Changes since revision 1.496: +3 -3 lines
PR kern/52039: use same safeguard as for the 82578

Revision 1.496: download - view: text, markup, annotated - select for diffs
Fri Mar 3 16:48:55 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.495: preferred, colored
Changes since revision 1.495: +6 -4 lines
fix r1.492 bug, sorry

Revision 1.495: download - view: text, markup, annotated - select for diffs
Fri Mar 3 07:57:49 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.494: preferred, colored
Changes since revision 1.494: +96 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Mar 3 07:38:52 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.493: preferred, colored
Changes since revision 1.493: +7 -2 lines
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 - view: text, markup, annotated - select for diffs
Fri Mar 3 07:32:36 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.492: preferred, colored
Changes since revision 1.492: +24 -9 lines
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 - view: text, markup, annotated - select for diffs
Fri Mar 3 03:33:44 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.491: preferred, colored
Changes since revision 1.491: +7 -8 lines
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 - view: text, markup, annotated - select for diffs
Wed Mar 1 08:56:33 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.490: preferred, colored
Changes since revision 1.490: +46 -42 lines
refactor: functionalize ITR/EITR writing processing.

tested I354 and 82545(VMware e1000).

Revision 1.490: download - view: text, markup, annotated - select for diffs
Wed Mar 1 08:31:06 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.489: preferred, colored
Changes since revision 1.489: +19 -15 lines
divide ITR/EITR value from wm_softc to wm_queue as EITR register is bound to each H/W queue.

Revision 1.489: download - view: text, markup, annotated - select for diffs
Tue Feb 28 09:55:47 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.488: preferred, colored
Changes since revision 1.488: +42 -11 lines
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 - view: text, markup, annotated - select for diffs
Mon Feb 27 09:27:27 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.487: preferred, colored
Changes since revision 1.487: +3 -3 lines
fix Tx queue assignment when the number of H/W queues is less than ncpu.

Revision 1.487: download - view: text, markup, annotated - select for diffs
Fri Feb 24 10:09:21 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.486: preferred, colored
Changes since revision 1.486: +12 -2 lines
apply 82574 RFCTL workaround the same as FreeBSD and linux.

In fact, this workaround reduces interrupt count.

Revision 1.486: download - view: text, markup, annotated - select for diffs
Fri Feb 24 10:07:33 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.485: preferred, colored
Changes since revision 1.485: +11 -6 lines
82574 should follow MSI-X mode IMS manner.

Howerver some legacy interrupts occur as MSI-X other interrupt yet...

Revision 1.485: download - view: text, markup, annotated - select for diffs
Sat Feb 18 14:48:43 2017 UTC (7 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.484: preferred, colored
Changes since revision 1.484: +27 -16 lines
Establish a softint for legacy, otherwise BOOM!

Revision 1.484: download - view: text, markup, annotated - select for diffs
Fri Feb 17 12:16:37 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.483: preferred, colored
Changes since revision 1.483: +56 -59 lines
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 - view: text, markup, annotated - select for diffs
Fri Feb 17 11:57:26 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.482: preferred, colored
Changes since revision 1.482: +14 -6 lines
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 - view: text, markup, annotated - select for diffs
Fri Feb 17 07:21:28 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.481: preferred, colored
Changes since revision 1.481: +15 -15 lines
more fix about IFF_OACTIVE.

fix TODO of r1.479 and reduce IFF_OACTIVE manipulation.

Revision 1.481: download - view: text, markup, annotated - select for diffs
Fri Feb 17 05:20:01 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.480: preferred, colored
Changes since revision 1.480: +31 -17 lines
refactor: functionize deferred_start code holding locks.

Revision 1.480: download - view: text, markup, annotated - select for diffs
Fri Feb 17 04:51:01 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.479: preferred, colored
Changes since revision 1.479: +32 -14 lines
refactor: functionize txrxintr disable/enable code.

Revision 1.479: download - view: text, markup, annotated - select for diffs
Thu Feb 16 05:36:41 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.478: preferred, colored
Changes since revision 1.478: +30 -9 lines
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 - view: text, markup, annotated - select for diffs
Mon Feb 13 05:02:21 2017 UTC (7 years, 9 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.477: preferred, colored
Changes since revision 1.477: +3 -3 lines
fix typo

Revision 1.477: download - view: text, markup, annotated - select for diffs
Thu Feb 9 23:30:46 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.476: preferred, colored
Changes since revision 1.476: +43 -2 lines
detach wm(4) evcnt.

pointed out by msaitoh@n.o, thanks.

Revision 1.308.2.10: download - view: text, markup, annotated - select for diffs
Sun Feb 5 13:40:30 2017 UTC (7 years, 10 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.9: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.9: +788 -290 lines
Sync with HEAD

Revision 1.476: download - view: text, markup, annotated - select for diffs
Thu Feb 2 10:29:10 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
CVS tags: nick-nhusb-base-20170204
Diff to: previous 1.475: preferred, colored
Changes since revision 1.475: +19 -17 lines
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 - view: text, markup, annotated - select for diffs
Wed Feb 1 08:56:41 2017 UTC (7 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.474: preferred, colored
Changes since revision 1.474: +264 -99 lines
 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 - view: text, markup, annotated - select for diffs
Wed Feb 1 07:50:03 2017 UTC (7 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.473: preferred, colored
Changes since revision 1.473: +3 -2 lines
 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 - view: text, markup, annotated - select for diffs
Wed Feb 1 03:54:49 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.472: preferred, colored
Changes since revision 1.472: +2 -14 lines
fix: wm(4) Rx descriptor is corrupted under high rate.

don't write descriptor which is not set DD bit.

Revision 1.472: download - view: text, markup, annotated - select for diffs
Tue Jan 31 03:06:06 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.471: preferred, colored
Changes since revision 1.471: +2 -3 lines
remove obsolete comment. wm(4) vlan have already tested on I354.

Revision 1.471: download - view: text, markup, annotated - select for diffs
Mon Jan 30 09:33:38 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.470: preferred, colored
Changes since revision 1.470: +10 -10 lines
fix endianness of "rsshash"(currently, used for debug message only) and tabify.

Revision 1.470: download - view: text, markup, annotated - select for diffs
Fri Jan 27 05:04:47 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.469: preferred, colored
Changes since revision 1.469: +12 -2 lines
add comment about txq->txq_lock contentions in wm_nq_transmit().

Revision 1.469: download - view: text, markup, annotated - select for diffs
Thu Jan 26 10:14:52 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.468: preferred, colored
Changes since revision 1.468: +9 -2 lines
fix memory leak at wm_detach.

pointed out and reviewed by msaitoh@n.o.

Revision 1.289.2.9.2.1: download - view: text, markup, annotated - select for diffs
Wed Jan 18 08:46:27 2017 UTC (7 years, 10 months ago) by skrll
Branches: netbsd-7-nhusb
Diff to: previous 1.289.2.9: preferred, colored
Changes since revision 1.289.2.9: +1611 -530 lines
Sync with netbsd-5

Revision 1.468: download - view: text, markup, annotated - select for diffs
Mon Jan 16 09:58:04 2017 UTC (7 years, 10 months ago) by maya
Branches: MAIN
Diff to: previous 1.467: preferred, colored
Changes since revision 1.467: +4 -6 lines
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 - view: text, markup, annotated - select for diffs
Mon Jan 16 00:14:04 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.466: preferred, colored
Changes since revision 1.466: +3 -3 lines
update todo comment

Revision 1.466: download - view: text, markup, annotated - select for diffs
Mon Jan 16 00:09:06 2017 UTC (7 years, 10 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.465: preferred, colored
Changes since revision 1.465: +327 -85 lines
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 - view: text, markup, annotated - select for diffs
Tue Jan 10 08:57:39 2017 UTC (7 years, 11 months ago) by msaitoh
Branches: MAIN
CVS tags: bouyer-socketcan-base
Branch point for: bouyer-socketcan
Diff to: previous 1.464: preferred, colored
Changes since revision 1.464: +2 -3 lines
remove debug printf().

Revision 1.464: download - view: text, markup, annotated - select for diffs
Tue Jan 10 08:56:02 2017 UTC (7 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.463: preferred, colored
Changes since revision 1.463: +10 -16 lines
 Fix previous. The last code wasn't called.

Revision 1.463: download - view: text, markup, annotated - select for diffs
Tue Jan 10 08:22:43 2017 UTC (7 years, 11 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.462: preferred, colored
Changes since revision 1.462: +3 -5 lines
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 - view: text, markup, annotated - select for diffs
Sat Jan 7 08:56:33 2017 UTC (7 years, 11 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.416.2.1: preferred, colored; branchpoint 1.416: preferred, colored
Changes since revision 1.416.2.1: +846 -293 lines
Sync with HEAD.  (Note that most of these changes are simply $NetBSD$
tag issues.)

Revision 1.462: download - view: text, markup, annotated - select for diffs
Fri Jan 6 08:05:26 2017 UTC (7 years, 11 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-localcount-20170107
Diff to: previous 1.461: preferred, colored
Changes since revision 1.461: +26 -5 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Jan 4 04:43:08 2017 UTC (7 years, 11 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.460: preferred, colored
Changes since revision 1.460: +3 -3 lines
fix typo. pointed out by msaitoh@n.o.

Revision 1.460: download - view: text, markup, annotated - select for diffs
Wed Dec 28 07:32:16 2016 UTC (7 years, 11 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.459: preferred, colored
Changes since revision 1.459: +5 -2 lines
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 - view: text, markup, annotated - select for diffs
Mon Dec 26 07:55:00 2016 UTC (7 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.458: preferred, colored
Changes since revision 1.458: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Sun Dec 18 07:53:08 2016 UTC (7 years, 11 months ago) by snj
Branches: netbsd-7
CVS tags: netbsd-7-nhusb-base-20170116, netbsd-7-1-RC2, netbsd-7-1-RC1
Diff to: previous 1.289.2.11: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.11: +110 -86 lines
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 - view: text, markup, annotated - select for diffs
Thu Dec 15 09:28:05 2016 UTC (7 years, 11 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.457: preferred, colored
Changes since revision 1.457: +2 -7 lines
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 - view: text, markup, annotated - select for diffs
Tue Dec 13 10:01:44 2016 UTC (7 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.456: preferred, colored
Changes since revision 1.456: +110 -86 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Dec 12 07:18:29 2016 UTC (8 years ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.10: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.10: +1496 -439 lines
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 - view: text, markup, annotated - select for diffs
Fri Dec 9 05:27:30 2016 UTC (8 years ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.9: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.9: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Thu Dec 8 01:12:01 2016 UTC (8 years ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.455: preferred, colored
Changes since revision 1.455: +62 -10 lines
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 - view: text, markup, annotated - select for diffs
Mon Dec 5 10:55:03 2016 UTC (8 years ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.8: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.8: +1431 -517 lines
Sync with HEAD

Revision 1.455: download - view: text, markup, annotated - select for diffs
Fri Dec 2 01:48:44 2016 UTC (8 years ago) by knakahara
Branches: MAIN
CVS tags: nick-nhusb-base-20161204
Diff to: previous 1.454: preferred, colored
Changes since revision 1.454: +24 -12 lines
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 - view: text, markup, annotated - select for diffs
Thu Dec 1 02:36:50 2016 UTC (8 years ago) by knakahara
Branches: MAIN
Diff to: previous 1.453: preferred, colored
Changes since revision 1.453: +75 -20 lines
support Tx multiqueue for 82574(aka e1000e for VMware and QEMU).

Revision 1.453: download - view: text, markup, annotated - select for diffs
Mon Nov 21 03:57:37 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.452: preferred, colored
Changes since revision 1.452: +10 -2 lines
Add note about kumeran registers. No functional change.

Revision 1.452: download - view: text, markup, annotated - select for diffs
Fri Nov 18 11:46:04 2016 UTC (8 years ago) by joerg
Branches: MAIN
Diff to: previous 1.451: preferred, colored
Changes since revision 1.451: +3 -3 lines
Remove extra pair of braces.

Revision 1.451: download - view: text, markup, annotated - select for diffs
Fri Nov 18 06:55:00 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.450: preferred, colored
Changes since revision 1.450: +3 -3 lines
 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 - view: text, markup, annotated - select for diffs
Thu Nov 17 03:40:08 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.449: preferred, colored
Changes since revision 1.449: +5 -5 lines
8257[124] should not set WM_F_ARC_SUBSYS_VALID.

Revision 1.449: download - view: text, markup, annotated - select for diffs
Thu Nov 17 03:36:23 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.448: preferred, colored
Changes since revision 1.448: +8 -5 lines
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 - view: text, markup, annotated - select for diffs
Wed Nov 16 09:27:49 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.447: preferred, colored
Changes since revision 1.447: +7 -7 lines
Move the location of wm_smbustopci() call.

Revision 1.447: download - view: text, markup, annotated - select for diffs
Wed Nov 16 08:56:17 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.446: preferred, colored
Changes since revision 1.446: +287 -21 lines
 Sync wm_smbustopci() with Linux and FreeBSD. This change effects PCH and
newer devices.

Revision 1.446: download - view: text, markup, annotated - select for diffs
Wed Nov 16 08:14:39 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.445: preferred, colored
Changes since revision 1.445: +12 -66 lines
 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 - view: text, markup, annotated - select for diffs
Wed Nov 16 07:24:52 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.444: preferred, colored
Changes since revision 1.444: +126 -2 lines
Add three workarounds for PCH_{LPT,SPT}.

Revision 1.444: download - view: text, markup, annotated - select for diffs
Mon Nov 14 05:38:39 2016 UTC (8 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.443: preferred, colored
Changes since revision 1.443: +4 -5 lines
Set CTRL_MEHE correctly (PCH_{LPT,SPT} only).

Revision 1.443: download - view: text, markup, annotated - select for diffs
Thu Nov 10 08:35:24 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.442: preferred, colored
Changes since revision 1.442: +83 -45 lines
- 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 - view: text, markup, annotated - select for diffs
Thu Nov 10 06:57:15 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.441: preferred, colored
Changes since revision 1.441: +4 -4 lines
 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 - view: text, markup, annotated - select for diffs
Tue Nov 8 10:37:40 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.440: preferred, colored
Changes since revision 1.440: +21 -6 lines
 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 - view: text, markup, annotated - select for diffs
Tue Nov 8 09:38:36 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.439: preferred, colored
Changes since revision 1.439: +2 -5 lines
Remove debug printf which was added in rev. 1.437.

Revision 1.439: download - view: text, markup, annotated - select for diffs
Tue Nov 8 08:54:30 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.438: preferred, colored
Changes since revision 1.438: +4 -9 lines
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 - view: text, markup, annotated - select for diffs
Sun Nov 6 02:38:25 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.437: preferred, colored
Changes since revision 1.437: +8 -8 lines
Add "10/100" into non-gigabit devices' name.

Revision 1.416.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 4 14:49:09 2016 UTC (8 years, 1 month ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.416: preferred, colored
Changes since revision 1.416: +820 -338 lines
Sync with HEAD

Revision 1.437: download - view: text, markup, annotated - select for diffs
Wed Nov 2 10:14:04 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-localcount-20161104
Diff to: previous 1.436: preferred, colored
Changes since revision 1.436: +45 -35 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Oct 31 02:44:54 2016 UTC (8 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.435: preferred, colored
Changes since revision 1.435: +6 -6 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 28 09:16:02 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.434: preferred, colored
Changes since revision 1.434: +45 -10 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 28 06:59:08 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.433: preferred, colored
Changes since revision 1.433: +15 -15 lines
Change debug flags to be better than before.

Revision 1.433: download - view: text, markup, annotated - select for diffs
Fri Oct 28 06:27:11 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.432: preferred, colored
Changes since revision 1.432: +6 -4 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Oct 28 05:50:18 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.431: preferred, colored
Changes since revision 1.431: +10 -11 lines
- Use MII_ADDRMASK.
- Remove debug printf().

Revision 1.431: download - view: text, markup, annotated - select for diffs
Fri Oct 28 05:29:11 2016 UTC (8 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.430: preferred, colored
Changes since revision 1.430: +12 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 28 05:21:48 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.429: preferred, colored
Changes since revision 1.429: +25 -12 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Oct 28 04:14:13 2016 UTC (8 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.428: preferred, colored
Changes since revision 1.428: +105 -36 lines
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 - view: text, markup, annotated - select for diffs
Wed Oct 26 10:21:44 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.427: preferred, colored
Changes since revision 1.427: +7 -3 lines
Use wm_gmii_82544_{read,write}reg() on non-82567 ICH8, 9 and 10.

Revision 1.427: download - view: text, markup, annotated - select for diffs
Wed Oct 26 07:22:14 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.426: preferred, colored
Changes since revision 1.426: +3 -2 lines
82567V_3 is BME1000_E_2(bm). Tested with Advantech AIMB-212 1st Ethernet port.

Revision 1.426: download - view: text, markup, annotated - select for diffs
Wed Oct 26 06:51:35 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.425: preferred, colored
Changes since revision 1.425: +5 -5 lines
82567V-3 is not ICH9 but ICH8.

Revision 1.425: download - view: text, markup, annotated - select for diffs
Fri Oct 21 08:30:48 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.424: preferred, colored
Changes since revision 1.424: +27 -12 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Oct 21 04:41:09 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.423: preferred, colored
Changes since revision 1.423: +368 -222 lines
- 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 - view: text, markup, annotated - select for diffs
Thu Oct 20 08:03:13 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.422: preferred, colored
Changes since revision 1.422: +39 -15 lines
- 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 - view: text, markup, annotated - select for diffs
Thu Oct 20 05:53:27 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.421: preferred, colored
Changes since revision 1.421: +17 -2 lines
Add newer I219 devices (not enabled).

Revision 1.421: download - view: text, markup, annotated - select for diffs
Thu Oct 20 04:06:53 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.420: preferred, colored
Changes since revision 1.420: +11 -2 lines
Add more DPRINTF()s.

Revision 1.420: download - view: text, markup, annotated - select for diffs
Wed Oct 19 08:55:23 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.419: preferred, colored
Changes since revision 1.419: +112 -15 lines
No, functional change:
- Add WM_DEBUG_LOCK
- Add some KASSERT
- Modify comment.

Revision 1.419: download - view: text, markup, annotated - select for diffs
Wed Oct 19 08:22:57 2016 UTC (8 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.418: preferred, colored
Changes since revision 1.418: +13 -4 lines
- Drop the host wakeup bit after resetting PHY on PCH and newer devices.
- Increase delay while toggling LANPHYPC

Revision 1.418: download - view: text, markup, annotated - select for diffs
Tue Oct 11 15:48:17 2016 UTC (8 years, 2 months ago) by skrll
Branches: MAIN
Diff to: previous 1.417: preferred, colored
Changes since revision 1.417: +4 -5 lines
Read sc_if_flags after taking core lock

Revision 1.308.2.8: download - view: text, markup, annotated - select for diffs
Wed Oct 5 20:55:43 2016 UTC (8 years, 2 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.7: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.7: +142 -109 lines
Sync with HEAD

Revision 1.227.2.20: download - view: text, markup, annotated - select for diffs
Sat Sep 24 13:14:57 2016 UTC (8 years, 2 months ago) by bouyer
Branches: netbsd-6
Diff to: previous 1.227.2.19: preferred, colored; branchpoint 1.227: preferred, colored; next MAIN 1.228: preferred, colored
Changes since revision 1.227.2.19: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Wed Aug 10 04:52:40 2016 UTC (8 years, 4 months ago) by knakahara
Branches: MAIN
CVS tags: nick-nhusb-base-20161004, localcount-20160914
Diff to: previous 1.416: preferred, colored
Changes since revision 1.416: +138 -105 lines
restructure wm(4) evcnt to support multiqueue evcnt.

ok by msaitou@n.o.

Revision 1.416: download - view: text, markup, annotated - select for diffs
Mon Jul 11 06:14:51 2016 UTC (8 years, 5 months ago) by knakahara
Branches: MAIN
CVS tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726
Branch point for: pgoyette-localcount
Diff to: previous 1.415: preferred, colored
Changes since revision 1.415: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Sat Jul 9 20:25:04 2016 UTC (8 years, 5 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.6: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.6: +57 -81 lines
Sync with HEAD

Revision 1.415: download - view: text, markup, annotated - select for diffs
Mon Jun 20 08:34:59 2016 UTC (8 years, 5 months ago) by knakahara
Branches: MAIN
CVS tags: nick-nhusb-base-20160907
Diff to: previous 1.414: preferred, colored
Changes since revision 1.414: +7 -2 lines
wm(4) can enable IFEF_START_MPSAFE now.

Revision 1.414: download - view: text, markup, annotated - select for diffs
Tue Jun 14 17:09:20 2016 UTC (8 years, 5 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.413: preferred, colored
Changes since revision 1.413: +3 -6 lines
fix: rxq->rxq_lock is uninitialized if NET_MPSAFE is not defined.

Revision 1.413: download - view: text, markup, annotated - select for diffs
Tue Jun 14 09:07:22 2016 UTC (8 years, 5 months ago) by skrll
Branches: MAIN
Diff to: previous 1.412: preferred, colored
Changes since revision 1.412: +49 -75 lines
Simplify the code.

WM_[RT]X_* macros are removed and replaced with mutex_* calls directly.

OK from nakahara@ and msaitoh@

Revision 1.412: download - view: text, markup, annotated - select for diffs
Fri Jun 10 13:27:14 2016 UTC (8 years, 6 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.411: preferred, colored
Changes since revision 1.411: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Mon May 30 03:54:12 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.410: preferred, colored
Changes since revision 1.410: +3 -3 lines
fix r1.409 mistake

Revision 1.308.2.6: download - view: text, markup, annotated - select for diffs
Sun May 29 08:44:22 2016 UTC (8 years, 6 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.5: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.5: +718 -441 lines
Sync with HEAD

Revision 1.410: download - view: text, markup, annotated - select for diffs
Mon May 23 23:36:02 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
CVS tags: nick-nhusb-base-20160529
Diff to: previous 1.409: preferred, colored
Changes since revision 1.409: +3 -2 lines
Update TODO: evcnt

Revision 1.409: download - view: text, markup, annotated - select for diffs
Mon May 23 04:07:29 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.408: preferred, colored
Changes since revision 1.408: +6 -3 lines
fix: ethernet controllers which use wiseman_txdesc_t (earlier than 82575) hang
possibly.

Revision 1.408: download - view: text, markup, annotated - select for diffs
Mon May 23 03:30:40 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.407: preferred, colored
Changes since revision 1.407: +3 -6 lines
GENERIC kernel (disabled NET_MPSAFE kernel) also needs txq_lock to avoid race
between tx processing and tx interrupt handler.

Revision 1.407: download - view: text, markup, annotated - select for diffs
Fri May 20 08:17:14 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.406: preferred, colored
Changes since revision 1.406: +4 -3 lines
Update TODO

    - "TX Multiqueue" -> "TX Multiqueue improvement"
    - add "Advanced Recieve Descriptor" (RX NEWQUEUE)

Revision 1.406: download - view: text, markup, annotated - select for diffs
Thu May 19 08:35:03 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.405: preferred, colored
Changes since revision 1.405: +3 -3 lines
fix build failure by gcc 4.8.5

Revision 1.405: download - view: text, markup, annotated - select for diffs
Thu May 19 08:27:57 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.404: preferred, colored
Changes since revision 1.404: +212 -350 lines
unify TX and RX interrupt handler to use MSI-X vector efficiently

Revision 1.404: download - view: text, markup, annotated - select for diffs
Thu May 19 08:22:37 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.403: preferred, colored
Changes since revision 1.403: +21 -11 lines
user-friendly interrupt affinity offset

Revision 1.403: download - view: text, markup, annotated - select for diffs
Thu May 19 08:20:06 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.402: preferred, colored
Changes since revision 1.402: +143 -31 lines
initial TX multiqueue support

Revision 1.402: download - view: text, markup, annotated - select for diffs
Wed May 18 08:59:56 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.401: preferred, colored
Changes since revision 1.401: +5 -6 lines
Whether Tx interrupt handler kicks if_start() should not depend on wm_txeof()
return value.

Revision 1.401: download - view: text, markup, annotated - select for diffs
Wed May 18 08:41:42 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.400: preferred, colored
Changes since revision 1.400: +8 -8 lines
rename WM_TXQ_WORKING to WM_TXQ_NO_SPACE

Revision 1.400: download - view: text, markup, annotated - select for diffs
Wed May 18 07:49:34 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.399: preferred, colored
Changes since revision 1.399: +15 -6 lines
device drivers should not divert ifp->if_flags to manage H/W satatus.

Revision 1.399: download - view: text, markup, annotated - select for diffs
Wed May 18 06:59:59 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.398: preferred, colored
Changes since revision 1.398: +11 -15 lines
refactor: eliminate "txq->txq_descs_size", use WM_TXDESCS_SIZE instead.

Revision 1.398: download - view: text, markup, annotated - select for diffs
Wed May 18 06:55:51 2016 UTC (8 years, 6 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.397: preferred, colored
Changes since revision 1.397: +25 -20 lines
fix unmatched dma sync size for NEWQUEUE. This bug would have caused
wm_nq_tx_offload() not to work.

Revision 1.397: download - view: text, markup, annotated - select for diffs
Wed May 11 04:37:09 2016 UTC (8 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.396: preferred, colored
Changes since revision 1.396: +4 -4 lines
Fix compile error on some archs (e.g. i386).

Revision 1.396: download - view: text, markup, annotated - select for diffs
Wed May 11 03:46:06 2016 UTC (8 years, 7 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.395: preferred, colored
Changes since revision 1.395: +4 -4 lines
Interrupt handlers read wm_rxqueue or wm_txqueue, so they must be freed after
disestablishing interrupt handlers.

Revision 1.395: download - view: text, markup, annotated - select for diffs
Wed May 11 02:23:50 2016 UTC (8 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.394: preferred, colored
Changes since revision 1.394: +7 -3 lines
Do I219 TX DMA workaround only when TDLEN(0) != 0

Revision 1.227.2.19: download - view: text, markup, annotated - select for diffs
Fri May 6 18:43:34 2016 UTC (8 years, 7 months ago) by snj
Branches: netbsd-6
Diff to: previous 1.227.2.18: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.18: +681 -155 lines
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 - view: text, markup, annotated - select for diffs
Fri May 6 10:56:04 2016 UTC (8 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.393: preferred, colored
Changes since revision 1.393: +35 -8 lines
- 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 - view: text, markup, annotated - select for diffs
Fri May 6 08:57:43 2016 UTC (8 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.392: preferred, colored
Changes since revision 1.392: +49 -2 lines
Add some workaround code for I219. It still doesn't work.

Revision 1.392: download - view: text, markup, annotated - select for diffs
Fri May 6 08:56:20 2016 UTC (8 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.391: preferred, colored
Changes since revision 1.391: +240 -36 lines
Basic support for I219. It doesn't work on I219, so it's disabled.

Revision 1.308.2.5: download - view: text, markup, annotated - select for diffs
Sat Mar 19 11:30:10 2016 UTC (8 years, 8 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.4: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.4: +169 -168 lines
Sync with HEAD

Revision 1.289.2.9: download - view: text, markup, annotated - select for diffs
Fri Feb 26 22:08:17 2016 UTC (8 years, 9 months ago) by snj
Branches: netbsd-7
CVS tags: netbsd-7-nhusb-base
Branch point for: netbsd-7-nhusb
Diff to: previous 1.289.2.8: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.8: +1140 -394 lines
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 - view: text, markup, annotated - select for diffs
Tue Feb 9 08:32:11 2016 UTC (8 years, 10 months ago) by ozaki-r
Branches: MAIN
CVS tags: nick-nhusb-base-20160422, nick-nhusb-base-20160319
Diff to: previous 1.390: preferred, colored
Changes since revision 1.390: +9 -5 lines
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 - view: text, markup, annotated - select for diffs
Fri Feb 5 13:06:24 2016 UTC (8 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.389: preferred, colored
Changes since revision 1.389: +8 -8 lines
s/max/ralmax/. No functional change.

Revision 1.389: download - view: text, markup, annotated - select for diffs
Fri Jan 29 11:30:03 2016 UTC (8 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.388: preferred, colored
Changes since revision 1.388: +3 -6 lines
Remove debug message.

Revision 1.388: download - view: text, markup, annotated - select for diffs
Thu Jan 7 10:08:18 2016 UTC (8 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.387: preferred, colored
Changes since revision 1.387: +155 -155 lines
- printf->DPRINTF in wm_serdes_mediastatus().
- KNF.

Revision 1.308.2.4: download - view: text, markup, annotated - select for diffs
Sun Dec 27 12:09:50 2015 UTC (8 years, 11 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.3: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.3: +2024 -1132 lines
Sync with HEAD (as of 26th Dec)

Revision 1.387: download - view: text, markup, annotated - select for diffs
Fri Dec 25 05:45:40 2015 UTC (8 years, 11 months ago) by msaitoh
Branches: MAIN
CVS tags: nick-nhusb-base-20151226
Diff to: previous 1.386: preferred, colored
Changes since revision 1.386: +7 -3 lines
 Modify comment for 82544 Errata 9 "Certain register cannot be written with
particular alignments in PCI-X bus operation".

Revision 1.386: download - view: text, markup, annotated - select for diffs
Fri Dec 25 04:50:16 2015 UTC (8 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.385: preferred, colored
Changes since revision 1.385: +44 -22 lines
- 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 - view: text, markup, annotated - select for diffs
Tue Dec 22 02:17:21 2015 UTC (8 years, 11 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.384: preferred, colored
Changes since revision 1.384: +3 -3 lines
fix potentially bug

Revision 1.384: download - view: text, markup, annotated - select for diffs
Tue Dec 22 02:10:25 2015 UTC (8 years, 11 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.383: preferred, colored
Changes since revision 1.383: +4 -6 lines
fix incorrect KASSERT

Revision 1.383: download - view: text, markup, annotated - select for diffs
Fri Dec 18 09:57:57 2015 UTC (8 years, 11 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.382: preferred, colored
Changes since revision 1.382: +13 -6 lines
set Tx/Rx interrupts affinity to other than CPU#0 as much as possible

Revision 1.382: download - view: text, markup, annotated - select for diffs
Sun Dec 13 19:06:43 2015 UTC (9 years ago) by christos
Branches: MAIN
Diff to: previous 1.381: preferred, colored
Changes since revision 1.381: +3 -3 lines
PR/50527: David Binderman: Fix impossible code. Odd offsets need special
treatment.

Revision 1.381: download - view: text, markup, annotated - select for diffs
Fri Oct 30 19:22:01 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.380: preferred, colored
Changes since revision 1.380: +13 -7 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Oct 30 18:52:15 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.379: preferred, colored
Changes since revision 1.379: +19 -12 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Oct 30 18:29:08 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.378: preferred, colored
Changes since revision 1.378: +4 -3 lines
 Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT.

Revision 1.378: download - view: text, markup, annotated - select for diffs
Fri Oct 30 18:23:37 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.377: preferred, colored
Changes since revision 1.377: +10 -4 lines
 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 - view: text, markup, annotated - select for diffs
Fri Oct 30 07:44:52 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.376: preferred, colored
Changes since revision 1.376: +38 -17 lines
 Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.

Revision 1.376: download - view: text, markup, annotated - select for diffs
Fri Oct 30 07:35:30 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.375: preferred, colored
Changes since revision 1.375: +5 -9 lines
igphy(4),ukphy(4): Set mii_mpd_* entries.
wm(4): check PHY type correctly.

Revision 1.375: download - view: text, markup, annotated - select for diffs
Thu Oct 29 07:24:01 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.374: preferred, colored
Changes since revision 1.374: +18 -8 lines
 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 - view: text, markup, annotated - select for diffs
Thu Oct 22 09:51:21 2015 UTC (9 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.373: preferred, colored
Changes since revision 1.373: +2 -57 lines
if_wm uses pci_intr_alloc stubs now.

Revision 1.373: download - view: text, markup, annotated - select for diffs
Thu Oct 22 07:00:05 2015 UTC (9 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.372: preferred, colored
Changes since revision 1.372: +5 -2 lines
add CTASSERT and KNF.

Revision 1.372: download - view: text, markup, annotated - select for diffs
Thu Oct 22 06:01:41 2015 UTC (9 years, 1 month ago) by knakahara
Branches: MAIN
Diff to: previous 1.371: preferred, colored
Changes since revision 1.371: +42 -4 lines
initial port rss_getkey() from freebsd, and use it instead of random().

Revision 1.371: download - view: text, markup, annotated - select for diffs
Wed Oct 14 07:16:04 2015 UTC (9 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.370: preferred, colored
Changes since revision 1.370: +208 -206 lines
- Update TODO:
  - "Multiqueue" -> "TX Multiqueue" because RX Multiqueue was added.
  - Sort entries.
- Grouping functions.

Revision 1.370: download - view: text, markup, annotated - select for diffs
Tue Oct 13 21:28:41 2015 UTC (9 years, 2 months ago) by christos
Branches: MAIN
Diff to: previous 1.369: preferred, colored
Changes since revision 1.369: +4 -4 lines
sprinkle __diagused

Revision 1.369: download - view: text, markup, annotated - select for diffs
Tue Oct 13 10:26:21 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.368: preferred, colored
Changes since revision 1.368: +3 -3 lines
wm_linkintr_msix() should use WM_DEBUG_LINK instead of WM_DEBUG_TX.

Revision 1.368: download - view: text, markup, annotated - select for diffs
Tue Oct 13 10:21:21 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.367: preferred, colored
Changes since revision 1.367: +6 -4 lines
recover if_wm.c:r1.348

Revision 1.367: download - view: text, markup, annotated - select for diffs
Tue Oct 13 09:10:01 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.366: preferred, colored
Changes since revision 1.366: +59 -58 lines
fix: XEN3_DOM0(not defined __HAVE_PCI_MSI_MSIX) build

Revision 1.366: download - view: text, markup, annotated - select for diffs
Tue Oct 13 09:03:58 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.365: preferred, colored
Changes since revision 1.365: +16 -16 lines
fix: WM_DEBUG build

Revision 1.365: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:36:02 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.364: preferred, colored
Changes since revision 1.364: +182 -6 lines
support RX multiqueue.

ok by msaitoh@n.o

Revision 1.364: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:33:12 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.363: preferred, colored
Changes since revision 1.363: +420 -242 lines
ready to support RX multiqueue.

ok by msaitoh@n.o

Revision 1.363: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:29:44 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.362: preferred, colored
Changes since revision 1.362: +23 -19 lines
refactor: rearrange interrupt handlers argument

Revision 1.362: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:27:11 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.361: preferred, colored
Changes since revision 1.361: +121 -130 lines
refactor: rearrange function arguments without interrupt handlers

Revision 1.361: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:23:31 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.360: preferred, colored
Changes since revision 1.360: +30 -30 lines
change const value register macros to macro expressions to support multiqueue.

Revision 1.360: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:20:02 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.359: preferred, colored
Changes since revision 1.359: +137 -102 lines
refactor: separate interrupts setup processing from wm_attach

Revision 1.359: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:17:15 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.358: preferred, colored
Changes since revision 1.358: +9 -9 lines
allocating queues should be finished before establishing interrupts.

Revision 1.358: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:14:27 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.357: preferred, colored
Changes since revision 1.357: +17 -7 lines
refactor: separate discriptors initialization and registers initialization

Revision 1.357: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:11:31 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.356: preferred, colored
Changes since revision 1.356: +122 -82 lines
separete TX, RX queue mutex from wm_softc and rearrange WM_BOTH_LOCK.

ok by msaitoh@n.o

Revision 1.356: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:08:03 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.355: preferred, colored
Changes since revision 1.355: +389 -300 lines
refactor: separate TX, RX queue variables from wm_softc (without mutex)

Revision 1.355: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:03:59 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.354: preferred, colored
Changes since revision 1.354: +222 -133 lines
refactor: separate busdma initialize processing as functions

Revision 1.354: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:00:15 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.353: preferred, colored
Changes since revision 1.353: +156 -81 lines
separate TX dma control data and RX dma control data.

ok by msaitoh@n.o

Revision 1.353: download - view: text, markup, annotated - select for diffs
Tue Oct 13 07:53:02 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.352: preferred, colored
Changes since revision 1.352: +224 -123 lines
refactor: separate busdma allocate processing as functions.

Revision 1.352: download - view: text, markup, annotated - select for diffs
Tue Oct 13 07:47:45 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.351: preferred, colored
Changes since revision 1.351: +88 -78 lines
refactor: change some macros to functions

change below macros to functions
    - WM_CDTXSYNC
    - WM_CDRXSYNC
    - WM_INIT_RXDESC

Revision 1.351: download - view: text, markup, annotated - select for diffs
Thu Oct 8 09:28:13 2015 UTC (9 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.350: preferred, colored
Changes since revision 1.350: +5 -9 lines
 Fix a bug that LSC's interrupt storm occured when MSI-X is used.
It was observed only on 82575.

Revision 1.350: download - view: text, markup, annotated - select for diffs
Wed Sep 30 04:28:04 2015 UTC (9 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.349: preferred, colored
Changes since revision 1.349: +18 -3 lines
-  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 - view: text, markup, annotated - select for diffs
Mon Sep 28 07:02:57 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.348: preferred, colored
Changes since revision 1.348: +17 -5 lines
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 - view: text, markup, annotated - select for diffs
Mon Sep 28 06:04:04 2015 UTC (9 years, 2 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.347: preferred, colored
Changes since revision 1.347: +6 -4 lines
use sc->sc_itr instead of hard-coded number.

ok by msaitoh@n.o

Revision 1.308.2.3: download - view: text, markup, annotated - select for diffs
Tue Sep 22 12:05:59 2015 UTC (9 years, 2 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.2: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.2: +604 -81 lines
Sync with HEAD

Revision 1.347: download - view: text, markup, annotated - select for diffs
Mon Sep 7 15:19:05 2015 UTC (9 years, 3 months ago) by msaitoh
Branches: MAIN
CVS tags: nick-nhusb-base-20150921
Diff to: previous 1.346: preferred, colored
Changes since revision 1.346: +35 -10 lines
- Check iNVM's image version and print it.
- Update TODO.

Revision 1.346: download - view: text, markup, annotated - select for diffs
Mon Aug 17 06:16:03 2015 UTC (9 years, 3 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.345: preferred, colored
Changes since revision 1.345: +16 -8 lines
Add kernel code to support intrctl(8).

Revision 1.345: download - view: text, markup, annotated - select for diffs
Tue Jul 28 07:15:03 2015 UTC (9 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.344: preferred, colored
Changes since revision 1.344: +7 -5 lines
 Print interrupt type correctly.

Revision 1.344: download - view: text, markup, annotated - select for diffs
Thu Jul 23 08:29:58 2015 UTC (9 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.343: preferred, colored
Changes since revision 1.343: +4 -6 lines
 Fix a bug that I21[01] NVM revision >= 3.25 can't be attached.
Reported by MATSUI Yoshihiro.

Revision 1.343: download - view: text, markup, annotated - select for diffs
Thu Jul 23 08:24:07 2015 UTC (9 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.342: preferred, colored
Changes since revision 1.342: +3 -3 lines
 The WM_F_EEPROM_EERDEEWR is not required on iNVM device.

Revision 1.342: download - view: text, markup, annotated - select for diffs
Wed Jul 22 11:14:13 2015 UTC (9 years, 4 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.341: preferred, colored
Changes since revision 1.341: +3 -3 lines
fix typo

Revision 1.341: download - view: text, markup, annotated - select for diffs
Wed Jul 22 08:22:55 2015 UTC (9 years, 4 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.340: preferred, colored
Changes since revision 1.340: +3 -5 lines
Sorry, if_wm turns MSI/MSI-X default off by my mistake.

Revision 1.340: download - view: text, markup, annotated - select for diffs
Tue Jul 21 03:15:50 2015 UTC (9 years, 4 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.339: preferred, colored
Changes since revision 1.339: +122 -172 lines
mofity for if_wm and if_bge to use pci_intr_alloc()

Revision 1.339: download - view: text, markup, annotated - select for diffs
Wed Jul 15 07:40:54 2015 UTC (9 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.338: preferred, colored
Changes since revision 1.338: +3 -5 lines
 Cleanup.

Revision 1.338: download - view: text, markup, annotated - select for diffs
Wed Jul 15 07:36:01 2015 UTC (9 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.337: preferred, colored
Changes since revision 1.337: +3 -3 lines
 Enable MSI/MSI-X feature by default.

Revision 1.337: download - view: text, markup, annotated - select for diffs
Wed Jul 15 04:03:16 2015 UTC (9 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.336: preferred, colored
Changes since revision 1.336: +8 -3 lines
 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 - view: text, markup, annotated - select for diffs
Fri Jun 26 06:57:17 2015 UTC (9 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.335: preferred, colored
Changes since revision 1.335: +8 -4 lines
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 - view: text, markup, annotated - select for diffs
Sat Jun 13 15:47:58 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.334: preferred, colored
Changes since revision 1.334: +539 -32 lines
 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 - view: text, markup, annotated - select for diffs
Fri Jun 12 04:40:28 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.333: preferred, colored
Changes since revision 1.333: +32 -9 lines
- Print NVM version on 8257[124], too.
- Modify NVM version string a bit.

Revision 1.289.2.8: download - view: text, markup, annotated - select for diffs
Wed Jun 10 16:43:51 2015 UTC (9 years, 6 months ago) by snj
Branches: 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
Diff to: previous 1.289.2.7: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.7: +12 -11 lines
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 - view: text, markup, annotated - select for diffs
Wed Jun 10 12:14:59 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.332: preferred, colored
Changes since revision 1.332: +2 -5 lines
 Remove extra if_start() in wm_ioctl().

Revision 1.332: download - view: text, markup, annotated - select for diffs
Mon Jun 8 03:45:19 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.331: preferred, colored
Changes since revision 1.331: +12 -10 lines
 Call wm_pll_workaround_i210() at the end of the wm_reset() function, too.

Revision 1.331: download - view: text, markup, annotated - select for diffs
Sat Jun 6 17:36:50 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.330: preferred, colored
Changes since revision 1.330: +11 -8 lines
 Fix the output of the option ROM version.

Revision 1.308.2.2: download - view: text, markup, annotated - select for diffs
Sat Jun 6 14:40:09 2015 UTC (9 years, 6 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308.2.1: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.1: +1040 -302 lines
Sync with HEAD

Revision 1.330: download - view: text, markup, annotated - select for diffs
Sat Jun 6 07:44:22 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.329: preferred, colored
Changes since revision 1.329: +33 -30 lines
 Cleanup.

Revision 1.329: download - view: text, markup, annotated - select for diffs
Sat Jun 6 04:39:12 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
CVS tags: nick-nhusb-base-20150606
Diff to: previous 1.328: preferred, colored
Changes since revision 1.328: +179 -8 lines
- 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 - view: text, markup, annotated - select for diffs
Sat Jun 6 03:38:40 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.327: preferred, colored
Changes since revision 1.327: +85 -7 lines
 Print NVM image version.

Revision 1.327: download - view: text, markup, annotated - select for diffs
Sat Jun 6 03:37:01 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.326: preferred, colored
Changes since revision 1.326: +25 -572 lines
 Revert previos. Sorry, I committed in another working directory...

Revision 1.326: download - view: text, markup, annotated - select for diffs
Sat Jun 6 03:33:37 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.325: preferred, colored
Changes since revision 1.325: +572 -25 lines
 Print NVM image version.

Revision 1.325: download - view: text, markup, annotated - select for diffs
Tue Jun 2 14:19:26 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.324: preferred, colored
Changes since revision 1.324: +431 -97 lines
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 - view: text, markup, annotated - select for diffs
Tue Jun 2 13:26:36 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.323: preferred, colored
Changes since revision 1.323: +132 -132 lines
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 - view: text, markup, annotated - select for diffs
Tue Jun 2 03:49:10 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.322: preferred, colored
Changes since revision 1.322: +10 -10 lines
 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 - view: text, markup, annotated - select for diffs
Fri May 22 03:15:43 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.321: preferred, colored
Changes since revision 1.321: +4 -3 lines
- 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 - view: text, markup, annotated - select for diffs
Tue May 19 05:09:02 2015 UTC (9 years, 6 months ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.6: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.6: +130 -8 lines
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 - view: text, markup, annotated - select for diffs
Sat May 16 22:41:59 2015 UTC (9 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.320: preferred, colored
Changes since revision 1.320: +130 -8 lines
 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 - view: text, markup, annotated - select for diffs
Mon May 4 10:10:42 2015 UTC (9 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.319: preferred, colored
Changes since revision 1.319: +38 -15 lines
 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 - view: text, markup, annotated - select for diffs
Mon May 4 08:46:09 2015 UTC (9 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.318: preferred, colored
Changes since revision 1.318: +42 -24 lines
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 - view: text, markup, annotated - select for diffs
Mon May 4 06:51:08 2015 UTC (9 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.317: preferred, colored
Changes since revision 1.317: +4 -3 lines
 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 - view: text, markup, annotated - select for diffs
Mon May 4 06:44:13 2015 UTC (9 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.316: preferred, colored
Changes since revision 1.316: +2 -4 lines
 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 - view: text, markup, annotated - select for diffs
Thu Apr 30 20:00:26 2015 UTC (9 years, 7 months ago) by snj
Branches: netbsd-5
Diff to: previous 1.162.4.20: preferred, colored; branchpoint 1.162: preferred, colored; next MAIN 1.163: preferred, colored
Changes since revision 1.162.4.20: +788 -316 lines
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 - view: text, markup, annotated - select for diffs
Thu Apr 30 19:53:28 2015 UTC (9 years, 7 months ago) by snj
Branches: netbsd-6
Diff to: previous 1.227.2.17: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.17: +32 -16 lines
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 - view: text, markup, annotated - select for diffs
Sun Apr 26 09:03:12 2015 UTC (9 years, 7 months ago) by martin
Branches: netbsd-5
Diff to: previous 1.162.4.19: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.19: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Sun Apr 19 17:01:50 2015 UTC (9 years, 7 months ago) by riz
Branches: netbsd-6
Diff to: previous 1.227.2.16: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.16: +15 -21 lines
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 - view: text, markup, annotated - select for diffs
Sun Apr 19 06:50:22 2015 UTC (9 years, 7 months ago) by riz
Branches: netbsd-7
Diff to: previous 1.289.2.5: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.5: +10 -18 lines
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 - view: text, markup, annotated - select for diffs
Fri Apr 17 02:54:15 2015 UTC (9 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.315: preferred, colored
Changes since revision 1.315: +10 -18 lines
 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 - view: text, markup, annotated - select for diffs
Thu Apr 16 06:20:08 2015 UTC (9 years, 7 months ago) by snj
Branches: netbsd-6
Diff to: previous 1.227.2.15: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.15: +204 -11 lines
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 - view: text, markup, annotated - select for diffs
Thu Apr 16 06:10:43 2015 UTC (9 years, 7 months ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.4: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.4: +6 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Apr 13 16:33:25 2015 UTC (9 years, 8 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.314: preferred, colored
Changes since revision 1.314: +3 -3 lines
Convert sys/dev to use <sys/rndsource.h>.

Revision 1.308.2.1: download - view: text, markup, annotated - select for diffs
Mon Apr 6 15:18:10 2015 UTC (9 years, 8 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.308: preferred, colored
Changes since revision 1.308: +246 -43 lines
Sync with HEAD

Revision 1.314: download - view: text, markup, annotated - select for diffs
Sat Mar 28 17:35:59 2015 UTC (9 years, 8 months ago) by msaitoh
Branches: MAIN
CVS tags: nick-nhusb-base-20150406
Diff to: previous 1.313: preferred, colored
Changes since revision 1.313: +6 -4 lines
 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 - view: text, markup, annotated - select for diffs
Wed Mar 18 04:39:15 2015 UTC (9 years, 8 months ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.3: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.3: +237 -40 lines
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 - view: text, markup, annotated - select for diffs
Mon Feb 16 00:25:52 2015 UTC (9 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.312: preferred, colored
Changes since revision 1.312: +3 -3 lines
 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 - view: text, markup, annotated - select for diffs
Sun Feb 15 21:32:33 2015 UTC (9 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.311: preferred, colored
Changes since revision 1.311: +202 -9 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Feb 13 09:00:50 2015 UTC (9 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.310: preferred, colored
Changes since revision 1.310: +34 -30 lines
 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 - view: text, markup, annotated - select for diffs
Wed Feb 4 10:55:00 2015 UTC (9 years, 10 months ago) by martin
Branches: netbsd-6
Diff to: previous 1.227.2.14: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.14: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Wed Feb 4 06:48:13 2015 UTC (9 years, 10 months ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.2: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.2: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Thu Jan 29 02:59:17 2015 UTC (9 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.309: preferred, colored
Changes since revision 1.309: +3 -3 lines
 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 - view: text, markup, annotated - select for diffs
Fri Jan 16 10:36:14 2015 UTC (9 years, 10 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.308: preferred, colored
Changes since revision 1.308: +6 -2 lines
Introduce defflag for NET_MPSAFE

Revision 1.227.2.14: download - view: text, markup, annotated - select for diffs
Thu Dec 4 06:04:07 2014 UTC (10 years ago) by snj
Branches: netbsd-6
Diff to: previous 1.227.2.13: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.13: +510 -366 lines
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 - view: text, markup, annotated - select for diffs
Sun Nov 16 09:47:35 2014 UTC (10 years ago) by msaitoh
Branches: MAIN
CVS tags: nick-nhusb-base
Branch point for: nick-nhusb
Diff to: previous 1.307: preferred, colored
Changes since revision 1.307: +12 -3 lines
Add C2000 KX and 2.5G.

Revision 1.227.2.13: download - view: text, markup, annotated - select for diffs
Sun Nov 9 12:13:15 2014 UTC (10 years, 1 month ago) by martin
Branches: netbsd-6
Diff to: previous 1.227.2.12: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.12: +4 -2 lines
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 - view: text, markup, annotated - select for diffs
Sun Nov 9 12:03:18 2014 UTC (10 years, 1 month ago) by martin
Branches: netbsd-6
Diff to: previous 1.227.2.11: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.11: +206 -44 lines
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 - view: text, markup, annotated - select for diffs
Fri Nov 7 21:34:56 2014 UTC (10 years, 1 month ago) by snj
Branches: netbsd-7
Diff to: previous 1.289.2.1: preferred, colored; branchpoint 1.289: preferred, colored
Changes since revision 1.289.2.1: +538 -325 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 24 17:58:09 2014 UTC (10 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.306: preferred, colored
Changes since revision 1.306: +4 -20 lines
Simplify. No functional change.

Revision 1.306: download - view: text, markup, annotated - select for diffs
Fri Oct 24 17:50:50 2014 UTC (10 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.305: preferred, colored
Changes since revision 1.305: +19 -40 lines
 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 - view: text, markup, annotated - select for diffs
Fri Oct 17 17:48:53 2014 UTC (10 years, 1 month ago) by snj
Branches: MAIN
Diff to: previous 1.304: preferred, colored
Changes since revision 1.304: +3 -3 lines
There's an r in "determine"

Revision 1.304: download - view: text, markup, annotated - select for diffs
Fri Oct 10 11:04:21 2014 UTC (10 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.303: preferred, colored
Changes since revision 1.303: +31 -7 lines
- Support DH89XXCC devices.
- Add extra delay for 82580 and newer devices except DH89XXCC SGMII device.
  Same as FreeBSD.

Revision 1.303: download - view: text, markup, annotated - select for diffs
Tue Oct 7 08:45:02 2014 UTC (10 years, 2 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.302: preferred, colored
Changes since revision 1.302: +8 -12 lines
Tidy up locking in wm_ioctl

Revision 1.302: download - view: text, markup, annotated - select for diffs
Tue Oct 7 07:04:35 2014 UTC (10 years, 2 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.301: preferred, colored
Changes since revision 1.301: +10 -2 lines
Don't call ifmedia_ioctl with holding locks

Revision 1.301: download - view: text, markup, annotated - select for diffs
Mon Oct 6 07:52:50 2014 UTC (10 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.300: preferred, colored
Changes since revision 1.300: +4 -4 lines
Fix debug message.

Revision 1.300: download - view: text, markup, annotated - select for diffs
Mon Oct 6 07:31:24 2014 UTC (10 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.299: preferred, colored
Changes since revision 1.299: +10 -33 lines
 Delete 82580ER related code. It was from FreeBSD and was removed in r203049.

Revision 1.299: download - view: text, markup, annotated - select for diffs
Mon Oct 6 07:09:30 2014 UTC (10 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.298: preferred, colored
Changes since revision 1.298: +46 -6 lines
 Add some devices. Not tested because I have no any of these devices/cards.

Revision 1.298: download - view: text, markup, annotated - select for diffs
Tue Sep 16 07:06:42 2014 UTC (10 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.297: preferred, colored
Changes since revision 1.297: +14 -2 lines
Add some new I218 devices.

Revision 1.297: download - view: text, markup, annotated - select for diffs
Thu Sep 11 17:09:04 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.296: preferred, colored
Changes since revision 1.296: +4 -4 lines
 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 - view: text, markup, annotated - select for diffs
Thu Sep 4 02:34:32 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.295: preferred, colored
Changes since revision 1.295: +2 -3 lines
Remove one obsolete TODO entry.

Revision 1.295: download - view: text, markup, annotated - select for diffs
Wed Sep 3 14:30:04 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.294: preferred, colored
Changes since revision 1.294: +88 -7 lines
Read SFF SFP ROM and configure driver from the value.

Revision 1.294: download - view: text, markup, annotated - select for diffs
Mon Sep 1 16:42:27 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.293: preferred, colored
Changes since revision 1.293: +114 -39 lines
 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 - view: text, markup, annotated - select for diffs
Fri Aug 29 12:14:29 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.292: preferred, colored
Changes since revision 1.292: +44 -51 lines
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 - view: text, markup, annotated - select for diffs
Fri Aug 29 11:37:51 2014 UTC (10 years, 3 months ago) by martin
Branches: netbsd-7
Diff to: previous 1.289: preferred, colored
Changes since revision 1.289: +13 -7 lines
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 - view: text, markup, annotated - select for diffs
Thu Aug 28 16:22:59 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.291: preferred, colored
Changes since revision 1.291: +90 -41 lines
 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 - view: text, markup, annotated - select for diffs
Tue Aug 26 14:44:00 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.290: preferred, colored
Changes since revision 1.290: +114 -114 lines
Modify WMP_F_1000{X,T} to WMP_F_{FIBER,COPPER}. No binary change.

Revision 1.290: download - view: text, markup, annotated - select for diffs
Sun Aug 24 21:15:35 2014 UTC (10 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.289: preferred, colored
Changes since revision 1.289: +13 -7 lines
 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 - view: text, markup, annotated - select for diffs
Wed Aug 20 00:03:42 2014 UTC (10 years, 3 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.234.2.3: preferred, colored
Changes since revision 1.234.2.3: +4758 -4194 lines
Rebase to HEAD as of a few days ago.

Revision 1.289: download - view: text, markup, annotated - select for diffs
Sun Aug 10 16:44:36 2014 UTC (10 years, 4 months ago) by tls
Branches: MAIN
CVS tags: tls-maxphys-base, netbsd-7-base
Branch point for: netbsd-7
Diff to: previous 1.288: preferred, colored
Changes since revision 1.288: +4 -3 lines
Merge tls-earlyentropy branch into HEAD.

Revision 1.268.2.2: download - view: text, markup, annotated - select for diffs
Sun Aug 10 06:54:54 2014 UTC (10 years, 4 months ago) by tls
Branches: tls-earlyentropy
Diff to: previous 1.268.2.1: preferred, colored; branchpoint 1.268: preferred, colored; next MAIN 1.269: preferred, colored
Changes since revision 1.268.2.1: +4068 -3715 lines
Rebase.

Revision 1.288: download - view: text, markup, annotated - select for diffs
Thu Aug 7 06:49:06 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
CVS tags: tls-earlyentropy-base
Diff to: previous 1.287: preferred, colored
Changes since revision 1.287: +3 -2 lines
Add one more TODO:
 - We should check XXX'ed comments.

Revision 1.287: download - view: text, markup, annotated - select for diffs
Wed Aug 6 02:55:50 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.286: preferred, colored
Changes since revision 1.286: +17 -14 lines
 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 - view: text, markup, annotated - select for diffs
Tue Aug 5 18:13:46 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.285: preferred, colored
Changes since revision 1.285: +7 -2 lines
Add some TODOs in comment.

Revision 1.285: download - view: text, markup, annotated - select for diffs
Thu Jul 31 03:50:09 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.284: preferred, colored
Changes since revision 1.284: +37 -62 lines
 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 - view: text, markup, annotated - select for diffs
Thu Jul 31 02:54:46 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.283: preferred, colored
Changes since revision 1.283: +9 -4 lines
 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 - view: text, markup, annotated - select for diffs
Mon Jul 28 06:36:09 2014 UTC (10 years, 4 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.282: preferred, colored
Changes since revision 1.282: +65 -52 lines
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 - view: text, markup, annotated - select for diffs
Fri Jul 25 18:28:03 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.281: preferred, colored
Changes since revision 1.281: +15 -3 lines
- 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 - view: text, markup, annotated - select for diffs
Wed Jul 23 10:48:16 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.280: preferred, colored
Changes since revision 1.280: +5401 -5402 lines
No functional change:
- Grouping functions.
- KNF.

Revision 1.280: download - view: text, markup, annotated - select for diffs
Wed Jul 23 09:44:52 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.279: preferred, colored
Changes since revision 1.279: +233 -149 lines
No functional change:
- Add missing prototypes.
- Rename functions for consistency and clarify.
- KNF.

Revision 1.279: download - view: text, markup, annotated - select for diffs
Tue Jul 22 04:20:39 2014 UTC (10 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.278: preferred, colored
Changes since revision 1.278: +37 -22 lines
 Add SERDES support from Matthias Drochner. Not all devices were tested but all
SERDES entries are enabled.

Revision 1.278: download - view: text, markup, annotated - select for diffs
Mon Jul 14 05:00:18 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.277: preferred, colored
Changes since revision 1.277: +3 -3 lines
Cleanup comments. No functional change.

Revision 1.277: download - view: text, markup, annotated - select for diffs
Mon Jul 14 01:24:58 2014 UTC (10 years, 5 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.276: preferred, colored
Changes since revision 1.276: +2 -4 lines
Remove a duplicated error message

Revision 1.276: download - view: text, markup, annotated - select for diffs
Fri Jul 11 08:50:08 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.275: preferred, colored
Changes since revision 1.275: +10 -10 lines
Fix compile error.

Revision 1.275: download - view: text, markup, annotated - select for diffs
Fri Jul 11 08:34:27 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.274: preferred, colored
Changes since revision 1.274: +34 -35 lines
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 - view: text, markup, annotated - select for diffs
Fri Jul 11 07:22:45 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.273: preferred, colored
Changes since revision 1.273: +4 -3 lines
 Restore the WM_F_EEPROM_SEMAPHORE flags for 82575-I354 and 80003 cases.
The flag was removed in last commit.

Revision 1.273: download - view: text, markup, annotated - select for diffs
Fri Jul 11 02:23:44 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.272: preferred, colored
Changes since revision 1.272: +34 -5 lines
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 - view: text, markup, annotated - select for diffs
Tue Jul 1 10:35:18 2014 UTC (10 years, 5 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.271: preferred, colored
Changes since revision 1.271: +233 -38 lines
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 - view: text, markup, annotated - select for diffs
Mon Jun 30 06:09:44 2014 UTC (10 years, 5 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.270: preferred, colored
Changes since revision 1.270: +21 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Jun 16 16:48:16 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.269: preferred, colored
Changes since revision 1.269: +4 -2 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jun 3 15:06:09 2014 UTC (10 years, 6 months ago) by msaitoh
Branches: netbsd-6-0
CVS tags: netbsd-6-0-6-RELEASE
Diff to: previous 1.227.2.3: preferred, colored; next MAIN 1.227.2.4: preferred, colored
Changes since revision 1.227.2.3: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue Jun 3 15:02:37 2014 UTC (10 years, 6 months ago) by msaitoh
Branches: netbsd-6-1
CVS tags: netbsd-6-1-5-RELEASE
Diff to: previous 1.227.2.8: preferred, colored; next MAIN 1.227.2.9: preferred, colored
Changes since revision 1.227.2.8: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue Jun 3 14:57:09 2014 UTC (10 years, 6 months ago) by msaitoh
Branches: netbsd-6
Diff to: previous 1.227.2.10: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.10: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue May 27 02:21:29 2014 UTC (10 years, 6 months ago) by tls
Branches: MAIN
Diff to: previous 1.268: preferred, colored
Changes since revision 1.268: +3 -3 lines
From dyoung@ -- bump max TX DMA size to avoid pathological condition with TSO.

Revision 1.223.2.4: download - view: text, markup, annotated - select for diffs
Thu May 22 11:40:25 2014 UTC (10 years, 6 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.223.2.3: preferred, colored; branchpoint 1.223: preferred, colored; next MAIN 1.224: preferred, colored
Changes since revision 1.223.2.3: +711 -217 lines
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 - view: text, markup, annotated - select for diffs
Sun May 18 17:45:40 2014 UTC (10 years, 6 months ago) by rmind
Branches: rmind-smpnet
Diff to: previous 1.261.2.1: preferred, colored; next MAIN 1.262: preferred, colored
Changes since revision 1.261.2.1: +210 -46 lines
sync with head

Revision 1.268.2.1: download - view: text, markup, annotated - select for diffs
Mon Apr 7 03:37:33 2014 UTC (10 years, 8 months ago) by tls
Branches: tls-earlyentropy
Diff to: previous 1.268: preferred, colored
Changes since revision 1.268: +4 -3 lines
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 - view: text, markup, annotated - select for diffs
Sat Mar 29 19:28:25 2014 UTC (10 years, 8 months ago) by christos
Branches: 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
Diff to: previous 1.267: preferred, colored
Changes since revision 1.267: +4 -3 lines
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 - view: text, markup, annotated - select for diffs
Tue Mar 25 16:19:13 2014 UTC (10 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.266: preferred, colored
Changes since revision 1.266: +4 -3 lines
kill sprintf

Revision 1.162.4.3.2.1.2.2: download - view: text, markup, annotated - select for diffs
Sat Feb 15 03:22:27 2014 UTC (10 years, 9 months ago) by matt
Branches: matt-nb5-mips64
Diff to: previous 1.162.4.3.2.1.2.1: preferred, colored; branchpoint 1.162.4.3.2.1: preferred, colored; next MAIN 1.162.4.4: preferred, colored
Changes since revision 1.162.4.3.2.1.2.1: +11 -11 lines
sync pcireg.h with HEAD.
update if_wm.c and ppb.c accordingly.

Revision 1.266: download - view: text, markup, annotated - select for diffs
Tue Jan 7 13:14:39 2014 UTC (10 years, 11 months ago) by msaitoh
Branches: MAIN
CVS tags: riastradh-drm2-base3
Diff to: previous 1.265: preferred, colored
Changes since revision 1.265: +47 -3 lines
 Insert completion barrier between register write and delay().
One exception is chip reset (to avoid hangup).

Revision 1.265: download - view: text, markup, annotated - select for diffs
Sun Dec 29 21:28:41 2013 UTC (10 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.264: preferred, colored
Changes since revision 1.264: +151 -34 lines
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 - view: text, markup, annotated - select for diffs
Fri Sep 13 21:22:10 2013 UTC (11 years, 2 months ago) by martin
Branches: MAIN
Diff to: previous 1.263: preferred, colored
Changes since revision 1.263: +11 -8 lines
Remove unused variables

Revision 1.263: download - view: text, markup, annotated - select for diffs
Sun Sep 8 03:17:02 2013 UTC (11 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.262: preferred, colored
Changes since revision 1.262: +3 -5 lines
Remove extra debug message.

Revision 1.162.4.19: download - view: text, markup, annotated - select for diffs
Sat Sep 7 17:10:18 2013 UTC (11 years, 3 months ago) by bouyer
Branches: netbsd-5
Diff to: previous 1.162.4.18: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.18: +259 -96 lines
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 - view: text, markup, annotated - select for diffs
Wed Aug 28 23:59:25 2013 UTC (11 years, 3 months ago) by rmind
Branches: rmind-smpnet
Diff to: previous 1.261: preferred, colored
Changes since revision 1.261: +5 -4 lines
sync with head

Revision 1.227.2.10: download - view: text, markup, annotated - select for diffs
Mon Jul 29 20:24:04 2013 UTC (11 years, 4 months ago) by jdc
Branches: netbsd-6
Diff to: previous 1.227.2.9: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.9: +90 -44 lines
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 - view: text, markup, annotated - select for diffs
Tue Jul 16 10:30:27 2013 UTC (11 years, 4 months ago) by msaitoh
Branches: MAIN
CVS tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Diff to: previous 1.261: preferred, colored
Changes since revision 1.261: +5 -4 lines
 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 - view: text, markup, annotated - select for diffs
Sun Jul 14 20:39:13 2013 UTC (11 years, 4 months ago) by riz
Branches: netbsd-6
Diff to: previous 1.227.2.8: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.8: +340 -147 lines
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 - view: text, markup, annotated - select for diffs
Thu Jun 27 09:57:49 2013 UTC (11 years, 5 months ago) by msaitoh
Branches: MAIN
Branch point for: rmind-smpnet
Diff to: previous 1.260: preferred, colored
Changes since revision 1.260: +26 -26 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jun 25 17:38:38 2013 UTC (11 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.259: preferred, colored
Changes since revision 1.259: +15 -6 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jun 25 02:34:00 2013 UTC (11 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.258: preferred, colored
Changes since revision 1.258: +52 -16 lines
 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 - view: text, markup, annotated - select for diffs
Sun Jun 23 06:20:18 2013 UTC (11 years, 5 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.234.2.2: preferred, colored
Changes since revision 1.234.2.2: +271 -108 lines
resync from head

Revision 1.258: download - view: text, markup, annotated - select for diffs
Wed Jun 19 10:53:24 2013 UTC (11 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.257: preferred, colored
Changes since revision 1.257: +6 -6 lines
Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.

Revision 1.257: download - view: text, markup, annotated - select for diffs
Wed Jun 19 10:38:51 2013 UTC (11 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.256: preferred, colored
Changes since revision 1.256: +22 -2 lines
Add ECC support for the packet buffer. Only 82571 and I21[78] support ECC.

Revision 1.256: download - view: text, markup, annotated - select for diffs
Wed Jun 19 10:27:08 2013 UTC (11 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.255: preferred, colored
Changes since revision 1.255: +6 -5 lines
Fix some bugs on I21[78] to make those devices stable.

Revision 1.162.4.18: download - view: text, markup, annotated - select for diffs
Wed Jun 19 07:50:15 2013 UTC (11 years, 5 months ago) by bouyer
Branches: netbsd-5
Diff to: previous 1.162.4.17: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.17: +1792 -296 lines
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 - view: text, markup, annotated - select for diffs
Tue Jun 11 14:39:35 2013 UTC (11 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.254: preferred, colored
Changes since revision 1.254: +4 -3 lines
 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 - view: text, markup, annotated - select for diffs
Tue Jun 11 10:07:09 2013 UTC (11 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.253: preferred, colored
Changes since revision 1.253: +4 -4 lines
The wm_linkintr_gmii() function is called from interrupt, so call
mii_pollstat() instead of mii_tick().

Revision 1.253: download - view: text, markup, annotated - select for diffs
Tue Jun 4 16:55:07 2013 UTC (11 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.252: preferred, colored
Changes since revision 1.252: +12 -11 lines
 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 - view: text, markup, annotated - select for diffs
Mon Jun 3 18:47:52 2013 UTC (11 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.251: preferred, colored
Changes since revision 1.251: +10 -2 lines
Use wm_gmii_hv_{read,write}reg() for I21[78].

Revision 1.251: download - view: text, markup, annotated - select for diffs
Mon Jun 3 01:31:37 2013 UTC (11 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.250: preferred, colored
Changes since revision 1.250: +2 -5 lines
Cleanup. No functional change.

Revision 1.250: download - view: text, markup, annotated - select for diffs
Sun Jun 2 17:23:33 2013 UTC (11 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.249: preferred, colored
Changes since revision 1.249: +30 -27 lines
- 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 - view: text, markup, annotated - select for diffs
Sun Jun 2 09:36:22 2013 UTC (11 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.248: preferred, colored
Changes since revision 1.248: +86 -22 lines
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 - view: text, markup, annotated - select for diffs
Sun Apr 21 19:59:41 2013 UTC (11 years, 7 months ago) by msaitoh
Branches: MAIN
CVS tags: khorben-n900
Diff to: previous 1.247: preferred, colored
Changes since revision 1.247: +14 -14 lines
Delete "PCI_" from PCIX and PICE capability registers.

Revision 1.247: download - view: text, markup, annotated - select for diffs
Thu Apr 18 12:42:03 2013 UTC (11 years, 7 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.246: preferred, colored
Changes since revision 1.246: +77 -9 lines
Add support I21[01]. Only tested with my own I210-T1 Ethernet Server Adapter.

Revision 1.246: download - view: text, markup, annotated - select for diffs
Sat Mar 30 03:21:08 2013 UTC (11 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.245: preferred, colored
Changes since revision 1.245: +33 -33 lines
remove trailing whitespace

Revision 1.234.2.2: download - view: text, markup, annotated - select for diffs
Mon Feb 25 00:29:18 2013 UTC (11 years, 9 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.234.2.1: preferred, colored
Changes since revision 1.234.2.1: +178 -57 lines
resync with head

Revision 1.227.2.8: download - view: text, markup, annotated - select for diffs
Mon Feb 18 18:05:29 2013 UTC (11 years, 9 months ago) by riz
Branches: 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
Diff to: previous 1.227.2.7: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.7: +47 -10 lines
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 - view: text, markup, annotated - select for diffs
Mon Feb 18 17:57:57 2013 UTC (11 years, 9 months ago) by riz
Branches: netbsd-6
Diff to: previous 1.227.2.6: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.6: +7 -7 lines

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 - view: text, markup, annotated - select for diffs
Thu Feb 14 22:08:28 2013 UTC (11 years, 9 months ago) by jdc
Branches: netbsd-6
Diff to: previous 1.227.2.5: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.5: +60 -2 lines
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 - view: text, markup, annotated - select for diffs
Wed Feb 13 16:58:04 2013 UTC (11 years, 9 months ago) by msaitoh
Branches: MAIN
CVS tags: agc-symver-base, agc-symver
Diff to: previous 1.244: preferred, colored
Changes since revision 1.244: +11 -10 lines
No functional change.
 - Fix comment.
 - Use macro.

Revision 1.244: download - view: text, markup, annotated - select for diffs
Wed Feb 13 12:28:23 2013 UTC (11 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.243: preferred, colored
Changes since revision 1.243: +65 -40 lines
No functional change.
- "struct mii_data *mii = &sc->sc_mii" and use it.
- Add comments.
- Fix some comments.

Revision 1.243: download - view: text, markup, annotated - select for diffs
Tue Feb 12 03:11:43 2013 UTC (11 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.242: preferred, colored
Changes since revision 1.242: +60 -2 lines
Use 82580(and I350) specific PHY read/write functions.
Fixes PR#47542.

Revision 1.242: download - view: text, markup, annotated - select for diffs
Thu Feb 7 15:38:42 2013 UTC (11 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.241: preferred, colored
Changes since revision 1.241: +13 -6 lines
Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.

Revision 1.241: download - view: text, markup, annotated - select for diffs
Thu Feb 7 02:10:18 2013 UTC (11 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.240: preferred, colored
Changes since revision 1.240: +8 -5 lines
Skip 64bit BAR correctly. I don't know if this bug causes a real problem.

Revision 1.240: download - view: text, markup, annotated - select for diffs
Wed Jan 30 14:20:53 2013 UTC (11 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.239: preferred, colored
Changes since revision 1.239: +30 -3 lines
- Add WM_DEBUG_NVM.
- If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.

Revision 1.223.2.3: download - view: text, markup, annotated - select for diffs
Wed Jan 16 05:33:18 2013 UTC (11 years, 10 months ago) by yamt
Branches: yamt-pagecache
CVS tags: yamt-pagecache-tag8
Diff to: previous 1.223.2.2: preferred, colored; branchpoint 1.223: preferred, colored
Changes since revision 1.223.2.2: +22 -18 lines
sync with (a bit old) head

Revision 1.227.2.5: download - view: text, markup, annotated - select for diffs
Mon Dec 17 00:30:05 2012 UTC (11 years, 11 months ago) by riz
Branches: netbsd-6
Diff to: previous 1.227.2.4: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.4: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Wed Dec 12 09:20:35 2012 UTC (12 years ago) by msaitoh
Branches: MAIN
CVS tags: yamt-pagecache-base8, yamt-pagecache-base7
Diff to: previous 1.238: preferred, colored
Changes since revision 1.238: +5 -5 lines
- 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 - view: text, markup, annotated - select for diffs
Fri Nov 23 16:35:21 2012 UTC (12 years ago) by riz
Branches: netbsd-6
Diff to: previous 1.227.2.3: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.3: +1 -1 lines
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 - view: text, markup, annotated - select for diffs
Tue Nov 20 03:02:18 2012 UTC (12 years ago) by tls
Branches: tls-maxphys
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +24 -20 lines
Resync to 2012-11-19 00:00:00 UTC

Revision 1.238: download - view: text, markup, annotated - select for diffs
Thu Nov 15 06:14:54 2012 UTC (12 years ago) by msaitoh
Branches: MAIN
Diff to: previous 1.237: preferred, colored
Changes since revision 1.237: +18 -14 lines
Change style a bit.

Revision 1.237: download - view: text, markup, annotated - select for diffs
Wed Nov 7 08:17:18 2012 UTC (12 years, 1 month ago) by msaitoh
Branches: MAIN
Diff to: previous 1.236: preferred, colored
Changes since revision 1.236: +3 -3 lines
Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.

Revision 1.227.2.2.2.1: download - view: text, markup, annotated - select for diffs
Thu Nov 1 16:45:01 2012 UTC (12 years, 1 month ago) by matt
Branches: matt-nb6-plus
Diff to: previous 1.227.2.2: preferred, colored; next MAIN 1.227.2.3: preferred, colored
Changes since revision 1.227.2.2: +518 -14 lines
sync with netbsd-6-0-RELEASE.

Revision 1.223.2.2: download - view: text, markup, annotated - select for diffs
Tue Oct 30 17:21:34 2012 UTC (12 years, 1 month ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.223.2.1: preferred, colored; branchpoint 1.223: preferred, colored
Changes since revision 1.223.2.1: +641 -38 lines
sync with head

Revision 1.162.4.17: download - view: text, markup, annotated - select for diffs
Wed Oct 17 20:46:37 2012 UTC (12 years, 1 month ago) by bouyer
Branches: 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
Diff to: previous 1.162.4.16: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.16: +18 -2 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 12 11:24:44 2012 UTC (12 years, 2 months ago) by msaitoh
Branches: MAIN
CVS tags: yamt-pagecache-base6
Diff to: previous 1.235: preferred, colored
Changes since revision 1.235: +8 -8 lines
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 - view: text, markup, annotated - select for diffs
Tue Oct 9 10:25:44 2012 UTC (12 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Mon Sep 3 19:09:41 2012 UTC (12 years, 3 months ago) by riz
Branches: 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
Diff to: previous 1.227.2.2: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.2: +516 -12 lines
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 - view: text, markup, annotated - select for diffs
Sat Sep 1 02:08:28 2012 UTC (12 years, 3 months ago) by matt
Branches: MAIN
Branch point for: tls-maxphys
Diff to: previous 1.233: preferred, colored
Changes since revision 1.233: +7 -4 lines
Shut up gcc about some uninitialized variables.

Revision 1.233: download - view: text, markup, annotated - select for diffs
Thu Aug 30 23:14:20 2012 UTC (12 years, 3 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.232: preferred, colored
Changes since revision 1.232: +4 -6 lines
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 - view: text, markup, annotated - select for diffs
Wed Aug 29 20:39:24 2012 UTC (12 years, 3 months ago) by bouyer
Branches: MAIN
Diff to: previous 1.231: preferred, colored
Changes since revision 1.231: +514 -11 lines
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 - view: text, markup, annotated - select for diffs
Thu Aug 9 08:00:55 2012 UTC (12 years, 4 months ago) by martin
Branches: netbsd-6
CVS tags: netbsd-6-0-RC1
Branch point for: matt-nb6-plus
Diff to: previous 1.227.2.1: preferred, colored; branchpoint 1.227: preferred, colored
Changes since revision 1.227.2.1: +18 -2 lines
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 - view: text, markup, annotated - select for diffs
Thu Aug 9 07:48:39 2012 UTC (12 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.230: preferred, colored
Changes since revision 1.230: +3 -3 lines
Fix the check of the device type in last commit.
Reported by Thomas Klausner.

Revision 1.230: download - view: text, markup, annotated - select for diffs
Thu Aug 9 04:16:37 2012 UTC (12 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.229: preferred, colored
Changes since revision 1.229: +18 -2 lines
 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 - view: text, markup, annotated - select for diffs
Sun Jul 22 14:33:04 2012 UTC (12 years, 4 months ago) by matt
Branches: MAIN
Diff to: previous 1.228: preferred, colored
Changes since revision 1.228: +7 -7 lines
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 - view: text, markup, annotated - select for diffs
Thu Jun 28 16:06:36 2012 UTC (12 years, 5 months ago) by riz
Branches: netbsd-6
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +102 -19 lines
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 - view: text, markup, annotated - select for diffs
Sat Jun 2 11:09:18 2012 UTC (12 years, 6 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.225.2.1: preferred, colored; branchpoint 1.225: preferred, colored; next MAIN 1.226: preferred, colored
Changes since revision 1.225.2.1: +102 -19 lines
sync to latest -current.

Revision 1.228: download - view: text, markup, annotated - select for diffs
Fri May 25 23:37:38 2012 UTC (12 years, 6 months ago) by msaitoh
Branches: MAIN
CVS tags: jmcneill-usbmp-base10
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +102 -19 lines
Add support Intel I350 Ethernet.

Revision 1.223.2.1: download - view: text, markup, annotated - select for diffs
Tue Apr 17 00:07:49 2012 UTC (12 years, 7 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +8 -18 lines
sync with head

Revision 1.225.2.1: download - view: text, markup, annotated - select for diffs
Sat Feb 18 07:34:43 2012 UTC (12 years, 9 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +4 -16 lines
merge to -current.

Revision 1.227: download - view: text, markup, annotated - select for diffs
Thu Feb 2 19:43:05 2012 UTC (12 years, 10 months ago) by tls
Branches: 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
Diff to: previous 1.226: preferred, colored
Changes since revision 1.226: +3 -14 lines
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 - view: text, markup, annotated - select for diffs
Mon Jan 30 19:41:21 2012 UTC (12 years, 10 months ago) by drochner
Branches: MAIN
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +3 -4 lines
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 - view: text, markup, annotated - select for diffs
Wed Jan 25 18:02:17 2012 UTC (12 years, 10 months ago) by riz
Branches: netbsd-5
Diff to: previous 1.162.4.15: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.15: +5 -3 lines
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 - view: text, markup, annotated - select for diffs
Mon Nov 28 18:21:46 2011 UTC (13 years ago) by bouyer
Branches: MAIN
CVS tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base
Branch point for: jmcneill-usbmp
Diff to: previous 1.224: preferred, colored
Changes since revision 1.224: +5 -3 lines
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 - view: text, markup, annotated - select for diffs
Sat Nov 19 22:51:23 2011 UTC (13 years ago) by tls
Branches: MAIN
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Fri Jul 1 07:45:39 2011 UTC (13 years, 5 months ago) by matt
Branches: MAIN
CVS tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: yamt-pagecache
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +5 -3 lines
Fix uninitialized data warning found by gcc 4.5

Revision 1.217.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 6 09:08:15 2011 UTC (13 years, 6 months ago) by jruoho
Branches: jruoho-x86intr
Diff to: previous 1.217: preferred, colored; next MAIN 1.218: preferred, colored
Changes since revision 1.217: +249 -81 lines
Sync with HEAD.

Revision 1.205.2.4: download - view: text, markup, annotated - select for diffs
Tue May 31 03:04:41 2011 UTC (13 years, 6 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.205.2.3: preferred, colored; next MAIN 1.206: preferred, colored
Changes since revision 1.205.2.3: +154 -21 lines
sync with head

Revision 1.222: download - view: text, markup, annotated - select for diffs
Tue May 24 22:46:42 2011 UTC (13 years, 6 months ago) by msaitoh
Branches: MAIN
CVS tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, cherry-xenmp
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +3 -2 lines
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 - view: text, markup, annotated - select for diffs
Fri May 20 00:57:42 2011 UTC (13 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +155 -23 lines
- 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 - view: text, markup, annotated - select for diffs
Mon Mar 7 04:15:01 2011 UTC (13 years, 9 months ago) by riz
Branches: 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
Diff to: previous 1.162.4.13: preferred, colored; next MAIN 1.162.4.14: preferred, colored
Changes since revision 1.162.4.13: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Mon Mar 7 04:14:19 2011 UTC (13 years, 9 months ago) by riz
Branches: netbsd-5
Diff to: previous 1.162.4.14: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.14: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Sat Mar 5 20:53:45 2011 UTC (13 years, 9 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.205.2.2: preferred, colored
Changes since revision 1.205.2.2: +175 -117 lines
sync with head

Revision 1.217.4.2: download - view: text, markup, annotated - select for diffs
Sat Mar 5 15:10:23 2011 UTC (13 years, 9 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.217.4.1: preferred, colored; branchpoint 1.217: preferred, colored; next MAIN 1.218: preferred, colored
Changes since revision 1.217.4.1: +3 -3 lines
Sync with HEAD

Revision 1.220: download - view: text, markup, annotated - select for diffs
Tue Feb 22 21:19:30 2011 UTC (13 years, 9 months ago) by dyoung
Branches: MAIN
CVS tags: bouyer-quota2-nbase
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +3 -3 lines
Use /*FALLTHROUGH*/.

Revision 1.217.4.1: download - view: text, markup, annotated - select for diffs
Tue Feb 8 16:19:50 2011 UTC (13 years, 10 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +94 -59 lines
Sync with HEAD

Revision 1.219: download - view: text, markup, annotated - select for diffs
Sun Feb 6 16:23:00 2011 UTC (13 years, 10 months ago) by bouyer
Branches: MAIN
CVS tags: bouyer-quota2-base
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +4 -4 lines
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 - view: text, markup, annotated - select for diffs
Wed Jan 26 00:25:34 2011 UTC (13 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +92 -57 lines
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 - view: text, markup, annotated - select for diffs
Tue Dec 14 02:51:46 2010 UTC (14 years ago) by dyoung
Branches: MAIN
CVS tags: matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: jruoho-x86intr, bouyer-quota2
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +25 -14 lines
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 - view: text, markup, annotated - select for diffs
Fri Nov 19 23:40:28 2010 UTC (14 years ago) by riz
Branches: netbsd-5
CVS tags: matt-nb5-pq3-base, matt-nb5-pq3
Diff to: previous 1.162.4.13: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.13: +593 -127 lines
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 - view: text, markup, annotated - select for diffs
Sat Nov 13 13:52:07 2010 UTC (14 years, 1 month ago) by uebayasi
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +2 -4 lines
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 - view: text, markup, annotated - select for diffs
Fri Oct 22 07:22:05 2010 UTC (14 years, 1 month ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.197.2.2: preferred, colored; branchpoint 1.197: preferred, colored; next MAIN 1.198: preferred, colored
Changes since revision 1.197.2.2: +4 -4 lines
Sync with HEAD (-D20101022).

Revision 1.215: download - view: text, markup, annotated - select for diffs
Sat Oct 16 06:31:49 2010 UTC (14 years, 1 month ago) by taca
Branches: MAIN
CVS tags: uebayasi-xip-base4, uebayasi-xip-base3
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +6 -6 lines
- 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 - view: text, markup, annotated - select for diffs
Tue Aug 17 06:46:26 2010 UTC (14 years, 3 months ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.197.2.1: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.1: +216 -72 lines
Sync with HEAD.

Revision 1.158.4.7: download - view: text, markup, annotated - select for diffs
Wed Aug 11 22:53:49 2010 UTC (14 years, 4 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.158.4.6: preferred, colored; branchpoint 1.158: preferred, colored; next MAIN 1.159: preferred, colored
Changes since revision 1.158.4.6: +220 -78 lines
sync with head.

Revision 1.214: download - view: text, markup, annotated - select for diffs
Mon Jul 26 22:33:24 2010 UTC (14 years, 4 months ago) by jym
Branches: MAIN
CVS tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base2
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +5 -5 lines
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 - view: text, markup, annotated - select for diffs
Wed Jul 21 15:35:39 2010 UTC (14 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +25 -33 lines
Use ether_set_ifflags_cb()

Revision 1.212: download - view: text, markup, annotated - select for diffs
Mon Jul 19 15:46:37 2010 UTC (14 years, 4 months ago) by jakllsch
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +11 -6 lines
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 - view: text, markup, annotated - select for diffs
Wed Jul 14 00:11:06 2010 UTC (14 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +25 -8 lines
- 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 - view: text, markup, annotated - select for diffs
Sat Jul 3 01:19:37 2010 UTC (14 years, 5 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.205.2.1: preferred, colored
Changes since revision 1.205.2.1: +157 -27 lines
sync with head

Revision 1.210: download - view: text, markup, annotated - select for diffs
Mon Jun 28 01:43:39 2010 UTC (14 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +8 -9 lines
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 - view: text, markup, annotated - select for diffs
Fri Jun 25 04:35:54 2010 UTC (14 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +7 -3 lines
Only 82571 shares port 0 of EEMNGCTL_CFGDONE.

Revision 1.208: download - view: text, markup, annotated - select for diffs
Fri Jun 25 04:03:14 2010 UTC (14 years, 5 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +155 -28 lines
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 - view: text, markup, annotated - select for diffs
Sun May 30 05:17:35 2010 UTC (14 years, 6 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +7 -9 lines
sync with head

Revision 1.207: download - view: text, markup, annotated - select for diffs
Tue May 25 01:17:55 2010 UTC (14 years, 6 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +5 -5 lines
Fix the names of 82577L[MC] LAN controllers (for mobile).
Fix typo.

Revision 1.197.2.1: download - view: text, markup, annotated - select for diffs
Fri Apr 30 14:43:38 2010 UTC (14 years, 7 months ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +1070 -162 lines
Sync with HEAD.

Revision 1.162.4.3.2.1.2.1: download - view: text, markup, annotated - select for diffs
Wed Apr 21 00:27:41 2010 UTC (14 years, 7 months ago) by matt
Branches: matt-nb5-mips64
CVS tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Diff to: previous 1.162.4.3.2.1: preferred, colored
Changes since revision 1.162.4.3.2.1: +1762 -537 lines
sync to netbsd-5

Revision 1.206: download - view: text, markup, annotated - select for diffs
Mon Apr 5 07:20:28 2010 UTC (14 years, 8 months ago) by joerg
Branches: MAIN
CVS tags: uebayasi-xip-base1
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +4 -6 lines
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 - view: text, markup, annotated - select for diffs
Thu Mar 11 15:03:48 2010 UTC (14 years, 9 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.158.4.5: preferred, colored; branchpoint 1.158: preferred, colored
Changes since revision 1.158.4.5: +2429 -700 lines
sync with head

Revision 1.205: download - view: text, markup, annotated - select for diffs
Wed Mar 10 15:04:04 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
Branch point for: rmind-uvmplock
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +4 -4 lines
82576 is dual port, so check the FUNCID and increment the MAC address for
the 2nd port.

Revision 1.204: download - view: text, markup, annotated - select for diffs
Sun Mar 7 10:11:04 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
CVS tags: yamt-nfs-mp-base9
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +3 -3 lines
Fix the type of sc_ss. That is not bus_space_handle_t but bus_size_t.
Reported by jdc.

Revision 1.203: download - view: text, markup, annotated - select for diffs
Sun Mar 7 09:05:19 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +396 -21 lines
- 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 - view: text, markup, annotated - select for diffs
Sun Mar 7 07:53:37 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +85 -3 lines
Add two workarounds for ICH8 with igp3.
- Workaround for 82566 Kumeran PCS lock loss.
- WOL from S5 stops working.

Revision 1.201: download - view: text, markup, annotated - select for diffs
Sun Mar 7 07:09:00 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +94 -20 lines
Add the detach code.

Revision 1.200: download - view: text, markup, annotated - select for diffs
Thu Feb 25 15:07:06 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +6 -6 lines
 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 - view: text, markup, annotated - select for diffs
Thu Feb 25 10:59:58 2010 UTC (14 years, 9 months ago) by sborrill
Branches: 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
Diff to: previous 1.162.4.12: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.12: +6 -6 lines
Fix regression caused by pullup #1277 requested by msaitoh.

Revision 1.199: download - view: text, markup, annotated - select for diffs
Tue Feb 16 15:17:17 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +483 -100 lines
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 - view: text, markup, annotated - select for diffs
Tue Feb 16 10:06:19 2010 UTC (14 years, 9 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +22 -26 lines
indent, tabify and remove extra spaces.

Revision 1.197: download - view: text, markup, annotated - select for diffs
Thu Feb 4 10:20:54 2010 UTC (14 years, 10 months ago) by msaitoh
Branches: MAIN
CVS tags: uebayasi-xip-base
Branch point for: uebayasi-xip
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +2 -3 lines
Don't increment when ICR_RXO is set because we count them by WMREG_MPC
counter.

Revision 1.196: download - view: text, markup, annotated - select for diffs
Thu Feb 4 09:13:23 2010 UTC (14 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +11 -4 lines
- 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.
- Count Missed packet (rx fifo overflow) and Receive no buffers (rx ring full)
  into iqdrops.

Revision 1.162.4.12: download - view: text, markup, annotated - select for diffs
Wed Jan 27 22:27:41 2010 UTC (14 years, 10 months ago) by sborrill
Branches: netbsd-5
Diff to: previous 1.162.4.11: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.11: +1311 -461 lines
Pull up the following revisions(s) (requested by msaitoh in ticket #1277):
sys/dev/pci/if_wm.c		1.184-1.192, 1.194
sys/dev/pci/if_wmreg.h		1.29-1.35
sys/dev/pci/if_wmvar.h		1.5-1.8
sys/dev/pci/pcidevs		1.1006,1.1009-1.1010, 1.1012-1.1013 via patch
sys/dev/pci/pcidevs.h		regen
sys/dev/pci/pcidevs_data.h	regen
sys/dev/mii/igphyreg.h		1.5
sys/dev/mii/inbmphyreg.h	1.1

- Add support for i82583V.
- Add some ICH9 and ICH10 devices.
- Add support for PCH.
- Fix the bug that ICH9 can't found a PHY. Fixes PR#42237
- Fix an incorrect test for WM_F_EEPROM_INVALID since rev. 1.183. Some old
  chips don't set EECD_EE_PRES.
- Fix a bug that both WM_F_EEPROM_SPI and WM_F_EEPROM_FLASH are set.
- Add a missing decrement for a timeout reported by Wolfgang Stukenbrock
  in PR#42422.
- PBA setting for i82574 is not 12K but 20K.
- Enable checking the management mode on 82574.
- Fix the length of the delay() in wm_gmii_reset(). It fixed the problem that
  sometimes the driver misunderstood PHYs in mii_attach(). It was reported
  by MATSUI Yoshihiro. We observed it on ICH9.
- Fix the checking of jumbo frame function
- Remove the extra macro definition for the offset 0x1a in EEPROM.
- Add missing break in wm_reset()...
- Fix the offset of WMREG_PBS...
- Make wm_reset() and wm_gmii_reset() close to e1000 driver.
  At least, this change make wm_attach() stable on ICH9.
- Reset GMII interface after wm_reset() in wm_init().
- Rework for assigning mii_{read,write}reg(). Use PCI product ID to identify
  the PHY.
- Add code about LPLU(Low Power Link Up) function. It seems that we have to
  do the same work for ICH9.
- Fixes the rx stall problem on 82578 by MANY workaround code. We need more
  work for 82577.

Revision 1.195: download - view: text, markup, annotated - select for diffs
Fri Jan 22 08:56:06 2010 UTC (14 years, 10 months ago) by martin
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +3 -3 lines
Unify the name of the device property to hold a MAC address - there was
no clear majority for either "mac-addr" vs. "mac-address", but a quick
gallup poll among developers selected the latter.

Revision 1.194: download - view: text, markup, annotated - select for diffs
Thu Jan 21 08:52:20 2010 UTC (14 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +246 -235 lines
Remove an extra debug printf(). KNF.
No functional change.

Revision 1.193: download - view: text, markup, annotated - select for diffs
Tue Jan 19 22:07:02 2010 UTC (14 years, 10 months ago) by pooka
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +4 -11 lines
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client.  This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached.  However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff.  ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.

Revision 1.192: download - view: text, markup, annotated - select for diffs
Thu Jan 14 18:56:02 2010 UTC (14 years, 10 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +357 -108 lines
Fixes the rx stall problem on 82578 by MANY workaround code.
We need more work for 82577.

Revision 1.191: download - view: text, markup, annotated - select for diffs
Tue Jan 12 22:26:30 2010 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +139 -36 lines
- Add i82567LM-2 i82567LM-4 i82567V-3 LAN controller.
- Reset GMII interface after wm_reset() in wm_init().
- Rework for assigning mii_{read,write}reg(). Use PCI product ID to identify
  the PHY.
- Add code about LPLU(Low Power Link Up) function. Now we can linkup 1000BaseT
  on PCH. It seems that we have to do the same work for ICH9.

Revision 1.190: download - view: text, markup, annotated - select for diffs
Mon Jan 11 12:29:28 2010 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +92 -19 lines
 Add partial support for PCH. We have to do more work for PCH. Especially
I don't know what driver i82578 should be attached to. makephy? or atphy?
MII_OUI() says that the PHY is from Attansic (== Atheros). Intel's e1000
driver says that it's close to makphy...

 I can't link up at 1000BaseT yet...

Revision 1.189: download - view: text, markup, annotated - select for diffs
Thu Jan 7 17:45:58 2010 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +321 -44 lines
Make wm_reset() and wm_gmii_reset() close to e1000 driver.
At least, this change make wm_attach() stable on ICH9.

Revision 1.188: download - view: text, markup, annotated - select for diffs
Thu Jan 7 17:34:38 2010 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +5 -5 lines
bugfixes:
 - add missing break in wm_reset()...
 - fix the offset of WMREG_PBS...
 - fix length of some delay()s in wm_gmii_reset()

Revision 1.187: download - view: text, markup, annotated - select for diffs
Tue Jan 5 10:02:01 2010 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +35 -11 lines
 Fix the checking of jumbo frame function though I don't know whether
the function wokrs or not...

 Remove the extra macro definition for the offset 0x1a in EEPROM.

Revision 1.186: download - view: text, markup, annotated - select for diffs
Tue Jan 5 09:31:21 2010 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +60 -10 lines
 Fix the length of the delay() in wm_gmii_reset(). It fixed the problem that
sometimes the driver misunderstood PHYs in mii_attach(). It was reported
by MATSUI Yoshihiro. We observed it on ICH9.

Revision 1.185: download - view: text, markup, annotated - select for diffs
Tue Dec 29 16:01:21 2009 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +124 -82 lines
- Fix an incorrect test for WM_F_EEPROM_INVALID since rev. 1.183. Some old
  chips don't set EECD_EE_PRES.
- Fix a bug that both WM_F_EEPROM_SPI and WM_F_EEPROM_FLASH are set.
- Add a missing decrement for a timeout reported by Wolfgang Stukenbrock
  in PR#42422.
- Add support for i82583V.
- PBA setting for i82574 is not 12K but 20K.
- Enable checking the management mode on 82574.

Revision 1.184: download - view: text, markup, annotated - select for diffs
Sun Dec 27 20:36:38 2009 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +30 -9 lines
Fix the bug that ICH9 can't found a PHY. This fix is not good, but it's
the same as e1000 driver... Fixes PR#42237

Revision 1.162.4.11: download - view: text, markup, annotated - select for diffs
Wed Dec 23 10:37:37 2009 UTC (14 years, 11 months ago) by sborrill
Branches: netbsd-5
Diff to: previous 1.162.4.10: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.4.10: +172 -114 lines
Pull up the following revisions(s) (requested by msaitoh in ticket #1203):
	sys/dev/pci/if_wm.c:		1.176-1.179, 1.181-1.183
	sys/dev/pci/if_wmreg.h:		1.28
	sys/dev/pci/if_wmvar.h:		1.1-1.4
	sys/dev/mii/igphy.c:		1.18-1.20 via patch

Many bugfixes:
- Some fixes for i80003 and ICH{8,9,10} from e1000 driver and document:
  - Add setting for KABGTXD register for ICH{8,9,10}.
  - ICH9 and ICH10 has no FCAL, FCAH and FCT like ICH8.
  - Add special setting for FCTTV and TCTL_EXT register for i80003
  - The special setting for TIPG is only for i80003.
  - Some of kumeran settings are only for i80003's bugs.
  - Add some ICH10 fixes.
  - Fix the bug that another lock mechanism is used to access Kumeran
    registers on i80003 and ICHs.
  - Fix yet another i80003 ONLY workaround. The code to modifing TIPG
    register is only for i80003.
- Set the Re-Transmit on Late Collision(RTLC) flag for all devices.
- Fix a typo in a printf message.
- If the difference bettween last flag and new flag is only IFF_PROMISC
  or IFF_ALLMULTI, set multicast filter only to prevent link down.
  Tested by Mark Davies and me. Fixes PR#29126 for wm.
- Cleanup interrupt establish error messages. Do not mix
  aprint_error/aprint_normal/printf calls for a single line.
- Fix igphy's 82566 support.
  - Patch for the DSP code is only for 8254[17] and we have to apply
    the different patches between rev. 1 and rev. 2.
  - The workaround for analog fuse is only for 82547 rev. 1.
  - The workaround for smartspeed is only for 8254[17]
- Sync with Intel's original em driver:
  - Check PCI-X mode as e1000 driver.
  - Add dspcode for igp3 and use it when the EEPROM isn't available.
  - Add some delays.
  - Stop the PHY transmitter before patching the DSP code and
    restart it after writing.
  - Save and restore register 0x2f5b.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Wed Dec 16 14:37:26 2009 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +20 -28 lines
Sync with Intel's original em driver:
- Add dspcode for igp3 and use it when the EEPROM isn't available.
- Add some delays.
- Stop the PHY transmitter before patching the DSP code and restart it after wrote.
- Save and restore register 0x2f5b.

Revision 1.182: download - view: text, markup, annotated - select for diffs
Wed Dec 16 04:50:35 2009 UTC (14 years, 11 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +12 -34 lines
Re-enable igphy's 82566 support.
 - Patch for the DSP code is only for 8254[17] and we have to apply the
   different patches between rev. 1 and rev. 2.
 - The workaround for analog fuse is only for 82547 rev. 1.
 - The workaround for smartspeed is only for 8254[17]

see http://mail-index.netbsd.org/tech-net/2009/08/05/msg001546.html

Revision 1.181: download - view: text, markup, annotated - select for diffs
Thu Nov 26 15:17:10 2009 UTC (15 years ago) by njoly
Branches: MAIN
CVS tags: matt-premerge-20091211
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +4 -4 lines
Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.

Revision 1.158.4.5: download - view: text, markup, annotated - select for diffs
Wed Sep 16 13:37:52 2009 UTC (15 years, 2 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.158.4.4: preferred, colored; branchpoint 1.158: preferred, colored
Changes since revision 1.158.4.4: +5 -5 lines
sync with head

Revision 1.180: download - view: text, markup, annotated - select for diffs
Sat Sep 5 14:09:55 2009 UTC (15 years, 3 months ago) by tsutsui
Branches: MAIN
CVS tags: yamt-nfs-mp-base8, jym-xensuspend-nbase
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +5 -5 lines
Invert logic around nested pmf(9) registrations for readability.

Revision 1.158.4.4: download - view: text, markup, annotated - select for diffs
Wed Aug 19 18:47:11 2009 UTC (15 years, 3 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.158.4.3: preferred, colored; branchpoint 1.158: preferred, colored
Changes since revision 1.158.4.3: +86 -34 lines
sync with head.

Revision 1.179: download - view: text, markup, annotated - select for diffs
Thu Aug 6 03:03:46 2009 UTC (15 years, 4 months ago) by msaitoh
Branches: MAIN
CVS tags: yamt-nfs-mp-base7
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +33 -3 lines
 If the difference bettween last flag and new flag is only IFF_PROMISC or
IFF_ALLMULTI, set multicast filter only to prevent link down. Tested by
Mark Davies and me. Fixes PR#29126 for wm.

Revision 1.178: download - view: text, markup, annotated - select for diffs
Thu Jul 30 03:46:48 2009 UTC (15 years, 4 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +55 -33 lines
Fix the bug that another lock mechanism is used to access Kumeran registers
on i80003 and ICHs.

Fix yet another i80003 ONLY workaround. The code to modifing TIPG register
is only for i80003.

Set the Re-Transmit on Late Collision(RTLC) flag for all devices.

Fix a typo in a printf message.

Revision 1.164.2.2: download - view: text, markup, annotated - select for diffs
Thu Jul 23 23:31:58 2009 UTC (15 years, 4 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.164.2.1: preferred, colored; next MAIN 1.165: preferred, colored
Changes since revision 1.164.2.1: +78 -28 lines
Sync with HEAD.

Revision 1.162.4.3.2.1: download - view: text, markup, annotated - select for diffs
Sun Jul 19 19:48:26 2009 UTC (15 years, 4 months ago) by snj
Branches: netbsd-5-0
CVS tags: netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20091211, matt-nb4-mips64-k7-u2a-k9b
Branch point for: matt-nb5-mips64
Diff to: previous 1.162.4.3: preferred, colored; next MAIN 1.162.4.4: preferred, colored