Source-Changes-HG archive

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

[src/trunk]: src/sys/net Remove workaround for GATEWAY



details:   https://anonhg.NetBSD.org/src/rev/711c096b580b
branches:  trunk
changeset: 343598:711c096b580b
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Feb 16 01:31:26 2016 +0000

description:
Remove workaround for GATEWAY

The workaround was introduced because lltable/llentry uses rwlock
but it may be executed in hardware interrupt due to fast forward.
Now we don't run fast forward in hardware interrupt anymore, so
we can remove the workaround.

diffstat:

 sys/net/if.h        |  37 +------------------------------------
 sys/net/if_llatbl.c |  11 +----------
 sys/net/if_llatbl.h |  35 +----------------------------------
 3 files changed, 3 insertions(+), 80 deletions(-)

diffs (171 lines):

diff -r 2c4d67a25ab0 -r 711c096b580b sys/net/if.h
--- a/sys/net/if.h      Mon Feb 15 23:36:30 2016 +0000
+++ b/sys/net/if.h      Tue Feb 16 01:31:26 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.196 2016/02/15 08:08:04 ozaki-r Exp $ */
+/*     $NetBSD: if.h,v 1.197 2016/02/16 01:31:26 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -214,11 +214,7 @@
 #include <sys/condvar.h>
 #include <sys/percpu.h>
 #include <sys/callout.h>
-#ifdef GATEWAY
-#include <sys/mutex.h>
-#else
 #include <sys/rwlock.h>
-#endif
 
 struct ifnet_lock {
        kmutex_t il_lock;       /* Protects the critical section. */
@@ -352,11 +348,7 @@
        struct ifnet_lock *if_ioctl_lock;
 #ifdef _KERNEL /* XXX kvm(3) */
        struct callout *if_slowtimo_ch;
-#ifdef GATEWAY
-       struct kmutex   *if_afdata_lock;
-#else
        struct krwlock  *if_afdata_lock;
-#endif
        struct if_percpuq       *if_percpuq; /* We should remove it in the future */
        void    *if_link_si;            /* softint to handle link state changes */
        int     if_old_link_state;      /* previous link state */
@@ -450,32 +442,6 @@
        "\23TSO6"               \
        "\24LRO"                \
 
-#ifdef GATEWAY
-#define        IF_AFDATA_LOCK_INIT(ifp)        \
-       do { \
-               (ifp)->if_afdata_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET); \
-       } while (0)
-
-#define        IF_AFDATA_LOCK_DESTROY(ifp)     mutex_obj_free((ifp)->if_afdata_lock)
-
-#define        IF_AFDATA_WLOCK(ifp)    mutex_enter((ifp)->if_afdata_lock)
-#define        IF_AFDATA_RLOCK(ifp)    mutex_enter((ifp)->if_afdata_lock)
-#define        IF_AFDATA_WUNLOCK(ifp)  mutex_exit((ifp)->if_afdata_lock)
-#define        IF_AFDATA_RUNLOCK(ifp)  mutex_exit((ifp)->if_afdata_lock)
-#define        IF_AFDATA_LOCK(ifp)     IF_AFDATA_WLOCK(ifp)
-#define        IF_AFDATA_UNLOCK(ifp)   IF_AFDATA_WUNLOCK(ifp)
-#define        IF_AFDATA_TRYLOCK(ifp)  mutex_tryenter((ifp)->if_afdata_lock)
-
-#define        IF_AFDATA_LOCK_ASSERT(ifp)      \
-       KASSERT(mutex_owned((ifp)->if_afdata_lock))
-#define        IF_AFDATA_RLOCK_ASSERT(ifp)     \
-       KASSERT(mutex_owned((ifp)->if_afdata_lock))
-#define        IF_AFDATA_WLOCK_ASSERT(ifp)     \
-       KASSERT(mutex_owned((ifp)->if_afdata_lock))
-#define        IF_AFDATA_UNLOCK_ASSERT(ifp)    \
-       KASSERT(!mutex_owned((ifp)->if_afdata_lock))
-
-#else /* GATEWAY */
 #define        IF_AFDATA_LOCK_INIT(ifp)        \
        do {(ifp)->if_afdata_lock = rw_obj_alloc();} while (0)
 
@@ -497,7 +463,6 @@
        KASSERT(rw_write_held((ifp)->if_afdata_lock))
 #define        IF_AFDATA_UNLOCK_ASSERT(ifp)    \
        KASSERT(!rw_lock_held((ifp)->if_afdata_lock))
-#endif /* GATEWAY */
 
 #define IFQ_LOCK(_ifq)         if ((_ifq)->ifq_lock) mutex_enter((_ifq)->ifq_lock)
 #define IFQ_UNLOCK(_ifq)       if ((_ifq)->ifq_lock) mutex_exit((_ifq)->ifq_lock)
diff -r 2c4d67a25ab0 -r 711c096b580b sys/net/if_llatbl.c
--- a/sys/net/if_llatbl.c       Mon Feb 15 23:36:30 2016 +0000
+++ b/sys/net/if_llatbl.c       Tue Feb 16 01:31:26 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_llatbl.c,v 1.9 2015/11/26 01:41:20 ozaki-r Exp $    */
+/*     $NetBSD: if_llatbl.c,v 1.10 2016/02/16 01:31:26 ozaki-r Exp $   */
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -383,16 +383,7 @@
                if (lle->la_rt != NULL) {
                        struct rtentry *rt = lle->la_rt;
                        lle->la_rt = NULL;
-#ifdef GATEWAY
-                       /* XXX cannot call rtfree with holding mutex(IPL_NET) */
-                       LLE_ADDREF(lle);
-                       LLE_WUNLOCK(lle);
-#endif
                        rtfree(rt);
-#ifdef GATEWAY
-                       LLE_WLOCK(lle);
-                       LLE_REMREF(lle);
-#endif
                }
 #endif
                llentry_free(lle);
diff -r 2c4d67a25ab0 -r 711c096b580b sys/net/if_llatbl.h
--- a/sys/net/if_llatbl.h       Mon Feb 15 23:36:30 2016 +0000
+++ b/sys/net/if_llatbl.h       Tue Feb 16 01:31:26 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_llatbl.h,v 1.7 2015/12/17 02:38:33 ozaki-r Exp $    */
+/*     $NetBSD: if_llatbl.h,v 1.8 2016/02/16 01:31:26 ozaki-r Exp $    */
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -37,9 +37,6 @@
 #endif
 
 #include <sys/rwlock.h>
-#ifdef GATEWAY
-#include <sys/mutex.h>
-#endif
 
 #include <netinet/in.h>
 
@@ -94,11 +91,7 @@
 
        LIST_ENTRY(llentry)     lle_chain;      /* chain of deleted items */
        struct callout          lle_timer;
-#ifdef GATEWAY
-       kmutex_t                lle_lock;
-#else
        krwlock_t               lle_lock;
-#endif
 
 #ifdef __NetBSD__
 #define        la_timer        lle_timer
@@ -121,31 +114,6 @@
 #define LLE_LOCK_TRACE(t, lle) do {} while (0)
 #endif
 
-#ifdef GATEWAY
-#define        LLE_WLOCK(lle)          do { \
-                                       LLE_LOCK_TRACE(WL, (lle)); \
-                                       mutex_enter(&(lle)->lle_lock); \
-                               } while (0)
-#define        LLE_RLOCK(lle)          do { \
-                                       LLE_LOCK_TRACE(RL, (lle)); \
-                                       mutex_enter(&(lle)->lle_lock); \
-                               } while (0)
-#define        LLE_WUNLOCK(lle)        do { \
-                                       LLE_LOCK_TRACE(WU, (lle)); \
-                                       mutex_exit(&(lle)->lle_lock); \
-                               } while (0)
-#define        LLE_RUNLOCK(lle)        do { \
-                                       LLE_LOCK_TRACE(RU, (lle)); \
-                                       mutex_exit(&(lle)->lle_lock); \
-                               } while (0)
-#define        LLE_DOWNGRADE(lle)      do {} while (0)
-#define        LLE_TRY_UPGRADE(lle)    (1)
-#define        LLE_LOCK_INIT(lle)      mutex_init(&(lle)->lle_lock, MUTEX_DEFAULT, \
-                                   IPL_NET)
-#define        LLE_LOCK_DESTROY(lle)   mutex_destroy(&(lle)->lle_lock)
-#define        LLE_WLOCK_ASSERT(lle)   KASSERT(mutex_owned(&(lle)->lle_lock))
-
-#else /* GATEWAY */
 #define        LLE_WLOCK(lle)          do { \
                                        LLE_LOCK_TRACE(WL, (lle)); \
                                        rw_enter(&(lle)->lle_lock, RW_WRITER); \
@@ -171,7 +139,6 @@
 #endif
 #define        LLE_LOCK_DESTROY(lle)   rw_destroy(&(lle)->lle_lock)
 #define        LLE_WLOCK_ASSERT(lle)   KASSERT(rw_write_held(&(lle)->lle_lock))
-#endif /* GATEWAY */
 
 #define LLE_IS_VALID(lle)      (((lle) != NULL) && ((lle) != (void *)-1))
 



Home | Main Index | Thread Index | Old Index