Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2022 12:29:17 GMT
From:      Vincenzo Maffione <vmaffione@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a74ed1442347 - stable/12 - monitor: fix cb restore when monitored adapter unregisters
Message-ID:  <202212311229.2BVCTHp8070022@gitrepo.freebsd.org>

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

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

commit a74ed14423470a4ef5dec5dfe0b448994fe6a399
Author:     Vincenzo Maffione <vmaffione@FreeBSD.org>
AuthorDate: 2022-12-24 15:28:45 +0000
Commit:     Vincenzo Maffione <vmaffione@FreeBSD.org>
CommitDate: 2022-12-31 12:14:13 +0000

    monitor: fix cb restore when monitored adapter unregisters
    
    netmap_monitor_stop() called nm_monitor_none() after the head of
    the zero-copy monitors had been reset, thus thinking that there
    was nothing left to do.
    
    MFC after:      7 days
    
    (cherry picked from commit b41818a28a6dba6d33076fbb789442308e57a124)
---
 sys/dev/netmap/netmap_monitor.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c
index 1f5ff65b3b81..aabf23b0397a 100644
--- a/sys/dev/netmap/netmap_monitor.c
+++ b/sys/dev/netmap/netmap_monitor.c
@@ -456,6 +456,9 @@ netmap_monitor_stop(struct netmap_adapter *na)
 			struct netmap_zmon_list *z = &kring->zmon_list[t];
 			u_int j;
 
+			if (nm_monitor_none(kring))
+				continue;
+
 			for (j = 0; j < kring->n_monitors; j++) {
 				struct netmap_kring *mkring =
 					kring->monitors[j];
@@ -468,6 +471,8 @@ netmap_monitor_stop(struct netmap_adapter *na)
 				}
 				kring->monitors[j] = NULL;
 			}
+			kring->n_monitors = 0;
+			nm_monitor_dealloc(kring);
 
 			if (!nm_is_zmon(na)) {
 				/* we are the head of at most one list */
@@ -488,12 +493,7 @@ netmap_monitor_stop(struct netmap_adapter *na)
 				z->prev = NULL;
 			}
 
-			if (!nm_monitor_none(kring)) {
-
-				kring->n_monitors = 0;
-				nm_monitor_dealloc(kring);
-				nm_monitor_restore_callbacks(kring);
-			}
+			nm_monitor_restore_callbacks(kring);
 		}
 	}
 }



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