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

2017-03-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Mar  9 06:19:37 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1370):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.60
  Use 64bit DMA tag. If not, a lot of bounce buffer is allocated.
Fixes PR#49968 reported by Hauke.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.6 -r1.14.2.7 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.14.2.6 src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.7
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.6	Tue Jun 14 08:42:34 2016
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar  9 06:19:37 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 279805 2015-03-09 10:29:15Z araujo $*/
-/*$NetBSD: ixgbe.c,v 1.14.2.6 2016/06/14 08:42:34 snj Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.7 2017/03/09 06:19:37 snj Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -522,7 +522,10 @@ ixgbe_attach(device_t parent, device_t d
 	hw = >hw;
 	adapter->osdep.pc = pa->pa_pc;
 	adapter->osdep.tag = pa->pa_tag;
-	adapter->osdep.dmat = pa->pa_dmat;
+	if (pci_dma64_available(pa))
+		adapter->osdep.dmat = pa->pa_dmat64;
+	else
+		adapter->osdep.dmat = pa->pa_dmat;
 	adapter->osdep.attached = false;
 
 	ent = ixgbe_lookup(pa);



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

2015-04-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 19 14:42:15 UTC 2015

Added Files:
src/sys/dev/pci/ixgbe [netbsd-7]: ixgbe_82598.h ixgbe_82599.h
ixgbe_x540.c ixgbe_x540.h

Log Message:
Apply patch (requested by msaitoh in ticket #697):
sys/dev/pci/files.pci   1.375 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.24-1.27 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_82598.h 1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_82599.c 1.6-1.8 via patch
sys/dev/pci/ixgbe/ixgbe_82599.h 1.1 via patch
sys/dev/pci/ixgbe/ixgbe_api.c   1.5-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_api.h   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_common.c1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_common.h1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_phy.c   1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_phy.h   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.8-1.9 via patch
sys/dev/pci/ixgbe/ixgbe_vf.c1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_vf.h1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_x540.c  1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_x540.h  1.1 via patch
sys/dev/pci/ixgbe/ixv.c 1.5-1.7 via patch
sys/dev/pci/ixgbe/ixv.h 1.4-1.5 via patch

Synchronize our ixg(4) driver up to FreeBSD r243716:
 - Add X540 support.
 - Add TSO6 support.
 - Add 100BaseTX support.
 - The max size in dma tag is changed from 65535 to 262140 
(IXGBE_TSO_SIZE).
   The value is the same as other *BSDs. The change might cause a 
address
   space shortage (ixgbe_dmamap_create() might fail) on some machines.
 - Show 1000Base-SX correctly.
 - Fix if_baudrate from 1G to 10G.
 - Fix a bug that ifconfig -z (SOICZIFDATA) doesn't work.
 - Fix a lot of bugs.
 - Improve performance.
[msaitoh, ticket #697]


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.2.4.2 src/sys/dev/pci/ixgbe/ixgbe_82598.h \
src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r0 -r1.1.4.2 src/sys/dev/pci/ixgbe/ixgbe_82599.h \
src/sys/dev/pci/ixgbe/ixgbe_x540.h

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

Added files:

Index: src/sys/dev/pci/ixgbe/ixgbe_82598.h
diff -u /dev/null src/sys/dev/pci/ixgbe/ixgbe_82598.h:1.2.4.2
--- /dev/null	Sun Apr 19 14:42:15 2015
+++ src/sys/dev/pci/ixgbe/ixgbe_82598.h	Sun Apr 19 14:42:14 2015
@@ -0,0 +1,52 @@
+/**
+
+  Copyright (c) 2001-2012, Intel Corporation 
+  All rights reserved.
+  
+  Redistribution and use in source and binary forms, with or without 
+  modification, are permitted provided that the following conditions are met:
+  
+   1. Redistributions of source code must retain the above copyright notice, 
+  this list of conditions and the following disclaimer.
+  
+   2. Redistributions in binary form must reproduce the above copyright 
+  notice, this list of conditions and the following disclaimer in the 
+  documentation and/or other materials provided with the distribution.
+  
+   3. Neither the name of the Intel Corporation nor the names of its 
+  contributors may be used to endorse or promote products derived from 
+  this software without specific prior written permission.
+  
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+**/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.h 238149 2012-07-05 20:51:44Z jfv $*/
+
+#ifndef _IXGBE_82598_H_
+#define _IXGBE_82598_H_
+
+u32 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw);

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

2015-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 24 10:41:09 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #545):
sys/dev/pci/ixgbe/ixgbe.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe.c: revision 1.18
sys/dev/pci/ixgbe/ixgbe.c: revision 1.19
 Add missing IXGBE_RX_LOCK_DESTROY() for the detach path.
 Remove extra IXGBE_TX_LOCK()/IXGBE_TX_UNLOCK() from
ixgbe_free_transmit_structures(). This function is called in the end of
the detach function. if_stop was called and almost all resources were
freed, so it's not required to block the TX stuff.
Fix mutex related problem reported by Uwe Toenjes in PR#49328:
 - Revert ixgbe_netbsd.c rev. 1.2
 - make CORE_LOCK adaptive
 - Release spin lock while reinitializing the jumb buffer structure.
disable preemption while scheduling the softint to configure the link.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.1 -r1.1.28.1 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.14.2.1 src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.2
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.1	Tue Feb 17 14:54:37 2015
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb 24 10:41:09 2015
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.51 2011/04/25 23:34:21 jfv Exp $*/
-/*$NetBSD: ixgbe.c,v 1.14.2.1 2015/02/17 14:54:37 martin Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.2 2015/02/24 10:41:09 martin Exp $*/
 
 #include opt_inet.h
 
@@ -2710,13 +2710,19 @@ ixgbe_config_link(struct adapter *adapte
 	sfp = ixgbe_is_sfp(hw);
 
 	if (sfp) { 
+		void *ip;
+
 		if (hw-phy.multispeed_fiber) {
 			hw-mac.ops.setup_sfp(hw);
 			ixgbe_enable_tx_laser(hw);
-			softint_schedule(adapter-msf_si);
+			ip = adapter-msf_si;
 		} else {
-			softint_schedule(adapter-mod_si);
+			ip = adapter-mod_si;
 		}
+
+		kpreempt_disable();
+		softint_schedule(ip);
+		kpreempt_enable();
 	} else {
 		if (hw-mac.ops.check_link)
 			err = ixgbe_check_link(hw, autoneg,
@@ -3180,10 +3186,8 @@ ixgbe_free_transmit_structures(struct ad
 	struct tx_ring *txr = adapter-tx_rings;
 
 	for (int i = 0; i  adapter-num_queues; i++, txr++) {
-		IXGBE_TX_LOCK(txr);
 		ixgbe_free_transmit_buffers(txr);
 		ixgbe_dma_free(adapter, txr-txdma);
-		IXGBE_TX_UNLOCK(txr);
 		IXGBE_TX_LOCK_DESTROY(txr);
 	}
 	free(adapter-tx_rings, M_DEVBUF);
@@ -3935,12 +3939,16 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	/* Free current RX buffer structs and their mbufs */
 	ixgbe_free_receive_ring(rxr);
 
+	IXGBE_RX_UNLOCK(rxr);
+
 	/* Now reinitialize our supply of jumbo mbufs.  The number
 	 * or size of jumbo mbufs may have changed.
 	 */
 	ixgbe_jcl_reinit(adapter-jcl_head, rxr-ptag-dt_dmat,
 	2 * adapter-num_rx_desc, adapter-rx_mbuf_sz);
 
+	IXGBE_RX_LOCK(rxr);
+
 	/* Configure header split? */
 	if (ixgbe_header_split)
 		rxr-hdr_split = TRUE;
@@ -4226,6 +4234,7 @@ ixgbe_free_receive_structures(struct ada
 #endif /* LRO */
 		/* Free the ring memory as well */
 		ixgbe_dma_free(adapter, rxr-rxdma);
+		IXGBE_RX_LOCK_DESTROY(rxr);
 	}
 
 	free(adapter-rx_rings, M_DEVBUF);

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.1 src/sys/dev/pci/ixgbe/ixgbe.h:1.1.28.1
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.1	Fri Aug 12 21:55:29 2011
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Feb 24 10:41:09 2015
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.h,v 1.24 2011/04/28 23:21:40 jfv Exp $*/
-/*$NetBSD: ixgbe.h,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe.h,v 1.1.28.1 2015/02/24 10:41:09 martin Exp $*/
 
 
 #ifndef _IXGBE_H_
@@ -476,7 +476,7 @@ struct adapter {
 
 
 #define IXGBE_CORE_LOCK_INIT(_sc, _name) \
-mutex_init((_sc)-core_mtx, MUTEX_DEFAULT, IPL_NET)
+mutex_init((_sc)-core_mtx, MUTEX_DEFAULT, IPL_SOFTNET)
 #define IXGBE_CORE_LOCK_DESTROY(_sc)  mutex_destroy((_sc)-core_mtx)
 #define IXGBE_TX_LOCK_DESTROY(_sc)mutex_destroy((_sc)-tx_mtx)
 #define IXGBE_RX_LOCK_DESTROY(_sc)mutex_destroy((_sc)-rx_mtx)



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

2015-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 17 14:54:37 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #527):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.15
  Fix a legacy interrupt problem. If the INTx line was shared with another
device, the ixgbe_legacy_irq() enabled the interrupt even if the interface
was down. Check the interface state and call functions appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.2.1 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.14 src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.1
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.14	Mon Apr 21 16:35:06 2014
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb 17 14:54:37 2015
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.51 2011/04/25 23:34:21 jfv Exp $*/
-/*$NetBSD: ixgbe.c,v 1.14 2014/04/21 16:35:06 chs Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.1 2015/02/17 14:54:37 martin Exp $*/
 
 #include opt_inet.h
 
@@ -1478,30 +1478,33 @@ ixgbe_legacy_irq(void *arg)
 {
 	struct ix_queue *que = arg;
 	struct adapter	*adapter = que-adapter;
+	struct ifnet   *ifp = adapter-ifp;
 	struct ixgbe_hw	*hw = adapter-hw;
 	struct 		tx_ring *txr = adapter-tx_rings;
-	bool		more_tx, more_rx;
+	bool		more_tx = false, more_rx = false;
 	u32   	reg_eicr, loop = MAX_LOOP;
 
-
 	reg_eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
 
 	adapter-stats.legint.ev_count++;
 	++que-irqs;
 	if (reg_eicr == 0) {
 		adapter-stats.intzero.ev_count++;
-		ixgbe_enable_intr(adapter);
+		if ((ifp-if_flags  IFF_UP) != 0)
+			ixgbe_enable_intr(adapter);
 		return 0;
 	}
 
-	more_rx = ixgbe_rxeof(que, adapter-rx_process_limit);
+	if ((ifp-if_flags  IFF_RUNNING) != 0) {
+		more_rx = ixgbe_rxeof(que, adapter-rx_process_limit);
 
-	IXGBE_TX_LOCK(txr);
-	do {
-		adapter-txloops.ev_count++;
-		more_tx = ixgbe_txeof(txr);
-	} while (loop--  more_tx);
-	IXGBE_TX_UNLOCK(txr);
+		IXGBE_TX_LOCK(txr);
+		do {
+			adapter-txloops.ev_count++;
+			more_tx = ixgbe_txeof(txr);
+		} while (loop--  more_tx);
+		IXGBE_TX_UNLOCK(txr);
+	}
 
 	if (more_rx || more_tx) {
 		if (more_rx)