summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2020-06-22 02:31:34 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2020-06-22 02:31:34 +0000
commitd706f6e60da883d9f53673ab80472054084a6874 (patch)
tree4ad2c1df68c3b1e0c7955aedce2af05fed7d8017 /sys/dev/pci
parentb0eb8a595f64a2929cf0dd38d15f81641f0f5517 (diff)
use ifiq_input and use it's return value to apply backpressure to rxrs.
this is a step toward deprecating softclock based livelock detection.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_bge.c11
-rw-r--r--sys/dev/pci/if_bnx.c7
-rw-r--r--sys/dev/pci/if_bnxt.c9
-rw-r--r--sys/dev/pci/if_bwfm_pci.c6
-rw-r--r--sys/dev/pci/if_em.c5
-rw-r--r--sys/dev/pci/if_nep.c5
-rw-r--r--sys/dev/pci/if_oce.c5
-rw-r--r--sys/dev/pci/if_sis.c5
-rw-r--r--sys/dev/pci/if_sk.c6
-rw-r--r--sys/dev/pci/if_vic.c6
-rw-r--r--sys/dev/pci/if_vr.c7
11 files changed, 46 insertions, 26 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 7e6c9c5467e..75506f2fdb3 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.389 2020/06/18 17:13:31 kettenis Exp $ */
+/* $OpenBSD: if_bge.c,v 1.390 2020/06/22 02:31:32 dlg Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -3462,6 +3462,7 @@ bge_rxeof(struct bge_softc *sc)
bus_addr_t offset, toff;
bus_size_t tlen;
int tosync;
+ int livelocked;
rx_cons = sc->bge_rx_saved_considx;
rx_prod = sc->bge_rdata->bge_status_block.bge_idx[0].bge_rx_prod_idx;
@@ -3564,16 +3565,20 @@ bge_rxeof(struct bge_softc *sc)
sc->bge_rx_saved_considx = rx_cons;
bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx);
+
+ livelocked = ifiq_input(&ifp->if_rcv, &ml);
if (stdcnt) {
if_rxr_put(&sc->bge_std_ring, stdcnt);
+ if (livelocked)
+ if_rxr_livelocked(&sc->bge_std_ring);
bge_fill_rx_ring_std(sc);
}
if (jumbocnt) {
if_rxr_put(&sc->bge_jumbo_ring, jumbocnt);
+ if (livelocked)
+ if_rxr_livelocked(&sc->bge_jumbo_ring);
bge_fill_rx_ring_jumbo(sc);
}
-
- if_input(ifp, &ml);
}
void
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index 19de2b461d8..a672f14cd1b 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.127 2020/05/17 08:27:51 jsg Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.128 2020/06/22 02:31:32 dlg Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -4467,6 +4467,9 @@ bnx_rx_int_next_rx:
BUS_SPACE_BARRIER_READ);
}
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&sc->rx_ring);
+
/* No new packets to process. Refill the RX chain and exit. */
sc->rx_cons = sw_cons;
if (!bnx_fill_rx_chain(sc))
@@ -4478,8 +4481,6 @@ bnx_rx_int_next_rx:
sc->rx_bd_chain_map[i]->dm_mapsize,
BUS_DMASYNC_PREWRITE);
- if_input(ifp, &ml);
-
DBPRINT(sc, BNX_INFO_RECV, "%s(exit): rx_prod = 0x%04X, "
"rx_cons = 0x%04X, rx_prod_bseq = 0x%08X\n",
__FUNCTION__, sc->rx_prod, sc->rx_cons, sc->rx_prod_bseq);
diff --git a/sys/dev/pci/if_bnxt.c b/sys/dev/pci/if_bnxt.c
index e21cddd8bc0..934b125ca3f 100644
--- a/sys/dev/pci/if_bnxt.c
+++ b/sys/dev/pci/if_bnxt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnxt.c,v 1.24 2020/06/09 07:03:12 jmatthew Exp $ */
+/* $OpenBSD: if_bnxt.c,v 1.25 2020/06/22 02:31:32 dlg Exp $ */
/*-
* Broadcom NetXtreme-C/E network driver.
*
@@ -1345,12 +1345,15 @@ bnxt_intr(void *xsc)
if_rxr_put(&sc->sc_rxr[0], rxfree);
if_rxr_put(&sc->sc_rxr[1], agfree);
+ if (ifiq_input(&sc->sc_ac.ac_if.if_rcv, &ml)) {
+ if_rxr_livelocked(&sc->sc_rxr[0]);
+ if_rxr_livelocked(&sc->sc_rxr[1]);
+ }
+
bnxt_rx_fill(sc);
if ((sc->sc_rx_cons == sc->sc_rx_prod) ||
(sc->sc_rx_ag_cons == sc->sc_rx_ag_prod))
timeout_add(&sc->sc_rx_refill, 0);
-
- if_input(&sc->sc_ac.ac_if, &ml);
}
if (txfree != 0) {
if (ifq_is_oactive(&ifp->if_snd))
diff --git a/sys/dev/pci/if_bwfm_pci.c b/sys/dev/pci/if_bwfm_pci.c
index 53b802680fc..b930011656c 100644
--- a/sys/dev/pci/if_bwfm_pci.c
+++ b/sys/dev/pci/if_bwfm_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bwfm_pci.c,v 1.36 2020/03/07 09:56:46 patrick Exp $ */
+/* $OpenBSD: if_bwfm_pci.c,v 1.37 2020/06/22 02:31:32 dlg Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
@@ -1914,7 +1914,9 @@ bwfm_pci_intr(void *v)
bwfm_pci_ring_rx(sc, &sc->sc_rx_complete, &ml);
bwfm_pci_ring_rx(sc, &sc->sc_tx_complete, &ml);
bwfm_pci_ring_rx(sc, &sc->sc_ctrl_complete, &ml);
- if_input(ifp, &ml);
+
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&sc->sc_rxbuf_ring);
}
#ifdef BWFM_DEBUG
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index d7b34e4b4a2..640d12b9daf 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em.c,v 1.353 2020/06/09 07:36:10 mpi Exp $ */
+/* $OpenBSD: if_em.c,v 1.354 2020/06/22 02:31:32 dlg Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -3008,7 +3008,8 @@ em_rxeof(struct em_queue *que)
que->rx.sc_rx_desc_tail = i;
- if_input(ifp, &ml);
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&que->rx.sc_rx_ring);
return (rv);
}
diff --git a/sys/dev/pci/if_nep.c b/sys/dev/pci/if_nep.c
index 2705b9a3db0..72a6e3e328b 100644
--- a/sys/dev/pci/if_nep.c
+++ b/sys/dev/pci/if_nep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nep.c,v 1.31 2018/11/09 14:14:31 claudio Exp $ */
+/* $OpenBSD: if_nep.c,v 1.32 2020/06/22 02:31:32 dlg Exp $ */
/*
* Copyright (c) 2014, 2015 Mark Kettenis
*
@@ -1049,7 +1049,8 @@ nep_rx_proc(struct nep_softc *sc)
bus_dmamap_sync(sc->sc_dmat, NEP_DMA_MAP(sc->sc_rcring), 0,
NEP_DMA_LEN(sc->sc_rcring), BUS_DMASYNC_PREREAD);
- if_input(ifp, &ml);
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&sc->sc_rx_ring);
nep_fill_rx_ring(sc);
diff --git a/sys/dev/pci/if_oce.c b/sys/dev/pci/if_oce.c
index 55da2fff1f2..a840370d85a 100644
--- a/sys/dev/pci/if_oce.c
+++ b/sys/dev/pci/if_oce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_oce.c,v 1.100 2017/11/27 16:53:04 sthen Exp $ */
+/* $OpenBSD: if_oce.c,v 1.101 2020/06/22 02:31:32 dlg Exp $ */
/*
* Copyright (c) 2012 Mike Belopuhov
@@ -1639,7 +1639,8 @@ oce_rxeof(struct oce_rq *rq, struct oce_nic_rx_cqe *cqe)
ml_enqueue(&ml, m);
}
exit:
- if_input(ifp, &ml);
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&rq->rxring);
}
void
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index d4ec85a7ed5..8860671c66a 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.135 2017/01/22 10:17:38 dlg Exp $ */
+/* $OpenBSD: if_sis.c,v 1.136 2020/06/22 02:31:32 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -1447,7 +1447,8 @@ sis_rxeof(struct sis_softc *sc)
ml_enqueue(&ml, m);
}
- if_input(ifp, &ml);
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&sc->sis_cdata.sis_rx_ring);
sis_fill_rx_ring(sc);
}
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c
index 6c32629a155..94507976ba5 100644
--- a/sys/dev/pci/if_sk.c
+++ b/sys/dev/pci/if_sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sk.c,v 1.189 2017/06/04 04:29:23 dlg Exp $ */
+/* $OpenBSD: if_sk.c,v 1.190 2020/06/22 02:31:33 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -1637,9 +1637,11 @@ sk_rxeof(struct sk_if_softc *sc_if)
}
sc_if->sk_cdata.sk_rx_cons = cur;
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(rxr);
+
sk_fill_rx_ring(sc_if);
- if_input(ifp, &ml);
}
void
diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c
index 3ac4e47a49a..1b007a49512 100644
--- a/sys/dev/pci/if_vic.c
+++ b/sys/dev/pci/if_vic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vic.c,v 1.99 2019/11/09 03:53:44 yasuoka Exp $ */
+/* $OpenBSD: if_vic.c,v 1.100 2020/06/22 02:31:33 dlg Exp $ */
/*
* Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org>
@@ -867,7 +867,9 @@ vic_rx_proc(struct vic_softc *sc, int q)
VIC_INC(sc->sc_data->vd_rx[q].nextidx, sc->sc_nrxbuf);
}
- if_input(ifp, &ml);
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&sc->sc_rxq[q].ring);
+
vic_rx_fill(sc, q);
bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_map, 0, sc->sc_dma_size,
diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c
index b61c0130a83..81a0f7ca2b4 100644
--- a/sys/dev/pci/if_vr.c
+++ b/sys/dev/pci/if_vr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vr.c,v 1.153 2017/01/22 10:17:38 dlg Exp $ */
+/* $OpenBSD: if_vr.c,v 1.154 2020/06/22 02:31:33 dlg Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -933,13 +933,14 @@ vr_rxeof(struct vr_softc *sc)
ml_enqueue(&ml, m);
}
+ if (ifiq_input(&ifp->if_rcv, &ml))
+ if_rxr_livelocked(&sc->sc_rxring);
+
vr_fill_rx_ring(sc);
bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap.vrm_map,
0, sc->sc_listmap.vrm_map->dm_mapsize,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-
- if_input(ifp, &ml);
}
void