Re: CVS commit: src/sys/dev/pci

2018-11-02 Thread Masanobu SAITOH

On 2018/11/02 17:16, SAITOH Masanobu wrote:

Module Name:src
Committed By:   msaitoh
Date:   Fri Nov  2 08:16:49 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- 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.


s/wm_phy_post_reset(false) should be called after 
reset/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.


To generate a diff of this commit:
cvs rdiff -u -r1.593 -r1.594 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: src/sys/dev/pci

2018-11-02 Thread Masanobu SAITOH

On 2018/11/02 17:04, SAITOH Masanobu wrote:

Module Name:src
Committed By:   msaitoh
Date:   Fri Nov  2 08:04:42 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
  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 reproduce this problem, the PHY link should be down
(don't connect Ethernet cable).


  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]


To generate a diff of this commit:
cvs rdiff -u -r1.591 -r1.592 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: src/sys/dev/pci

2018-10-31 Thread Masanobu SAITOH

On 2018/11/01 1:11, Jared D. McNeill wrote:

Module Name:src
Committed By:   jmcneill
Date:   Wed Oct 31 16:11:29 UTC 2018

Modified Files:
src/sys/dev/pci: xhci_pci.c

Log Message:
Add MSI-X support.


 Some xHCI chips support multi-vector MSI or MSI-X. Each
vector can be assigned to different port. Please someone(TM) wrote
the code to get the benefit.




To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/xhci_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: src/sys/dev/pci

2018-09-14 Thread Jonathan A. Kollasch
On Fri, Sep 14, 2018 at 06:46:47PM +, Jonathan A. Kollasch wrote:
> Module Name:  src
> Committed By: jakllsch
> Date: Fri Sep 14 18:46:47 UTC 2018
> 
> Modified Files:
>   src/sys/dev/pci: if_msk.c if_mskvar.h if_skreg.h
> 
> Log Message:
> msk(4): add 64-bit DMA support
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/if_msk.c
> cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/if_mskvar.h
> cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_skreg.h

The commit message on these file-revisions have been adjusted to:

msk(4): add 64-bit DMA support

portions of this change set provided by mrg@


Re: CVS commit: src/sys/dev/pci/ixgbe

2018-07-03 Thread Masanobu SAITOH

On 2018/07/03 13:02, SAITOH Masanobu wrote:

Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  3 04:02:07 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
  Remove nmbclusters check.


 A big problem is that the number of RX descriptor unexpectedly
decreased from 2048 to 1024 if the number of port and/or the number
of CPU is high.


a2sdihtp4f: sysctl -a | grep ixg | grep rx_desc
hw.ixg0.num_rx_desc = 2048
hw.ixg1.num_rx_desc = 2048
hw.ixg2.num_rx_desc = 2048
hw.ixg3.num_rx_desc = 1024




We don't use the mbuf cluster. The old code also had
a bug that ixgbe_total_ports adds two every port and never decrement in
the detach path. Found by hikaru@.

  The code was removed in FreeBSD when it switched to use iflib and OpenBSD
removed the code 8 years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/pci/ixgbe/ixgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: src/sys/dev/pci

2018-06-08 Thread Ryo ONODERA
Hi,

From: Kengo NAKAHARA , Date: Fri, 8 Jun 2018 20:20:03 
+0900

> Hi,
> 
> Sorry, I checked it fixed panic only. iwm.c:r1.81 and r1.82 fix this problem
> at my environment.
> 
> Could you try latest kernel with these commits?

Thank you very much for your quick fix.
It works fine now.

> Thanks,
> 
> On 2018/06/09 3:14, Ryo ONODERA wrote:
>> Hi,
>> 
>> This change causes the following error and I cannot use iwm(4) device
>> anymore.
>> Could you take a look at my problem?
>> 
>> $ ifconfig iwm0
>> ifconfig: SIOCGIFFLAGS iwm0: Device not configured
>> 
>> dmesg is here:
>> (snip)
>> iwm0 at pci2 dev 0 function 0: vendor 8086 product 24fd (rev. 0x78)
>> iwm0: interrupting at msi2 vec 0
>> (snip)
>> iwm0: hw rev 0x230, fw ver 22.361476.0, address 74:e5:f9:69:6c:bb
>> iwm0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
>> iwm0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
>> iwm0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 
>> 36Mbps 48Mbps 54Mbps
>> 
>> 
>> From: "Kengo NAKAHARA" , Date: Tue, 5 Jun 2018 
>> 12:17:18 +
>> 
>>> Module Name:src
>>> Committed By:   knakahara
>>> Date:   Tue Jun  5 12:17:18 UTC 2018
>>>
>>> Modified Files:
>>> src/sys/dev/pci: if_iwm.c
>>>
>>> Log Message:
>>> Fix panic on boot with iwm(4). Advised by nonaka@n.o, thanks.
>>>
>>> XXX pullup-8
>>>
>>>
>>> To generate a diff of this commit:
>>> cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/if_iwm.c
>>>
>>> Please note that diffs are not public domain; they are subject to the
>>> copyright notices on the relevant files.
>>>
>> 
>> --
>> Ryo ONODERA // r...@tetera.org
>> PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
>> 
> 
> -- 
> //
> Internet Initiative Japan Inc.
> 
> Device Engineering Section,
> IoT Platform Development Department,
> Network Division,
> Technology Unit
> 
> Kengo NAKAHARA 

--
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Re: CVS commit: src/sys/dev/pci

2018-06-08 Thread Kengo NAKAHARA
Hi,

Sorry, I checked it fixed panic only. iwm.c:r1.81 and r1.82 fix this problem
at my environment.

Could you try latest kernel with these commits?


Thanks,

On 2018/06/09 3:14, Ryo ONODERA wrote:
> Hi,
> 
> This change causes the following error and I cannot use iwm(4) device
> anymore.
> Could you take a look at my problem?
> 
> $ ifconfig iwm0
> ifconfig: SIOCGIFFLAGS iwm0: Device not configured
> 
> dmesg is here:
> (snip)
> iwm0 at pci2 dev 0 function 0: vendor 8086 product 24fd (rev. 0x78)
> iwm0: interrupting at msi2 vec 0
> (snip)
> iwm0: hw rev 0x230, fw ver 22.361476.0, address 74:e5:f9:69:6c:bb
> iwm0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
> iwm0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
> iwm0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 
> 36Mbps 48Mbps 54Mbps
> 
> 
> From: "Kengo NAKAHARA" , Date: Tue, 5 Jun 2018 12:17:18 
> +
> 
>> Module Name: src
>> Committed By:knakahara
>> Date:Tue Jun  5 12:17:18 UTC 2018
>>
>> Modified Files:
>>  src/sys/dev/pci: if_iwm.c
>>
>> Log Message:
>> Fix panic on boot with iwm(4). Advised by nonaka@n.o, thanks.
>>
>> XXX pullup-8
>>
>>
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/if_iwm.c
>>
>> Please note that diffs are not public domain; they are subject to the
>> copyright notices on the relevant files.
>>
> 
> --
> Ryo ONODERA // r...@tetera.org
> PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
> 

-- 
//
Internet Initiative Japan Inc.

Device Engineering Section,
IoT Platform Development Department,
Network Division,
Technology Unit

Kengo NAKAHARA 


Re: CVS commit: src/sys/dev/pci

2018-06-08 Thread Ryo ONODERA
Hi,

This change causes the following error and I cannot use iwm(4) device
anymore.
Could you take a look at my problem?

$ ifconfig iwm0
ifconfig: SIOCGIFFLAGS iwm0: Device not configured

dmesg is here:
(snip)
iwm0 at pci2 dev 0 function 0: vendor 8086 product 24fd (rev. 0x78)
iwm0: interrupting at msi2 vec 0
(snip)
iwm0: hw rev 0x230, fw ver 22.361476.0, address 74:e5:f9:69:6c:bb
iwm0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
iwm0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
iwm0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 
36Mbps 48Mbps 54Mbps


From: "Kengo NAKAHARA" , Date: Tue, 5 Jun 2018 12:17:18 
+

> Module Name:  src
> Committed By: knakahara
> Date: Tue Jun  5 12:17:18 UTC 2018
> 
> Modified Files:
>   src/sys/dev/pci: if_iwm.c
> 
> Log Message:
> Fix panic on boot with iwm(4). Advised by nonaka@n.o, thanks.
> 
> XXX pullup-8
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/if_iwm.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 

--
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


CVS commit: src/sys/dev/pci

2018-05-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 28 02:28:05 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1327 -r1.1328 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1326 -r1.1327 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 28 02:28:05 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1327 -r1.1328 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1326 -r1.1327 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1327 src/sys/dev/pci/pcidevs.h:1.1328
--- src/sys/dev/pci/pcidevs.h:1.1327	Sat May 26 13:26:01 2018
+++ src/sys/dev/pci/pcidevs.h	Mon May 28 02:28:05 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1327 2018/05/26 13:26:01 jakllsch Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1328 2018/05/28 02:28:05 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp
+ *	NetBSD: pcidevs,v 1.1337 2018/05/28 02:27:32 msaitoh Exp
  */
 
 /*
@@ -4045,8 +4045,12 @@
 #define	PCI_PRODUCT_INTEL_82965GME_IGD	0x2a12		/* 82965GME Integrated Graphics Device */
 #define	PCI_PRODUCT_INTEL_82965GME_KT	0x2a17		/* 82965GME KT */
 #define	PCI_PRODUCT_INTEL_82GM45_HB	0x2a40		/* 82GM45 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82GM45_PCIE	0x2a41		/* 82GM45 PCIe */
 #define	PCI_PRODUCT_INTEL_82GM45_IGD	0x2a42		/* 82GM45 Integrated Graphics Device */
 #define	PCI_PRODUCT_INTEL_82GM45_IGD_1	0x2a43		/* 82GM45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82GM45_MEI_1	0x2a44		/* 82GM45 MEI */
+#define	PCI_PRODUCT_INTEL_82GM45_MEI_2	0x2a45		/* 82GM45 MEI */
+#define	PCI_PRODUCT_INTEL_82GM45_IDER	0x2a46		/* 82GM45 IDER */
 #define	PCI_PRODUCT_INTEL_82GM45_KT	0x2a47		/* 82GM45 KT */
 #define	PCI_PRODUCT_INTEL_XE55_QP_SAD	0x2c01		/* QuickPath System Address Decoder */
 #define	PCI_PRODUCT_INTEL_XE55_QPI_LINK0	0x2c10		/* Xeon 5500 QPI Link 0 */
@@ -4118,7 +4122,11 @@
 #define	PCI_PRODUCT_INTEL_XE56_IMC_CH2_RANK	0x2db2		/* Xeon 5600 IMC Channel 2 Rank */
 #define	PCI_PRODUCT_INTEL_XE56_IMC_CH2_THERM	0x2db3		/* Xeon 5600 IMC Channel 2 Thermal Control */
 #define	PCI_PRODUCT_INTEL_82IGD_E_HB	0x2e00		/* 82IGD_E Host Bridge */
+#define	PCI_PRODUCT_INTEL_82Q45_PCIE	0x2e01		/* 82IGD_E PCIe */
 #define	PCI_PRODUCT_INTEL_82IGD_E_IGD	0x2e02		/* 82IGD_E Integrated Graphics */
+#define	PCI_PRODUCT_INTEL_82Q45_HECI_1	0x2e04		/* 82Q45 ME HECI */
+#define	PCI_PRODUCT_INTEL_82Q45_HECI_2	0x2e05		/* 82Q45 ME HECI */
+#define	PCI_PRODUCT_INTEL_82Q45_IDER_2	0x2e06		/* 82Q45 ME IDER */
 #define	PCI_PRODUCT_INTEL_82Q45_KT	0x2e07		/* 82Q45 KT */
 #define	PCI_PRODUCT_INTEL_82Q45_HB	0x2e10		/* 82Q45 Host Bridge */
 #define	PCI_PRODUCT_INTEL_82Q45_EXP	0x2e11		/* 82Q45 PCI Express Bridge */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1326 src/sys/dev/pci/pcidevs_data.h:1.1327
--- src/sys/dev/pci/pcidevs_data.h:1.1326	Sat May 26 13:26:01 2018
+++ src/sys/dev/pci/pcidevs_data.h	Mon May 28 02:28:05 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1326 2018/05/26 13:26:01 jakllsch Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1327 2018/05/28 02:28:05 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp
+ *	NetBSD: pcidevs,v 1.1337 2018/05/28 02:27:32 msaitoh Exp
  */
 
 /*
@@ -6810,22 +6810,30 @@ static const uint16_t pci_products[] = {
 	22729, 21244, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_HB, 
 	22738, 6839, 6449, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_PCIE, 
+	22738, 18304, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_IGD, 
 	22738, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_IGD_1, 
 	22738, 692, 1716, 2427, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_MEI_1, 
+	22738, 21293, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_MEI_2, 
+	22738, 21293, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_IDER, 
+	22738, 22745, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_KT, 
 	22738, 21244, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE55_QP_SAD, 
-	22745, 6, 7871, 6805, 0,
+	22750, 6, 7871, 6805, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE55_QPI_LINK0, 
 	18869, 21053, 19114, 7912, 7956, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE55_QPI_PHYS0, 
 	18869, 21053, 19114, 21502, 7956, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE55_MIRR_LINK0, 
-	18869, 21053, 22755, 7975, 7912, 7956, 0,
+	18869, 21053, 22760, 7975, 7912, 7956, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE55_MIRR_LINK1, 
-	18869, 21053, 22755, 7975, 7912, 7958, 0,
+	18869, 21053, 22760, 7975, 7912, 7958, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE55_QPI_LINK1, 
 	18869, 21053, 19114, 7912, 7958, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE55_QPI_PHYS1, 
@@ -6837,13 

CVS commit: src/sys/dev/pci

2018-05-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 28 02:27:33 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add some Intel 4 series chipset devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1336 -r1.1337 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 28 02:27:33 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add some Intel 4 series chipset devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1336 -r1.1337 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1336 src/sys/dev/pci/pcidevs:1.1337
--- src/sys/dev/pci/pcidevs:1.1336	Sat May 26 13:25:19 2018
+++ src/sys/dev/pci/pcidevs	Mon May 28 02:27:32 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp $
+$NetBSD: pcidevs,v 1.1337 2018/05/28 02:27:32 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4038,8 +4038,12 @@ product INTEL 82965GME_HB	0x2a10	82965GM
 product INTEL 82965GME_IGD	0x2a12	82965GME Integrated Graphics Device
 product INTEL 82965GME_KT	0x2a17	82965GME KT
 product INTEL 82GM45_HB		0x2a40	82GM45 Host Bridge
+product INTEL 82GM45_PCIE	0x2a41	82GM45 PCIe
 product INTEL 82GM45_IGD	0x2a42	82GM45 Integrated Graphics Device
 product INTEL 82GM45_IGD_1	0x2a43	82GM45 Integrated Graphics Device
+product INTEL 82GM45_MEI_1	0x2a44	82GM45 MEI
+product INTEL 82GM45_MEI_2	0x2a45	82GM45 MEI
+product INTEL 82GM45_IDER	0x2a46	82GM45 IDER
 product INTEL 82GM45_KT		0x2a47	82GM45 KT
 product INTEL XE55_QP_SAD	0x2c01	QuickPath System Address Decoder
 product INTEL XE55_QPI_LINK0	0x2c10	Xeon 5500 QPI Link 0
@@ -4111,7 +4115,11 @@ product INTEL XE56_IMC_CH2_ADDR 0x2db1	X
 product INTEL XE56_IMC_CH2_RANK 0x2db2	Xeon 5600 IMC Channel 2 Rank
 product INTEL XE56_IMC_CH2_THERM 0x2db3	Xeon 5600 IMC Channel 2 Thermal Control
 product INTEL 82IGD_E_HB	0x2e00	82IGD_E Host Bridge
+product INTEL 82Q45_PCIE	0x2e01	82IGD_E PCIe
 product INTEL 82IGD_E_IGD	0x2e02	82IGD_E Integrated Graphics
+product INTEL 82Q45_HECI_1	0x2e04	82Q45 ME HECI
+product INTEL 82Q45_HECI_2	0x2e05	82Q45 ME HECI
+product INTEL 82Q45_IDER_2	0x2e06	82Q45 ME IDER
 product INTEL 82Q45_KT		0x2e07	82Q45 KT
 product INTEL 82Q45_HB		0x2e10	82Q45 Host Bridge
 product INTEL 82Q45_EXP		0x2e11	82Q45 PCI Express Bridge



CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:33:44 UTC 2018

Modified Files:
src/sys/dev/pci: piixide.c

Log Message:
Match PCI_PRODUCT_INTEL_82Q45_IDER.

Not entirely sure which chip map to use, but as this is for AMT, it's
probably not like there's a real PATA interface to configure DMA for,
and as the 965 AMT stuff uses the sata version of the chip map, we'll
cargo cult it for now.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/piixide.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:33:44 UTC 2018

Modified Files:
src/sys/dev/pci: piixide.c

Log Message:
Match PCI_PRODUCT_INTEL_82Q45_IDER.

Not entirely sure which chip map to use, but as this is for AMT, it's
probably not like there's a real PATA interface to configure DMA for,
and as the 965 AMT stuff uses the sata version of the chip map, we'll
cargo cult it for now.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/piixide.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/piixide.c
diff -u src/sys/dev/pci/piixide.c:1.65 src/sys/dev/pci/piixide.c:1.66
--- src/sys/dev/pci/piixide.c:1.65	Mon Feb  1 08:28:48 2016
+++ src/sys/dev/pci/piixide.c	Sat May 26 13:33:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: piixide.c,v 1.65 2016/02/01 08:28:48 msaitoh Exp $	*/
+/*	$NetBSD: piixide.c,v 1.66 2018/05/26 13:33:44 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.65 2016/02/01 08:28:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.66 2018/05/26 13:33:44 jakllsch Exp $");
 
 #include 
 #include 
@@ -289,6 +289,11 @@ static const struct pciide_product_desc 
 	  "Intel 82965PM IDE controller",
 	  piixsata_chip_map,
 	},
+	{ PCI_PRODUCT_INTEL_82Q45_IDER,
+	  0,
+	  "Intel 82Q45 IDE Redirection controller",
+	  piixsata_chip_map,
+	},
 	{
 	  PCI_PRODUCT_INTEL_3400_SATA_1,
 	  0,



CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:26:02 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1326 -r1.1327 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1325 -r1.1326 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:26:02 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1326 -r1.1327 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1325 -r1.1326 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1326 src/sys/dev/pci/pcidevs.h:1.1327
--- src/sys/dev/pci/pcidevs.h:1.1326	Thu May 24 04:29:55 2018
+++ src/sys/dev/pci/pcidevs.h	Sat May 26 13:26:01 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1326 2018/05/24 04:29:55 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1327 2018/05/26 13:26:01 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1335 2018/05/24 04:29:25 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp
  */
 
 /*
@@ -4124,6 +4124,7 @@
 #define	PCI_PRODUCT_INTEL_82Q45_EXP	0x2e11		/* 82Q45 PCI Express Bridge */
 #define	PCI_PRODUCT_INTEL_82Q45_IGD	0x2e12		/* 82Q45 Integrated Graphics Device */
 #define	PCI_PRODUCT_INTEL_82Q45_IGD_1	0x2e13		/* 82Q45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q45_IDER	0x2e16		/* 82Q45 IDER */
 #define	PCI_PRODUCT_INTEL_82Q45_KT_1	0x2e17		/* 82Q45 KT */
 #define	PCI_PRODUCT_INTEL_82G45_HB	0x2e20		/* 82G45 Host Bridge */
 #define	PCI_PRODUCT_INTEL_82G45_IGD	0x2e22		/* 82G45 Integrated Graphics Device */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1325 src/sys/dev/pci/pcidevs_data.h:1.1326
--- src/sys/dev/pci/pcidevs_data.h:1.1325	Thu May 24 04:29:55 2018
+++ src/sys/dev/pci/pcidevs_data.h	Sat May 26 13:26:01 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1325 2018/05/24 04:29:55 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1326 2018/05/26 13:26:01 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1335 2018/05/24 04:29:25 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp
  */
 
 /*
@@ -6968,24 +6968,26 @@ static const uint16_t pci_products[] = {
 	22843, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_IGD_1, 
 	22843, 692, 1716, 2427, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_IDER, 
+	22843, 22849, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_KT_1, 
 	22843, 21244, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G45_HB, 
-	22849, 6839, 6449, 0,
+	22854, 6839, 6449, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G45_IGD, 
-	22849, 692, 1716, 2427, 0,
+	22854, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G41_HB, 
-	22855, 6839, 6449, 0,
+	22860, 6839, 6449, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G41_IGD, 
-	22855, 692, 1716, 2427, 0,
+	22860, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82B43_HB, 
-	22861, 6839, 6449, 0,
+	22866, 6839, 6449, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82B43_IGD, 
-	22861, 692, 1716, 2427, 0,
+	22866, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_DMI2, 
 	18869, 18998, 18882, 19004, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_1_1, 
-	18869, 18998, 18882, 18304, 7962, 7975, 22867, 19004, 22870, 0,
+	18869, 18998, 18882, 18304, 7962, 7975, 22872, 19004, 22875, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_1_2, 
 	18869, 18998, 18882, 18304, 7962, 7975, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_1, 
@@ -7005,33 +7007,33 @@ static const uint16_t pci_products[] = {
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_4, 
 	18869, 18998, 18882, 18304, 7962, 7975, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_R2PCIE_1, 
-	18869, 18998, 22875, 22883, 692, 8365, 5905, 3027, 0,
+	18869, 18998, 22880, 22888, 692, 8365, 5905, 3027, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_UBOX_1, 
-	18869, 18998, 18882, 22892, 558, 22903, 0,
+	18869, 18998, 18882, 22897, 558, 22908, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_UBOX_3, 
-	18869, 18998, 18882, 22892, 558, 22903, 0,
+	18869, 18998, 18882, 22897, 558, 22908, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH0, 
-	18869, 18998, 18882, 22914, 19044, 15233, 7956, 0,
+	18869, 18998, 18882, 22919, 19044, 15233, 7956, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH1, 
-	18869, 18998, 18882, 22914, 19044, 15233, 7958, 0,
+	18869, 18998, 18882, 22919, 19044, 15233, 7958, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH2, 
-	18869, 18998, 18882, 22914, 19044, 15233, 6297, 0,
+	18869, 18998, 18882, 22919, 19044, 15233, 6297, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH3, 
-	18869, 

CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:25:19 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel 82Q45 IDER


To generate a diff of this commit:
cvs rdiff -u -r1.1335 -r1.1336 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:25:19 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel 82Q45 IDER


To generate a diff of this commit:
cvs rdiff -u -r1.1335 -r1.1336 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1335 src/sys/dev/pci/pcidevs:1.1336
--- src/sys/dev/pci/pcidevs:1.1335	Thu May 24 04:29:25 2018
+++ src/sys/dev/pci/pcidevs	Sat May 26 13:25:19 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1335 2018/05/24 04:29:25 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4117,6 +4117,7 @@ product INTEL 82Q45_HB		0x2e10	82Q45 Hos
 product INTEL 82Q45_EXP		0x2e11	82Q45 PCI Express Bridge
 product INTEL 82Q45_IGD		0x2e12	82Q45 Integrated Graphics Device
 product INTEL 82Q45_IGD_1	0x2e13	82Q45 Integrated Graphics Device
+product INTEL 82Q45_IDER	0x2e16	82Q45 IDER
 product INTEL 82Q45_KT_1	0x2e17	82Q45 KT
 product INTEL 82G45_HB		0x2e20	82G45 Host Bridge
 product INTEL 82G45_IGD		0x2e22	82G45 Integrated Graphics Device



CVS commit: src/sys/dev/pci

2018-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 24 04:29:25 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add some Marvell Yukon devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1334 -r1.1335 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1334 src/sys/dev/pci/pcidevs:1.1335
--- src/sys/dev/pci/pcidevs:1.1334	Mon May 21 03:45:50 2018
+++ src/sys/dev/pci/pcidevs	Thu May 24 04:29:25 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1334 2018/05/21 03:45:50 jnemeth Exp $
+$NetBSD: pcidevs,v 1.1335 2018/05/24 04:29:25 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2513,6 +2513,13 @@ product MARVELL YUKON_C032	0x4367	Yukon 
 product MARVELL YUKON_C034	0x4368	Yukon 88EC034
 product MARVELL YUKON_C042	0x4369	Yukon 88EC042
 product MARVELL YUKON_8058	0x436a	Yukon 88E8058
+product MARVELL YUKON_8071	0x436b	Yukon 88E8071
+product MARVELL YUKON_8072	0x436c	Yukon 88E8072
+product MARVELL YUKON_8055_2	0x436d	Yukon 88E8055
+product MARVELL YUKON_8075	0x4370	Yukon 88E8075
+product MARVELL YUKON_8057	0x4380	Yukon 88E8057
+product MARVELL YUKON_8059	0x4381	Yukon 88E8059
+product MARVELL YUKON_8079	0x4382	Yukon 88E8079
 product MARVELL GT64120		0x4620	GT-64120 System Controller
 product MARVELL BELKIN		0x5005	Belkin Gigabit Ethernet
 product MARVELL 88SX5040	0x5040	88SX5040 SATA



CVS commit: src/sys/dev/pci

2018-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 24 04:29:25 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add some Marvell Yukon devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1334 -r1.1335 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 24 04:29:56 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1325 -r1.1326 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1324 -r1.1325 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 10:11:08 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
 Add "bool txr_no_space" for TX descriptor shortage. Use it like IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.46 src/sys/dev/pci/ixgbe/ix_txrx.c:1.47
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.46	Wed May 23 04:45:24 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.46 2018/05/23 04:45:24 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.47 2018/05/23 10:11:07 msaitoh Exp $ */
 
 /**
 
@@ -146,7 +146,9 @@ ixgbe_legacy_start_locked(struct ifnet *
 	}
 	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return (ENETDOWN);
-
+	if (txr->txr_no_space)
+		return (ENETDOWN);
+	
 	while (!IFQ_IS_EMPTY(>if_snd)) {
 		if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
 			break;
@@ -291,6 +293,8 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 	}
 	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return (ENETDOWN);
+	if (txr->txr_no_space)
+		return (ENETDOWN);
 
 	/* Process the queue */
 	while ((next = pcq_get(txr->txr_interq)) != NULL) {
@@ -461,6 +465,7 @@ retry:
 
 	/* Make certain there are enough descriptors */
 	if (txr->tx_avail < (map->dm_nsegs + 2)) {
+		txr->txr_no_space = true;
 		txr->no_desc_avail.ev_count++;
 		ixgbe_dmamap_unload(txr->txtag, txbuf->map);
 		return EAGAIN;
@@ -1159,6 +1164,7 @@ ixgbe_txeof(struct tx_ring *txr)
 			buf->m_head = NULL;
 		}
 		buf->eop = NULL;
+		txr->txr_no_space = false;
 		++txr->tx_avail;
 
 		/* We clean the range if multi segment */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.154 src/sys/dev/pci/ixgbe/ixgbe.c:1.155
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.154	Wed May 23 04:37:13 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.154 2018/05/23 04:37:13 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.155 2018/05/23 10:11:07 msaitoh Exp $ */
 
 /**
 
@@ -703,6 +703,8 @@ ixgbe_initialize_transmit_units(struct a
 		/* Cache the tail address */
 		txr->tail = IXGBE_TDT(j);
 
+		txr->txr_no_space = false;
+
 		/* Disable Head Writeback */
 		/*
 		 * Note: for X550 series devices, these registers are actually

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.48 src/sys/dev/pci/ixgbe/ixgbe.h:1.49
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.48	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.48 2018/05/18 10:09:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.49 2018/05/23 10:11:07 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -368,6 +368,7 @@ struct tx_ring {
 	pcq_t			*txr_interq;
 	struct work		wq_cookie;
 	void			*txr_si;
+	bool			txr_no_space; /* Like IFF_OACTIVE */
 
 	/* Flow Director */
 	u16			atr_sample;

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.99 src/sys/dev/pci/ixgbe/ixv.c:1.100
--- src/sys/dev/pci/ixgbe/ixv.c:1.99	Wed May 23 04:37:13 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.99 2018/05/23 04:37:13 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.100 2018/05/23 10:11:07 msaitoh Exp $*/
 
 /**
 
@@ -1589,6 +1589,8 @@ ixv_initialize_transmit_units(struct ada
 		/* Set Tx Tail register */
 		txr->tail = IXGBE_VFTDT(j);
 
+		txr->txr_no_space = false;
+
 		/* Set Ring parameters */
 		IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(j),
 		(tdba & 0xULL));



CVS commit: src/sys/dev/pci/ixgbe

2018-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 10:11:08 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
 Add "bool txr_no_space" for TX descriptor shortage. Use it like IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 04:45:24 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Don't check IFF_RUNNING in ixgbe_rxeof(). Doing break and leaving a deacriptor
with DD bit is worse than just processing the entry. And it's also racy to
check IFF_RUNNING in rxeof(). If you'd like to strictly obey IFF_RUNNING,
it would be better to do it in the upper layer.

 Same as DragonFly (a part of 79251f5ebe4cf9dd2f3e6aed590e09d756d39922).


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ix_txrx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.45 src/sys/dev/pci/ixgbe/ix_txrx.c:1.46
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.45	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed May 23 04:45:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.45 2018/05/18 10:09:02 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.46 2018/05/23 04:45:24 msaitoh Exp $ */
 
 /**
 
@@ -1833,8 +1833,6 @@ ixgbe_rxeof(struct ix_queue *que)
 
 		if ((staterr & IXGBE_RXD_STAT_DD) == 0)
 			break;
-		if ((ifp->if_flags & IFF_RUNNING) == 0)
-			break;
 
 		count--;
 		sendmp = NULL;



CVS commit: src/sys/dev/pci/ixgbe

2018-05-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 04:45:24 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Don't check IFF_RUNNING in ixgbe_rxeof(). Doing break and leaving a deacriptor
with DD bit is worse than just processing the entry. And it's also racy to
check IFF_RUNNING in rxeof(). If you'd like to strictly obey IFF_RUNNING,
it would be better to do it in the upper layer.

 Same as DragonFly (a part of 79251f5ebe4cf9dd2f3e6aed590e09d756d39922).


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ix_txrx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 04:37:13 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 Add rxd_nxck (Receive Descriptor next to check) read only sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 04:37:13 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 Add rxd_nxck (Receive Descriptor next to check) read only sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.153 src/sys/dev/pci/ixgbe/ixgbe.c:1.154
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.153	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed May 23 04:37:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.153 2018/05/18 10:09:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.154 2018/05/23 04:37:13 msaitoh Exp $ */
 
 /**
 
@@ -236,6 +236,7 @@ static int	ixgbe_sysctl_phy_overtemp_occ
 static int	ixgbe_sysctl_power_state(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO);
 #endif
+static int  ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
 static int  ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int  ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int  ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -1817,6 +1818,14 @@ ixgbe_add_hw_stats(struct adapter *adapt
 		if (sysctl_createv(log, 0, , ,
 		CTLFLAG_READONLY,
 		CTLTYPE_INT,
+		"rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"),
+			ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
+		CTL_CREATE, CTL_EOL) != 0)
+			break;
+
+		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY,
+		CTLTYPE_INT,
 		"rxd_head", SYSCTL_DESCR("Receive Descriptor Head"),
 		ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
 		CTL_CREATE, CTL_EOL) != 0)
@@ -2179,6 +2188,27 @@ ixgbe_sysctl_tdt_handler(SYSCTLFN_ARGS)
 } /* ixgbe_sysctl_tdt_handler */
 
 /
+ * ixgbe_sysctl_next_to_check_handler - Receive Descriptor next to check
+ * handler function
+ *
+ *   Retrieves the next_to_check value
+ /
+static int 
+ixgbe_sysctl_next_to_check_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+	uint32_t val;
+
+	if (!rxr)
+		return (0);
+
+	val = rxr->next_to_check;
+	node.sysctl_data = 
+	return sysctl_lookup(SYSCTLFN_CALL());
+} /* ixgbe_sysctl_next_to_check_handler */
+
+/
  * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function
  *
  *   Retrieves the RDH value from the hardware

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.98 src/sys/dev/pci/ixgbe/ixv.c:1.99
--- src/sys/dev/pci/ixgbe/ixv.c:1.98	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed May 23 04:37:13 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.98 2018/05/18 10:09:02 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.99 2018/05/23 04:37:13 msaitoh Exp $*/
 
 /**
 
@@ -136,6 +136,7 @@ static void	ixv_add_stats_sysctls(struct
 static void	ixv_set_sysctl_value(struct adapter *, const char *,
 		const char *, int *, int);
 static int  ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
+static int  ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
 static int  ixv_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int  ixv_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int  ixv_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -1878,6 +1879,27 @@ ixv_sysctl_tdt_handler(SYSCTLFN_ARGS)
 } /* ixv_sysctl_tdt_handler */
 
 /
+ * ixv_sysctl_next_to_check_handler - Receive Descriptor next to check
+ * handler function
+ *
+ *   Retrieves the next_to_check value
+ /
+static int 
+ixv_sysctl_next_to_check_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+	uint32_t val;
+
+	if (!rxr)
+		return (0);
+
+	val = rxr->next_to_check;
+	node.sysctl_data = 
+	return sysctl_lookup(SYSCTLFN_CALL());
+} /* ixv_sysctl_next_to_check_handler */
+
+/
  * ixv_sysctl_rdh_handler - Receive Descriptor Head handler function
  *
  *   Retrieves the RDH value from the hardware
@@ -2450,6 +2472,14 @@ ixv_add_stats_sysctls(struct adapter *ad
 		if (sysctl_createv(log, 0, , ,
 		CTLFLAG_READONLY,
 		CTLTYPE_INT,
+		"rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"),
+			ixv_sysctl_next_to_check_handler, 0, (void *)rxr, 

CVS commit: src/sys/dev/pci

2018-05-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon May 21 03:56:21 UTC 2018

Modified Files:
src/sys/dev/pci: pucdata.c

Log Message:
add Oxford Semiconductor OXPCIe954 PCIe 4-port serial card


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/pci/pucdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.101 src/sys/dev/pci/pucdata.c:1.102
--- src/sys/dev/pci/pucdata.c:1.101	Fri Apr 13 07:57:04 2018
+++ src/sys/dev/pci/pucdata.c	Mon May 21 03:56:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.101 2018/04/13 07:57:04 msaitoh Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.102 2018/05/21 03:56:21 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.101 2018/04/13 07:57:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.102 2018/05/21 03:56:21 jnemeth Exp $");
 
 #include 
 #include 
@@ -1108,6 +1108,19 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* Oxford Semiconductor OXPCIe954 PCIe UARTs */
+	{   "Oxford Semiconductor OXPCIe954 UART",
+	{	PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE954,
+		0, 0 },
+	{	0x,	0x,	0,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1000, COM_FREQ * 0x22 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1200, COM_FREQ * 0x22 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1400, COM_FREQ * 0x22 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1600, COM_FREQ * 0x22 },
+	},
+	},
+
 	/* Oxford Semiconductor OXmPCI952 PCI UARTs */
 	{   "Oxford Semiconductor OXmPCI952 UARTs",
 	{	PCI_VENDOR_OXFORDSEMI,	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41092,



CVS commit: src/sys/dev/pci

2018-05-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon May 21 03:56:21 UTC 2018

Modified Files:
src/sys/dev/pci: pucdata.c

Log Message:
add Oxford Semiconductor OXPCIe954 PCIe 4-port serial card


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/pci/pucdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon May 21 03:54:06 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1324 -r1.1325 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1323 -r1.1324 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon May 21 03:45:50 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add Oxford Semiconductor OXPCIe954 PCIe 4-port serial card


To generate a diff of this commit:
cvs rdiff -u -r1.1333 -r1.1334 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1333 src/sys/dev/pci/pcidevs:1.1334
--- src/sys/dev/pci/pcidevs:1.1333	Thu May  3 04:21:10 2018
+++ src/sys/dev/pci/pcidevs	Mon May 21 03:45:50 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1333 2018/05/03 04:21:10 maya Exp $
+$NetBSD: pcidevs,v 1.1334 2018/05/21 03:45:50 jnemeth Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6280,6 +6280,7 @@ product OXFORDSEMI OXPCIE952_3	0xc140	OX
 product OXFORDSEMI OXPCIE952_4	0xc141	OXPCIe952
 product OXFORDSEMI OXPCIE952_5	0xc144	OXPCIe952
 product OXFORDSEMI OXPCIE952_6	0xc145	OXPCIe952
+product OXFORDSEMI OXPCIE954	0xc208	OXPCIe954
 
 /* Packet Engines products */
 product PACKETENGINES GNICII	0x0911	G-NIC II Ethernet



CVS commit: src/sys/dev/pci

2018-05-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon May 21 03:45:50 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add Oxford Semiconductor OXPCIe954 PCIe 4-port serial card


To generate a diff of this commit:
cvs rdiff -u -r1.1333 -r1.1334 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 17:21:42 UTC 2018

Modified Files:
src/sys/dev/pci: pci_map.c

Log Message:
Re-enable PCI window decode enable in PCI Command Register upon
successful pci_mapreg_map().

Loosely related to PR #53286.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/pci_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 17:21:42 UTC 2018

Modified Files:
src/sys/dev/pci: pci_map.c

Log Message:
Re-enable PCI window decode enable in PCI Command Register upon
successful pci_mapreg_map().

Loosely related to PR #53286.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/pci_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pci_map.c
diff -u src/sys/dev/pci/pci_map.c:1.35 src/sys/dev/pci/pci_map.c:1.36
--- src/sys/dev/pci/pci_map.c:1.35	Sat May 19 17:18:57 2018
+++ src/sys/dev/pci/pci_map.c	Sat May 19 17:21:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_map.c,v 1.35 2018/05/19 17:18:57 jakllsch Exp $	*/
+/*	$NetBSD: pci_map.c,v 1.36 2018/05/19 17:21:42 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.35 2018/05/19 17:18:57 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.36 2018/05/19 17:21:42 jakllsch Exp $");
 
 #include 
 #include 
@@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 
 #include 
 #include 
 
-bool pci_mapreg_map_enable_decode = false;
+bool pci_mapreg_map_enable_decode = true;
 
 static int
 pci_io_find(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t type,



CVS commit: src/sys/dev/pci

2018-05-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 19 09:32:55 UTC 2018

Modified Files:
src/sys/dev/pci: if_ena.c if_enavar.h

Log Message:
Intermediate changes to make it further into actually at least compile, not 
nearly yet
complete. Committed so that others can possibly pick it off, as discussed
on tech-userlevel@ with Martin


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/dev/pci/if_ena.c \
src/sys/dev/pci/if_enavar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 19 09:32:55 UTC 2018

Modified Files:
src/sys/dev/pci: if_ena.c if_enavar.h

Log Message:
Intermediate changes to make it further into actually at least compile, not 
nearly yet
complete. Committed so that others can possibly pick it off, as discussed
on tech-userlevel@ with Martin


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/dev/pci/if_ena.c \
src/sys/dev/pci/if_enavar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_ena.c
diff -u src/sys/dev/pci/if_ena.c:1.1.1.1 src/sys/dev/pci/if_ena.c:1.2
--- src/sys/dev/pci/if_ena.c:1.1.1.1	Sat May 19 09:18:31 2018
+++ src/sys/dev/pci/if_ena.c	Sat May 19 09:32:55 2018
@@ -28,7 +28,10 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
+#if 0
 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
+#endif
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.2 2018/05/19 09:32:55 jdolecek Exp $");
 
 #include 
 #include 
@@ -39,56 +42,27 @@ __FBSDID("$FreeBSD: head/sys/dev/ena/ena
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 
-#include 
-#include 
+#include 
 
-#include "ena.h"
-#include "ena_sysctl.h"
+#include 
 
 /*
  *  Function prototypes
  */
-static int	ena_probe(device_t);
+static int	ena_probe(device_t, cfdata_t, void *);
 static void	ena_intr_msix_mgmnt(void *);
 static int	ena_allocate_pci_resources(struct ena_adapter*);
 static void	ena_free_pci_resources(struct ena_adapter *);
-static int	ena_change_mtu(if_t, int);
-static inline void ena_alloc_counters(counter_u64_t *, int);
-static inline void ena_free_counters(counter_u64_t *, int);
-static inline void ena_reset_counters(counter_u64_t *, int);
+static int	ena_change_mtu(struct ifnet *, int);
+static inline void ena_alloc_counters(struct evcnt *, int);
+static inline void ena_free_counters(struct evcnt *, int);
+static inline void ena_reset_counters(struct evcnt *, int);
 static void	ena_init_io_rings_common(struct ena_adapter *,
 struct ena_ring *, uint16_t);
 static void	ena_init_io_rings(struct ena_adapter *);
@@ -146,13 +120,15 @@ static int	ena_rss_configure(struct ena_
 static int	ena_up_complete(struct ena_adapter *);
 static int	ena_up(struct ena_adapter *);
 static void	ena_down(struct ena_adapter *);
-static uint64_t	ena_get_counter(if_t, ift_counter);
-static int	ena_media_change(if_t);
-static void	ena_media_status(if_t, struct ifmediareq *);
+#if 0
+static uint64_t	ena_get_counter(struct ifnet *, ift_counter);
+#endif
+static int	ena_media_change(struct ifnet *);
+static void	ena_media_status(struct ifnet *, struct ifmediareq *);
 static void	ena_init(void *);
-static int	ena_ioctl(if_t, u_long, caddr_t);
+static int	ena_ioctl(struct ifnet *, u_long, void *);
 static int	ena_get_dev_offloads(struct ena_com_dev_get_features_ctx *);
-static void	ena_update_host_info(struct ena_admin_host_info *, if_t);
+static void	ena_update_host_info(struct ena_admin_host_info *, struct ifnet *);
 static void	ena_update_hwassist(struct ena_adapter *);
 static int	ena_setup_ifnet(device_t, struct ena_adapter *,
 struct ena_com_dev_get_features_ctx *);
@@ -161,9 +137,9 @@ static int	ena_check_and_collapse_mbuf(s
 struct mbuf **mbuf);
 static int	ena_xmit_mbuf(struct ena_ring *, struct mbuf **);
 static void	ena_start_xmit(struct ena_ring *);
-static int	ena_mq_start(if_t, struct mbuf *);
+static int	ena_mq_start(struct ifnet *, struct mbuf *);
 static void	ena_deferred_mq_start(void *, int);
-static void	ena_qflush(if_t);
+static void	ena_qflush(struct ifnet *);
 static int	ena_calc_io_queue_num(struct ena_adapter *,
 struct ena_com_dev_get_features_ctx *);
 static int	ena_calc_queue_size(struct ena_adapter *, uint16_t *,
@@ -171,7 +147,7 @@ static int	ena_calc_queue_size(struct en
 static int	ena_rss_init_default(struct ena_adapter *);
 static void	ena_rss_init_default_deferred(void *);
 static void	ena_config_host_info(struct ena_com_dev *);
-static int	ena_attach(device_t);
+static int	ena_attach(device_t parent, device_t self, void *aux);
 static int	ena_detach(device_t);
 static int	ena_device_init(struct ena_adapter *, device_t,
 struct ena_com_dev_get_features_ctx *, int *);
@@ -182,25 +158,32 @@ static void	unimplemented_aenq_handler(v
 struct ena_admin_aenq_entry *);
 static void	ena_timer_service(void *);
 
-static char ena_version[] = DEVICE_NAME DRV_MODULE_NAME " v" 

CVS commit: src/sys/dev/pci/ixgbe

2018-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 18 10:09:02 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
 Revert new watchdog timer commits. The new watchdog timer made stability
worse than before. It seems unknown problems exists.

http://mail-index.netbsd.org/source-changes/2018/05/08/msg095020.html
http://mail-index.netbsd.org/source-changes/2018/05/16/msg095240.html


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.44 src/sys/dev/pci/ixgbe/ix_txrx.c:1.45
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.44	Wed May 16 08:08:24 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri May 18 10:09:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.44 2018/05/16 08:08:24 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.45 2018/05/18 10:09:02 msaitoh Exp $ */
 
 /**
 
@@ -130,10 +130,9 @@ static void	ixgbe_setup_hw_rsc(struct rx
 int
 ixgbe_legacy_start_locked(struct ifnet *ifp, struct tx_ring *txr)
 {
+	int rc;
 	struct mbuf*m_head;
 	struct adapter *adapter = txr->adapter;
-	int enqueued = 0;
-	int rc;
 
 	IXGBE_TX_LOCK_ASSERT(txr);
 
@@ -159,7 +158,6 @@ ixgbe_legacy_start_locked(struct ifnet *
 		if ((rc = ixgbe_xmit(txr, m_head)) == EAGAIN) {
 			break;
 		}
-		enqueued++;
 		IFQ_DEQUEUE(>if_snd, m_head);
 		if (rc != 0) {
 			m_freem(m_head);
@@ -170,11 +168,6 @@ ixgbe_legacy_start_locked(struct ifnet *
 		bpf_mtap(ifp, m_head);
 	}
 
-	if (enqueued) {
-		txr->lastsent = time_uptime;
-		txr->sending = true;
-	}
-
 	return IXGBE_SUCCESS;
 } /* ixgbe_legacy_start_locked */
 
@@ -323,11 +316,6 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 			break;
 	}
 
-	if (enqueued) {
-		txr->lastsent = time_uptime;
-		txr->sending = true;
-	}
-
 	if (txr->tx_avail < IXGBE_TX_CLEANUP_THRESHOLD(txr->adapter))
 		ixgbe_txeof(txr);
 
@@ -552,6 +540,10 @@ retry:
 	if (m_head->m_flags & M_MCAST)
 		ifp->if_omcasts++;
 
+	/* Mark queue as having work */
+	if (txr->busy == 0)
+		txr->busy = 1;
+
 	return (0);
 } /* ixgbe_xmit */
 
@@ -677,7 +669,6 @@ ixgbe_setup_transmit_ring(struct tx_ring
 	/* Free any existing tx buffers. */
 	txbuf = txr->tx_buffers;
 	for (int i = 0; i < txr->num_desc; i++, txbuf++) {
-		txr->sending = false;
 		if (txbuf->m_head != NULL) {
 			bus_dmamap_sync(txr->txtag->dt_dmat, txbuf->map,
 			0, txbuf->m_head->m_pkthdr.len,
@@ -1138,7 +1129,7 @@ ixgbe_txeof(struct tx_ring *txr)
 #endif /* DEV_NETMAP */
 
 	if (txr->tx_avail == txr->num_desc) {
-		txr->sending = false;
+		txr->busy = 0;
 		return false;
 	}
 
@@ -1220,8 +1211,25 @@ ixgbe_txeof(struct tx_ring *txr)
 	work += txr->num_desc;
 	txr->next_to_clean = work;
 
+	/*
+	 * Queue Hang detection, we know there's
+	 * work outstanding or the first return
+	 * would have been taken, so increment busy
+	 * if nothing managed to get cleaned, then
+	 * in local_timer it will be checked and
+	 * marked as HUNG if it exceeds a MAX attempt.
+	 */
+	if ((processed == 0) && (txr->busy != IXGBE_QUEUE_HUNG))
+		++txr->busy;
+	/*
+	 * If anything gets cleaned we reset state to 1,
+	 * note this will turn off HUNG if its set.
+	 */
+	if (processed)
+		txr->busy = 1;
+
 	if (txr->tx_avail == txr->num_desc)
-		txr->sending = false;
+		txr->busy = 0;
 
 	return ((limit > 0) ? false : true);
 } /* ixgbe_txeof */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.152 src/sys/dev/pci/ixgbe/ixgbe.c:1.153
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.152	Tue May 15 09:30:56 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri May 18 10:09:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.152 2018/05/15 09:30:56 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.153 2018/05/18 10:09:02 msaitoh Exp $ */
 
 /**
 
@@ -184,8 +184,6 @@ static void	ixgbe_free_pciintr_resources
 static void	ixgbe_free_pci_resources(struct adapter *);
 static void	ixgbe_local_timer(void *);
 static void	ixgbe_local_timer1(void *);
-static void	ixgbe_watchdog(struct ifnet *);
-static bool	ixgbe_watchdog_txq(struct ifnet *, struct tx_ring *, bool *);
 static int	ixgbe_setup_interface(device_t, struct adapter *);
 static void	ixgbe_config_gpie(struct adapter *);
 static void	ixgbe_config_dmac(struct adapter *);
@@ -4293,8 +4291,11 @@ static void
 ixgbe_local_timer1(void *arg)
 {
 	struct adapter	*adapter = arg;
+	device_t	dev = adapter->dev;
 	struct ix_queue *que = adapter->queues;
+	u64		queues = 0;
 	u64		v0, v1, v2, v3, v4, v5, v6, v7;
+	int		hung = 0;
 	int		i;
 
 	

CVS commit: src/sys/dev/pci/ixgbe

2018-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 18 10:09:02 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
 Revert new watchdog timer commits. The new watchdog timer made stability
worse than before. It seems unknown problems exists.

http://mail-index.netbsd.org/source-changes/2018/05/08/msg095020.html
http://mail-index.netbsd.org/source-changes/2018/05/16/msg095240.html


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-16 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 16 19:02:00 UTC 2018

Modified Files:
src/sys/dev/pci: pci_map.c

Log Message:
Enable the appropriate memory or I/O space decode in the PCI
Command/Status Register upon mapping a BAR.

This should fix PR #53286.  It's also possible there are other similar
PRs that might be fixed by this.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/pci_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pci_map.c
diff -u src/sys/dev/pci/pci_map.c:1.33 src/sys/dev/pci/pci_map.c:1.34
--- src/sys/dev/pci/pci_map.c:1.33	Fri Mar 17 11:21:45 2017
+++ src/sys/dev/pci/pci_map.c	Wed May 16 19:02:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_map.c,v 1.33 2017/03/17 11:21:45 msaitoh Exp $	*/
+/*	$NetBSD: pci_map.c,v 1.34 2018/05/16 19:02:00 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.33 2017/03/17 11:21:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.34 2018/05/16 19:02:00 jakllsch Exp $");
 
 #include 
 #include 
@@ -287,11 +287,17 @@ pci_mapreg_submap(const struct pci_attac
 	bus_space_handle_t handle;
 	bus_addr_t base;
 	bus_size_t realmaxsize;
-	int flags;
+	pcireg_t csr;
+	int flags, s;
 
 	if (PCI_MAPREG_TYPE(type) == PCI_MAPREG_TYPE_IO) {
 		if ((pa->pa_flags & PCI_FLAGS_IO_OKAY) == 0)
 			return 1;
+		s = splhigh();
+		csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+		csr |= PCI_COMMAND_IO_ENABLE;
+		pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, csr);
+		splx(s);
 		if (pci_io_find(pa->pa_pc, pa->pa_tag, reg, type, ,
 		, ))
 			return 1;
@@ -299,6 +305,11 @@ pci_mapreg_submap(const struct pci_attac
 	} else {
 		if ((pa->pa_flags & PCI_FLAGS_MEM_OKAY) == 0)
 			return 1;
+		s = splhigh();
+		csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+		csr |= PCI_COMMAND_MEM_ENABLE;
+		pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, csr);
+		splx(s);
 		if (pci_mem_find(pa->pa_pc, pa->pa_tag, reg, type, ,
 		, ))
 			return 1;
@@ -307,7 +318,6 @@ pci_mapreg_submap(const struct pci_attac
 
 	if (reg == PCI_MAPREG_ROM) {
 		pcireg_t 	mask;
-		int		s;
 		/* we have to enable the ROM address decoder... */
 		s = splhigh();
 		mask = pci_conf_read(pa->pa_pc, pa->pa_tag, reg);



CVS commit: src/sys/dev/pci

2018-05-16 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 16 19:02:00 UTC 2018

Modified Files:
src/sys/dev/pci: pci_map.c

Log Message:
Enable the appropriate memory or I/O space decode in the PCI
Command/Status Register upon mapping a BAR.

This should fix PR #53286.  It's also possible there are other similar
PRs that might be fixed by this.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/pci_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 16 08:08:24 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Whitespace fix. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/ixgbe/ix_txrx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 16 08:08:24 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Whitespace fix. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/ixgbe/ix_txrx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.43 src/sys/dev/pci/ixgbe/ix_txrx.c:1.44
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.43	Wed May 16 07:51:17 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed May 16 08:08:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.43 2018/05/16 07:51:17 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.44 2018/05/16 08:08:24 msaitoh Exp $ */
 
 /**
 
@@ -169,6 +169,7 @@ ixgbe_legacy_start_locked(struct ifnet *
 		/* Send a copy of the frame to the BPF listener */
 		bpf_mtap(ifp, m_head);
 	}
+
 	if (enqueued) {
 		txr->lastsent = time_uptime;
 		txr->sending = true;
@@ -253,6 +254,8 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 		IXGBE_TX_UNLOCK(txr);
 	} else {
 		if (adapter->txrx_use_workqueue) {
+			u_int *enqueued;
+
 			/*
 			 * This function itself is not called in interrupt
 			 * context, however it can be called in fast softint
@@ -261,11 +264,12 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 			 * enqueuing when the machine uses both spontaneous
 			 * packets and forwarding packets.
 			 */
-			u_int *enqueued = percpu_getref(adapter->txr_wq_enqueued);
+			enqueued = percpu_getref(adapter->txr_wq_enqueued);
 			if (*enqueued == 0) {
 *enqueued = 1;
 percpu_putref(adapter->txr_wq_enqueued);
-workqueue_enqueue(adapter->txr_wq, >wq_cookie, curcpu());
+workqueue_enqueue(adapter->txr_wq,
+>wq_cookie, curcpu());
 			} else
 percpu_putref(adapter->txr_wq_enqueued);
 		} else
@@ -1960,46 +1964,46 @@ ixgbe_rxeof(struct ix_queue *que)
 			if (adapter->num_queues > 1) {
 sendmp->m_pkthdr.flowid =
 le32toh(cur->wb.lower.hi_dword.rss);
-switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) {	 
-case IXGBE_RXDADV_RSSTYPE_IPV4:
+switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) {
+case IXGBE_RXDADV_RSSTYPE_IPV4:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_IPV4);
 	break;
-case IXGBE_RXDADV_RSSTYPE_IPV4_TCP:
+case IXGBE_RXDADV_RSSTYPE_IPV4_TCP:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_TCP_IPV4);
 	break;
-case IXGBE_RXDADV_RSSTYPE_IPV6:
+case IXGBE_RXDADV_RSSTYPE_IPV6:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_IPV6);
 	break;
-case IXGBE_RXDADV_RSSTYPE_IPV6_TCP:
+case IXGBE_RXDADV_RSSTYPE_IPV6_TCP:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_TCP_IPV6);
 	break;
-case IXGBE_RXDADV_RSSTYPE_IPV6_EX:
+case IXGBE_RXDADV_RSSTYPE_IPV6_EX:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_IPV6_EX);
 	break;
-case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
+case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_TCP_IPV6_EX);
 	break;
 #if __FreeBSD_version > 110
-case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
+case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_UDP_IPV4);
 	break;
-case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
+case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_UDP_IPV6);
 	break;
-case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
+case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_RSS_UDP_IPV6_EX);
 	break;
 #endif
-default:
+default:
 	M_HASHTYPE_SET(sendmp,
 	M_HASHTYPE_OPAQUE_HASH);
 }
@@ -2124,7 +2128,8 @@ ixgbe_dma_malloc(struct adapter *adapter
 			   >dma_tag);
 	if (r != 0) {
 		aprint_error_dev(dev,
-		"%s: ixgbe_dma_tag_create failed; error %d\n", __func__, r);
+		"%s: ixgbe_dma_tag_create failed; error %d\n", __func__,
+		r);
 		goto fail_0;
 	}
 



CVS commit: src/sys/dev/pci/ixgbe

2018-05-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 16 07:51:17 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Fix a problem that the watchdog timer sometimes mistakenly fires. Restore
TX sending check in the end of ixgbe_txeof which was wrongly removed in
ix_txrx.c rev. 1.42.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ix_txrx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 16 07:51:17 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Fix a problem that the watchdog timer sometimes mistakenly fires. Restore
TX sending check in the end of ixgbe_txeof which was wrongly removed in
ix_txrx.c rev. 1.42.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ix_txrx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.42 src/sys/dev/pci/ixgbe/ix_txrx.c:1.43
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.42	Tue May  8 09:45:54 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed May 16 07:51:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.42 2018/05/08 09:45:54 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.43 2018/05/16 07:51:17 msaitoh Exp $ */
 
 /**
 
@@ -1216,6 +1216,9 @@ ixgbe_txeof(struct tx_ring *txr)
 	work += txr->num_desc;
 	txr->next_to_clean = work;
 
+	if (txr->tx_avail == txr->num_desc)
+		txr->sending = false;
+
 	return ((limit > 0) ? false : true);
 } /* ixgbe_txeof */
 



CVS commit: src/sys/dev/pci/ixgbe

2018-05-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 15 09:30:56 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
 The TQSMR register is not for receiving but for transmitting, so move the
initialization from ixgbe_initialize_receive_units() to
ixgbe_initialize_transmit_units(). No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/pci/ixgbe/ixgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.151 src/sys/dev/pci/ixgbe/ixgbe.c:1.152
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.151	Thu May 10 03:15:28 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue May 15 09:30:56 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.151 2018/05/10 03:15:28 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.152 2018/05/15 09:30:56 msaitoh Exp $ */
 
 /**
 
@@ -583,7 +583,7 @@ ixgbe_initialize_receive_units(struct ad
 
 	for (i = 0; i < adapter->num_queues; i++, rxr++) {
 		u64 rdba = rxr->rxdma.dma_paddr;
-		u32 tqsmreg, reg;
+		u32 reg;
 		int regnum = i / 4;	/* 1 register per 4 queues */
 		int regshift = i % 4;	/* 4 bits per 1 queue */
 		j = rxr->me;
@@ -609,20 +609,6 @@ ixgbe_initialize_receive_units(struct ad
 		IXGBE_WRITE_REG(hw, IXGBE_RQSMR(regnum), reg);
 
 		/*
-		 * Set RQSMR (Receive Queue Statistic Mapping) register.
-		 * Register location for queue 0...7 are different between
-		 * 82598 and newer.
-		 */
-		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
-			tqsmreg = IXGBE_TQSMR(regnum);
-		else
-			tqsmreg = IXGBE_TQSM(regnum);
-		reg = IXGBE_READ_REG(hw, tqsmreg);
-		reg &= ~(0x00ff << (regshift * 8));
-		reg |= i << (regshift * 8);
-		IXGBE_WRITE_REG(hw, tqsmreg, reg);
-
-		/*
 		 * Set DROP_EN iff we have no flow control and >1 queue.
 		 * Note that srrctl was cleared shortly before during reset,
 		 * so we do not need to clear the bit, but do it just in case
@@ -687,6 +673,9 @@ ixgbe_initialize_transmit_units(struct a
 	for (i = 0; i < adapter->num_queues; i++, txr++) {
 		u64 tdba = txr->txdma.dma_paddr;
 		u32 txctrl = 0;
+		u32 tqsmreg, reg;
+		int regnum = i / 4;	/* 1 register per 4 queues */
+		int regshift = i % 4;	/* 4 bits per 1 queue */
 		int j = txr->me;
 
 		IXGBE_WRITE_REG(hw, IXGBE_TDBAL(j),
@@ -695,6 +684,19 @@ ixgbe_initialize_transmit_units(struct a
 		IXGBE_WRITE_REG(hw, IXGBE_TDLEN(j),
 		adapter->num_tx_desc * sizeof(union ixgbe_adv_tx_desc));
 
+		/*
+		 * Set TQSMR (Transmit Queue Statistic Mapping) register.
+		 * Register location is different between 82598 and others.
+		 */
+		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
+			tqsmreg = IXGBE_TQSMR(regnum);
+		else
+			tqsmreg = IXGBE_TQSM(regnum);
+		reg = IXGBE_READ_REG(hw, tqsmreg);
+		reg &= ~(0x00ff << (regshift * 8));
+		reg |= i << (regshift * 8);
+		IXGBE_WRITE_REG(hw, tqsmreg, reg);
+
 		/* Setup the HW Tx Head and Tail descriptor pointers */
 		IXGBE_WRITE_REG(hw, IXGBE_TDH(j), 0);
 		IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0);



CVS commit: src/sys/dev/pci/ixgbe

2018-05-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 15 09:30:56 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
 The TQSMR register is not for receiving but for transmitting, so move the
initialization from ixgbe_initialize_receive_units() to
ixgbe_initialize_transmit_units(). No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/pci/ixgbe/ixgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 14 09:21:36 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Fix panic or hangup when "sysctl -w hw.ixgN.debug=1".

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.96 src/sys/dev/pci/ixgbe/ixv.c:1.97
--- src/sys/dev/pci/ixgbe/ixv.c:1.96	Tue May  8 09:45:54 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Mon May 14 09:21:36 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.96 2018/05/08 09:45:54 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.97 2018/05/14 09:21:36 msaitoh Exp $*/
 
 /**
 
@@ -2639,21 +2639,18 @@ ixv_print_debug_info(struct adapter *ada
 static int
 ixv_sysctl_debug(SYSCTLFN_ARGS)
 {
-	struct sysctlnode node;
-	struct adapter *adapter;
+	struct sysctlnode node = *rnode;
+	struct adapter *adapter = (struct adapter *)node.sysctl_data;
 	interror, result;
 
-	node = *rnode;
 	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 
 	if (error || newp == NULL)
 		return error;
 
-	if (result == 1) {
-		adapter = (struct adapter *)node.sysctl_data;
+	if (result == 1)
 		ixv_print_debug_info(adapter);
-	}
 
 	return 0;
 } /* ixv_sysctl_debug */



CVS commit: src/sys/dev/pci/ixgbe

2018-05-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 14 09:21:36 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Fix panic or hangup when "sysctl -w hw.ixgN.debug=1".

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri May 11 07:42:22 UTC 2018

Modified Files:
src/sys/dev/pci: files.pci
Added Files:
src/sys/dev/pci: if_bwfm_pci.c if_bwfm_pci.h

Log Message:
add bwfm pci support, from openbsd

Tested on BCM43602.


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/sys/dev/pci/files.pci
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/if_bwfm_pci.c \
src/sys/dev/pci/if_bwfm_pci.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.394 src/sys/dev/pci/files.pci:1.395
--- src/sys/dev/pci/files.pci:1.394	Thu Mar  1 04:29:37 2018
+++ src/sys/dev/pci/files.pci	Fri May 11 07:42:22 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.394 2018/03/01 04:29:37 pgoyette Exp $
+#	$NetBSD: files.pci,v 1.395 2018/05/11 07:42:22 maya Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -1073,6 +1073,10 @@ include "dev/pci/n8/files.n8"
 attach	bwi at pci with bwi_pci
 file	dev/pci/if_bwi_pci.c		bwi_pci
 
+# Broadcom FullMAC USB wireless adapter
+attach	bwfm at pci with bwfm_pci: firmload
+file	dev/pci/if_bwfm_pci.c		bwfm_pci
+
 # Marvell Serial-ATA Host Controller
 attach	mvsata at pci with mvsata_pci
 file	dev/pci/mvsata_pci.c		mvsata_pci

Added files:

Index: src/sys/dev/pci/if_bwfm_pci.c
diff -u /dev/null src/sys/dev/pci/if_bwfm_pci.c:1.1
--- /dev/null	Fri May 11 07:42:22 2018
+++ src/sys/dev/pci/if_bwfm_pci.c	Fri May 11 07:42:22 2018
@@ -0,0 +1,2062 @@
+/*	$NetBSD: if_bwfm_pci.c,v 1.1 2018/05/11 07:42:22 maya Exp $	*/
+/*	$OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $	*/
+/*
+ * Copyright (c) 2010-2016 Broadcom Corporation
+ * Copyright (c) 2017 Patrick Wildt 
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define BWFM_DMA_D2H_SCRATCH_BUF_LEN		8
+#define BWFM_DMA_D2H_RINGUPD_BUF_LEN		1024
+#define BWFM_DMA_H2D_IOCTL_BUF_LEN		ETHER_MAX_LEN
+
+#define BWFM_NUM_TX_MSGRINGS			2
+#define BWFM_NUM_RX_MSGRINGS			3
+
+#define BWFM_NUM_TX_PKTIDS			2048
+#define BWFM_NUM_RX_PKTIDS			1024
+
+#define BWFM_NUM_TX_DESCS			1
+#define BWFM_NUM_RX_DESCS			1
+
+#ifdef BWFM_DEBUG
+#define DPRINTF(x)	do { if (bwfm_debug > 0) printf x; } while (0)
+#define DPRINTFN(n, x)	do { if (bwfm_debug >= (n)) printf x; } while (0)
+static int bwfm_debug = 2;
+#else
+#define DPRINTF(x)	do { ; } while (0)
+#define DPRINTFN(n, x)	do { ; } while (0)
+#endif
+
+#define DEVNAME(sc)	device_xname((sc)->sc_sc.sc_dev)
+#define letoh16		htole16
+#define letoh32		htole32
+#define nitems(x)	__arraycount(x)
+
+enum ring_status {
+	RING_CLOSED,
+	RING_CLOSING,
+	RING_OPEN,
+	RING_OPENING,
+};
+
+struct bwfm_pci_msgring {
+	uint32_t		 w_idx_addr;
+	uint32_t		 r_idx_addr;
+	uint32_t		 w_ptr;
+	uint32_t		 r_ptr;
+	int			 nitem;
+	int			 itemsz;
+	enum ring_status	 status;
+	struct bwfm_pci_dmamem	*ring;
+	struct mbuf		*m;
+
+	int			 fifo;
+	uint8_t			 mac[ETHER_ADDR_LEN];
+};
+
+struct bwfm_pci_buf {
+	bus_dmamap_t	 bb_map;
+	struct mbuf	*bb_m;
+};
+
+struct bwfm_pci_pkts {
+	struct bwfm_pci_buf	*pkts;
+	uint32_t		 npkt;
+	int			 last;
+};
+
+struct if_rxring {
+	u_int	rxr_total;
+	u_int	rxr_inuse;
+};
+
+struct bwfm_cmd_flowring_create {
+	struct work		 wq_cookie;
+	struct bwfm_pci_softc	*sc;
+	struct mbuf		*m;
+	int			 flowid;
+	int			 prio;
+};
+
+struct bwfm_pci_softc {
+	struct bwfm_softc	 sc_sc;
+	pci_chipset_tag_t	 sc_pc;
+	pcitag_t		 sc_tag;
+	pcireg_t		 sc_id;
+	void			*sc_ih;
+	pci_intr_handle_t	*sc_pihp;
+
+	bus_space_tag_t		 sc_reg_iot;
+	bus_space_handle_t	 sc_reg_ioh;
+	bus_size_t		 sc_reg_ios;
+
+	bus_space_tag_t		 sc_tcm_iot;
+	bus_space_handle_t	 sc_tcm_ioh;
+	bus_size_t		 sc_tcm_ios;
+
+	bus_dma_tag_t		 sc_dmat;
+
+	uint32_t		 sc_shared_address;
+	uint32_t		 sc_shared_flags;
+	uint8_t			 sc_shared_version;
+
+	uint8_t			 sc_dma_idx_sz;
+	struct 

CVS commit: src/sys/dev/pci

2018-05-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri May 11 07:42:22 UTC 2018

Modified Files:
src/sys/dev/pci: files.pci
Added Files:
src/sys/dev/pci: if_bwfm_pci.c if_bwfm_pci.h

Log Message:
add bwfm pci support, from openbsd

Tested on BCM43602.


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/sys/dev/pci/files.pci
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/if_bwfm_pci.c \
src/sys/dev/pci/if_bwfm_pci.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 10 03:43:42 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
 KNF. No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.578 -r1.579 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.578 src/sys/dev/pci/if_wm.c:1.579
--- src/sys/dev/pci/if_wm.c:1.578	Tue May  8 11:36:39 2018
+++ src/sys/dev/pci/if_wm.c	Thu May 10 03:43:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.578 2018/05/08 11:36:39 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.579 2018/05/10 03:43:42 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.578 2018/05/08 11:36:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.579 2018/05/10 03:43:42 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -301,14 +301,14 @@ struct wm_softc;
 	struct evcnt qname##_ev_##evname;
 
 #define WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, evtype)	\
-	do{\
+	do {\
 		snprintf((q)->qname##_##evname##_evcnt_name,		\
 		sizeof((q)->qname##_##evname##_evcnt_name),		\
 		"%s%02d%s", #qname, (qnum), #evname);		\
 		evcnt_attach_dynamic(&(q)->qname##_ev_##evname,		\
 		(evtype), NULL, (xname),\
 		(q)->qname##_##evname##_evcnt_name);		\
-	}while(0)
+	} while (0)
 
 #define WM_Q_MISC_EVCNT_ATTACH(qname, evname, q, qnum, xname)		\
 	WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, EVCNT_TYPE_MISC)
@@ -2203,7 +2203,7 @@ alloc_retry:
 		/* SPI */
 		sc->sc_flags |= WM_F_EEPROM_SPI;
 		wm_nvm_set_addrbits_size_eecd(sc);
-		if((sc->sc_type == WM_T_80003)
+		if ((sc->sc_type == WM_T_80003)
 		|| (sc->sc_nvm_wordsize < (1 << 15))) {
 			sc->nvm.read = wm_nvm_read_eerd;
 			/* Don't use WM_F_LOCK_EECD because we use EERD */
@@ -4905,7 +4905,7 @@ wm_init_rss(struct wm_softc *sc)
 		int qid, reta_ent;
 
 		qid  = i % sc->sc_nqueues;
-		switch(sc->sc_type) {
+		switch (sc->sc_type) {
 		case WM_T_82574:
 			reta_ent = __SHIFTIN(qid,
 			RETA_ENT_QINDEX_MASK_82574);
@@ -4964,7 +4964,7 @@ wm_adjust_qnum(struct wm_softc *sc, int 
 		return;
 	}
 
-	switch(sc->sc_type) {
+	switch (sc->sc_type) {
 	case WM_T_82572:
 		hw_ntxqueues = 2;
 		hw_nrxqueues = 2;
@@ -5237,7 +5237,7 @@ wm_unset_stopping_flags(struct wm_softc 
 	/*
 	 * must unset stopping flags in ascending order.
 	 */
-	for(i = 0; i < sc->sc_nqueues; i++) {
+	for (i = 0; i < sc->sc_nqueues; i++) {
 		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
 		struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;
 
@@ -5265,7 +5265,7 @@ wm_set_stopping_flags(struct wm_softc *s
 	/*
 	 * must set stopping flags in ascending order.
 	 */
-	for(i = 0; i < sc->sc_nqueues; i++) {
+	for (i = 0; i < sc->sc_nqueues; i++) {
 		struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;
 		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
 
@@ -9148,7 +9148,7 @@ wm_linkintr_msix(void *arg)
 	if (sc->sc_core_stopping)
 		goto out;
 
-	if((reg & ICR_LSC) != 0) {
+	if ((reg & ICR_LSC) != 0) {
 		WM_EVCNT_INCR(>sc_ev_linkintr);
 		wm_linkintr(sc, ICR_LSC);
 	}
@@ -11630,10 +11630,10 @@ wm_sfp_get_media_type(struct wm_softc *s
 
 	if ((val & (SFF_SFP_ETH_FLAGS_1000SX | SFF_SFP_ETH_FLAGS_1000LX)) != 0)
 		mediatype = WM_MEDIATYPE_SERDES;
-	else if ((val & SFF_SFP_ETH_FLAGS_1000T) != 0){
+	else if ((val & SFF_SFP_ETH_FLAGS_1000T) != 0) {
 		sc->sc_flags |= WM_F_SGMII;
 		mediatype = WM_MEDIATYPE_COPPER;
-	} else if ((val & SFF_SFP_ETH_FLAGS_100FX) != 0){
+	} else if ((val & SFF_SFP_ETH_FLAGS_100FX) != 0) {
 		sc->sc_flags |= WM_F_SGMII;
 		mediatype = WM_MEDIATYPE_SERDES;
 	}



CVS commit: src/sys/dev/pci

2018-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 10 03:43:42 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
 KNF. No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.578 -r1.579 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 10 03:41:00 UTC 2018

Modified Files:
src/sys/dev/pci: ehci_pci.c uhci_pci.c

Log Message:
 KNF. No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/ehci_pci.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/uhci_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 10 03:41:00 UTC 2018

Modified Files:
src/sys/dev/pci: ehci_pci.c uhci_pci.c

Log Message:
 KNF. No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/ehci_pci.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/uhci_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.66 src/sys/dev/pci/ehci_pci.c:1.67
--- src/sys/dev/pci/ehci_pci.c:1.66	Mon Apr  9 16:21:10 2018
+++ src/sys/dev/pci/ehci_pci.c	Thu May 10 03:41:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.66 2018/04/09 16:21:10 jakllsch Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.67 2018/05/10 03:41:00 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.66 2018/04/09 16:21:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.67 2018/05/10 03:41:00 msaitoh Exp $");
 
 #include 
 #include 
@@ -191,7 +191,7 @@ ehci_pci_attach(device_t parent, device_
 	}
 	aprint_normal_dev(self, "interrupting at %s\n", intrstr);
 
-	switch(pci_conf_read(pc, tag, PCI_USBREV) & PCI_USBREV_MASK) {
+	switch (pci_conf_read(pc, tag, PCI_USBREV) & PCI_USBREV_MASK) {
 	case PCI_USBREV_PRE_1_0:
 	case PCI_USBREV_1_0:
 	case PCI_USBREV_1_1:

Index: src/sys/dev/pci/uhci_pci.c
diff -u src/sys/dev/pci/uhci_pci.c:1.62 src/sys/dev/pci/uhci_pci.c:1.63
--- src/sys/dev/pci/uhci_pci.c:1.62	Mon Apr  9 16:21:10 2018
+++ src/sys/dev/pci/uhci_pci.c	Thu May 10 03:41:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci_pci.c,v 1.62 2018/04/09 16:21:10 jakllsch Exp $	*/
+/*	$NetBSD: uhci_pci.c,v 1.63 2018/05/10 03:41:00 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.62 2018/04/09 16:21:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.63 2018/05/10 03:41:00 msaitoh Exp $");
 
 #include "ehci.h"
 
@@ -154,7 +154,7 @@ uhci_pci_attach(device_t parent, device_
 	bus_space_read_2(sc->sc.iot, sc->sc.ioh, UHCI_STS));
 	splx(s);
 
-	switch(pci_conf_read(pc, tag, PCI_USBREV) & PCI_USBREV_MASK) {
+	switch (pci_conf_read(pc, tag, PCI_USBREV) & PCI_USBREV_MASK) {
 	case PCI_USBREV_PRE_1_0:
 		sc->sc.sc_bus.ub_revision = USBREV_PRE_1_0;
 		break;



CVS commit: src/sys/dev/pci/ixgbe

2018-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 10 03:15:28 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
Count some register correctly:
- QPRDC register is only for 82599 and newer.
- Count IXGBE_QPRDC, PX{ON,OFF}{T,R}XC[NT].


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/pci/ixgbe/ixgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.150 src/sys/dev/pci/ixgbe/ixgbe.c:1.151
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.150	Tue May  8 09:45:54 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu May 10 03:15:28 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.150 2018/05/08 09:45:54 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.151 2018/05/10 03:15:28 msaitoh Exp $ */
 
 /**
 
@@ -1558,16 +1558,24 @@ ixgbe_update_stats_counters(struct adapt
 	if (hw->mac.type == ixgbe_mac_X550)
 		stats->mbsdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MBSDC);
 
+	/* 16 registers */
 	for (int i = 0; i < __arraycount(stats->qprc); i++) {
 		int j = i % adapter->num_queues;
+
 		stats->qprc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPRC(i));
 		stats->qptc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPTC(i));
-		stats->qprdc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
+		if (hw->mac.type >= ixgbe_mac_82599EB) {
+			stats->qprdc[j].ev_count
+			+= IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
+		}
 	}
+
+	/* 8 registers */
 	for (int i = 0; i < __arraycount(stats->mpc); i++) {
 		uint32_t mp;
 		int j = i % adapter->num_queues;
 
+		/* MPC */
 		mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
 		/* global total per queue */
 		stats->mpc[j].ev_count += mp;
@@ -1577,7 +1585,24 @@ ixgbe_update_stats_counters(struct adapt
 		if (hw->mac.type == ixgbe_mac_82598EB)
 			stats->rnbc[j].ev_count
 			+= IXGBE_READ_REG(hw, IXGBE_RNBC(i));
-		
+
+		stats->pxontxc[j].ev_count
+		+= IXGBE_READ_REG(hw, IXGBE_PXONTXC(i));
+		stats->pxofftxc[j].ev_count
+		+= IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i));
+		if (hw->mac.type >= ixgbe_mac_82599EB) {
+			stats->pxonrxc[j].ev_count
+			+= IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i));
+			stats->pxoffrxc[j].ev_count
+			+= IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(i));
+			stats->pxon2offc[j].ev_count
+			+= IXGBE_READ_REG(hw, IXGBE_PXON2OFFCNT(i));
+		} else {
+			stats->pxonrxc[j].ev_count
+			+= IXGBE_READ_REG(hw, IXGBE_PXONRXC(i));
+			stats->pxoffrxc[j].ev_count
+			+= IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i));
+		}
 	}
 	stats->mpctotal.ev_count += total_missed_rx;
 
@@ -1828,8 +1853,10 @@ ixgbe_add_hw_stats(struct adapter *adapt
 			evcnt_attach_dynamic(>pxoffrxc[i],
 			EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
 			"pxoffrxc");
-			evcnt_attach_dynamic(>pxon2offc[i],
-			EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
+			if (hw->mac.type >= ixgbe_mac_82599EB)
+evcnt_attach_dynamic(>pxon2offc[i],
+EVCNT_TYPE_MISC, NULL,
+adapter->queues[i].evnamebuf,
 			"pxon2offc");
 		}
 		if (i < __arraycount(stats->qprc)) {
@@ -1845,9 +1872,10 @@ ixgbe_add_hw_stats(struct adapter *adapt
 			evcnt_attach_dynamic(>qbtc[i],
 			EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
 			"qbtc");
-			evcnt_attach_dynamic(>qprdc[i],
-			EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
-			"qprdc");
+			if (hw->mac.type >= ixgbe_mac_82599EB)
+evcnt_attach_dynamic(>qprdc[i],
+EVCNT_TYPE_MISC, NULL,
+adapter->queues[i].evnamebuf, "qprdc");
 		}
 
 		evcnt_attach_dynamic(>rx_packets, EVCNT_TYPE_MISC,
@@ -2036,14 +2064,16 @@ ixgbe_clear_evcnt(struct adapter *adapte
 			stats->pxonrxc[i].ev_count = 0;
 			stats->pxofftxc[i].ev_count = 0;
 			stats->pxoffrxc[i].ev_count = 0;
-			stats->pxon2offc[i].ev_count = 0;
+			if (hw->mac.type >= ixgbe_mac_82599EB)
+stats->pxon2offc[i].ev_count = 0;
 		}
 		if (i < __arraycount(stats->qprc)) {
 			stats->qprc[i].ev_count = 0;
 			stats->qptc[i].ev_count = 0;
 			stats->qbrc[i].ev_count = 0;
 			stats->qbtc[i].ev_count = 0;
-			stats->qprdc[i].ev_count = 0;
+			if (hw->mac.type >= ixgbe_mac_82599EB)
+stats->qprdc[i].ev_count = 0;
 		}
 
 		rxr->rx_packets.ev_count = 0;
@@ -3474,14 +3504,16 @@ ixgbe_detach(device_t dev, int flags)
 			evcnt_detach(>pxonrxc[i]);
 			evcnt_detach(>pxofftxc[i]);
 			evcnt_detach(>pxoffrxc[i]);
-			evcnt_detach(>pxon2offc[i]);
+			if (hw->mac.type >= ixgbe_mac_82599EB)
+evcnt_detach(>pxon2offc[i]);
 		}
 		if (i < __arraycount(stats->qprc)) {
 			evcnt_detach(>qprc[i]);
 			evcnt_detach(>qptc[i]);
 			evcnt_detach(>qbrc[i]);
 			evcnt_detach(>qbtc[i]);
-			evcnt_detach(>qprdc[i]);
+			if (hw->mac.type >= ixgbe_mac_82599EB)
+evcnt_detach(>qprdc[i]);
 		}
 
 		evcnt_detach(>rx_packets);



CVS commit: src/sys/dev/pci/ixgbe

2018-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 10 03:15:28 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
Count some register correctly:
- QPRDC register is only for 82599 and newer.
- Count IXGBE_QPRDC, PX{ON,OFF}{T,R}XC[NT].


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/pci/ixgbe/ixgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May  9 03:50:51 UTC 2018

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
 Fix typo. s/TPL/TLP/


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/pci/pcireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May  9 03:50:51 UTC 2018

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
 Fix typo. s/TPL/TLP/


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/pci/pcireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.200 src/sys/dev/pci/pci_subr.c:1.201
--- src/sys/dev/pci/pci_subr.c:1.200	Thu Feb  1 09:09:14 2018
+++ src/sys/dev/pci/pci_subr.c	Wed May  9 03:50:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.200 2018/02/01 09:09:14 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.201 2018/05/09 03:50:51 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.200 2018/02/01 09:09:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.201 2018/05/09 03:50:51 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3846,7 +3846,7 @@ pci_conf_print_dpc_cap(const pcireg_t *r
 	extcapoff + PCI_DPC_RPPIO_HLOG);
 	printf("RP PIO ImpSpec Log Register: start from 0x%03x\n",
 	extcapoff + PCI_DPC_RPPIO_IMPSLOG);
-	printf("RP PIO TPL Prefix Log Register: start from 0x%03x\n",
+	printf("RP PIO TLP Prefix Log Register: start from 0x%03x\n",
 	extcapoff + PCI_DPC_RPPIO_TLPPLOG);
 }
 

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.137 src/sys/dev/pci/pcireg.h:1.138
--- src/sys/dev/pci/pcireg.h:1.137	Thu Feb  1 09:09:14 2018
+++ src/sys/dev/pci/pcireg.h	Wed May  9 03:50:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.137 2018/02/01 09:09:14 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.138 2018/05/09 03:50:51 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -2029,7 +2029,7 @@ struct pci_rom {
   /* Same */
 #define	PCI_DPC_RPPIO_HLOG 0x20	/* RP PIO Header Log Register */
 #define	PCI_DPC_RPPIO_IMPSLOG 0x30 /* RP PIO ImpSpec Log Register */
-#define	PCI_DPC_RPPIO_TLPPLOG 0x34 /* RP PIO TPL Prefix Log Register */
+#define	PCI_DPC_RPPIO_TLPPLOG 0x34 /* RP PIO TLP Prefix Log Register */
 
 /*
  * Extended capability ID: 0x001e



CVS commit: src/sys/dev/pci

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 11:36:40 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
 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.


To generate a diff of this commit:
cvs rdiff -u -r1.577 -r1.578 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.577 src/sys/dev/pci/if_wm.c:1.578
--- src/sys/dev/pci/if_wm.c:1.577	Tue May  8 07:59:56 2018
+++ src/sys/dev/pci/if_wm.c	Tue May  8 11:36:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.577 2018/05/08 07:59:56 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.578 2018/05/08 11:36:39 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.577 2018/05/08 07:59:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.578 2018/05/08 11:36:39 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6703,6 +6703,7 @@ wm_init_tx_queue(struct wm_softc *sc, st
 	wm_init_tx_regs(sc, wmq, txq);
 	wm_init_tx_buffer(sc, txq);
 
+	txq->txq_flags = 0; /* Clear WM_TXQ_NO_SPACE */
 	txq->txq_sending = false;
 }
 



CVS commit: src/sys/dev/pci

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 11:36:40 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
 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.


To generate a diff of this commit:
cvs rdiff -u -r1.577 -r1.578 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 09:45:54 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
- Fix broken watchdog timer. This change detects TX device timeout correctly.
  NOTE: It's supporsed not to be called {ixgbe,ixv}_rearm_queues() in the
  timer. Those are not required if any chip have no bug. In reality,
  ixgbe_rearm_queues() is required on 82599 and newer chip AND other than
  queue 0 to prevent device timeout. When it occured, packet was sent but the
  descriptor's DD bit wasn't set even though IXGBE_TXD_CMD_EOP and
  IXGBE_TXD_CMD_RS were set. After forcing interrupt by writing EICS register
  in ixgbe_rearm_queues(), DD is set. Why? Is this an undocumented errata? It
  might be possible not call rearm_queues on 82598 or queue 0, we call in any
  cases in case the problem occurs. On ixv(4), I have not seen this problem yet
  (though I tested only on X550_X(Xeon D 12xx)'s virtual function), but we
  do rearm in case TX device timeout happen.
- ixv(4): Call callout_stop() earlier in ixv_stop() like ixgbe_stop().
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.41 src/sys/dev/pci/ixgbe/ix_txrx.c:1.42
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.41	Wed Apr 25 08:46:19 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue May  8 09:45:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.41 2018/04/25 08:46:19 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.42 2018/05/08 09:45:54 msaitoh Exp $ */
 
 /**
 
@@ -130,9 +130,10 @@ static void	ixgbe_setup_hw_rsc(struct rx
 int
 ixgbe_legacy_start_locked(struct ifnet *ifp, struct tx_ring *txr)
 {
-	int rc;
 	struct mbuf*m_head;
 	struct adapter *adapter = txr->adapter;
+	int enqueued = 0;
+	int rc;
 
 	IXGBE_TX_LOCK_ASSERT(txr);
 
@@ -158,6 +159,7 @@ ixgbe_legacy_start_locked(struct ifnet *
 		if ((rc = ixgbe_xmit(txr, m_head)) == EAGAIN) {
 			break;
 		}
+		enqueued++;
 		IFQ_DEQUEUE(>if_snd, m_head);
 		if (rc != 0) {
 			m_freem(m_head);
@@ -167,6 +169,10 @@ ixgbe_legacy_start_locked(struct ifnet *
 		/* Send a copy of the frame to the BPF listener */
 		bpf_mtap(ifp, m_head);
 	}
+	if (enqueued) {
+		txr->lastsent = time_uptime;
+		txr->sending = true;
+	}
 
 	return IXGBE_SUCCESS;
 } /* ixgbe_legacy_start_locked */
@@ -313,6 +319,11 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 			break;
 	}
 
+	if (enqueued) {
+		txr->lastsent = time_uptime;
+		txr->sending = true;
+	}
+
 	if (txr->tx_avail < IXGBE_TX_CLEANUP_THRESHOLD(txr->adapter))
 		ixgbe_txeof(txr);
 
@@ -537,10 +548,6 @@ retry:
 	if (m_head->m_flags & M_MCAST)
 		ifp->if_omcasts++;
 
-	/* Mark queue as having work */
-	if (txr->busy == 0)
-		txr->busy = 1;
-
 	return (0);
 } /* ixgbe_xmit */
 
@@ -666,6 +673,7 @@ ixgbe_setup_transmit_ring(struct tx_ring
 	/* Free any existing tx buffers. */
 	txbuf = txr->tx_buffers;
 	for (int i = 0; i < txr->num_desc; i++, txbuf++) {
+		txr->sending = false;
 		if (txbuf->m_head != NULL) {
 			bus_dmamap_sync(txr->txtag->dt_dmat, txbuf->map,
 			0, txbuf->m_head->m_pkthdr.len,
@@ -1126,7 +1134,7 @@ ixgbe_txeof(struct tx_ring *txr)
 #endif /* DEV_NETMAP */
 
 	if (txr->tx_avail == txr->num_desc) {
-		txr->busy = 0;
+		txr->sending = false;
 		return false;
 	}
 
@@ -1208,26 +1216,6 @@ ixgbe_txeof(struct tx_ring *txr)
 	work += txr->num_desc;
 	txr->next_to_clean = work;
 
-	/*
-	 * Queue Hang detection, we know there's
-	 * work outstanding or the first return
-	 * would have been taken, so increment busy
-	 * if nothing managed to get cleaned, then
-	 * in local_timer it will be checked and
-	 * marked as HUNG if it exceeds a MAX attempt.
-	 */
-	if ((processed == 0) && (txr->busy != IXGBE_QUEUE_HUNG))
-		++txr->busy;
-	/*
-	 * If anything gets cleaned we reset state to 1,
-	 * note this will turn off HUNG if its set.
-	 */
-	if (processed)
-		txr->busy = 1;
-
-	if (txr->tx_avail == txr->num_desc)
-		txr->busy = 0;
-
 	return ((limit > 0) ? false : true);
 } /* ixgbe_txeof */
 

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.149 src/sys/dev/pci/ixgbe/ixgbe.c:1.150
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.149	Thu Apr 19 07:40:12 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue May  8 09:45:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.149 2018/04/19 07:40:12 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.150 2018/05/08 09:45:54 msaitoh Exp $ */
 
 /**
 
@@ -184,6 +184,8 @@ static void	

CVS commit: src/sys/dev/pci/ixgbe

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 09:45:54 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
- Fix broken watchdog timer. This change detects TX device timeout correctly.
  NOTE: It's supporsed not to be called {ixgbe,ixv}_rearm_queues() in the
  timer. Those are not required if any chip have no bug. In reality,
  ixgbe_rearm_queues() is required on 82599 and newer chip AND other than
  queue 0 to prevent device timeout. When it occured, packet was sent but the
  descriptor's DD bit wasn't set even though IXGBE_TXD_CMD_EOP and
  IXGBE_TXD_CMD_RS were set. After forcing interrupt by writing EICS register
  in ixgbe_rearm_queues(), DD is set. Why? Is this an undocumented errata? It
  might be possible not call rearm_queues on 82598 or queue 0, we call in any
  cases in case the problem occurs. On ixv(4), I have not seen this problem yet
  (though I tested only on X550_X(Xeon D 12xx)'s virtual function), but we
  do rearm in case TX device timeout happen.
- ixv(4): Call callout_stop() earlier in ixv_stop() like ixgbe_stop().
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 07:59:56 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.576 -r1.577 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.576 src/sys/dev/pci/if_wm.c:1.577
--- src/sys/dev/pci/if_wm.c:1.576	Mon Apr 23 01:35:25 2018
+++ src/sys/dev/pci/if_wm.c	Tue May  8 07:59:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.576 2018/04/23 01:35:25 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.577 2018/05/08 07:59:56 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.576 2018/04/23 01:35:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.577 2018/05/08 07:59:56 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6508,8 +6508,8 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 		WM_Q_INTR_EVCNT_ATTACH(rxq, rxintr, rxq, i, xname);
 		WM_Q_INTR_EVCNT_ATTACH(rxq, rxdefer, rxq, i, xname);
 
-		WM_Q_INTR_EVCNT_ATTACH(rxq, rxipsum, rxq, i, xname);
-		WM_Q_INTR_EVCNT_ATTACH(rxq, rxtusum, rxq, i, xname);
+		WM_Q_MISC_EVCNT_ATTACH(rxq, rxipsum, rxq, i, xname);
+		WM_Q_MISC_EVCNT_ATTACH(rxq, rxtusum, rxq, i, xname);
 #endif /* WM_EVENT_COUNTERS */
 
 		rx_done++;



CVS commit: src/sys/dev/pci

2018-05-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 07:59:56 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.576 -r1.577 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 04:11:10 UTC 2018

Modified Files:
src/sys/dev/pci: if_bnx.c if_bnxvar.h

Log Message:
- Fix a bug that bnx(4) panics on shutdown. Stop callout before restroy.
  Reported by Andreas Gustafsson in PR#53265.
- Make sure not to re-arm the callout when we are about to detach. Same as
  if_bge.c rev. 1.292.
- Use pci_intr_establish_xname().


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/if_bnxvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.63 src/sys/dev/pci/if_bnx.c:1.64
--- src/sys/dev/pci/if_bnx.c:1.63	Thu Feb  8 09:05:19 2018
+++ src/sys/dev/pci/if_bnx.c	Tue May  8 04:11:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.63 2018/02/08 09:05:19 dholland Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.64 2018/05/08 04:11:09 msaitoh Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.63 2018/02/08 09:05:19 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.64 2018/05/08 04:11:09 msaitoh Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -792,7 +792,8 @@ bnx_attach(device_t parent, device_t sel
 	IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
 
 	/* Hookup IRQ last. */
-	sc->bnx_intrhand = pci_intr_establish(pc, ih, IPL_NET, bnx_intr, sc);
+	sc->bnx_intrhand = pci_intr_establish_xname(pc, ih, IPL_NET, bnx_intr,
+	sc, device_xname(self));
 	if (sc->bnx_intrhand == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
@@ -890,17 +891,7 @@ bnx_detach(device_t dev, int flags)
 
 	/* Stop and reset the controller. */
 	s = splnet();
-	if (ifp->if_flags & IFF_RUNNING)
-		bnx_stop(ifp, 1);
-	else {
-		/* Disable the transmit/receive blocks. */
-		REG_WR(sc, BNX_MISC_ENABLE_CLR_BITS, 0x5ff);
-		REG_RD(sc, BNX_MISC_ENABLE_CLR_BITS);
-		DELAY(20);
-		bnx_disable_intr(sc);
-		bnx_reset(sc, BNX_DRV_MSG_CODE_RESET);
-	}
-
+	bnx_stop(ifp, 1);
 	splx(s);
 
 	pmf_device_deregister(dev);
@@ -3371,10 +3362,11 @@ bnx_stop(struct ifnet *ifp, int disable)
 
 	DBPRINT(sc, BNX_VERBOSE_RESET, "Entering %s()\n", __func__);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
-		return;
-
-	callout_stop(>bnx_timeout);
+	if (disable) {
+		sc->bnx_detaching = 1;
+		callout_halt(>bnx_timeout, NULL);
+	} else
+		callout_stop(>bnx_timeout);
 
 	mii_down(>bnx_mii);
 
@@ -5694,9 +5686,6 @@ bnx_tick(void *xsc)
 	/* Update the statistics from the hardware statistics block. */
 	bnx_stats_update(sc);
 
-	/* Schedule the next tick. */
-	callout_reset(>bnx_timeout, hz, bnx_tick, sc);
-
 	mii = >bnx_mii;
 	mii_tick(mii);
 
@@ -5707,6 +5696,11 @@ bnx_tick(void *xsc)
 	bnx_get_buf(sc, , _prod, _bseq);
 	sc->rx_prod = prod;
 	sc->rx_prod_bseq = prod_bseq;
+
+	/* Schedule the next tick. */
+	if (!sc->bnx_detaching)
+		callout_reset(>bnx_timeout, hz, bnx_tick, sc);
+
 	splx(s);
 	return;
 }

Index: src/sys/dev/pci/if_bnxvar.h
diff -u src/sys/dev/pci/if_bnxvar.h:1.6 src/sys/dev/pci/if_bnxvar.h:1.7
--- src/sys/dev/pci/if_bnxvar.h:1.6	Tue Jul  1 17:11:35 2014
+++ src/sys/dev/pci/if_bnxvar.h	Tue May  8 04:11:09 2018
@@ -210,6 +210,7 @@ struct bnx_softc
 	uint32_t		tx_prod_bseq;	/* Counts the bytes used.  */
 
 	struct callout		bnx_timeout;
+	int			bnx_detaching;
 
 	/* Frame size and mbuf allocation size for RX frames. */
 	uint32_t		max_frame_size;



CVS commit: src/sys/dev/pci

2018-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May  8 04:11:10 UTC 2018

Modified Files:
src/sys/dev/pci: if_bnx.c if_bnxvar.h

Log Message:
- Fix a bug that bnx(4) panics on shutdown. Stop callout before restroy.
  Reported by Andreas Gustafsson in PR#53265.
- Make sure not to re-arm the callout when we are about to detach. Same as
  if_bge.c rev. 1.292.
- Use pci_intr_establish_xname().


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/if_bnxvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/dev/pci/ixgbe

2018-05-07 Thread Masanobu SAITOH

On 2018/05/07 16:56, Masanobu SAITOH wrote:

Hi.

On 2018/05/03 17:38, Frank Kardel wrote:

Hi,

I am now seeing that packet reception stops. tcpdump will only show outgoing 
packets and no incoming packets.

ifconfig ixgX down
ifconfig ixgX up

gets things going again.

Code from 2018-02-24 was fine and I think even code shortly before this commit 
was fine, but there was the mbuf used-after-free issue that hit me pretty hard. 
So the system wasn't running for too long anyway.

Does that ring a bell ?

Frank


  IMHO, this change doesn't cause such type of problem...

  Could you show me the following information?

  0) dmesg

 This is required to know which chip is used and what type of
 interrupt is used and configured (INTX, MSI or MSI-X).

  1) ifconfig -v ixg0

 It's required to know offload status, the MTU size and some
 error count.

  2) sysctl hw.ixg0 (or sysctl hw |grep ixg (for all ixg(4)s))

 This output has some information of TX/RX ring.

  3) vmstat -e[v]

     Only for ixg(4):
     vmstat -e[v] |grep ixg

 ixg(4) has a lot of counters. I added error counters at
 all of error paths. (If you found a error path which has
 no counter, it's my fault.)

     Only to check checksum counters:

     options INET_CSUM_COUNTERS (for ip_input())
     options TCP_CSUM_COUNTERS  (for tcp_input())
     options UDP_CSUM_COUNTERS  (for udp_input())
     options WM_EVENT_COUNTERS  (only for wm(4))
     options BGE_EVENT_COUNTERS (only for bge(4))
     (No special options for ixg(4) because those counters are enabled by 
default)

     vmstat -e[v] |grep csum

  4) If you use a virtual interface like vlan(4) or age(4). Please


s/age/agr/



     show the configuration.



5) Whether you use options NET_MPSAFE or not.


Thanks.



  Regards.


On 04/25/18 10:46, SAITOH Masanobu wrote:

Module Name:    src
Committed By:    msaitoh
Date:    Wed Apr 25 08:46:19 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h ixgbe_netbsd.c ixgbe_netbsd.h
    ixgbe_osdep.h

Log Message:
  Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

  One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

  Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

  I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_osdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.







--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: src/sys/dev/pci/ixgbe

2018-05-07 Thread Masanobu SAITOH

Hi.

On 2018/05/03 17:38, Frank Kardel wrote:

Hi,

I am now seeing that packet reception stops. tcpdump will only show outgoing 
packets and no incoming packets.

ifconfig ixgX down
ifconfig ixgX up

gets things going again.

Code from 2018-02-24 was fine and I think even code shortly before this commit 
was fine, but there was the mbuf used-after-free issue that hit me pretty hard. 
So the system wasn't running for too long anyway.

Does that ring a bell ?

Frank


 IMHO, this change doesn't cause such type of problem...

 Could you show me the following information?

 0) dmesg

This is required to know which chip is used and what type of
interrupt is used and configured (INTX, MSI or MSI-X).

 1) ifconfig -v ixg0

It's required to know offload status, the MTU size and some
error count.

 2) sysctl hw.ixg0 (or sysctl hw |grep ixg (for all ixg(4)s))

This output has some information of TX/RX ring.

 3) vmstat -e[v]

Only for ixg(4):
vmstat -e[v] |grep ixg

ixg(4) has a lot of counters. I added error counters at
all of error paths. (If you found a error path which has
no counter, it's my fault.)

Only to check checksum counters:

options INET_CSUM_COUNTERS (for ip_input())
options TCP_CSUM_COUNTERS  (for tcp_input())
options UDP_CSUM_COUNTERS  (for udp_input())
options WM_EVENT_COUNTERS  (only for wm(4))
options BGE_EVENT_COUNTERS (only for bge(4))
(No special options for ixg(4) because those counters are enabled by 
default)

vmstat -e[v] |grep csum

 4) If you use a virtual interface like vlan(4) or age(4). Please
show the configuration.


 Regards.


On 04/25/18 10:46, SAITOH Masanobu wrote:

Module Name:    src
Committed By:    msaitoh
Date:    Wed Apr 25 08:46:19 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h ixgbe_netbsd.c ixgbe_netbsd.h
    ixgbe_osdep.h

Log Message:
  Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

  One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

  Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

  I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_osdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: src/sys/dev/pci/ixgbe

2018-05-03 Thread Frank Kardel

Hi,

I am now seeing that packet reception stops. tcpdump will only show 
outgoing packets and no incoming packets.


ifconfig ixgX down
ifconfig ixgX up

gets things going again.

Code from 2018-02-24 was fine and I think even code shortly before this 
commit was fine, but there was the mbuf used-after-free issue that hit 
me pretty hard. So the system wasn't running for too long anyway.


Does that ring a bell ?

Frank

On 04/25/18 10:46, SAITOH Masanobu wrote:

Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 25 08:46:19 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h ixgbe_netbsd.c ixgbe_netbsd.h
ixgbe_osdep.h

Log Message:
  Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

  One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

  Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

  I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_osdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/dev/pci/ixgbe

2018-05-03 Thread Frank Kardel

Hi,

I am now seeing that packet reception stops. tcpdump will only show 
outgoing packets and no incoming packets.


ifconfig ixgX down
ifconfig ixgX up

gets things going again.

Code from 2018-02-24 was fine and I think even code shortly before this 
commit was fine, but there was the mbuf used-after-free issue that hit 
me pretty hard. So the system wasn't running for too long anyway.


Does that ring a bell ?

Frank

On 04/25/18 10:46, SAITOH Masanobu wrote:

Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 25 08:46:19 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h ixgbe_netbsd.c ixgbe_netbsd.h
ixgbe_osdep.h

Log Message:
  Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

  One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

  Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

  I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_osdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-02 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu May  3 04:22:18 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1323 -r1.1324 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1322 -r1.1323 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-05-02 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu May  3 04:21:10 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add some broadcom 802.11ac wifi devices


To generate a diff of this commit:
cvs rdiff -u -r1.1332 -r1.1333 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1332 src/sys/dev/pci/pcidevs:1.1333
--- src/sys/dev/pci/pcidevs:1.1332	Sat Apr 28 05:11:49 2018
+++ src/sys/dev/pci/pcidevs	Thu May  3 04:21:10 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1332 2018/04/28 05:11:49 mlelstv Exp $
+$NetBSD: pcidevs,v 1.1333 2018/05/03 04:21:10 maya Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1889,6 +1889,8 @@ product BROADCOM BCM43224	0x4353	BCM4322
 product BROADCOM BCM43225	0x4357	BCM43225 2.4GHz 802.11
 product BROADCOM BCM43227	0x4358	BCM43227 2.4GHz 802.11
 product BROADCOM BCM43228	0x4359	BCM43228 Dualband 802.11
+product BROADCOM BCM4350	0x43a3	BCM4350 802.11ac Wireless Network Adapter
+product BROADCOM BCM43602	0x43ba	BCM43602 802.11ac Wireless LAN SoC
 product BROADCOM BCM4401	0x4401	BCM4401 10/100 Ethernet
 product BROADCOM BCM4401_B0	0x4401	BCM4401-B0 10/100 Ethernet
 product BROADCOM BCM4727	0x4727	BCM4727 802.11b/g/n



CVS commit: src/sys/dev/pci

2018-05-02 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu May  3 04:21:10 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add some broadcom 802.11ac wifi devices


To generate a diff of this commit:
cvs rdiff -u -r1.1332 -r1.1333 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr 28 05:12:55 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1322 -r1.1323 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1321 -r1.1322 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr 28 05:11:49 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Symbios/LSI RAID and SAS controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.1331 -r1.1332 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr 28 05:11:49 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Symbios/LSI RAID and SAS controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.1331 -r1.1332 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1331 src/sys/dev/pci/pcidevs:1.1332
--- src/sys/dev/pci/pcidevs:1.1331	Tue Apr 24 18:08:56 2018
+++ src/sys/dev/pci/pcidevs	Sat Apr 28 05:11:49 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1331 2018/04/24 18:08:56 maya Exp $
+$NetBSD: pcidevs,v 1.1332 2018/04/28 05:11:49 mlelstv Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5659,6 +5659,12 @@ product SYMBIOS 875			0x000f	53c875/876
 product SYMBIOS 1510			0x0010	53c1510
 product SYMBIOS 895A			0x0012	53c895A
 product SYMBIOS 875A			0x0013	53c875A
+product SYMBIOS MEGARAID_3516		0x0014	MegaRAID SAS3516
+product SYMBIOS MEGARAID_3416		0x0015	MegaRAID SAS3416
+product SYMBIOS MEGARAID_3508		0x0016	MegaRAID SAS3508
+product SYMBIOS MEGARAID_3408		0x0017	MegaRAID SAS3408
+product SYMBIOS MEGARAID_3504		0x001b	MegaRAID SAS3504
+product SYMBIOS MEGARAID_3404		0x001c	MegaRAID SAS3404
 product SYMBIOS 1010			0x0020	53c1010
 product SYMBIOS 1010_2			0x0021	53c1010 (66MHz)
 product SYMBIOS 1030			0x0030	53c1020/53c1030
@@ -5701,6 +5707,28 @@ product SYMBIOS SAS2208_6		0x0085	SAS220
 product SYMBIOS SAS2308_1		0x0086	SAS2308
 product SYMBIOS SAS2308_2		0x0087	SAS2308
 product SYMBIOS 875J			0x008f	53c875J
+product SYMBIOS SAS3108_1		0x0090	SAS3108
+product SYMBIOS SAS3108_2		0x0091	SAS3108
+product SYMBIOS SAS3108_3		0x0094	SAS3108
+product SYMBIOS SAS3108_4		0x0095	SAS3108
+product SYMBIOS SAS3004			0x0096	SAS3004
+product SYMBIOS SAS3008			0x0097	SAS3008
+product	SYMBIOS	SAS3516			0x00ab	SAS3516
+product	SYMBIOS	SAS3416			0x00ac	SAS3416
+product	SYMBIOS	SAS3508			0x00ae	SAS3508
+product	SYMBIOS	SAS3408			0x00af	SAS3408
+product	SYMBIOS	SAS3504			0x00be	SAS3504
+product	SYMBIOS	SAS3404			0x00bf	SAS3404
+product	SYMBIOS	SAS3324_1		0x00c0	SAS3324
+product	SYMBIOS	SAS3324_2		0x00c1	SAS3324
+product	SYMBIOS	SAS3324_3		0x00c2	SAS3324
+product	SYMBIOS	SAS3324_4		0x00c3	SAS3324
+product	SYMBIOS	SAS3324_5		0x00c4	SAS3324
+product	SYMBIOS	SAS3324_6		0x00c5	SAS3324
+product	SYMBIOS	SAS3324_7		0x00c6	SAS3324
+product	SYMBIOS	SAS3324_8		0x00c7	SAS3324
+product	SYMBIOS	SAS3324_9		0x00c8	SAS3324
+product	SYMBIOS	SAS3324_10		0x00c9	SAS3324
 product SYMBIOS MEGARAID_320X		0x0407	LSI Megaraid SCSI 320-X
 product SYMBIOS MEGARAID_320E		0x0408	LSI Megaraid SCSI 320-E
 product SYMBIOS MEGARAID_300X		0x0409	LSI Megaraid SATA (300-6X/300-8X) 



CVS commit: src/sys/dev/pci/ixgbe

2018-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 25 08:46:19 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h ixgbe_netbsd.c ixgbe_netbsd.h
ixgbe_osdep.h

Log Message:
 Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

 One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

 Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

 I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_osdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.40 src/sys/dev/pci/ixgbe/ix_txrx.c:1.41
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.40	Tue Apr 17 08:38:05 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Apr 25 08:46:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.40 2018/04/17 08:38:05 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.41 2018/04/25 08:46:19 msaitoh Exp $ */
 
 /**
 
@@ -1607,7 +1607,7 @@ ixgbe_setup_receive_structures(struct ad
 	 * or size of jumbo mbufs may have changed.
 	 * Assume all of rxr->ptag are the same.
 	 */
-	ixgbe_jcl_reinit(>jcl_head, rxr->ptag->dt_dmat,
+	ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat,
 	(2 * adapter->num_rx_desc) * adapter->num_queues,
 	adapter->rx_mbuf_sz);
 

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.45 src/sys/dev/pci/ixgbe/ixgbe.h:1.46
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.45	Thu Apr 19 21:50:09 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Wed Apr 25 08:46:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.45 2018/04/19 21:50:09 christos Exp $ */
+/* $NetBSD: ixgbe.h,v 1.46 2018/04/25 08:46:19 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -751,6 +751,9 @@ bool ixgbe_rxeof(struct ix_queue *);
 
 const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
 
+/* For NetBSD */
+void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, int, size_t);
+
 #include "ixgbe_bypass.h"
 #include "ixgbe_fdir.h"
 #include "ixgbe_rss.h"

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.7
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6	Thu Jun  1 02:45:11 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c	Wed Apr 25 08:46:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.6 2017/06/01 02:45:11 chs Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.7 2018/04/25 08:46:19 msaitoh Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,7 +40,7 @@
 #include 
 #include 
 
-#include "ixgbe_netbsd.h"
+#include "ixgbe.h"
 
 void
 ixgbe_dma_tag_destroy(ixgbe_dma_tag_t *dt)
@@ -162,11 +162,12 @@ post_zalloc_err:
 }
 
 void
-ixgbe_jcl_reinit(ixgbe_extmem_head_t *eh, bus_dma_tag_t dmat, int nbuf,
+ixgbe_jcl_reinit(struct adapter *adapter, bus_dma_tag_t dmat, int nbuf,
 size_t size)
 {
-	int i;
+	ixgbe_extmem_head_t *eh = >jcl_head;
 	ixgbe_extmem_t *em;
+	int i;
 
 	if (!eh->eh_initialized) {
 		TAILQ_INIT(>eh_freelist);
@@ -174,6 +175,18 @@ ixgbe_jcl_reinit(ixgbe_extmem_head_t *eh
 		eh->eh_initialized = true;
 	}
 
+	/*
+	 *  Check previous parameters. If it's not required to reinit, just
+	 * return.
+	 *
+	 *  Note that the num_rx_desc is currently fixed value. It's never
+	 * changed after device is attached.
+	 */
+	if ((adapter->osdep.last_rx_mbuf_sz == adapter->rx_mbuf_sz)
+	&& (adapter->osdep.last_num_rx_desc == adapter->num_rx_desc))
+		return;
+
+	/* Free all dmamem */
 	while ((em = ixgbe_getext(eh, 0)) != NULL) {
 		KASSERT(em->em_vaddr != NULL);
 		bus_dmamem_unmap(dmat, em->em_vaddr, em->em_size);
@@ -190,6 +203,10 @@ ixgbe_jcl_reinit(ixgbe_extmem_head_t *eh
 		}
 		ixgbe_putext(em);
 	}
+
+	/* Keep 

CVS commit: src/sys/dev/pci/ixgbe

2018-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 25 08:46:19 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h ixgbe_netbsd.c ixgbe_netbsd.h
ixgbe_osdep.h

Log Message:
 Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

 One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

 Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

 I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_osdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 24 18:10:33 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1321 -r1.1322 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1320 -r1.1321 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1321 src/sys/dev/pci/pcidevs.h:1.1322
--- src/sys/dev/pci/pcidevs.h:1.1321	Tue Apr 17 08:47:43 2018
+++ src/sys/dev/pci/pcidevs.h	Tue Apr 24 18:10:32 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1321 2018/04/17 08:47:43 nonaka Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1322 2018/04/24 18:10:32 maya Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1330 2018/04/17 08:47:19 nonaka Exp
+ *	NetBSD: pcidevs,v 1.1331 2018/04/24 18:08:56 maya Exp
  */
 
 /*
@@ -6515,6 +6515,7 @@
 #define	PCI_PRODUCT_REALTEK_RTS5227	0x5227		/* RTS5227 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTS5229	0x5229		/* RTS5229 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTS5249	0x5249		/* RTS5249 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTS525A	0x525A		/* RTS525A PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8402	0x5286		/* RTL8402 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8411B	0x5287		/* RTL8411B PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8411	0x5289		/* RTL8411 PCI-E Card Reader */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1320 src/sys/dev/pci/pcidevs_data.h:1.1321
--- src/sys/dev/pci/pcidevs_data.h:1.1320	Tue Apr 17 08:47:43 2018
+++ src/sys/dev/pci/pcidevs_data.h	Tue Apr 24 18:10:32 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1320 2018/04/17 08:47:43 nonaka Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1321 2018/04/24 18:10:32 maya Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1330 2018/04/17 08:47:19 nonaka Exp
+ *	NetBSD: pcidevs,v 1.1331 2018/04/24 18:08:56 maya Exp
  */
 
 /*
@@ -11404,436 +11404,438 @@ static const uint16_t pci_products[] = {
 	29702, 16780, 11239, 15387, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS5249, 
 	29710, 16780, 11239, 15387, 0,
-	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8402, 
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS525A, 
 	29718, 16780, 11239, 15387, 0,
-	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411B, 
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8402, 
 	29726, 16780, 11239, 15387, 0,
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411B, 
+	29734, 16780, 11239, 15387, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411, 
-	29735, 16780, 11239, 15387, 0,
+	29743, 16780, 11239, 15387, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029, 
-	29743, 5603, 0,
+	29751, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139D, 
-	29748, 5705, 5603, 0,
+	29756, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8100, 
-	29754, 5705, 5603, 0,
+	29762, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129, 
-	29759, 5705, 5603, 0,
+	29767, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
-	29764, 5705, 5603, 0,
+	29772, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8138, 
-	29782, 5705, 5603, 0,
+	29790, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139, 
 	7475, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC, 
-	29787, 5618, 5603, 0,
+	29795, 5618, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8168, 
-	29801, 5618, 5603, 0,
+	29809, 5618, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169, 
-	29811, 5618, 5603, 0,
+	29819, 5618, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188CE, 
-	29821, 4759, 4534, 29831, 16780, 17315, 0,
+	29829, 4759, 4534, 29839, 16780, 17315, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192CE, 
-	29839, 4759, 4534, 29831, 16780, 17315, 0,
+	29847, 4759, 4534, 29839, 16780, 17315, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188EE, 
-	29849, 4759, 4534, 29831, 16780, 17315, 0,
+	29857, 4759, 4534, 29839, 16780, 17315, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180, 
-	29859, 7562, 0,
+	29867, 7562, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185, 
-	29864, 29869, 0,
+	29872, 29877, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_PPB, 
-	29881, 8258, 0,
+	29889, 8258, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_QXL, 
-	29886, 234, 0,
+	29894, 234, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7780, 
-	29890, 615, 6341, 0,
+	29898, 615, 6341, 0,
 

CVS commit: src/sys/dev/pci

2018-04-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 24 18:10:33 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1321 -r1.1322 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1320 -r1.1321 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 24 18:08:56 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add realtek RT525A PCI-E card reader

found in my Dell XPS 15 9550.


To generate a diff of this commit:
cvs rdiff -u -r1.1330 -r1.1331 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1330 src/sys/dev/pci/pcidevs:1.1331
--- src/sys/dev/pci/pcidevs:1.1330	Tue Apr 17 08:47:19 2018
+++ src/sys/dev/pci/pcidevs	Tue Apr 24 18:08:56 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1330 2018/04/17 08:47:19 nonaka Exp $
+$NetBSD: pcidevs,v 1.1331 2018/04/24 18:08:56 maya Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6508,6 +6508,7 @@ product REALTEK RTS5209		0x5209	RTS5209 
 product REALTEK RTS5227		0x5227	RTS5227 PCI-E Card Reader
 product REALTEK RTS5229		0x5229	RTS5229 PCI-E Card Reader
 product REALTEK RTS5249		0x5249	RTS5249 PCI-E Card Reader
+product REALTEK RTS525A		0x525A	RTS525A PCI-E Card Reader
 product REALTEK RTL8402		0x5286	RTL8402 PCI-E Card Reader
 product REALTEK RTL8411B	0x5287	RTL8411B PCI-E Card Reader
 product REALTEK RTL8411		0x5289	RTL8411 PCI-E Card Reader



CVS commit: src/sys/dev/pci

2018-04-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 24 18:08:56 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add realtek RT525A PCI-E card reader

found in my Dell XPS 15 9550.


To generate a diff of this commit:
cvs rdiff -u -r1.1330 -r1.1331 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 23 01:35:25 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- Backout if_wm.c rev.1.574 and print "device timeout (lost interrupt)"
 when all descriptors in a queue are free. When all descripters 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.


To generate a diff of this commit:
cvs rdiff -u -r1.575 -r1.576 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.575 src/sys/dev/pci/if_wm.c:1.576
--- src/sys/dev/pci/if_wm.c:1.575	Mon Apr 23 01:29:23 2018
+++ src/sys/dev/pci/if_wm.c	Mon Apr 23 01:35:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.575 2018/04/23 01:29:23 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.576 2018/04/23 01:35:25 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.575 2018/04/23 01:29:23 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.576 2018/04/23 01:35:25 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -370,7 +370,7 @@ struct wm_txqueue {
 
 	bool txq_stopping;
 
-	bool txq_watchdog;
+	bool txq_sending;
 	time_t txq_lastsent;
 
 	uint32_t txq_packets;		/* for AIM */
@@ -3010,7 +3010,7 @@ wm_watchdog_txq(struct ifnet *ifp, struc
 {
 
 	mutex_enter(txq->txq_lock);
-	if (txq->txq_watchdog &&
+	if (txq->txq_sending &&
 	time_uptime - txq->txq_lastsent > wm_watchdog_timeout) {
 		wm_watchdog_txq_locked(ifp, txq, hang);
 	}
@@ -3032,14 +3032,17 @@ wm_watchdog_txq_locked(struct ifnet *ifp
 	 */
 	wm_txeof(txq, UINT_MAX);
 
-	if (txq->txq_free != WM_NTXDESC(txq)) {
+	if (txq->txq_sending)
+		*hang |= __BIT(wmq->wmq_id);
+
+	if (txq->txq_free == WM_NTXDESC(txq)) {
+		log(LOG_ERR, "%s: device timeout (lost interrupt)\n",
+		device_xname(sc->sc_dev));
+	} else {
 #ifdef WM_DEBUG
 		int i, j;
 		struct wm_txsoft *txs;
 #endif
-		if (txq->txq_watchdog)
-			*hang |= __BIT(wmq->wmq_id);
-
 		log(LOG_ERR,
 		"%s: device timeout (txfree %d txsfree %d txnext %d)\n",
 		device_xname(sc->sc_dev), txq->txq_free, txq->txq_sfree,
@@ -6011,7 +6014,7 @@ wm_stop_locked(struct ifnet *ifp, int di
 		struct wm_queue *wmq = >sc_queue[qidx];
 		struct wm_txqueue *txq = >wmq_txq;
 		mutex_enter(txq->txq_lock);
-		txq->txq_watchdog = false; /* ensure watchdog disabled */
+		txq->txq_sending = false; /* ensure watchdog disabled */
 		for (i = 0; i < WM_TXQUEUELEN(txq); i++) {
 			txs = >txq_soft[i];
 			if (txs->txs_mbuf != NULL) {
@@ -6700,7 +6703,7 @@ wm_init_tx_queue(struct wm_softc *sc, st
 	wm_init_tx_regs(sc, wmq, txq);
 	wm_init_tx_buffer(sc, txq);
 
-	txq->txq_watchdog = false;
+	txq->txq_sending = false;
 }
 
 static void
@@ -7467,7 +7470,7 @@ wm_send_common_locked(struct ifnet *ifp,
 	if (txq->txq_free != ofree) {
 		/* Set a watchdog timer in case the chip flakes out. */
 		txq->txq_lastsent = time_uptime;
-		txq->txq_watchdog = true;
+		txq->txq_sending = true;
 	}
 }
 
@@ -8041,7 +8044,7 @@ wm_nq_send_common_locked(struct ifnet *i
 	if (sent) {
 		/* Set a watchdog timer in case the chip flakes out. */
 		txq->txq_lastsent = time_uptime;
-		txq->txq_watchdog = true;
+		txq->txq_sending = true;
 	}
 }
 
@@ -8186,7 +8189,7 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 	 * timer.
 	 */
 	if (txq->txq_sfree == WM_TXQUEUELEN(txq))
-		txq->txq_watchdog = false;
+		txq->txq_sending = false;
 
 	return more;
 }



CVS commit: src/sys/dev/pci

2018-04-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 23 01:35:25 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- Backout if_wm.c rev.1.574 and print "device timeout (lost interrupt)"
 when all descriptors in a queue are free. When all descripters 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.


To generate a diff of this commit:
cvs rdiff -u -r1.575 -r1.576 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 23 01:29:23 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.574 -r1.575 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.574 src/sys/dev/pci/if_wm.c:1.575
--- src/sys/dev/pci/if_wm.c:1.574	Fri Apr 20 03:03:13 2018
+++ src/sys/dev/pci/if_wm.c	Mon Apr 23 01:29:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.574 2018/04/20 03:03:13 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.575 2018/04/23 01:29:23 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.574 2018/04/20 03:03:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.575 2018/04/23 01:29:23 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -13069,7 +13069,7 @@ wm_get_swfw_semaphore(struct wm_softc *s
 	else
 		timeout = 200;
 
-	for (timeout = 0; timeout < 200; timeout++) {
+	while (timeout) {
 		if (wm_get_swsm_semaphore(sc)) {
 			aprint_error_dev(sc->sc_dev,
 			"%s: failed to get semaphore\n",
@@ -13085,6 +13085,7 @@ wm_get_swfw_semaphore(struct wm_softc *s
 		}
 		wm_put_swsm_semaphore(sc);
 		delay(5000);
+		timeout--;
 	}
 	printf("%s: failed to get swfw semaphore mask 0x%x swfw 0x%x\n",
 	device_xname(sc->sc_dev), mask, swfw_sync);



CVS commit: src/sys/dev/pci

2018-04-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 23 01:29:23 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.574 -r1.575 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 20 03:03:13 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.573 -r1.574 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.573 src/sys/dev/pci/if_wm.c:1.574
--- src/sys/dev/pci/if_wm.c:1.573	Mon Apr 16 08:31:06 2018
+++ src/sys/dev/pci/if_wm.c	Fri Apr 20 03:03:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.573 2018/04/16 08:31:06 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.574 2018/04/20 03:03:13 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.573 2018/04/16 08:31:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.574 2018/04/20 03:03:13 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3031,14 +3031,15 @@ wm_watchdog_txq_locked(struct ifnet *ifp
 	 * before we report an error.
 	 */
 	wm_txeof(txq, UINT_MAX);
-	if (txq->txq_watchdog)
-		*hang |= __BIT(wmq->wmq_id);
 
 	if (txq->txq_free != WM_NTXDESC(txq)) {
 #ifdef WM_DEBUG
 		int i, j;
 		struct wm_txsoft *txs;
 #endif
+		if (txq->txq_watchdog)
+			*hang |= __BIT(wmq->wmq_id);
+
 		log(LOG_ERR,
 		"%s: device timeout (txfree %d txsfree %d txnext %d)\n",
 		device_xname(sc->sc_dev), txq->txq_free, txq->txq_sfree,



CVS commit: src/sys/dev/pci

2018-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 20 03:03:13 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.573 -r1.574 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 19 07:40:12 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 Use ixgbe_eitr_write() when writing the EITR for the link interrupt like
queue's EITR to write the register safely. This change is not relatively
so important than queue's EITR because link's EITR is written in if_init().


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.148 src/sys/dev/pci/ixgbe/ixgbe.c:1.149
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.148	Tue Apr 17 08:38:05 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Apr 19 07:40:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.148 2018/04/17 08:38:05 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.149 2018/04/19 07:40:12 msaitoh Exp $ */
 
 /**
 
@@ -208,7 +208,7 @@ static void ixgbe_update_link_status
 static void	ixgbe_set_ivar(struct adapter *, u8, u8, s8);
 static void	ixgbe_configure_ivars(struct adapter *);
 static u8 *	ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
-static void	ixgbe_eitr_write(struct ix_queue *, uint32_t);
+static void	ixgbe_eitr_write(struct adapter *, uint32_t, uint32_t);
 
 static void	ixgbe_setup_vlan_hw_support(struct adapter *);
 #if 0
@@ -2559,7 +2559,7 @@ ixgbe_msix_que(void *arg)
 	 *the last interval.
 	 */
 	if (que->eitr_setting)
-		ixgbe_eitr_write(que, que->eitr_setting);
+		ixgbe_eitr_write(adapter, que->msix, que->eitr_setting);
 
 	que->eitr_setting = 0;
 
@@ -3042,16 +3042,15 @@ ixgbe_msix_link(void *arg)
 } /* ixgbe_msix_link */
 
 static void
-ixgbe_eitr_write(struct ix_queue *que, uint32_t itr)
+ixgbe_eitr_write(struct adapter *adapter, uint32_t index, uint32_t itr)
 {
-	struct adapter *adapter = que->adapter;
 	
 if (adapter->hw.mac.type == ixgbe_mac_82598EB)
 itr |= itr << 16;
 else
 itr |= IXGBE_EITR_CNT_WDIS;
 
-	IXGBE_WRITE_REG(>hw, IXGBE_EITR(que->msix), itr);
+	IXGBE_WRITE_REG(>hw, IXGBE_EITR(index), itr);
 }
 
 
@@ -3099,7 +3098,7 @@ ixgbe_sysctl_interrupt_rate_handler(SYSC
 		ixgbe_max_interrupt_rate = rate;
 	} else
 		ixgbe_max_interrupt_rate = 0;
-	ixgbe_eitr_write(que, reg);
+	ixgbe_eitr_write(adapter, que->msix, reg);
 
 	return (0);
 } /* ixgbe_sysctl_interrupt_rate_handler */
@@ -3919,7 +3918,7 @@ ixgbe_init_locked(struct adapter *adapte
 	}
 
 	/* Set moderation on the Link interrupt */
-	IXGBE_WRITE_REG(hw, IXGBE_EITR(adapter->vector), IXGBE_LINK_ITR);
+	ixgbe_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR);
 
 	/* Enable power to the phy. */
 	ixgbe_set_phy_power(hw, TRUE);
@@ -4054,7 +4053,7 @@ ixgbe_configure_ivars(struct adapter *ad
 		/* ... and the TX */
 		ixgbe_set_ivar(adapter, txr->me, que->msix, 1);
 		/* Set an Initial EITR value */
-		ixgbe_eitr_write(que, newitr);
+		ixgbe_eitr_write(adapter, que->msix, newitr);
 		/*
 		 * To eliminate influence of the previous state.
 		 * At this point, Tx/Rx interrupt handler

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.94 src/sys/dev/pci/ixgbe/ixv.c:1.95
--- src/sys/dev/pci/ixgbe/ixv.c:1.94	Tue Apr 17 08:38:05 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Apr 19 07:40:12 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.94 2018/04/17 08:38:05 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.95 2018/04/19 07:40:12 msaitoh Exp $*/
 
 /**
 
@@ -117,7 +117,7 @@ static int	ixv_sysctl_debug(SYSCTLFN_PRO
 static void	ixv_set_ivar(struct adapter *, u8, u8, s8);
 static void	ixv_configure_ivars(struct adapter *);
 static u8 *	ixv_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
-static void	ixv_eitr_write(struct ix_queue *, uint32_t);
+static void	ixv_eitr_write(struct adapter *, uint32_t, uint32_t);
 
 static void	ixv_setup_vlan_support(struct adapter *);
 #if 0
@@ -802,7 +802,7 @@ ixv_init_locked(struct adapter *adapter)
 	IXGBE_WRITE_REG(hw, IXGBE_VTEIAM, mask);
 
 	/* Set moderation on the Link interrupt */
-	IXGBE_WRITE_REG(hw, IXGBE_VTEITR(adapter->vector), IXGBE_LINK_ITR);
+	ixv_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR);
 
 	/* Stats init */
 	ixv_init_stats(adapter);
@@ -916,7 +916,7 @@ ixv_msix_que(void *arg)
 	 *the last interval.
 	 */
 	if (que->eitr_setting)
-		ixv_eitr_write(que, que->eitr_setting);
+		ixv_eitr_write(adapter, que->msix, que->eitr_setting);
 
 	que->eitr_setting = 0;
 
@@ -991,9 +991,8 @@ ixv_msix_mbx(void *arg)
 } /* ixv_msix_mbx */
 
 static void
-ixv_eitr_write(struct ix_queue *que, uint32_t itr)
+ixv_eitr_write(struct adapter *adapter, uint32_t index, uint32_t itr)
 {
-	struct adapter *adapter = que->adapter;
 
 	/*
 	 * Newer 

CVS commit: src/sys/dev/pci/ixgbe

2018-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 19 07:40:12 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 Use ixgbe_eitr_write() when writing the EITR for the link interrupt like
queue's EITR to write the register safely. This change is not relatively
so important than queue's EITR because link's EITR is written in if_init().


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 19 06:04:31 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.h

Log Message:
 Remove unused IXGBE_FC_HI and IXGBE_FC_LO. The watermark of the flow control
is automatically calculated from the size of the packet buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/ixgbe/ixgbe.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.43 src/sys/dev/pci/ixgbe/ixgbe.h:1.44
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.43	Tue Apr 17 08:38:05 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Thu Apr 19 06:04:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.43 2018/04/17 08:38:05 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.44 2018/04/19 06:04:31 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -173,8 +173,6 @@
 
 /* Flow control constants */
 #define IXGBE_FC_PAUSE0x
-#define IXGBE_FC_HI   0x2
-#define IXGBE_FC_LO   0x1
 
 /*
  * Used for optimizing small rx mbufs.  Effort is made to keep the copy



CVS commit: src/sys/dev/pci/ixgbe

2018-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 19 06:04:31 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.h

Log Message:
 Remove unused IXGBE_FC_HI and IXGBE_FC_LO. The watermark of the flow control
is automatically calculated from the size of the packet buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/ixgbe/ixgbe.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:44 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1320 -r1.1321 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1319 -r1.1320 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:44 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1320 -r1.1321 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1319 -r1.1320 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:19 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Added some NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1329 -r1.1330 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1329 src/sys/dev/pci/pcidevs:1.1330
--- src/sys/dev/pci/pcidevs:1.1329	Mon Apr 16 13:11:53 2018
+++ src/sys/dev/pci/pcidevs	Tue Apr 17 08:47:19 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1329 2018/04/16 13:11:53 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1330 2018/04/17 08:47:19 nonaka Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -645,6 +645,8 @@ vendor MARVELL2		0x1b4b	Marvell
 vendor FRESCO		0x1b73	Fresco Logic
 vendor QINHENG2		0x1c00	Nanjing QinHeng Electronics (PCIe)
 vendor SYMPHONY2	0x1c1c	Symphony Labs (2nd PCI Vendor ID)
+vendor HGST		0x1c58	HGST, Inc.
+vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
@@ -1742,6 +1744,9 @@ product BBELEC ISOLATED_2_PORT		0x4212	d
 product BBELEC ISOLATED_4_PORT		0x4214	quad-channel Isolated RS-485 PCI UART
 product BBELEC ISOLATED_8_PORT		0x4218	octal-channel Isolated RS-485 PCI UART
 
+/* Beijing Memblaze Technology Co. Ltd. products */
+product BEIJING_MEMBLAZE PBLAZE4	0x0540	PBlaze4 NVMe SSD
+
 /* Belkin products */
 product BELKIN F5D6001		0x6001	F5D6001
 product BELKIN F5D6020V3	0x6020	F5D6020v3 802.11b
@@ -2631,6 +2636,10 @@ product HP ILO3_SLAVE		0x3306	iLO3 Slave
 product HP ILO3_MGMT		0x3307	iLO3 Management
 product HP RS780_PPB_GFX	0x9602  (AMD) RS780 PCI-PCI Bridge (int gfx)
 
+/* HGST Inc. products */
+product HGST SN100	0x0003	Ultrastar SN100 Series NVMe SSD
+product HGST SN200	0x0023	Ultrastar SN200 Series NVMe SSD
+
 /* Hifn products */
 product HIFN 7751	0x0005	7751
 product HIFN 6500	0x0006	6500
@@ -6616,6 +6625,8 @@ product SAFENET SAFEXCEL	0x1141 SafeXcel
 product SAMSUNGELEC3	XP941		0xa800	XP941 M.2 SSD
 product SAMSUNGELEC3	SM951		0xa801	SM951 M.2 SSD
 product SAMSUNGELEC3	SM951_NVME	0xa802	SM951 M.2 NVMe SSD
+product SAMSUNGELEC3	172X		0xa821	NVMe SSD Controller 172X
+product SAMSUNGELEC3	172XAB		0xa822	NVMe SSD Controller 172Xa/172Xb
 
 /* Samsung Semiconductor products */
 product SAMSUNGSEMI	KS8920	0x8920	KS8920 10/100 Ethernet



CVS commit: src/sys/dev/pci

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:19 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Added some NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1329 -r1.1330 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-04-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr 17 08:38:05 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
 Remove unused structure entries. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.39 src/sys/dev/pci/ixgbe/ix_txrx.c:1.40
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.39	Wed Apr  4 08:13:07 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue Apr 17 08:38:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.39 2018/04/04 08:13:07 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.40 2018/04/17 08:38:05 msaitoh Exp $ */
 
 /**
 
@@ -494,8 +494,7 @@ retry:
 		segaddr = htole64(map->dm_segs[j].ds_addr);
 
 		txd->read.buffer_addr = segaddr;
-		txd->read.cmd_type_len = htole32(txr->txd_cmd |
-		cmd_type_len | seglen);
+		txd->read.cmd_type_len = htole32(cmd_type_len | seglen);
 		txd->read.olinfo_status = htole32(olinfo_status);
 
 		if (++i == txr->num_desc)
@@ -2266,8 +2265,6 @@ ixgbe_allocate_queues(struct adapter *ad
 		txr->num_desc = adapter->num_tx_desc;
 
 		/* Initialize the TX side lock */
-		snprintf(txr->mtx_name, sizeof(txr->mtx_name), "%s:tx(%d)",
-		device_xname(dev), txr->me);
 		mutex_init(>tx_mtx, MUTEX_DEFAULT, IPL_NET);
 
 		if (ixgbe_dma_malloc(adapter, tsize, >txdma,
@@ -2318,8 +2315,6 @@ ixgbe_allocate_queues(struct adapter *ad
 		rxr->num_desc = adapter->num_rx_desc;
 
 		/* Initialize the RX side lock */
-		snprintf(rxr->mtx_name, sizeof(rxr->mtx_name), "%s:rx(%d)",
-		device_xname(dev), rxr->me);
 		mutex_init(>rx_mtx, MUTEX_DEFAULT, IPL_NET);
 
 		if (ixgbe_dma_malloc(adapter, rsize, >rxdma,

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.147 src/sys/dev/pci/ixgbe/ixgbe.c:1.148
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.147	Tue Apr 17 05:23:58 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Apr 17 08:38:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.147 2018/04/17 05:23:58 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.148 2018/04/17 08:38:05 msaitoh Exp $ */
 
 /**
 
@@ -6282,7 +6282,6 @@ ixgbe_allocate_msix(struct adapter *adap
 	adapter->osdep.intrs[vector], IPL_NET, ixgbe_msix_link, adapter,
 	intr_xname);
 	if (adapter->osdep.ihs[vector] == NULL) {
-		adapter->res = NULL;
 		aprint_error_dev(dev, "Failed to register LINK handler\n");
 		error = ENXIO;
 		goto err_out;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.42 src/sys/dev/pci/ixgbe/ixgbe.h:1.43
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.42	Tue Apr 17 05:23:58 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Apr 17 08:38:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.42 2018/04/17 05:23:58 knakahara Exp $ */
+/* $NetBSD: ixgbe.h,v 1.43 2018/04/17 08:38:05 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -322,11 +322,9 @@ struct ixgbe_mc_addr {
 struct ix_queue {
 	struct adapter   *adapter;
 	u32  msix;   /* This queue's MSI-X vector */
-	u32  eims;   /* This queue's EIMS bit */
 	u32  eitr_setting;
 	u32  me;
 	struct resource  *res;
-	void *tag;
 	int  busy;
 	struct tx_ring   *txr;
 	struct rx_ring   *rxr;
@@ -365,9 +363,10 @@ struct tx_ring {
 	u16			next_avail_desc;
 	u16			next_to_clean;
 	u16			num_desc;
-	u32			txd_cmd;
 	ixgbe_dma_tag_t		*txtag;
-	char			mtx_name[16];
+#if 0
+	char			mtx_name[16]; /* NetBSD has no mutex name */
+#endif
 	pcq_t			*txr_interq;
 	struct work		wq_cookie;
 	void			*txr_si;
@@ -415,7 +414,9 @@ struct rx_ring {
 u16 			next_to_check;
 	u16			num_desc;
 	u16			mbuf_sz;
-	char			mtx_name[16];
+#if 0
+	char			mtx_name[16]; /* NetBSD has no mutex name */
+#endif
 	struct ixgbe_rx_buf	*rx_buffers;
 	ixgbe_dma_tag_t		*ptag;
 
@@ -461,17 +462,10 @@ struct adapter {
 	struct resource		*pci_mem;
 	struct resource		*msix_mem;
 
-	/*
-	 * Interrupt resources: this set is
-	 * either used for legacy, or for Link
-	 * when doing MSI-X
-	 */
-	void			*tag;
-	struct resource 	*res;
+	/* NetBSD: Interrupt resources are in osdep */
 
 	struct ifmedia		media;
 	callout_t		timer;
-	int			link_rid;
 	int			if_flags;
 
 	kmutex_t		core_mtx;

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.93 src/sys/dev/pci/ixgbe/ixv.c:1.94
--- src/sys/dev/pci/ixgbe/ixv.c:1.93	Thu Apr 12 08:03:55 2018
+++ 

CVS commit: src/sys/dev/pci/ixgbe

2018-04-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr 17 08:38:05 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
 Remove unused structure entries. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2018-04-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Apr 17 05:23:58 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h

Log Message:
Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.

The operation is not supported, however causing panic is problem.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/ixgbe/ixgbe.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.146 src/sys/dev/pci/ixgbe/ixgbe.c:1.147
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.146	Thu Apr 12 08:03:55 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Apr 17 05:23:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.146 2018/04/12 08:03:55 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.147 2018/04/17 05:23:58 knakahara Exp $ */
 
 /**
 
@@ -2487,7 +2487,7 @@ static inline void
 ixgbe_sched_handle_que(struct adapter *adapter, struct ix_queue *que)
 {
 
-	if (adapter->txrx_use_workqueue) {
+	if(que->txrx_use_workqueue) {
 		/*
 		 * adapter->que_wq is bound to each CPU instead of
 		 * each NIC queue to reduce workqueue kthread. As we
@@ -2531,6 +2531,12 @@ ixgbe_msix_que(void *arg)
 	ixgbe_disable_queue(adapter, que->msix);
 	++que->irqs.ev_count;
 
+	/*
+	 * Don't change "que->txrx_use_workqueue" from this point to avoid
+	 * flip-flopping softint/workqueue mode in one deferred processing.
+	 */
+	que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 	/* Don't run ixgbe_rxeof in interrupt context */
 	more = true;
@@ -3174,6 +3180,16 @@ ixgbe_add_device_sysctls(struct adapter 
 	CTL_EOL) != 0)
 		aprint_error_dev(dev, "could not create sysctl\n");
 
+	/*
+	 * If each "que->txrx_use_workqueue" is changed in sysctl handler,
+	 * it causesflip-flopping softint/workqueue mode in one deferred
+	 * processing. Therefore, preempt_disable()/preempt_enable() are
+	 * required in ixgbe_sched_handle_que() to avoid
+	 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule().
+	 * I think changing "que->txrx_use_workqueue" in interrupt handler
+	 * is lighter than doing preempt_disable()/preempt_enable() in every
+	 * ixgbe_sched_handle_que().
+	 */
 	adapter->txrx_use_workqueue = ixgbe_txrx_workqueue;
 	if (sysctl_createv(log, 0, , , CTLFLAG_READWRITE,
 	CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"),
@@ -4798,6 +4814,11 @@ ixgbe_legacy_irq(void *arg)
 	}
 
 	if ((ifp->if_flags & IFF_RUNNING) != 0) {
+		/*
+		 * The same as ixgbe_msix_que() about "que->txrx_use_workqueue".
+		 */
+		que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 		/* Don't run ixgbe_rxeof in interrupt context */
 		more = true;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.41 src/sys/dev/pci/ixgbe/ixgbe.h:1.42
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.41	Wed Apr  4 08:13:07 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Apr 17 05:23:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.41 2018/04/04 08:13:07 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.42 2018/04/17 05:23:58 knakahara Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -346,6 +346,7 @@ struct ix_queue {
 	 * > 0 : this queue is disabled
 	 *   the value is ixgbe_disable_queue() called count
 	 */
+	bool txrx_use_workqueue;
 };
 
 /*



CVS commit: src/sys/dev/pci/ixgbe

2018-04-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Apr 17 05:23:58 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h

Log Message:
Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.

The operation is not supported, however causing panic is problem.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/ixgbe/ixgbe.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



  1   2   3   4   5   6   7   8   9   10   >