Up to [cvs.NetBSD.org] / src / sys / dev / pci
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Add MBUFTRACE
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@
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
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.
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).
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.
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.
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.
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.
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.
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.
wm(4): Fix compile error without WM_EVENT_COUNTERS.
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): 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): Print RX packet buffer size.
Add Intel I219-{LM,V}(20,21) support.
if_wm.c: fix spelling and grammar in a comment
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).
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).
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).
wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).
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.
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.
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.
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.
wm(4): Replace /* nothing */ to __nothing for evcnt macros Prevent empty if bodies for !WM_EVENT_COUNTERS.
wm(4): Modify descriptions of flow control related event counters.
wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.
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): 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.
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.
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.
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.
Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.
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@.
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.
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.
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.
Add missing read to count Circuit Breaker Rx Dropped Packet correctly.
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.
Apply patch, requested by riastradh in ticket #1842: sys/dev/pci/if_wm.c (apply patch) Fix a bug introduced in ticket #1795.
Fix typo. s/ictxact/ictxatc/. No functional change.
Use WM_IS_ICHPCH(). No functional change.
Fix prc511's comment and description.
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().
Move statistics updating code from wm_tick() to new wm_update_stats(). - To reuse. - No functional change.
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
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.
Don't add "Count" for event counter's description.
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.
IC{TX,RX}*C registers are for older than 82575.
Sort lines. No functional change. Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach() to match.
Sort lines. No functional change. Rearrange the order of the registers so that they are roughly in ascending order.
Add note for the TORL register. The TOR register includes error, flow control and broadcast rejected.
Count some 64bit counters correctly. - Fix calculation of GORC, GOTC, TOR and TOT counters correctly. - Found by knakahara.
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.
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.
Workaround for some hypervisor environments. The environments cannot stop e1000 interrupt immediately.
Add comment to ICH/PCH's lock stuff in wm_reset().
Fix typo. No functional change. OK'd by knakahara.
Undo accidental whitespace changes from applying the patch for ticket #1759 by applying a patch from msaitoh (NFC).
KNF. Modify comment. No fucntional change.
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.
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.
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.
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.
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>
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>
wm(4): Revert previous -- mistakenly committed unsquashed change part.
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.
To avoid releasing mutex temporally, use new wm_set_mdio_slow_mode_hv_locked().
Consistency use -1 instead of 1 for some error code. Advised by knakahara.
Pass an error code correctly if phy.acquire() failed. This is not a real bug because the return value is not used.
Pass an error code to the upper layer instead of -1. Advised by knakahara.
Modify debug messages so that we can determine where it happened.
Sprinkle const on splfoo call results.
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@
Add some KASSERTs around the locking protocol. Discussed with msaitoh@, knakahara@ and riastradh@
Improve a couple of comments
Trailing whitespace
KNF the KNF
Add more statistics countes. - Add many statics counters that the chip has. - Attach event counters only if available.
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@
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@
KNF
Don't need sys/malloc.h so remove the #include
Turn a locking botch (shouldn't drop lock on error) into a KASSERT
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.
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.
KNF. No functional change.
Consistently use semicolon. No functional change.
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.
Fix compile error if WM_DEBUG is set.
Be less tautological and more explanatory in a comment.
Use PRIxBIT instead of casts
wm_tick: Add missing splx(s) when not WM_MPSAFE
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.
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.
Call m_freem(m) only if m0 == NULL.
if_wm.c: various spelling and grammar fixes
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.
if_wm.c: remove stray semicolons from struct declaration C99 does not allow 'struct { int member;; }'. No binary change.
Remove duplicated break. No functional change.
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.
Keep constants 32 bit, why does __BIT() return uintmax_t?
aprint_verbose the DMA range used.
whitespace in a comment
Typo in comment
Simplify. Same code before and after.
Trailing whitespace
s/checkum/checksum/ in comment.
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.
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.
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.
Use macro. No functional change.
Add some sysctl info for debugging.
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.
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.
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.
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.
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.
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.
Uniform INTx/MSI handler's Tx/Rx behavior to MSI-X's one. Because the difference has caused INTx/MSI own bugs.
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.
Only print an error about missing I/O BARs for chips that need it.
Add support for I219V 15-19 and I219LM 16-19.
Print I219's version number.
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.
Sync w/ HEAD.
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.
sync with head
Sync with HEAD.
Fix i386 build failure with options WM_EVENT_COUNTERS. pointed out by msaitoh@n.o.
if_wm: do not return a void value from a void function This is a GCC extension.
Sync with HEAD.
Whitespace fixes. No functional change.
Refactor rxq->rxq_ptr updating.
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.
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.
wm(4) use atomic_{load,store}_relaxed for evcnt 64 bit counter. ok'ed by msaitoh@n.o.
Sync w/ HEAD.
Add some sysctl values for debugging TX/RX queues.
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
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
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
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]
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]
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]
Add WMPHY_I350. Not used yet.
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
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.
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)).
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)).
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)).
Small fixes from knakahara: - Check return value correctly in wm_lv_jumbo_workaround_ich8lan(). - Fix comment.
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.
Use 12K for packet buffer for jumbo frame on PCH2 and newer. XXX Note that Linux Use 14K.
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.
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.
s/ressource/resource/. Found by knakahara.
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.
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.
Set if_baudrate for non-MII device. Before this commit, it was 0.
Explicitly cast from uint16_t to uint32_t before shifting 16bit left when printing Image Unique ID. Found by kUBSan.
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
s/MII_IGPHY_/IGPHY_/. No functional change.
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.
"wmX: 0" on 82542 is difficult to understand, so don't print it.
Fix a bug that the WMREG_EEARBC_I210 register is incorrectly set if the system uses iNVM.
prop_data_data_nocopy -> prop_data_value
No functional change: - Rename some macros and function. - Add newline.
Update for proplib(3) API changes.
Make WM_NRXDESC unsigned.
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.
Sync with HEAD
Mostly merge changes from HEAD upto 20200411
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
wm_tx_offload() and wm_nq_tx_offload() actually always return 0, make them return void and remove the check for their return value
fixup field names in previous
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
Don't bother with IFF_OACTIVE.
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.
Sync with head.
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.
Whitespace fix. No functional change.
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.
Fix missing workqueue_destroy(). ok by msaitoh@n.o
Fix wm(4) create too many workqueue. Pointed out by msaitoh@n.o
Adopt <net/if_stats.h>.
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.
Sync with head.
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.
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.
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
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
fix softint_disestablish() in wm_detach(). ok by msaitoh@n.o XXX pullup-8, pullup-9
Add Intel I219 LM10-LM15 and V10-V14 from OpenBSD.
No longer need to go to splnet() before calling ifmedia_ioctl() in the NET_MPSAFE; ifmedia_ioctl() will do this for us, if needed.
KNF. No functional change.
fix build failure. ok by msaitoh@n.o.
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.
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.
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.
- 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
- 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.
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.
Fix a bug that wm_sgmii_readreg_locked() may return error even if error isn't occured.
Simplify. No functional change.
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.
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.
Fix typo in comment.
if_flags is neither int nor short. It's unsigned short.
printf -> device_printf
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.
Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits(). Found by kUBSan.
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.
- 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.
Use aprint_debug_dev() instead of printf() in wm_ulp_disable().
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@
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.
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().
Print ICH/PCH's NVM version.
Sync with HEAD
Use unsigned. Found by UBSan. OK'd by kamil.
s/recieve/receive/
Whitespace fix (mainly tabify).
-No functional change: - KNF - u_int*_t -> uint*_t.
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
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].
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.
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].
KNF. No functional change.
Pass error status to the upper layer in wm_gmii_{i82544,i80003}*().
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.
Add Intel I219 variations for Cannon Lake.
Use do { ... } whille (0) for DPRINTF(x, y).
Typo (s/vaule/value/)
Fix GCC7 "avoid ambiguous 'else'" build error in if_wm.c Detected with kUBSan NetBSD/i386 build.
Fix panic when wm(4) is reattached. ok by msaitoh@n.o. This panic occured after kern_rndq.c:r1.90.
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.
- Add support for I210 SGMII Flash-less device. - Add KASSERT. - Update TODO list.
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.
I21[01]'s RAL size is not 15 but 16(== 82575's value). Same as other OSes.
Add yet another PHY workaround. Disable generation of early preamble on 82577 PHY rev. 1 or 2 and 82578 PHY rev. 1.
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.
We now have IFM_2500_KX and IFM_1000_KX, so use them.
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.
Sync with HEAD
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.
Use __nothing (== ((void)0)) instead of "do {} while (/*CONSTCOND*/false)".
No functional change intended: - Use "do {} while (/*CONSTCOND*/false)" for null DPRINTF(). - Reduce indent level of wm_linkintr_gmii().
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
Synch with HEAD
Set I82579_LPI_CTRL register correctly in wm_set_eee_pchlan().
- 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.
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.
Fix error check. reported by David Binderman in kern/53821.
Accept IFM_NONE.
Sync with HEAD, resolve a few conflicts
Fix WoL detection once again.
- Don't setup WoL on non-WoL capable port. - Setup PHY wakeup feature on PCH and newer. Tested on Thinkpad X220.
Fix WoL capability detection on ICH and PCH.
Rename functions. Add comment. No functional change.
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
When sc->phy.acquire() failed, it's not required to call sc->phy.release().
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
Print and clear the wakeup status only when the WUS register != 0.
- 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.
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.
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.
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]
Fix comment. No functional change.
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.
Sync with HEAD, resolve a couple of conflicts
- 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.
- 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).
- 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]
- 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.
- 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.
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.
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.
make this compile again (rv was uninitialized)
KNF a bit. No functional change.
- 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.
After writing MDIC register, don't read quickly the same register but do delay(50). Same as otehr OSes.
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]
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.
- 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.
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)
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)
Sync with head
Fix KASSERT to prevent panic on CNP(Intel 300 series + I219) with INTx interrupt (Xen dom0 or pre netbsd-8). XXX pullup-[78]
Ssync with HEAD
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.
Fix comment.
- 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.
- Split txdrop evcnt into pcqdrop and descdrop. - Simplify evcnt name by removing duplicated "tx" or "rx". - s/tu/underrun/
Sync with HEAD Resolve a couple of conflicts (result of the uimin/uimax changes)
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!)
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.
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.
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.
Sync with HEAD
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.
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.
Sync with HEAD
Style fix. No functional change.
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
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.
Ensure to call if_register after interface initializations finish
Sync with HEAD
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.
KNF. No binary change.
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.
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.
rxipsum and rxtusum are not interrupt counter, so use EVCNT_TYPE_MISC instead of EVCNT_TYPE_INTR.
Synch with HEAD
- 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.
Count timeout correctly. This change reduce timeout value for 80003 as expected. Reported by mouse@.
Sync with HEAD
Fix watchdog timer. Without this change, watchdog timer is unnecessary fired and device is initialized without any error message. OK'd by knakahara.
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().
KNF. No functional change.
Sync with HEAD, resolve some conflicts
I354 uses an external PHY, so don't use wm_set_eee_i350().
Enable I219.
Add PCH_CNP support (I219 with Intel 300 series chipset). It's required more test, so it's disabled by default.
If the extended configration size in the EXTCNFSIZE register is 0, don't continue.
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.
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.
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.
Do wm_reset_mdicnfg_82580() on 82580 only.
- 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.
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.
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.
Apply RSS utility to wm(4). ok by msaitoh@n.o.
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
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.
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.
Fix unmatched return type. The return value of wm_txeof() is not useded yet.
Fix if_wm.c:r1.557 merge miss, sorry.
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.
CID-1427779: Fix uninitialized variables
wm_txeof() can limit the loop count the same as wm_rxeof() now.
Fix duplicated "rxintr" evcnt counting. Pointed out by ozaki-r@n.o, thanks.
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.
improve comments
Fix legacy Tx descriptors printing when WM_DEBUG is enabled.
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.
Add ASPM workaround for 8257[1234] and 82583 to prevent device timeout or hangup. Fixes PR#52818 reported by Shinichi Doyashiki.
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.
PR/52885 - Shinichi Doyashiki -- typo in comment
Don't use MSI-X if we can use only one queue to save interrupt resource. Written by knakahara and tested by me.
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.
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
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.
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.
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.
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.
update from HEAD
- 82583 supports jumbo frame. Fixes PR#52773 reported by Shinichi Doyashiki. - Cleanup comment.
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.
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.
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).
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.
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@
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.
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
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.
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
If if_initialize() failed in the attach function, return.
On I219, drop TARC0 bit 28 for DMA hang workaround (from Linux).
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.
- 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.
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
Sync with HEAD
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.
rename unclear functions. pointed out by msaitoh@n.o.
add comment about confusing wm_rxeof() calling. pointed out by msaitoh@n.o.
Check some wm_nvm_read()'s return vale.
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.
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].
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.
- 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.
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.
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.
- 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.
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.
Remove wrong semaphore access in wm_nvm_{read,write}_{ich8,spt} to prevent hungup. A semaphore is get/put in wm_nvm_{read,write}.
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().
IF TX is not required to flush, RX is also not required to flush. Same as other OSes.
- 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.
- 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.
- 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.
Remove debug printf().
Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too. Before this commit, above devices and non-PCIe devices accessed wrong register.
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.
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.
- 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.
Add missing "else" in wm_nvm_release().
- 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().
- 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.
Print sc_flags with snprintb().
Don't print the Image Unique ID if an NVM is iNVM (i210 and I211).
- Add debug printf()s. - If a legacy interrupt is a spurious interrupt, don't print debug message. - Add comment.
Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset(). Same as other OSes.
Use IFM_1000_KX and IFM_2500_KX.
Sync with HEAD
Sync with HEAD
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
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.
improve comments about the difference between legacy/msi and msix. pointed out by msaitoh@n.o.
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].
fix typo pointed out by ozaki-r@n.o.
remove extra "+"
add comments about the situation wm(4) use MSI-X but does not use multiqueue.
make self-describing function the code reading sc->sc_nintrs or sc->sc_nqueues directly.
add prototype. I have forgotten the fix by wm_softint_establish(). Thank you christos@n.o!
add comments about transmit context descriptor
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.
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.
Sync with HEAD
Sync with netbsd-7-1-RELEASE
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.
PR kern/52039: use same safeguard as for the 82578
fix r1.492 bug, sorry
implement AIM(Adaptive Interrupt Moderation), but not enable yet. Currently, it causes performance degration if enabled. More ITR calcuration tuning is required...
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.
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
IFEF_START_MPSAFE flag should be set only if WM_MPSAFE defined. some refactor. pointed out and suggested by msaitoh@n.o, thanks.
refactor: functionalize ITR/EITR writing processing. tested I354 and 82545(VMware e1000).
divide ITR/EITR value from wm_softc to wm_queue as EITR register is bound to each H/W queue.
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.
fix Tx queue assignment when the number of H/W queues is less than ncpu.
apply 82574 RFCTL workaround the same as FreeBSD and linux. In fact, this workaround reduces interrupt count.
82574 should follow MSI-X mode IMS manner. Howerver some legacy interrupts occur as MSI-X other interrupt yet...
Establish a softint for legacy, otherwise BOOM!
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.
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
more fix about IFF_OACTIVE. fix TODO of r1.479 and reduce IFF_OACTIVE manipulation.
refactor: functionize deferred_start code holding locks.
refactor: functionize txrxintr disable/enable code.
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
fix typo
detach wm(4) evcnt. pointed out by msaitoh@n.o, thanks.
Sync with HEAD
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.
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.
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.
fix: wm(4) Rx descriptor is corrupted under high rate. don't write descriptor which is not set DD bit.
remove obsolete comment. wm(4) vlan have already tested on I354.
fix endianness of "rsshash"(currently, used for debug message only) and tabify.
add comment about txq->txq_lock contentions in wm_nq_transmit().
fix memory leak at wm_detach. pointed out and reviewed by msaitoh@n.o.
Sync with netbsd-5
move declaration to #ifdef WM_DEBUG block as opposed to using __debugused fixes build with DEBUG but without WM_DEBUG ok martin
update todo comment
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.
remove debug printf().
Fix previous. The last code wasn't called.
sc->sc_core_stopping must be checked with holding sc_core_lock. pointed out by ozaki-r@n.o, thanks.
Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
- Set IPV6EXDIS bit in RFCTL register because of an Errata on 82575 and newer devices. - Update comment in wm_init_rss().
fix typo. pointed out by msaitoh@n.o.
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.
0x10cb is not 82801H but 82801I. No functional change (The macro name was changed but the vaule is the same).
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.
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
- 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.
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.
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.
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.
Sync with HEAD
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.
support Tx multiqueue for 82574(aka e1000e for VMware and QEMU).
Add note about kumeran registers. No functional change.
Remove extra pair of braces.
Fix WOL related setting of the WUC register for other than PCH* in wm_enable_wakeup(). Tested with 82567V(ICH8) and 82583V.
8257[124] should not set WM_F_ARC_SUBSYS_VALID.
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.
Move the location of wm_smbustopci() call.
Sync wm_smbustopci() with Linux and FreeBSD. This change effects PCH and newer devices.
Fix a bug that 8257[56], 82580, I35[04] and I21[01] didn't use wm_{get,release}_hw_control() correctly.
Add three workarounds for PCH_{LPT,SPT}.
Set CTRL_MEHE correctly (PCH_{LPT,SPT} only).
- 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.
Call wm_enable_phy_wakeup() on PCH2 and newer, too. Now these devices can do WOL. Tested with Thinkpad X220(PCH2).
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.
Remove debug printf which was added in rev. 1.437.
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*.
Add "10/100" into non-gigabit devices' name.
Sync with HEAD
- 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.
Fix locking against myself at wm_turn{on,off} when NET_MPSAFE is defined. Pointed out by ozaki-r@n.o, thanks.
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.
Change debug flags to be better than before.
- 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.
- Use MII_ADDRMASK. - Remove debug printf().
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
- 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.
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
Use wm_gmii_82544_{read,write}reg() on non-82567 ICH8, 9 and 10.
82567V_3 is BME1000_E_2(bm). Tested with Advantech AIMB-212 1st Ethernet port.
82567V-3 is not ICH9 but ICH8.
- 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.
- 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()
- 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.
Add newer I219 devices (not enabled).
Add more DPRINTF()s.
No, functional change: - Add WM_DEBUG_LOCK - Add some KASSERT - Modify comment.
- Drop the host wakeup bit after resetting PHY on PCH and newer devices. - Increase delay while toggling LANPHYPC
Read sc_if_flags after taking core lock
Sync with HEAD
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.
restructure wm(4) evcnt to support multiqueue evcnt. ok by msaitou@n.o.
pci_intr_type() is required pci_chipset_tag_t argument by other than x86. pointed out by nonaka@n.o.
Sync with HEAD
wm(4) can enable IFEF_START_MPSAFE now.
fix: rxq->rxq_lock is uninitialized if NET_MPSAFE is not defined.
Simplify the code. WM_[RT]X_* macros are removed and replaced with mutex_* calls directly. OK from nakahara@ and msaitoh@
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.
fix r1.409 mistake
Sync with HEAD
Update TODO: evcnt
fix: ethernet controllers which use wiseman_txdesc_t (earlier than 82575) hang possibly.
GENERIC kernel (disabled NET_MPSAFE kernel) also needs txq_lock to avoid race between tx processing and tx interrupt handler.
Update TODO - "TX Multiqueue" -> "TX Multiqueue improvement" - add "Advanced Recieve Descriptor" (RX NEWQUEUE)
fix build failure by gcc 4.8.5
unify TX and RX interrupt handler to use MSI-X vector efficiently
user-friendly interrupt affinity offset
initial TX multiqueue support
Whether Tx interrupt handler kicks if_start() should not depend on wm_txeof() return value.
rename WM_TXQ_WORKING to WM_TXQ_NO_SPACE
device drivers should not divert ifp->if_flags to manage H/W satatus.
refactor: eliminate "txq->txq_descs_size", use WM_TXDESCS_SIZE instead.
fix unmatched dma sync size for NEWQUEUE. This bug would have caused wm_nq_tx_offload() not to work.
Fix compile error on some archs (e.g. i386).
Interrupt handlers read wm_rxqueue or wm_txqueue, so they must be freed after disestablishing interrupt handlers.
Do I219 TX DMA workaround only when TDLEN(0) != 0
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.
- 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.
Add some workaround code for I219. It still doesn't work.
Basic support for I219. It doesn't work on I219, so it's disabled.
Sync with HEAD
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.
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!
s/max/ralmax/. No functional change.
Remove debug message.
- printf->DPRINTF in wm_serdes_mediastatus(). - KNF.
Sync with HEAD (as of 26th Dec)
Modify comment for 82544 Errata 9 "Certain register cannot be written with particular alignments in PCI-X bus operation".
- 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.
fix potentially bug
fix incorrect KASSERT
set Tx/Rx interrupts affinity to other than CPU#0 as much as possible
PR/50527: David Binderman: Fix impossible code. Odd offsets need special treatment.
- 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.
- 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.
Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT.
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.
Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.
igphy(4),ukphy(4): Set mii_mpd_* entries. wm(4): check PHY type correctly.
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.
if_wm uses pci_intr_alloc stubs now.
add CTASSERT and KNF.
initial port rss_getkey() from freebsd, and use it instead of random().
- Update TODO: - "Multiqueue" -> "TX Multiqueue" because RX Multiqueue was added. - Sort entries. - Grouping functions.
sprinkle __diagused
wm_linkintr_msix() should use WM_DEBUG_LINK instead of WM_DEBUG_TX.
recover if_wm.c:r1.348
fix: XEN3_DOM0(not defined __HAVE_PCI_MSI_MSIX) build
fix: WM_DEBUG build
support RX multiqueue. ok by msaitoh@n.o
ready to support RX multiqueue. ok by msaitoh@n.o
refactor: rearrange interrupt handlers argument
refactor: rearrange function arguments without interrupt handlers
change const value register macros to macro expressions to support multiqueue.
refactor: separate interrupts setup processing from wm_attach
allocating queues should be finished before establishing interrupts.
refactor: separate discriptors initialization and registers initialization
separete TX, RX queue mutex from wm_softc and rearrange WM_BOTH_LOCK. ok by msaitoh@n.o
refactor: separate TX, RX queue variables from wm_softc (without mutex)
refactor: separate busdma initialize processing as functions
separate TX dma control data and RX dma control data. ok by msaitoh@n.o
refactor: separate busdma allocate processing as functions.
refactor: change some macros to functions change below macros to functions - WM_CDTXSYNC - WM_CDRXSYNC - WM_INIT_RXDESC
Fix a bug that LSC's interrupt storm occured when MSI-X is used. It was observed only on 82575.
- 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@.
When the driver uses MSI-X, it tunes RX's EITR the same as TX's. ok by msaitoh@n.o
use sc->sc_itr instead of hard-coded number. ok by msaitoh@n.o
Sync with HEAD
- Check iNVM's image version and print it. - Update TODO.
Add kernel code to support intrctl(8).
Print interrupt type correctly.
Fix a bug that I21[01] NVM revision >= 3.25 can't be attached. Reported by MATSUI Yoshihiro.
The WM_F_EEPROM_EERDEEWR is not required on iNVM device.
fix typo
Sorry, if_wm turns MSI/MSI-X default off by my mistake.
mofity for if_wm and if_bge to use pci_intr_alloc()
Cleanup.
Enable MSI/MSI-X feature by default.
Don't use MSI on 8257[12] because of errata 63 "Byte Enables 2 and 3 are not set on MSI writes".
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*.
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,
- Print NVM version on 8257[124], too. - Modify NVM version string a bit.
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.
Remove extra if_start() in wm_ioctl().
Call wm_pll_workaround_i210() at the end of the wm_reset() function, too.
Fix the output of the option ROM version.
Sync with HEAD
Cleanup.
- 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.
Print NVM image version.
Revert previos. Sorry, I committed in another working directory...
Print NVM image version.
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.
No functional change: - Reorder functions. - Rename wm_tbi_check_link() to wm_tbi_tick() because this function acts as mii_tick().
Fix a bug that flags related to semaphore were incorrectly checked in wm_kmrn_{readreg,writereg}. i80003, ICH* and PCH* had this problem.
- 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.
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.
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.
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.
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.
Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more than 4096. Almost the Same as other OSes
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).
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.
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.
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.
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]
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].
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].
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.
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.
Convert sys/dev to use <sys/rndsource.h>.
Sync with HEAD
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.
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.
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.
- 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 sc_mediatype is evaluated incorrectly. The real problem might be occured only on fiber and serdes cases.
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]
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].
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]
Introduce defflag for NET_MPSAFE
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.
Add C2000 KX and 2.5G.
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.
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
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
Simplify. No functional change.
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.
There's an r in "determine"
- Support DH89XXCC devices. - Add extra delay for 82580 and newer devices except DH89XXCC SGMII device. Same as FreeBSD.
Tidy up locking in wm_ioctl
Don't call ifmedia_ioctl with holding locks
Fix debug message.
Delete 82580ER related code. It was from FreeBSD and was removed in r203049.
Add some devices. Not tested because I have no any of these devices/cards.
Add some new I218 devices.
It's not required to print "failed to detect NVM bank" with aprint_error_dev(). Use DPRINTF(). Same as {Free,Open}BSD.
Remove one obsolete TODO entry.
Read SFF SFP ROM and configure driver from the value.
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.
No binary change: - Move some NVM related macros from if_wm.c to if_wmreg.h. - Rename some macros for consistency.
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.
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.
Modify WMP_F_1000{X,T} to WMP_F_{FIBER,COPPER}. No binary change.
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.
Rebase to HEAD as of a few days ago.
Merge tls-earlyentropy branch into HEAD.
Rebase.
Add one more TODO: - We should check XXX'ed comments.
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.
Add some TODOs in comment.
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.
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.
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.
- 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.
No functional change: - Grouping functions. - KNF.
No functional change: - Add missing prototypes. - Rename functions for consistency and clarify. - KNF.
Add SERDES support from Matthias Drochner. Not all devices were tested but all SERDES entries are enabled.
Cleanup comments. No functional change.
Remove a duplicated error message
Fix compile error.
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
Restore the WM_F_EEPROM_SEMAPHORE flags for 82575-I354 and 80003 cases. The flag was removed in last commit.
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.
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@
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@
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.
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.
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.
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.
From dyoung@ -- bump max TX DMA size to avoid pathological condition with TSO.
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")
sync with head
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.
make pci_intr_string and eisa_intr_string take a buffer and a length instead of relying in local static storage.
kill sprintf
sync pcireg.h with HEAD. update if_wm.c and ppb.c accordingly.
Insert completion barrier between register write and delay(). One exception is chip reset (to avoid hangup).
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.
Remove unused variables
Remove extra debug message.
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]
sync with head
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.
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.
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]
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).
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.
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.
resync from head
Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.
Add ECC support for the packet buffer. Only 82571 and I21[78] support ECC.
Fix some bugs on I21[78] to make those devices stable.
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.
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.
The wm_linkintr_gmii() function is called from interrupt, so call mii_pollstat() instead of mii_tick().
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.
Use wm_gmii_hv_{read,write}reg() for I21[78].
Cleanup. No functional change.
- 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)
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.
Delete "PCI_" from PCIX and PICE capability registers.
Add support I21[01]. Only tested with my own I210-T1 Ethernet Server Adapter.
remove trailing whitespace
resync with head
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.
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]
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.
No functional change. - Fix comment. - Use macro.
No functional change. - "struct mii_data *mii = &sc->sc_mii" and use it. - Add comments. - Fix some comments.
Use 82580(and I350) specific PHY read/write functions. Fixes PR#47542.
Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.
Skip 64bit BAR correctly. I don't know if this bug causes a real problem.
- Add WM_DEBUG_NVM. - If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.
sync with (a bit old) head
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.
- 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.
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.
Resync to 2012-11-19 00:00:00 UTC
Change style a bit.
Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.
sync with netbsd-6-0-RELEASE.
sync with head
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.
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
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.
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.
Shut up gcc about some uninitialized variables.
Enable VLAN hardware tagging on all chips that have the new queue mechanism. Tested with 82575{EB,GB}, 82576, 82580, I350 and ICH9.
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.
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.
Fix the check of the device type in last commit. Reported by Thomas Klausner.
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.
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.
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.
sync to latest -current.
Add support Intel I350 Ethernet.
sync with head
merge to -current.
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.
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.
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 ...)
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 ...)
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.
Fix uninitialized data warning found by gcc 4.5
Sync with HEAD.
sync with head
Fix invalid PBA setting on ICH{9,10}. This bug was introduced in the last commit. I noticed this problem via mail from spz.
- 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.
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
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
sync with head
Sync with HEAD
Use /*FALLTHROUGH*/.
Sync with HEAD
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
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.
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.
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.
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.
Sync with HEAD (-D20101022).
- 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.
Sync with HEAD.
sync with head.
Add PAE to ALL kernel, so that most paddr_t format string errors get caught during compilation. While here, fix the compilation for ALL.
Use ether_set_ifflags_cb()
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.
- 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.
sync with head
Fix a bug that wm_attach() fails after reading MAC address. Fixes PR#43533. Fix an uninitialized value on some cases.
Only 82571 shares port 0 of EEMNGCTL_CFGDONE.
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
sync with head
Fix the names of 82577L[MC] LAN controllers (for mobile). Fix typo.
Sync with HEAD.
sync to netbsd-5
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.
sync with head
82576 is dual port, so check the FUNCID and increment the MAC address for the 2nd port.
Fix the type of sc_ss. That is not bus_space_handle_t but bus_size_t. Reported by jdc.
- 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.
Add two workarounds for ICH8 with igp3. - Workaround for 82566 Kumeran PCS lock loss. - WOL from S5 stops working.
Add the detach code.
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.
Fix regression caused by pullup #1277 requested by msaitoh.
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.
indent, tabify and remove extra spaces.
Don't increment when ICR_RXO is set because we count them by WMREG_MPC counter.
- 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.
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.
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.
Remove an extra debug printf(). KNF. No functional change.
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.
Fixes the rx stall problem on 82578 by MANY workaround code. We need more work for 82577.
- 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.
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...
Make wm_reset() and wm_gmii_reset() close to e1000 driver. At least, this change make wm_attach() stable on ICH9.
bugfixes: - add missing break in wm_reset()... - fix the offset of WMREG_PBS... - fix length of some delay()s in wm_gmii_reset()
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.
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 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.
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
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.
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.
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
Cleanup interrupt establish error messages. Do not mix aprint_error/aprint_normal/printf calls for a single line.
sync with head
Invert logic around nested pmf(9) registrations for readability.
sync with head.
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.
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.
Sync with HEAD.