CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:17:44 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #453):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

 XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.6 -r1.199.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.6 -r1.125.2.7 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: [netbsd-9] src/sys/dev/pci/ixgbe

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:17:44 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #453):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

 XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.6 -r1.199.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.6 -r1.125.2.7 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.199.2.6 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.7
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.6	Thu Oct 17 19:09:14 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Nov 19 13:17:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.6 2019/10/17 19:09:14 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.7 2019/11/19 13:17:44 martin Exp $ */
 
 /**
 
@@ -1338,6 +1338,8 @@ ixgbe_setup_interface(device_t dev, stru
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.7
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6	Thu Nov 14 15:30:19 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Nov 19 13:17:44 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.6 2019/11/14 15:30:19 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.7 2019/11/19 13:17:44 martin Exp $*/
 
 /**
 
@@ -1610,6 +1610,8 @@ ixv_setup_interface(device_t dev, struct
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.



CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:30:19 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #422):

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.5 -r1.125.2.6 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.125.2.5 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.5	Tue Oct  8 17:05:16 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Nov 14 15:30:19 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.5 2019/10/08 17:05:16 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.6 2019/11/14 15:30:19 martin Exp $*/
 
 /**
 
@@ -1920,7 +1920,8 @@ ixv_initialize_receive_units(struct adap
 			adapter->num_rx_desc - 1);
 	}
 
-	ixv_initialize_rss_mapping(adapter);
+	if (adapter->hw.mac.type >= ixgbe_mac_X550_vf)
+		ixv_initialize_rss_mapping(adapter);
 } /* ixv_initialize_receive_units */
 
 /



CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:30:19 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #422):

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.5 -r1.125.2.6 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: [netbsd-9] src/sys/dev/pci/ixgbe

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:09:14 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #348):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.214

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.5 -r1.199.2.6 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: [netbsd-9] src/sys/dev/pci/ixgbe

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:09:14 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #348):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.214

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.5 -r1.199.2.6 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.199.2.5 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.6
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.5	Thu Sep 26 19:07:22 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Oct 17 19:09:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.5 2019/09/26 19:07:22 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.6 2019/10/17 19:09:14 martin Exp $ */
 
 /**
 
@@ -5860,7 +5860,7 @@ ixgbe_sysctl_eee_state(SYSCTLFN_ARGS)
 	if ((new_eee < 0) || (new_eee > 1))
 		return (EINVAL);
 
-	retval = adapter->hw.mac.ops.setup_eee(>hw, new_eee);
+	retval = ixgbe_setup_eee(>hw, new_eee);
 	if (retval) {
 		device_printf(dev, "Error in EEE setup: 0x%08X\n", retval);
 		return (EINVAL);
@@ -6034,8 +6034,6 @@ ixgbe_init_device_features(struct adapte
 		 */
 		adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
 		adapter->feat_cap |= IXGBE_FEATURE_FDIR;
-		if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR)
-			adapter->feat_cap |= IXGBE_FEATURE_EEE;
 		break;
 	case ixgbe_mac_X550EM_a:
 		/*



CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 17:05:16 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #293):

sys/dev/pci/ixgbe/ixv.c: revision 1.139

Set MTU correctly if mtu > 1500.


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.4 -r1.125.2.5 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.125.2.4 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.5
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.4	Thu Sep 26 19:07:22 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Oct  8 17:05:16 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.4 2019/09/26 19:07:22 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.5 2019/10/08 17:05:16 martin Exp $*/
 
 /**
 
@@ -716,6 +716,9 @@ ixv_init_locked(struct adapter *adapter)
 	for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++)
 		que->disabled_count = 0;
 
+	adapter->max_frame_size =
+	ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
 	/* reprogram the RAR[0] in case user changed it. */
 	hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);
 
@@ -748,10 +751,10 @@ ixv_init_locked(struct adapter *adapter)
 	 * Determine the correct mbuf pool
 	 * for doing jumbo/headersplit
 	 */
-	if (ifp->if_mtu > ETHERMTU)
-		adapter->rx_mbuf_sz = MJUMPAGESIZE;
-	else
+	if (adapter->max_frame_size <= MCLBYTES)
 		adapter->rx_mbuf_sz = MCLBYTES;
+	else
+		adapter->rx_mbuf_sz = MJUMPAGESIZE;
 
 	/* Prepare receive descriptors and buffers */
 	if (ixgbe_setup_receive_structures(adapter)) {



CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 17:05:16 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #293):

sys/dev/pci/ixgbe/ixv.c: revision 1.139

Set MTU correctly if mtu > 1500.


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.4 -r1.125.2.5 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: [netbsd-9] src/sys/dev/pci/ixgbe

2019-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  5 09:11:03 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe_netbsd.c
ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #180):

sys/dev/pci/ixgbe/ixv.c: revision 1.130
sys/dev/pci/ixgbe/ixgbe.c: revision 1.207
sys/dev/pci/ixgbe/ixgbe.c: revision 1.208
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.55
sys/dev/pci/ixgbe/ixv.c: revision 1.129
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.10

 printf -> device_printf

 Set IFM_1000_BX10 correctly.

 Use aprint_*() in the attach function.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.2.1 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.3 -r1.199.2.4 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.125.2.2 -r1.125.2.3 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: [netbsd-9] src/sys/dev/pci/ixgbe

2019-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  5 09:11:03 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe_netbsd.c
ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #180):

sys/dev/pci/ixgbe/ixv.c: revision 1.130
sys/dev/pci/ixgbe/ixgbe.c: revision 1.207
sys/dev/pci/ixgbe/ixgbe.c: revision 1.208
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.55
sys/dev/pci/ixgbe/ixv.c: revision 1.129
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.10

 printf -> device_printf

 Set IFM_1000_BX10 correctly.

 Use aprint_*() in the attach function.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.2.1 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.3 -r1.199.2.4 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.125.2.2 -r1.125.2.3 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.54 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.1
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54	Thu Jul  4 08:56:35 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Sep  5 09:11:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54 2019/07/04 08:56:35 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.1 2019/09/05 09:11:03 martin Exp $ */
 
 /**
 
@@ -1363,7 +1363,9 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 			error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat,
 			rxbuf->pmap, mp, BUS_DMA_NOWAIT);
 			if (error != 0) {
-printf("Refresh mbufs: payload dmamap load failure - %d\n", error);
+device_printf(adapter->dev, "Refresh mbufs: "
+"payload dmamap load failure - %d\n",
+error);
 m_free(mp);
 rxbuf->buf = NULL;
 goto update;

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.3 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.4
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.3	Sun Sep  1 13:08:12 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Sep  5 09:11:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.3 2019/09/01 13:08:12 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.4 2019/09/05 09:11:03 martin Exp $ */
 
 /**
 
@@ -1403,7 +1403,6 @@ static void
 ixgbe_add_media_types(struct adapter *adapter)
 {
 	struct ixgbe_hw *hw = >hw;
-	device_t	dev = adapter->dev;
 	u64		layer;
 
 	layer = adapter->phy_layer;
@@ -1469,7 +1468,7 @@ ixgbe_add_media_types(struct adapter *ad
 		ADD(IFM_5000_T | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
-		device_printf(dev, "Media supported: 1000baseBX\n");
+		ADD(IFM_1000_BX10 | IFM_FDX, 0);
 	/* XXX no ifmedia_set? */
 
 	ADD(IFM_AUTO, 0);
@@ -3306,7 +3305,8 @@ ixgbe_sysctl_instance(struct adapter *ad
 
 	return rnode;
 err:
-	printf("%s: sysctl_createv failed, rc = %d\n", __func__, rc);
+	device_printf(adapter->dev,
+	"%s: sysctl_createv failed, rc = %d\n", __func__, rc);
 	return NULL;
 }
 

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.9 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.9.4.1
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.9	Thu Dec  6 13:25:02 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c	Thu Sep  5 09:11:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.9 2018/12/06 13:25:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.9.4.1 2019/09/05 09:11:03 martin Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -197,7 +197,8 @@ ixgbe_jcl_reinit(struct adapter *adapter
 
 	for (i = 0; i < nbuf; i++) {
 		if ((em = ixgbe_newext(eh, dmat, size)) == NULL) {
-			printf("%s: only %d of %d jumbo buffers allocated\n",
+			device_printf(adapter->dev,
+			"%s: only %d of %d jumbo buffers allocated\n",
 			__func__, i, nbuf);
 			break;
 		}

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.2 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.3
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.2	Sun Sep  1 11:12:45 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Sep  5 09:11:03 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.2 2019/09/01 11:12:45 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.3 2019/09/05 09:11:03 martin Exp $*/
 
 /**
 
@@ -516,7 +516,7 @@ ixv_attach(device_t parent, device_t dev
 
 	error = ixv_allocate_msix(adapter, pa);
 	if (error) {
-		device_printf(dev, "ixv_allocate_msix() failed!\n");
+		aprint_error_dev(dev, "ixv_allocate_msix() failed!\n");
 		goto err_late;
 	}
 
@@ -2406,7 +2406,8 @@ ixv_sysctl_instance(struct adapter *adap
 
 	return rnode;
 err:
-	printf("%s: sysctl_createv failed, rc = %d\n", __func__, 

CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep  1 13:08:13 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #136):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o

pullup-8, pullup-9

 -

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by 
nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o

pullup-8, pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.2 -r1.199.2.3 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.199.2.2 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.3
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.2	Sun Sep  1 11:12:45 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sun Sep  1 13:08:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.2 2019/09/01 11:12:45 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.3 2019/09/01 13:08:12 martin Exp $ */
 
 /**
 
@@ -6467,7 +6467,9 @@ ixgbe_allocate_legacy(struct adapter *ad
 	int		counts[PCI_INTR_TYPE_SIZE];
 	pci_intr_type_t intr_type, max_type;
 	char		intrbuf[PCI_INTRSTR_LEN];
+	char		wqname[MAXCOMLEN];
 	const char	*intrstr = NULL;
+	int defertx_error = 0, error;
 
 	/* We allocate a single interrupt resource */
 	max_type = PCI_INTR_TYPE_MSI;
@@ -6529,15 +6531,27 @@ alloc_retry:
 	 * Try allocating a fast interrupt and the associated deferred
 	 * processing contexts.
 	 */
-	if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX))
+	if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 		txr->txr_si =
 		softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 			ixgbe_deferred_mq_start, txr);
+
+		snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
+		defertx_error = workqueue_create(>txr_wq, wqname,
+		ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI,
+		IPL_NET, IXGBE_WORKQUEUE_FLAGS);
+		adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
+	}
 	que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 	ixgbe_handle_que, que);
+	snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
+	error = workqueue_create(>que_wq, wqname,
+	ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
+	IXGBE_WORKQUEUE_FLAGS);
 
 	if ((!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)
-		& (txr->txr_si == NULL)) || (que->que_si == NULL)) {
+		&& ((txr->txr_si == NULL) || defertx_error != 0))
+	|| (que->que_si == NULL) || error != 0) {
 		aprint_error_dev(dev,
 		"could not establish software interrupts\n");
 



CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep  1 13:08:13 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #136):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o

pullup-8, pullup-9

 -

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by 
nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o

pullup-8, pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.2 -r1.199.2.3 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: [netbsd-9] src/sys/dev/pci/ixgbe

2019-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep  1 11:12:45 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #134):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.202
sys/dev/pci/ixgbe/ixgbe.c: revision 1.203
sys/dev/pci/ixgbe/ixgbe.c: revision 1.204
sys/dev/pci/ixgbe/ixv.c: revision 1.128

Simplify ix{gbe,v}_[un]register_vlan() API suggested by knakahara.

 The API was the same as FreeBSD's pre-iflib's. They use iflib now and it's
not required for us to keep the old API.
X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.

 An interrupt might not arrive when a module is inserted. When an link status
change interrupt occurred and the driver still regard SFP as unplugged, link
becomes up and the real media type is unknown. e.g:

 % ifconfig -m ixg0
 (snip)
 media: Ethernet autoselect (autoselect rxpause,txpause)
 status: active
 supported Ethernet media:
 media none
 media autoselect
 (snip)

To resolve this problem, when an link status change interrupt occurred and the
driver still regard SFP as unplugged, issue the module softint before issuing
LSC interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.1 -r1.199.2.2 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.1 -r1.125.2.2 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.199.2.1 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.2
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.1	Sun Sep  1 11:07:05 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sun Sep  1 11:12:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.1 2019/09/01 11:07:05 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.2 2019/09/01 11:12:45 martin Exp $ */
 
 /**
 
@@ -222,8 +222,8 @@ static void	ixgbe_eitr_write(struct adap
 static void	ixgbe_setup_vlan_hw_tagging(struct adapter *);
 static void	ixgbe_setup_vlan_hw_support(struct adapter *);
 static int	ixgbe_vlan_cb(struct ethercom *, uint16_t, bool);
-static int	ixgbe_register_vlan(void *, struct ifnet *, u16);
-static int	ixgbe_unregister_vlan(void *, struct ifnet *, u16);
+static int	ixgbe_register_vlan(struct adapter *, u16);
+static int	ixgbe_unregister_vlan(struct adapter *, u16);
 
 static void	ixgbe_add_device_sysctls(struct adapter *);
 static void	ixgbe_add_hw_stats(struct adapter *);
@@ -1489,6 +1489,8 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 			return (TRUE);
 		return (FALSE);
 	case ixgbe_mac_82599EB:
+	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
 		switch (hw->mac.ops.get_media_type(hw)) {
 		case ixgbe_media_type_fiber:
 		case ixgbe_media_type_fiber_qsfp:
@@ -1496,11 +1498,6 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 		default:
 			return (FALSE);
 		}
-	case ixgbe_mac_X550EM_x:
-	case ixgbe_mac_X550EM_a:
-		if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber)
-			return (TRUE);
-		return (FALSE);
 	default:
 		return (FALSE);
 	}
@@ -2310,9 +2307,9 @@ ixgbe_vlan_cb(struct ethercom *ec, uint1
 	int rv;
 
 	if (set)
-		rv = ixgbe_register_vlan(ifp->if_softc, ifp, vid);
+		rv = ixgbe_register_vlan(adapter, vid);
 	else
-		rv = ixgbe_unregister_vlan(ifp->if_softc, ifp, vid);
+		rv = ixgbe_unregister_vlan(adapter, vid);
 
 	if (rv != 0)
 		return rv;
@@ -2336,15 +2333,11 @@ ixgbe_vlan_cb(struct ethercom *ec, uint1
  *   VFTA, init will repopulate the real table.
  /
 static int
-ixgbe_register_vlan(void *arg, struct ifnet *ifp, u16 vtag)
+ixgbe_register_vlan(struct adapter *adapter, u16 vtag)
 {
-	struct adapter	*adapter = ifp->if_softc;
 	u16		index, bit;
 	int		error;
 
-	if (ifp->if_softc != arg)   /* Not our event */
-		return EINVAL;
-
 	if ((vtag == 0) || (vtag > 4095))	/* Invalid */
 		return EINVAL;
 
@@ -2367,15 +2360,11 @@ ixgbe_register_vlan(void *arg, struct if
  *   Run via vlan unconfig EVENT, remove our entry in the soft vfta.
  /
 static int
-ixgbe_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag)
+ixgbe_unregister_vlan(struct adapter *adapter, u16 vtag)
 {
-	struct adapter	*adapter = ifp->if_softc;
 	u16		index, bit;
 	int		error;
 
-	if (ifp->if_softc != arg)
-		return EINVAL;
-
 	if ((vtag == 0) || (vtag > 4095))	/* Invalid */
 		return EINVAL;
 
@@ -3124,6 +3113,34 @@ ixgbe_msix_link(void *arg)
 	/* Clear interrupt with write */
 	IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr);
 
+	if (ixgbe_is_sfp(hw)) {
+		/* Pluggable optics-related interrupt */
+		if (hw->mac.type >= ixgbe_mac_X540)
+			eicr_mask = IXGBE_EICR_GPI_SDP0_X540;
+		else
+			eicr_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw);
+
+		

CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2019-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep  1 11:12:45 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #134):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.202
sys/dev/pci/ixgbe/ixgbe.c: revision 1.203
sys/dev/pci/ixgbe/ixgbe.c: revision 1.204
sys/dev/pci/ixgbe/ixv.c: revision 1.128

Simplify ix{gbe,v}_[un]register_vlan() API suggested by knakahara.

 The API was the same as FreeBSD's pre-iflib's. They use iflib now and it's
not required for us to keep the old API.
X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.

 An interrupt might not arrive when a module is inserted. When an link status
change interrupt occurred and the driver still regard SFP as unplugged, link
becomes up and the real media type is unknown. e.g:

 % ifconfig -m ixg0
 (snip)
 media: Ethernet autoselect (autoselect rxpause,txpause)
 status: active
 supported Ethernet media:
 media none
 media autoselect
 (snip)

To resolve this problem, when an link status change interrupt occurred and the
driver still regard SFP as unplugged, issue the module softint before issuing
LSC interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.1 -r1.199.2.2 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.1 -r1.125.2.2 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.