Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Sep 2021 07:36:19 GMT
From:      Wojciech Macek <wma@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: dcd0d08b692f - stable/13 - mvneta: Fix MTU update sequence
Message-ID:  <202109280736.18S7aJcG089681@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by wma:

URL: https://cgit.FreeBSD.org/src/commit/?id=dcd0d08b692fc1377ab07c3d9260ad1c93944c5c

commit dcd0d08b692fc1377ab07c3d9260ad1c93944c5c
Author:     Kornel Duleba <mindal@semihalf.com>
AuthorDate: 2021-08-31 06:22:29 +0000
Commit:     Wojciech Macek <wma@FreeBSD.org>
CommitDate: 2021-09-28 07:35:41 +0000

    mvneta: Fix MTU update sequence
    
    After MTU is updated we might start using allocating RX buffers from different pool. (MJUM9BYTES vs MCLBYTES)
    Because of that we need to update the RX buffer size in hardware.
    Previously it was done only when the interface was up, which is incorrect since MTU can be changed at any time.
    
    Differential revision:  https://reviews.freebsd.org/D31724
    Sponsored by:           Stormshield
    Obtained from:          Semihalf
    MFC after:              2 weeks
    Reviewed by:            wma
    
    (cherry picked from commit 5438ef47e377d659acf7f97a66fe418223f2c847)
---
 sys/dev/neta/if_mvneta.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c
index 4ff830731e94..debb4a922cbc 100644
--- a/sys/dev/neta/if_mvneta.c
+++ b/sys/dev/neta/if_mvneta.c
@@ -2168,29 +2168,28 @@ mvneta_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 				ifp->if_hwassist = CSUM_IP | CSUM_TCP |
 					CSUM_UDP;
 			}
-
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-				/* Stop hardware */
+			/*
+			 * Reinitialize RX queues.
+			 * We need to update RX descriptor size.
+			 */
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				mvneta_stop_locked(sc);
-				/*
-				 * Reinitialize RX queues.
-				 * We need to update RX descriptor size.
-				 */
-				for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) {
-					mvneta_rx_lockq(sc, q);
-					if (mvneta_rx_queue_init(ifp, q) != 0) {
-						device_printf(sc->dev,
-						    "initialization failed:"
-						    " cannot initialize queue\n");
-						mvneta_rx_unlockq(sc, q);
-						error = ENOBUFS;
-						break;
-					}
+
+			for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) {
+				mvneta_rx_lockq(sc, q);
+				if (mvneta_rx_queue_init(ifp, q) != 0) {
+					device_printf(sc->dev,
+					    "initialization failed:"
+					    " cannot initialize queue\n");
 					mvneta_rx_unlockq(sc, q);
+					error = ENOBUFS;
+					break;
 				}
-				/* Trigger reinitialization */
-				mvneta_init_locked(sc);
+				mvneta_rx_unlockq(sc, q);
 			}
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+				mvneta_init_locked(sc);
+
 			mvneta_sc_unlock(sc);
                 }
                 break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109280736.18S7aJcG089681>