summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2016-07-28 12:08:14 +0000
committermikeb <mikeb@openbsd.org>2016-07-28 12:08:14 +0000
commitf89d6e40b38c352febf143c36187be5359b90ac3 (patch)
tree012ae0ce35098bc0f52eb858afb9d53965f070f2
parentfirmware is the plural; (diff)
downloadwireguard-openbsd-f89d6e40b38c352febf143c36187be5359b90ac3.tar.xz
wireguard-openbsd-f89d6e40b38c352febf143c36187be5359b90ac3.zip
Convert ifq_deq_{begin,rollback,commit} dance to a single ifq_dequeue
-rw-r--r--sys/dev/pv/hyperv.c10
-rw-r--r--sys/dev/pv/if_xnf.c24
-rw-r--r--sys/kern/kern_pledge.c4
3 files changed, 17 insertions, 21 deletions
diff --git a/sys/dev/pv/hyperv.c b/sys/dev/pv/hyperv.c
index 94d21473a69..cd975cd9262 100644
--- a/sys/dev/pv/hyperv.c
+++ b/sys/dev/pv/hyperv.c
@@ -397,7 +397,7 @@ hv_cmd(struct hv_softc *sc, void *cmd, size_t cmdlen, void *rsp,
int rv;
if (cmdlen > HV_MESSAGE_PAYLOAD) {
- printf("%s: payload too large (%ld)\n", sc->sc_dev.dv_xname,
+ printf("%s: payload too large (%lu)\n", sc->sc_dev.dv_xname,
cmdlen);
return (EMSGSIZE);
}
@@ -568,12 +568,12 @@ hv_event_intr(struct hv_softc *sc)
continue;
ch = hv_channel_lookup(sc, relid);
if (ch == NULL) {
- printf("%s: unhandled event on %u\n",
+ printf("%s: unhandled event on %d\n",
sc->sc_dev.dv_xname, relid);
continue;
}
if (ch->ch_state != HV_CHANSTATE_OPENED) {
- printf("%s: channel %u is not active\n",
+ printf("%s: channel %d is not active\n",
sc->sc_dev.dv_xname, relid);
continue;
}
@@ -600,7 +600,7 @@ hv_message_intr(struct hv_softc *sc)
hdr = (struct hv_channel_msg_header *)msg->payload;
if (hdr->message_type >= HV_CHANMSG_COUNT) {
- printf("%s: unhandled message type %d flags %#x\n",
+ printf("%s: unhandled message type %u flags %#x\n",
sc->sc_dev.dv_xname, hdr->message_type,
msg->header.message_flags);
goto skip;
@@ -608,7 +608,7 @@ hv_message_intr(struct hv_softc *sc)
if (hv_msg_dispatch[hdr->message_type].hmd_handler)
hv_msg_dispatch[hdr->message_type].hmd_handler(sc, hdr);
else
- printf("%s: unhandled message type %d\n",
+ printf("%s: unhandled message type %u\n",
sc->sc_dev.dv_xname, hdr->message_type);
skip:
msg->header.message_type = HV_MESSAGE_TYPE_NONE;
diff --git a/sys/dev/pv/if_xnf.c b/sys/dev/pv/if_xnf.c
index 67a905e1636..24947720d71 100644
--- a/sys/dev/pv/if_xnf.c
+++ b/sys/dev/pv/if_xnf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xnf.c,v 1.22 2016/04/19 18:15:41 mikeb Exp $ */
+/* $OpenBSD: if_xnf.c,v 1.23 2016/07/28 12:08:14 mikeb Exp $ */
/*
* Copyright (c) 2015, 2016 Mike Belopuhov
@@ -467,7 +467,7 @@ xnf_start(struct ifnet *ifp)
struct xnf_softc *sc = ifp->if_softc;
struct xnf_tx_ring *txr = sc->sc_tx_ring;
struct mbuf *m;
- int error, pkts = 0;
+ int pkts = 0;
uint32_t prod;
if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
@@ -479,25 +479,23 @@ xnf_start(struct ifnet *ifp)
prod = txr->txr_prod;
for (;;) {
- m = ifq_deq_begin(&ifp->if_snd);
- if (m == NULL)
- break;
-
- error = xnf_encap(sc, m, &prod);
- if (error == ENOENT) {
+ if ((XNF_TX_DESC - (prod - sc->sc_tx_cons)) <
+ sc->sc_tx_frags) {
/* transient */
- ifq_deq_rollback(&ifp->if_snd, m);
ifq_set_oactive(&ifp->if_snd);
break;
- } else if (error) {
+ }
+ m = ifq_dequeue(&ifp->if_snd);
+ if (m == NULL)
+ break;
+
+ if (xnf_encap(sc, m, &prod)) {
/* the chain is too large */
ifp->if_oerrors++;
- ifq_deq_commit(&ifp->if_snd, m);
m_freem(m);
continue;
}
ifp->if_opackets++;
- ifq_deq_commit(&ifp->if_snd, m);
#if NBPFILTER > 0
if (ifp->if_bpf)
@@ -534,8 +532,6 @@ xnf_encap(struct xnf_softc *sc, struct mbuf *m_head, uint32_t *prod)
uint32_t oprod = *prod;
int i, id, flags, n = 0;
- if ((XNF_TX_DESC - (*prod - sc->sc_tx_cons)) < sc->sc_tx_frags)
- return (ENOENT);
n = chainlen(m_head);
if (n > sc->sc_tx_frags && m_defrag(m_head, M_DONTWAIT))
goto errout;
diff --git a/sys/kern/kern_pledge.c b/sys/kern/kern_pledge.c
index 6411cb6d992..7bbee024104 100644
--- a/sys/kern/kern_pledge.c
+++ b/sys/kern/kern_pledge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_pledge.c,v 1.178 2016/07/12 06:06:34 deraadt Exp $ */
+/* $OpenBSD: kern_pledge.c,v 1.179 2016/07/28 12:08:14 mikeb Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -382,7 +382,7 @@ static const struct {
{ "rpath", PLEDGE_RPATH },
{ "sendfd", PLEDGE_SENDFD },
{ "settime", PLEDGE_SETTIME },
- { "stdio", PLEDGE_STDIO },
+ { "stdio", PLEDGE_STDIO|PLEDGE_RECVFD },
{ "tmppath", PLEDGE_TMPPATH },
{ "tty", PLEDGE_TTY },
{ "unix", PLEDGE_UNIX },