Add new sysctl "rx_copy_len". ixgbe_rxeof() has an optimization "RX_COPY" to reduce costs of bus_dmamap_load_mbuf() and bus_dmamap_unload() by copying a mbuf cluster's memory to a newly allocated mbuf's MH_databuf[] and recycle the original map. The optimization is used when a length of a packet is smaller than a specific value. The value is calculated based on MHLEN. The size of MHLEN is architecture specific. It's 256 or 512. Make the threshold controllable by adding a new sysctl.diff -r1.80 -r1.81 src/sys/dev/pci/ixgbe/ix_txrx.c
(msaitoh)
--- src/sys/dev/pci/ixgbe/ix_txrx.c 2021/07/07 08:32:51 1.80
+++ src/sys/dev/pci/ixgbe/ix_txrx.c 2021/07/07 08:58:19 1.81
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $ */ | 1 | /* $NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh 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 | |
@@ -54,27 +54,27 @@ | @@ -54,27 +54,27 @@ | |||
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> | 66 | #include <sys/cdefs.h> | |
67 | __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $"); | 67 | __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $"); | |
68 | 68 | |||
69 | #include "opt_inet.h" | 69 | #include "opt_inet.h" | |
70 | #include "opt_inet6.h" | 70 | #include "opt_inet6.h" | |
71 | 71 | |||
72 | #include "ixgbe.h" | 72 | #include "ixgbe.h" | |
73 | 73 | |||
74 | /* | 74 | /* | |
75 | * HW RSC control: | 75 | * HW RSC control: | |
76 | * this feature only works with | 76 | * this feature only works with | |
77 | * IPv4, and only on 82599 and later. | 77 | * IPv4, and only on 82599 and later. | |
78 | * Also this will cause IP forwarding to | 78 | * Also this will cause IP forwarding to | |
79 | * fail and that can't be controlled by | 79 | * fail and that can't be controlled by | |
80 | * the stack as LRO can. For all these | 80 | * the stack as LRO can. For all these | |
@@ -1966,27 +1966,27 @@ ixgbe_rxeof(struct ix_queue *que) | @@ -1966,27 +1966,27 @@ ixgbe_rxeof(struct ix_queue *que) | |||
1966 | if (sendmp != NULL) { /* secondary frag */ | 1966 | if (sendmp != NULL) { /* secondary frag */ | |
1967 | rbuf->buf = newmp; | 1967 | rbuf->buf = newmp; | |
1968 | rbuf->fmp = NULL; | 1968 | rbuf->fmp = NULL; | |
1969 | mp->m_len = len; | 1969 | mp->m_len = len; | |
1970 | mp->m_flags &= ~M_PKTHDR; | 1970 | mp->m_flags &= ~M_PKTHDR; | |
1971 | sendmp->m_pkthdr.len += mp->m_len; | 1971 | sendmp->m_pkthdr.len += mp->m_len; | |
1972 | } else { | 1972 | } else { | |
1973 | /* | 1973 | /* | |
1974 | * Optimize. This might be a small packet, | 1974 | * Optimize. This might be a small packet, | |
1975 | * maybe just a TCP ACK. Do a fast copy that | 1975 | * maybe just a TCP ACK. Do a fast copy that | |
1976 | * is cache aligned into a new mbuf, and | 1976 | * is cache aligned into a new mbuf, and | |
1977 | * leave the old mbuf+cluster for re-use. | 1977 | * leave the old mbuf+cluster for re-use. | |
1978 | */ | 1978 | */ | |
1979 | if (eop && len <= IXGBE_RX_COPY_LEN) { | 1979 | if (eop && len <= adapter->rx_copy_len) { | |
1980 | sendmp = m_gethdr(M_NOWAIT, MT_DATA); | 1980 | sendmp = m_gethdr(M_NOWAIT, MT_DATA); | |
1981 | if (sendmp != NULL) { | 1981 | if (sendmp != NULL) { | |
1982 | sendmp->m_data += IXGBE_RX_COPY_ALIGN; | 1982 | sendmp->m_data += IXGBE_RX_COPY_ALIGN; | |
1983 | ixgbe_bcopy(mp->m_data, sendmp->m_data, | 1983 | ixgbe_bcopy(mp->m_data, sendmp->m_data, | |
1984 | len); | 1984 | len); | |
1985 | sendmp->m_len = len; | 1985 | sendmp->m_len = len; | |
1986 | rxr->rx_copies.ev_count++; | 1986 | rxr->rx_copies.ev_count++; | |
1987 | rbuf->flags |= IXGBE_RX_COPY; | 1987 | rbuf->flags |= IXGBE_RX_COPY; | |
1988 | 1988 | |||
1989 | m_freem(newmp); | 1989 | m_freem(newmp); | |
1990 | } | 1990 | } | |
1991 | } | 1991 | } | |
1992 | if (sendmp == NULL) { | 1992 | if (sendmp == NULL) { |
--- src/sys/dev/pci/ixgbe/ixgbe.c 2021/06/29 21:03:36 1.285
+++ src/sys/dev/pci/ixgbe/ixgbe.c 2021/07/07 08:58:19 1.286
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ixgbe.c,v 1.285 2021/06/29 21:03:36 pgoyette Exp $ */ | 1 | /* $NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh 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 | |
@@ -54,27 +54,27 @@ | @@ -54,27 +54,27 @@ | |||
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> | 66 | #include <sys/cdefs.h> | |
67 | __KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.285 2021/06/29 21:03:36 pgoyette Exp $"); | 67 | __KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $"); | |
68 | 68 | |||
69 | #ifdef _KERNEL_OPT | 69 | #ifdef _KERNEL_OPT | |
70 | #include "opt_inet.h" | 70 | #include "opt_inet.h" | |
71 | #include "opt_inet6.h" | 71 | #include "opt_inet6.h" | |
72 | #include "opt_net_mpsafe.h" | 72 | #include "opt_net_mpsafe.h" | |
73 | #include "opt_ixgbe.h" | 73 | #include "opt_ixgbe.h" | |
74 | #endif | 74 | #endif | |
75 | 75 | |||
76 | #include "ixgbe.h" | 76 | #include "ixgbe.h" | |
77 | #include "ixgbe_phy.h" | 77 | #include "ixgbe_phy.h" | |
78 | #include "ixgbe_sriov.h" | 78 | #include "ixgbe_sriov.h" | |
79 | #include "vlan.h" | 79 | #include "vlan.h" | |
80 | 80 | |||
@@ -249,26 +249,27 @@ static int ixgbe_sysctl_dmac(SYSCTLFN_PR | @@ -249,26 +249,27 @@ static int ixgbe_sysctl_dmac(SYSCTLFN_PR | |||
249 | static int ixgbe_sysctl_phy_temp(SYSCTLFN_PROTO); | 249 | static int ixgbe_sysctl_phy_temp(SYSCTLFN_PROTO); | |
250 | static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTLFN_PROTO); | 250 | static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTLFN_PROTO); | |
251 | #ifdef IXGBE_DEBUG | 251 | #ifdef IXGBE_DEBUG | |
252 | static int ixgbe_sysctl_power_state(SYSCTLFN_PROTO); | 252 | static int ixgbe_sysctl_power_state(SYSCTLFN_PROTO); | |
253 | static int ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO); | 253 | static int ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO); | |
254 | #endif | 254 | #endif | |
255 | static int ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO); | 255 | static int ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO); | |
256 | static int ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO); | 256 | static int ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO); | |
257 | static int ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO); | 257 | static int ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO); | |
258 | static int ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO); | 258 | static int ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO); | |
259 | static int ixgbe_sysctl_tdh_handler(SYSCTLFN_PROTO); | 259 | static int ixgbe_sysctl_tdh_handler(SYSCTLFN_PROTO); | |
260 | static int ixgbe_sysctl_eee_state(SYSCTLFN_PROTO); | 260 | static int ixgbe_sysctl_eee_state(SYSCTLFN_PROTO); | |
261 | static int ixgbe_sysctl_debug(SYSCTLFN_PROTO); | 261 | static int ixgbe_sysctl_debug(SYSCTLFN_PROTO); | |
262 | static int ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO); | |||
262 | static int ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO); | 263 | static int ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO); | |
263 | static int ixgbe_sysctl_wufc(SYSCTLFN_PROTO); | 264 | static int ixgbe_sysctl_wufc(SYSCTLFN_PROTO); | |
264 | 265 | |||
265 | /* Interrupt functions */ | 266 | /* Interrupt functions */ | |
266 | static int ixgbe_msix_que(void *); | 267 | static int ixgbe_msix_que(void *); | |
267 | static int ixgbe_msix_admin(void *); | 268 | static int ixgbe_msix_admin(void *); | |
268 | static void ixgbe_intr_admin_common(struct adapter *, u32, u32 *); | 269 | static void ixgbe_intr_admin_common(struct adapter *, u32, u32 *); | |
269 | static int ixgbe_legacy_irq(void *); | 270 | static int ixgbe_legacy_irq(void *); | |
270 | 271 | |||
271 | /* Event handlers running on workqueue */ | 272 | /* Event handlers running on workqueue */ | |
272 | static void ixgbe_handle_que(void *); | 273 | static void ixgbe_handle_que(void *); | |
273 | static void ixgbe_handle_link(void *); | 274 | static void ixgbe_handle_link(void *); | |
274 | static void ixgbe_handle_msf(void *); | 275 | static void ixgbe_handle_msf(void *); | |
@@ -976,26 +977,29 @@ ixgbe_attach(device_t parent, device_t d | @@ -976,26 +977,29 @@ ixgbe_attach(device_t parent, device_t d | |||
976 | ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) { | 977 | ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) { | |
977 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | 978 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | |
978 | adapter->num_tx_desc = DEFAULT_TXD; | 979 | adapter->num_tx_desc = DEFAULT_TXD; | |
979 | } else | 980 | } else | |
980 | adapter->num_tx_desc = ixgbe_txd; | 981 | adapter->num_tx_desc = ixgbe_txd; | |
981 | 982 | |||
982 | if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | 983 | if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | |
983 | ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) { | 984 | ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) { | |
984 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | 985 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | |
985 | adapter->num_rx_desc = DEFAULT_RXD; | 986 | adapter->num_rx_desc = DEFAULT_RXD; | |
986 | } else | 987 | } else | |
987 | adapter->num_rx_desc = ixgbe_rxd; | 988 | adapter->num_rx_desc = ixgbe_rxd; | |
988 | 989 | |||
990 | /* Set default high limit of copying mbuf in rxeof */ | |||
991 | adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX; | |||
992 | ||||
989 | adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; | 993 | adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; | |
990 | 994 | |||
991 | /* Allocate our TX/RX Queues */ | 995 | /* Allocate our TX/RX Queues */ | |
992 | if (ixgbe_allocate_queues(adapter)) { | 996 | if (ixgbe_allocate_queues(adapter)) { | |
993 | error = ENOMEM; | 997 | error = ENOMEM; | |
994 | goto err_out; | 998 | goto err_out; | |
995 | } | 999 | } | |
996 | 1000 | |||
997 | hw->phy.reset_if_overtemp = TRUE; | 1001 | hw->phy.reset_if_overtemp = TRUE; | |
998 | error = ixgbe_reset_hw(hw); | 1002 | error = ixgbe_reset_hw(hw); | |
999 | hw->phy.reset_if_overtemp = FALSE; | 1003 | hw->phy.reset_if_overtemp = FALSE; | |
1000 | if (error == IXGBE_ERR_SFP_NOT_PRESENT) | 1004 | if (error == IXGBE_ERR_SFP_NOT_PRESENT) | |
1001 | error = IXGBE_SUCCESS; | 1005 | error = IXGBE_SUCCESS; | |
@@ -3358,26 +3362,33 @@ ixgbe_add_device_sysctls(struct adapter | @@ -3358,26 +3362,33 @@ ixgbe_add_device_sysctls(struct adapter | |||
3358 | if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) { | 3362 | if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) { | |
3359 | aprint_error_dev(dev, "could not create sysctl root\n"); | 3363 | aprint_error_dev(dev, "could not create sysctl root\n"); | |
3360 | return; | 3364 | return; | |
3361 | } | 3365 | } | |
3362 | 3366 | |||
3363 | if (sysctl_createv(log, 0, &rnode, &cnode, | 3367 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
3364 | CTLFLAG_READWRITE, CTLTYPE_INT, | 3368 | CTLFLAG_READWRITE, CTLTYPE_INT, | |
3365 | "debug", SYSCTL_DESCR("Debug Info"), | 3369 | "debug", SYSCTL_DESCR("Debug Info"), | |
3366 | ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) | 3370 | ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) | |
3367 | != 0) | 3371 | != 0) | |
3368 | aprint_error_dev(dev, "could not create sysctl\n"); | 3372 | aprint_error_dev(dev, "could not create sysctl\n"); | |
3369 | 3373 | |||
3370 | if (sysctl_createv(log, 0, &rnode, &cnode, | 3374 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
3375 | CTLFLAG_READWRITE, CTLTYPE_INT, | |||
3376 | "rx_copy_len", SYSCTL_DESCR("RX Copy Length"), | |||
3377 | ixgbe_sysctl_rx_copy_len, 0, | |||
3378 | (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | |||
3379 | aprint_error_dev(dev, "could not create sysctl\n"); | |||
3380 | ||||
3381 | if (sysctl_createv(log, 0, &rnode, &cnode, | |||
3371 | CTLFLAG_READONLY, CTLTYPE_INT, | 3382 | CTLFLAG_READONLY, CTLTYPE_INT, | |
3372 | "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"), | 3383 | "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"), | |
3373 | NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0) | 3384 | NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0) | |
3374 | aprint_error_dev(dev, "could not create sysctl\n"); | 3385 | aprint_error_dev(dev, "could not create sysctl\n"); | |
3375 | 3386 | |||
3376 | if (sysctl_createv(log, 0, &rnode, &cnode, | 3387 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
3377 | CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", | 3388 | CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", | |
3378 | SYSCTL_DESCR("Number of jumbo buffers per queue"), | 3389 | SYSCTL_DESCR("Number of jumbo buffers per queue"), | |
3379 | NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, | 3390 | NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, | |
3380 | CTL_EOL) != 0) | 3391 | CTL_EOL) != 0) | |
3381 | aprint_error_dev(dev, "could not create sysctl\n"); | 3392 | aprint_error_dev(dev, "could not create sysctl\n"); | |
3382 | 3393 | |||
3383 | if (sysctl_createv(log, 0, &rnode, &cnode, | 3394 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
@@ -6164,26 +6175,51 @@ ixgbe_sysctl_debug(SYSCTLFN_ARGS) | @@ -6164,26 +6175,51 @@ ixgbe_sysctl_debug(SYSCTLFN_ARGS) | |||
6164 | node.sysctl_data = &result; | 6175 | node.sysctl_data = &result; | |
6165 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | 6176 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | |
6166 | 6177 | |||
6167 | if (error || newp == NULL) | 6178 | if (error || newp == NULL) | |
6168 | return error; | 6179 | return error; | |
6169 | 6180 | |||
6170 | if (result == 1) | 6181 | if (result == 1) | |
6171 | ixgbe_print_debug_info(adapter); | 6182 | ixgbe_print_debug_info(adapter); | |
6172 | 6183 | |||
6173 | return 0; | 6184 | return 0; | |
6174 | } /* ixgbe_sysctl_debug */ | 6185 | } /* ixgbe_sysctl_debug */ | |
6175 | 6186 | |||
6176 | /************************************************************************ | 6187 | /************************************************************************ | |
6188 | * ixgbe_sysctl_rx_copy_len | |||
6189 | ************************************************************************/ | |||
6190 | static int | |||
6191 | ixgbe_sysctl_rx_copy_len(SYSCTLFN_ARGS) | |||
6192 | { | |||
6193 | struct sysctlnode node = *rnode; | |||
6194 | struct adapter *adapter = (struct adapter *)node.sysctl_data; | |||
6195 | int error; | |||
6196 | int result = adapter->rx_copy_len; | |||
6197 | ||||
6198 | node.sysctl_data = &result; | |||
6199 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | |||
6200 | ||||
6201 | if (error || newp == NULL) | |||
6202 | return error; | |||
6203 | ||||
6204 | if ((result < 0) || (result > IXGBE_RX_COPY_LEN_MAX)) | |||
6205 | return EINVAL; | |||
6206 | ||||
6207 | adapter->rx_copy_len = result; | |||
6208 | ||||
6209 | return 0; | |||
6210 | } /* ixgbe_sysctl_rx_copy_len */ | |||
6211 | ||||
6212 | /************************************************************************ | |||
6177 | * ixgbe_init_device_features | 6213 | * ixgbe_init_device_features | |
6178 | ************************************************************************/ | 6214 | ************************************************************************/ | |
6179 | static void | 6215 | static void | |
6180 | ixgbe_init_device_features(struct adapter *adapter) | 6216 | ixgbe_init_device_features(struct adapter *adapter) | |
6181 | { | 6217 | { | |
6182 | adapter->feat_cap = IXGBE_FEATURE_NETMAP | 6218 | adapter->feat_cap = IXGBE_FEATURE_NETMAP | |
6183 | | IXGBE_FEATURE_RSS | 6219 | | IXGBE_FEATURE_RSS | |
6184 | | IXGBE_FEATURE_MSI | 6220 | | IXGBE_FEATURE_MSI | |
6185 | | IXGBE_FEATURE_MSIX | 6221 | | IXGBE_FEATURE_MSIX | |
6186 | | IXGBE_FEATURE_LEGACY_IRQ | 6222 | | IXGBE_FEATURE_LEGACY_IRQ | |
6187 | | IXGBE_FEATURE_LEGACY_TX; | 6223 | | IXGBE_FEATURE_LEGACY_TX; | |
6188 | 6224 | |||
6189 | /* Set capabilities first... */ | 6225 | /* Set capabilities first... */ |
--- src/sys/dev/pci/ixgbe/ixgbe.h 2021/03/09 10:03:18 1.75
+++ src/sys/dev/pci/ixgbe/ixgbe.h 2021/07/07 08:58:19 1.76
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ixgbe.h,v 1.75 2021/03/09 10:03:18 msaitoh Exp $ */ | 1 | /* $NetBSD: ixgbe.h,v 1.76 2021/07/07 08:58:19 msaitoh 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 | |||
@@ -175,27 +175,27 @@ | @@ -175,27 +175,27 @@ | |||
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 MPKTHSIZE (offsetof(struct _mbuf_dummy, m_pktdat)) | |
187 | #define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32) | 187 | #define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32) | |
188 | #define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) | 188 | #define IXGBE_RX_COPY_LEN_MAX (MSIZE - IXGBE_RX_COPY_HDR_PADDED) | |
189 | #define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE) | 189 | #define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE) | |
190 | 190 | |||
191 | /* Keep older OS drivers building... */ | 191 | /* Keep older OS drivers building... */ | |
192 | #if !defined(SYSCTL_ADD_UQUAD) | 192 | #if !defined(SYSCTL_ADD_UQUAD) | |
193 | #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD | 193 | #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD | |
194 | #endif | 194 | #endif | |
195 | 195 | |||
196 | /* Defines for printing debug information */ | 196 | /* Defines for printing debug information */ | |
197 | #define DEBUG_INIT 0 | 197 | #define DEBUG_INIT 0 | |
198 | #define DEBUG_IOCTL 0 | 198 | #define DEBUG_IOCTL 0 | |
199 | #define DEBUG_HW 0 | 199 | #define DEBUG_HW 0 | |
200 | 200 | |||
201 | #define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") | 201 | #define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") | |
@@ -558,26 +558,27 @@ struct adapter { | @@ -558,26 +558,27 @@ struct adapter { | |||
558 | */ | 558 | */ | |
559 | struct tx_ring *tx_rings; | 559 | struct tx_ring *tx_rings; | |
560 | u32 num_tx_desc; | 560 | u32 num_tx_desc; | |
561 | u32 tx_process_limit; | 561 | u32 tx_process_limit; | |
562 | 562 | |||
563 | /* | 563 | /* | |
564 | * Receive rings | 564 | * Receive rings | |
565 | * Allocated at run time, an array of rings | 565 | * Allocated at run time, an array of rings | |
566 | */ | 566 | */ | |
567 | struct rx_ring *rx_rings; | 567 | struct rx_ring *rx_rings; | |
568 | u64 active_queues; | 568 | u64 active_queues; | |
569 | u32 num_rx_desc; | 569 | u32 num_rx_desc; | |
570 | u32 rx_process_limit; | 570 | u32 rx_process_limit; | |
571 | u32 rx_copy_len; | |||
571 | int num_jcl; | 572 | int num_jcl; | |
572 | 573 | |||
573 | /* Multicast array memory */ | 574 | /* Multicast array memory */ | |
574 | struct ixgbe_mc_addr *mta; | 575 | struct ixgbe_mc_addr *mta; | |
575 | 576 | |||
576 | /* SR-IOV */ | 577 | /* SR-IOV */ | |
577 | int iov_mode; | 578 | int iov_mode; | |
578 | int num_vfs; | 579 | int num_vfs; | |
579 | int pool; | 580 | int pool; | |
580 | struct ixgbe_vf *vfs; | 581 | struct ixgbe_vf *vfs; | |
581 | 582 | |||
582 | /* Bypass */ | 583 | /* Bypass */ | |
583 | struct ixgbe_bp_data bypass; | 584 | struct ixgbe_bp_data bypass; |
--- src/sys/dev/pci/ixgbe/ixv.c 2021/06/16 00:21:18 1.162
+++ src/sys/dev/pci/ixgbe/ixv.c 2021/07/07 08:58:19 1.163
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ixv.c,v 1.162 2021/06/16 00:21:18 riastradh Exp $ */ | 1 | /* $NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh 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 | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
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> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.162 2021/06/16 00:21:18 riastradh Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $"); | |
39 | 39 | |||
40 | #ifdef _KERNEL_OPT | 40 | #ifdef _KERNEL_OPT | |
41 | #include "opt_inet.h" | 41 | #include "opt_inet.h" | |
42 | #include "opt_inet6.h" | 42 | #include "opt_inet6.h" | |
43 | #include "opt_net_mpsafe.h" | 43 | #include "opt_net_mpsafe.h" | |
44 | #include "opt_ixgbe.h" | 44 | #include "opt_ixgbe.h" | |
45 | #endif | 45 | #endif | |
46 | 46 | |||
47 | #include "ixgbe.h" | 47 | #include "ixgbe.h" | |
48 | #include "vlan.h" | 48 | #include "vlan.h" | |
49 | 49 | |||
50 | /************************************************************************ | 50 | /************************************************************************ | |
51 | * Driver version | 51 | * Driver version | |
@@ -138,26 +138,27 @@ static void ixv_init_stats(struct adapte | @@ -138,26 +138,27 @@ static void ixv_init_stats(struct adapte | |||
138 | static void ixv_update_stats(struct adapter *); | 138 | static void ixv_update_stats(struct adapter *); | |
139 | static void ixv_add_stats_sysctls(struct adapter *); | 139 | static void ixv_add_stats_sysctls(struct adapter *); | |
140 | static void ixv_clear_evcnt(struct adapter *); | 140 | static void ixv_clear_evcnt(struct adapter *); | |
141 | 141 | |||
142 | /* Sysctl handlers */ | 142 | /* Sysctl handlers */ | |
143 | static void ixv_set_sysctl_value(struct adapter *, const char *, | 143 | static void ixv_set_sysctl_value(struct adapter *, const char *, | |
144 | const char *, int *, int); | 144 | const char *, int *, int); | |
145 | static int ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO); | 145 | static int ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO); | |
146 | static int ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO); | 146 | static int ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO); | |
147 | static int ixv_sysctl_rdh_handler(SYSCTLFN_PROTO); | 147 | static int ixv_sysctl_rdh_handler(SYSCTLFN_PROTO); | |
148 | static int ixv_sysctl_rdt_handler(SYSCTLFN_PROTO); | 148 | static int ixv_sysctl_rdt_handler(SYSCTLFN_PROTO); | |
149 | static int ixv_sysctl_tdt_handler(SYSCTLFN_PROTO); | 149 | static int ixv_sysctl_tdt_handler(SYSCTLFN_PROTO); | |
150 | static int ixv_sysctl_tdh_handler(SYSCTLFN_PROTO); | 150 | static int ixv_sysctl_tdh_handler(SYSCTLFN_PROTO); | |
151 | static int ixv_sysctl_rx_copy_len(SYSCTLFN_PROTO); | |||
151 | 152 | |||
152 | /* The MSI-X Interrupt handlers */ | 153 | /* The MSI-X Interrupt handlers */ | |
153 | static int ixv_msix_que(void *); | 154 | static int ixv_msix_que(void *); | |
154 | static int ixv_msix_mbx(void *); | 155 | static int ixv_msix_mbx(void *); | |
155 | 156 | |||
156 | /* Event handlers running on workqueue */ | 157 | /* Event handlers running on workqueue */ | |
157 | static void ixv_handle_que(void *); | 158 | static void ixv_handle_que(void *); | |
158 | 159 | |||
159 | /* Deferred workqueue handlers */ | 160 | /* Deferred workqueue handlers */ | |
160 | static void ixv_handle_admin(struct work *, void *); | 161 | static void ixv_handle_admin(struct work *, void *); | |
161 | static void ixv_handle_que_work(struct work *, void *); | 162 | static void ixv_handle_que_work(struct work *, void *); | |
162 | 163 | |||
163 | const struct sysctlnode *ixv_sysctl_instance(struct adapter *); | 164 | const struct sysctlnode *ixv_sysctl_instance(struct adapter *); | |
@@ -506,26 +507,29 @@ ixv_attach(device_t parent, device_t dev | @@ -506,26 +507,29 @@ ixv_attach(device_t parent, device_t dev | |||
506 | ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) { | 507 | ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) { | |
507 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | 508 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | |
508 | adapter->num_tx_desc = DEFAULT_TXD; | 509 | adapter->num_tx_desc = DEFAULT_TXD; | |
509 | } else | 510 | } else | |
510 | adapter->num_tx_desc = ixv_txd; | 511 | adapter->num_tx_desc = ixv_txd; | |
511 | 512 | |||
512 | if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | 513 | if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | |
513 | ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) { | 514 | ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) { | |
514 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | 515 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | |
515 | adapter->num_rx_desc = DEFAULT_RXD; | 516 | adapter->num_rx_desc = DEFAULT_RXD; | |
516 | } else | 517 | } else | |
517 | adapter->num_rx_desc = ixv_rxd; | 518 | adapter->num_rx_desc = ixv_rxd; | |
518 | 519 | |||
520 | /* Set default high limit of copying mbuf in rxeof */ | |||
521 | adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX; | |||
522 | ||||
519 | adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; | 523 | adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; | |
520 | 524 | |||
521 | /* Setup MSI-X */ | 525 | /* Setup MSI-X */ | |
522 | error = ixv_configure_interrupts(adapter); | 526 | error = ixv_configure_interrupts(adapter); | |
523 | if (error) | 527 | if (error) | |
524 | goto err_out; | 528 | goto err_out; | |
525 | 529 | |||
526 | /* Allocate our TX/RX Queues */ | 530 | /* Allocate our TX/RX Queues */ | |
527 | if (ixgbe_allocate_queues(adapter)) { | 531 | if (ixgbe_allocate_queues(adapter)) { | |
528 | aprint_error_dev(dev, "ixgbe_allocate_queues() failed!\n"); | 532 | aprint_error_dev(dev, "ixgbe_allocate_queues() failed!\n"); | |
529 | error = ENOMEM; | 533 | error = ENOMEM; | |
530 | goto err_out; | 534 | goto err_out; | |
531 | } | 535 | } | |
@@ -2551,26 +2555,33 @@ ixv_add_device_sysctls(struct adapter *a | @@ -2551,26 +2555,33 @@ ixv_add_device_sysctls(struct adapter *a | |||
2551 | 2555 | |||
2552 | if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { | 2556 | if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { | |
2553 | aprint_error_dev(dev, "could not create sysctl root\n"); | 2557 | aprint_error_dev(dev, "could not create sysctl root\n"); | |
2554 | return; | 2558 | return; | |
2555 | } | 2559 | } | |
2556 | 2560 | |||
2557 | if (sysctl_createv(log, 0, &rnode, &cnode, | 2561 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
2558 | CTLFLAG_READWRITE, CTLTYPE_INT, "debug", | 2562 | CTLFLAG_READWRITE, CTLTYPE_INT, "debug", | |
2559 | SYSCTL_DESCR("Debug Info"), | 2563 | SYSCTL_DESCR("Debug Info"), | |
2560 | ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | 2564 | ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | |
2561 | aprint_error_dev(dev, "could not create sysctl\n"); | 2565 | aprint_error_dev(dev, "could not create sysctl\n"); | |
2562 | 2566 | |||
2563 | if (sysctl_createv(log, 0, &rnode, &cnode, | 2567 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
2568 | CTLFLAG_READWRITE, CTLTYPE_INT, | |||
2569 | "rx_copy_len", SYSCTL_DESCR("RX Copy Length"), | |||
2570 | ixv_sysctl_rx_copy_len, 0, | |||
2571 | (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | |||
2572 | aprint_error_dev(dev, "could not create sysctl\n"); | |||
2573 | ||||
2574 | if (sysctl_createv(log, 0, &rnode, &cnode, | |||
2564 | CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", | 2575 | CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", | |
2565 | SYSCTL_DESCR("Number of jumbo buffers per queue"), | 2576 | SYSCTL_DESCR("Number of jumbo buffers per queue"), | |
2566 | NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, | 2577 | NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, | |
2567 | CTL_EOL) != 0) | 2578 | CTL_EOL) != 0) | |
2568 | aprint_error_dev(dev, "could not create sysctl\n"); | 2579 | aprint_error_dev(dev, "could not create sysctl\n"); | |
2569 | 2580 | |||
2570 | if (sysctl_createv(log, 0, &rnode, &cnode, | 2581 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
2571 | CTLFLAG_READWRITE, CTLTYPE_BOOL, "enable_aim", | 2582 | CTLFLAG_READWRITE, CTLTYPE_BOOL, "enable_aim", | |
2572 | SYSCTL_DESCR("Interrupt Moderation"), | 2583 | SYSCTL_DESCR("Interrupt Moderation"), | |
2573 | NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) | 2584 | NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) | |
2574 | aprint_error_dev(dev, "could not create sysctl\n"); | 2585 | aprint_error_dev(dev, "could not create sysctl\n"); | |
2575 | 2586 | |||
2576 | if (sysctl_createv(log, 0, &rnode, &cnode, | 2587 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
@@ -2923,26 +2934,51 @@ ixv_sysctl_debug(SYSCTLFN_ARGS) | @@ -2923,26 +2934,51 @@ ixv_sysctl_debug(SYSCTLFN_ARGS) | |||
2923 | node.sysctl_data = &result; | 2934 | node.sysctl_data = &result; | |
2924 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | 2935 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | |
2925 | 2936 | |||
2926 | if (error || newp == NULL) | 2937 | if (error || newp == NULL) | |
2927 | return error; | 2938 | return error; | |
2928 | 2939 | |||
2929 | if (result == 1) | 2940 | if (result == 1) | |
2930 | ixv_print_debug_info(adapter); | 2941 | ixv_print_debug_info(adapter); | |
2931 | 2942 | |||
2932 | return 0; | 2943 | return 0; | |
2933 | } /* ixv_sysctl_debug */ | 2944 | } /* ixv_sysctl_debug */ | |
2934 | 2945 | |||
2935 | /************************************************************************ | 2946 | /************************************************************************ | |
2947 | * ixv_sysctl_rx_copy_len | |||
2948 | ************************************************************************/ | |||
2949 | static int | |||
2950 | ixv_sysctl_rx_copy_len(SYSCTLFN_ARGS) | |||
2951 | { | |||
2952 | struct sysctlnode node = *rnode; | |||
2953 | struct adapter *adapter = (struct adapter *)node.sysctl_data; | |||
2954 | int error; | |||
2955 | int result = adapter->rx_copy_len; | |||
2956 | ||||
2957 | node.sysctl_data = &result; | |||
2958 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | |||
2959 | ||||
2960 | if (error || newp == NULL) | |||
2961 | return error; | |||
2962 | ||||
2963 | if ((result < 0) || (result > IXGBE_RX_COPY_LEN_MAX)) | |||
2964 | return EINVAL; | |||
2965 | ||||
2966 | adapter->rx_copy_len = result; | |||
2967 | ||||
2968 | return 0; | |||
2969 | } /* ixgbe_sysctl_rx_copy_len */ | |||
2970 | ||||
2971 | /************************************************************************ | |||
2936 | * ixv_init_device_features | 2972 | * ixv_init_device_features | |
2937 | ************************************************************************/ | 2973 | ************************************************************************/ | |
2938 | static void | 2974 | static void | |
2939 | ixv_init_device_features(struct adapter *adapter) | 2975 | ixv_init_device_features(struct adapter *adapter) | |
2940 | { | 2976 | { | |
2941 | adapter->feat_cap = IXGBE_FEATURE_NETMAP | 2977 | adapter->feat_cap = IXGBE_FEATURE_NETMAP | |
2942 | | IXGBE_FEATURE_VF | 2978 | | IXGBE_FEATURE_VF | |
2943 | | IXGBE_FEATURE_RSS | 2979 | | IXGBE_FEATURE_RSS | |
2944 | | IXGBE_FEATURE_LEGACY_TX; | 2980 | | IXGBE_FEATURE_LEGACY_TX; | |
2945 | 2981 | |||
2946 | /* A tad short on feature flags for VFs, atm. */ | 2982 | /* A tad short on feature flags for VFs, atm. */ | |
2947 | switch (adapter->hw.mac.type) { | 2983 | switch (adapter->hw.mac.type) { | |
2948 | case ixgbe_mac_82599_vf: | 2984 | case ixgbe_mac_82599_vf: |