Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2022 12:04: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: 4d97457db1f5 - stable/13 - monitor: fix cb restore when monitored adapter unregisters
Message-ID:  <202212311204.2BVC4HHF040855@gitrepo.freebsd.org>

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

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

commit 4d97457db1f5fd8edb17397c5ecc77a396fa2d7d
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:01:53 +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 9e5d57f7ff0f..6294cc9bdbba 100644
--- a/sys/dev/netmap/netmap_monitor.c
+++ b/sys/dev/netmap/netmap_monitor.c
@@ -458,6 +458,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];
@@ -470,6 +473,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 */
@@ -490,12 +495,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?202212311204.2BVC4HHF040855>