Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Make arp have its own mowner
details: https://anonhg.NetBSD.org/src/rev/c5a0dfff6d2e
branches: trunk
changeset: 372370:c5a0dfff6d2e
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Nov 19 08:00:51 2022 +0000
description:
Make arp have its own mowner
This helped me to debug mbuf leaks in arp.
(if_arp.c rev. 1.298)
diffstat:
sys/net/if_llatbl.c | 5 ++++-
sys/net/if_llatbl.h | 6 +++++-
sys/net/nd.c | 7 +++++--
sys/netinet/in.c | 17 +++++++++++++----
sys/netinet/in_var.h | 5 ++++-
5 files changed, 31 insertions(+), 9 deletions(-)
diffs (152 lines):
diff -r 834712feb816 -r c5a0dfff6d2e sys/net/if_llatbl.c
--- a/sys/net/if_llatbl.c Sat Nov 19 07:57:51 2022 +0000
+++ b/sys/net/if_llatbl.c Sat Nov 19 08:00:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_llatbl.c,v 1.34 2022/05/24 20:50:20 andvar Exp $ */
+/* $NetBSD: if_llatbl.c,v 1.35 2022/11/19 08:00:51 yamt Exp $ */
/*
* Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
* Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -540,6 +540,9 @@
llt->llt_foreach_entry = htable_foreach_lle;
llt->llt_free_tbl = htable_free_tbl;
+#ifdef MBUFTRACE
+ llt->llt_mowner = NULL;
+#endif
return (llt);
}
diff -r 834712feb816 -r c5a0dfff6d2e sys/net/if_llatbl.h
--- a/sys/net/if_llatbl.h Sat Nov 19 07:57:51 2022 +0000
+++ b/sys/net/if_llatbl.h Sat Nov 19 08:00:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_llatbl.h,v 1.18 2020/09/14 15:09:57 roy Exp $ */
+/* $NetBSD: if_llatbl.h,v 1.19 2022/11/19 08:00:51 yamt Exp $ */
/*
* Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
* Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -34,6 +34,7 @@
#if defined(_KERNEL_OPT)
#include "opt_gateway.h"
+#include "opt_mbuftrace.h"
#endif
#include <sys/rwlock.h>
@@ -232,6 +233,9 @@
llt_unlink_entry_t *llt_unlink_entry;
llt_fill_sa_entry_t *llt_fill_sa_entry;
llt_free_tbl_t *llt_free_tbl;
+#ifdef MBUFTRACE
+ struct mowner *llt_mowner;
+#endif
};
MALLOC_DECLARE(M_LLTABLE);
diff -r 834712feb816 -r c5a0dfff6d2e sys/net/nd.c
--- a/sys/net/nd.c Sat Nov 19 07:57:51 2022 +0000
+++ b/sys/net/nd.c Sat Nov 19 08:00:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd.c,v 1.4 2020/09/15 23:40:03 roy Exp $ */
+/* $NetBSD: nd.c,v 1.5 2022/11/19 08:00:51 yamt Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd.c,v 1.4 2020/09/15 23:40:03 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd.c,v 1.5 2022/11/19 08:00:51 yamt Exp $");
#include <sys/callout.h>
#include <sys/mbuf.h>
@@ -359,6 +359,9 @@
ln->ln_state == ND_LLINFO_WAITDELETE)
ln->ln_state = ND_LLINFO_INCOMPLETE;
+#ifdef MBUFTRACE
+ m_claimm(m, ln->lle_tbl->llt_mowner);
+#endif
if (ln->ln_hold != NULL) {
struct mbuf *m_hold;
int i;
diff -r 834712feb816 -r c5a0dfff6d2e sys/netinet/in.c
--- a/sys/netinet/in.c Sat Nov 19 07:57:51 2022 +0000
+++ b/sys/netinet/in.c Sat Nov 19 08:00:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $ */
+/* $NetBSD: in.c,v 1.246 2022/11/19 08:00:51 yamt Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.246 2022/11/19 08:00:51 yamt Exp $");
#include "arp.h"
@@ -2415,7 +2415,7 @@
#if NARP > 0
static struct lltable *
-in_lltattach(struct ifnet *ifp)
+in_lltattach(struct ifnet *ifp, struct in_ifinfo *ii)
{
struct lltable *llt;
@@ -2431,6 +2431,12 @@
llt->llt_fill_sa_entry = in_lltable_fill_sa_entry;
llt->llt_free_entry = in_lltable_free_entry;
llt->llt_match_prefix = in_lltable_match_prefix;
+#ifdef MBUFTRACE
+ struct mowner *mowner = &ii->ii_mowner;
+ mowner_init_owner(mowner, ifp->if_xname, "arp");
+ MOWNER_ATTACH(mowner);
+ llt->llt_mowner = mowner;
+#endif
lltable_link(llt);
return (llt);
@@ -2446,7 +2452,7 @@
ii = kmem_zalloc(sizeof(struct in_ifinfo), KM_SLEEP);
#if NARP > 0
- ii->ii_llt = in_lltattach(ifp);
+ ii->ii_llt = in_lltattach(ifp, ii);
#endif
#ifdef IPSELSRC
@@ -2467,6 +2473,9 @@
#endif
#if NARP > 0
lltable_free(ii->ii_llt);
+#ifdef MBUFTRACE
+ MOWNER_DETACH(&ii->ii_mowner);
+#endif
#endif
kmem_free(ii, sizeof(struct in_ifinfo));
}
diff -r 834712feb816 -r c5a0dfff6d2e sys/netinet/in_var.h
--- a/sys/netinet/in_var.h Sat Nov 19 07:57:51 2022 +0000
+++ b/sys/netinet/in_var.h Sat Nov 19 08:00:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_var.h,v 1.102 2021/03/08 22:01:18 christos Exp $ */
+/* $NetBSD: in_var.h,v 1.103 2022/11/19 08:00:51 yamt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -357,6 +357,9 @@
struct in_ifinfo {
struct lltable *ii_llt; /* ARP state */
struct in_ifsysctl *ii_selsrc;
+#ifdef MBUFTRACE
+ struct mowner ii_mowner;
+#endif
};
#endif /* _KERNEL */
Home |
Main Index |
Thread Index |
Old Index