Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Replace compile-time checking for vlan code with a modul...
details: https://anonhg.NetBSD.org/src/rev/fd15100da2b8
branches: trunk
changeset: 449784:fd15100da2b8
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sat Mar 23 09:48:04 2019 +0000
description:
Replace compile-time checking for vlan code with a module hook.
Should resolve the errors reported on irc when booting a kernel which
has agr without vlan:
[ 1.0000000] WARNING: module error: built-in module if_agr can't find builtin dependency `if_vlan'
[ 1.0000000] WARNING: module error: built-in module if_agr prerequisite if_vlan failed, error 2
diffstat:
sys/modules/if_agr/Makefile | 4 ++--
sys/net/agr/if_agr.c | 14 +++++---------
sys/net/if.c | 10 ++++++++--
sys/net/if.h | 8 +++++++-
sys/net/if_vlan.c | 6 ++++--
5 files changed, 26 insertions(+), 16 deletions(-)
diffs (161 lines):
diff -r acb833e9f479 -r fd15100da2b8 sys/modules/if_agr/Makefile
--- a/sys/modules/if_agr/Makefile Sat Mar 23 09:33:16 2019 +0000
+++ b/sys/modules/if_agr/Makefile Sat Mar 23 09:48:04 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2019/02/17 04:05:51 rin Exp $
+# $NetBSD: Makefile,v 1.4 2019/03/23 09:48:04 pgoyette Exp $
.include "../Makefile.inc"
@@ -25,7 +25,7 @@
if_agrsubr.c \
if_agrtimer.c
-CPPFLAGS+= -DINET -DNVLAN=1
+CPPFLAGS+= -DINET
WARNS= 3
diff -r acb833e9f479 -r fd15100da2b8 sys/net/agr/if_agr.c
--- a/sys/net/agr/if_agr.c Sat Mar 23 09:33:16 2019 +0000
+++ b/sys/net/agr/if_agr.c Sat Mar 23 09:48:04 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_agr.c,v 1.47 2018/06/26 06:48:02 msaitoh Exp $ */
+/* $NetBSD: if_agr.c,v 1.48 2019/03/23 09:48:04 pgoyette Exp $ */
/*-
* Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,11 +27,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.47 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.48 2019/03/23 09:48:04 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
-#include "vlan.h"
#endif
#include <sys/param.h>
@@ -169,11 +168,8 @@
* provided us with the tag.
*/
if (ec->ec_nvlans && vlan_has_tag(m)) {
-#if NVLAN > 0
- vlan_input(ifp, m);
-#else
- m_freem(m);
-#endif
+ MODULE_HOOK_CALL_VOID(if_vlan_vlan_input_hook, (ifp, m),
+ m_freem(m));
return;
}
@@ -1169,4 +1165,4 @@
*/
#include <net/if_module.h>
-IF_MODULE(MODULE_CLASS_DRIVER, agr, "if_vlan")
+IF_MODULE(MODULE_CLASS_DRIVER, agr, "")
diff -r acb833e9f479 -r fd15100da2b8 sys/net/if.c
--- a/sys/net/if.c Sat Mar 23 09:33:16 2019 +0000
+++ b/sys/net/if.c Sat Mar 23 09:48:04 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.446 2019/03/01 11:06:57 pgoyette Exp $ */
+/* $NetBSD: if.c,v 1.447 2019/03/23 09:48:04 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.446 2019/03/01 11:06:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.447 2019/03/23 09:48:04 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -119,6 +119,7 @@
#include <sys/xcall.h>
#include <sys/cpu.h>
#include <sys/intr.h>
+#include <sys/module_hook.h>
#include <sys/compat_stub.h>
#include <net/if.h>
@@ -244,6 +245,11 @@
static void sysctl_net_pktq_setup(struct sysctllog **, int);
#endif
+/*
+ * Hook for if_vlan - needed by if_agr
+ */
+struct if_vlan_vlan_input_hook_t if_vlan_vlan_input_hook;
+
static void if_sysctl_setup(struct sysctllog **);
static int
diff -r acb833e9f479 -r fd15100da2b8 sys/net/if.h
--- a/sys/net/if.h Sat Mar 23 09:33:16 2019 +0000
+++ b/sys/net/if.h Sat Mar 23 09:48:04 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.h,v 1.268 2019/02/05 06:43:20 msaitoh Exp $ */
+/* $NetBSD: if.h,v 1.269 2019/03/23 09:48:04 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -88,6 +88,7 @@
#include <sys/pslist.h>
#include <sys/pserialize.h>
#include <sys/psref.h>
+#include <sys/module_hook.h>
#endif
/*
@@ -1330,6 +1331,11 @@
#define IFQCTL_PEAK 3
#define IFQCTL_DROPS 4
+/*
+ * Hook for if_vlan - needed by if_agr
+ */
+MODULE_HOOK(if_vlan_vlan_input_hook, void, (struct ifnet *, struct mbuf *));
+
#endif /* _KERNEL */
#endif /* !_NET_IF_H_ */
diff -r acb833e9f479 -r fd15100da2b8 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Sat Mar 23 09:33:16 2019 +0000
+++ b/sys/net/if_vlan.c Sat Mar 23 09:48:04 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.133 2018/10/19 00:12:56 knakahara Exp $ */
+/* $NetBSD: if_vlan.c,v 1.134 2019/03/23 09:48:04 pgoyette Exp $ */
/*
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.133 2018/10/19 00:12:56 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.134 2019/03/23 09:48:04 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -293,6 +293,7 @@
if_clone_attach(&vlan_cloner);
vlan_hash_init();
+ MODULE_HOOK_SET(if_vlan_vlan_input_hook, "vlan_inp", vlan_input);
}
static int
@@ -318,6 +319,7 @@
mutex_destroy(&ifv_hash.lock);
mutex_destroy(&ifv_list.lock);
+ MODULE_HOOK_UNSET(if_vlan_vlan_input_hook);
return 0;
}
Home |
Main Index |
Thread Index |
Old Index