| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ix_txrx.c,v 1.100 2022/09/16 03:05:51 knakahara Exp $ */ | | 1 | /* $NetBSD: ix_txrx.c,v 1.101 2023/10/03 06:06:50 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.100 2022/09/16 03:05:51 knakahara Exp $"); | | 67 | __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.101 2023/10/03 06:06:50 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 |
| @@ -1324,31 +1324,26 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) | | | @@ -1324,31 +1324,26 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) |
1324 | (IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU))); | | 1324 | (IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU))); |
1325 | | | 1325 | |
1326 | rxr->hw_rsc = TRUE; | | 1326 | rxr->hw_rsc = TRUE; |
1327 | } /* ixgbe_setup_hw_rsc */ | | 1327 | } /* ixgbe_setup_hw_rsc */ |
1328 | | | 1328 | |
1329 | /************************************************************************ | | 1329 | /************************************************************************ |
1330 | * ixgbe_refresh_mbufs | | 1330 | * ixgbe_refresh_mbufs |
1331 | * | | 1331 | * |
1332 | * Refresh mbuf buffers for RX descriptor rings | | 1332 | * Refresh mbuf buffers for RX descriptor rings |
1333 | * - now keeps its own state so discards due to resource | | 1333 | * - now keeps its own state so discards due to resource |
1334 | * exhaustion are unnecessary, if an mbuf cannot be obtained | | 1334 | * exhaustion are unnecessary, if an mbuf cannot be obtained |
1335 | * it just returns, keeping its placeholder, thus it can simply | | 1335 | * it just returns, keeping its placeholder, thus it can simply |
1336 | * be recalled to try again. | | 1336 | * be recalled to try again. |
1337 | * | | | |
1338 | * XXX NetBSD TODO: | | | |
1339 | * - The ixgbe_rxeof() function always preallocates mbuf cluster, | | | |
1340 | * so the ixgbe_refresh_mbufs() function can be simplified. | | | |
1341 | * | | | |
1342 | ************************************************************************/ | | 1337 | ************************************************************************/ |
1343 | static void | | 1338 | static void |
1344 | ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) | | 1339 | ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) |
1345 | { | | 1340 | { |
1346 | struct adapter *adapter = rxr->adapter; | | 1341 | struct adapter *adapter = rxr->adapter; |
1347 | struct ixgbe_rx_buf *rxbuf; | | 1342 | struct ixgbe_rx_buf *rxbuf; |
1348 | struct mbuf *mp; | | 1343 | struct mbuf *mp; |
1349 | int i, error; | | 1344 | int i, error; |
1350 | bool refreshed = false; | | 1345 | bool refreshed = false; |
1351 | | | 1346 | |
1352 | i = rxr->next_to_refresh; | | 1347 | i = rxr->next_to_refresh; |
1353 | /* next_to_refresh points to the previous one */ | | 1348 | /* next_to_refresh points to the previous one */ |
1354 | if (++i == rxr->num_desc) | | 1349 | if (++i == rxr->num_desc) |