Wed Sep 15 16:38:01 2021 UTC ()
Pull up the following (all via patch), requested by msaitoh in ticket #1696:

	sysdev/pci/ixgbe/ixgbe.c			1.252, 1.280-1.283, 1.286-1.287, 1.289-1.290 via patch
	sysdev/pci/ixgbe/ixgbe.h			1.73, 1.76-1.80 via patch
	sysdev/pci/ixgbe/ix_txrx.c			1.68-1.93
	sysdev/pci/ixgbe/ixv.c				1.153, 1.157-1.161, 1.163-1.166 via patch
	sysdev/pci/ixgbe/if_bypass.c			1.7-1.9
	sysdev/pci/ixgbe/if_fdir.c			1.4-1.5
	sysdev/pci/ixgbe/if_sriov.c			1.10-1.11
	sysdev/pci/ixgbe/ixgbe_82598.c			1.16
	sysdev/pci/ixgbe/ixgbe_82599.c			1.23
	sysdev/pci/ixgbe/ixgbe_api.c			1.25
	sysdev/pci/ixgbe/ixgbe_bypass.h			1.2
	sysdev/pci/ixgbe/ixgbe_common.c			1.30-1.33
	sysdev/pci/ixgbe/ixgbe_dcb.c			1.10-1.11
	sysdev/pci/ixgbe/ixgbe_dcb.h			1.7
	sysdev/pci/ixgbe/ixgbe_dcb_82598.c		1.8-1.9
	sysdev/pci/ixgbe/ixgbe_dcb_82598.h		1.7
	sysdev/pci/ixgbe/ixgbe_dcb_82599.c		1.8-1.9
	sysdev/pci/ixgbe/ixgbe_dcb_82599.h		1.7
	sysdev/pci/ixgbe/ixgbe_fdir.h			1.3
	sysdev/pci/ixgbe/ixgbe_features.h		1.3
	sysdev/pci/ixgbe/ixgbe_mbx.c			1.12
	sysdev/pci/ixgbe/ixgbe_netbsd.c			1.16-1.17
	sysdev/pci/ixgbe/ixgbe_netbsd.h			1.13-1.14
	sysdev/pci/ixgbe/ixgbe_netmap.c			1.3-1.4
	sysdev/pci/ixgbe/ixgbe_netmap.h			1.2
	sysdev/pci/ixgbe/ixgbe_osdep.c			1.7
	sysdev/pci/ixgbe/ixgbe_osdep.h			1.29-1.30
	sysdev/pci/ixgbe/ixgbe_phy.c			1.24
	sysdev/pci/ixgbe/ixgbe_rss.h			1.5
	sysdev/pci/ixgbe/ixgbe_sriov.h			1.4
	sysdev/pci/ixgbe/ixgbe_type.h			1.49
	sysdev/pci/ixgbe/ixgbe_vf.c			1.27
	sysdev/pci/ixgbe/ixgbe_x540.c			1.18-1.19
	sysdev/pci/ixgbe/ixgbe_x540.h			1.9
	sysdev/pci/ixgbe/ixgbe_x550.c			1.19-1.20
	sysdev/pci/ixgbe/ixgbe_x550.h			1.6
	sysdev/pci/files.pci				1.438
	share/man/man4/ixg.4				1.15
	share/man/man4/ixv.4				1.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
  Before this commit, resource shortage was easily occurred because
  the total number of the clusters is small.
- Improve performance:
  - Use m_adj(ETHER_ALIGN) more.
  - Sprinkle __predict_false() in the RX path.
  - Don't pre-allocate a cluster for RXCOPY case to improve short
    packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
  DMA buffer. Also, when the buffer is already freed, do not call
  bus_dmamap_unload(9) (no resource leaks with this change). This
  change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
  ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
  on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
  address. At least, this change is required for macppc
  (sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
  panic.
- Save the discard_multidesc state to not to forget the state by
  exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
  packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value of ixgbe_reset_hw() for debugging.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxr->next_to_check updating.
- Add new sysctl "rx_copy_len".
- Add a new sysctl to read rxr->next_to_refresh.
- Print error number when error occurred.
- Rename ix{gbe,v}_stop() with ix{gbe,v}_stop_locked(). No functional
  change.
- Don't use fixed value.
- Comment out flow director processing in fast path.
- Add missing NetBSD RCS IDs and __KERNEL_RCSID()s.
- KNF.
- Fix typos.


(martin)
diff -r1.10.4.2 -r1.10.4.3 src/share/man/man4/ixg.4
diff -r1.3.2.4 -r1.3.2.5 src/share/man/man4/ixv.4
diff -r1.388.4.5 -r1.388.4.6 src/sys/dev/pci/files.pci
diff -r1.2.4.6 -r1.2.4.7 src/sys/dev/pci/ixgbe/if_bypass.c
diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/if_fdir.c
diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_fdir.h
diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_features.h
diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_netmap.c
diff -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/if_sriov.c
diff -r1.24.2.21 -r1.24.2.22 src/sys/dev/pci/ixgbe/ix_txrx.c
diff -r1.88.2.43 -r1.88.2.44 src/sys/dev/pci/ixgbe/ixgbe.c
diff -r1.24.6.21 -r1.24.6.22 src/sys/dev/pci/ixgbe/ixgbe.h
diff -r1.8.8.5 -r1.8.8.6 src/sys/dev/pci/ixgbe/ixgbe_82598.c
diff -r1.14.8.6 -r1.14.8.7 src/sys/dev/pci/ixgbe/ixgbe_82599.c
diff -r1.15.8.6 -r1.15.8.7 src/sys/dev/pci/ixgbe/ixgbe_api.c
diff -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/ixgbe_bypass.h
diff -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/ixgbe_netmap.h
diff -r1.13.2.10 -r1.13.2.11 src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -r1.4.8.2 -r1.4.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb.c
diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb.h
diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h
diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c
diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h
diff -r1.6.8.3 -r1.6.8.4 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
diff -r1.6.2.6 -r1.6.2.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
diff -r1.7.6.3 -r1.7.6.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
diff -r1.1.12.4 -r1.1.12.5 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
diff -r1.17.6.7 -r1.17.6.8 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
diff -r1.11.6.7 -r1.11.6.8 src/sys/dev/pci/ixgbe/ixgbe_phy.c
diff -r1.2.2.4 -r1.2.2.5 src/sys/dev/pci/ixgbe/ixgbe_rss.h
diff -r1.1.4.4 -r1.1.4.5 src/sys/dev/pci/ixgbe/ixgbe_sriov.h
diff -r1.22.2.12 -r1.22.2.13 src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -r1.12.8.6 -r1.12.8.7 src/sys/dev/pci/ixgbe/ixgbe_vf.c
diff -r1.9.6.5 -r1.9.6.6 src/sys/dev/pci/ixgbe/ixgbe_x540.c
diff -r1.5.8.2 -r1.5.8.3 src/sys/dev/pci/ixgbe/ixgbe_x540.h
diff -r1.5.6.9 -r1.5.6.10 src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -r1.2.12.3 -r1.2.12.4 src/sys/dev/pci/ixgbe/ixgbe_x550.h
diff -r1.56.2.31 -r1.56.2.32 src/sys/dev/pci/ixgbe/ixv.c

cvs diff -r1.10.4.2 -r1.10.4.3 src/share/man/man4/ixg.4 (expand / switch to unified diff)

--- src/share/man/man4/ixg.4 2021/03/11 16:04:25 1.10.4.2
+++ src/share/man/man4/ixg.4 2021/09/15 16:38:01 1.10.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: ixg.4,v 1.10.4.2 2021/03/11 16:04:25 martin Exp $ 1.\" $NetBSD: ixg.4,v 1.10.4.3 2021/09/15 16:38:01 martin Exp $
2.\" 2.\"
3.\" Copyright (c) 2001-2008, Intel Corporation 3.\" Copyright (c) 2001-2008, Intel Corporation
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions are met: 7.\" modification, are permitted provided that the following conditions are met:
8.\" 8.\"
9.\" 1. Redistributions of source code must retain the above copyright notice, 9.\" 1. Redistributions of source code must retain the above copyright notice,
10.\" this list of conditions and the following disclaimer. 10.\" this list of conditions and the following disclaimer.
11.\" 11.\"
12.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the 13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution. 14.\" documentation and/or other materials provided with the distribution.
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30.\" POSSIBILITY OF SUCH DAMAGE. 30.\" POSSIBILITY OF SUCH DAMAGE.
31.\" 31.\"
32.\" * Other names and brands may be claimed as the property of others. 32.\" * Other names and brands may be claimed as the property of others.
33.\" 33.\"
34.\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.3 2010/12/19 23:54:31 yongari Exp $ 34.\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.3 2010/12/19 23:54:31 yongari Exp $
35.\" 35.\"
36.Dd March 9, 2021 36.Dd August 25, 2021
37.Dt IXG 4 37.Dt IXG 4
38.Os 38.Os
39.Sh NAME 39.Sh NAME
40.Nm ixg 40.Nm ixg
41.Nd Intel(R) 10Gb Ethernet driver 41.Nd Intel(R) 10Gb Ethernet driver
42.Sh SYNOPSIS 42.Sh SYNOPSIS
43.Cd "ixg* at pci? dev ? function ?" 43.Cd "ixg* at pci? dev ? function ?"
44.Sh DESCRIPTION 44.Sh DESCRIPTION
45The 45The
46.Nm 46.Nm
47driver provides support for PCI 10Gb Ethernet adapters based on 47driver provides support for PCI 10Gb Ethernet adapters based on
48the Intel(R) 82598EB, 82599, X540 and X550 Ethernet Controllers. 48the Intel(R) 82598EB, 82599, X540 and X550 Ethernet Controllers.
49The driver supports Jumbo Frames, TCP Segmentation Offload (TSO). 49The driver supports Jumbo Frames, TCP Segmentation Offload (TSO).
@@ -73,46 +73,26 @@ A fatal initialization error has occurre @@ -73,46 +73,26 @@ A fatal initialization error has occurre
73.It "ixg%d: watchdog timeout -- resetting" 73.It "ixg%d: watchdog timeout -- resetting"
74The device has stopped responding to the network, or there is a problem with 74The device has stopped responding to the network, or there is a problem with
75the network connection (cable). 75the network connection (cable).
76.El 76.El
77.Sh SUPPORT 77.Sh SUPPORT
78For general information and support, 78For general information and support,
79go to the Intel support website at: 79go to the Intel support website at:
80.Lk http://www.intel.com/support/ . 80.Lk http://www.intel.com/support/ .
81.\" .Pp 81.\" .Pp
82.\" If an issue is identified with the released source code on the supported kernel 82.\" If an issue is identified with the released source code on the supported kernel
83.\" with a supported adapter, email the specific information related to the 83.\" with a supported adapter, email the specific information related to the
84.\" issue to 84.\" issue to
85.\" .Aq freebsdnic@mailbox.intel.com . 85.\" .Aq freebsdnic@mailbox.intel.com .
86.Sh OPTIONS 
87The 
88.Nm 
89driver doesn't use the common 
90.Xr MCLGET 9 
91interface and use the driver specific cluster allocation mechanism. 
92If it's exhausted, the 
93.Xr evcnt 9 
94counter "ixgX qY Rx no jumbo mbuf" is incremented. 
95If this is observed, 
96the number can be changed by the following config parameter: 
97.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n 
98.It Dv IXGBE_JCLNUM_MULTI 
99The number of RX jumbo buffers (clusters) per queue is calculated by 
100.Dv IXGBE_JCLNUM_MULTI 
101* (number of rx descriptors). 
102The total number of clusters per queue is available via the 
103.Li hw.ixgN.num_jcl_per_queue 
104.Xr sysctl 7 . 
105.El 
106.Sh SEE ALSO 86.Sh SEE ALSO
107.Xr arp 4 , 87.Xr arp 4 ,
108.Xr ixv 4 , 88.Xr ixv 4 ,
109.Xr netintro 4 , 89.Xr netintro 4 ,
110.Xr vlan 4 , 90.Xr vlan 4 ,
111.Xr ifconfig 8 91.Xr ifconfig 8
112.Sh HISTORY 92.Sh HISTORY
113The 93The
114.Nm 94.Nm
115device driver comes from 95device driver comes from
116.Fx , 96.Fx ,
117where it is called 97where it is called
118.Nm ixgbe . 98.Nm ixgbe .

cvs diff -r1.3.2.4 -r1.3.2.5 src/share/man/man4/ixv.4 (expand / switch to unified diff)

--- src/share/man/man4/ixv.4 2021/03/11 16:04:25 1.3.2.4
+++ src/share/man/man4/ixv.4 2021/09/15 16:38:01 1.3.2.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: ixv.4,v 1.3.2.4 2021/03/11 16:04:25 martin Exp $ 1.\" $NetBSD: ixv.4,v 1.3.2.5 2021/09/15 16:38:01 martin Exp $
2.\" 2.\"
3.\" Copyright (c) 2018 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Masanobu SAITOH. 7.\" by Masanobu SAITOH.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -17,62 +17,42 @@ @@ -17,62 +17,42 @@
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE. 28.\" POSSIBILITY OF SUCH DAMAGE.
29.\" 29.\"
30.Dd March 9, 2021 30.Dd August 25, 2021
31.Dt IXV 4 31.Dt IXV 4
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm ixv 34.Nm ixv
35.Nd Intel 10 Gigabit Ethernet virtual function 35.Nd Intel 10 Gigabit Ethernet virtual function
36.Sh SYNOPSIS 36.Sh SYNOPSIS
37.Cd "ixv* at pci? dev ? function ?" 37.Cd "ixv* at pci? dev ? function ?"
38.Sh DESCRIPTION 38.Sh DESCRIPTION
39The 39The
40.Nm 40.Nm
41driver supports Intel 10 Gigabit Ethernet virtual function that 82599 and 41driver supports Intel 10 Gigabit Ethernet virtual function that 82599 and
42newer chips support. 42newer chips support.
43It can be used on a 43It can be used on a
44.Nx 44.Nx
45guest that the host supports SR-IOV. 45guest that the host supports SR-IOV.
46.Sh OPTIONS 
47The 
48.Nm 
49driver doesn't use the common 
50.Xr MCLGET 9 
51interface and use the driver specific cluster allocation mechanism. 
52If it's exhausted, the 
53.Xr evcnt 9 
54counter "ixgX qY Rx no jumbo mbuf" is incremented. 
55If this is observed, 
56the number can be changed by the following config parameter: 
57.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n 
58.It Dv IXGBE_JCLNUM_MULTI 
59The number of RX jumbo buffers (clusters) per queue is calculated by 
60.Dv IXGBE_JCLNUM_MULTI 
61* (number of rx descriptors). 
62The total number of clusters per queue is available with the 
63.Li hw.ixgN.num_jcl_per_queue 
64.Xr sysctl 7 . 
65.El 
66.Sh SEE ALSO 46.Sh SEE ALSO
67.Xr arp 4 , 47.Xr arp 4 ,
68.Xr ixg 4 , 48.Xr ixg 4 ,
69.Xr netintro 4 , 49.Xr netintro 4 ,
70.Xr vlan 4 , 50.Xr vlan 4 ,
71.Xr ifconfig 8 51.Xr ifconfig 8
72.Sh HISTORY 52.Sh HISTORY
73The 53The
74.Nm 54.Nm
75device driver comes from 55device driver comes from
76.Fx . 56.Fx .
77It first appeared in 57It first appeared in
78.Nx 8.0 . 58.Nx 8.0 .

cvs diff -r1.388.4.5 -r1.388.4.6 src/sys/dev/pci/files.pci (expand / switch to unified diff)

--- src/sys/dev/pci/files.pci 2021/03/11 16:04:24 1.388.4.5
+++ src/sys/dev/pci/files.pci 2021/09/15 16:38:00 1.388.4.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files.pci,v 1.388.4.5 2021/03/11 16:04:24 martin Exp $ 1# $NetBSD: files.pci,v 1.388.4.6 2021/09/15 16:38:00 martin Exp $
2# 2#
3# Config file and device description for machine-independent PCI code. 3# Config file and device description for machine-independent PCI code.
4# Included by ports that need it. Requires that the SCSI files be 4# Included by ports that need it. Requires that the SCSI files be
5# defined first. 5# defined first.
6 6
7defflag opt_pci.h PCIVERBOSE PCI_CONFIG_DUMP PCI_NETBSD_CONFIGURE 7defflag opt_pci.h PCIVERBOSE PCI_CONFIG_DUMP PCI_NETBSD_CONFIGURE
8defparam opt_pci.h PCI_NETBSD_ENABLE_IDE 8defparam opt_pci.h PCI_NETBSD_ENABLE_IDE
9 9
10defflag opt_bktr.h BKTR_430_FX_MODE BKTR_GPIO_ACCESS BKTR_NO_MSP_RESET 10defflag opt_bktr.h BKTR_430_FX_MODE BKTR_GPIO_ACCESS BKTR_NO_MSP_RESET
11 BKTR_REVERSE_MUTE BKTR_SIS_VIA_MODE BKTR_USE_PLL 11 BKTR_REVERSE_MUTE BKTR_SIS_VIA_MODE BKTR_USE_PLL
12defparam opt_bktr.h BKTR_OVERRIDE_CARD BKTR_OVERRIDE_TUNER BKTR_OVERRIDE_DBX 12defparam opt_bktr.h BKTR_OVERRIDE_CARD BKTR_OVERRIDE_TUNER BKTR_OVERRIDE_DBX
13 BKTR_OVERRIDE_MSP BKTR_SYSTEM_DEFAULT 13 BKTR_OVERRIDE_MSP BKTR_SYSTEM_DEFAULT
14 14
@@ -677,27 +677,26 @@ file dev/pci/ixgbe/ix_txrx.c ixg | ixv @@ -677,27 +677,26 @@ file dev/pci/ixgbe/ix_txrx.c ixg | ixv
677file dev/pci/ixgbe/ixgbe_netbsd.c ixg | ixv 677file dev/pci/ixgbe/ixgbe_netbsd.c ixg | ixv
678file dev/pci/ixgbe/ixgbe_82598.c ixg | ixv 678file dev/pci/ixgbe/ixgbe_82598.c ixg | ixv
679file dev/pci/ixgbe/ixgbe_82599.c ixg | ixv 679file dev/pci/ixgbe/ixgbe_82599.c ixg | ixv
680file dev/pci/ixgbe/ixgbe_x540.c ixg | ixv 680file dev/pci/ixgbe/ixgbe_x540.c ixg | ixv
681file dev/pci/ixgbe/ixgbe_x550.c ixg | ixv 681file dev/pci/ixgbe/ixgbe_x550.c ixg | ixv
682file dev/pci/ixgbe/ixgbe_api.c ixg | ixv 682file dev/pci/ixgbe/ixgbe_api.c ixg | ixv
683file dev/pci/ixgbe/ixgbe_common.c ixg | ixv 683file dev/pci/ixgbe/ixgbe_common.c ixg | ixv
684file dev/pci/ixgbe/ixgbe_mbx.c ixg | ixv 684file dev/pci/ixgbe/ixgbe_mbx.c ixg | ixv
685file dev/pci/ixgbe/ixgbe_osdep.c ixg | ixv 685file dev/pci/ixgbe/ixgbe_osdep.c ixg | ixv
686file dev/pci/ixgbe/ixgbe_phy.c ixg | ixv 686file dev/pci/ixgbe/ixgbe_phy.c ixg | ixv
687file dev/pci/ixgbe/ixgbe_vf.c ixg | ixv 687file dev/pci/ixgbe/ixgbe_vf.c ixg | ixv
688file dev/pci/ixgbe/if_bypass.c ixg | ixv 688file dev/pci/ixgbe/if_bypass.c ixg | ixv
689file dev/pci/ixgbe/if_fdir.c ixg | ixv 689file dev/pci/ixgbe/if_fdir.c ixg | ixv
690defparam opt_ixgbe.h IXGBE_JCLNUM_MULTI 
691 690
692# This appears to be the driver for virtual instances of i82599. 691# This appears to be the driver for virtual instances of i82599.
693device ixv: ether, ifnet, arp, mii, mii_phy 692device ixv: ether, ifnet, arp, mii, mii_phy
694attach ixv at pci 693attach ixv at pci
695file dev/pci/ixgbe/ixv.c ixv 694file dev/pci/ixgbe/ixv.c ixv
696 695
697# Intel i8254x Gigabit Ethernet 696# Intel i8254x Gigabit Ethernet
698device wm: ether, ifnet, arp, mii, mii_bitbang 697device wm: ether, ifnet, arp, mii, mii_bitbang
699attach wm at pci 698attach wm at pci
700file dev/pci/if_wm.c wm 699file dev/pci/if_wm.c wm
701defflag opt_if_wm.h WM_EVENT_COUNTERS 700defflag opt_if_wm.h WM_EVENT_COUNTERS
702defparam opt_if_wm.h WM_RX_PROCESS_LIMIT_DEFAULT 701defparam opt_if_wm.h WM_RX_PROCESS_LIMIT_DEFAULT
703 WM_RX_INTR_PROCESS_LIMIT_DEFAULT 702 WM_RX_INTR_PROCESS_LIMIT_DEFAULT

cvs diff -r1.2.4.6 -r1.2.4.7 src/sys/dev/pci/ixgbe/if_bypass.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/if_bypass.c 2020/09/02 12:24:08 1.2.4.6
+++ src/sys/dev/pci/ixgbe/if_bypass.c 2021/09/15 16:38:00 1.2.4.7
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: if_bypass.c,v 1.2.4.7 2021/09/15 16:38:00 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the
@@ -22,26 +23,28 @@ @@ -22,26 +23,28 @@
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE. 31 POSSIBILITY OF SUCH DAMAGE.
31 32
32******************************************************************************/ 33******************************************************************************/
33/*$FreeBSD: head/sys/dev/ixgbe/if_bypass.c 327031 2017-12-20 18:15:06Z erj $*/ 34/*$FreeBSD: head/sys/dev/ixgbe/if_bypass.c 327031 2017-12-20 18:15:06Z erj $*/
34 35
 36#include <sys/cdefs.h>
 37__KERNEL_RCSID(0, "$NetBSD: if_bypass.c,v 1.2.4.7 2021/09/15 16:38:00 martin Exp $");
35 38
36#include "ixgbe.h" 39#include "ixgbe.h"
37 40
38/************************************************************************ 41/************************************************************************
39 * ixgbe_bypass_mutex_enter 42 * ixgbe_bypass_mutex_enter
40 * 43 *
41 * Mutex support for the bypass feature. Using a dual lock 44 * Mutex support for the bypass feature. Using a dual lock
42 * to facilitate a privileged access to the watchdog update 45 * to facilitate a privileged access to the watchdog update
43 * over other threads. 46 * over other threads.
44 ************************************************************************/ 47 ************************************************************************/
45static void 48static void
46ixgbe_bypass_mutex_enter(struct adapter *adapter) 49ixgbe_bypass_mutex_enter(struct adapter *adapter)
47{ 50{
@@ -659,27 +662,27 @@ ixgbe_bp_log(SYSCTLFN_ARGS) @@ -659,27 +662,27 @@ ixgbe_bp_log(SYSCTLFN_ARGS)
659 u32 time = eeprom[count].logs & BYPASS_LOG_TIME_M; 662 u32 time = eeprom[count].logs & BYPASS_LOG_TIME_M;
660 u32 event = (eeprom[count].logs & BYPASS_LOG_EVENT_M) >> 663 u32 event = (eeprom[count].logs & BYPASS_LOG_EVENT_M) >>
661 BYPASS_LOG_EVENT_SHIFT; 664 BYPASS_LOG_EVENT_SHIFT;
662 u8 action = eeprom[count].actions & BYPASS_LOG_ACTION_M; 665 u8 action = eeprom[count].actions & BYPASS_LOG_ACTION_M;
663 u16 day_mon[2][13] = { 666 u16 day_mon[2][13] = {
664 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, 667 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
665 {0, 31, 59, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} 668 {0, 31, 59, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
666 }; 669 };
667 const char *event_str[] = {"unknown", "main on", "aux on", 670 const char *event_str[] = {"unknown", "main on", "aux on",
668 "main off", "aux off", "WDT", "user" }; 671 "main off", "aux off", "WDT", "user" };
669 const char *action_str[] = {"ignore", "normal", "bypass", 672 const char *action_str[] = {"ignore", "normal", "bypass",
670 "isolate",}; 673 "isolate",};
671 674
672 /* verify vaild data 1 - 6 */ 675 /* verify valid data 1 - 6 */
673 if (event < BYPASS_EVENT_MAIN_ON || event > BYPASS_EVENT_USR) 676 if (event < BYPASS_EVENT_MAIN_ON || event > BYPASS_EVENT_USR)
674 event = 0; 677 event = 0;
675 678
676 /* 679 /*
677 * time is in sec's this year, so convert to something 680 * time is in sec's this year, so convert to something
678 * printable. 681 * printable.
679 */ 682 */
680 ixgbe_get_bypass_time(&year, &sec); 683 ixgbe_get_bypass_time(&year, &sec);
681 days = time / SEC_PER_DAY; 684 days = time / SEC_PER_DAY;
682 for (i = 11; days < day_mon[LEAP_YR(year)][i]; i--) 685 for (i = 11; days < day_mon[LEAP_YR(year)][i]; i--)
683 continue; 686 continue;
684 mon = i + 1; /* display month as 1-12 */ 687 mon = i + 1; /* display month as 1-12 */
685 time -= (day_mon[LEAP_YR(year)][i] * SEC_PER_DAY); 688 time -= (day_mon[LEAP_YR(year)][i] * SEC_PER_DAY);

cvs diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/if_fdir.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/if_fdir.c 2018/04/14 10:25:11 1.1.4.3
+++ src/sys/dev/pci/ixgbe/if_fdir.c 2021/09/15 16:38:00 1.1.4.4
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: if_fdir.c,v 1.1.4.4 2021/09/15 16:38:00 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the
@@ -22,26 +23,29 @@ @@ -22,26 +23,29 @@
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE. 31 POSSIBILITY OF SUCH DAMAGE.
31 32
32******************************************************************************/ 33******************************************************************************/
33/*$FreeBSD: head/sys/dev/ixgbe/if_fdir.c 327031 2017-12-20 18:15:06Z erj $*/ 34/*$FreeBSD: head/sys/dev/ixgbe/if_fdir.c 327031 2017-12-20 18:15:06Z erj $*/
34 35
 36#include <sys/cdefs.h>
 37__KERNEL_RCSID(0, "$NetBSD: if_fdir.c,v 1.1.4.4 2021/09/15 16:38:00 martin Exp $");
 38
35#include "ixgbe.h" 39#include "ixgbe.h"
36 40
37#ifdef IXGBE_FDIR 41#ifdef IXGBE_FDIR
38 42
39void 43void
40ixgbe_init_fdir(struct adapter *adapter) 44ixgbe_init_fdir(struct adapter *adapter)
41{ 45{
42 u32 hdrm = 32 << fdir_pballoc; 46 u32 hdrm = 32 << fdir_pballoc;
43 47
44 if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) 48 if (!(adapter->feat_en & IXGBE_FEATURE_FDIR))
45 return; 49 return;
46 50
47 adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm, 51 adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm,

cvs diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_fdir.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_fdir.h 2018/04/14 10:25:11 1.1.4.3
+++ src/sys/dev/pci/ixgbe/ixgbe_fdir.h 2021/09/15 16:38:01 1.1.4.4
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_fdir.h,v 1.1.4.4 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the

cvs diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_features.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_features.h 2019/07/22 17:53:35 1.1.4.3
+++ src/sys/dev/pci/ixgbe/ixgbe_features.h 2021/09/15 16:38:01 1.1.4.4
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_features.h,v 1.1.4.4 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the

cvs diff -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_netmap.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_netmap.c 2019/07/22 17:53:35 1.1.4.3
+++ src/sys/dev/pci/ixgbe/ixgbe_netmap.c 2021/09/15 16:38:01 1.1.4.4
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_netmap.c,v 1.1.4.4 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the
@@ -59,26 +60,29 @@ @@ -59,26 +60,29 @@
59 60
60/* 61/*
61 * $FreeBSD: head/sys/dev/ixgbe/ixgbe_netmap.c 320688 2017-07-05 17:27:03Z erj $ 62 * $FreeBSD: head/sys/dev/ixgbe/ixgbe_netmap.c 320688 2017-07-05 17:27:03Z erj $
62 * 63 *
63 * netmap support for: ixgbe 64 * netmap support for: ixgbe
64 * 65 *
65 * This file is meant to be a reference on how to implement 66 * This file is meant to be a reference on how to implement
66 * netmap support for a network driver. 67 * netmap support for a network driver.
67 * This file contains code but only static or inline functions used 68 * This file contains code but only static or inline functions used
68 * by a single driver. To avoid replication of code we just #include 69 * by a single driver. To avoid replication of code we just #include
69 * it near the beginning of the standard driver. 70 * it near the beginning of the standard driver.
70 */ 71 */
71 72
 73#include <sys/cdefs.h>
 74__KERNEL_RCSID(0, "$NetBSD: ixgbe_netmap.c,v 1.1.4.4 2021/09/15 16:38:01 martin Exp $");
 75
72#ifdef DEV_NETMAP 76#ifdef DEV_NETMAP
73/* 77/*
74 * Some drivers may need the following headers. Others 78 * Some drivers may need the following headers. Others
75 * already include them by default 79 * already include them by default
76 80
77#include <vm/vm.h> 81#include <vm/vm.h>
78#include <vm/pmap.h> 82#include <vm/pmap.h>
79 83
80 */ 84 */
81#include "ixgbe.h" 85#include "ixgbe.h"
82 86
83/* 87/*
84 * device-specific sysctl variables: 88 * device-specific sysctl variables:

cvs diff -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/if_sriov.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/if_sriov.c 2019/07/22 17:53:35 1.1.4.5
+++ src/sys/dev/pci/ixgbe/if_sriov.c 2021/09/15 16:38:00 1.1.4.6
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: if_sriov.c,v 1.1.4.6 2021/09/15 16:38:00 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the
@@ -22,26 +23,29 @@ @@ -22,26 +23,29 @@
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE. 31 POSSIBILITY OF SUCH DAMAGE.
31 32
32******************************************************************************/ 33******************************************************************************/
33/*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/ 34/*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/
34 35
 36#include <sys/cdefs.h>
 37__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.1.4.6 2021/09/15 16:38:00 martin Exp $");
 38
35#include "ixgbe.h" 39#include "ixgbe.h"
36#include "ixgbe_sriov.h" 40#include "ixgbe_sriov.h"
37 41
38#ifdef PCI_IOV 42#ifdef PCI_IOV
39 43
40MALLOC_DEFINE(M_IXGBE_SRIOV, "ix_sriov", "ix SR-IOV allocations"); 44MALLOC_DEFINE(M_IXGBE_SRIOV, "ix_sriov", "ix SR-IOV allocations");
41 45
42/************************************************************************ 46/************************************************************************
43 * ixgbe_pci_iov_detach 47 * ixgbe_pci_iov_detach
44 ************************************************************************/ 48 ************************************************************************/
45int 49int
46ixgbe_pci_iov_detach(device_t dev) 50ixgbe_pci_iov_detach(device_t dev)
47{ 51{

cvs diff -r1.24.2.21 -r1.24.2.22 src/sys/dev/pci/ixgbe/ix_txrx.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ix_txrx.c 2021/03/11 16:04:25 1.24.2.21
+++ src/sys/dev/pci/ixgbe/ix_txrx.c 2021/09/15 16:38:00 1.24.2.22
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ix_txrx.c,v 1.24.2.21 2021/03/11 16:04:25 martin Exp $ */ 1/* $NetBSD: ix_txrx.c,v 1.24.2.22 2021/09/15 16:38:00 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 4
5 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
6 All rights reserved. 6 All rights reserved.
7 7
8 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
10 10
11 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
13 13
14 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -53,26 +53,29 @@ @@ -53,26 +53,29 @@
53 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 53 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
63 * POSSIBILITY OF SUCH DAMAGE. 63 * POSSIBILITY OF SUCH DAMAGE.
64 */ 64 */
65 65
 66#include <sys/cdefs.h>
 67__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.22 2021/09/15 16:38:00 martin Exp $");
 68
66#include "opt_inet.h" 69#include "opt_inet.h"
67#include "opt_inet6.h" 70#include "opt_inet6.h"
68 71
69#include "ixgbe.h" 72#include "ixgbe.h"
70 73
71/* 74/*
72 * HW RSC control: 75 * HW RSC control:
73 * this feature only works with 76 * this feature only works with
74 * IPv4, and only on 82599 and later. 77 * IPv4, and only on 82599 and later.
75 * Also this will cause IP forwarding to 78 * Also this will cause IP forwarding to
76 * fail and that can't be controlled by 79 * fail and that can't be controlled by
77 * the stack as LRO can. For all these 80 * the stack as LRO can. For all these
78 * reasons I've deemed it best to leave 81 * reasons I've deemed it best to leave
@@ -83,26 +86,30 @@ @@ -83,26 +86,30 @@
83static bool ixgbe_rsc_enable = FALSE; 86static bool ixgbe_rsc_enable = FALSE;
84 87
85/* 88/*
86 * For Flow Director: this is the 89 * For Flow Director: this is the
87 * number of TX packets we sample 90 * number of TX packets we sample
88 * for the filter pool, this means 91 * for the filter pool, this means
89 * every 20th packet will be probed. 92 * every 20th packet will be probed.
90 * 93 *
91 * This feature can be disabled by 94 * This feature can be disabled by
92 * setting this to 0. 95 * setting this to 0.
93 */ 96 */
94static int atr_sample_rate = 20; 97static int atr_sample_rate = 20;
95 98
 99#define IXGBE_M_ADJ(adapter, rxr, mp) \
 100 if (adapter->max_frame_size <= (rxr->mbuf_sz - ETHER_ALIGN)) \
 101 m_adj(mp, ETHER_ALIGN)
 102
96/************************************************************************ 103/************************************************************************
97 * Local Function prototypes 104 * Local Function prototypes
98 ************************************************************************/ 105 ************************************************************************/
99static void ixgbe_setup_transmit_ring(struct tx_ring *); 106static void ixgbe_setup_transmit_ring(struct tx_ring *);
100static void ixgbe_free_transmit_buffers(struct tx_ring *); 107static void ixgbe_free_transmit_buffers(struct tx_ring *);
101static int ixgbe_setup_receive_ring(struct rx_ring *); 108static int ixgbe_setup_receive_ring(struct rx_ring *);
102static void ixgbe_free_receive_buffers(struct rx_ring *); 109static void ixgbe_free_receive_buffers(struct rx_ring *);
103static void ixgbe_rx_checksum(u32, struct mbuf *, u32, 110static void ixgbe_rx_checksum(u32, struct mbuf *, u32,
104 struct ixgbe_hw_stats *); 111 struct ixgbe_hw_stats *);
105static void ixgbe_refresh_mbufs(struct rx_ring *, int); 112static void ixgbe_refresh_mbufs(struct rx_ring *, int);
106static void ixgbe_drain(struct ifnet *, struct tx_ring *); 113static void ixgbe_drain(struct ifnet *, struct tx_ring *);
107static int ixgbe_xmit(struct tx_ring *, struct mbuf *); 114static int ixgbe_xmit(struct tx_ring *, struct mbuf *);
108static int ixgbe_tx_ctx_setup(struct tx_ring *, 115static int ixgbe_tx_ctx_setup(struct tx_ring *,
@@ -192,27 +199,27 @@ ixgbe_legacy_start(struct ifnet *ifp) @@ -192,27 +199,27 @@ ixgbe_legacy_start(struct ifnet *ifp)
192 } 199 }
193} /* ixgbe_legacy_start */ 200} /* ixgbe_legacy_start */
194 201
195/************************************************************************ 202/************************************************************************
196 * ixgbe_mq_start - Multiqueue Transmit Entry Point 203 * ixgbe_mq_start - Multiqueue Transmit Entry Point
197 * 204 *
198 * (if_transmit function) 205 * (if_transmit function)
199 ************************************************************************/ 206 ************************************************************************/
200int 207int
201ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m) 208ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m)
202{ 209{
203 struct adapter *adapter = ifp->if_softc; 210 struct adapter *adapter = ifp->if_softc;
204 struct tx_ring *txr; 211 struct tx_ring *txr;
205 int i; 212 int i;
206#ifdef RSS 213#ifdef RSS
207 uint32_t bucket_id; 214 uint32_t bucket_id;
208#endif 215#endif
209 216
210 /* 217 /*
211 * When doing RSS, map it to the same outbound queue 218 * When doing RSS, map it to the same outbound queue
212 * as the incoming flow would be mapped to. 219 * as the incoming flow would be mapped to.
213 * 220 *
214 * If everything is setup correctly, it should be the 221 * If everything is setup correctly, it should be the
215 * same bucket that the current CPU we're on is. 222 * same bucket that the current CPU we're on is.
216 */ 223 */
217#ifdef RSS 224#ifdef RSS
218 if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { 225 if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
@@ -472,41 +479,43 @@ retry: @@ -472,41 +479,43 @@ retry:
472 ixgbe_dmamap_unload(txr->txtag, txbuf->map); 479 ixgbe_dmamap_unload(txr->txtag, txbuf->map);
473 return EAGAIN; 480 return EAGAIN;
474 } 481 }
475 482
476 /* 483 /*
477 * Set up the appropriate offload context 484 * Set up the appropriate offload context
478 * this will consume the first descriptor 485 * this will consume the first descriptor
479 */ 486 */
480 error = ixgbe_tx_ctx_setup(txr, m_head, &cmd_type_len, &olinfo_status); 487 error = ixgbe_tx_ctx_setup(txr, m_head, &cmd_type_len, &olinfo_status);
481 if (__predict_false(error)) { 488 if (__predict_false(error)) {
482 return (error); 489 return (error);
483 } 490 }
484 491
 492#ifdef IXGBE_FDIR
485 /* Do the flow director magic */ 493 /* Do the flow director magic */
486 if ((adapter->feat_en & IXGBE_FEATURE_FDIR) && 494 if ((adapter->feat_en & IXGBE_FEATURE_FDIR) &&
487 (txr->atr_sample) && (!adapter->fdir_reinit)) { 495 (txr->atr_sample) && (!adapter->fdir_reinit)) {
488 ++txr->atr_count; 496 ++txr->atr_count;
489 if (txr->atr_count >= atr_sample_rate) { 497 if (txr->atr_count >= atr_sample_rate) {
490 ixgbe_atr(txr, m_head); 498 ixgbe_atr(txr, m_head);
491 txr->atr_count = 0; 499 txr->atr_count = 0;
492 } 500 }
493 } 501 }
 502#endif
494 503
495 olinfo_status |= IXGBE_ADVTXD_CC; 504 olinfo_status |= IXGBE_ADVTXD_CC;
496 i = txr->next_avail_desc; 505 i = txr->next_avail_desc;
497 for (j = 0; j < map->dm_nsegs; j++) { 506 for (j = 0; j < map->dm_nsegs; j++) {
498 bus_size_t seglen; 507 bus_size_t seglen;
499 bus_addr_t segaddr; 508 uint64_t segaddr;
500 509
501 txbuf = &txr->tx_buffers[i]; 510 txbuf = &txr->tx_buffers[i];
502 txd = &txr->tx_base[i]; 511 txd = &txr->tx_base[i];
503 seglen = map->dm_segs[j].ds_len; 512 seglen = map->dm_segs[j].ds_len;
504 segaddr = htole64(map->dm_segs[j].ds_addr); 513 segaddr = htole64(map->dm_segs[j].ds_addr);
505 514
506 txd->read.buffer_addr = segaddr; 515 txd->read.buffer_addr = segaddr;
507 txd->read.cmd_type_len = htole32(cmd_type_len | seglen); 516 txd->read.cmd_type_len = htole32(cmd_type_len | seglen);
508 txd->read.olinfo_status = htole32(olinfo_status); 517 txd->read.olinfo_status = htole32(olinfo_status);
509 518
510 if (++i == txr->num_desc) 519 if (++i == txr->num_desc)
511 i = 0; 520 i = 0;
512 } 521 }
@@ -1117,52 +1126,52 @@ ixgbe_txeof(struct tx_ring *txr) @@ -1117,52 +1126,52 @@ ixgbe_txeof(struct tx_ring *txr)
1117 * of the client thread. Interrupt handlers only wake up 1126 * of the client thread. Interrupt handlers only wake up
1118 * clients, which may be sleeping on individual rings 1127 * clients, which may be sleeping on individual rings
1119 * or on a global resource for all rings. 1128 * or on a global resource for all rings.
1120 * To implement tx interrupt mitigation, we wake up the client 1129 * To implement tx interrupt mitigation, we wake up the client
1121 * thread roughly every half ring, even if the NIC interrupts 1130 * thread roughly every half ring, even if the NIC interrupts
1122 * more frequently. This is implemented as follows: 1131 * more frequently. This is implemented as follows:
1123 * - ixgbe_txsync() sets kring->nr_kflags with the index of 1132 * - ixgbe_txsync() sets kring->nr_kflags with the index of
1124 * the slot that should wake up the thread (nkr_num_slots 1133 * the slot that should wake up the thread (nkr_num_slots
1125 * means the user thread should not be woken up); 1134 * means the user thread should not be woken up);
1126 * - the driver ignores tx interrupts unless netmap_mitigate=0 1135 * - the driver ignores tx interrupts unless netmap_mitigate=0
1127 * or the slot has the DD bit set. 1136 * or the slot has the DD bit set.
1128 */ 1137 */
1129 if (kring->nr_kflags < kring->nkr_num_slots && 1138 if (kring->nr_kflags < kring->nkr_num_slots &&
1130 txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD) { 1139 le32toh(txd[kring->nr_kflags].wb.status) & IXGBE_TXD_STAT_DD) {
1131 netmap_tx_irq(ifp, txr->me); 1140 netmap_tx_irq(ifp, txr->me);
1132 } 1141 }
1133 return false; 1142 return false;
1134 } 1143 }
1135#endif /* DEV_NETMAP */ 1144#endif /* DEV_NETMAP */
1136 1145
1137 if (txr->tx_avail == txr->num_desc) { 1146 if (txr->tx_avail == txr->num_desc) {
1138 txr->busy = 0; 1147 txr->busy = 0;
1139 return false; 1148 return false;
1140 } 1149 }
1141 1150
1142 /* Get work starting point */ 1151 /* Get work starting point */
1143 work = txr->next_to_clean; 1152 work = txr->next_to_clean;
1144 buf = &txr->tx_buffers[work]; 1153 buf = &txr->tx_buffers[work];
1145 txd = &txr->tx_base[work]; 1154 txd = &txr->tx_base[work];
1146 work -= txr->num_desc; /* The distance to ring end */ 1155 work -= txr->num_desc; /* The distance to ring end */
1147 ixgbe_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, 1156 ixgbe_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map,
1148 BUS_DMASYNC_POSTREAD); 1157 BUS_DMASYNC_POSTREAD);
1149 1158
1150 do { 1159 do {
1151 union ixgbe_adv_tx_desc *eop = buf->eop; 1160 union ixgbe_adv_tx_desc *eop = buf->eop;
1152 if (eop == NULL) /* No work */ 1161 if (eop == NULL) /* No work */
1153 break; 1162 break;
1154 1163
1155 if ((eop->wb.status & IXGBE_TXD_STAT_DD) == 0) 1164 if ((le32toh(eop->wb.status) & IXGBE_TXD_STAT_DD) == 0)
1156 break; /* I/O not complete */ 1165 break; /* I/O not complete */
1157 1166
1158 if (buf->m_head) { 1167 if (buf->m_head) {
1159 txr->bytes += buf->m_head->m_pkthdr.len; 1168 txr->bytes += buf->m_head->m_pkthdr.len;
1160 bus_dmamap_sync(txr->txtag->dt_dmat, buf->map, 1169 bus_dmamap_sync(txr->txtag->dt_dmat, buf->map,
1161 0, buf->m_head->m_pkthdr.len, 1170 0, buf->m_head->m_pkthdr.len,
1162 BUS_DMASYNC_POSTWRITE); 1171 BUS_DMASYNC_POSTWRITE);
1163 ixgbe_dmamap_unload(txr->txtag, buf->map); 1172 ixgbe_dmamap_unload(txr->txtag, buf->map);
1164 m_freem(buf->m_head); 1173 m_freem(buf->m_head);
1165 buf->m_head = NULL; 1174 buf->m_head = NULL;
1166 } 1175 }
1167 buf->eop = NULL; 1176 buf->eop = NULL;
1168 txr->txr_no_space = false; 1177 txr->txr_no_space = false;
@@ -1318,92 +1327,88 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) @@ -1318,92 +1327,88 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr)
1318 rxr->hw_rsc = TRUE; 1327 rxr->hw_rsc = TRUE;
1319} /* ixgbe_setup_hw_rsc */ 1328} /* ixgbe_setup_hw_rsc */
1320 1329
1321/************************************************************************ 1330/************************************************************************
1322 * ixgbe_refresh_mbufs 1331 * ixgbe_refresh_mbufs
1323 * 1332 *
1324 * Refresh mbuf buffers for RX descriptor rings 1333 * Refresh mbuf buffers for RX descriptor rings
1325 * - now keeps its own state so discards due to resource 1334 * - now keeps its own state so discards due to resource
1326 * exhaustion are unnecessary, if an mbuf cannot be obtained 1335 * exhaustion are unnecessary, if an mbuf cannot be obtained
1327 * it just returns, keeping its placeholder, thus it can simply 1336 * it just returns, keeping its placeholder, thus it can simply
1328 * be recalled to try again. 1337 * be recalled to try again.
1329 * 1338 *
1330 * XXX NetBSD TODO: 1339 * XXX NetBSD TODO:
1331 * - The ixgbe_rxeof() function always preallocates mbuf cluster (jcl), 1340 * - The ixgbe_rxeof() function always preallocates mbuf cluster,
1332 * so the ixgbe_refresh_mbufs() function can be simplified. 1341 * so the ixgbe_refresh_mbufs() function can be simplified.
1333 * 1342 *
1334 ************************************************************************/ 1343 ************************************************************************/
1335static void 1344static void
1336ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) 1345ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)
1337{ 1346{
1338 struct adapter *adapter = rxr->adapter; 1347 struct adapter *adapter = rxr->adapter;
1339 struct ixgbe_rx_buf *rxbuf; 1348 struct ixgbe_rx_buf *rxbuf;
1340 struct mbuf *mp; 1349 struct mbuf *mp;
1341 int i, j, error; 1350 int i, error;
1342 bool refreshed = false; 1351 bool refreshed = false;
1343 1352
1344 i = j = rxr->next_to_refresh; 1353 i = rxr->next_to_refresh;
1345 /* Control the loop with one beyond */ 1354 /* next_to_refresh points to the previous one */
1346 if (++j == rxr->num_desc) 1355 if (++i == rxr->num_desc)
1347 j = 0; 1356 i = 0;
1348 1357
1349 while (j != limit) { 1358 while (i != limit) {
1350 rxbuf = &rxr->rx_buffers[i]; 1359 rxbuf = &rxr->rx_buffers[i];
1351 if (rxbuf->buf == NULL) { 1360 if (__predict_false(rxbuf->buf == NULL)) {
1352 mp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, 1361 mp = ixgbe_getcl();
1353 MT_DATA, M_PKTHDR, rxr->mbuf_sz); 
1354 if (mp == NULL) { 1362 if (mp == NULL) {
1355 rxr->no_jmbuf.ev_count++; 1363 rxr->no_mbuf.ev_count++;
1356 goto update; 1364 goto update;
1357 } 1365 }
1358 if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) 1366 mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz;
1359 m_adj(mp, ETHER_ALIGN); 1367 IXGBE_M_ADJ(adapter, rxr, mp);
1360 } else 1368 } else
1361 mp = rxbuf->buf; 1369 mp = rxbuf->buf;
1362 1370
1363 mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz; 
1364 
1365 /* If we're dealing with an mbuf that was copied rather 1371 /* If we're dealing with an mbuf that was copied rather
1366 * than replaced, there's no need to go through busdma. 1372 * than replaced, there's no need to go through busdma.
1367 */ 1373 */
1368 if ((rxbuf->flags & IXGBE_RX_COPY) == 0) { 1374 if ((rxbuf->flags & IXGBE_RX_COPY) == 0) {
1369 /* Get the memory mapping */ 1375 /* Get the memory mapping */
1370 ixgbe_dmamap_unload(rxr->ptag, rxbuf->pmap); 1376 ixgbe_dmamap_unload(rxr->ptag, rxbuf->pmap);
1371 error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat, 1377 error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat,
1372 rxbuf->pmap, mp, BUS_DMA_NOWAIT); 1378 rxbuf->pmap, mp, BUS_DMA_NOWAIT);
1373 if (error != 0) { 1379 if (__predict_false(error != 0)) {
1374 device_printf(adapter->dev, "Refresh mbufs: " 1380 device_printf(adapter->dev, "Refresh mbufs: "
1375 "payload dmamap load failure - %d\n", 1381 "payload dmamap load failure - %d\n",
1376 error); 1382 error);
1377 m_free(mp); 1383 m_free(mp);
1378 rxbuf->buf = NULL; 1384 rxbuf->buf = NULL;
1379 goto update; 1385 goto update;
1380 } 1386 }
1381 rxbuf->buf = mp; 1387 rxbuf->buf = mp;
1382 bus_dmamap_sync(rxr->ptag->dt_dmat, rxbuf->pmap, 1388 bus_dmamap_sync(rxr->ptag->dt_dmat, rxbuf->pmap,
1383 0, mp->m_pkthdr.len, BUS_DMASYNC_PREREAD); 1389 0, mp->m_pkthdr.len, BUS_DMASYNC_PREREAD);
1384 rxbuf->addr = rxr->rx_base[i].read.pkt_addr = 1390 rxbuf->addr = rxr->rx_base[i].read.pkt_addr =
1385 htole64(rxbuf->pmap->dm_segs[0].ds_addr); 1391 htole64(rxbuf->pmap->dm_segs[0].ds_addr);
1386 } else { 1392 } else {
1387 rxr->rx_base[i].read.pkt_addr = rxbuf->addr; 1393 rxr->rx_base[i].read.pkt_addr = rxbuf->addr;
1388 rxbuf->flags &= ~IXGBE_RX_COPY; 1394 rxbuf->flags &= ~IXGBE_RX_COPY;
1389 } 1395 }
1390 1396
1391 refreshed = true; 1397 refreshed = true;
1392 /* Next is precalculated */ 1398 /* next_to_refresh points to the previous one */
1393 i = j; 
1394 rxr->next_to_refresh = i; 1399 rxr->next_to_refresh = i;
1395 if (++j == rxr->num_desc) 1400 if (++i == rxr->num_desc)
1396 j = 0; 1401 i = 0;
1397 } 1402 }
1398 1403
1399update: 1404update:
1400 if (refreshed) /* Update hardware tail index */ 1405 if (refreshed) /* Update hardware tail index */
1401 IXGBE_WRITE_REG(&adapter->hw, rxr->tail, rxr->next_to_refresh); 1406 IXGBE_WRITE_REG(&adapter->hw, rxr->tail, rxr->next_to_refresh);
1402 1407
1403 return; 1408 return;
1404} /* ixgbe_refresh_mbufs */ 1409} /* ixgbe_refresh_mbufs */
1405 1410
1406/************************************************************************ 1411/************************************************************************
1407 * ixgbe_allocate_receive_buffers 1412 * ixgbe_allocate_receive_buffers
1408 * 1413 *
1409 * Allocate memory for rx_buffer structures. Since we use one 1414 * Allocate memory for rx_buffer structures. Since we use one
@@ -1503,37 +1508,26 @@ ixgbe_setup_receive_ring(struct rx_ring  @@ -1503,37 +1508,26 @@ ixgbe_setup_receive_ring(struct rx_ring
1503 if (adapter->feat_en & IXGBE_FEATURE_NETMAP) 1508 if (adapter->feat_en & IXGBE_FEATURE_NETMAP)
1504 slot = netmap_reset(na, NR_RX, rxr->me, 0); 1509 slot = netmap_reset(na, NR_RX, rxr->me, 0);
1505#endif /* DEV_NETMAP */ 1510#endif /* DEV_NETMAP */
1506 1511
1507 rsize = roundup2(adapter->num_rx_desc * 1512 rsize = roundup2(adapter->num_rx_desc *
1508 sizeof(union ixgbe_adv_rx_desc), DBA_ALIGN); 1513 sizeof(union ixgbe_adv_rx_desc), DBA_ALIGN);
1509 bzero((void *)rxr->rx_base, rsize); 1514 bzero((void *)rxr->rx_base, rsize);
1510 /* Cache the size */ 1515 /* Cache the size */
1511 rxr->mbuf_sz = adapter->rx_mbuf_sz; 1516 rxr->mbuf_sz = adapter->rx_mbuf_sz;
1512 1517
1513 /* Free current RX buffer structs and their mbufs */ 1518 /* Free current RX buffer structs and their mbufs */
1514 ixgbe_free_receive_ring(rxr); 1519 ixgbe_free_receive_ring(rxr);
1515 1520
1516 IXGBE_RX_UNLOCK(rxr); 
1517 /* 
1518 * Now reinitialize our supply of jumbo mbufs. The number 
1519 * or size of jumbo mbufs may have changed. 
1520 * Assume all of rxr->ptag are the same. 
1521 */ 
1522 ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr, 
1523 adapter->num_jcl, adapter->rx_mbuf_sz); 
1524 
1525 IXGBE_RX_LOCK(rxr); 
1526 
1527 /* Now replenish the mbufs */ 1521 /* Now replenish the mbufs */
1528 for (int j = 0; j != rxr->num_desc; ++j) { 1522 for (int j = 0; j != rxr->num_desc; ++j) {
1529 struct mbuf *mp; 1523 struct mbuf *mp;
1530 1524
1531 rxbuf = &rxr->rx_buffers[j]; 1525 rxbuf = &rxr->rx_buffers[j];
1532 1526
1533#ifdef DEV_NETMAP 1527#ifdef DEV_NETMAP
1534 /* 1528 /*
1535 * In netmap mode, fill the map and set the buffer 1529 * In netmap mode, fill the map and set the buffer
1536 * address in the NIC ring, considering the offset 1530 * address in the NIC ring, considering the offset
1537 * between the netmap and NIC rings (see comment in 1531 * between the netmap and NIC rings (see comment in
1538 * ixgbe_setup_transmit_ring() ). No need to allocate 1532 * ixgbe_setup_transmit_ring() ). No need to allocate
1539 * an mbuf, so end the block with a continue; 1533 * an mbuf, so end the block with a continue;
@@ -1543,51 +1537,61 @@ ixgbe_setup_receive_ring(struct rx_ring  @@ -1543,51 +1537,61 @@ ixgbe_setup_receive_ring(struct rx_ring
1543 uint64_t paddr; 1537 uint64_t paddr;
1544 void *addr; 1538 void *addr;
1545 1539
1546 addr = PNMB(na, slot + sj, &paddr); 1540 addr = PNMB(na, slot + sj, &paddr);
1547 netmap_load_map(na, rxr->ptag, rxbuf->pmap, addr); 1541 netmap_load_map(na, rxr->ptag, rxbuf->pmap, addr);
1548 /* Update descriptor and the cached value */ 1542 /* Update descriptor and the cached value */
1549 rxr->rx_base[j].read.pkt_addr = htole64(paddr); 1543 rxr->rx_base[j].read.pkt_addr = htole64(paddr);
1550 rxbuf->addr = htole64(paddr); 1544 rxbuf->addr = htole64(paddr);
1551 continue; 1545 continue;
1552 } 1546 }
1553#endif /* DEV_NETMAP */ 1547#endif /* DEV_NETMAP */
1554 1548
1555 rxbuf->flags = 0; 1549 rxbuf->flags = 0;
1556 rxbuf->buf = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, 1550 rxbuf->buf = ixgbe_getcl();
1557 MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); 
1558 if (rxbuf->buf == NULL) { 1551 if (rxbuf->buf == NULL) {
 1552 rxr->no_mbuf.ev_count++;
1559 error = ENOBUFS; 1553 error = ENOBUFS;
1560 goto fail; 1554 goto fail;
1561 } 1555 }
1562 mp = rxbuf->buf; 1556 mp = rxbuf->buf;
1563 mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz; 1557 mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz;
 1558 IXGBE_M_ADJ(adapter, rxr, mp);
1564 /* Get the memory mapping */ 1559 /* Get the memory mapping */
1565 error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat, rxbuf->pmap, 1560 error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat, rxbuf->pmap,
1566 mp, BUS_DMA_NOWAIT); 1561 mp, BUS_DMA_NOWAIT);
1567 if (error != 0) 1562 if (error != 0) {
1568 goto fail; 1563 /*
 1564 * Clear this entry for later cleanup in
 1565 * ixgbe_discard() which is called via
 1566 * ixgbe_free_receive_ring().
 1567 */
 1568 m_freem(mp);
 1569 rxbuf->buf = NULL;
 1570 goto fail;
 1571 }
1569 bus_dmamap_sync(rxr->ptag->dt_dmat, rxbuf->pmap, 1572 bus_dmamap_sync(rxr->ptag->dt_dmat, rxbuf->pmap,
1570 0, adapter->rx_mbuf_sz, BUS_DMASYNC_PREREAD); 1573 0, mp->m_pkthdr.len, BUS_DMASYNC_PREREAD);
1571 /* Update the descriptor and the cached value */ 1574 /* Update the descriptor and the cached value */
1572 rxr->rx_base[j].read.pkt_addr = 1575 rxr->rx_base[j].read.pkt_addr =
1573 htole64(rxbuf->pmap->dm_segs[0].ds_addr); 1576 htole64(rxbuf->pmap->dm_segs[0].ds_addr);
1574 rxbuf->addr = htole64(rxbuf->pmap->dm_segs[0].ds_addr); 1577 rxbuf->addr = htole64(rxbuf->pmap->dm_segs[0].ds_addr);
1575 } 1578 }
1576 1579
1577 /* Setup our descriptor indices */ 1580 /* Setup our descriptor indices */
1578 rxr->next_to_check = 0; 1581 rxr->next_to_check = 0;
1579 rxr->next_to_refresh = 0; 1582 rxr->next_to_refresh = adapter->num_rx_desc - 1; /* Fully allocated */
1580 rxr->lro_enabled = FALSE; 1583 rxr->lro_enabled = FALSE;
 1584 rxr->discard_multidesc = false;
1581 rxr->rx_copies.ev_count = 0; 1585 rxr->rx_copies.ev_count = 0;
1582#if 0 /* NetBSD */ 1586#if 0 /* NetBSD */
1583 rxr->rx_bytes.ev_count = 0; 1587 rxr->rx_bytes.ev_count = 0;
1584#if 1 /* Fix inconsistency */ 1588#if 1 /* Fix inconsistency */
1585 rxr->rx_packets.ev_count = 0; 1589 rxr->rx_packets.ev_count = 0;
1586#endif 1590#endif
1587#endif 1591#endif
1588 rxr->vtag_strip = FALSE; 1592 rxr->vtag_strip = FALSE;
1589 1593
1590 ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, 1594 ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
1591 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); 1595 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
1592 1596
1593 /* 1597 /*
@@ -1689,29 +1693,26 @@ ixgbe_free_receive_buffers(struct rx_rin @@ -1689,29 +1693,26 @@ ixgbe_free_receive_buffers(struct rx_rin
1689 INIT_DEBUGOUT("ixgbe_free_receive_buffers: begin"); 1693 INIT_DEBUGOUT("ixgbe_free_receive_buffers: begin");
1690 1694
1691 /* Cleanup any existing buffers */ 1695 /* Cleanup any existing buffers */
1692 if (rxr->rx_buffers != NULL) { 1696 if (rxr->rx_buffers != NULL) {
1693 for (int i = 0; i < adapter->num_rx_desc; i++) { 1697 for (int i = 0; i < adapter->num_rx_desc; i++) {
1694 rxbuf = &rxr->rx_buffers[i]; 1698 rxbuf = &rxr->rx_buffers[i];
1695 ixgbe_rx_discard(rxr, i); 1699 ixgbe_rx_discard(rxr, i);
1696 if (rxbuf->pmap != NULL) { 1700 if (rxbuf->pmap != NULL) {
1697 ixgbe_dmamap_destroy(rxr->ptag, rxbuf->pmap); 1701 ixgbe_dmamap_destroy(rxr->ptag, rxbuf->pmap);
1698 rxbuf->pmap = NULL; 1702 rxbuf->pmap = NULL;
1699 } 1703 }
1700 } 1704 }
1701 1705
1702 /* NetBSD specific. See ixgbe_netbsd.c */ 
1703 ixgbe_jcl_destroy(adapter, rxr); 
1704 
1705 if (rxr->rx_buffers != NULL) { 1706 if (rxr->rx_buffers != NULL) {
1706 free(rxr->rx_buffers, M_DEVBUF); 1707 free(rxr->rx_buffers, M_DEVBUF);
1707 rxr->rx_buffers = NULL; 1708 rxr->rx_buffers = NULL;
1708 } 1709 }
1709 } 1710 }
1710 1711
1711 if (rxr->ptag != NULL) { 1712 if (rxr->ptag != NULL) {
1712 ixgbe_dma_tag_destroy(rxr->ptag); 1713 ixgbe_dma_tag_destroy(rxr->ptag);
1713 rxr->ptag = NULL; 1714 rxr->ptag = NULL;
1714 } 1715 }
1715 1716
1716 return; 1717 return;
1717} /* ixgbe_free_receive_buffers */ 1718} /* ixgbe_free_receive_buffers */
@@ -1758,46 +1759,45 @@ ixgbe_rx_input(struct rx_ring *rxr, stru @@ -1758,46 +1759,45 @@ ixgbe_rx_input(struct rx_ring *rxr, stru
1758} /* ixgbe_rx_input */ 1759} /* ixgbe_rx_input */
1759 1760
1760/************************************************************************ 1761/************************************************************************
1761 * ixgbe_rx_discard 1762 * ixgbe_rx_discard
1762 ************************************************************************/ 1763 ************************************************************************/
1763static __inline void 1764static __inline void
1764ixgbe_rx_discard(struct rx_ring *rxr, int i) 1765ixgbe_rx_discard(struct rx_ring *rxr, int i)
1765{ 1766{
1766 struct ixgbe_rx_buf *rbuf; 1767 struct ixgbe_rx_buf *rbuf;
1767 1768
1768 rbuf = &rxr->rx_buffers[i]; 1769 rbuf = &rxr->rx_buffers[i];
1769 1770
1770 /* 1771 /*
1771 * With advanced descriptors the writeback 1772 * With advanced descriptors the writeback clobbers the buffer addrs,
1772 * clobbers the buffer addrs, so its easier 1773 * so its easier to just free the existing mbufs and take the normal
1773 * to just free the existing mbufs and take 1774 * refresh path to get new buffers and mapping.
1774 * the normal refresh path to get new buffers 
1775 * and mapping. 
1776 */ 1775 */
1777 1776
1778 if (rbuf->fmp != NULL) {/* Partial chain ? */ 1777 if (rbuf->fmp != NULL) {/* Partial chain ? */
1779 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0, 1778 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
1780 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD); 1779 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
 1780 ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
1781 m_freem(rbuf->fmp); 1781 m_freem(rbuf->fmp);
1782 rbuf->fmp = NULL; 1782 rbuf->fmp = NULL;
1783 rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */ 1783 rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
1784 } else if (rbuf->buf) { 1784 } else if (rbuf->buf) {
1785 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0, 1785 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
1786 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD); 1786 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
 1787 ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
1787 m_free(rbuf->buf); 1788 m_free(rbuf->buf);
1788 rbuf->buf = NULL; 1789 rbuf->buf = NULL;
1789 } 1790 }
1790 ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap); 
1791 1791
1792 rbuf->flags = 0; 1792 rbuf->flags = 0;
1793 1793
1794 return; 1794 return;
1795} /* ixgbe_rx_discard */ 1795} /* ixgbe_rx_discard */
1796 1796
1797 1797
1798/************************************************************************ 1798/************************************************************************
1799 * ixgbe_rxeof 1799 * ixgbe_rxeof
1800 * 1800 *
1801 * Executes in interrupt context. It replenishes the 1801 * Executes in interrupt context. It replenishes the
1802 * mbufs in the descriptor and sends data which has 1802 * mbufs in the descriptor and sends data which has
1803 * been dma'ed into host memory to upper layer. 1803 * been dma'ed into host memory to upper layer.
@@ -1807,106 +1807,123 @@ ixgbe_rx_discard(struct rx_ring *rxr, in @@ -1807,106 +1807,123 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
1807bool 1807bool
1808ixgbe_rxeof(struct ix_queue *que) 1808ixgbe_rxeof(struct ix_queue *que)
1809{ 1809{
1810 struct adapter *adapter = que->adapter; 1810 struct adapter *adapter = que->adapter;
1811 struct rx_ring *rxr = que->rxr; 1811 struct rx_ring *rxr = que->rxr;
1812 struct ifnet *ifp = adapter->ifp; 1812 struct ifnet *ifp = adapter->ifp;
1813#ifdef LRO 1813#ifdef LRO
1814 struct lro_ctrl *lro = &rxr->lro; 1814 struct lro_ctrl *lro = &rxr->lro;
1815#endif /* LRO */ 1815#endif /* LRO */
1816 union ixgbe_adv_rx_desc *cur; 1816 union ixgbe_adv_rx_desc *cur;
1817 struct ixgbe_rx_buf *rbuf, *nbuf; 1817 struct ixgbe_rx_buf *rbuf, *nbuf;
1818 int i, nextp, processed = 0; 1818 int i, nextp, processed = 0;
1819 u32 staterr = 0; 1819 u32 staterr = 0;
1820 u32 count = 0; 1820 u32 loopcount = 0;
1821 u32 limit = adapter->rx_process_limit; 1821 u32 limit = adapter->rx_process_limit;
1822 bool discard_multidesc = false; 1822 bool discard_multidesc = rxr->discard_multidesc;
1823#ifdef RSS 1823#ifdef RSS
1824 u16 pkt_info; 1824 u16 pkt_info;
1825#endif 1825#endif
1826 1826
1827 IXGBE_RX_LOCK(rxr); 1827 IXGBE_RX_LOCK(rxr);
1828 1828
1829#ifdef DEV_NETMAP 1829#ifdef DEV_NETMAP
1830 if (adapter->feat_en & IXGBE_FEATURE_NETMAP) { 1830 if (adapter->feat_en & IXGBE_FEATURE_NETMAP) {
1831 /* Same as the txeof routine: wakeup clients on intr. */ 1831 /* Same as the txeof routine: wakeup clients on intr. */
1832 if (netmap_rx_irq(ifp, rxr->me, &processed)) { 1832 if (netmap_rx_irq(ifp, rxr->me, &processed)) {
1833 IXGBE_RX_UNLOCK(rxr); 1833 IXGBE_RX_UNLOCK(rxr);
1834 return (FALSE); 1834 return (FALSE);
1835 } 1835 }
1836 } 1836 }
1837#endif /* DEV_NETMAP */ 1837#endif /* DEV_NETMAP */
1838 1838
1839 /* 1839 /*
1840 * The max number of loop is rx_process_limit. If discard_multidesc is 1840 * The max number of loop is rx_process_limit. If discard_multidesc is
1841 * true, continue processing to not to send broken packet to the upper 1841 * true, continue processing to not to send broken packet to the upper
1842 * layer. 1842 * layer.
1843 */ 1843 */
1844 for (i = rxr->next_to_check; 1844 for (i = rxr->next_to_check;
1845 (count < limit) || (discard_multidesc == true);) { 1845 (loopcount < limit) || (discard_multidesc == true);) {
1846 1846
1847 struct mbuf *sendmp, *mp; 1847 struct mbuf *sendmp, *mp;
1848 struct mbuf *newmp; 1848 struct mbuf *newmp;
1849 u32 rsc, ptype; 1849 u32 rsc, ptype;
1850 u16 len; 1850 u16 len;
1851 u16 vtag = 0; 1851 u16 vtag = 0;
1852 bool eop; 1852 bool eop;
 1853 bool discard = false;
1853 1854
1854 /* Sync the ring. */ 1855 /* Sync the ring. */
1855 ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, 1856 ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
1856 BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); 1857 BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
1857 1858
1858 cur = &rxr->rx_base[i]; 1859 cur = &rxr->rx_base[i];
1859 staterr = le32toh(cur->wb.upper.status_error); 1860 staterr = le32toh(cur->wb.upper.status_error);
1860#ifdef RSS 1861#ifdef RSS
1861 pkt_info = le16toh(cur->wb.lower.lo_dword.hs_rss.pkt_info); 1862 pkt_info = le16toh(cur->wb.lower.lo_dword.hs_rss.pkt_info);
1862#endif 1863#endif
1863 1864
1864 if ((staterr & IXGBE_RXD_STAT_DD) == 0) 1865 if ((staterr & IXGBE_RXD_STAT_DD) == 0)
1865 break; 1866 break;
1866 1867
1867 count++; 1868 loopcount++;
1868 sendmp = NULL; 1869 sendmp = newmp = NULL;
1869 nbuf = NULL; 1870 nbuf = NULL;
1870 rsc = 0; 1871 rsc = 0;
1871 cur->wb.upper.status_error = 0; 1872 cur->wb.upper.status_error = 0;
1872 rbuf = &rxr->rx_buffers[i]; 1873 rbuf = &rxr->rx_buffers[i];
1873 mp = rbuf->buf; 1874 mp = rbuf->buf;
1874 1875
1875 len = le16toh(cur->wb.upper.length); 1876 len = le16toh(cur->wb.upper.length);
1876 ptype = le32toh(cur->wb.lower.lo_dword.data) & 1877 ptype = le32toh(cur->wb.lower.lo_dword.data) &
1877 IXGBE_RXDADV_PKTTYPE_MASK; 1878 IXGBE_RXDADV_PKTTYPE_MASK;
1878 eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); 1879 eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0);
1879 1880
1880 /* Make sure bad packets are discarded */ 1881 /* Make sure bad packets are discarded */
1881 if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { 1882 if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) {
1882#if __FreeBSD_version >= 1100036 1883#if __FreeBSD_version >= 1100036
1883 if (adapter->feat_en & IXGBE_FEATURE_VF) 1884 if (adapter->feat_en & IXGBE_FEATURE_VF)
1884 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); 1885 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
1885#endif 1886#endif
1886 rxr->rx_discarded.ev_count++; 1887 rxr->rx_discarded.ev_count++;
1887 ixgbe_rx_discard(rxr, i); 1888 ixgbe_rx_discard(rxr, i);
1888 discard_multidesc = false; 1889 discard_multidesc = false;
1889 goto next_desc; 1890 goto next_desc;
1890 } 1891 }
1891 1892
1892 /* pre-alloc new mbuf */ 1893 if (__predict_false(discard_multidesc))
1893 if (!discard_multidesc) 1894 discard = true;
1894 newmp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, MT_DATA, 1895 else {
1895 M_PKTHDR, rxr->mbuf_sz); 1896 /* Pre-alloc new mbuf. */
1896 else 1897
1897 newmp = NULL; 1898 if ((rbuf->fmp == NULL) &&
1898 if (newmp == NULL) { 1899 eop && (len <= adapter->rx_copy_len)) {
1899 rxr->no_jmbuf.ev_count++; 1900 /* For short packet. See below. */
 1901 sendmp = m_gethdr(M_NOWAIT, MT_DATA);
 1902 if (__predict_false(sendmp == NULL)) {
 1903 rxr->no_mbuf.ev_count++;
 1904 discard = true;
 1905 }
 1906 } else {
 1907 /* For long packet. */
 1908 newmp = ixgbe_getcl();
 1909 if (__predict_false(newmp == NULL)) {
 1910 rxr->no_mbuf.ev_count++;
 1911 discard = true;
 1912 }
 1913 }
 1914 }
 1915
 1916 if (__predict_false(discard)) {
1900 /* 1917 /*
1901 * Descriptor initialization is already done by the 1918 * Descriptor initialization is already done by the
1902 * above code (cur->wb.upper.status_error = 0). 1919 * above code (cur->wb.upper.status_error = 0).
1903 * So, we can reuse current rbuf->buf for new packet. 1920 * So, we can reuse current rbuf->buf for new packet.
1904 * 1921 *
1905 * Rewrite the buffer addr, see comment in 1922 * Rewrite the buffer addr, see comment in
1906 * ixgbe_rx_discard(). 1923 * ixgbe_rx_discard().
1907 */ 1924 */
1908 cur->read.pkt_addr = rbuf->addr; 1925 cur->read.pkt_addr = rbuf->addr;
1909 m_freem(rbuf->fmp); 1926 m_freem(rbuf->fmp);
1910 rbuf->fmp = NULL; 1927 rbuf->fmp = NULL;
1911 if (!eop) { 1928 if (!eop) {
1912 /* Discard the entire packet. */ 1929 /* Discard the entire packet. */
@@ -1948,66 +1965,80 @@ ixgbe_rxeof(struct ix_queue *que) @@ -1948,66 +1965,80 @@ ixgbe_rxeof(struct ix_queue *que)
1948 nextp = i + 1; 1965 nextp = i + 1;
1949 if (nextp == adapter->num_rx_desc) 1966 if (nextp == adapter->num_rx_desc)
1950 nextp = 0; 1967 nextp = 0;
1951 } 1968 }
1952 nbuf = &rxr->rx_buffers[nextp]; 1969 nbuf = &rxr->rx_buffers[nextp];
1953 prefetch(nbuf); 1970 prefetch(nbuf);
1954 } 1971 }
1955 /* 1972 /*
1956 * Rather than using the fmp/lmp global pointers 1973 * Rather than using the fmp/lmp global pointers
1957 * we now keep the head of a packet chain in the 1974 * we now keep the head of a packet chain in the
1958 * buffer struct and pass this along from one 1975 * buffer struct and pass this along from one
1959 * descriptor to the next, until we get EOP. 1976 * descriptor to the next, until we get EOP.
1960 */ 1977 */
1961 mp->m_len = len; 
1962 /* 1978 /*
1963 * See if there is a stored head 1979 * See if there is a stored head
1964 * that determines what we are 1980 * that determines what we are
1965 */ 1981 */
1966 sendmp = rbuf->fmp; 1982 if (rbuf->fmp != NULL) {
1967 if (sendmp != NULL) { /* secondary frag */ 1983 /* Secondary frag */
 1984 sendmp = rbuf->fmp;
 1985
 1986 /* Update new (used in future) mbuf */
 1987 newmp->m_pkthdr.len = newmp->m_len = rxr->mbuf_sz;
 1988 IXGBE_M_ADJ(adapter, rxr, newmp);
1968 rbuf->buf = newmp; 1989 rbuf->buf = newmp;
1969 rbuf->fmp = NULL; 1990 rbuf->fmp = NULL;
 1991
 1992 /* For secondary frag */
 1993 mp->m_len = len;
1970 mp->m_flags &= ~M_PKTHDR; 1994 mp->m_flags &= ~M_PKTHDR;
 1995
 1996 /* For sendmp */
1971 sendmp->m_pkthdr.len += mp->m_len; 1997 sendmp->m_pkthdr.len += mp->m_len;
1972 } else { 1998 } else {
1973 /* 1999 /*
1974 * Optimize. This might be a small packet, 2000 * It's the first segment of a multi descriptor
1975 * maybe just a TCP ACK. Do a fast copy that 2001 * packet or a single segment which contains a full
1976 * is cache aligned into a new mbuf, and 2002 * packet.
1977 * leave the old mbuf+cluster for re-use. 
1978 */ 2003 */
1979 if (eop && len <= IXGBE_RX_COPY_LEN) { 
1980 sendmp = m_gethdr(M_NOWAIT, MT_DATA); 
1981 if (sendmp != NULL) { 
1982 sendmp->m_data += IXGBE_RX_COPY_ALIGN; 
1983 ixgbe_bcopy(mp->m_data, sendmp->m_data, 
1984 len); 
1985 sendmp->m_len = len; 
1986 rxr->rx_copies.ev_count++; 
1987 rbuf->flags |= IXGBE_RX_COPY; 
1988 2004
1989 m_freem(newmp); 2005 if (eop && (len <= adapter->rx_copy_len)) {
1990 } 2006 /*
1991 } 2007 * Optimize. This might be a small packet, may
1992 if (sendmp == NULL) { 2008 * be just a TCP ACK. Copy into a new mbuf, and
 2009 * Leave the old mbuf+cluster for re-use.
 2010 */
 2011 sendmp->m_data += ETHER_ALIGN;
 2012 memcpy(mtod(sendmp, void *),
 2013 mtod(mp, void *), len);
 2014 rxr->rx_copies.ev_count++;
 2015 rbuf->flags |= IXGBE_RX_COPY;
 2016 } else {
 2017 /* Non short packet */
 2018
 2019 /* Update new (used in future) mbuf */
 2020 newmp->m_pkthdr.len = newmp->m_len
 2021 = rxr->mbuf_sz;
 2022 IXGBE_M_ADJ(adapter, rxr, newmp);
1993 rbuf->buf = newmp; 2023 rbuf->buf = newmp;
1994 rbuf->fmp = NULL; 2024 rbuf->fmp = NULL;
 2025
 2026 /* For sendmp */
1995 sendmp = mp; 2027 sendmp = mp;
1996 } 2028 }
1997 2029
1998 /* first desc of a non-ps chain */ 2030 /* first desc of a non-ps chain */
1999 sendmp->m_flags |= M_PKTHDR; 2031 sendmp->m_pkthdr.len = sendmp->m_len = len;
2000 sendmp->m_pkthdr.len = mp->m_len; 
2001 } 2032 }
2002 ++processed; 2033 ++processed;
2003 2034
2004 /* Pass the head pointer on */ 2035 /* Pass the head pointer on */
2005 if (eop == 0) { 2036 if (eop == 0) {
2006 nbuf->fmp = sendmp; 2037 nbuf->fmp = sendmp;
2007 sendmp = NULL; 2038 sendmp = NULL;
2008 mp->m_next = nbuf->buf; 2039 mp->m_next = nbuf->buf;
2009 } else { /* Sending this frame */ 2040 } else { /* Sending this frame */
2010 m_set_rcvif(sendmp, ifp); 2041 m_set_rcvif(sendmp, ifp);
2011 ++rxr->packets; 2042 ++rxr->packets;
2012 rxr->rx_packets.ev_count++; 2043 rxr->rx_packets.ev_count++;
2013 /* capture data for AIM */ 2044 /* capture data for AIM */
@@ -2079,49 +2110,46 @@ ixgbe_rxeof(struct ix_queue *que) @@ -2079,49 +2110,46 @@ ixgbe_rxeof(struct ix_queue *que)
2079 } else { 2110 } else {
2080 sendmp->m_pkthdr.flowid = que->msix; 2111 sendmp->m_pkthdr.flowid = que->msix;
2081 M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE); 2112 M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE);
2082 } 2113 }
2083#endif 2114#endif
2084 } 2115 }
2085next_desc: 2116next_desc:
2086 ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, 2117 ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
2087 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); 2118 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
2088 2119
2089 /* Advance our pointers to the next descriptor. */ 2120 /* Advance our pointers to the next descriptor. */
2090 if (++i == rxr->num_desc) 2121 if (++i == rxr->num_desc)
2091 i = 0; 2122 i = 0;
 2123 rxr->next_to_check = i;
2092 2124
2093 /* Now send to the stack or do LRO */ 2125 /* Now send to the stack or do LRO */
2094 if (sendmp != NULL) { 2126 if (sendmp != NULL)
2095 rxr->next_to_check = i; 
2096 IXGBE_RX_UNLOCK(rxr); 
2097 ixgbe_rx_input(rxr, ifp, sendmp, ptype); 2127 ixgbe_rx_input(rxr, ifp, sendmp, ptype);
2098 IXGBE_RX_LOCK(rxr); 
2099 i = rxr->next_to_check; 
2100 } 
2101 2128
2102 /* Every 8 descriptors we go to refresh mbufs */ 2129 /* Every 8 descriptors we go to refresh mbufs */
2103 if (processed == 8) { 2130 if (processed == 8) {
2104 ixgbe_refresh_mbufs(rxr, i); 2131 ixgbe_refresh_mbufs(rxr, i);
2105 processed = 0; 2132 processed = 0;
2106 } 2133 }
2107 } 2134 }
2108 2135
 2136 /* Save the current status */
 2137 rxr->discard_multidesc = discard_multidesc;
 2138
2109 /* Refresh any remaining buf structs */ 2139 /* Refresh any remaining buf structs */
2110 if (ixgbe_rx_unrefreshed(rxr)) 2140 if (ixgbe_rx_unrefreshed(rxr))
2111 ixgbe_refresh_mbufs(rxr, i); 2141 ixgbe_refresh_mbufs(rxr, i);
2112 2142
2113 rxr->next_to_check = i; 
2114 
2115 IXGBE_RX_UNLOCK(rxr); 2143 IXGBE_RX_UNLOCK(rxr);
2116 2144
2117#ifdef LRO 2145#ifdef LRO
2118 /* 2146 /*
2119 * Flush any outstanding LRO work 2147 * Flush any outstanding LRO work
2120 */ 2148 */
2121 tcp_lro_flush_all(lro); 2149 tcp_lro_flush_all(lro);
2122#endif /* LRO */ 2150#endif /* LRO */
2123 2151
2124 /* 2152 /*
2125 * Still have cleaning to do? 2153 * Still have cleaning to do?
2126 */ 2154 */
2127 if ((staterr & IXGBE_RXD_STAT_DD) != 0) 2155 if ((staterr & IXGBE_RXD_STAT_DD) != 0)
@@ -2202,27 +2230,27 @@ ixgbe_dma_malloc(struct adapter *adapter @@ -2202,27 +2230,27 @@ ixgbe_dma_malloc(struct adapter *adapter
2202 goto fail_0; 2230 goto fail_0;
2203 } 2231 }
2204 2232
2205 r = bus_dmamem_alloc(dma->dma_tag->dt_dmat, size, 2233 r = bus_dmamem_alloc(dma->dma_tag->dt_dmat, size,
2206 dma->dma_tag->dt_alignment, dma->dma_tag->dt_boundary, 2234 dma->dma_tag->dt_alignment, dma->dma_tag->dt_boundary,
2207 &dma->dma_seg, 1, &rsegs, BUS_DMA_NOWAIT); 2235 &dma->dma_seg, 1, &rsegs, BUS_DMA_NOWAIT);
2208 if (r != 0) { 2236 if (r != 0) {
2209 aprint_error_dev(dev, 2237 aprint_error_dev(dev,
2210 "%s: bus_dmamem_alloc failed; error %d\n", __func__, r); 2238 "%s: bus_dmamem_alloc failed; error %d\n", __func__, r);
2211 goto fail_1; 2239 goto fail_1;
2212 } 2240 }
2213 2241
2214 r = bus_dmamem_map(dma->dma_tag->dt_dmat, &dma->dma_seg, rsegs, 2242 r = bus_dmamem_map(dma->dma_tag->dt_dmat, &dma->dma_seg, rsegs,
2215 size, &dma->dma_vaddr, BUS_DMA_NOWAIT); 2243 size, &dma->dma_vaddr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
2216 if (r != 0) { 2244 if (r != 0) {
2217 aprint_error_dev(dev, "%s: bus_dmamem_map failed; error %d\n", 2245 aprint_error_dev(dev, "%s: bus_dmamem_map failed; error %d\n",
2218 __func__, r); 2246 __func__, r);
2219 goto fail_2; 2247 goto fail_2;
2220 } 2248 }
2221 2249
2222 r = ixgbe_dmamap_create(dma->dma_tag, 0, &dma->dma_map); 2250 r = ixgbe_dmamap_create(dma->dma_tag, 0, &dma->dma_map);
2223 if (r != 0) { 2251 if (r != 0) {
2224 aprint_error_dev(dev, "%s: bus_dmamem_map failed; error %d\n", 2252 aprint_error_dev(dev, "%s: bus_dmamem_map failed; error %d\n",
2225 __func__, r); 2253 __func__, r);
2226 goto fail_3; 2254 goto fail_3;
2227 } 2255 }
2228 2256

cvs diff -r1.88.2.43 -r1.88.2.44 src/sys/dev/pci/ixgbe/ixgbe.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe.c 2021/03/11 16:04:25 1.88.2.43
+++ src/sys/dev/pci/ixgbe/ixgbe.c 2021/09/15 16:38:00 1.88.2.44
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe.c,v 1.88.2.43 2021/03/11 16:04:25 martin Exp $ */ 1/* $NetBSD: ixgbe.c,v 1.88.2.44 2021/09/15 16:38:00 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 4
5 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
6 All rights reserved. 6 All rights reserved.
7 7
8 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
10 10
11 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
13 13
14 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -53,31 +53,33 @@ @@ -53,31 +53,33 @@
53 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 53 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
63 * POSSIBILITY OF SUCH DAMAGE. 63 * POSSIBILITY OF SUCH DAMAGE.
64 */ 64 */
65 65
 66#include <sys/cdefs.h>
 67__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.44 2021/09/15 16:38:00 martin Exp $");
 68
66#ifdef _KERNEL_OPT 69#ifdef _KERNEL_OPT
67#include "opt_inet.h" 70#include "opt_inet.h"
68#include "opt_inet6.h" 71#include "opt_inet6.h"
69#include "opt_net_mpsafe.h" 72#include "opt_net_mpsafe.h"
70#include "opt_ixgbe.h" 
71#endif 73#endif
72 74
73#include "ixgbe.h" 75#include "ixgbe.h"
74#include "ixgbe_sriov.h" 76#include "ixgbe_sriov.h"
75#include "vlan.h" 77#include "vlan.h"
76 78
77#include <sys/cprng.h> 79#include <sys/cprng.h>
78#include <dev/mii/mii.h> 80#include <dev/mii/mii.h>
79#include <dev/mii/miivar.h> 81#include <dev/mii/miivar.h>
80 82
81/************************************************************************ 83/************************************************************************
82 * Driver version 84 * Driver version
83 ************************************************************************/ 85 ************************************************************************/
@@ -162,27 +164,27 @@ static const char *ixgbe_strings[] =  @@ -162,27 +164,27 @@ static const char *ixgbe_strings[] =
162static int ixgbe_probe(device_t, cfdata_t, void *); 164static int ixgbe_probe(device_t, cfdata_t, void *);
163static void ixgbe_attach(device_t, device_t, void *); 165static void ixgbe_attach(device_t, device_t, void *);
164static int ixgbe_detach(device_t, int); 166static int ixgbe_detach(device_t, int);
165#if 0 167#if 0
166static int ixgbe_shutdown(device_t); 168static int ixgbe_shutdown(device_t);
167#endif 169#endif
168static bool ixgbe_suspend(device_t, const pmf_qual_t *); 170static bool ixgbe_suspend(device_t, const pmf_qual_t *);
169static bool ixgbe_resume(device_t, const pmf_qual_t *); 171static bool ixgbe_resume(device_t, const pmf_qual_t *);
170static int ixgbe_ifflags_cb(struct ethercom *); 172static int ixgbe_ifflags_cb(struct ethercom *);
171static int ixgbe_ioctl(struct ifnet *, u_long, void *); 173static int ixgbe_ioctl(struct ifnet *, u_long, void *);
172static int ixgbe_init(struct ifnet *); 174static int ixgbe_init(struct ifnet *);
173static void ixgbe_init_locked(struct adapter *); 175static void ixgbe_init_locked(struct adapter *);
174static void ixgbe_ifstop(struct ifnet *, int); 176static void ixgbe_ifstop(struct ifnet *, int);
175static void ixgbe_stop(void *); 177static void ixgbe_stop_locked(void *);
176static void ixgbe_init_device_features(struct adapter *); 178static void ixgbe_init_device_features(struct adapter *);
177static void ixgbe_check_fan_failure(struct adapter *, u32, bool); 179static void ixgbe_check_fan_failure(struct adapter *, u32, bool);
178static void ixgbe_add_media_types(struct adapter *); 180static void ixgbe_add_media_types(struct adapter *);
179static void ixgbe_media_status(struct ifnet *, struct ifmediareq *); 181static void ixgbe_media_status(struct ifnet *, struct ifmediareq *);
180static int ixgbe_media_change(struct ifnet *); 182static int ixgbe_media_change(struct ifnet *);
181static int ixgbe_allocate_pci_resources(struct adapter *, 183static int ixgbe_allocate_pci_resources(struct adapter *,
182 const struct pci_attach_args *); 184 const struct pci_attach_args *);
183static void ixgbe_free_softint(struct adapter *); 185static void ixgbe_free_softint(struct adapter *);
184static void ixgbe_get_slot_info(struct adapter *); 186static void ixgbe_get_slot_info(struct adapter *);
185static int ixgbe_allocate_msix(struct adapter *, 187static int ixgbe_allocate_msix(struct adapter *,
186 const struct pci_attach_args *); 188 const struct pci_attach_args *);
187static int ixgbe_allocate_legacy(struct adapter *, 189static int ixgbe_allocate_legacy(struct adapter *,
188 const struct pci_attach_args *); 190 const struct pci_attach_args *);
@@ -234,32 +236,34 @@ static int ixgbe_get_advertise(struct ad @@ -234,32 +236,34 @@ static int ixgbe_get_advertise(struct ad
234static void ixgbe_set_sysctl_value(struct adapter *, const char *, 236static void ixgbe_set_sysctl_value(struct adapter *, const char *,
235 const char *, int *, int); 237 const char *, int *, int);
236static int ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO); 238static int ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO);
237static int ixgbe_sysctl_advertise(SYSCTLFN_PROTO); 239static int ixgbe_sysctl_advertise(SYSCTLFN_PROTO);
238static int ixgbe_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO); 240static int ixgbe_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
239static int ixgbe_sysctl_dmac(SYSCTLFN_PROTO); 241static int ixgbe_sysctl_dmac(SYSCTLFN_PROTO);
240static int ixgbe_sysctl_phy_temp(SYSCTLFN_PROTO); 242static int ixgbe_sysctl_phy_temp(SYSCTLFN_PROTO);
241static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTLFN_PROTO); 243static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTLFN_PROTO);
242#ifdef IXGBE_DEBUG 244#ifdef IXGBE_DEBUG
243static int ixgbe_sysctl_power_state(SYSCTLFN_PROTO); 245static int ixgbe_sysctl_power_state(SYSCTLFN_PROTO);
244static int ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO); 246static int ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO);
245#endif 247#endif
246static int ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO); 248static int ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
 249static int ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
247static int ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO); 250static int ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO);
248static int ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO); 251static int ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO);
249static int ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO); 252static int ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO);
250static int ixgbe_sysctl_tdh_handler(SYSCTLFN_PROTO); 253static int ixgbe_sysctl_tdh_handler(SYSCTLFN_PROTO);
251static int ixgbe_sysctl_eee_state(SYSCTLFN_PROTO); 254static int ixgbe_sysctl_eee_state(SYSCTLFN_PROTO);
252static int ixgbe_sysctl_debug(SYSCTLFN_PROTO); 255static int ixgbe_sysctl_debug(SYSCTLFN_PROTO);
 256static int ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO);
253static int ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO); 257static int ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO);
254static int ixgbe_sysctl_wufc(SYSCTLFN_PROTO); 258static int ixgbe_sysctl_wufc(SYSCTLFN_PROTO);
255 259
256/* Support for pluggable optic modules */ 260/* Support for pluggable optic modules */
257static bool ixgbe_sfp_probe(struct adapter *); 261static bool ixgbe_sfp_probe(struct adapter *);
258 262
259/* Legacy (single vector) interrupt handler */ 263/* Legacy (single vector) interrupt handler */
260static int ixgbe_legacy_irq(void *); 264static int ixgbe_legacy_irq(void *);
261 265
262/* The MSI/MSI-X Interrupt handlers */ 266/* The MSI/MSI-X Interrupt handlers */
263static int ixgbe_msix_que(void *); 267static int ixgbe_msix_que(void *);
264static int ixgbe_msix_link(void *); 268static int ixgbe_msix_link(void *);
265 269
@@ -929,51 +933,53 @@ ixgbe_attach(device_t parent, device_t d @@ -929,51 +933,53 @@ ixgbe_attach(device_t parent, device_t d
929 ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) { 933 ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) {
930 aprint_error_dev(dev, "TXD config issue, using default!\n"); 934 aprint_error_dev(dev, "TXD config issue, using default!\n");
931 adapter->num_tx_desc = DEFAULT_TXD; 935 adapter->num_tx_desc = DEFAULT_TXD;
932 } else 936 } else
933 adapter->num_tx_desc = ixgbe_txd; 937 adapter->num_tx_desc = ixgbe_txd;
934 938
935 if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || 939 if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
936 ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) { 940 ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) {
937 aprint_error_dev(dev, "RXD config issue, using default!\n"); 941 aprint_error_dev(dev, "RXD config issue, using default!\n");
938 adapter->num_rx_desc = DEFAULT_RXD; 942 adapter->num_rx_desc = DEFAULT_RXD;
939 } else 943 } else
940 adapter->num_rx_desc = ixgbe_rxd; 944 adapter->num_rx_desc = ixgbe_rxd;
941 945
942 adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; 946 /* Set default high limit of copying mbuf in rxeof */
 947 adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX;
943 948
944 /* Allocate our TX/RX Queues */ 949 /* Allocate our TX/RX Queues */
945 if (ixgbe_allocate_queues(adapter)) { 950 if (ixgbe_allocate_queues(adapter)) {
946 error = ENOMEM; 951 error = ENOMEM;
947 goto err_out; 952 goto err_out;
948 } 953 }
949 954
950 hw->phy.reset_if_overtemp = TRUE; 955 hw->phy.reset_if_overtemp = TRUE;
951 error = ixgbe_reset_hw(hw); 956 error = ixgbe_reset_hw(hw);
952 hw->phy.reset_if_overtemp = FALSE; 957 hw->phy.reset_if_overtemp = FALSE;
953 if (error == IXGBE_ERR_SFP_NOT_PRESENT) { 958 if (error == IXGBE_ERR_SFP_NOT_PRESENT) {
954 /* 959 /*
955 * No optics in this port, set up 960 * No optics in this port, set up
956 * so the timer routine will probe 961 * so the timer routine will probe
957 * for later insertion. 962 * for later insertion.
958 */ 963 */
959 adapter->sfp_probe = TRUE; 964 adapter->sfp_probe = TRUE;
960 error = IXGBE_SUCCESS; 965 error = IXGBE_SUCCESS;
961 } else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED) { 966 } else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED) {
962 aprint_error_dev(dev, "Unsupported SFP+ module detected!\n"); 967 aprint_error_dev(dev, "Unsupported SFP+ module detected!\n");
963 unsupported_sfp = true; 968 unsupported_sfp = true;
964 error = IXGBE_SUCCESS; 969 error = IXGBE_SUCCESS;
965 } else if (error) { 970 } else if (error) {
966 aprint_error_dev(dev, "Hardware initialization failed\n"); 971 aprint_error_dev(dev,
 972 "Hardware initialization failed(error = %d)\n", error);
967 error = EIO; 973 error = EIO;
968 goto err_late; 974 goto err_late;
969 } 975 }
970 976
971 /* Make sure we have a good EEPROM before we read from it */ 977 /* Make sure we have a good EEPROM before we read from it */
972 if (ixgbe_validate_eeprom_checksum(&adapter->hw, NULL) < 0) { 978 if (ixgbe_validate_eeprom_checksum(&adapter->hw, NULL) < 0) {
973 aprint_error_dev(dev, "The EEPROM Checksum Is Not Valid\n"); 979 aprint_error_dev(dev, "The EEPROM Checksum Is Not Valid\n");
974 error = EIO; 980 error = EIO;
975 goto err_late; 981 goto err_late;
976 } 982 }
977 983
978 aprint_normal("%s:", device_xname(dev)); 984 aprint_normal("%s:", device_xname(dev));
979 /* NVM Image Version */ 985 /* NVM Image Version */
@@ -1195,27 +1201,27 @@ ixgbe_attach(device_t parent, device_t d @@ -1195,27 +1201,27 @@ ixgbe_attach(device_t parent, device_t d
1195 adapter->dmac = 0; 1201 adapter->dmac = 0;
1196 /* Set initial advertised speeds (if applicable) */ 1202 /* Set initial advertised speeds (if applicable) */
1197 adapter->advertise = ixgbe_get_advertise(adapter); 1203 adapter->advertise = ixgbe_get_advertise(adapter);
1198 1204
1199 if (adapter->feat_cap & IXGBE_FEATURE_SRIOV) 1205 if (adapter->feat_cap & IXGBE_FEATURE_SRIOV)
1200 ixgbe_define_iov_schemas(dev, &error); 1206 ixgbe_define_iov_schemas(dev, &error);
1201 1207
1202 /* Add sysctls */ 1208 /* Add sysctls */
1203 ixgbe_add_device_sysctls(adapter); 1209 ixgbe_add_device_sysctls(adapter);
1204 ixgbe_add_hw_stats(adapter); 1210 ixgbe_add_hw_stats(adapter);
1205 1211
1206 /* For Netmap */ 1212 /* For Netmap */
1207 adapter->init_locked = ixgbe_init_locked; 1213 adapter->init_locked = ixgbe_init_locked;
1208 adapter->stop_locked = ixgbe_stop; 1214 adapter->stop_locked = ixgbe_stop_locked;
1209 1215
1210 if (adapter->feat_en & IXGBE_FEATURE_NETMAP) 1216 if (adapter->feat_en & IXGBE_FEATURE_NETMAP)
1211 ixgbe_netmap_attach(adapter); 1217 ixgbe_netmap_attach(adapter);
1212 1218
1213 snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, adapter->feat_cap); 1219 snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, adapter->feat_cap);
1214 aprint_verbose_dev(dev, "feature cap %s\n", buf); 1220 aprint_verbose_dev(dev, "feature cap %s\n", buf);
1215 snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, adapter->feat_en); 1221 snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, adapter->feat_en);
1216 aprint_verbose_dev(dev, "feature ena %s\n", buf); 1222 aprint_verbose_dev(dev, "feature ena %s\n", buf);
1217 1223
1218 if (pmf_device_register(dev, ixgbe_suspend, ixgbe_resume)) 1224 if (pmf_device_register(dev, ixgbe_suspend, ixgbe_resume))
1219 pmf_class_network_register(dev, adapter->ifp); 1225 pmf_class_network_register(dev, adapter->ifp);
1220 else 1226 else
1221 aprint_error_dev(dev, "couldn't establish power handler\n"); 1227 aprint_error_dev(dev, "couldn't establish power handler\n");
@@ -1642,37 +1648,40 @@ ixgbe_update_stats_counters(struct adapt @@ -1642,37 +1648,40 @@ ixgbe_update_stats_counters(struct adapt
1642 /* Hardware workaround, gprc counts missed packets */ 1648 /* Hardware workaround, gprc counts missed packets */
1643 stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx; 1649 stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx;
1644 1650
1645 lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); 1651 lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC);
1646 stats->lxontxc.ev_count += lxon; 1652 stats->lxontxc.ev_count += lxon;
1647 lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); 1653 lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
1648 stats->lxofftxc.ev_count += lxoff; 1654 stats->lxofftxc.ev_count += lxoff;
1649 total = lxon + lxoff; 1655 total = lxon + lxoff;
1650 1656
1651 if (hw->mac.type != ixgbe_mac_82598EB) { 1657 if (hw->mac.type != ixgbe_mac_82598EB) {
1652 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCL) + 1658 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCL) +
1653 ((u64)IXGBE_READ_REG(hw, IXGBE_GORCH) << 32); 1659 ((u64)IXGBE_READ_REG(hw, IXGBE_GORCH) << 32);
1654 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCL) + 1660 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCL) +
1655 ((u64)IXGBE_READ_REG(hw, IXGBE_GOTCH) << 32) - total * ETHER_MIN_LEN; 1661 ((u64)IXGBE_READ_REG(hw, IXGBE_GOTCH) << 32)
 1662 - total * ETHER_MIN_LEN;
1656 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORL) + 1663 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORL) +
1657 ((u64)IXGBE_READ_REG(hw, IXGBE_TORH) << 32); 1664 ((u64)IXGBE_READ_REG(hw, IXGBE_TORH) << 32);
1658 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); 1665 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT);
1659 stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); 1666 stats->lxoffrxc.ev_count
 1667 += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT);
1660 } else { 1668 } else {
1661 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXC); 1669 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXC);
1662 stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); 1670 stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC);
1663 /* 82598 only has a counter in the high register */ 1671 /* 82598 only has a counter in the high register */
1664 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCH); 1672 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCH);
1665 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCH) - total * ETHER_MIN_LEN; 1673 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCH)
 1674 - total * ETHER_MIN_LEN;
1666 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORH); 1675 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORH);
1667 } 1676 }
1668 1677
1669 /* 1678 /*
1670 * Workaround: mprc hardware is incorrectly counting 1679 * Workaround: mprc hardware is incorrectly counting
1671 * broadcasts, so for now we subtract those. 1680 * broadcasts, so for now we subtract those.
1672 */ 1681 */
1673 bprc = IXGBE_READ_REG(hw, IXGBE_BPRC); 1682 bprc = IXGBE_READ_REG(hw, IXGBE_BPRC);
1674 stats->bprc.ev_count += bprc; 1683 stats->bprc.ev_count += bprc;
1675 stats->mprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPRC) 1684 stats->mprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPRC)
1676 - ((hw->mac.type == ixgbe_mac_82598EB) ? bprc : 0); 1685 - ((hw->mac.type == ixgbe_mac_82598EB) ? bprc : 0);
1677 1686
1678 stats->prc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PRC64); 1687 stats->prc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PRC64);
@@ -1866,76 +1875,78 @@ ixgbe_add_hw_stats(struct adapter *adapt @@ -1866,76 +1875,78 @@ ixgbe_add_hw_stats(struct adapter *adapt
1866 evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, 1875 evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC,
1867 NULL, adapter->queues[i].evnamebuf, 1876 NULL, adapter->queues[i].evnamebuf,
1868 "TX Queue No Descriptor Available"); 1877 "TX Queue No Descriptor Available");
1869 evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, 1878 evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC,
1870 NULL, adapter->queues[i].evnamebuf, 1879 NULL, adapter->queues[i].evnamebuf,
1871 "Queue Packets Transmitted"); 1880 "Queue Packets Transmitted");
1872#ifndef IXGBE_LEGACY_TX 1881#ifndef IXGBE_LEGACY_TX
1873 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, 1882 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC,
1874 NULL, adapter->queues[i].evnamebuf, 1883 NULL, adapter->queues[i].evnamebuf,
1875 "Packets dropped in pcq"); 1884 "Packets dropped in pcq");
1876#endif 1885#endif
1877 1886
1878 if (sysctl_createv(log, 0, &rnode, &cnode, 1887 if (sysctl_createv(log, 0, &rnode, &cnode,
1879 CTLFLAG_READONLY, 1888 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxck",
1880 CTLTYPE_INT, 1889 SYSCTL_DESCR("Receive Descriptor next to check"),
1881 "rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"), 1890 ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
1882 ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0, 1891 CTL_CREATE, CTL_EOL) != 0)
 1892 break;
 1893
 1894 if (sysctl_createv(log, 0, &rnode, &cnode,
 1895 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxrf",
 1896 SYSCTL_DESCR("Receive Descriptor next to refresh"),
 1897 ixgbe_sysctl_next_to_refresh_handler, 0, (void *)rxr, 0,
1883 CTL_CREATE, CTL_EOL) != 0) 1898 CTL_CREATE, CTL_EOL) != 0)
1884 break; 1899 break;
1885 1900
1886 if (sysctl_createv(log, 0, &rnode, &cnode, 1901 if (sysctl_createv(log, 0, &rnode, &cnode,
1887 CTLFLAG_READONLY, 1902 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
1888 CTLTYPE_INT, 1903 SYSCTL_DESCR("Receive Descriptor Head"),
1889 "rxd_head", SYSCTL_DESCR("Receive Descriptor Head"), 
1890 ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0, 1904 ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
1891 CTL_CREATE, CTL_EOL) != 0) 1905 CTL_CREATE, CTL_EOL) != 0)
1892 break; 1906 break;
1893 1907
1894 if (sysctl_createv(log, 0, &rnode, &cnode, 1908 if (sysctl_createv(log, 0, &rnode, &cnode,
1895 CTLFLAG_READONLY, 1909 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_tail",
1896 CTLTYPE_INT, 1910 SYSCTL_DESCR("Receive Descriptor Tail"),
1897 "rxd_tail", SYSCTL_DESCR("Receive Descriptor Tail"), 
1898 ixgbe_sysctl_rdt_handler, 0, (void *)rxr, 0, 1911 ixgbe_sysctl_rdt_handler, 0, (void *)rxr, 0,
1899 CTL_CREATE, CTL_EOL) != 0) 1912 CTL_CREATE, CTL_EOL) != 0)
1900 break; 1913 break;
1901 1914
1902 if (i < __arraycount(stats->qprc)) { 1915 if (i < __arraycount(stats->qprc)) {
1903 evcnt_attach_dynamic(&stats->qprc[i], 1916 evcnt_attach_dynamic(&stats->qprc[i], EVCNT_TYPE_MISC,
1904 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 1917 NULL, adapter->queues[i].evnamebuf, "qprc");
1905 "qprc"); 1918 evcnt_attach_dynamic(&stats->qptc[i], EVCNT_TYPE_MISC,
1906 evcnt_attach_dynamic(&stats->qptc[i], 1919 NULL, adapter->queues[i].evnamebuf, "qptc");
1907 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 1920 evcnt_attach_dynamic(&stats->qbrc[i], EVCNT_TYPE_MISC,
1908 "qptc"); 1921 NULL, adapter->queues[i].evnamebuf, "qbrc");
1909 evcnt_attach_dynamic(&stats->qbrc[i], 1922 evcnt_attach_dynamic(&stats->qbtc[i], EVCNT_TYPE_MISC,
1910 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 1923 NULL, adapter->queues[i].evnamebuf, "qbtc");
1911 "qbrc"); 
1912 evcnt_attach_dynamic(&stats->qbtc[i], 
1913 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 
1914 "qbtc"); 
1915 if (hw->mac.type >= ixgbe_mac_82599EB) 1924 if (hw->mac.type >= ixgbe_mac_82599EB)
1916 evcnt_attach_dynamic(&stats->qprdc[i], 1925 evcnt_attach_dynamic(&stats->qprdc[i],
1917 EVCNT_TYPE_MISC, NULL, 1926 EVCNT_TYPE_MISC, NULL,
1918 adapter->queues[i].evnamebuf, "qprdc"); 1927 adapter->queues[i].evnamebuf, "qprdc");
1919 } 1928 }
1920 1929
1921 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC, 1930 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC,
1922 NULL, adapter->queues[i].evnamebuf, "Queue Packets Received"); 1931 NULL, adapter->queues[i].evnamebuf,
 1932 "Queue Packets Received");
1923 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC, 1933 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC,
1924 NULL, adapter->queues[i].evnamebuf, "Queue Bytes Received"); 1934 NULL, adapter->queues[i].evnamebuf,
 1935 "Queue Bytes Received");
1925 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC, 1936 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC,
1926 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames"); 1937 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames");
1927 evcnt_attach_dynamic(&rxr->no_jmbuf, EVCNT_TYPE_MISC, 1938 evcnt_attach_dynamic(&rxr->no_mbuf, EVCNT_TYPE_MISC,
1928 NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf"); 1939 NULL, adapter->queues[i].evnamebuf, "Rx no mbuf");
1929 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC, 1940 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC,
1930 NULL, adapter->queues[i].evnamebuf, "Rx discarded"); 1941 NULL, adapter->queues[i].evnamebuf, "Rx discarded");
1931#ifdef LRO 1942#ifdef LRO
1932 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", 1943 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued",
1933 CTLFLAG_RD, &lro->lro_queued, 0, 1944 CTLFLAG_RD, &lro->lro_queued, 0,
1934 "LRO Queued"); 1945 "LRO Queued");
1935 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed", 1946 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed",
1936 CTLFLAG_RD, &lro->lro_flushed, 0, 1947 CTLFLAG_RD, &lro->lro_flushed, 0,
1937 "LRO Flushed"); 1948 "LRO Flushed");
1938#endif /* LRO */ 1949#endif /* LRO */
1939 } 1950 }
1940 1951
1941 /* MAC stats get their own sub node */ 1952 /* MAC stats get their own sub node */
@@ -2113,27 +2124,27 @@ ixgbe_clear_evcnt(struct adapter *adapte @@ -2113,27 +2124,27 @@ ixgbe_clear_evcnt(struct adapter *adapte
2113 2124
2114 if (i < __arraycount(stats->qprc)) { 2125 if (i < __arraycount(stats->qprc)) {
2115 stats->qprc[i].ev_count = 0; 2126 stats->qprc[i].ev_count = 0;
2116 stats->qptc[i].ev_count = 0; 2127 stats->qptc[i].ev_count = 0;
2117 stats->qbrc[i].ev_count = 0; 2128 stats->qbrc[i].ev_count = 0;
2118 stats->qbtc[i].ev_count = 0; 2129 stats->qbtc[i].ev_count = 0;
2119 if (hw->mac.type >= ixgbe_mac_82599EB) 2130 if (hw->mac.type >= ixgbe_mac_82599EB)
2120 stats->qprdc[i].ev_count = 0; 2131 stats->qprdc[i].ev_count = 0;
2121 } 2132 }
2122 2133
2123 rxr->rx_packets.ev_count = 0; 2134 rxr->rx_packets.ev_count = 0;
2124 rxr->rx_bytes.ev_count = 0; 2135 rxr->rx_bytes.ev_count = 0;
2125 rxr->rx_copies.ev_count = 0; 2136 rxr->rx_copies.ev_count = 0;
2126 rxr->no_jmbuf.ev_count = 0; 2137 rxr->no_mbuf.ev_count = 0;
2127 rxr->rx_discarded.ev_count = 0; 2138 rxr->rx_discarded.ev_count = 0;
2128 } 2139 }
2129 stats->ipcs.ev_count = 0; 2140 stats->ipcs.ev_count = 0;
2130 stats->l4cs.ev_count = 0; 2141 stats->l4cs.ev_count = 0;
2131 stats->ipcs_bad.ev_count = 0; 2142 stats->ipcs_bad.ev_count = 0;
2132 stats->l4cs_bad.ev_count = 0; 2143 stats->l4cs_bad.ev_count = 0;
2133 stats->intzero.ev_count = 0; 2144 stats->intzero.ev_count = 0;
2134 stats->legint.ev_count = 0; 2145 stats->legint.ev_count = 0;
2135 stats->crcerrs.ev_count = 0; 2146 stats->crcerrs.ev_count = 0;
2136 stats->illerrc.ev_count = 0; 2147 stats->illerrc.ev_count = 0;
2137 stats->errbc.ev_count = 0; 2148 stats->errbc.ev_count = 0;
2138 stats->mspdc.ev_count = 0; 2149 stats->mspdc.ev_count = 0;
2139 if (hw->mac.type >= ixgbe_mac_X550) 2150 if (hw->mac.type >= ixgbe_mac_X550)
@@ -2250,26 +2261,52 @@ ixgbe_sysctl_next_to_check_handler(SYSCT @@ -2250,26 +2261,52 @@ ixgbe_sysctl_next_to_check_handler(SYSCT
2250 if (!rxr) 2261 if (!rxr)
2251 return (0); 2262 return (0);
2252 2263
2253 adapter = rxr->adapter; 2264 adapter = rxr->adapter;
2254 if (ixgbe_fw_recovery_mode_swflag(adapter)) 2265 if (ixgbe_fw_recovery_mode_swflag(adapter))
2255 return (EPERM); 2266 return (EPERM);
2256 2267
2257 val = rxr->next_to_check; 2268 val = rxr->next_to_check;
2258 node.sysctl_data = &val; 2269 node.sysctl_data = &val;
2259 return sysctl_lookup(SYSCTLFN_CALL(&node)); 2270 return sysctl_lookup(SYSCTLFN_CALL(&node));
2260} /* ixgbe_sysctl_next_to_check_handler */ 2271} /* ixgbe_sysctl_next_to_check_handler */
2261 2272
2262/************************************************************************ 2273/************************************************************************
 2274 * ixgbe_sysctl_next_to_refresh_handler - Receive Descriptor next to check
 2275 * handler function
 2276 *
 2277 * Retrieves the next_to_refresh value
 2278 ************************************************************************/
 2279static int
 2280ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
 2281{
 2282 struct sysctlnode node = *rnode;
 2283 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
 2284 struct adapter *adapter;
 2285 uint32_t val;
 2286
 2287 if (!rxr)
 2288 return (0);
 2289
 2290 adapter = rxr->adapter;
 2291 if (ixgbe_fw_recovery_mode_swflag(adapter))
 2292 return (EPERM);
 2293
 2294 val = rxr->next_to_refresh;
 2295 node.sysctl_data = &val;
 2296 return sysctl_lookup(SYSCTLFN_CALL(&node));
 2297} /* ixgbe_sysctl_next_to_refresh_handler */
 2298
 2299/************************************************************************
2263 * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function 2300 * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function
2264 * 2301 *
2265 * Retrieves the RDH value from the hardware 2302 * Retrieves the RDH value from the hardware
2266 ************************************************************************/ 2303 ************************************************************************/
2267static int 2304static int
2268ixgbe_sysctl_rdh_handler(SYSCTLFN_ARGS) 2305ixgbe_sysctl_rdh_handler(SYSCTLFN_ARGS)
2269{ 2306{
2270 struct sysctlnode node = *rnode; 2307 struct sysctlnode node = *rnode;
2271 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data; 2308 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
2272 struct adapter *adapter; 2309 struct adapter *adapter;
2273 uint32_t val; 2310 uint32_t val;
2274 2311
2275 if (!rxr) 2312 if (!rxr)
@@ -3088,28 +3125,31 @@ ixgbe_msix_link(void *arg) @@ -3088,28 +3125,31 @@ ixgbe_msix_link(void *arg)
3088 /* Check for over temp condition */ 3125 /* Check for over temp condition */
3089 if (adapter->feat_en & IXGBE_FEATURE_TEMP_SENSOR) { 3126 if (adapter->feat_en & IXGBE_FEATURE_TEMP_SENSOR) {
3090 switch (adapter->hw.mac.type) { 3127 switch (adapter->hw.mac.type) {
3091 case ixgbe_mac_X550EM_a: 3128 case ixgbe_mac_X550EM_a:
3092 if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a)) 3129 if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a))
3093 break; 3130 break;
3094 IXGBE_WRITE_REG(hw, IXGBE_EIMC, 3131 IXGBE_WRITE_REG(hw, IXGBE_EIMC,
3095 IXGBE_EICR_GPI_SDP0_X550EM_a); 3132 IXGBE_EICR_GPI_SDP0_X550EM_a);
3096 IXGBE_WRITE_REG(hw, IXGBE_EICR, 3133 IXGBE_WRITE_REG(hw, IXGBE_EICR,
3097 IXGBE_EICR_GPI_SDP0_X550EM_a); 3134 IXGBE_EICR_GPI_SDP0_X550EM_a);
3098 retval = hw->phy.ops.check_overtemp(hw); 3135 retval = hw->phy.ops.check_overtemp(hw);
3099 if (retval != IXGBE_ERR_OVERTEMP) 3136 if (retval != IXGBE_ERR_OVERTEMP)
3100 break; 3137 break;
3101 device_printf(adapter->dev, "CRITICAL: OVER TEMP!! PHY IS SHUT DOWN!!\n"); 3138 device_printf(adapter->dev,
3102 device_printf(adapter->dev, "System shutdown required!\n"); 3139 "CRITICAL: OVER TEMP!! "
 3140 "PHY IS SHUT DOWN!!\n");
 3141 device_printf(adapter->dev,
 3142 "System shutdown required!\n");
3103 break; 3143 break;
3104 default: 3144 default:
3105 if (!(eicr & IXGBE_EICR_TS)) 3145 if (!(eicr & IXGBE_EICR_TS))
3106 break; 3146 break;
3107 retval = hw->phy.ops.check_overtemp(hw); 3147 retval = hw->phy.ops.check_overtemp(hw);
3108 if (retval != IXGBE_ERR_OVERTEMP) 3148 if (retval != IXGBE_ERR_OVERTEMP)
3109 break; 3149 break;
3110 device_printf(adapter->dev, "CRITICAL: OVER TEMP!! PHY IS SHUT DOWN!!\n"); 3150 device_printf(adapter->dev, "CRITICAL: OVER TEMP!! PHY IS SHUT DOWN!!\n");
3111 device_printf(adapter->dev, "System shutdown required!\n"); 3151 device_printf(adapter->dev, "System shutdown required!\n");
3112 IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_TS); 3152 IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_TS);
3113 break; 3153 break;
3114 } 3154 }
3115 } 3155 }
@@ -3243,40 +3283,41 @@ ixgbe_add_device_sysctls(struct adapter  @@ -3243,40 +3283,41 @@ ixgbe_add_device_sysctls(struct adapter
3243 struct sysctllog **log; 3283 struct sysctllog **log;
3244 const struct sysctlnode *rnode, *cnode; 3284 const struct sysctlnode *rnode, *cnode;
3245 3285
3246 log = &adapter->sysctllog; 3286 log = &adapter->sysctllog;
3247 3287
3248 if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) { 3288 if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) {
3249 aprint_error_dev(dev, "could not create sysctl root\n"); 3289 aprint_error_dev(dev, "could not create sysctl root\n");
3250 return; 3290 return;
3251 } 3291 }
3252 3292
3253 if (sysctl_createv(log, 0, &rnode, &cnode, 3293 if (sysctl_createv(log, 0, &rnode, &cnode,
3254 CTLFLAG_READWRITE, CTLTYPE_INT, 3294 CTLFLAG_READWRITE, CTLTYPE_INT,
3255 "debug", SYSCTL_DESCR("Debug Info"), 3295 "debug", SYSCTL_DESCR("Debug Info"),
3256 ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) 3296 ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL)
 3297 != 0)
3257 aprint_error_dev(dev, "could not create sysctl\n"); 3298 aprint_error_dev(dev, "could not create sysctl\n");
3258 3299
3259 if (sysctl_createv(log, 0, &rnode, &cnode, 3300 if (sysctl_createv(log, 0, &rnode, &cnode,
3260 CTLFLAG_READONLY, CTLTYPE_INT, 3301 CTLFLAG_READWRITE, CTLTYPE_INT,
3261 "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"), 3302 "rx_copy_len", SYSCTL_DESCR("RX Copy Length"),
3262 NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0) 3303 ixgbe_sysctl_rx_copy_len, 0,
 3304 (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
3263 aprint_error_dev(dev, "could not create sysctl\n"); 3305 aprint_error_dev(dev, "could not create sysctl\n");
3264 3306
3265 if (sysctl_createv(log, 0, &rnode, &cnode, 3307 if (sysctl_createv(log, 0, &rnode, &cnode,
3266 CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", 3308 CTLFLAG_READONLY, CTLTYPE_INT,
3267 SYSCTL_DESCR("Number of jumbo buffers per queue"), 3309 "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"),
3268 NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, 3310 NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0)
3269 CTL_EOL) != 0) 
3270 aprint_error_dev(dev, "could not create sysctl\n"); 3311 aprint_error_dev(dev, "could not create sysctl\n");
3271 3312
3272 if (sysctl_createv(log, 0, &rnode, &cnode, 3313 if (sysctl_createv(log, 0, &rnode, &cnode,
3273 CTLFLAG_READONLY, CTLTYPE_INT, 3314 CTLFLAG_READONLY, CTLTYPE_INT,
3274 "num_queues", SYSCTL_DESCR("Number of queues"), 3315 "num_queues", SYSCTL_DESCR("Number of queues"),
3275 NULL, 0, &adapter->num_queues, 0, CTL_CREATE, CTL_EOL) != 0) 3316 NULL, 0, &adapter->num_queues, 0, CTL_CREATE, CTL_EOL) != 0)
3276 aprint_error_dev(dev, "could not create sysctl\n"); 3317 aprint_error_dev(dev, "could not create sysctl\n");
3277 3318
3278 /* Sysctls for all devices */ 3319 /* Sysctls for all devices */
3279 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, 3320 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
3280 CTLTYPE_INT, "fc", SYSCTL_DESCR(IXGBE_SYSCTL_DESC_SET_FC), 3321 CTLTYPE_INT, "fc", SYSCTL_DESCR(IXGBE_SYSCTL_DESC_SET_FC),
3281 ixgbe_sysctl_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, 3322 ixgbe_sysctl_flowcntl, 0, (void *)adapter, 0, CTL_CREATE,
3282 CTL_EOL) != 0) 3323 CTL_EOL) != 0)
@@ -3297,28 +3338,30 @@ ixgbe_add_device_sysctls(struct adapter  @@ -3297,28 +3338,30 @@ ixgbe_add_device_sysctls(struct adapter
3297 3338
3298 /* 3339 /*
3299 * If each "que->txrx_use_workqueue" is changed in sysctl handler, 3340 * If each "que->txrx_use_workqueue" is changed in sysctl handler,
3300 * it causesflip-flopping softint/workqueue mode in one deferred 3341 * it causesflip-flopping softint/workqueue mode in one deferred
3301 * processing. Therefore, preempt_disable()/preempt_enable() are 3342 * processing. Therefore, preempt_disable()/preempt_enable() are
3302 * required in ixgbe_sched_handle_que() to avoid 3343 * required in ixgbe_sched_handle_que() to avoid
3303 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule(). 3344 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule().
3304 * I think changing "que->txrx_use_workqueue" in interrupt handler 3345 * I think changing "que->txrx_use_workqueue" in interrupt handler
3305 * is lighter than doing preempt_disable()/preempt_enable() in every 3346 * is lighter than doing preempt_disable()/preempt_enable() in every
3306 * ixgbe_sched_handle_que(). 3347 * ixgbe_sched_handle_que().
3307 */ 3348 */
3308 adapter->txrx_use_workqueue = ixgbe_txrx_workqueue; 3349 adapter->txrx_use_workqueue = ixgbe_txrx_workqueue;
3309 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, 3350 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
3310 CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"), 3351 CTLTYPE_BOOL, "txrx_workqueue",
3311 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL) != 0) 3352 SYSCTL_DESCR("Use workqueue for packet processing"),
 3353 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE,
 3354 CTL_EOL) != 0)
3312 aprint_error_dev(dev, "could not create sysctl\n"); 3355 aprint_error_dev(dev, "could not create sysctl\n");
3313 3356
3314#ifdef IXGBE_DEBUG 3357#ifdef IXGBE_DEBUG
3315 /* testing sysctls (for all devices) */ 3358 /* testing sysctls (for all devices) */
3316 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, 3359 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
3317 CTLTYPE_INT, "power_state", SYSCTL_DESCR("PCI Power State"), 3360 CTLTYPE_INT, "power_state", SYSCTL_DESCR("PCI Power State"),
3318 ixgbe_sysctl_power_state, 0, (void *)adapter, 0, CTL_CREATE, 3361 ixgbe_sysctl_power_state, 0, (void *)adapter, 0, CTL_CREATE,
3319 CTL_EOL) != 0) 3362 CTL_EOL) != 0)
3320 aprint_error_dev(dev, "could not create sysctl\n"); 3363 aprint_error_dev(dev, "could not create sysctl\n");
3321 3364
3322 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READONLY, 3365 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READONLY,
3323 CTLTYPE_STRING, "print_rss_config", 3366 CTLTYPE_STRING, "print_rss_config",
3324 SYSCTL_DESCR("Prints RSS Configuration"), 3367 SYSCTL_DESCR("Prints RSS Configuration"),
@@ -3361,27 +3404,28 @@ ixgbe_add_device_sysctls(struct adapter  @@ -3361,27 +3404,28 @@ ixgbe_add_device_sysctls(struct adapter
3361 aprint_error_dev(dev, "could not create sysctl\n"); 3404 aprint_error_dev(dev, "could not create sysctl\n");
3362 return; 3405 return;
3363 } 3406 }
3364 3407
3365 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY, 3408 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY,
3366 CTLTYPE_INT, "temp", 3409 CTLTYPE_INT, "temp",
3367 SYSCTL_DESCR("Current External PHY Temperature (Celsius)"), 3410 SYSCTL_DESCR("Current External PHY Temperature (Celsius)"),
3368 ixgbe_sysctl_phy_temp, 0, (void *)adapter, 0, CTL_CREATE, 3411 ixgbe_sysctl_phy_temp, 0, (void *)adapter, 0, CTL_CREATE,
3369 CTL_EOL) != 0) 3412 CTL_EOL) != 0)
3370 aprint_error_dev(dev, "could not create sysctl\n"); 3413 aprint_error_dev(dev, "could not create sysctl\n");
3371 3414
3372 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY, 3415 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY,
3373 CTLTYPE_INT, "overtemp_occurred", 3416 CTLTYPE_INT, "overtemp_occurred",
3374 SYSCTL_DESCR("External PHY High Temperature Event Occurred"), 3417 SYSCTL_DESCR(
 3418 "External PHY High Temperature Event Occurred"),
3375 ixgbe_sysctl_phy_overtemp_occurred, 0, (void *)adapter, 0, 3419 ixgbe_sysctl_phy_overtemp_occurred, 0, (void *)adapter, 0,
3376 CTL_CREATE, CTL_EOL) != 0) 3420 CTL_CREATE, CTL_EOL) != 0)
3377 aprint_error_dev(dev, "could not create sysctl\n"); 3421 aprint_error_dev(dev, "could not create sysctl\n");
3378 } 3422 }
3379 3423
3380 if ((hw->mac.type == ixgbe_mac_X550EM_a) 3424 if ((hw->mac.type == ixgbe_mac_X550EM_a)
3381 && (hw->phy.type == ixgbe_phy_fw)) 3425 && (hw->phy.type == ixgbe_phy_fw))
3382 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, 3426 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
3383 CTLTYPE_BOOL, "force_10_100_autonego", 3427 CTLTYPE_BOOL, "force_10_100_autonego",
3384 SYSCTL_DESCR("Force autonego on 10M and 100M"), 3428 SYSCTL_DESCR("Force autonego on 10M and 100M"),
3385 NULL, 0, &hw->phy.force_10_100_autonego, 0, 3429 NULL, 0, &hw->phy.force_10_100_autonego, 0,
3386 CTL_CREATE, CTL_EOL) != 0) 3430 CTL_CREATE, CTL_EOL) != 0)
3387 aprint_error_dev(dev, "could not create sysctl\n"); 3431 aprint_error_dev(dev, "could not create sysctl\n");
@@ -3519,28 +3563,29 @@ ixgbe_detach(device_t dev, int flags) @@ -3519,28 +3563,29 @@ ixgbe_detach(device_t dev, int flags)
3519 u32 ctrl_ext; 3563 u32 ctrl_ext;
3520 int i; 3564 int i;
3521 3565
3522 INIT_DEBUGOUT("ixgbe_detach: begin"); 3566 INIT_DEBUGOUT("ixgbe_detach: begin");
3523 if (adapter->osdep.attached == false) 3567 if (adapter->osdep.attached == false)
3524 return 0; 3568 return 0;
3525 3569
3526 if (ixgbe_pci_iov_detach(dev) != 0) { 3570 if (ixgbe_pci_iov_detach(dev) != 0) {
3527 device_printf(dev, "SR-IOV in use; detach first.\n"); 3571 device_printf(dev, "SR-IOV in use; detach first.\n");
3528 return (EBUSY); 3572 return (EBUSY);
3529 } 3573 }
3530 3574
3531 /* 3575 /*
3532 * Stop the interface. ixgbe_setup_low_power_mode() calls ixgbe_stop(), 3576 * Stop the interface. ixgbe_setup_low_power_mode() calls
3533 * so it's not required to call ixgbe_stop() directly. 3577 * ixgbe_stop_locked(), so it's not required to call ixgbe_stop_locked()
 3578 * directly.
3534 */ 3579 */
3535 IXGBE_CORE_LOCK(adapter); 3580 IXGBE_CORE_LOCK(adapter);
3536 ixgbe_setup_low_power_mode(adapter); 3581 ixgbe_setup_low_power_mode(adapter);
3537 IXGBE_CORE_UNLOCK(adapter); 3582 IXGBE_CORE_UNLOCK(adapter);
3538#if NVLAN > 0 3583#if NVLAN > 0
3539 /* Make sure VLANs are not using driver */ 3584 /* Make sure VLANs are not using driver */
3540 if (!VLAN_ATTACHED(&adapter->osdep.ec)) 3585 if (!VLAN_ATTACHED(&adapter->osdep.ec))
3541 ; /* nothing to do: no VLANs */ 3586 ; /* nothing to do: no VLANs */
3542 else if ((flags & (DETACH_SHUTDOWN | DETACH_FORCE)) != 0) 3587 else if ((flags & (DETACH_SHUTDOWN | DETACH_FORCE)) != 0)
3543 vlan_ifdetach(adapter->ifp); 3588 vlan_ifdetach(adapter->ifp);
3544 else { 3589 else {
3545 aprint_error_dev(dev, "VLANs in use, detach first\n"); 3590 aprint_error_dev(dev, "VLANs in use, detach first\n");
3546 return (EBUSY); 3591 return (EBUSY);
@@ -3618,27 +3663,27 @@ ixgbe_detach(device_t dev, int flags) @@ -3618,27 +3663,27 @@ ixgbe_detach(device_t dev, int flags)
3618 3663
3619 if (i < __arraycount(stats->qprc)) { 3664 if (i < __arraycount(stats->qprc)) {
3620 evcnt_detach(&stats->qprc[i]); 3665 evcnt_detach(&stats->qprc[i]);
3621 evcnt_detach(&stats->qptc[i]); 3666 evcnt_detach(&stats->qptc[i]);
3622 evcnt_detach(&stats->qbrc[i]); 3667 evcnt_detach(&stats->qbrc[i]);
3623 evcnt_detach(&stats->qbtc[i]); 3668 evcnt_detach(&stats->qbtc[i]);
3624 if (hw->mac.type >= ixgbe_mac_82599EB) 3669 if (hw->mac.type >= ixgbe_mac_82599EB)
3625 evcnt_detach(&stats->qprdc[i]); 3670 evcnt_detach(&stats->qprdc[i]);
3626 } 3671 }
3627 3672
3628 evcnt_detach(&rxr->rx_packets); 3673 evcnt_detach(&rxr->rx_packets);
3629 evcnt_detach(&rxr->rx_bytes); 3674 evcnt_detach(&rxr->rx_bytes);
3630 evcnt_detach(&rxr->rx_copies); 3675 evcnt_detach(&rxr->rx_copies);
3631 evcnt_detach(&rxr->no_jmbuf); 3676 evcnt_detach(&rxr->no_mbuf);
3632 evcnt_detach(&rxr->rx_discarded); 3677 evcnt_detach(&rxr->rx_discarded);
3633 } 3678 }
3634 evcnt_detach(&stats->ipcs); 3679 evcnt_detach(&stats->ipcs);
3635 evcnt_detach(&stats->l4cs); 3680 evcnt_detach(&stats->l4cs);
3636 evcnt_detach(&stats->ipcs_bad); 3681 evcnt_detach(&stats->ipcs_bad);
3637 evcnt_detach(&stats->l4cs_bad); 3682 evcnt_detach(&stats->l4cs_bad);
3638 evcnt_detach(&stats->intzero); 3683 evcnt_detach(&stats->intzero);
3639 evcnt_detach(&stats->legint); 3684 evcnt_detach(&stats->legint);
3640 evcnt_detach(&stats->crcerrs); 3685 evcnt_detach(&stats->crcerrs);
3641 evcnt_detach(&stats->illerrc); 3686 evcnt_detach(&stats->illerrc);
3642 evcnt_detach(&stats->errbc); 3687 evcnt_detach(&stats->errbc);
3643 evcnt_detach(&stats->mspdc); 3688 evcnt_detach(&stats->mspdc);
3644 if (hw->mac.type >= ixgbe_mac_X550) 3689 if (hw->mac.type >= ixgbe_mac_X550)
@@ -3704,35 +3749,35 @@ static int @@ -3704,35 +3749,35 @@ static int
3704ixgbe_setup_low_power_mode(struct adapter *adapter) 3749ixgbe_setup_low_power_mode(struct adapter *adapter)
3705{ 3750{
3706 struct ixgbe_hw *hw = &adapter->hw; 3751 struct ixgbe_hw *hw = &adapter->hw;
3707 device_t dev = adapter->dev; 3752 device_t dev = adapter->dev;
3708 s32 error = 0; 3753 s32 error = 0;
3709 3754
3710 KASSERT(mutex_owned(&adapter->core_mtx)); 3755 KASSERT(mutex_owned(&adapter->core_mtx));
3711 3756
3712 /* Limit power management flow to X550EM baseT */ 3757 /* Limit power management flow to X550EM baseT */
3713 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T && 3758 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T &&
3714 hw->phy.ops.enter_lplu) { 3759 hw->phy.ops.enter_lplu) {
3715 /* X550EM baseT adapters need a special LPLU flow */ 3760 /* X550EM baseT adapters need a special LPLU flow */
3716 hw->phy.reset_disable = true; 3761 hw->phy.reset_disable = true;
3717 ixgbe_stop(adapter); 3762 ixgbe_stop_locked(adapter);
3718 error = hw->phy.ops.enter_lplu(hw); 3763 error = hw->phy.ops.enter_lplu(hw);
3719 if (error) 3764 if (error)
3720 device_printf(dev, 3765 device_printf(dev,
3721 "Error entering LPLU: %d\n", error); 3766 "Error entering LPLU: %d\n", error);
3722 hw->phy.reset_disable = false; 3767 hw->phy.reset_disable = false;
3723 } else { 3768 } else {
3724 /* Just stop for other adapters */ 3769 /* Just stop for other adapters */
3725 ixgbe_stop(adapter); 3770 ixgbe_stop_locked(adapter);
3726 } 3771 }
3727 3772
3728 if (!hw->wol_enabled) { 3773 if (!hw->wol_enabled) {
3729 ixgbe_set_phy_power(hw, FALSE); 3774 ixgbe_set_phy_power(hw, FALSE);
3730 IXGBE_WRITE_REG(hw, IXGBE_WUFC, 0); 3775 IXGBE_WRITE_REG(hw, IXGBE_WUFC, 0);
3731 IXGBE_WRITE_REG(hw, IXGBE_WUC, 0); 3776 IXGBE_WRITE_REG(hw, IXGBE_WUC, 0);
3732 } else { 3777 } else {
3733 /* Turn off support for APM wakeup. (Using ACPI instead) */ 3778 /* Turn off support for APM wakeup. (Using ACPI instead) */
3734 IXGBE_WRITE_REG(hw, IXGBE_GRC_BY_MAC(hw), 3779 IXGBE_WRITE_REG(hw, IXGBE_GRC_BY_MAC(hw),
3735 IXGBE_READ_REG(hw, IXGBE_GRC_BY_MAC(hw)) & ~(u32)2); 3780 IXGBE_READ_REG(hw, IXGBE_GRC_BY_MAC(hw)) & ~(u32)2);
3736 3781
3737 /* 3782 /*
3738 * Clear Wake Up Status register to prevent any previous wakeup 3783 * Clear Wake Up Status register to prevent any previous wakeup
@@ -3861,27 +3906,27 @@ ixgbe_set_if_hwassist(struct adapter *ad @@ -3861,27 +3906,27 @@ ixgbe_set_if_hwassist(struct adapter *ad
3861static void 3906static void
3862ixgbe_init_locked(struct adapter *adapter) 3907ixgbe_init_locked(struct adapter *adapter)
3863{ 3908{
3864 struct ifnet *ifp = adapter->ifp; 3909 struct ifnet *ifp = adapter->ifp;
3865 device_t dev = adapter->dev; 3910 device_t dev = adapter->dev;
3866 struct ixgbe_hw *hw = &adapter->hw; 3911 struct ixgbe_hw *hw = &adapter->hw;
3867 struct ix_queue *que; 3912 struct ix_queue *que;
3868 struct tx_ring *txr; 3913 struct tx_ring *txr;
3869 struct rx_ring *rxr; 3914 struct rx_ring *rxr;
3870 u32 txdctl, mhadd; 3915 u32 txdctl, mhadd;
3871 u32 rxdctl, rxctrl; 3916 u32 rxdctl, rxctrl;
3872 u32 ctrl_ext; 3917 u32 ctrl_ext;
3873 bool unsupported_sfp = false; 3918 bool unsupported_sfp = false;
3874 int i, j, err; 3919 int i, j, error;
3875 3920
3876 /* XXX check IFF_UP and IFF_RUNNING, power-saving state! */ 3921 /* XXX check IFF_UP and IFF_RUNNING, power-saving state! */
3877 3922
3878 KASSERT(mutex_owned(&adapter->core_mtx)); 3923 KASSERT(mutex_owned(&adapter->core_mtx));
3879 INIT_DEBUGOUT("ixgbe_init_locked: begin"); 3924 INIT_DEBUGOUT("ixgbe_init_locked: begin");
3880 3925
3881 hw->need_unsupported_sfp_recovery = false; 3926 hw->need_unsupported_sfp_recovery = false;
3882 hw->adapter_stopped = FALSE; 3927 hw->adapter_stopped = FALSE;
3883 ixgbe_stop_adapter(hw); 3928 ixgbe_stop_adapter(hw);
3884 callout_stop(&adapter->timer); 3929 callout_stop(&adapter->timer);
3885 for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++) 3930 for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++)
3886 que->disabled_count = 0; 3931 que->disabled_count = 0;
3887 3932
@@ -3897,49 +3942,48 @@ ixgbe_init_locked(struct adapter *adapte @@ -3897,49 +3942,48 @@ ixgbe_init_locked(struct adapter *adapte
3897 3942
3898 /* Get the latest mac address, User can use a LAA */ 3943 /* Get the latest mac address, User can use a LAA */
3899 memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl), 3944 memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl),
3900 IXGBE_ETH_LENGTH_OF_ADDRESS); 3945 IXGBE_ETH_LENGTH_OF_ADDRESS);
3901 ixgbe_set_rar(hw, 0, hw->mac.addr, adapter->pool, 1); 3946 ixgbe_set_rar(hw, 0, hw->mac.addr, adapter->pool, 1);
3902 hw->addr_ctrl.rar_used_count = 1; 3947 hw->addr_ctrl.rar_used_count = 1;
3903 3948
3904 /* Set hardware offload abilities from ifnet flags */ 3949 /* Set hardware offload abilities from ifnet flags */
3905 ixgbe_set_if_hwassist(adapter); 3950 ixgbe_set_if_hwassist(adapter);
3906 3951
3907 /* Prepare transmit descriptors and buffers */ 3952 /* Prepare transmit descriptors and buffers */
3908 if (ixgbe_setup_transmit_structures(adapter)) { 3953 if (ixgbe_setup_transmit_structures(adapter)) {
3909 device_printf(dev, "Could not setup transmit structures\n"); 3954 device_printf(dev, "Could not setup transmit structures\n");
3910 ixgbe_stop(adapter); 3955 ixgbe_stop_locked(adapter);
3911 return; 3956 return;
3912 } 3957 }
3913 3958
3914 ixgbe_init_hw(hw); 3959 ixgbe_init_hw(hw);
3915 3960
3916 ixgbe_initialize_iov(adapter); 3961 ixgbe_initialize_iov(adapter);
3917 3962
3918 ixgbe_initialize_transmit_units(adapter); 3963 ixgbe_initialize_transmit_units(adapter);
3919 3964
3920 /* Setup Multicast table */ 3965 /* Setup Multicast table */
3921 ixgbe_set_rxfilter(adapter); 3966 ixgbe_set_rxfilter(adapter);
3922 3967
3923 /* Determine the correct mbuf pool, based on frame size */ 3968 /* Use fixed buffer size, even for jumbo frames */
3924 if (adapter->max_frame_size <= MCLBYTES) 3969 adapter->rx_mbuf_sz = MCLBYTES;
3925 adapter->rx_mbuf_sz = MCLBYTES; 
3926 else 
3927 adapter->rx_mbuf_sz = MJUMPAGESIZE; 
3928 3970
3929 /* Prepare receive descriptors and buffers */ 3971 /* Prepare receive descriptors and buffers */
3930 if (ixgbe_setup_receive_structures(adapter)) { 3972 error = ixgbe_setup_receive_structures(adapter);
3931 device_printf(dev, "Could not setup receive structures\n"); 3973 if (error) {
3932 ixgbe_stop(adapter); 3974 device_printf(dev,
 3975 "Could not setup receive structures (err = %d)\n", error);
 3976 ixgbe_stop_locked(adapter);
3933 return; 3977 return;
3934 } 3978 }
3935 3979
3936 /* Configure RX settings */ 3980 /* Configure RX settings */
3937 ixgbe_initialize_receive_units(adapter); 3981 ixgbe_initialize_receive_units(adapter);
3938 3982
3939 /* Enable SDP & MSI-X interrupts based on adapter */ 3983 /* Enable SDP & MSI-X interrupts based on adapter */
3940 ixgbe_config_gpie(adapter); 3984 ixgbe_config_gpie(adapter);
3941 3985
3942 /* Set MTU size */ 3986 /* Set MTU size */
3943 if (ifp->if_mtu > ETHERMTU) { 3987 if (ifp->if_mtu > ETHERMTU) {
3944 /* aka IXGBE_MAXFRS on 82599 and newer */ 3988 /* aka IXGBE_MAXFRS on 82599 and newer */
3945 mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD); 3989 mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD);
@@ -4041,28 +4085,28 @@ ixgbe_init_locked(struct adapter *adapte @@ -4041,28 +4085,28 @@ ixgbe_init_locked(struct adapter *adapte
4041 } else { /* Simple settings for Legacy/MSI */ 4085 } else { /* Simple settings for Legacy/MSI */
4042 ixgbe_set_ivar(adapter, 0, 0, 0); 4086 ixgbe_set_ivar(adapter, 0, 0, 0);
4043 ixgbe_set_ivar(adapter, 0, 0, 1); 4087 ixgbe_set_ivar(adapter, 0, 0, 1);
4044 IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE); 4088 IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE);
4045 } 4089 }
4046 4090
4047 ixgbe_init_fdir(adapter); 4091 ixgbe_init_fdir(adapter);
4048 4092
4049 /* 4093 /*
4050 * Check on any SFP devices that 4094 * Check on any SFP devices that
4051 * need to be kick-started 4095 * need to be kick-started
4052 */ 4096 */
4053 if (hw->phy.type == ixgbe_phy_none) { 4097 if (hw->phy.type == ixgbe_phy_none) {
4054 err = hw->phy.ops.identify(hw); 4098 error = hw->phy.ops.identify(hw);
4055 if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) 4099 if (error == IXGBE_ERR_SFP_NOT_SUPPORTED)
4056 unsupported_sfp = true; 4100 unsupported_sfp = true;
4057 } else if (hw->phy.type == ixgbe_phy_sfp_unsupported) 4101 } else if (hw->phy.type == ixgbe_phy_sfp_unsupported)
4058 unsupported_sfp = true; 4102 unsupported_sfp = true;
4059 4103
4060 if (unsupported_sfp) 4104 if (unsupported_sfp)
4061 device_printf(dev, 4105 device_printf(dev,
4062 "Unsupported SFP+ module type was detected.\n"); 4106 "Unsupported SFP+ module type was detected.\n");
4063 4107
4064 /* Set moderation on the Link interrupt */ 4108 /* Set moderation on the Link interrupt */
4065 ixgbe_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR); 4109 ixgbe_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR);
4066 4110
4067 /* Enable EEE power saving */ 4111 /* Enable EEE power saving */
4068 if (adapter->feat_cap & IXGBE_FEATURE_EEE) 4112 if (adapter->feat_cap & IXGBE_FEATURE_EEE)
@@ -4515,27 +4559,27 @@ watchdog: @@ -4515,27 +4559,27 @@ watchdog:
4515static void 4559static void
4516ixgbe_recovery_mode_timer(void *arg) 4560ixgbe_recovery_mode_timer(void *arg)
4517{ 4561{
4518 struct adapter *adapter = arg; 4562 struct adapter *adapter = arg;
4519 struct ixgbe_hw *hw = &adapter->hw; 4563 struct ixgbe_hw *hw = &adapter->hw;
4520 4564
4521 IXGBE_CORE_LOCK(adapter); 4565 IXGBE_CORE_LOCK(adapter);
4522 if (ixgbe_fw_recovery_mode(hw)) { 4566 if (ixgbe_fw_recovery_mode(hw)) {
4523 if (atomic_cas_uint(&adapter->recovery_mode, 0, 1)) { 4567 if (atomic_cas_uint(&adapter->recovery_mode, 0, 1)) {
4524 /* Firmware error detected, entering recovery mode */ 4568 /* Firmware error detected, entering recovery mode */
4525 device_printf(adapter->dev, "Firmware recovery mode detected. Limiting functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n"); 4569 device_printf(adapter->dev, "Firmware recovery mode detected. Limiting functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n");
4526 4570
4527 if (hw->adapter_stopped == FALSE) 4571 if (hw->adapter_stopped == FALSE)
4528 ixgbe_stop(adapter); 4572 ixgbe_stop_locked(adapter);
4529 } 4573 }
4530 } else 4574 } else
4531 atomic_cas_uint(&adapter->recovery_mode, 1, 0); 4575 atomic_cas_uint(&adapter->recovery_mode, 1, 0);
4532 4576
4533 callout_reset(&adapter->recovery_mode_timer, hz, 4577 callout_reset(&adapter->recovery_mode_timer, hz,
4534 ixgbe_recovery_mode_timer, adapter); 4578 ixgbe_recovery_mode_timer, adapter);
4535 IXGBE_CORE_UNLOCK(adapter); 4579 IXGBE_CORE_UNLOCK(adapter);
4536} /* ixgbe_recovery_mode_timer */ 4580} /* ixgbe_recovery_mode_timer */
4537 4581
4538/************************************************************************ 4582/************************************************************************
4539 * ixgbe_sfp_probe 4583 * ixgbe_sfp_probe
4540 * 4584 *
4541 * Determine if a port had optics inserted. 4585 * Determine if a port had optics inserted.
@@ -4685,71 +4729,71 @@ ixgbe_handle_phy(void *context) @@ -4685,71 +4729,71 @@ ixgbe_handle_phy(void *context)
4685 "CRITICAL: EXTERNAL PHY OVER TEMP!! " 4729 "CRITICAL: EXTERNAL PHY OVER TEMP!! "
4686 " PHY will downshift to lower power state!\n"); 4730 " PHY will downshift to lower power state!\n");
4687 else if (error) 4731 else if (error)
4688 device_printf(adapter->dev, 4732 device_printf(adapter->dev,
4689 "Error handling LASI interrupt: %d\n", error); 4733 "Error handling LASI interrupt: %d\n", error);
4690} /* ixgbe_handle_phy */ 4734} /* ixgbe_handle_phy */
4691 4735
4692static void 4736static void
4693ixgbe_ifstop(struct ifnet *ifp, int disable) 4737ixgbe_ifstop(struct ifnet *ifp, int disable)
4694{ 4738{
4695 struct adapter *adapter = ifp->if_softc; 4739 struct adapter *adapter = ifp->if_softc;
4696 4740
4697 IXGBE_CORE_LOCK(adapter); 4741 IXGBE_CORE_LOCK(adapter);
4698 ixgbe_stop(adapter); 4742 ixgbe_stop_locked(adapter);
4699 IXGBE_CORE_UNLOCK(adapter); 4743 IXGBE_CORE_UNLOCK(adapter);
4700} 4744}
4701 4745
4702/************************************************************************ 4746/************************************************************************
4703 * ixgbe_stop - Stop the hardware 4747 * ixgbe_stop_locked - Stop the hardware
4704 * 4748 *
4705 * Disables all traffic on the adapter by issuing a 4749 * Disables all traffic on the adapter by issuing a
4706 * global reset on the MAC and deallocates TX/RX buffers. 4750 * global reset on the MAC and deallocates TX/RX buffers.
4707 ************************************************************************/ 4751 ************************************************************************/
4708static void 4752static void
4709ixgbe_stop(void *arg) 4753ixgbe_stop_locked(void *arg)
4710{ 4754{
4711 struct ifnet *ifp; 4755 struct ifnet *ifp;
4712 struct adapter *adapter = arg; 4756 struct adapter *adapter = arg;
4713 struct ixgbe_hw *hw = &adapter->hw; 4757 struct ixgbe_hw *hw = &adapter->hw;
4714 4758
4715 ifp = adapter->ifp; 4759 ifp = adapter->ifp;
4716 4760
4717 KASSERT(mutex_owned(&adapter->core_mtx)); 4761 KASSERT(mutex_owned(&adapter->core_mtx));
4718 4762
4719 INIT_DEBUGOUT("ixgbe_stop: begin\n"); 4763 INIT_DEBUGOUT("ixgbe_stop_locked: begin\n");
4720 ixgbe_disable_intr(adapter); 4764 ixgbe_disable_intr(adapter);
4721 callout_stop(&adapter->timer); 4765 callout_stop(&adapter->timer);
4722 4766
4723 /* Let the stack know...*/ 4767 /* Let the stack know...*/
4724 ifp->if_flags &= ~IFF_RUNNING; 4768 ifp->if_flags &= ~IFF_RUNNING;
4725 4769
4726 ixgbe_reset_hw(hw); 4770 ixgbe_reset_hw(hw);
4727 hw->adapter_stopped = FALSE; 4771 hw->adapter_stopped = FALSE;
4728 ixgbe_stop_adapter(hw); 4772 ixgbe_stop_adapter(hw);
4729 if (hw->mac.type == ixgbe_mac_82599EB) 4773 if (hw->mac.type == ixgbe_mac_82599EB)
4730 ixgbe_stop_mac_link_on_d3_82599(hw); 4774 ixgbe_stop_mac_link_on_d3_82599(hw);
4731 /* Turn off the laser - noop with no optics */ 4775 /* Turn off the laser - noop with no optics */
4732 ixgbe_disable_tx_laser(hw); 4776 ixgbe_disable_tx_laser(hw);
4733 4777
4734 /* Update the stack */ 4778 /* Update the stack */
4735 adapter->link_up = FALSE; 4779 adapter->link_up = FALSE;
4736 ixgbe_update_link_status(adapter); 4780 ixgbe_update_link_status(adapter);
4737 4781
4738 /* reprogram the RAR[0] in case user changed it. */ 4782 /* reprogram the RAR[0] in case user changed it. */
4739 ixgbe_set_rar(&adapter->hw, 0, adapter->hw.mac.addr, 0, IXGBE_RAH_AV); 4783 ixgbe_set_rar(&adapter->hw, 0, adapter->hw.mac.addr, 0, IXGBE_RAH_AV);
4740 4784
4741 return; 4785 return;
4742} /* ixgbe_stop */ 4786} /* ixgbe_stop_locked */
4743 4787
4744/************************************************************************ 4788/************************************************************************
4745 * ixgbe_update_link_status - Update OS on link state 4789 * ixgbe_update_link_status - Update OS on link state
4746 * 4790 *
4747 * Note: Only updates the OS on the cached link state. 4791 * Note: Only updates the OS on the cached link state.
4748 * The real check of the hardware only happens with 4792 * The real check of the hardware only happens with
4749 * a link interrupt. 4793 * a link interrupt.
4750 ************************************************************************/ 4794 ************************************************************************/
4751static void 4795static void
4752ixgbe_update_link_status(struct adapter *adapter) 4796ixgbe_update_link_status(struct adapter *adapter)
4753{ 4797{
4754 struct ifnet *ifp = adapter->ifp; 4798 struct ifnet *ifp = adapter->ifp;
4755 device_t dev = adapter->dev; 4799 device_t dev = adapter->dev;
@@ -5342,28 +5386,27 @@ ixgbe_set_advertise(struct adapter *adap @@ -5342,28 +5386,27 @@ ixgbe_set_advertise(struct adapter *adap
5342 /* No speed changes for backplane media */ 5386 /* No speed changes for backplane media */
5343 if (hw->phy.media_type == ixgbe_media_type_backplane) 5387 if (hw->phy.media_type == ixgbe_media_type_backplane)
5344 return (ENODEV); 5388 return (ENODEV);
5345 5389
5346 if (!((hw->phy.media_type == ixgbe_media_type_copper) || 5390 if (!((hw->phy.media_type == ixgbe_media_type_copper) ||
5347 (hw->phy.multispeed_fiber))) { 5391 (hw->phy.multispeed_fiber))) {
5348 device_printf(dev, 5392 device_printf(dev,
5349 "Advertised speed can only be set on copper or " 5393 "Advertised speed can only be set on copper or "
5350 "multispeed fiber media types.\n"); 5394 "multispeed fiber media types.\n");
5351 return (EINVAL); 5395 return (EINVAL);
5352 } 5396 }
5353 5397
5354 if (advertise < 0x0 || advertise > 0x3f) { 5398 if (advertise < 0x0 || advertise > 0x3f) {
5355 device_printf(dev, 5399 device_printf(dev, "Invalid advertised speed; valid modes are 0x0 through 0x3f\n");
5356 "Invalid advertised speed; valid modes are 0x0 through 0x3f\n"); 
5357 return (EINVAL); 5400 return (EINVAL);
5358 } 5401 }
5359 5402
5360 if (hw->mac.ops.get_link_capabilities) { 5403 if (hw->mac.ops.get_link_capabilities) {
5361 err = hw->mac.ops.get_link_capabilities(hw, &link_caps, 5404 err = hw->mac.ops.get_link_capabilities(hw, &link_caps,
5362 &negotiate); 5405 &negotiate);
5363 if (err != IXGBE_SUCCESS) { 5406 if (err != IXGBE_SUCCESS) {
5364 device_printf(dev, "Unable to determine supported advertise speeds\n"); 5407 device_printf(dev, "Unable to determine supported advertise speeds\n");
5365 return (ENODEV); 5408 return (ENODEV);
5366 } 5409 }
5367 } 5410 }
5368 5411
5369 /* Set new value and report new advertised mode */ 5412 /* Set new value and report new advertised mode */
@@ -5968,26 +6011,51 @@ ixgbe_sysctl_debug(SYSCTLFN_ARGS) @@ -5968,26 +6011,51 @@ ixgbe_sysctl_debug(SYSCTLFN_ARGS)
5968 node.sysctl_data = &result; 6011 node.sysctl_data = &result;
5969 error = sysctl_lookup(SYSCTLFN_CALL(&node)); 6012 error = sysctl_lookup(SYSCTLFN_CALL(&node));
5970 6013
5971 if (error || newp == NULL) 6014 if (error || newp == NULL)
5972 return error; 6015 return error;
5973 6016
5974 if (result == 1) 6017 if (result == 1)
5975 ixgbe_print_debug_info(adapter); 6018 ixgbe_print_debug_info(adapter);
5976 6019
5977 return 0; 6020 return 0;
5978} /* ixgbe_sysctl_debug */ 6021} /* ixgbe_sysctl_debug */
5979 6022
5980/************************************************************************ 6023/************************************************************************
 6024 * ixgbe_sysctl_rx_copy_len
 6025 ************************************************************************/
 6026static int
 6027ixgbe_sysctl_rx_copy_len(SYSCTLFN_ARGS)
 6028{
 6029 struct sysctlnode node = *rnode;
 6030 struct adapter *adapter = (struct adapter *)node.sysctl_data;
 6031 int error;
 6032 int result = adapter->rx_copy_len;
 6033
 6034 node.sysctl_data = &result;
 6035 error = sysctl_lookup(SYSCTLFN_CALL(&node));
 6036
 6037 if (error || newp == NULL)
 6038 return error;
 6039
 6040 if ((result < 0) || (result > IXGBE_RX_COPY_LEN_MAX))
 6041 return EINVAL;
 6042
 6043 adapter->rx_copy_len = result;
 6044
 6045 return 0;
 6046} /* ixgbe_sysctl_rx_copy_len */
 6047
 6048/************************************************************************
5981 * ixgbe_init_device_features 6049 * ixgbe_init_device_features
5982 ************************************************************************/ 6050 ************************************************************************/
5983static void 6051static void
5984ixgbe_init_device_features(struct adapter *adapter) 6052ixgbe_init_device_features(struct adapter *adapter)
5985{ 6053{
5986 adapter->feat_cap = IXGBE_FEATURE_NETMAP 6054 adapter->feat_cap = IXGBE_FEATURE_NETMAP
5987 | IXGBE_FEATURE_RSS 6055 | IXGBE_FEATURE_RSS
5988 | IXGBE_FEATURE_MSI 6056 | IXGBE_FEATURE_MSI
5989 | IXGBE_FEATURE_MSIX 6057 | IXGBE_FEATURE_MSIX
5990 | IXGBE_FEATURE_LEGACY_IRQ 6058 | IXGBE_FEATURE_LEGACY_IRQ
5991 | IXGBE_FEATURE_LEGACY_TX; 6059 | IXGBE_FEATURE_LEGACY_TX;
5992 6060
5993 /* Set capabilities first... */ 6061 /* Set capabilities first... */
@@ -6316,27 +6384,28 @@ ixgbe_ioctl(struct ifnet *ifp, u_long co @@ -6316,27 +6384,28 @@ ixgbe_ioctl(struct ifnet *ifp, u_long co
6316 6384
6317/************************************************************************ 6385/************************************************************************
6318 * ixgbe_check_fan_failure 6386 * ixgbe_check_fan_failure
6319 ************************************************************************/ 6387 ************************************************************************/
6320static void 6388static void
6321ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt) 6389ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt)
6322{ 6390{
6323 u32 mask; 6391 u32 mask;
6324 6392
6325 mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(&adapter->hw) : 6393 mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(&adapter->hw) :
6326 IXGBE_ESDP_SDP1; 6394 IXGBE_ESDP_SDP1;
6327 6395
6328 if (reg & mask) 6396 if (reg & mask)
6329 device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n"); 6397 device_printf(adapter->dev,
 6398 "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
6330} /* ixgbe_check_fan_failure */ 6399} /* ixgbe_check_fan_failure */
6331 6400
6332/************************************************************************ 6401/************************************************************************
6333 * ixgbe_handle_que 6402 * ixgbe_handle_que
6334 ************************************************************************/ 6403 ************************************************************************/
6335static void 6404static void
6336ixgbe_handle_que(void *context) 6405ixgbe_handle_que(void *context)
6337{ 6406{
6338 struct ix_queue *que = context; 6407 struct ix_queue *que = context;
6339 struct adapter *adapter = que->adapter; 6408 struct adapter *adapter = que->adapter;
6340 struct tx_ring *txr = que->txr; 6409 struct tx_ring *txr = que->txr;
6341 struct ifnet *ifp = adapter->ifp; 6410 struct ifnet *ifp = adapter->ifp;
6342 bool more = false; 6411 bool more = false;
@@ -6457,27 +6526,28 @@ alloc_retry: @@ -6457,27 +6526,28 @@ alloc_retry:
6457 adapter->osdep.intrs = NULL; 6526 adapter->osdep.intrs = NULL;
6458 return ENXIO; 6527 return ENXIO;
6459 } 6528 }
6460 aprint_normal_dev(dev, "interrupting at %s\n", intrstr); 6529 aprint_normal_dev(dev, "interrupting at %s\n", intrstr);
6461 /* 6530 /*
6462 * Try allocating a fast interrupt and the associated deferred 6531 * Try allocating a fast interrupt and the associated deferred
6463 * processing contexts. 6532 * processing contexts.
6464 */ 6533 */
6465 if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) { 6534 if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
6466 txr->txr_si = 6535 txr->txr_si =
6467 softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS, 6536 softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
6468 ixgbe_deferred_mq_start, txr); 6537 ixgbe_deferred_mq_start, txr);
6469 6538
6470 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev)); 6539 snprintf(wqname, sizeof(wqname), "%sdeferTx",
 6540 device_xname(dev));
6471 defertx_error = workqueue_create(&adapter->txr_wq, wqname, 6541 defertx_error = workqueue_create(&adapter->txr_wq, wqname,
6472 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, 6542 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI,
6473 IPL_NET, IXGBE_WORKQUEUE_FLAGS); 6543 IPL_NET, IXGBE_WORKQUEUE_FLAGS);
6474 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int)); 6544 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
6475 } 6545 }
6476 que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS, 6546 que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
6477 ixgbe_handle_que, que); 6547 ixgbe_handle_que, que);
6478 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev)); 6548 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
6479 error = workqueue_create(&adapter->que_wq, wqname, 6549 error = workqueue_create(&adapter->que_wq, wqname,
6480 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 6550 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
6481 IXGBE_WORKQUEUE_FLAGS); 6551 IXGBE_WORKQUEUE_FLAGS);
6482 6552
6483 if ((!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX) 6553 if ((!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)
@@ -6627,27 +6697,28 @@ ixgbe_allocate_msix(struct adapter *adap @@ -6627,27 +6697,28 @@ ixgbe_allocate_msix(struct adapter *adap
6627 ixgbe_handle_que, que); 6697 ixgbe_handle_que, que);
6628 if (que->que_si == NULL) { 6698 if (que->que_si == NULL) {
6629 aprint_error_dev(dev, 6699 aprint_error_dev(dev,
6630 "couldn't establish software interrupt\n"); 6700 "couldn't establish software interrupt\n");
6631 error = ENXIO; 6701 error = ENXIO;
6632 goto err_out; 6702 goto err_out;
6633 } 6703 }
6634 } 6704 }
6635 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev)); 6705 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
6636 error = workqueue_create(&adapter->txr_wq, wqname, 6706 error = workqueue_create(&adapter->txr_wq, wqname,
6637 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 6707 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
6638 IXGBE_WORKQUEUE_FLAGS); 6708 IXGBE_WORKQUEUE_FLAGS);
6639 if (error) { 6709 if (error) {
6640 aprint_error_dev(dev, "couldn't create workqueue for deferred Tx\n"); 6710 aprint_error_dev(dev,
 6711 "couldn't create workqueue for deferred Tx\n");
6641 goto err_out; 6712 goto err_out;
6642 } 6713 }
6643 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int)); 6714 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
6644 6715
6645 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev)); 6716 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
6646 error = workqueue_create(&adapter->que_wq, wqname, 6717 error = workqueue_create(&adapter->que_wq, wqname,
6647 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 6718 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
6648 IXGBE_WORKQUEUE_FLAGS); 6719 IXGBE_WORKQUEUE_FLAGS);
6649 if (error) { 6720 if (error) {
6650 aprint_error_dev(dev, "couldn't create workqueue for Tx/Rx\n"); 6721 aprint_error_dev(dev, "couldn't create workqueue for Tx/Rx\n");
6651 goto err_out; 6722 goto err_out;
6652 } 6723 }
6653 6724

cvs diff -r1.24.6.21 -r1.24.6.22 src/sys/dev/pci/ixgbe/ixgbe.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe.h 2021/03/11 16:04:25 1.24.6.21
+++ src/sys/dev/pci/ixgbe/ixgbe.h 2021/09/15 16:38:01 1.24.6.22
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe.h,v 1.24.6.21 2021/03/11 16:04:25 martin Exp $ */ 1/* $NetBSD: ixgbe.h,v 1.24.6.22 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -173,30 +173,27 @@ @@ -173,30 +173,27 @@
173/* Flow control constants */ 173/* Flow control constants */
174#define IXGBE_FC_PAUSE 0xFFFF 174#define IXGBE_FC_PAUSE 0xFFFF
175 175
176/* 176/*
177 * Used for optimizing small rx mbufs. Effort is made to keep the copy 177 * Used for optimizing small rx mbufs. Effort is made to keep the copy
178 * small and aligned for the CPU L1 cache. 178 * small and aligned for the CPU L1 cache.
179 * 179 *
180 * MHLEN is typically 168 bytes, giving us 8-byte alignment. Getting 180 * MHLEN is typically 168 bytes, giving us 8-byte alignment. Getting
181 * 32 byte alignment needed for the fast bcopy results in 8 bytes being 181 * 32 byte alignment needed for the fast bcopy results in 8 bytes being
182 * wasted. Getting 64 byte alignment, which _should_ be ideal for 182 * wasted. Getting 64 byte alignment, which _should_ be ideal for
183 * modern Intel CPUs, results in 40 bytes wasted and a significant drop 183 * modern Intel CPUs, results in 40 bytes wasted and a significant drop
184 * in observed efficiency of the optimization, 97.9% -> 81.8%. 184 * in observed efficiency of the optimization, 97.9% -> 81.8%.
185 */ 185 */
186#define MPKTHSIZE (offsetof(struct _mbuf_dummy, m_pktdat)) 186#define IXGBE_RX_COPY_LEN_MAX (MHLEN - ETHER_ALIGN)
187#define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32) 
188#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) 
189#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE) 
190 187
191/* Keep older OS drivers building... */ 188/* Keep older OS drivers building... */
192#if !defined(SYSCTL_ADD_UQUAD) 189#if !defined(SYSCTL_ADD_UQUAD)
193#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD 190#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
194#endif 191#endif
195 192
196/* Defines for printing debug information */ 193/* Defines for printing debug information */
197#define DEBUG_INIT 0 194#define DEBUG_INIT 0
198#define DEBUG_IOCTL 0 195#define DEBUG_IOCTL 0
199#define DEBUG_HW 0 196#define DEBUG_HW 0
200 197
201#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") 198#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n")
202#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) 199#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A)
@@ -321,28 +318,28 @@ struct ix_queue { @@ -321,28 +318,28 @@ struct ix_queue {
321 u32 msix; /* This queue's MSI-X vector */ 318 u32 msix; /* This queue's MSI-X vector */
322 u32 eitr_setting; 319 u32 eitr_setting;
323 u32 me; 320 u32 me;
324 struct resource *res; 321 struct resource *res;
325 int busy; 322 int busy;
326 struct tx_ring *txr; 323 struct tx_ring *txr;
327 struct rx_ring *rxr; 324 struct rx_ring *rxr;
328 struct work wq_cookie; 325 struct work wq_cookie;
329 void *que_si; 326 void *que_si;
330 /* Per queue event conters */ 327 /* Per queue event conters */
331 struct evcnt irqs; /* Hardware interrupt */ 328 struct evcnt irqs; /* Hardware interrupt */
332 struct evcnt handleq; /* software_interrupt */ 329 struct evcnt handleq; /* software_interrupt */
333 struct evcnt req; /* deferred */ 330 struct evcnt req; /* deferred */
334 char namebuf[32]; 331 char namebuf[32]; /* Name for sysctl */
335 char evnamebuf[32]; 332 char evnamebuf[32]; /* Name for evcnt */
336 333
337 /* Lock for disabled_count and this queue's EIMS/EIMC bit */ 334 /* Lock for disabled_count and this queue's EIMS/EIMC bit */
338 kmutex_t dc_mtx; 335 kmutex_t dc_mtx;
339 /* 336 /*
340 * disabled_count means: 337 * disabled_count means:
341 * 0 : this queue is enabled 338 * 0 : this queue is enabled
342 * > 0 : this queue is disabled 339 * > 0 : this queue is disabled
343 * the value is ixgbe_disable_queue() called count 340 * the value is ixgbe_disable_queue() called count
344 */ 341 */
345 int disabled_count; 342 int disabled_count;
346 bool txrx_use_workqueue; 343 bool txrx_use_workqueue;
347}; 344};
348 345
@@ -400,48 +397,46 @@ struct tx_ring { @@ -400,48 +397,46 @@ struct tx_ring {
400struct rx_ring { 397struct rx_ring {
401 struct adapter *adapter; 398 struct adapter *adapter;
402 kmutex_t rx_mtx; 399 kmutex_t rx_mtx;
403 u32 me; 400 u32 me;
404 u32 tail; 401 u32 tail;
405 union ixgbe_adv_rx_desc *rx_base; 402 union ixgbe_adv_rx_desc *rx_base;
406 struct ixgbe_dma_alloc rxdma; 403 struct ixgbe_dma_alloc rxdma;
407#ifdef LRO 404#ifdef LRO
408 struct lro_ctrl lro; 405 struct lro_ctrl lro;
409#endif /* LRO */ 406#endif /* LRO */
410 bool lro_enabled; 407 bool lro_enabled;
411 bool hw_rsc; 408 bool hw_rsc;
412 bool vtag_strip; 409 bool vtag_strip;
 410 bool discard_multidesc;
413 u16 next_to_refresh; 411 u16 next_to_refresh;
414 u16 next_to_check; 412 u16 next_to_check;
415 u16 num_desc; 413 u16 num_desc;
416 u16 mbuf_sz; 414 u16 mbuf_sz;
417#if 0 415#if 0
418 char mtx_name[16]; /* NetBSD has no mutex name */ 416 char mtx_name[16]; /* NetBSD has no mutex name */
419#endif 417#endif
420 struct ixgbe_rx_buf *rx_buffers; 418 struct ixgbe_rx_buf *rx_buffers;
421 ixgbe_dma_tag_t *ptag; 419 ixgbe_dma_tag_t *ptag;
422 u16 last_rx_mbuf_sz; 
423 u32 last_num_rx_desc; 
424 ixgbe_extmem_head_t jcl_head; 
425 420
426 u64 bytes; /* Used for AIM calc */ 421 u64 bytes; /* Used for AIM calc */
427 u64 packets; 422 u64 packets;
428 423
429 /* Soft stats */ 424 /* Soft stats */
430 struct evcnt rx_copies; 425 struct evcnt rx_copies;
431 struct evcnt rx_packets; 426 struct evcnt rx_packets;
432 struct evcnt rx_bytes; 427 struct evcnt rx_bytes;
433 struct evcnt rx_discarded; 428 struct evcnt rx_discarded;
434 struct evcnt no_jmbuf; 429 struct evcnt no_mbuf;
435 u64 rsc_num; 430 u64 rsc_num;
436 431
437 /* Flow Director */ 432 /* Flow Director */
438 u64 flm; 433 u64 flm;
439}; 434};
440 435
441struct ixgbe_vf { 436struct ixgbe_vf {
442 u_int pool; 437 u_int pool;
443 u_int rar_index; 438 u_int rar_index;
444 u_int max_frame_size; 439 u_int max_frame_size;
445 uint32_t flags; 440 uint32_t flags;
446 uint8_t ether_addr[ETHER_ADDR_LEN]; 441 uint8_t ether_addr[ETHER_ADDR_LEN];
447 uint16_t mc_hash[IXGBE_MAX_VF_MC]; 442 uint16_t mc_hash[IXGBE_MAX_VF_MC];
@@ -549,27 +544,27 @@ struct adapter { @@ -549,27 +544,27 @@ struct adapter {
549 */ 544 */
550 struct tx_ring *tx_rings; 545 struct tx_ring *tx_rings;
551 u32 num_tx_desc; 546 u32 num_tx_desc;
552 u32 tx_process_limit; 547 u32 tx_process_limit;
553 548
554 /* 549 /*
555 * Receive rings 550 * Receive rings
556 * Allocated at run time, an array of rings 551 * Allocated at run time, an array of rings
557 */ 552 */
558 struct rx_ring *rx_rings; 553 struct rx_ring *rx_rings;
559 u64 active_queues; 554 u64 active_queues;
560 u32 num_rx_desc; 555 u32 num_rx_desc;
561 u32 rx_process_limit; 556 u32 rx_process_limit;
562 int num_jcl; 557 u32 rx_copy_len;
563 558
564 /* Multicast array memory */ 559 /* Multicast array memory */
565 struct ixgbe_mc_addr *mta; 560 struct ixgbe_mc_addr *mta;
566 561
567 /* SR-IOV */ 562 /* SR-IOV */
568 int iov_mode; 563 int iov_mode;
569 int num_vfs; 564 int num_vfs;
570 int pool; 565 int pool;
571 struct ixgbe_vf *vfs; 566 struct ixgbe_vf *vfs;
572 567
573 /* Bypass */ 568 /* Bypass */
574 struct ixgbe_bp_data bypass; 569 struct ixgbe_bp_data bypass;
575 570
@@ -747,26 +742,22 @@ int ixgbe_mq_start_locked(struct ifnet  @@ -747,26 +742,22 @@ int ixgbe_mq_start_locked(struct ifnet
747void ixgbe_deferred_mq_start(void *); 742void ixgbe_deferred_mq_start(void *);
748void ixgbe_deferred_mq_start_work(struct work *, void *); 743void ixgbe_deferred_mq_start_work(struct work *, void *);
749void ixgbe_drain_all(struct adapter *); 744void ixgbe_drain_all(struct adapter *);
750 745
751int ixgbe_allocate_queues(struct adapter *); 746int ixgbe_allocate_queues(struct adapter *);
752void ixgbe_free_queues(struct adapter *); 747void ixgbe_free_queues(struct adapter *);
753int ixgbe_setup_transmit_structures(struct adapter *); 748int ixgbe_setup_transmit_structures(struct adapter *);
754void ixgbe_free_transmit_structures(struct adapter *); 749void ixgbe_free_transmit_structures(struct adapter *);
755int ixgbe_setup_receive_structures(struct adapter *); 750int ixgbe_setup_receive_structures(struct adapter *);
756void ixgbe_free_receive_structures(struct adapter *); 751void ixgbe_free_receive_structures(struct adapter *);
757bool ixgbe_txeof(struct tx_ring *); 752bool ixgbe_txeof(struct tx_ring *);
758bool ixgbe_rxeof(struct ix_queue *); 753bool ixgbe_rxeof(struct ix_queue *);
759 754
760const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *); 
761 
762/* For NetBSD */ 755/* For NetBSD */
763void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, struct rx_ring *, 756const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
764 int, size_t); 
765void ixgbe_jcl_destroy(struct adapter *, struct rx_ring *); 
766 757
767#include "ixgbe_bypass.h" 758#include "ixgbe_bypass.h"
768#include "ixgbe_fdir.h" 759#include "ixgbe_fdir.h"
769#include "ixgbe_rss.h" 760#include "ixgbe_rss.h"
770#include "ixgbe_netmap.h" 761#include "ixgbe_netmap.h"
771 762
772#endif /* _IXGBE_H_ */ 763#endif /* _IXGBE_H_ */

cvs diff -r1.8.8.5 -r1.8.8.6 src/sys/dev/pci/ixgbe/ixgbe_82598.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_82598.c 2020/09/02 12:27:54 1.8.8.5
+++ src/sys/dev/pci/ixgbe/ixgbe_82598.c 2021/09/15 16:38:01 1.8.8.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_82598.c,v 1.8.8.5 2020/09/02 12:27:54 martin Exp $ */ 1/* $NetBSD: ixgbe_82598.c,v 1.8.8.6 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -25,26 +25,29 @@ @@ -25,26 +25,29 @@
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
34 34
35******************************************************************************/ 35******************************************************************************/
36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.c 331224 2018-03-19 20:55:05Z erj $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.c 331224 2018-03-19 20:55:05Z erj $*/
37 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_82598.c,v 1.8.8.6 2021/09/15 16:38:01 martin Exp $");
 40
38#include "ixgbe_type.h" 41#include "ixgbe_type.h"
39#include "ixgbe_82598.h" 42#include "ixgbe_82598.h"
40#include "ixgbe_api.h" 43#include "ixgbe_api.h"
41#include "ixgbe_common.h" 44#include "ixgbe_common.h"
42#include "ixgbe_phy.h" 45#include "ixgbe_phy.h"
43 46
44#define IXGBE_82598_MAX_TX_QUEUES 32 47#define IXGBE_82598_MAX_TX_QUEUES 32
45#define IXGBE_82598_MAX_RX_QUEUES 64 48#define IXGBE_82598_MAX_RX_QUEUES 64
46#define IXGBE_82598_RAR_ENTRIES 16 49#define IXGBE_82598_RAR_ENTRIES 16
47#define IXGBE_82598_MC_TBL_SIZE 128 50#define IXGBE_82598_MC_TBL_SIZE 128
48#define IXGBE_82598_VFT_TBL_SIZE 128 51#define IXGBE_82598_VFT_TBL_SIZE 128
49#define IXGBE_82598_RX_PB_SIZE 512 52#define IXGBE_82598_RX_PB_SIZE 512
50 53

cvs diff -r1.14.8.6 -r1.14.8.7 src/sys/dev/pci/ixgbe/ixgbe_82599.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_82599.c 2020/09/02 12:27:54 1.14.8.6
+++ src/sys/dev/pci/ixgbe/ixgbe_82599.c 2021/09/15 16:38:01 1.14.8.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_82599.c,v 1.14.8.6 2020/09/02 12:27:54 martin Exp $ */ 1/* $NetBSD: ixgbe_82599.c,v 1.14.8.7 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -25,26 +25,29 @@ @@ -25,26 +25,29 @@
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
34 34
35******************************************************************************/ 35******************************************************************************/
36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.c 331224 2018-03-19 20:55:05Z erj $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.c 331224 2018-03-19 20:55:05Z erj $*/
37 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_82599.c,v 1.14.8.7 2021/09/15 16:38:01 martin Exp $");
 40
38#include "ixgbe_type.h" 41#include "ixgbe_type.h"
39#include "ixgbe_82599.h" 42#include "ixgbe_82599.h"
40#include "ixgbe_api.h" 43#include "ixgbe_api.h"
41#include "ixgbe_common.h" 44#include "ixgbe_common.h"
42#include "ixgbe_phy.h" 45#include "ixgbe_phy.h"
43 46
44#define IXGBE_82599_MAX_TX_QUEUES 128 47#define IXGBE_82599_MAX_TX_QUEUES 128
45#define IXGBE_82599_MAX_RX_QUEUES 128 48#define IXGBE_82599_MAX_RX_QUEUES 128
46#define IXGBE_82599_RAR_ENTRIES 128 49#define IXGBE_82599_RAR_ENTRIES 128
47#define IXGBE_82599_MC_TBL_SIZE 128 50#define IXGBE_82599_MC_TBL_SIZE 128
48#define IXGBE_82599_VFT_TBL_SIZE 128 51#define IXGBE_82599_VFT_TBL_SIZE 128
49#define IXGBE_82599_RX_PB_SIZE 512 52#define IXGBE_82599_RX_PB_SIZE 512
50 53

cvs diff -r1.15.8.6 -r1.15.8.7 src/sys/dev/pci/ixgbe/ixgbe_api.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_api.c 2020/01/24 18:37:31 1.15.8.6
+++ src/sys/dev/pci/ixgbe/ixgbe_api.c 2021/09/15 16:38:01 1.15.8.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_api.c,v 1.15.8.6 2020/01/24 18:37:31 martin Exp $ */ 1/* $NetBSD: ixgbe_api.c,v 1.15.8.7 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -25,26 +25,29 @@ @@ -25,26 +25,29 @@
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
34 34
35******************************************************************************/ 35******************************************************************************/
36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 331224 2018-03-19 20:55:05Z erj $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 331224 2018-03-19 20:55:05Z erj $*/
37 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_api.c,v 1.15.8.7 2021/09/15 16:38:01 martin Exp $");
 40
38#include "ixgbe_api.h" 41#include "ixgbe_api.h"
39#include "ixgbe_common.h" 42#include "ixgbe_common.h"
40 43
41#define IXGBE_EMPTY_PARAM 44#define IXGBE_EMPTY_PARAM
42 45
43static const u32 ixgbe_mvals_base[IXGBE_MVALS_IDX_LIMIT] = { 46static const u32 ixgbe_mvals_base[IXGBE_MVALS_IDX_LIMIT] = {
44 IXGBE_MVALS_INIT(IXGBE_EMPTY_PARAM) 47 IXGBE_MVALS_INIT(IXGBE_EMPTY_PARAM)
45}; 48};
46 49
47static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = { 50static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = {
48 IXGBE_MVALS_INIT(_X540) 51 IXGBE_MVALS_INIT(_X540)
49}; 52};
50 53

cvs diff -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/ixgbe_bypass.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_bypass.h 2017/12/21 19:28:54 1.1.4.2
+++ src/sys/dev/pci/ixgbe/ixgbe_bypass.h 2021/09/15 16:38:01 1.1.4.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_bypass.h,v 1.1.4.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the

cvs diff -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/ixgbe_netmap.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_netmap.h 2017/12/21 19:28:54 1.1.4.2
+++ src/sys/dev/pci/ixgbe/ixgbe_netmap.h 2021/09/15 16:38:01 1.1.4.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_netmap.h,v 1.1.4.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the

cvs diff -r1.13.2.10 -r1.13.2.11 src/sys/dev/pci/ixgbe/ixgbe_common.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_common.c 2020/09/02 12:24:08 1.13.2.10
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c 2021/09/15 16:38:01 1.13.2.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_common.c,v 1.13.2.10 2020/09/02 12:24:08 martin Exp $ */ 1/* $NetBSD: ixgbe_common.c,v 1.13.2.11 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -25,26 +25,29 @@ @@ -25,26 +25,29 @@
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
34 34
35******************************************************************************/ 35******************************************************************************/
36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 331224 2018-03-19 20:55:05Z erj $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 331224 2018-03-19 20:55:05Z erj $*/
37 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.13.2.11 2021/09/15 16:38:01 martin Exp $");
 40
38#include "ixgbe_common.h" 41#include "ixgbe_common.h"
39#include "ixgbe_phy.h" 42#include "ixgbe_phy.h"
40#include "ixgbe_dcb.h" 43#include "ixgbe_dcb.h"
41#include "ixgbe_dcb_82599.h" 44#include "ixgbe_dcb_82599.h"
42#include "ixgbe_api.h" 45#include "ixgbe_api.h"
43 46
44static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw); 47static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw);
45static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw); 48static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw);
46static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw); 49static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw);
47static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw); 50static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw);
48static void ixgbe_standby_eeprom(struct ixgbe_hw *hw); 51static void ixgbe_standby_eeprom(struct ixgbe_hw *hw);
49static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data, 52static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data,
50 u16 count); 53 u16 count);
@@ -1128,27 +1131,27 @@ s32 ixgbe_stop_adapter_generic(struct ix @@ -1128,27 +1131,27 @@ s32 ixgbe_stop_adapter_generic(struct ix
1128 * the hardware 1131 * the hardware
1129 */ 1132 */
1130 hw->adapter_stopped = TRUE; 1133 hw->adapter_stopped = TRUE;
1131 1134
1132 /* Disable the receive unit */ 1135 /* Disable the receive unit */
1133 ixgbe_disable_rx(hw); 1136 ixgbe_disable_rx(hw);
1134 1137
1135 /* Clear interrupt mask to stop interrupts from being generated */ 1138 /* Clear interrupt mask to stop interrupts from being generated */
1136 /* 1139 /*
1137 * XXX 1140 * XXX
1138 * This function is called in the state of both interrupt disabled 1141 * This function is called in the state of both interrupt disabled
1139 * and interrupt enabled, e.g. 1142 * and interrupt enabled, e.g.
1140 * + interrupt disabled case: 1143 * + interrupt disabled case:
1141 * - ixgbe_stop() 1144 * - ixgbe_stop_locked()
1142 * - ixgbe_disable_intr() // interrupt disabled here 1145 * - ixgbe_disable_intr() // interrupt disabled here
1143 * - ixgbe_stop_adapter() 1146 * - ixgbe_stop_adapter()
1144 * - hw->mac.ops.stop_adapter() 1147 * - hw->mac.ops.stop_adapter()
1145 * == this function 1148 * == this function
1146 * + interrupt enabled case: 1149 * + interrupt enabled case:
1147 * - ixgbe_local_timer1() 1150 * - ixgbe_local_timer1()
1148 * - ixgbe_init_locked() 1151 * - ixgbe_init_locked()
1149 * - ixgbe_stop_adapter() 1152 * - ixgbe_stop_adapter()
1150 * - hw->mac.ops.stop_adapter() 1153 * - hw->mac.ops.stop_adapter()
1151 * == this function 1154 * == this function
1152 * Therefore, it causes nest status breaking to nest the status 1155 * Therefore, it causes nest status breaking to nest the status
1153 * (that is, que->im_nest++) at all times. So, this function must 1156 * (that is, que->im_nest++) at all times. So, this function must
1154 * use ixgbe_ensure_disabled_intr() instead of ixgbe_disable_intr(). 1157 * use ixgbe_ensure_disabled_intr() instead of ixgbe_disable_intr().
@@ -5038,28 +5041,28 @@ s32 ixgbe_bypass_rw_generic(struct ixgbe @@ -5038,28 +5041,28 @@ s32 ixgbe_bypass_rw_generic(struct ixgbe
5038 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); 5041 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp);
5039 IXGBE_WRITE_FLUSH(hw); 5042 IXGBE_WRITE_FLUSH(hw);
5040 5043
5041 /* set the page bits to match the cmd that the status it belongs to */ 5044 /* set the page bits to match the cmd that the status it belongs to */
5042 *status = (*status & 0x3fffffff) | (cmd & 0xc0000000); 5045 *status = (*status & 0x3fffffff) | (cmd & 0xc0000000);
5043 5046
5044 return IXGBE_SUCCESS; 5047 return IXGBE_SUCCESS;
5045} 5048}
5046 5049
5047/** 5050/**
5048 * ixgbe_bypass_valid_rd_generic - Verify valid return from bit-bang. 5051 * ixgbe_bypass_valid_rd_generic - Verify valid return from bit-bang.
5049 * 5052 *
5050 * If we send a write we can't be sure it took until we can read back 5053 * If we send a write we can't be sure it took until we can read back
5051 * that same register. It can be a problem as some of the feilds may 5054 * that same register. It can be a problem as some of the fields may
5052 * for valid reasons change inbetween the time wrote the register and 5055 * for valid reasons change in-between the time wrote the register and
5053 * we read it again to verify. So this function check everything we 5056 * we read it again to verify. So this function check everything we
5054 * can check and then assumes it worked. 5057 * can check and then assumes it worked.
5055 * 5058 *
5056 * @u32 in_reg - The register cmd for the bit-bang read. 5059 * @u32 in_reg - The register cmd for the bit-bang read.
5057 * @u32 out_reg - The register returned from a bit-bang read. 5060 * @u32 out_reg - The register returned from a bit-bang read.
5058 **/ 5061 **/
5059bool ixgbe_bypass_valid_rd_generic(u32 in_reg, u32 out_reg) 5062bool ixgbe_bypass_valid_rd_generic(u32 in_reg, u32 out_reg)
5060{ 5063{
5061 u32 mask; 5064 u32 mask;
5062 5065
5063 /* Page must match for all control pages */ 5066 /* Page must match for all control pages */
5064 if ((in_reg & BYPASS_PAGE_M) != (out_reg & BYPASS_PAGE_M)) 5067 if ((in_reg & BYPASS_PAGE_M) != (out_reg & BYPASS_PAGE_M))
5065 return FALSE; 5068 return FALSE;
@@ -5092,27 +5095,27 @@ bool ixgbe_bypass_valid_rd_generic(u32 i @@ -5092,27 +5095,27 @@ bool ixgbe_bypass_valid_rd_generic(u32 i
5092 break; 5095 break;
5093 case BYPASS_PAGE_CTL2: 5096 case BYPASS_PAGE_CTL2:
5094 /* All we can check in this page is control number 5097 /* All we can check in this page is control number
5095 * which is already done above. 5098 * which is already done above.
5096 */ 5099 */
5097 break; 5100 break;
5098 } 5101 }
5099 5102
5100 /* We are as sure as we can be return TRUE */ 5103 /* We are as sure as we can be return TRUE */
5101 return TRUE; 5104 return TRUE;
5102} 5105}
5103 5106
5104/** 5107/**
5105 * ixgbe_bypass_set_generic - Set a bypass field in the FW CTRL Regiter. 5108 * ixgbe_bypass_set_generic - Set a bypass field in the FW CTRL Register.
5106 * 5109 *
5107 * @hw: pointer to hardware structure 5110 * @hw: pointer to hardware structure
5108 * @cmd: The control word we are setting. 5111 * @cmd: The control word we are setting.
5109 * @event: The event we are setting in the FW. This also happens to 5112 * @event: The event we are setting in the FW. This also happens to
5110 * be the mask for the event we are setting (handy) 5113 * be the mask for the event we are setting (handy)
5111 * @action: The action we set the event to in the FW. This is in a 5114 * @action: The action we set the event to in the FW. This is in a
5112 * bit field that happens to be what we want to put in 5115 * bit field that happens to be what we want to put in
5113 * the event spot (also handy) 5116 * the event spot (also handy)
5114 **/ 5117 **/
5115s32 ixgbe_bypass_set_generic(struct ixgbe_hw *hw, u32 ctrl, u32 event, 5118s32 ixgbe_bypass_set_generic(struct ixgbe_hw *hw, u32 ctrl, u32 event,
5116 u32 action) 5119 u32 action)
5117{ 5120{
5118 u32 by_ctl = 0; 5121 u32 by_ctl = 0;
@@ -5138,27 +5141,27 @@ s32 ixgbe_bypass_set_generic(struct ixgb @@ -5138,27 +5141,27 @@ s32 ixgbe_bypass_set_generic(struct ixgb
5138 5141
5139 if (ixgbe_bypass_rw_generic(hw, verify, &by_ctl)) 5142 if (ixgbe_bypass_rw_generic(hw, verify, &by_ctl))
5140 return IXGBE_ERR_INVALID_ARGUMENT; 5143 return IXGBE_ERR_INVALID_ARGUMENT;
5141 } while (!ixgbe_bypass_valid_rd_generic(cmd, by_ctl)); 5144 } while (!ixgbe_bypass_valid_rd_generic(cmd, by_ctl));
5142 } else { 5145 } else {
5143 /* We have give the FW time for the write to stick */ 5146 /* We have give the FW time for the write to stick */
5144 msec_delay(100); 5147 msec_delay(100);
5145 } 5148 }
5146 5149
5147 return IXGBE_SUCCESS; 5150 return IXGBE_SUCCESS;
5148} 5151}
5149 5152
5150/** 5153/**
5151 * ixgbe_bypass_rd_eep_generic - Read the bypass FW eeprom addres. 5154 * ixgbe_bypass_rd_eep_generic - Read the bypass FW eeprom address.
5152 * 5155 *
5153 * @hw: pointer to hardware structure 5156 * @hw: pointer to hardware structure
5154 * @addr: The bypass eeprom address to read. 5157 * @addr: The bypass eeprom address to read.
5155 * @value: The 8b of data at the address above. 5158 * @value: The 8b of data at the address above.
5156 **/ 5159 **/
5157s32 ixgbe_bypass_rd_eep_generic(struct ixgbe_hw *hw, u32 addr, u8 *value) 5160s32 ixgbe_bypass_rd_eep_generic(struct ixgbe_hw *hw, u32 addr, u8 *value)
5158{ 5161{
5159 u32 cmd; 5162 u32 cmd;
5160 u32 status; 5163 u32 status;
5161 5164
5162 5165
5163 /* send the request */ 5166 /* send the request */
5164 cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; 5167 cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;

cvs diff -r1.4.8.2 -r1.4.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_dcb.c 2018/04/14 10:25:11 1.4.8.2
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb.c 2021/09/15 16:38:01 1.4.8.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_dcb.c,v 1.4.8.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 3 SPDX-License-Identifier: BSD-3-Clause
3 4
4 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 6 All rights reserved.
6 7
7 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
9 10
10 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
12 13
13 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -23,26 +24,28 @@ @@ -23,26 +24,28 @@
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE. 32 POSSIBILITY OF SUCH DAMAGE.
32 33
33******************************************************************************/ 34******************************************************************************/
34/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb.c 331224 2018-03-19 20:55:05Z erj $*/ 35/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb.c 331224 2018-03-19 20:55:05Z erj $*/
35 36
 37#include <sys/cdefs.h>
 38__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb.c,v 1.4.8.3 2021/09/15 16:38:01 martin Exp $");
36 39
37#include "ixgbe_type.h" 40#include "ixgbe_type.h"
38#include "ixgbe_dcb.h" 41#include "ixgbe_dcb.h"
39#include "ixgbe_dcb_82598.h" 42#include "ixgbe_dcb_82598.h"
40#include "ixgbe_dcb_82599.h" 43#include "ixgbe_dcb_82599.h"
41 44
42/** 45/**
43 * ixgbe_dcb_calculate_tc_credits - This calculates the ieee traffic class 46 * ixgbe_dcb_calculate_tc_credits - This calculates the ieee traffic class
44 * credits from the configured bandwidth percentages. Credits 47 * credits from the configured bandwidth percentages. Credits
45 * are the smallest unit programmable into the underlying 48 * are the smallest unit programmable into the underlying
46 * hardware. The IEEE 802.1Qaz specification do not use bandwidth 49 * hardware. The IEEE 802.1Qaz specification do not use bandwidth
47 * groups so this is much simplified from the CEE case. 50 * groups so this is much simplified from the CEE case.
48 * @bw: bandwidth index by traffic class 51 * @bw: bandwidth index by traffic class

cvs diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_dcb.h 2018/04/14 10:25:11 1.3.8.2
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb.h 2021/09/15 16:38:01 1.3.8.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_dcb.h,v 1.3.8.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 3 SPDX-License-Identifier: BSD-3-Clause
3 4
4 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 6 All rights reserved.
6 7
7 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
9 10
10 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
12 13
13 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright

cvs diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 2018/04/14 10:25:11 1.3.8.2
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 2021/09/15 16:38:01 1.3.8.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_dcb_82598.c,v 1.3.8.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 3 SPDX-License-Identifier: BSD-3-Clause
3 4
4 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 6 All rights reserved.
6 7
7 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
9 10
10 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
12 13
13 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -23,26 +24,28 @@ @@ -23,26 +24,28 @@
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE. 32 POSSIBILITY OF SUCH DAMAGE.
32 33
33******************************************************************************/ 34******************************************************************************/
34/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.c 331224 2018-03-19 20:55:05Z erj $*/ 35/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.c 331224 2018-03-19 20:55:05Z erj $*/
35 36
 37#include <sys/cdefs.h>
 38__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb_82598.c,v 1.3.8.3 2021/09/15 16:38:01 martin Exp $");
36 39
37#include "ixgbe_type.h" 40#include "ixgbe_type.h"
38#include "ixgbe_dcb.h" 41#include "ixgbe_dcb.h"
39#include "ixgbe_dcb_82598.h" 42#include "ixgbe_dcb_82598.h"
40 43
41/** 44/**
42 * ixgbe_dcb_get_tc_stats_82598 - Return status data for each traffic class 45 * ixgbe_dcb_get_tc_stats_82598 - Return status data for each traffic class
43 * @hw: pointer to hardware structure 46 * @hw: pointer to hardware structure
44 * @stats: pointer to statistics structure 47 * @stats: pointer to statistics structure
45 * @tc_count: Number of elements in bwg_array. 48 * @tc_count: Number of elements in bwg_array.
46 * 49 *
47 * This function returns the status data for each of the Traffic Classes in use. 50 * This function returns the status data for each of the Traffic Classes in use.
48 */ 51 */

cvs diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 2018/04/14 10:25:11 1.3.8.2
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 2021/09/15 16:38:01 1.3.8.3
@@ -1,13 +1,15 @@ @@ -1,13 +1,15 @@
 1/* $NetBSD: ixgbe_dcb_82598.h,v 1.3.8.3 2021/09/15 16:38:01 martin Exp $ */
 2
1/****************************************************************************** 3/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
3 5
4 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 7 All rights reserved.
6 8
7 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
9 11
10 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
12 14
13 2. Redistributions in binary form must reproduce the above copyright 15 2. Redistributions in binary form must reproduce the above copyright

cvs diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 2018/04/14 10:25:11 1.3.8.2
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 2021/09/15 16:38:01 1.3.8.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_dcb_82599.c,v 1.3.8.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 3 SPDX-License-Identifier: BSD-3-Clause
3 4
4 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 6 All rights reserved.
6 7
7 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
9 10
10 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
12 13
13 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -23,26 +24,28 @@ @@ -23,26 +24,28 @@
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE. 32 POSSIBILITY OF SUCH DAMAGE.
32 33
33******************************************************************************/ 34******************************************************************************/
34/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82599.c 331224 2018-03-19 20:55:05Z erj $*/ 35/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82599.c 331224 2018-03-19 20:55:05Z erj $*/
35 36
 37#include <sys/cdefs.h>
 38__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb_82599.c,v 1.3.8.3 2021/09/15 16:38:01 martin Exp $");
36 39
37#include "ixgbe_type.h" 40#include "ixgbe_type.h"
38#include "ixgbe_dcb.h" 41#include "ixgbe_dcb.h"
39#include "ixgbe_dcb_82599.h" 42#include "ixgbe_dcb_82599.h"
40 43
41/** 44/**
42 * ixgbe_dcb_get_tc_stats_82599 - Returns status for each traffic class 45 * ixgbe_dcb_get_tc_stats_82599 - Returns status for each traffic class
43 * @hw: pointer to hardware structure 46 * @hw: pointer to hardware structure
44 * @stats: pointer to statistics structure 47 * @stats: pointer to statistics structure
45 * @tc_count: Number of elements in bwg_array. 48 * @tc_count: Number of elements in bwg_array.
46 * 49 *
47 * This function returns the status data for each of the Traffic Classes in use. 50 * This function returns the status data for each of the Traffic Classes in use.
48 */ 51 */

cvs diff -r1.3.8.2 -r1.3.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 2018/04/14 10:25:11 1.3.8.2
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 2021/09/15 16:38:01 1.3.8.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_dcb_82599.h,v 1.3.8.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 3 SPDX-License-Identifier: BSD-3-Clause
3 4
4 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 6 All rights reserved.
6 7
7 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
9 10
10 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
12 13
13 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright

cvs diff -r1.6.8.3 -r1.6.8.4 src/sys/dev/pci/ixgbe/ixgbe_mbx.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_mbx.c 2019/07/22 17:53:35 1.6.8.3
+++ src/sys/dev/pci/ixgbe/ixgbe_mbx.c 2021/09/15 16:38:01 1.6.8.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_mbx.c,v 1.6.8.3 2019/07/22 17:53:35 martin Exp $ */ 1/* $NetBSD: ixgbe_mbx.c,v 1.6.8.4 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -25,26 +25,29 @@ @@ -25,26 +25,29 @@
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
34 34
35******************************************************************************/ 35******************************************************************************/
36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.c 326022 2017-11-20 19:36:21Z pfg $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.c 326022 2017-11-20 19:36:21Z pfg $*/
37 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_mbx.c,v 1.6.8.4 2021/09/15 16:38:01 martin Exp $");
 40
38#include "ixgbe_type.h" 41#include "ixgbe_type.h"
39#include "ixgbe_mbx.h" 42#include "ixgbe_mbx.h"
40 43
41/** 44/**
42 * ixgbe_clear_mbx - Clear Mailbox Memory 45 * ixgbe_clear_mbx - Clear Mailbox Memory
43 * @hw: pointer to the HW structure 46 * @hw: pointer to the HW structure
44 * @vf_number: id of mailbox to write 47 * @vf_number: id of mailbox to write
45 * 48 *
46 * Set VFMBMEM of given VF to 0x0. 49 * Set VFMBMEM of given VF to 0x0.
47 **/ 50 **/
48s32 ixgbe_clear_mbx(struct ixgbe_hw *hw, u16 vf_number) 51s32 ixgbe_clear_mbx(struct ixgbe_hw *hw, u16 vf_number)
49{ 52{
50 struct ixgbe_mbx_info *mbx = &hw->mbx; 53 struct ixgbe_mbx_info *mbx = &hw->mbx;

cvs diff -r1.6.2.6 -r1.6.2.7 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c 2020/08/05 15:58:02 1.6.2.6
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c 2021/09/15 16:38:01 1.6.2.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.6 2020/08/05 15:58:02 martin Exp $ */ 1/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.7 2021/09/15 16:38:01 martin Exp $ */
2/* 2/*
3 * Copyright (c) 2011 The NetBSD Foundation, Inc. 3 * Copyright (c) 2011 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Coyote Point Systems, Inc. 7 * by Coyote Point Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -17,26 +17,30 @@ @@ -17,26 +17,30 @@
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
 30
 31#include <sys/cdefs.h>
 32__KERNEL_RCSID(0, "$NetBSD: ixgbe_netbsd.c,v 1.6.2.7 2021/09/15 16:38:01 martin Exp $");
 33
30#include <sys/param.h> 34#include <sys/param.h>
31 35
32#include <sys/atomic.h> 36#include <sys/atomic.h>
33#include <sys/bus.h> 37#include <sys/bus.h>
34#include <sys/condvar.h> 38#include <sys/condvar.h>
35#include <sys/cpu.h> 39#include <sys/cpu.h>
36#include <sys/kmem.h> 40#include <sys/kmem.h>
37#include <sys/mbuf.h> 41#include <sys/mbuf.h>
38#include <sys/mutex.h> 42#include <sys/mutex.h>
39#include <sys/queue.h> 43#include <sys/queue.h>
40#include <sys/workqueue.h> 44#include <sys/workqueue.h>
41#include <dev/pci/pcivar.h> 45#include <dev/pci/pcivar.h>
42 46
@@ -85,212 +89,39 @@ ixgbe_dmamap_sync(ixgbe_dma_tag_t *dt, b @@ -85,212 +89,39 @@ ixgbe_dmamap_sync(ixgbe_dma_tag_t *dt, b
85void 89void
86ixgbe_dmamap_unload(ixgbe_dma_tag_t *dt, bus_dmamap_t dmam) 90ixgbe_dmamap_unload(ixgbe_dma_tag_t *dt, bus_dmamap_t dmam)
87{ 91{
88 bus_dmamap_unload(dt->dt_dmat, dmam); 92 bus_dmamap_unload(dt->dt_dmat, dmam);
89} 93}
90 94
91int 95int
92ixgbe_dmamap_create(ixgbe_dma_tag_t *dt, int flags, bus_dmamap_t *dmamp) 96ixgbe_dmamap_create(ixgbe_dma_tag_t *dt, int flags, bus_dmamap_t *dmamp)
93{ 97{
94 return bus_dmamap_create(dt->dt_dmat, dt->dt_maxsize, dt->dt_nsegments, 98 return bus_dmamap_create(dt->dt_dmat, dt->dt_maxsize, dt->dt_nsegments,
95 dt->dt_maxsegsize, dt->dt_boundary, flags, dmamp); 99 dt->dt_maxsegsize, dt->dt_boundary, flags, dmamp);
96} 100}
97 101
98static void 
99ixgbe_putext(ixgbe_extmem_t *em) 
100{ 
101 ixgbe_extmem_head_t *eh = em->em_head; 
102 
103 mutex_enter(&eh->eh_mtx); 
104 
105 TAILQ_INSERT_HEAD(&eh->eh_freelist, em, em_link); 
106 
107 mutex_exit(&eh->eh_mtx); 
108 
109 return; 
110} 
111 
112static ixgbe_extmem_t * 
113ixgbe_getext(ixgbe_extmem_head_t *eh, size_t size) 
114{ 
115 ixgbe_extmem_t *em; 
116 
117 mutex_enter(&eh->eh_mtx); 
118 
119 TAILQ_FOREACH(em, &eh->eh_freelist, em_link) { 
120 if (em->em_size >= size) 
121 break; 
122 } 
123 
124 if (em != NULL) 
125 TAILQ_REMOVE(&eh->eh_freelist, em, em_link); 
126 
127 mutex_exit(&eh->eh_mtx); 
128 
129 return em; 
130} 
131 
132static ixgbe_extmem_t * 
133ixgbe_newext(ixgbe_extmem_head_t *eh, bus_dma_tag_t dmat, size_t size) 
134{ 
135 ixgbe_extmem_t *em; 
136 int nseg, rc; 
137 
138 em = kmem_zalloc(sizeof(*em), KM_SLEEP); 
139 
140 rc = bus_dmamem_alloc(dmat, size, PAGE_SIZE, 0, &em->em_seg, 1, &nseg, 
141 BUS_DMA_WAITOK); 
142 
143 if (rc != 0) 
144 goto post_zalloc_err; 
145 
146 rc = bus_dmamem_map(dmat, &em->em_seg, 1, size, &em->em_vaddr, 
147 BUS_DMA_WAITOK); 
148 
149 if (rc != 0) 
150 goto post_dmamem_err; 
151 
152 em->em_dmat = dmat; 
153 em->em_size = size; 
154 em->em_head = eh; 
155 
156 return em; 
157post_dmamem_err: 
158 bus_dmamem_free(dmat, &em->em_seg, 1); 
159post_zalloc_err: 
160 kmem_free(em, sizeof(*em)); 
161 return NULL; 
162} 
163 
164static void 
165ixgbe_jcl_freeall(struct adapter *adapter, struct rx_ring *rxr) 
166{ 
167 ixgbe_extmem_head_t *eh = &rxr->jcl_head; 
168 ixgbe_extmem_t *em; 
169 bus_dma_tag_t dmat = rxr->ptag->dt_dmat; 
170 
171 while ((em = ixgbe_getext(eh, 0)) != NULL) { 
172 KASSERT(em->em_vaddr != NULL); 
173 bus_dmamem_unmap(dmat, em->em_vaddr, em->em_size); 
174 bus_dmamem_free(dmat, &em->em_seg, 1); 
175 memset(em, 0, sizeof(*em)); 
176 kmem_free(em, sizeof(*em)); 
177 } 
178} 
179 
180void 
181ixgbe_jcl_reinit(struct adapter *adapter, bus_dma_tag_t dmat, 
182 struct rx_ring *rxr, int nbuf, size_t size) 
183{ 
184 ixgbe_extmem_head_t *eh = &rxr->jcl_head; 
185 ixgbe_extmem_t *em; 
186 int i; 
187 
188 if (!eh->eh_initialized) { 
189 TAILQ_INIT(&eh->eh_freelist); 
190 mutex_init(&eh->eh_mtx, MUTEX_DEFAULT, IPL_NET); 
191 eh->eh_initialized = true; 
192 } 
193 
194 /* 
195 * Check previous parameters. If it's not required to reinit, just 
196 * return. 
197 * 
198 * Note that the num_rx_desc is currently fixed value. It's never 
199 * changed after device is attached. 
200 */ 
201 if ((rxr->last_rx_mbuf_sz == rxr->mbuf_sz) 
202 && (rxr->last_num_rx_desc == adapter->num_rx_desc)) 
203 return; 
204 
205 /* Free all dmamem */ 
206 ixgbe_jcl_freeall(adapter, rxr); 
207 
208 for (i = 0; i < nbuf; i++) { 
209 if ((em = ixgbe_newext(eh, dmat, size)) == NULL) { 
210 device_printf(adapter->dev, 
211 "%s: only %d of %d jumbo buffers allocated\n", 
212 __func__, i, nbuf); 
213 break; 
214 } 
215 ixgbe_putext(em); 
216 } 
217 
218 /* Keep current parameters */ 
219 rxr->last_rx_mbuf_sz = adapter->rx_mbuf_sz; 
220 rxr->last_num_rx_desc = adapter->num_rx_desc; 
221} 
222 
223void 
224ixgbe_jcl_destroy(struct adapter *adapter, struct rx_ring *rxr) 
225{ 
226 ixgbe_extmem_head_t *eh = &rxr->jcl_head; 
227 
228 if (eh->eh_initialized) { 
229 /* Free all dmamem */ 
230 ixgbe_jcl_freeall(adapter, rxr); 
231 102
232 mutex_destroy(&eh->eh_mtx); 
233 eh->eh_initialized = false; 
234 } 
235} 
236 
237 
238static void 
239ixgbe_jcl_free(struct mbuf *m, void *buf, size_t size, void *arg) 
240{ 
241 ixgbe_extmem_t *em = arg; 
242 
243 KASSERT(em->em_size == size); 
244 
245 ixgbe_putext(em); 
246 /* this is an abstraction violation, but it does not lead to a 
247 * double-free 
248 */ 
249 if (__predict_true(m != NULL)) { 
250 KASSERT(m->m_type != MT_FREE); 
251 m->m_type = MT_FREE; 
252 pool_cache_put(mb_cache, m); 
253 } 
254} 
255 
256/* XXX need to wait for the system to finish with each jumbo mbuf and 
257 * free it before detaching the driver from the device. 
258 */ 
259struct mbuf * 103struct mbuf *
260ixgbe_getjcl(ixgbe_extmem_head_t *eh, int nowait /* M_DONTWAIT */, 104ixgbe_getcl(void)
261 int type /* MT_DATA */, int flags /* M_PKTHDR */, size_t size) 
262{ 105{
263 ixgbe_extmem_t *em; 
264 struct mbuf *m; 106 struct mbuf *m;
265 107
266 if ((flags & M_PKTHDR) != 0) 108 MGETHDR(m, M_DONTWAIT, MT_DATA);
267 m = m_gethdr(nowait, type); 
268 else 
269 m = m_get(nowait, type); 
270 109
271 if (m == NULL) 110 if (m == NULL)
272 return NULL; 111 return NULL;
273 112
274 em = ixgbe_getext(eh, size); 113 MCLGET(m, M_DONTWAIT);
275 if (em == NULL) { 
276 m_freem(m); 
277 return NULL; 
278 } 
279 
280 MEXTADD(m, em->em_vaddr, em->em_size, M_DEVBUF, &ixgbe_jcl_free, em); 
281 
282 if ((m->m_flags & M_EXT) == 0) { 114 if ((m->m_flags & M_EXT) == 0) {
283 ixgbe_putext(em); 
284 m_freem(m); 115 m_freem(m);
285 return NULL; 116 return NULL;
286 } 117 }
287 118
288 return m; 119 return m;
289} 120}
290 121
291void 122void
292ixgbe_pci_enable_busmaster(pci_chipset_tag_t pc, pcitag_t tag) 123ixgbe_pci_enable_busmaster(pci_chipset_tag_t pc, pcitag_t tag)
293{ 124{
294 pcireg_t pci_cmd_word; 125 pcireg_t pci_cmd_word;
295 126
296 pci_cmd_word = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); 127 pci_cmd_word = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);

cvs diff -r1.7.6.3 -r1.7.6.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.h 2021/03/11 16:04:25 1.7.6.3
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.h 2021/09/15 16:38:01 1.7.6.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/*$NetBSD: ixgbe_netbsd.h,v 1.7.6.3 2021/03/11 16:04:25 martin Exp $*/ 1/* $NetBSD: ixgbe_netbsd.h,v 1.7.6.4 2021/09/15 16:38:01 martin Exp $ */
2/* 2/*
3 * Copyright (c) 2011 The NetBSD Foundation, Inc. 3 * Copyright (c) 2011 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Coyote Point Systems, Inc. 7 * by Coyote Point Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -31,85 +31,51 @@ @@ -31,85 +31,51 @@
31#ifndef _IXGBE_NETBSD_H 31#ifndef _IXGBE_NETBSD_H
32#define _IXGBE_NETBSD_H 32#define _IXGBE_NETBSD_H
33 33
34#if 0 /* Enable this if you don't want to use TX multiqueue function */ 34#if 0 /* Enable this if you don't want to use TX multiqueue function */
35#define IXGBE_LEGACY_TX 1 35#define IXGBE_LEGACY_TX 1
36#endif 36#endif
37 37
38#define ETHERCAP_VLAN_HWFILTER 0 38#define ETHERCAP_VLAN_HWFILTER 0
39#define ETHERCAP_VLAN_HWCSUM 0 39#define ETHERCAP_VLAN_HWCSUM 0
40#define MJUM9BYTES (9 * 1024) 40#define MJUM9BYTES (9 * 1024)
41#define MJUM16BYTES (16 * 1024) 41#define MJUM16BYTES (16 * 1024)
42#define MJUMPAGESIZE PAGE_SIZE 42#define MJUMPAGESIZE PAGE_SIZE
43 43
44/* 
45 * Number of jcl per queue is calculated by 
46 * adapter->num_rx_desc * IXGBE_JCLNUM_MULTI. The lower limit is 2. 
47 */ 
48#define IXGBE_JCLNUM_MULTI_LOWLIM 2 
49#define IXGBE_JCLNUM_MULTI_DEFAULT 3 
50#if !defined(IXGBE_JCLNUM_MULTI) 
51# define IXGBE_JCLNUM_MULTI IXGBE_JCLNUM_MULTI_DEFAULT 
52#else 
53# if (IXGBE_JCLNUM_MULTI < IXGBE_JCLNUM_MULTI_LOWLIM) 
54# error IXGBE_JCLNUM_MULTI is too low. 
55# endif 
56#endif 
57 
58#define IFCAP_RXCSUM \ 44#define IFCAP_RXCSUM \
59 (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|\ 45 (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|\
60 IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx) 46 IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx)
61 47
62#define IFCAP_TXCSUM \ 48#define IFCAP_TXCSUM \
63 (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx|\ 49 (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx|\
64 IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_UDPv6_Tx) 50 IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_UDPv6_Tx)
65 51
66#define IFCAP_HWCSUM (IFCAP_RXCSUM|IFCAP_TXCSUM) 52#define IFCAP_HWCSUM (IFCAP_RXCSUM|IFCAP_TXCSUM)
67 53
68#define ETHER_ALIGN 2 54#define ETHER_ALIGN 2
69 55
70struct ixgbe_dma_tag { 56struct ixgbe_dma_tag {
71 bus_dma_tag_t dt_dmat; 57 bus_dma_tag_t dt_dmat;
72 bus_size_t dt_alignment; 58 bus_size_t dt_alignment;
73 bus_size_t dt_boundary; 59 bus_size_t dt_boundary;
74 bus_size_t dt_maxsize; 60 bus_size_t dt_maxsize;
75 int dt_nsegments; 61 int dt_nsegments;
76 bus_size_t dt_maxsegsize; 62 bus_size_t dt_maxsegsize;
77 int dt_flags; 63 int dt_flags;
78}; 64};
79 65
80typedef struct ixgbe_dma_tag ixgbe_dma_tag_t; 66typedef struct ixgbe_dma_tag ixgbe_dma_tag_t;
81 67
82struct ixgbe_extmem_head; 68int ixgbe_dma_tag_create(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
83typedef struct ixgbe_extmem_head ixgbe_extmem_head_t; 69 int, bus_size_t, int, ixgbe_dma_tag_t **);
84 
85struct ixgbe_extmem { 
86 ixgbe_extmem_head_t *em_head; 
87 bus_dma_tag_t em_dmat; 
88 bus_size_t em_size; 
89 bus_dma_segment_t em_seg; 
90 void *em_vaddr; 
91 TAILQ_ENTRY(ixgbe_extmem) em_link; 
92}; 
93 
94typedef struct ixgbe_extmem ixgbe_extmem_t; 
95 
96struct ixgbe_extmem_head { 
97 TAILQ_HEAD(, ixgbe_extmem) eh_freelist; 
98 kmutex_t eh_mtx; 
99 bool eh_initialized; 
100}; 
101 
102int ixgbe_dma_tag_create(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, int, 
103 bus_size_t, int, ixgbe_dma_tag_t **); 
104void ixgbe_dma_tag_destroy(ixgbe_dma_tag_t *); 70void ixgbe_dma_tag_destroy(ixgbe_dma_tag_t *);
105int ixgbe_dmamap_create(ixgbe_dma_tag_t *, int, bus_dmamap_t *); 71int ixgbe_dmamap_create(ixgbe_dma_tag_t *, int, bus_dmamap_t *);
106void ixgbe_dmamap_destroy(ixgbe_dma_tag_t *, bus_dmamap_t); 72void ixgbe_dmamap_destroy(ixgbe_dma_tag_t *, bus_dmamap_t);
107void ixgbe_dmamap_sync(ixgbe_dma_tag_t *, bus_dmamap_t, int); 73void ixgbe_dmamap_sync(ixgbe_dma_tag_t *, bus_dmamap_t, int);
108void ixgbe_dmamap_unload(ixgbe_dma_tag_t *, bus_dmamap_t); 74void ixgbe_dmamap_unload(ixgbe_dma_tag_t *, bus_dmamap_t);
109 75
110struct mbuf *ixgbe_getjcl(ixgbe_extmem_head_t *, int, int, int, size_t); 76struct mbuf *ixgbe_getcl(void);
111void ixgbe_pci_enable_busmaster(pci_chipset_tag_t, pcitag_t); 77void ixgbe_pci_enable_busmaster(pci_chipset_tag_t, pcitag_t);
112 78
113u_int atomic_load_acq_uint(volatile u_int *); 79u_int atomic_load_acq_uint(volatile u_int *);
114 80
115#endif /* _IXGBE_NETBSD_H */ 81#endif /* _IXGBE_NETBSD_H */

cvs diff -r1.1.12.4 -r1.1.12.5 src/sys/dev/pci/ixgbe/ixgbe_osdep.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_osdep.c 2020/01/24 18:37:31 1.1.12.4
+++ src/sys/dev/pci/ixgbe/ixgbe_osdep.c 2021/09/15 16:38:01 1.1.12.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_osdep.c,v 1.1.12.4 2020/01/24 18:37:31 martin Exp $ */ 1/* $NetBSD: ixgbe_osdep.c,v 1.1.12.5 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 4
5 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
6 All rights reserved. 6 All rights reserved.
7 7
8 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
10 10
11 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
13 13
14 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -24,26 +24,29 @@ @@ -24,26 +24,29 @@
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE. 32 POSSIBILITY OF SUCH DAMAGE.
33 33
34******************************************************************************/ 34******************************************************************************/
35/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.c 327031 2017-12-20 18:15:06Z erj $*/ 35/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.c 327031 2017-12-20 18:15:06Z erj $*/
36 36
 37#include <sys/cdefs.h>
 38__KERNEL_RCSID(0, "$NetBSD: ixgbe_osdep.c,v 1.1.12.5 2021/09/15 16:38:01 martin Exp $");
 39
37#include "ixgbe_osdep.h" 40#include "ixgbe_osdep.h"
38#include "ixgbe.h" 41#include "ixgbe.h"
39 42
40inline device_t 43inline device_t
41ixgbe_dev_from_hw(struct ixgbe_hw *hw) 44ixgbe_dev_from_hw(struct ixgbe_hw *hw)
42{ 45{
43 return ((struct adapter *)hw->back)->dev; 46 return ((struct adapter *)hw->back)->dev;
44} 47}
45 48
46u16 49u16
47ixgbe_read_pci_cfg(struct ixgbe_hw *hw, u32 reg) 50ixgbe_read_pci_cfg(struct ixgbe_hw *hw, u32 reg)
48{ 51{
49 pci_chipset_tag_t pc = hw->back->osdep.pc; 52 pci_chipset_tag_t pc = hw->back->osdep.pc;

cvs diff -r1.17.6.7 -r1.17.6.8 src/sys/dev/pci/ixgbe/ixgbe_osdep.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_osdep.h 2020/08/05 15:58:02 1.17.6.7
+++ src/sys/dev/pci/ixgbe/ixgbe_osdep.h 2021/09/15 16:38:01 1.17.6.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_osdep.h,v 1.17.6.7 2020/08/05 15:58:02 martin Exp $ */ 1/* $NetBSD: ixgbe_osdep.h,v 1.17.6.8 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -169,55 +169,35 @@ typedef uint64_t u64; @@ -169,55 +169,35 @@ typedef uint64_t u64;
169#endif 169#endif
170#endif 170#endif
171 171
172#if defined(__i386__) || defined(__amd64__) 172#if defined(__i386__) || defined(__amd64__)
173static __inline 173static __inline
174void prefetch(void *x) 174void prefetch(void *x)
175{ 175{
176 __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); 176 __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
177} 177}
178#else 178#else
179#define prefetch(x) 179#define prefetch(x)
180#endif 180#endif
181 181
182/* 
183 * Optimized bcopy thanks to Luigi Rizzo's investigative work. Assumes 
184 * non-overlapping regions and 32-byte padding on both src and dst. 
185 */ 
186static __inline int 
187ixgbe_bcopy(void *restrict _src, void *restrict _dst, int l) 
188{ 
189 uint64_t *src = _src; 
190 uint64_t *dst = _dst; 
191 
192 for (; l > 0; l -= 32) { 
193 *dst++ = *src++; 
194 *dst++ = *src++; 
195 *dst++ = *src++; 
196 *dst++ = *src++; 
197 } 
198 return (0); 
199} 
200 
201struct ixgbe_osdep 182struct ixgbe_osdep
202{ 183{
203 struct ethercom ec; 184 struct ethercom ec;
204 pci_chipset_tag_t pc; 185 pci_chipset_tag_t pc;
205 pcitag_t tag; 186 pcitag_t tag;
206 bus_space_tag_t mem_bus_space_tag; 187 bus_space_tag_t mem_bus_space_tag;
207 bus_space_handle_t mem_bus_space_handle; 188 bus_space_handle_t mem_bus_space_handle;
208 bus_size_t mem_size; 189 bus_size_t mem_size;
209 bus_dma_tag_t dmat; 190 bus_dma_tag_t dmat;
210 u16 last_rx_mbuf_sz; 
211 pci_intr_handle_t *intrs; 191 pci_intr_handle_t *intrs;
212 int nintrs; 192 int nintrs;
213 void *ihs[IXG_MAX_NINTR]; 193 void *ihs[IXG_MAX_NINTR];
214 bool attached; 194 bool attached;
215}; 195};
216 196
217/* These routines need struct ixgbe_hw declared */ 197/* These routines need struct ixgbe_hw declared */
218struct ixgbe_hw; 198struct ixgbe_hw;
219device_t ixgbe_dev_from_hw(struct ixgbe_hw *hw); 199device_t ixgbe_dev_from_hw(struct ixgbe_hw *hw);
220 200
221/* These routines are needed by the shared code */ 201/* These routines are needed by the shared code */
222extern u16 ixgbe_read_pci_cfg(struct ixgbe_hw *, u32); 202extern u16 ixgbe_read_pci_cfg(struct ixgbe_hw *, u32);
223#define IXGBE_READ_PCIE_WORD ixgbe_read_pci_cfg 203#define IXGBE_READ_PCIE_WORD ixgbe_read_pci_cfg

cvs diff -r1.11.6.7 -r1.11.6.8 src/sys/dev/pci/ixgbe/ixgbe_phy.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_phy.c 2020/09/02 12:27:54 1.11.6.7
+++ src/sys/dev/pci/ixgbe/ixgbe_phy.c 2021/09/15 16:38:01 1.11.6.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_phy.c,v 1.11.6.7 2020/09/02 12:27:54 martin Exp $ */ 1/* $NetBSD: ixgbe_phy.c,v 1.11.6.8 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -25,26 +25,29 @@ @@ -25,26 +25,29 @@
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
34 34
35******************************************************************************/ 35******************************************************************************/
36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.c 331224 2018-03-19 20:55:05Z erj $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.c 331224 2018-03-19 20:55:05Z erj $*/
37 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_phy.c,v 1.11.6.8 2021/09/15 16:38:01 martin Exp $");
 40
38#include "ixgbe_api.h" 41#include "ixgbe_api.h"
39#include "ixgbe_common.h" 42#include "ixgbe_common.h"
40#include "ixgbe_phy.h" 43#include "ixgbe_phy.h"
41 44
42#include <dev/mii/mdio.h> 45#include <dev/mii/mdio.h>
43 46
44static void ixgbe_i2c_start(struct ixgbe_hw *hw); 47static void ixgbe_i2c_start(struct ixgbe_hw *hw);
45static void ixgbe_i2c_stop(struct ixgbe_hw *hw); 48static void ixgbe_i2c_stop(struct ixgbe_hw *hw);
46static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data); 49static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data);
47static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data); 50static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data);
48static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw); 51static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw);
49static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data); 52static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data);
50static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data); 53static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data);

cvs diff -r1.2.2.4 -r1.2.2.5 src/sys/dev/pci/ixgbe/ixgbe_rss.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_rss.h 2018/04/14 10:25:11 1.2.2.4
+++ src/sys/dev/pci/ixgbe/ixgbe_rss.h 2021/09/15 16:38:01 1.2.2.5
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_rss.h,v 1.2.2.5 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the

cvs diff -r1.1.4.4 -r1.1.4.5 src/sys/dev/pci/ixgbe/ixgbe_sriov.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_sriov.h 2018/04/14 10:25:11 1.1.4.4
+++ src/sys/dev/pci/ixgbe/ixgbe_sriov.h 2021/09/15 16:38:01 1.1.4.5
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_sriov.h,v 1.1.4.5 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the

cvs diff -r1.22.2.12 -r1.22.2.13 src/sys/dev/pci/ixgbe/ixgbe_type.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_type.h 2020/09/02 12:27:54 1.22.2.12
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h 2021/09/15 16:38:01 1.22.2.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_type.h,v 1.22.2.12 2020/09/02 12:27:54 martin Exp $ */ 1/* $NetBSD: ixgbe_type.h,v 1.22.2.13 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -2763,27 +2763,27 @@ enum { @@ -2763,27 +2763,27 @@ enum {
2763#define IXGBE_RXD_ERR_OSE 0x10 /* Oversize Error */ 2763#define IXGBE_RXD_ERR_OSE 0x10 /* Oversize Error */
2764#define IXGBE_RXD_ERR_USE 0x20 /* Undersize Error */ 2764#define IXGBE_RXD_ERR_USE 0x20 /* Undersize Error */
2765#define IXGBE_RXD_ERR_TCPE 0x40 /* TCP/UDP Checksum Error */ 2765#define IXGBE_RXD_ERR_TCPE 0x40 /* TCP/UDP Checksum Error */
2766#define IXGBE_RXD_ERR_IPE 0x80 /* IP Checksum Error */ 2766#define IXGBE_RXD_ERR_IPE 0x80 /* IP Checksum Error */
2767#define IXGBE_RXDADV_ERR_MASK 0xfff00000 /* RDESC.ERRORS mask */ 2767#define IXGBE_RXDADV_ERR_MASK 0xfff00000 /* RDESC.ERRORS mask */
2768#define IXGBE_RXDADV_ERR_SHIFT 20 /* RDESC.ERRORS shift */ 2768#define IXGBE_RXDADV_ERR_SHIFT 20 /* RDESC.ERRORS shift */
2769#define IXGBE_RXDADV_ERR_OUTERIPER 0x04000000 /* CRC IP Header error */ 2769#define IXGBE_RXDADV_ERR_OUTERIPER 0x04000000 /* CRC IP Header error */
2770#define IXGBE_RXDADV_ERR_RXE 0x20000000 /* Any MAC Error */ 2770#define IXGBE_RXDADV_ERR_RXE 0x20000000 /* Any MAC Error */
2771#define IXGBE_RXDADV_ERR_FCEOFE 0x80000000 /* FCEOFe/IPE */ 2771#define IXGBE_RXDADV_ERR_FCEOFE 0x80000000 /* FCEOFe/IPE */
2772#define IXGBE_RXDADV_ERR_FCERR 0x00700000 /* FCERR/FDIRERR */ 2772#define IXGBE_RXDADV_ERR_FCERR 0x00700000 /* FCERR/FDIRERR */
2773#define IXGBE_RXDADV_ERR_FDIR_LEN 0x00100000 /* FDIR Length error */ 2773#define IXGBE_RXDADV_ERR_FDIR_LEN 0x00100000 /* FDIR Length error */
2774#define IXGBE_RXDADV_ERR_FDIR_DROP 0x00200000 /* FDIR Drop error */ 2774#define IXGBE_RXDADV_ERR_FDIR_DROP 0x00200000 /* FDIR Drop error */
2775#define IXGBE_RXDADV_ERR_FDIR_COLL 0x00400000 /* FDIR Collision error */ 2775#define IXGBE_RXDADV_ERR_FDIR_COLL 0x00400000 /* FDIR Collision error */
2776#define IXGBE_RXDADV_ERR_HBO 0x00800000 /*Header Buffer Overflow */ 2776#define IXGBE_RXDADV_ERR_HBO 0x00800000 /* Header Buffer Overflow */
2777#define IXGBE_RXDADV_ERR_CE 0x01000000 /* CRC Error */ 2777#define IXGBE_RXDADV_ERR_CE 0x01000000 /* CRC Error */
2778#define IXGBE_RXDADV_ERR_LE 0x02000000 /* Length Error */ 2778#define IXGBE_RXDADV_ERR_LE 0x02000000 /* Length Error */
2779#define IXGBE_RXDADV_ERR_PE 0x08000000 /* Packet Error */ 2779#define IXGBE_RXDADV_ERR_PE 0x08000000 /* Packet Error */
2780#define IXGBE_RXDADV_ERR_OSE 0x10000000 /* Oversize Error */ 2780#define IXGBE_RXDADV_ERR_OSE 0x10000000 /* Oversize Error */
2781#define IXGBE_RXDADV_ERR_USE 0x20000000 /* Undersize Error */ 2781#define IXGBE_RXDADV_ERR_USE 0x20000000 /* Undersize Error */
2782#define IXGBE_RXDADV_ERR_TCPE 0x40000000 /* TCP/UDP Checksum Error */ 2782#define IXGBE_RXDADV_ERR_TCPE 0x40000000 /* TCP/UDP Checksum Error */
2783#define IXGBE_RXDADV_ERR_IPE 0x80000000 /* IP Checksum Error */ 2783#define IXGBE_RXDADV_ERR_IPE 0x80000000 /* IP Checksum Error */
2784#define IXGBE_RXD_VLAN_ID_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ 2784#define IXGBE_RXD_VLAN_ID_MASK 0x0FFF /* VLAN ID is in lower 12 bits */
2785#define IXGBE_RXD_PRI_MASK 0xE000 /* Priority is in upper 3 bits */ 2785#define IXGBE_RXD_PRI_MASK 0xE000 /* Priority is in upper 3 bits */
2786#define IXGBE_RXD_PRI_SHIFT 13 2786#define IXGBE_RXD_PRI_SHIFT 13
2787#define IXGBE_RXD_CFI_MASK 0x1000 /* CFI is bit 12 */ 2787#define IXGBE_RXD_CFI_MASK 0x1000 /* CFI is bit 12 */
2788#define IXGBE_RXD_CFI_SHIFT 12 2788#define IXGBE_RXD_CFI_SHIFT 12
2789 2789

cvs diff -r1.12.8.6 -r1.12.8.7 src/sys/dev/pci/ixgbe/ixgbe_vf.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_vf.c 2021/03/11 16:04:25 1.12.8.6
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.c 2021/09/15 16:38:01 1.12.8.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe_vf.c,v 1.12.8.6 2021/03/11 16:04:25 martin Exp $ */ 1/* $NetBSD: ixgbe_vf.c,v 1.12.8.7 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
5 5
6 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
7 All rights reserved. 7 All rights reserved.
8 8
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
11 11
12 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
14 14
@@ -25,26 +25,28 @@ @@ -25,26 +25,28 @@
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
34 34
35******************************************************************************/ 35******************************************************************************/
36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 331224 2018-03-19 20:55:05Z erj $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 331224 2018-03-19 20:55:05Z erj $*/
37 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_vf.c,v 1.12.8.7 2021/09/15 16:38:01 martin Exp $");
38 40
39#include "ixgbe_api.h" 41#include "ixgbe_api.h"
40#include "ixgbe_type.h" 42#include "ixgbe_type.h"
41#include "ixgbe_vf.h" 43#include "ixgbe_vf.h"
42 44
43#ifndef IXGBE_VFWRITE_REG 45#ifndef IXGBE_VFWRITE_REG
44#define IXGBE_VFWRITE_REG IXGBE_WRITE_REG 46#define IXGBE_VFWRITE_REG IXGBE_WRITE_REG
45#endif 47#endif
46#ifndef IXGBE_VFREAD_REG 48#ifndef IXGBE_VFREAD_REG
47#define IXGBE_VFREAD_REG IXGBE_READ_REG 49#define IXGBE_VFREAD_REG IXGBE_READ_REG
48#endif 50#endif
49 51
50/** 52/**

cvs diff -r1.9.6.5 -r1.9.6.6 src/sys/dev/pci/ixgbe/ixgbe_x540.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_x540.c 2021/03/11 16:04:25 1.9.6.5
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.c 2021/09/15 16:38:01 1.9.6.6
@@ -1,13 +1,15 @@ @@ -1,13 +1,15 @@
 1/* $NetBSD: ixgbe_x540.c,v 1.9.6.6 2021/09/15 16:38:01 martin Exp $ */
 2
1/****************************************************************************** 3/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 4 SPDX-License-Identifier: BSD-3-Clause
3 5
4 Copyright (c) 2001-2017, Intel Corporation 6 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 7 All rights reserved.
6 8
7 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 10 modification, are permitted provided that the following conditions are met:
9 11
10 1. Redistributions of source code must retain the above copyright notice, 12 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 13 this list of conditions and the following disclaimer.
12 14
13 2. Redistributions in binary form must reproduce the above copyright 15 2. Redistributions in binary form must reproduce the above copyright
@@ -23,26 +25,29 @@ @@ -23,26 +25,29 @@
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE. 33 POSSIBILITY OF SUCH DAMAGE.
32 34
33******************************************************************************/ 35******************************************************************************/
34/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.c 331224 2018-03-19 20:55:05Z erj $*/ 36/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.c 331224 2018-03-19 20:55:05Z erj $*/
35 37
 38#include <sys/cdefs.h>
 39__KERNEL_RCSID(0, "$NetBSD: ixgbe_x540.c,v 1.9.6.6 2021/09/15 16:38:01 martin Exp $");
 40
36#include "ixgbe_x540.h" 41#include "ixgbe_x540.h"
37#include "ixgbe_type.h" 42#include "ixgbe_type.h"
38#include "ixgbe_api.h" 43#include "ixgbe_api.h"
39#include "ixgbe_common.h" 44#include "ixgbe_common.h"
40#include "ixgbe_phy.h" 45#include "ixgbe_phy.h"
41 46
42#define IXGBE_X540_MAX_TX_QUEUES 128 47#define IXGBE_X540_MAX_TX_QUEUES 128
43#define IXGBE_X540_MAX_RX_QUEUES 128 48#define IXGBE_X540_MAX_RX_QUEUES 128
44#define IXGBE_X540_RAR_ENTRIES 128 49#define IXGBE_X540_RAR_ENTRIES 128
45#define IXGBE_X540_MC_TBL_SIZE 128 50#define IXGBE_X540_MC_TBL_SIZE 128
46#define IXGBE_X540_VFT_TBL_SIZE 128 51#define IXGBE_X540_VFT_TBL_SIZE 128
47#define IXGBE_X540_RX_PB_SIZE 384 52#define IXGBE_X540_RX_PB_SIZE 384
48 53

cvs diff -r1.5.8.2 -r1.5.8.3 src/sys/dev/pci/ixgbe/ixgbe_x540.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_x540.h 2018/04/14 10:25:11 1.5.8.2
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.h 2021/09/15 16:38:01 1.5.8.3
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_x540.h,v 1.5.8.3 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause 3 SPDX-License-Identifier: BSD-3-Clause
3 4
4 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
5 All rights reserved. 6 All rights reserved.
6 7
7 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
9 10
10 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
12 13
13 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright

cvs diff -r1.5.6.9 -r1.5.6.10 src/sys/dev/pci/ixgbe/ixgbe_x550.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_x550.c 2020/09/02 12:27:54 1.5.6.9
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c 2021/09/15 16:38:01 1.5.6.10
@@ -1,13 +1,15 @@ @@ -1,13 +1,15 @@
 1/* $NetBSD: ixgbe_x550.c,v 1.5.6.10 2021/09/15 16:38:01 martin Exp $ */
 2
1/****************************************************************************** 3/******************************************************************************
2 4
3 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 6 All rights reserved.
5 7
6 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
8 10
9 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
11 13
12 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 15 notice, this list of conditions and the following disclaimer in the
@@ -22,26 +24,29 @@ @@ -22,26 +24,29 @@
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE. 32 POSSIBILITY OF SUCH DAMAGE.
31 33
32******************************************************************************/ 34******************************************************************************/
33/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x550.c 331224 2018-03-19 20:55:05Z erj $*/ 35/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x550.c 331224 2018-03-19 20:55:05Z erj $*/
34 36
 37#include <sys/cdefs.h>
 38__KERNEL_RCSID(0, "$NetBSD: ixgbe_x550.c,v 1.5.6.10 2021/09/15 16:38:01 martin Exp $");
 39
35#include "ixgbe_x550.h" 40#include "ixgbe_x550.h"
36#include "ixgbe_x540.h" 41#include "ixgbe_x540.h"
37#include "ixgbe_type.h" 42#include "ixgbe_type.h"
38#include "ixgbe_api.h" 43#include "ixgbe_api.h"
39#include "ixgbe_common.h" 44#include "ixgbe_common.h"
40#include "ixgbe_phy.h" 45#include "ixgbe_phy.h"
41#include <dev/mii/mii.h> 46#include <dev/mii/mii.h>
42 47
43static s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed); 48static s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed);
44static s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw, 49static s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
45 ixgbe_link_speed speed, 50 ixgbe_link_speed speed,
46 bool autoneg_wait_to_complete); 51 bool autoneg_wait_to_complete);
47static s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *, u32 mask); 52static s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);

cvs diff -r1.2.12.3 -r1.2.12.4 src/sys/dev/pci/ixgbe/ixgbe_x550.h (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe_x550.h 2019/07/22 17:53:35 1.2.12.3
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.h 2021/09/15 16:38:01 1.2.12.4
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
 1/* $NetBSD: ixgbe_x550.h,v 1.2.12.4 2021/09/15 16:38:01 martin Exp $ */
1/****************************************************************************** 2/******************************************************************************
2 3
3 Copyright (c) 2001-2017, Intel Corporation 4 Copyright (c) 2001-2017, Intel Corporation
4 All rights reserved. 5 All rights reserved.
5 6
6 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 8 modification, are permitted provided that the following conditions are met:
8 9
9 1. Redistributions of source code must retain the above copyright notice, 10 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
11 12
12 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the

cvs diff -r1.56.2.31 -r1.56.2.32 src/sys/dev/pci/ixgbe/ixv.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixv.c 2021/03/11 16:04:25 1.56.2.31
+++ src/sys/dev/pci/ixgbe/ixv.c 2021/09/15 16:38:01 1.56.2.32
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/*$NetBSD: ixv.c,v 1.56.2.31 2021/03/11 16:04:25 martin Exp $*/ 1/* $NetBSD: ixv.c,v 1.56.2.32 2021/09/15 16:38:01 martin Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 4
5 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
6 All rights reserved. 6 All rights reserved.
7 7
8 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
10 10
11 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
13 13
14 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -24,31 +24,33 @@ @@ -24,31 +24,33 @@
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE. 32 POSSIBILITY OF SUCH DAMAGE.
33 33
34******************************************************************************/ 34******************************************************************************/
35/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/ 35/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
36 36
 37#include <sys/cdefs.h>
 38__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.32 2021/09/15 16:38:01 martin Exp $");
 39
37#ifdef _KERNEL_OPT 40#ifdef _KERNEL_OPT
38#include "opt_inet.h" 41#include "opt_inet.h"
39#include "opt_inet6.h" 42#include "opt_inet6.h"
40#include "opt_net_mpsafe.h" 43#include "opt_net_mpsafe.h"
41#include "opt_ixgbe.h" 
42#endif 44#endif
43 45
44#include "ixgbe.h" 46#include "ixgbe.h"
45#include "vlan.h" 47#include "vlan.h"
46 48
47/************************************************************************ 49/************************************************************************
48 * Driver version 50 * Driver version
49 ************************************************************************/ 51 ************************************************************************/
50static const char ixv_driver_version[] = "2.0.1-k"; 52static const char ixv_driver_version[] = "2.0.1-k";
51/* XXX NetBSD: + 1.5.17 */ 53/* XXX NetBSD: + 1.5.17 */
52 54
53/************************************************************************ 55/************************************************************************
54 * PCI Device ID Table 56 * PCI Device ID Table
@@ -81,27 +83,27 @@ static const char *ixv_strings[] = { @@ -81,27 +83,27 @@ static const char *ixv_strings[] = {
81 * Function prototypes 83 * Function prototypes
82 *********************************************************************/ 84 *********************************************************************/
83static int ixv_probe(device_t, cfdata_t, void *); 85static int ixv_probe(device_t, cfdata_t, void *);
84static void ixv_attach(device_t, device_t, void *); 86static void ixv_attach(device_t, device_t, void *);
85static int ixv_detach(device_t, int); 87static int ixv_detach(device_t, int);
86#if 0 88#if 0
87static int ixv_shutdown(device_t); 89static int ixv_shutdown(device_t);
88#endif 90#endif
89static int ixv_ifflags_cb(struct ethercom *); 91static int ixv_ifflags_cb(struct ethercom *);
90static int ixv_ioctl(struct ifnet *, u_long, void *); 92static int ixv_ioctl(struct ifnet *, u_long, void *);
91static int ixv_init(struct ifnet *); 93static int ixv_init(struct ifnet *);
92static void ixv_init_locked(struct adapter *); 94static void ixv_init_locked(struct adapter *);
93static void ixv_ifstop(struct ifnet *, int); 95static void ixv_ifstop(struct ifnet *, int);
94static void ixv_stop(void *); 96static void ixv_stop_locked(void *);
95static void ixv_init_device_features(struct adapter *); 97static void ixv_init_device_features(struct adapter *);
96static void ixv_media_status(struct ifnet *, struct ifmediareq *); 98static void ixv_media_status(struct ifnet *, struct ifmediareq *);
97static int ixv_media_change(struct ifnet *); 99static int ixv_media_change(struct ifnet *);
98static int ixv_allocate_pci_resources(struct adapter *, 100static int ixv_allocate_pci_resources(struct adapter *,
99 const struct pci_attach_args *); 101 const struct pci_attach_args *);
100static int ixv_allocate_msix(struct adapter *, 102static int ixv_allocate_msix(struct adapter *,
101 const struct pci_attach_args *); 103 const struct pci_attach_args *);
102static int ixv_configure_interrupts(struct adapter *); 104static int ixv_configure_interrupts(struct adapter *);
103static void ixv_free_pci_resources(struct adapter *); 105static void ixv_free_pci_resources(struct adapter *);
104static void ixv_local_timer(void *); 106static void ixv_local_timer(void *);
105static void ixv_local_timer_locked(void *); 107static void ixv_local_timer_locked(void *);
106static int ixv_setup_interface(device_t, struct adapter *); 108static int ixv_setup_interface(device_t, struct adapter *);
107static int ixv_negotiate_api(struct adapter *); 109static int ixv_negotiate_api(struct adapter *);
@@ -129,30 +131,32 @@ static void ixv_unregister_vlan(void *,  @@ -129,30 +131,32 @@ static void ixv_unregister_vlan(void *,
129 131
130static void ixv_add_device_sysctls(struct adapter *); 132static void ixv_add_device_sysctls(struct adapter *);
131static void ixv_save_stats(struct adapter *); 133static void ixv_save_stats(struct adapter *);
132static void ixv_init_stats(struct adapter *); 134static void ixv_init_stats(struct adapter *);
133static void ixv_update_stats(struct adapter *); 135static void ixv_update_stats(struct adapter *);
134static void ixv_add_stats_sysctls(struct adapter *); 136static void ixv_add_stats_sysctls(struct adapter *);
135static void ixv_clear_evcnt(struct adapter *); 137static void ixv_clear_evcnt(struct adapter *);
136 138
137/* Sysctl handlers */ 139/* Sysctl handlers */
138static void ixv_set_sysctl_value(struct adapter *, const char *, 140static void ixv_set_sysctl_value(struct adapter *, const char *,
139 const char *, int *, int); 141 const char *, int *, int);
140static int ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO); 142static int ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
141static int ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO); 143static int ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
 144static int ixv_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
142static int ixv_sysctl_rdh_handler(SYSCTLFN_PROTO); 145static int ixv_sysctl_rdh_handler(SYSCTLFN_PROTO);
143static int ixv_sysctl_rdt_handler(SYSCTLFN_PROTO); 146static int ixv_sysctl_rdt_handler(SYSCTLFN_PROTO);
144static int ixv_sysctl_tdt_handler(SYSCTLFN_PROTO); 147static int ixv_sysctl_tdt_handler(SYSCTLFN_PROTO);
145static int ixv_sysctl_tdh_handler(SYSCTLFN_PROTO); 148static int ixv_sysctl_tdh_handler(SYSCTLFN_PROTO);
 149static int ixv_sysctl_rx_copy_len(SYSCTLFN_PROTO);
146 150
147/* The MSI-X Interrupt handlers */ 151/* The MSI-X Interrupt handlers */
148static int ixv_msix_que(void *); 152static int ixv_msix_que(void *);
149static int ixv_msix_mbx(void *); 153static int ixv_msix_mbx(void *);
150 154
151/* Deferred interrupt tasklets */ 155/* Deferred interrupt tasklets */
152static void ixv_handle_que(void *); 156static void ixv_handle_que(void *);
153static void ixv_handle_link(void *); 157static void ixv_handle_link(void *);
154 158
155/* Workqueue handler for deferred work */ 159/* Workqueue handler for deferred work */
156static void ixv_handle_que_work(struct work *, void *); 160static void ixv_handle_que_work(struct work *, void *);
157 161
158const struct sysctlnode *ixv_sysctl_instance(struct adapter *); 162const struct sysctlnode *ixv_sysctl_instance(struct adapter *);
@@ -322,27 +326,27 @@ ixv_attach(device_t parent, device_t dev @@ -322,27 +326,27 @@ ixv_attach(device_t parent, device_t dev
322 /* 326 /*
323 * Make sure BUSMASTER is set, on a VM under 327 * Make sure BUSMASTER is set, on a VM under
324 * KVM it may not be and will break things. 328 * KVM it may not be and will break things.
325 */ 329 */
326 ixgbe_pci_enable_busmaster(pa->pa_pc, pa->pa_tag); 330 ixgbe_pci_enable_busmaster(pa->pa_pc, pa->pa_tag);
327 331
328 /* Allocate, clear, and link in our adapter structure */ 332 /* Allocate, clear, and link in our adapter structure */
329 adapter = device_private(dev); 333 adapter = device_private(dev);
330 adapter->hw.back = adapter; 334 adapter->hw.back = adapter;
331 adapter->dev = dev; 335 adapter->dev = dev;
332 hw = &adapter->hw; 336 hw = &adapter->hw;
333 337
334 adapter->init_locked = ixv_init_locked; 338 adapter->init_locked = ixv_init_locked;
335 adapter->stop_locked = ixv_stop; 339 adapter->stop_locked = ixv_stop_locked;
336 340
337 adapter->osdep.pc = pa->pa_pc; 341 adapter->osdep.pc = pa->pa_pc;
338 adapter->osdep.tag = pa->pa_tag; 342 adapter->osdep.tag = pa->pa_tag;
339 if (pci_dma64_available(pa)) 343 if (pci_dma64_available(pa))
340 adapter->osdep.dmat = pa->pa_dmat64; 344 adapter->osdep.dmat = pa->pa_dmat64;
341 else 345 else
342 adapter->osdep.dmat = pa->pa_dmat; 346 adapter->osdep.dmat = pa->pa_dmat;
343 adapter->osdep.attached = false; 347 adapter->osdep.attached = false;
344 348
345 ent = ixv_lookup(pa); 349 ent = ixv_lookup(pa);
346 350
347 KASSERT(ent != NULL); 351 KASSERT(ent != NULL);
348 352
@@ -501,27 +505,28 @@ ixv_attach(device_t parent, device_t dev @@ -501,27 +505,28 @@ ixv_attach(device_t parent, device_t dev
501 ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) { 505 ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) {
502 aprint_error_dev(dev, "TXD config issue, using default!\n"); 506 aprint_error_dev(dev, "TXD config issue, using default!\n");
503 adapter->num_tx_desc = DEFAULT_TXD; 507 adapter->num_tx_desc = DEFAULT_TXD;
504 } else 508 } else
505 adapter->num_tx_desc = ixv_txd; 509 adapter->num_tx_desc = ixv_txd;
506 510
507 if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || 511 if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
508 ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) { 512 ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) {
509 aprint_error_dev(dev, "RXD config issue, using default!\n"); 513 aprint_error_dev(dev, "RXD config issue, using default!\n");
510 adapter->num_rx_desc = DEFAULT_RXD; 514 adapter->num_rx_desc = DEFAULT_RXD;
511 } else 515 } else
512 adapter->num_rx_desc = ixv_rxd; 516 adapter->num_rx_desc = ixv_rxd;
513 517
514 adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; 518 /* Set default high limit of copying mbuf in rxeof */
 519 adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX;
515 520
516 /* Setup MSI-X */ 521 /* Setup MSI-X */
517 error = ixv_configure_interrupts(adapter); 522 error = ixv_configure_interrupts(adapter);
518 if (error) 523 if (error)
519 goto err_out; 524 goto err_out;
520 525
521 /* Allocate our TX/RX Queues */ 526 /* Allocate our TX/RX Queues */
522 if (ixgbe_allocate_queues(adapter)) { 527 if (ixgbe_allocate_queues(adapter)) {
523 aprint_error_dev(dev, "ixgbe_allocate_queues() failed!\n"); 528 aprint_error_dev(dev, "ixgbe_allocate_queues() failed!\n");
524 error = ENOMEM; 529 error = ENOMEM;
525 goto err_out; 530 goto err_out;
526 } 531 }
527 532
@@ -661,27 +666,27 @@ ixv_detach(device_t dev, int flags) @@ -661,27 +666,27 @@ ixv_detach(device_t dev, int flags)
661 evcnt_detach(&adapter->queues[i].irqs); 666 evcnt_detach(&adapter->queues[i].irqs);
662 evcnt_detach(&adapter->queues[i].handleq); 667 evcnt_detach(&adapter->queues[i].handleq);
663 evcnt_detach(&adapter->queues[i].req); 668 evcnt_detach(&adapter->queues[i].req);
664 evcnt_detach(&txr->no_desc_avail); 669 evcnt_detach(&txr->no_desc_avail);
665 evcnt_detach(&txr->total_packets); 670 evcnt_detach(&txr->total_packets);
666 evcnt_detach(&txr->tso_tx); 671 evcnt_detach(&txr->tso_tx);
667#ifndef IXGBE_LEGACY_TX 672#ifndef IXGBE_LEGACY_TX
668 evcnt_detach(&txr->pcq_drops); 673 evcnt_detach(&txr->pcq_drops);
669#endif 674#endif
670 675
671 evcnt_detach(&rxr->rx_packets); 676 evcnt_detach(&rxr->rx_packets);
672 evcnt_detach(&rxr->rx_bytes); 677 evcnt_detach(&rxr->rx_bytes);
673 evcnt_detach(&rxr->rx_copies); 678 evcnt_detach(&rxr->rx_copies);
674 evcnt_detach(&rxr->no_jmbuf); 679 evcnt_detach(&rxr->no_mbuf);
675 evcnt_detach(&rxr->rx_discarded); 680 evcnt_detach(&rxr->rx_discarded);
676 } 681 }
677 evcnt_detach(&stats->ipcs); 682 evcnt_detach(&stats->ipcs);
678 evcnt_detach(&stats->l4cs); 683 evcnt_detach(&stats->l4cs);
679 evcnt_detach(&stats->ipcs_bad); 684 evcnt_detach(&stats->ipcs_bad);
680 evcnt_detach(&stats->l4cs_bad); 685 evcnt_detach(&stats->l4cs_bad);
681 686
682 /* Packet Reception Stats */ 687 /* Packet Reception Stats */
683 evcnt_detach(&stats->vfgorc); 688 evcnt_detach(&stats->vfgorc);
684 evcnt_detach(&stats->vfgprc); 689 evcnt_detach(&stats->vfgprc);
685 evcnt_detach(&stats->vfmprc); 690 evcnt_detach(&stats->vfmprc);
686 691
687 /* Packet Transmission Stats */ 692 /* Packet Transmission Stats */
@@ -735,56 +740,52 @@ ixv_init_locked(struct adapter *adapter) @@ -735,56 +740,52 @@ ixv_init_locked(struct adapter *adapter)
735 ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; 740 ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
736 741
737 /* reprogram the RAR[0] in case user changed it. */ 742 /* reprogram the RAR[0] in case user changed it. */
738 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); 743 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);
739 744
740 /* Get the latest mac address, User can use a LAA */ 745 /* Get the latest mac address, User can use a LAA */
741 memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl), 746 memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl),
742 IXGBE_ETH_LENGTH_OF_ADDRESS); 747 IXGBE_ETH_LENGTH_OF_ADDRESS);
743 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, 1); 748 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, 1);
744 749
745 /* Prepare transmit descriptors and buffers */ 750 /* Prepare transmit descriptors and buffers */
746 if (ixgbe_setup_transmit_structures(adapter)) { 751 if (ixgbe_setup_transmit_structures(adapter)) {
747 aprint_error_dev(dev, "Could not setup transmit structures\n"); 752 aprint_error_dev(dev, "Could not setup transmit structures\n");
748 ixv_stop(adapter); 753 ixv_stop_locked(adapter);
749 return; 754 return;
750 } 755 }
751 756
752 /* Reset VF and renegotiate mailbox API version */ 757 /* Reset VF and renegotiate mailbox API version */
753 hw->mac.ops.reset_hw(hw); 758 hw->mac.ops.reset_hw(hw);
754 hw->mac.ops.start_hw(hw); 759 hw->mac.ops.start_hw(hw);
755 error = ixv_negotiate_api(adapter); 760 error = ixv_negotiate_api(adapter);
756 if (error) 761 if (error)
757 device_printf(dev, 762 device_printf(dev,
758 "Mailbox API negotiation failed in init_locked!\n"); 763 "Mailbox API negotiation failed in init_locked!\n");
759 764
760 ixv_initialize_transmit_units(adapter); 765 ixv_initialize_transmit_units(adapter);
761 766
762 /* Setup Multicast table */ 767 /* Setup Multicast table */
763 ixv_set_rxfilter(adapter); 768 ixv_set_rxfilter(adapter);
764 769
765 /* 770 /* Use fixed buffer size, even for jumbo frames */
766 * Determine the correct mbuf pool 771 adapter->rx_mbuf_sz = MCLBYTES;
767 * for doing jumbo/headersplit 
768 */ 
769 if (adapter->max_frame_size <= MCLBYTES) 
770 adapter->rx_mbuf_sz = MCLBYTES; 
771 else 
772 adapter->rx_mbuf_sz = MJUMPAGESIZE; 
773 772
774 /* Prepare receive descriptors and buffers */ 773 /* Prepare receive descriptors and buffers */
775 if (ixgbe_setup_receive_structures(adapter)) { 774 error = ixgbe_setup_receive_structures(adapter);
776 device_printf(dev, "Could not setup receive structures\n"); 775 if (error) {
777 ixv_stop(adapter); 776 device_printf(dev,
 777 "Could not setup receive structures (err = %d)\n", error);
 778 ixv_stop_locked(adapter);
778 return; 779 return;
779 } 780 }
780 781
781 /* Configure RX settings */ 782 /* Configure RX settings */
782 ixv_initialize_receive_units(adapter); 783 ixv_initialize_receive_units(adapter);
783 784
784 /* Set up VLAN offload and filter */ 785 /* Set up VLAN offload and filter */
785 ixv_setup_vlan_support(adapter); 786 ixv_setup_vlan_support(adapter);
786 787
787 /* Set up MSI-X routing */ 788 /* Set up MSI-X routing */
788 ixv_configure_ivars(adapter); 789 ixv_configure_ivars(adapter);
789 790
790 /* Set up auto-mask */ 791 /* Set up auto-mask */
@@ -1423,57 +1424,57 @@ ixv_update_link_status(struct adapter *a @@ -1423,57 +1424,57 @@ ixv_update_link_status(struct adapter *a
1423 1424
1424/************************************************************************ 1425/************************************************************************
1425 * ixv_stop - Stop the hardware 1426 * ixv_stop - Stop the hardware
1426 * 1427 *
1427 * Disables all traffic on the adapter by issuing a 1428 * Disables all traffic on the adapter by issuing a
1428 * global reset on the MAC and deallocates TX/RX buffers. 1429 * global reset on the MAC and deallocates TX/RX buffers.
1429 ************************************************************************/ 1430 ************************************************************************/
1430static void 1431static void
1431ixv_ifstop(struct ifnet *ifp, int disable) 1432ixv_ifstop(struct ifnet *ifp, int disable)
1432{ 1433{
1433 struct adapter *adapter = ifp->if_softc; 1434 struct adapter *adapter = ifp->if_softc;
1434 1435
1435 IXGBE_CORE_LOCK(adapter); 1436 IXGBE_CORE_LOCK(adapter);
1436 ixv_stop(adapter); 1437 ixv_stop_locked(adapter);
1437 IXGBE_CORE_UNLOCK(adapter); 1438 IXGBE_CORE_UNLOCK(adapter);
1438} 1439}
1439 1440
1440static void 1441static void
1441ixv_stop(void *arg) 1442ixv_stop_locked(void *arg)
1442{ 1443{
1443 struct ifnet *ifp; 1444 struct ifnet *ifp;
1444 struct adapter *adapter = arg; 1445 struct adapter *adapter = arg;
1445 struct ixgbe_hw *hw = &adapter->hw; 1446 struct ixgbe_hw *hw = &adapter->hw;
1446 1447
1447 ifp = adapter->ifp; 1448 ifp = adapter->ifp;
1448 1449
1449 KASSERT(mutex_owned(&adapter->core_mtx)); 1450 KASSERT(mutex_owned(&adapter->core_mtx));
1450 1451
1451 INIT_DEBUGOUT("ixv_stop: begin\n"); 1452 INIT_DEBUGOUT("ixv_stop_locked: begin\n");
1452 ixv_disable_intr(adapter); 1453 ixv_disable_intr(adapter);
1453 1454
1454 /* Tell the stack that the interface is no longer active */ 1455 /* Tell the stack that the interface is no longer active */
1455 ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); 1456 ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
1456 1457
1457 hw->mac.ops.reset_hw(hw); 1458 hw->mac.ops.reset_hw(hw);
1458 adapter->hw.adapter_stopped = FALSE; 1459 adapter->hw.adapter_stopped = FALSE;
1459 hw->mac.ops.stop_adapter(hw); 1460 hw->mac.ops.stop_adapter(hw);
1460 callout_stop(&adapter->timer); 1461 callout_stop(&adapter->timer);
1461 1462
1462 /* reprogram the RAR[0] in case user changed it. */ 1463 /* reprogram the RAR[0] in case user changed it. */
1463 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); 1464 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);
1464 1465
1465 return; 1466 return;
1466} /* ixv_stop */ 1467} /* ixv_stop_locked */
1467 1468
1468 1469
1469/************************************************************************ 1470/************************************************************************
1470 * ixv_allocate_pci_resources 1471 * ixv_allocate_pci_resources
1471 ************************************************************************/ 1472 ************************************************************************/
1472static int 1473static int
1473ixv_allocate_pci_resources(struct adapter *adapter, 1474ixv_allocate_pci_resources(struct adapter *adapter,
1474 const struct pci_attach_args *pa) 1475 const struct pci_attach_args *pa)
1475{ 1476{
1476 pcireg_t memtype, csr; 1477 pcireg_t memtype, csr;
1477 device_t dev = adapter->dev; 1478 device_t dev = adapter->dev;
1478 bus_addr_t addr; 1479 bus_addr_t addr;
1479 int flags; 1480 int flags;
@@ -1971,26 +1972,52 @@ ixv_sysctl_next_to_check_handler(SYSCTLF @@ -1971,26 +1972,52 @@ ixv_sysctl_next_to_check_handler(SYSCTLF
1971 struct sysctlnode node = *rnode; 1972 struct sysctlnode node = *rnode;
1972 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data; 1973 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
1973 uint32_t val; 1974 uint32_t val;
1974 1975
1975 if (!rxr) 1976 if (!rxr)
1976 return (0); 1977 return (0);
1977 1978
1978 val = rxr->next_to_check; 1979 val = rxr->next_to_check;
1979 node.sysctl_data = &val; 1980 node.sysctl_data = &val;
1980 return sysctl_lookup(SYSCTLFN_CALL(&node)); 1981 return sysctl_lookup(SYSCTLFN_CALL(&node));
1981} /* ixv_sysctl_next_to_check_handler */ 1982} /* ixv_sysctl_next_to_check_handler */
1982 1983
1983/************************************************************************ 1984/************************************************************************
 1985 * ixv_sysctl_next_to_refresh_handler - Receive Descriptor next to refresh
 1986 * handler function
 1987 *
 1988 * Retrieves the next_to_refresh value
 1989 ************************************************************************/
 1990static int
 1991ixv_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
 1992{
 1993 struct sysctlnode node = *rnode;
 1994 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
 1995 struct adapter *adapter;
 1996 uint32_t val;
 1997
 1998 if (!rxr)
 1999 return (0);
 2000
 2001 adapter = rxr->adapter;
 2002 if (ixgbe_fw_recovery_mode_swflag(adapter))
 2003 return (EPERM);
 2004
 2005 val = rxr->next_to_refresh;
 2006 node.sysctl_data = &val;
 2007 return sysctl_lookup(SYSCTLFN_CALL(&node));
 2008} /* ixv_sysctl_next_to_refresh_handler */
 2009
 2010/************************************************************************
1984 * ixv_sysctl_rdh_handler - Receive Descriptor Head handler function 2011 * ixv_sysctl_rdh_handler - Receive Descriptor Head handler function
1985 * 2012 *
1986 * Retrieves the RDH value from the hardware 2013 * Retrieves the RDH value from the hardware
1987 ************************************************************************/ 2014 ************************************************************************/
1988static int 2015static int
1989ixv_sysctl_rdh_handler(SYSCTLFN_ARGS) 2016ixv_sysctl_rdh_handler(SYSCTLFN_ARGS)
1990{ 2017{
1991 struct sysctlnode node = *rnode; 2018 struct sysctlnode node = *rnode;
1992 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data; 2019 struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
1993 uint32_t val; 2020 uint32_t val;
1994 2021
1995 if (!rxr) 2022 if (!rxr)
1996 return (0); 2023 return (0);
@@ -2417,48 +2444,49 @@ ixv_add_device_sysctls(struct adapter *a @@ -2417,48 +2444,49 @@ ixv_add_device_sysctls(struct adapter *a
2417 struct sysctllog **log; 2444 struct sysctllog **log;
2418 const struct sysctlnode *rnode, *cnode; 2445 const struct sysctlnode *rnode, *cnode;
2419 device_t dev; 2446 device_t dev;
2420 2447
2421 dev = adapter->dev; 2448 dev = adapter->dev;
2422 log = &adapter->sysctllog; 2449 log = &adapter->sysctllog;
2423 2450
2424 if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { 2451 if ((rnode = ixv_sysctl_instance(adapter)) == NULL) {
2425 aprint_error_dev(dev, "could not create sysctl root\n"); 2452 aprint_error_dev(dev, "could not create sysctl root\n");
2426 return; 2453 return;
2427 } 2454 }
2428 2455
2429 if (sysctl_createv(log, 0, &rnode, &cnode, 2456 if (sysctl_createv(log, 0, &rnode, &cnode,
2430 CTLFLAG_READWRITE, CTLTYPE_INT, 2457 CTLFLAG_READWRITE, CTLTYPE_INT, "debug",
2431 "debug", SYSCTL_DESCR("Debug Info"), 2458 SYSCTL_DESCR("Debug Info"),
2432 ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) 2459 ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
2433 aprint_error_dev(dev, "could not create sysctl\n"); 2460 aprint_error_dev(dev, "could not create sysctl\n");
2434 2461
2435 if (sysctl_createv(log, 0, &rnode, &cnode, 2462 if (sysctl_createv(log, 0, &rnode, &cnode,
2436 CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", 2463 CTLFLAG_READWRITE, CTLTYPE_INT,
2437 SYSCTL_DESCR("Number of jumbo buffers per queue"), 2464 "rx_copy_len", SYSCTL_DESCR("RX Copy Length"),
2438 NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, 2465 ixv_sysctl_rx_copy_len, 0,
2439 CTL_EOL) != 0) 2466 (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
2440 aprint_error_dev(dev, "could not create sysctl\n"); 2467 aprint_error_dev(dev, "could not create sysctl\n");
2441 2468
2442 if (sysctl_createv(log, 0, &rnode, &cnode, 2469 if (sysctl_createv(log, 0, &rnode, &cnode,
2443 CTLFLAG_READWRITE, CTLTYPE_BOOL, 2470 CTLFLAG_READWRITE, CTLTYPE_BOOL, "enable_aim",
2444 "enable_aim", SYSCTL_DESCR("Interrupt Moderation"), 2471 SYSCTL_DESCR("Interrupt Moderation"),
2445 NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) 2472 NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
2446 aprint_error_dev(dev, "could not create sysctl\n"); 2473 aprint_error_dev(dev, "could not create sysctl\n");
2447 2474
2448 if (sysctl_createv(log, 0, &rnode, &cnode, 2475 if (sysctl_createv(log, 0, &rnode, &cnode,
2449 CTLFLAG_READWRITE, CTLTYPE_BOOL, 2476 CTLFLAG_READWRITE, CTLTYPE_BOOL, "txrx_workqueue",
2450 "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"), 2477 SYSCTL_DESCR("Use workqueue for packet processing"),
2451 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL) != 0) 2478 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL)
 2479 != 0)
2452 aprint_error_dev(dev, "could not create sysctl\n"); 2480 aprint_error_dev(dev, "could not create sysctl\n");
2453} 2481}
2454 2482
2455/************************************************************************ 2483/************************************************************************
2456 * ixv_add_stats_sysctls - Add statistic sysctls for the VF. 2484 * ixv_add_stats_sysctls - Add statistic sysctls for the VF.
2457 ************************************************************************/ 2485 ************************************************************************/
2458static void 2486static void
2459ixv_add_stats_sysctls(struct adapter *adapter) 2487ixv_add_stats_sysctls(struct adapter *adapter)
2460{ 2488{
2461 device_t dev = adapter->dev; 2489 device_t dev = adapter->dev;
2462 struct tx_ring *txr = adapter->tx_rings; 2490 struct tx_ring *txr = adapter->tx_rings;
2463 struct rx_ring *rxr = adapter->rx_rings; 2491 struct rx_ring *rxr = adapter->rx_rings;
2464 struct ixgbevf_hw_stats *stats = &adapter->stats.vf; 2492 struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
@@ -2544,57 +2572,63 @@ ixv_add_stats_sysctls(struct adapter *ad @@ -2544,57 +2572,63 @@ ixv_add_stats_sysctls(struct adapter *ad
2544 NULL, adapter->queues[i].evnamebuf, 2572 NULL, adapter->queues[i].evnamebuf,
2545 "Queue Packets Transmitted"); 2573 "Queue Packets Transmitted");
2546#ifndef IXGBE_LEGACY_TX 2574#ifndef IXGBE_LEGACY_TX
2547 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, 2575 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC,
2548 NULL, adapter->queues[i].evnamebuf, 2576 NULL, adapter->queues[i].evnamebuf,
2549 "Packets dropped in pcq"); 2577 "Packets dropped in pcq");
2550#endif 2578#endif
2551 2579
2552#ifdef LRO 2580#ifdef LRO
2553 struct lro_ctrl *lro = &rxr->lro; 2581 struct lro_ctrl *lro = &rxr->lro;
2554#endif /* LRO */ 2582#endif /* LRO */
2555 2583
2556 if (sysctl_createv(log, 0, &rnode, &cnode, 2584 if (sysctl_createv(log, 0, &rnode, &cnode,
2557 CTLFLAG_READONLY, 2585 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxck",
2558 CTLTYPE_INT, 2586 SYSCTL_DESCR("Receive Descriptor next to check"),
2559 "rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"), 2587 ixv_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
2560 ixv_sysctl_next_to_check_handler, 0, (void *)rxr, 0, 
2561 CTL_CREATE, CTL_EOL) != 0) 2588 CTL_CREATE, CTL_EOL) != 0)
2562 break; 2589 break;
2563 2590
2564 if (sysctl_createv(log, 0, &rnode, &cnode, 2591 if (sysctl_createv(log, 0, &rnode, &cnode,
2565 CTLFLAG_READONLY, 2592 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxrf",
2566 CTLTYPE_INT, 2593 SYSCTL_DESCR("Receive Descriptor next to refresh"),
2567 "rxd_head", SYSCTL_DESCR("Receive Descriptor Head"), 2594 ixv_sysctl_next_to_refresh_handler, 0, (void *)rxr, 0,
 2595 CTL_CREATE, CTL_EOL) != 0)
 2596 break;
 2597
 2598 if (sysctl_createv(log, 0, &rnode, &cnode,
 2599 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
 2600 SYSCTL_DESCR("Receive Descriptor Head"),
2568 ixv_sysctl_rdh_handler, 0, (void *)rxr, 0, 2601 ixv_sysctl_rdh_handler, 0, (void *)rxr, 0,
2569 CTL_CREATE, CTL_EOL) != 0) 2602 CTL_CREATE, CTL_EOL) != 0)
2570 break; 2603 break;
2571 2604
2572 if (sysctl_createv(log, 0, &rnode, &cnode, 2605 if (sysctl_createv(log, 0, &rnode, &cnode,
2573 CTLFLAG_READONLY, 2606 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_tail",
2574 CTLTYPE_INT, 2607 SYSCTL_DESCR("Receive Descriptor Tail"),
2575 "rxd_tail", SYSCTL_DESCR("Receive Descriptor Tail"), 
2576 ixv_sysctl_rdt_handler, 0, (void *)rxr, 0, 2608 ixv_sysctl_rdt_handler, 0, (void *)rxr, 0,
2577 CTL_CREATE, CTL_EOL) != 0) 2609 CTL_CREATE, CTL_EOL) != 0)
2578 break; 2610 break;
2579 2611
2580 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC, 2612 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC,
2581 NULL, adapter->queues[i].evnamebuf, "Queue Packets Received"); 2613 NULL, adapter->queues[i].evnamebuf,
 2614 "Queue Packets Received");
2582 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC, 2615 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC,
2583 NULL, adapter->queues[i].evnamebuf, "Queue Bytes Received"); 2616 NULL, adapter->queues[i].evnamebuf,
 2617 "Queue Bytes Received");
2584 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC, 2618 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC,
2585 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames"); 2619 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames");
2586 evcnt_attach_dynamic(&rxr->no_jmbuf, EVCNT_TYPE_MISC, 2620 evcnt_attach_dynamic(&rxr->no_mbuf, EVCNT_TYPE_MISC,
2587 NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf"); 2621 NULL, adapter->queues[i].evnamebuf, "Rx no mbuf");
2588 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC, 2622 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC,
2589 NULL, adapter->queues[i].evnamebuf, "Rx discarded"); 2623 NULL, adapter->queues[i].evnamebuf, "Rx discarded");
2590#ifdef LRO 2624#ifdef LRO
2591 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", 2625 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued",
2592 CTLFLAG_RD, &lro->lro_queued, 0, 2626 CTLFLAG_RD, &lro->lro_queued, 0,
2593 "LRO Queued"); 2627 "LRO Queued");
2594 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed", 2628 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed",
2595 CTLFLAG_RD, &lro->lro_flushed, 0, 2629 CTLFLAG_RD, &lro->lro_flushed, 0,
2596 "LRO Flushed"); 2630 "LRO Flushed");
2597#endif /* LRO */ 2631#endif /* LRO */
2598 } 2632 }
2599 2633
2600 /* MAC stats get their own sub node */ 2634 /* MAC stats get their own sub node */
@@ -2670,27 +2704,27 @@ ixv_clear_evcnt(struct adapter *adapter) @@ -2670,27 +2704,27 @@ ixv_clear_evcnt(struct adapter *adapter)
2670#endif 2704#endif
2671 txr->q_efbig_tx_dma_setup = 0; 2705 txr->q_efbig_tx_dma_setup = 0;
2672 txr->q_mbuf_defrag_failed = 0; 2706 txr->q_mbuf_defrag_failed = 0;
2673 txr->q_efbig2_tx_dma_setup = 0; 2707 txr->q_efbig2_tx_dma_setup = 0;
2674 txr->q_einval_tx_dma_setup = 0; 2708 txr->q_einval_tx_dma_setup = 0;
2675 txr->q_other_tx_dma_setup = 0; 2709 txr->q_other_tx_dma_setup = 0;
2676 txr->q_eagain_tx_dma_setup = 0; 2710 txr->q_eagain_tx_dma_setup = 0;
2677 txr->q_enomem_tx_dma_setup = 0; 2711 txr->q_enomem_tx_dma_setup = 0;
2678 txr->q_tso_err = 0; 2712 txr->q_tso_err = 0;
2679 2713
2680 rxr->rx_packets.ev_count = 0; 2714 rxr->rx_packets.ev_count = 0;
2681 rxr->rx_bytes.ev_count = 0; 2715 rxr->rx_bytes.ev_count = 0;
2682 rxr->rx_copies.ev_count = 0; 2716 rxr->rx_copies.ev_count = 0;
2683 rxr->no_jmbuf.ev_count = 0; 2717 rxr->no_mbuf.ev_count = 0;
2684 rxr->rx_discarded.ev_count = 0; 2718 rxr->rx_discarded.ev_count = 0;
2685 } 2719 }
2686 2720
2687 /* MAC stats get their own sub node */ 2721 /* MAC stats get their own sub node */
2688 2722
2689 stats->ipcs.ev_count = 0; 2723 stats->ipcs.ev_count = 0;
2690 stats->l4cs.ev_count = 0; 2724 stats->l4cs.ev_count = 0;
2691 stats->ipcs_bad.ev_count = 0; 2725 stats->ipcs_bad.ev_count = 0;
2692 stats->l4cs_bad.ev_count = 0; 2726 stats->l4cs_bad.ev_count = 0;
2693 2727
2694 /* Packet Reception Stats */ 2728 /* Packet Reception Stats */
2695 stats->vfgprc.ev_count = 0; 2729 stats->vfgprc.ev_count = 0;
2696 stats->vfgorc.ev_count = 0; 2730 stats->vfgorc.ev_count = 0;
@@ -2790,26 +2824,51 @@ ixv_sysctl_debug(SYSCTLFN_ARGS) @@ -2790,26 +2824,51 @@ ixv_sysctl_debug(SYSCTLFN_ARGS)
2790 node.sysctl_data = &result; 2824 node.sysctl_data = &result;
2791 error = sysctl_lookup(SYSCTLFN_CALL(&node)); 2825 error = sysctl_lookup(SYSCTLFN_CALL(&node));
2792 2826
2793 if (error || newp == NULL) 2827 if (error || newp == NULL)
2794 return error; 2828 return error;
2795 2829
2796 if (result == 1) 2830 if (result == 1)
2797 ixv_print_debug_info(adapter); 2831 ixv_print_debug_info(adapter);
2798 2832
2799 return 0; 2833 return 0;
2800} /* ixv_sysctl_debug */ 2834} /* ixv_sysctl_debug */
2801 2835
2802/************************************************************************ 2836/************************************************************************
 2837 * ixv_sysctl_rx_copy_len
 2838 ************************************************************************/
 2839static int
 2840ixv_sysctl_rx_copy_len(SYSCTLFN_ARGS)
 2841{
 2842 struct sysctlnode node = *rnode;
 2843 struct adapter *adapter = (struct adapter *)node.sysctl_data;
 2844 int error;
 2845 int result = adapter->rx_copy_len;
 2846
 2847 node.sysctl_data = &result;
 2848 error = sysctl_lookup(SYSCTLFN_CALL(&node));
 2849
 2850 if (error || newp == NULL)
 2851 return error;
 2852
 2853 if ((result < 0) || (result > IXGBE_RX_COPY_LEN_MAX))
 2854 return EINVAL;
 2855
 2856 adapter->rx_copy_len = result;
 2857
 2858 return 0;
 2859} /* ixgbe_sysctl_rx_copy_len */
 2860
 2861/************************************************************************
2803 * ixv_init_device_features 2862 * ixv_init_device_features
2804 ************************************************************************/ 2863 ************************************************************************/
2805static void 2864static void
2806ixv_init_device_features(struct adapter *adapter) 2865ixv_init_device_features(struct adapter *adapter)
2807{ 2866{
2808 adapter->feat_cap = IXGBE_FEATURE_NETMAP 2867 adapter->feat_cap = IXGBE_FEATURE_NETMAP
2809 | IXGBE_FEATURE_VF 2868 | IXGBE_FEATURE_VF
2810 | IXGBE_FEATURE_RSS 2869 | IXGBE_FEATURE_RSS
2811 | IXGBE_FEATURE_LEGACY_TX; 2870 | IXGBE_FEATURE_LEGACY_TX;
2812 2871
2813 /* A tad short on feature flags for VFs, atm. */ 2872 /* A tad short on feature flags for VFs, atm. */
2814 switch (adapter->hw.mac.type) { 2873 switch (adapter->hw.mac.type) {
2815 case ixgbe_mac_82599_vf: 2874 case ixgbe_mac_82599_vf:
@@ -2845,27 +2904,27 @@ ixv_init_device_features(struct adapter  @@ -2845,27 +2904,27 @@ ixv_init_device_features(struct adapter
2845 ixv_enable_legacy_tx) 2904 ixv_enable_legacy_tx)
2846 adapter->feat_en |= IXGBE_FEATURE_LEGACY_TX; 2905 adapter->feat_en |= IXGBE_FEATURE_LEGACY_TX;
2847} /* ixv_init_device_features */ 2906} /* ixv_init_device_features */
2848 2907
2849/************************************************************************ 2908/************************************************************************
2850 * ixv_shutdown - Shutdown entry point 2909 * ixv_shutdown - Shutdown entry point
2851 ************************************************************************/ 2910 ************************************************************************/
2852#if 0 /* XXX NetBSD ought to register something like this through pmf(9) */ 2911#if 0 /* XXX NetBSD ought to register something like this through pmf(9) */
2853static int 2912static int
2854ixv_shutdown(device_t dev) 2913ixv_shutdown(device_t dev)
2855{ 2914{
2856 struct adapter *adapter = device_private(dev); 2915 struct adapter *adapter = device_private(dev);
2857 IXGBE_CORE_LOCK(adapter); 2916 IXGBE_CORE_LOCK(adapter);
2858 ixv_stop(adapter); 2917 ixv_stop_locked(adapter);
2859 IXGBE_CORE_UNLOCK(adapter); 2918 IXGBE_CORE_UNLOCK(adapter);
2860 2919
2861 return (0); 2920 return (0);
2862} /* ixv_shutdown */ 2921} /* ixv_shutdown */
2863#endif 2922#endif
2864 2923
2865static int 2924static int
2866ixv_ifflags_cb(struct ethercom *ec) 2925ixv_ifflags_cb(struct ethercom *ec)
2867{ 2926{
2868 struct ifnet *ifp = &ec->ec_if; 2927 struct ifnet *ifp = &ec->ec_if;
2869 struct adapter *adapter = ifp->if_softc; 2928 struct adapter *adapter = ifp->if_softc;
2870 u_short saved_flags; 2929 u_short saved_flags;
2871 u_short change; 2930 u_short change;
@@ -3188,37 +3247,37 @@ ixv_allocate_msix(struct adapter *adapte @@ -3188,37 +3247,37 @@ ixv_allocate_msix(struct adapter *adapte
3188 que->que_si 3247 que->que_si
3189 = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS, 3248 = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
3190 ixv_handle_que, que); 3249 ixv_handle_que, que);
3191 if (que->que_si == NULL) { 3250 if (que->que_si == NULL) {
3192 aprint_error_dev(dev, 3251 aprint_error_dev(dev,
3193 "could not establish software interrupt\n"); 3252 "could not establish software interrupt\n");
3194 } 3253 }
3195 } 3254 }
3196 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev)); 3255 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
3197 error = workqueue_create(&adapter->txr_wq, wqname, 3256 error = workqueue_create(&adapter->txr_wq, wqname,
3198 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 3257 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
3199 IXGBE_WORKQUEUE_FLAGS); 3258 IXGBE_WORKQUEUE_FLAGS);
3200 if (error) { 3259 if (error) {
3201 aprint_error_dev(dev, "couldn't create workqueue for deferred Tx\n"); 3260 aprint_error_dev(dev,
 3261 "couldn't create workqueue for deferred Tx\n");
3202 } 3262 }
3203 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int)); 3263 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
3204 3264
3205 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev)); 3265 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
3206 error = workqueue_create(&adapter->que_wq, wqname, 3266 error = workqueue_create(&adapter->que_wq, wqname,
3207 ixv_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 3267 ixv_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
3208 IXGBE_WORKQUEUE_FLAGS); 3268 IXGBE_WORKQUEUE_FLAGS);
3209 if (error) { 3269 if (error) {
3210 aprint_error_dev(dev, 3270 aprint_error_dev(dev, "couldn't create workqueue for Tx/Rx\n");
3211 "couldn't create workqueue\n"); 
3212 } 3271 }
3213 3272
3214 /* and Mailbox */ 3273 /* and Mailbox */
3215 cpu_id++; 3274 cpu_id++;
3216 snprintf(intr_xname, sizeof(intr_xname), "%s link", device_xname(dev)); 3275 snprintf(intr_xname, sizeof(intr_xname), "%s link", device_xname(dev));
3217 adapter->vector = vector; 3276 adapter->vector = vector;
3218 intrstr = pci_intr_string(pc, adapter->osdep.intrs[vector], intrbuf, 3277 intrstr = pci_intr_string(pc, adapter->osdep.intrs[vector], intrbuf,
3219 sizeof(intrbuf)); 3278 sizeof(intrbuf));
3220#ifdef IXGBE_MPSAFE 3279#ifdef IXGBE_MPSAFE
3221 pci_intr_setattr(pc, &adapter->osdep.intrs[vector], PCI_INTR_MPSAFE, 3280 pci_intr_setattr(pc, &adapter->osdep.intrs[vector], PCI_INTR_MPSAFE,
3222 true); 3281 true);
3223#endif 3282#endif
3224 /* Set the mbx handler function */ 3283 /* Set the mbx handler function */