summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-04-23 10:53:45 +0000
committerdlg <dlg@openbsd.org>2019-04-23 10:53:45 +0000
commit26415d92bd9308bb6af8c530d2e314e144b121f0 (patch)
tree161f40b6481691306ce00e8a250f972e7aa77976
parentAdd -no-clear variants of copy-selection and copy-pipe which do not (diff)
downloadwireguard-openbsd-26415d92bd9308bb6af8c530d2e314e144b121f0.tar.xz
wireguard-openbsd-26415d92bd9308bb6af8c530d2e314e144b121f0.zip
a first cut at converting some virtual ethernet interfaces to if_vinput
this let's input processing bypass ifiqs. there's a performance benefit from this, and it will let me tweak the backpressure detection mechanism that ifiqs use without impacting on a stack of virtual interfaces. ive tested all of these except mpw, which i will end up testing soon anyway.
-rw-r--r--sys/net/if_bpe.c7
-rw-r--r--sys/net/if_etherip.c7
-rw-r--r--sys/net/if_gre.c17
-rw-r--r--sys/net/if_mpw.c7
-rw-r--r--sys/net/if_trunk.c7
-rw-r--r--sys/net/if_vxlan.c7
-rw-r--r--sys/netinet/ip_carp.c12
7 files changed, 26 insertions, 38 deletions
diff --git a/sys/net/if_bpe.c b/sys/net/if_bpe.c
index c307a4caf76..c86f7810b6f 100644
--- a/sys/net/if_bpe.c
+++ b/sys/net/if_bpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bpe.c,v 1.4 2019/04/19 07:39:37 dlg Exp $ */
+/* $OpenBSD: if_bpe.c,v 1.5 2019/04/23 10:53:45 dlg Exp $ */
/*
* Copyright (c) 2018 David Gwynne <dlg@openbsd.org>
*
@@ -194,6 +194,7 @@ bpe_clone_create(struct if_clone *ifc, int unit)
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ether_fakeaddr(ifp);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -891,7 +892,6 @@ bpe_input_map(struct bpe_softc *sc, const uint8_t *ba, const uint8_t *ca)
void
bpe_input(struct ifnet *ifp0, struct mbuf *m)
{
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct bpe_softc *sc;
struct ifnet *ifp;
struct ether_header *beh, *ceh;
@@ -969,8 +969,7 @@ bpe_input(struct ifnet *ifp0, struct mbuf *m)
pf_pkt_addr_changed(m);
#endif
- ml_enqueue(&ml, m);
- if_input(ifp, &ml);
+ if_vinput(ifp, m);
return;
drop:
diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c
index cbf8b58700b..e43f8c223b9 100644
--- a/sys/net/if_etherip.c
+++ b/sys/net/if_etherip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_etherip.c,v 1.44 2019/04/19 07:39:37 dlg Exp $ */
+/* $OpenBSD: if_etherip.c,v 1.45 2019/04/23 10:53:45 dlg Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*
@@ -159,6 +159,7 @@ etherip_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -592,7 +593,6 @@ int
etherip_input(struct etherip_tunnel *key, struct mbuf *m, uint8_t tos,
int hlen)
{
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct etherip_softc *sc;
struct ifnet *ifp;
struct etherip_header *eip;
@@ -657,8 +657,7 @@ etherip_input(struct etherip_tunnel *key, struct mbuf *m, uint8_t tos,
pf_pkt_addr_changed(m);
#endif
- ml_enqueue(&ml, m);
- if_input(ifp, &ml);
+ if_vinput(ifp, m);
return IPPROTO_DONE;
drop:
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 2549906d100..ee4798b8124 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.148 2019/04/22 00:38:05 dlg Exp $ */
+/* $OpenBSD: if_gre.c,v 1.149 2019/04/23 10:53:45 dlg Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -729,6 +729,7 @@ egre_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -804,6 +805,7 @@ nvgre_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -866,6 +868,7 @@ eoip_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -1310,7 +1313,6 @@ static int
egre_input(const struct gre_tunnel *key, struct mbuf *m, int hlen, uint8_t otos)
{
struct egre_softc *sc;
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
NET_ASSERT_LOCKED();
sc = RBT_FIND(egre_tree, &egre_tree, (const struct egre_softc *)key);
@@ -1335,8 +1337,7 @@ egre_input(const struct gre_tunnel *key, struct mbuf *m, int hlen, uint8_t otos)
gre_l2_prio(&sc->sc_tunnel, m, otos);
- ml_enqueue(&ml, m);
- if_input(&sc->sc_ac.ac_if, &ml);
+ if_vinput(&sc->sc_ac.ac_if, m);
return (0);
}
@@ -1559,7 +1560,6 @@ nvgre_input(const struct gre_tunnel *key, struct mbuf *m, int hlen,
uint8_t otos)
{
struct nvgre_softc *sc;
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
if (ISSET(m->m_flags, M_MCAST|M_BCAST))
sc = nvgre_mcast_find(key, m->m_pkthdr.ph_ifidx);
@@ -1587,8 +1587,7 @@ nvgre_input(const struct gre_tunnel *key, struct mbuf *m, int hlen,
pf_pkt_addr_changed(m);
#endif
- ml_enqueue(&ml, m);
- if_input(&sc->sc_ac.ac_if, &ml);
+ if_vinput(&sc->sc_ac.ac_if, m);
return (0);
}
@@ -4188,7 +4187,6 @@ static struct mbuf *
eoip_input(struct gre_tunnel *key, struct mbuf *m,
const struct gre_header *gh, uint8_t otos, int iphlen)
{
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct eoip_softc *sc;
struct gre_h_key_eoip *eoiph;
int hlen, len;
@@ -4240,8 +4238,7 @@ eoip_input(struct gre_tunnel *key, struct mbuf *m,
pf_pkt_addr_changed(m);
#endif
- ml_enqueue(&ml, m);
- if_input(&sc->sc_ac.ac_if, &ml);
+ if_vinput(&sc->sc_ac.ac_if, m);
return (NULL);
diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c
index 9ef833404e3..bcef7de8209 100644
--- a/sys/net/if_mpw.c
+++ b/sys/net/if_mpw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpw.c,v 1.53 2019/04/19 07:39:37 dlg Exp $ */
+/* $OpenBSD: if_mpw.c,v 1.54 2019/04/23 10:53:45 dlg Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -116,6 +116,7 @@ mpw_clone_create(struct if_clone *ifc, int unit)
sc->sc_dead = 0;
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -506,7 +507,6 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
static void
mpw_input(struct mpw_softc *sc, struct mbuf *m)
{
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct ifnet *ifp = &sc->sc_if;
struct shim_hdr *shim;
struct mbuf *n;
@@ -612,8 +612,7 @@ mpw_input(struct mpw_softc *sc, struct mbuf *m)
pf_pkt_addr_changed(m);
#endif
- ml_enqueue(&ml, m);
- if_input(ifp, &ml);
+ if_vinput(ifp, m);
return;
drop:
m_freem(m);
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index 6887002a863..9682fc1edee 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.137 2018/08/12 23:50:31 ccardenas Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.138 2019/04/23 10:53:45 dlg Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -194,6 +194,7 @@ trunk_clone_create(struct if_clone *ifc, int unit)
* Attach as an ordinary ethernet device, children will be attached
* as special device IFT_IEEE8023ADLAG.
*/
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -1118,7 +1119,6 @@ trunk_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
struct trunk_port *tp;
struct ifnet *trifp = NULL;
struct ether_header *eh;
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
eh = mtod(m, struct ether_header *);
if (ETHER_IS_MULTICAST(eh->ether_dhost))
@@ -1162,8 +1162,7 @@ trunk_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
}
- ml_enqueue(&ml, m);
- if_input(trifp, &ml);
+ if_vinput(trifp, m);
return (1);
bad:
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 0cfc0878bc8..73535393979 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vxlan.c,v 1.70 2018/12/03 17:25:22 claudio Exp $ */
+/* $OpenBSD: if_vxlan.c,v 1.71 2019/04/23 10:53:45 dlg Exp $ */
/*
* Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org>
@@ -159,6 +159,7 @@ vxlan_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -634,7 +635,6 @@ int
vxlan_lookup(struct mbuf *m, struct udphdr *uh, int iphlen,
struct sockaddr *srcsa, struct sockaddr *dstsa)
{
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct vxlan_softc *sc = NULL, *sc_cand = NULL;
struct vxlan_header v;
int vni;
@@ -743,8 +743,7 @@ vxlan_lookup(struct mbuf *m, struct udphdr *uh, int iphlen,
m = n;
}
- ml_enqueue(&ml, m);
- if_input(ifp, &ml);
+ if_vinput(ifp, m);
/* success */
return (1);
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 6d204c33dcb..8f6d59b3953 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.336 2018/12/17 09:17:30 claudio Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.337 2019/04/23 10:53:45 dlg Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -829,6 +829,7 @@ carp_clone_create(struct if_clone *ifc, int unit)
ifp->if_start = carp_start;
ifp->if_xflags = IFXF_CLONED;
IFQ_SET_MAXLEN(&ifp->if_snd, 1);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
ifp->if_type = IFT_CARP;
@@ -1381,7 +1382,6 @@ int
carp_input(struct ifnet *ifp0, struct mbuf *m, void *cookie)
{
struct ether_header *eh;
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct srpl *cif;
struct carp_softc *sc;
struct srp_ref sr;
@@ -1444,18 +1444,14 @@ carp_input(struct ifnet *ifp0, struct mbuf *m, void *cookie)
if (m0 == NULL)
continue;
- ml_init(&ml);
- ml_enqueue(&ml, m0);
-
- if_input(&sc->sc_if, &ml);
+ if_vinput(&sc->sc_if, m0);
}
SRPL_LEAVE(&sr);
return (0);
}
- ml_enqueue(&ml, m);
- if_input(&sc->sc_if, &ml);
+ if_vinput(&sc->sc_if, m);
out:
SRPL_LEAVE(&sr);