Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Fix build of kernels without ether



details:   https://anonhg.NetBSD.org/src/rev/b3abc89a7188
branches:  trunk
changeset: 828314:b3abc89a7188
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Dec 08 04:03:51 2017 +0000

description:
Fix build of kernels without ether

By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.

PR kern/52790

diffstat:

 sys/net/if.c        |  28 ++--------------------------
 sys/net/if.h        |   4 +---
 sys/net/if_bridge.c |  12 ++++++++----
 sys/net/if_vlan.c   |  15 ++++++++++-----
 4 files changed, 21 insertions(+), 38 deletions(-)

diffs (150 lines):

diff -r 4308594b215b -r b3abc89a7188 sys/net/if.c
--- a/sys/net/if.c      Fri Dec 08 03:36:42 2017 +0000
+++ b/sys/net/if.c      Fri Dec 08 04:03:51 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.409 2017/12/07 10:05:42 ozaki-r Exp $ */
+/*     $NetBSD: if.c,v 1.410 2017/12/08 04:03:51 ozaki-r 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.409 2017/12/07 10:05:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.410 2017/12/08 04:03:51 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3614,30 +3614,6 @@
        return rc;
 }
 
-int
-if_enable_vlan_mtu(struct ifnet *ifp)
-{
-       int error;
-
-       mutex_enter(ifp->if_ioctl_lock);
-       error= ether_enable_vlan_mtu(ifp);
-       mutex_exit(ifp->if_ioctl_lock);
-
-       return error;
-}
-
-int
-if_disable_vlan_mtu(struct ifnet *ifp)
-{
-       int error;
-
-       mutex_enter(ifp->if_ioctl_lock);
-       error= ether_disable_vlan_mtu(ifp);
-       mutex_exit(ifp->if_ioctl_lock);
-
-       return error;
-}
-
 static void
 sysctl_sndq_setup(struct sysctllog **clog, const char *ifname,
     struct ifaltq *ifq)
diff -r 4308594b215b -r b3abc89a7188 sys/net/if.h
--- a/sys/net/if.h      Fri Dec 08 03:36:42 2017 +0000
+++ b/sys/net/if.h      Fri Dec 08 04:03:51 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.249 2017/12/06 09:03:12 ozaki-r Exp $ */
+/*     $NetBSD: if.h,v 1.250 2017/12/08 04:03:51 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1022,8 +1022,6 @@
 int    if_mcast_op(ifnet_t *, const unsigned long, const struct sockaddr *);
 int    if_flags_set(struct ifnet *, const short);
 int    if_clone_list(int, char *, int *);
-int    if_enable_vlan_mtu(struct ifnet *);
-int    if_disable_vlan_mtu(struct ifnet *);
 
 struct ifnet *ifunit(const char *);
 struct ifnet *if_get(const char *, struct psref *);
diff -r 4308594b215b -r b3abc89a7188 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Fri Dec 08 03:36:42 2017 +0000
+++ b/sys/net/if_bridge.c       Fri Dec 08 04:03:51 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.143 2017/12/06 07:40:16 ozaki-r Exp $  */
+/*     $NetBSD: if_bridge.c,v 1.144 2017/12/08 04:03:51 ozaki-r Exp $  */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.143 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.144 2017/12/08 04:03:51 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -772,7 +772,9 @@
                }
                /* FALLTHROUGH */
        case IFT_L2TP:
-               error = if_enable_vlan_mtu(ifs);
+               mutex_enter(ifs->if_ioctl_lock);
+               error = ether_enable_vlan_mtu(ifs);
+               mutex_exit(ifs->if_ioctl_lock);
                if (error > 0)
                        goto out;
                /*
@@ -854,7 +856,9 @@
                 * Don't call it with holding a spin lock.
                 */
                (void) ifpromisc(ifs, 0);
-               (void) if_disable_vlan_mtu(ifs);
+               mutex_enter(ifs->if_ioctl_lock);
+               (void) ether_disable_vlan_mtu(ifs);
+               mutex_exit(ifs->if_ioctl_lock);
                break;
        default:
 #ifdef DIAGNOSTIC
diff -r 4308594b215b -r b3abc89a7188 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Fri Dec 08 03:36:42 2017 +0000
+++ b/sys/net/if_vlan.c Fri Dec 08 04:03:51 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.117 2017/12/06 08:12:54 ozaki-r Exp $    */
+/*     $NetBSD: if_vlan.c,v 1.118 2017/12/08 04:03:51 ozaki-r 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.117 2017/12/06 08:12:54 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.118 2017/12/08 04:03:51 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -463,7 +463,9 @@
                nmib->ifvm_mintu = ETHERMIN;
 
                if (ec->ec_nvlans++ == 0) {
-                       error = if_enable_vlan_mtu(p);
+                       mutex_enter(p->if_ioctl_lock);
+                       error = ether_enable_vlan_mtu(p);
+                       mutex_exit(p->if_ioctl_lock);
                        if (error >= 0) {
                                if (error) {
                                        ec->ec_nvlans--;
@@ -610,8 +612,11 @@
        case IFT_ETHER:
            {
                struct ethercom *ec = (void *)p;
-               if (--ec->ec_nvlans == 0)
-                       (void)if_disable_vlan_mtu(p);
+               if (--ec->ec_nvlans == 0) {
+                       mutex_enter(p->if_ioctl_lock);
+                       (void) ether_disable_vlan_mtu(p);
+                       mutex_exit(p->if_ioctl_lock);
+               }
 
                ether_ifdetach(ifp);
                /* Restore vlan_ioctl overwritten by ether_ifdetach */



Home | Main Index | Thread Index | Old Index