Source-Changes-HG archive

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

[src/trunk]: src/sys/net Remove redundant splnet/splx calls - ec_lock is IPL_...



details:   https://anonhg.NetBSD.org/src/rev/184671bc4945
branches:  trunk
changeset: 351407:184671bc4945
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Feb 12 09:36:05 2017 +0000

description:
Remove redundant splnet/splx calls - ec_lock is IPL_NET.

diffstat:

 sys/net/if_ethersubr.c |  21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diffs (124 lines):

diff -r adeaf8075355 -r 184671bc4945 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Sun Feb 12 08:51:45 2017 +0000
+++ b/sys/net/if_ethersubr.c    Sun Feb 12 09:36:05 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.236 2017/01/24 18:37:20 maxv Exp $  */
+/*     $NetBSD: if_ethersubr.c,v 1.237 2017/02/12 09:36:05 skrll Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.236 2017/01/24 18:37:20 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.237 2017/02/12 09:36:05 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -991,7 +991,6 @@
 {
        struct ethercom *ec = (void *) ifp;
        struct ether_multi *enm;
-       int s;
 
        /*
         * Prevent further calls to ioctl (for example turning off
@@ -1014,7 +1013,6 @@
                vlan_ifdetach(ifp);
 #endif
 
-       s = splnet();
        mutex_enter(ec->ec_lock);
        while ((enm = LIST_FIRST(&ec->ec_multiaddrs)) != NULL) {
                LIST_REMOVE(enm, enm_list);
@@ -1022,7 +1020,6 @@
                ec->ec_multicnt--;
        }
        mutex_exit(ec->ec_lock);
-       splx(s);
 
        mutex_destroy(ec->ec_lock);
 
@@ -1234,7 +1231,7 @@
        struct ether_multi *enm, *_enm;
        u_char addrlo[ETHER_ADDR_LEN];
        u_char addrhi[ETHER_ADDR_LEN];
-       int s, error = 0;
+       int error = 0;
 
        /* Allocate out of lock */
        /* XXX still can be called in softint */
@@ -1242,7 +1239,6 @@
        if (enm == NULL)
                return ENOBUFS;
 
-       s = splnet();
        mutex_enter(ec->ec_lock);
        error = ether_multiaddr(sa, addrlo, addrhi);
        if (error != 0)
@@ -1284,7 +1280,6 @@
        enm = NULL;
 out:
        mutex_exit(ec->ec_lock);
-       splx(s);
        if (enm != NULL)
                kmem_free(enm, sizeof(*enm));
        return error;
@@ -1299,9 +1294,8 @@
        struct ether_multi *enm;
        u_char addrlo[ETHER_ADDR_LEN];
        u_char addrhi[ETHER_ADDR_LEN];
-       int s, error;
+       int error;
 
-       s = splnet();
        mutex_enter(ec->ec_lock);
        error = ether_multiaddr(sa, addrlo, addrhi);
        if (error != 0)
@@ -1328,7 +1322,6 @@
        LIST_REMOVE(enm, enm_list);
        ec->ec_multicnt--;
        mutex_exit(ec->ec_lock);
-       splx(s);
 
        kmem_free(enm, sizeof(*enm));
        /*
@@ -1338,7 +1331,6 @@
        return ENETRESET;
 error:
        mutex_exit(ec->ec_lock);
-       splx(s);
        return error;
 }
 
@@ -1537,7 +1529,7 @@
        int error = 0;
        size_t written;
        struct psref psref;
-       int bound, s;
+       int bound;
        unsigned int multicnt;
        struct ether_multi_sysctl *addrs;
        int i;
@@ -1573,12 +1565,10 @@
        multicnt = ec->ec_multicnt;
        addrs = kmem_alloc(sizeof(*addrs) * multicnt, KM_SLEEP);
 
-       s = splnet();
        mutex_enter(ec->ec_lock);
        if (multicnt < ec->ec_multicnt) {
                /* The number of multicast addresses have increased */
                mutex_exit(ec->ec_lock);
-               splx(s);
                kmem_free(addrs, sizeof(*addrs) * multicnt);
                goto retry;
        }
@@ -1592,7 +1582,6 @@
                i++;
        }
        mutex_exit(ec->ec_lock);
-       splx(s);
 
        error = 0;
        written = 0;



Home | Main Index | Thread Index | Old Index