diff options
author | 2019-06-07 06:47:41 +0000 | |
---|---|---|
committer | 2019-06-07 06:47:41 +0000 | |
commit | 19467c1d4c9eb498a32c99dce05db3b7f31ef0d7 (patch) | |
tree | 8cba969956da8a0094b95ab0a3855c9cd422e39e | |
parent | tidy up the formatting of gendsa synopsis a little; (diff) | |
download | wireguard-openbsd-19467c1d4c9eb498a32c99dce05db3b7f31ef0d7.tar.xz wireguard-openbsd-19467c1d4c9eb498a32c99dce05db3b7f31ef0d7.zip |
have mcx_process_rx return the number of slots it made free
this is instead of passing a pointer to the counter.
while here use byte swapping loads and stores, which is mostly a
nop cos i dont think we have an LE arch with swapping memory
operations.
ok jmatthew@
-rw-r--r-- | sys/dev/pci/if_mcx.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c index 3ddbd2b72ee..8dfe00a2a9c 100644 --- a/sys/dev/pci/if_mcx.c +++ b/sys/dev/pci/if_mcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mcx.c,v 1.19 2019/06/06 03:17:49 jmatthew Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.20 2019/06/07 06:47:41 dlg Exp $ */ /* * Copyright (c) 2017 David Gwynne <dlg@openbsd.org> @@ -2035,8 +2035,8 @@ static void mcx_cmdq_dump(const struct mcx_cmdq_entry *); static void mcx_cmdq_mbox_dump(struct mcx_dmamem *, int); */ static void mcx_refill(void *); -static void mcx_process_rx(struct mcx_softc *, struct mcx_cq_entry *, - struct mbuf_list *, int *); +static int mcx_process_rx(struct mcx_softc *, struct mcx_cq_entry *, + struct mbuf_list *); static void mcx_process_txeof(struct mcx_softc *, struct mcx_cq_entry *, int *); static void mcx_process_cq(struct mcx_softc *, struct mcx_cq *); @@ -5554,9 +5554,9 @@ mcx_process_txeof(struct mcx_softc *sc, struct mcx_cq_entry *cqe, int *txfree) ms->ms_m = NULL; } -void +static int mcx_process_rx(struct mcx_softc *sc, struct mcx_cq_entry *cqe, - struct mbuf_list *ml, int *slots) + struct mbuf_list *ml) { struct mcx_slot *ms; struct mbuf *m; @@ -5571,10 +5571,12 @@ mcx_process_rx(struct mcx_softc *sc, struct mcx_cq_entry *cqe, m = ms->ms_m; ms->ms_m = NULL; - m->m_pkthdr.len = m->m_len = betoh32(cqe->cq_byte_cnt); - (*slots)++; + + m->m_pkthdr.len = m->m_len = bemtoh32(&cqe->cq_byte_cnt); ml_enqueue(ml, m); + + return (1); } static struct mcx_cq_entry * @@ -5636,7 +5638,7 @@ mcx_process_cq(struct mcx_softc *sc, struct mcx_cq *cq) mcx_process_txeof(sc, cqe, &txfree); break; case MCX_CQ_ENTRY_OPCODE_SEND: - mcx_process_rx(sc, cqe, &ml, &rxfree); + rxfree += mcx_process_rx(sc, cqe, &ml); break; case MCX_CQ_ENTRY_OPCODE_REQ_ERR: case MCX_CQ_ENTRY_OPCODE_SEND_ERR: |