git: 4ad57c7afaca - main - netmap_update_config: update na->name to cope with reconfigurations

From: Vincenzo Maffione <vmaffione_at_FreeBSD.org>
Date: Sat, 03 Dec 2022 18:27:13 UTC
The branch main has been updated by vmaffione:

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

commit 4ad57c7afaca3fd94b67c00706e210f0373b8e62
Author:     Vincenzo Maffione <vmaffione@FreeBSD.org>
AuthorDate: 2022-12-03 18:12:04 +0000
Commit:     Vincenzo Maffione <vmaffione@FreeBSD.org>
CommitDate: 2022-12-03 18:12:04 +0000

    netmap_update_config: update na->name to cope with reconfigurations
    
    MFC after:      1 week
---
 sys/dev/netmap/netmap.c      | 4 ++++
 sys/dev/netmap/netmap_bdg.h  | 1 -
 sys/dev/netmap/netmap_kern.h | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
index a166bc9d233d..4bafa507384d 100644
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -763,6 +763,10 @@ netmap_update_config(struct netmap_adapter *na)
 {
 	struct nm_config_info info;
 
+	if (na->ifp && !nm_is_bwrap(na)) {
+		strlcpy(na->name, na->ifp->if_xname, sizeof(na->name));
+	}
+
 	bzero(&info, sizeof(info));
 	if (na->nm_config == NULL ||
 	    na->nm_config(na, &info)) {
diff --git a/sys/dev/netmap/netmap_bdg.h b/sys/dev/netmap/netmap_bdg.h
index a88eaf11b07c..ac8629141601 100644
--- a/sys/dev/netmap/netmap_bdg.h
+++ b/sys/dev/netmap/netmap_bdg.h
@@ -192,7 +192,6 @@ void netmap_uninit_bridges2(struct nm_bridge *, u_int);
 int netmap_bdg_update_private_data(const char *name, bdg_update_private_data_fn_t callback,
 	void *callback_data, void *auth_token);
 int netmap_bdg_config(struct nm_ifreq *nifr);
-int nm_is_bwrap(struct netmap_adapter *);
 
 #define NM_NEED_BWRAP (-2)
 #endif /* _NET_NETMAP_BDG_H_ */
diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h
index acceaa9df540..e5be1c793f4d 100644
--- a/sys/dev/netmap/netmap_kern.h
+++ b/sys/dev/netmap/netmap_kern.h
@@ -1155,6 +1155,7 @@ struct netmap_bwrap_adapter {
 	struct netmap_vp_adapter *saved_na_vp;
 	int (*nm_intr_notify)(struct netmap_kring *kring, int flags);
 };
+int nm_is_bwrap(struct netmap_adapter *na);
 int nm_bdg_polling(struct nmreq_header *hdr);
 
 int netmap_bdg_attach(struct nmreq_header *hdr, void *auth_token);
@@ -1566,6 +1567,7 @@ extern unsigned int vale_max_bridges;
 #define	netmap_get_vale_na(_1, _2, _3, _4)	0
 #define netmap_bdg_create(_1, _2)	NULL
 #define netmap_bdg_destroy(_1, _2)	0
+#define vale_max_bridges		1
 #endif /* !WITH_VALE */
 
 #ifdef WITH_PIPES