From 73e221c2229cb93cf087cb8828401c9528036943 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Fri, 11 Nov 2016 16:19:10 +0000 Subject: Remove mutexes protection from the switchctl as they don't seem to be doing anything for us, and remove some whitespaces from the header that can be found near the removed lines. ok mikeb@ --- sys/net/if_switch.h | 8 +++----- sys/net/switchctl.c | 11 +---------- 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'sys') diff --git a/sys/net/if_switch.h b/sys/net/if_switch.h index da2115476ef..586b8e02f2d 100644 --- a/sys/net/if_switch.h +++ b/sys/net/if_switch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_switch.h,v 1.7 2016/11/10 17:32:40 rzalamena Exp $ */ +/* $OpenBSD: if_switch.h,v 1.8 2016/11/11 16:19:09 rzalamena Exp $ */ /* * Copyright (c) 2016 Kazuya GODA @@ -185,9 +185,7 @@ struct switch_dev { struct mbuf *swdev_inputm; struct mbuf_queue swdev_outq; struct selinfo swdev_rsel; - struct mutex swdev_rsel_mtx; struct selinfo swdev_wsel; - struct mutex swdev_wsel_mtx; int swdev_waiting; void (*swdev_init)(struct switch_softc *); int (*swdev_input)(struct switch_softc *, @@ -203,8 +201,8 @@ struct switch_softc { struct switch_dev *sc_swdev; /* char device */ struct bstp_state *sc_stp; /* STP state */ struct swofp_ofs *sc_ofs; /* OpenFlow */ - TAILQ_HEAD(,switch_port) sc_swpo_list; /* port */ - LIST_ENTRY(switch_softc) sc_switch_next; /* switch link */ + TAILQ_HEAD(,switch_port) sc_swpo_list; /* port */ + LIST_ENTRY(switch_softc) sc_switch_next; /* switch link */ void (*switch_process_forward)( struct switch_softc *, struct switch_flow_classify *, struct mbuf *); diff --git a/sys/net/switchctl.c b/sys/net/switchctl.c index fb65665b44f..49edf759af3 100644 --- a/sys/net/switchctl.c +++ b/sys/net/switchctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchctl.c,v 1.7 2016/11/10 17:32:40 rzalamena Exp $ */ +/* $OpenBSD: switchctl.c,v 1.8 2016/11/11 16:19:09 rzalamena Exp $ */ /* * Copyright (c) 2016 Kazuya GODA @@ -378,7 +378,6 @@ int switchkqfilter(dev_t dev, struct knote *kn) { struct switch_softc *sc = switch_dev2sc(dev); - struct mutex *mtx; struct klist *klist; if (sc == NULL) @@ -386,12 +385,10 @@ switchkqfilter(dev_t dev, struct knote *kn) switch (kn->kn_filter) { case EVFILT_READ: - mtx = &sc->sc_swdev->swdev_rsel_mtx; klist = &sc->sc_swdev->swdev_rsel.si_note; kn->kn_fop = &switch_rd_filtops; break; case EVFILT_WRITE: - mtx = &sc->sc_swdev->swdev_wsel_mtx; klist = &sc->sc_swdev->swdev_wsel.si_note; kn->kn_fop = &switch_wr_filtops; break; @@ -401,9 +398,7 @@ switchkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (caddr_t)sc; - mtx_enter(mtx); SLIST_INSERT_HEAD(klist, kn, kn_selnext); - mtx_leave(mtx); return (0); } @@ -417,9 +412,7 @@ filt_switch_rdetach(struct knote *kn) if (ISSET(kn->kn_status, KN_DETACHED)) return; - mtx_enter(&sc->sc_swdev->swdev_rsel_mtx); SLIST_REMOVE(klist, kn, knote, kn_selnext); - mtx_leave(&sc->sc_swdev->swdev_rsel_mtx); } int @@ -451,9 +444,7 @@ filt_switch_wdetach(struct knote *kn) if (ISSET(kn->kn_status, KN_DETACHED)) return; - mtx_enter(&sc->sc_swdev->swdev_wsel_mtx); SLIST_REMOVE(klist, kn, knote, kn_selnext); - mtx_leave(&sc->sc_swdev->swdev_wsel_mtx); } int -- cgit v1.2.3