Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/pci Pull up the following revisions, requested by...
details: https://anonhg.NetBSD.org/src/rev/9c1fb0bc2f1c
branches: netbsd-8
changeset: 373191:9c1fb0bc2f1c
user: martin <martin%NetBSD.org@localhost>
date: Mon Jan 23 14:01:25 2023 +0000
description:
Pull up the following revisions, requested by msaitoh in ticket #1795:
sys/dev/pci/if_wm.c 1.764-1.767 via patch
sys/dev/pci/if_wmreg.h 1.128
- Workaround for some hypervisor environments. The environments
cannot stop e1000 interrupt immediately.
- Rename nq_txdesc' member "nqrx_ctx" to "nqtx_ctx". No functional
change.
- Add comment. Modify comment.
- KNF.
diffstat:
sys/dev/pci/if_wm.c | 111 +++++++++++++++++++++++++++---------------------
sys/dev/pci/if_wmreg.h | 4 +-
2 files changed, 65 insertions(+), 50 deletions(-)
diffs (truncated from 367 to 300 lines):
diff -r 53d9182c168a -r 9c1fb0bc2f1c sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Mon Jan 23 13:36:04 2023 +0000
+++ b/sys/dev/pci/if_wm.c Mon Jan 23 14:01:25 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.508.4.47 2022/09/08 10:29:36 martin Exp $ */
+/* $NetBSD: if_wm.c,v 1.508.4.48 2023/01/23 14:01:25 martin Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.47 2022/09/08 10:29:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.48 2023/01/23 14:01:25 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -487,6 +487,7 @@
char sysctlname[32]; /* Name for sysctl */
bool wmq_txrx_use_workqueue;
+ bool wmq_wq_enqueued;
struct work wmq_cookie;
void *wmq_si;
krndsource_t rnd_source; /* random source */
@@ -2263,7 +2264,7 @@
aprint_error_dev(sc->sc_dev,
"unable to find PCIX capability\n");
else if (sc->sc_type != WM_T_82545_3 &&
- sc->sc_type != WM_T_82546_3) {
+ sc->sc_type != WM_T_82546_3) {
/*
* Work around a problem caused by the BIOS
* setting the max memory read byte count
@@ -3633,7 +3634,7 @@
ifp->if_oerrors++;
#ifdef WM_DEBUG
for (i = txq->txq_sdirty; i != txq->txq_snext;
- i = WM_NEXTTXS(txq, i)) {
+ i = WM_NEXTTXS(txq, i)) {
txs = &txq->txq_soft[i];
printf("txs %d tx %d -> %d\n",
i, txs->txs_firstdesc, txs->txs_lastdesc);
@@ -3794,9 +3795,9 @@
crcerrs + algnerrc + symerrc + rxerrc + sec + cexterr + rlec;
/*
- * WMREG_RNBC is incremented when there are no available buffers in host
- * memory. It does not mean the number of dropped packets, because an
- * Ethernet controller can receive packets in such case if there is
+ * WMREG_RNBC is incremented when there are no available buffers in
+ * host memory. It does not mean the number of dropped packets, because
+ * an Ethernet controller can receive packets in such case if there is
* space in the phy's FIFO.
*
* If you want to know the nubmer of WMREG_RMBC, you should use such as
@@ -4093,7 +4094,7 @@
return 0;
- bad:
+bad:
return -1;
}
@@ -4378,11 +4379,11 @@
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
- allmulti:
+allmulti:
ifp->if_flags |= IFF_ALLMULTI;
sc->sc_rctl |= RCTL_MPE;
- setit:
+setit:
CSR_WRITE(sc, WMREG_RCTL, sc->sc_rctl);
}
@@ -4750,7 +4751,8 @@
* LCD Write Enable bits are set in the NVM. When both NVM bits
* are cleared, SW will configure them instead.
*/
- DPRINTF(sc, WM_DEBUG_INIT, ("%s: %s: Configure SMBus and LED\n",
+ DPRINTF(sc, WM_DEBUG_INIT,
+ ("%s: %s: Configure SMBus and LED\n",
device_xname(sc->sc_dev), __func__));
wm_write_smbus_addr(sc);
@@ -5056,15 +5058,15 @@
CSR_WRITE(sc, WMREG_TARC0, tarc0);
switch (sc->sc_type) {
- /*
- * 8257[12] Errata No.52, 82573 Errata No.43 and some others.
- * Avoid RSS Hash Value bug.
- */
case WM_T_82571:
case WM_T_82572:
case WM_T_82573:
case WM_T_80003:
case WM_T_ICH8:
+ /*
+ * 8257[12] Errata No.52, 82573 Errata No.43 and some
+ * others to avoid RSS Hash Value bug.
+ */
reg = CSR_READ(sc, WMREG_RFCTL);
reg |= WMREG_RFCTL_NEWIPV6EXDIS |WMREG_RFCTL_IPV6EXDIS;
CSR_WRITE(sc, WMREG_RFCTL, reg);
@@ -5468,6 +5470,11 @@
CSR_WRITE(sc, WMREG_CTRL, reg);
/* Don't insert a completion barrier when reset */
delay(20*1000);
+ /*
+ * The EXTCNFCTR_MDIO_SW_OWNERSHIP bit is cleared by the reset,
+ * so don't use sc->phy.release(sc). Release sc_ich_phymtx
+ * only. See also wm_get_swflag_ich8lan().
+ */
mutex_exit(sc->sc_ich_phymtx);
break;
case WM_T_82580:
@@ -6091,7 +6098,7 @@
kcpuset_destroy(affinity);
return 0;
- fail:
+fail:
for (qidx = 0; qidx < txrx_established; qidx++) {
struct wm_queue *wmq = &sc->sc_queue[qidx];
pci_intr_disestablish(sc->sc_pc,sc->sc_ihs[wmq->wmq_intr_idx]);
@@ -6168,7 +6175,8 @@
* So, overwrite counter field by software.
*/
if (sc->sc_type == WM_T_82575)
- eitr |= __SHIFTIN(wmq->wmq_itr, EITR_COUNTER_MASK_82575);
+ eitr |= __SHIFTIN(wmq->wmq_itr,
+ EITR_COUNTER_MASK_82575);
else
eitr |= EITR_CNT_INGR;
@@ -6269,7 +6277,8 @@
goto err;
rv = sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
- CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"),
+ CTLTYPE_BOOL, "txrx_workqueue",
+ SYSCTL_DESCR("Use workqueue for packet processing"),
NULL, 0, &sc->sc_txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL);
if (rv != 0)
goto teardown;
@@ -6971,7 +6980,7 @@
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
- out:
+out:
sc->sc_if_flags = ifp->if_flags;
if (error)
log(LOG_ERR, "%s: interface not running\n",
@@ -7198,7 +7207,7 @@
return 1;
}
- send_packet:
+send_packet:
txq->txq_fifo_head += len;
if (txq->txq_fifo_head >= txq->txq_fifo_size)
txq->txq_fifo_head -= txq->txq_fifo_size;
@@ -7263,14 +7272,14 @@
return 0;
- fail_3:
+fail_3:
bus_dmamap_destroy(sc->sc_dmat, txq->txq_desc_dmamap);
- fail_2:
+fail_2:
bus_dmamem_unmap(sc->sc_dmat, (void *)txq->txq_descs_u,
WM_TXDESCS_SIZE(txq));
- fail_1:
+fail_1:
bus_dmamem_free(sc->sc_dmat, &txq->txq_desc_seg, txq->txq_desc_rseg);
- fail_0:
+fail_0:
return error;
}
@@ -7388,7 +7397,7 @@
return 0;
- fail:
+fail:
for (i = 0; i < WM_TXQUEUELEN(txq); i++) {
if (txq->txq_soft[i].txs_dmamap != NULL)
bus_dmamap_destroy(sc->sc_dmat,
@@ -7579,7 +7588,7 @@
return 0;
- fail_2:
+fail_2:
for (i = 0; i < rx_done; i++) {
struct wm_rxqueue *rxq = &sc->sc_queue[i].wmq_rxq;
wm_free_rx_buffer(sc, rxq);
@@ -7587,7 +7596,7 @@
if (rxq->rxq_lock)
mutex_obj_free(rxq->rxq_lock);
}
- fail_1:
+fail_1:
for (i = 0; i < tx_done; i++) {
struct wm_txqueue *txq = &sc->sc_queue[i].wmq_txq;
pcq_destroy(txq->txq_interq);
@@ -7599,7 +7608,7 @@
kmem_free(sc->sc_queue,
sizeof(struct wm_queue) * sc->sc_nqueues);
- fail_0:
+fail_0:
return error;
}
@@ -8806,12 +8815,12 @@
* however it does not cause problems.
*/
/* Fill in the context descriptor. */
- txq->txq_nq_descs[txq->txq_next].nqrx_ctx.nqtxc_vl_len =
+ txq->txq_nq_descs[txq->txq_next].nqtx_ctx.nqtxc_vl_len =
htole32(vl_len);
- txq->txq_nq_descs[txq->txq_next].nqrx_ctx.nqtxc_sn = 0;
- txq->txq_nq_descs[txq->txq_next].nqrx_ctx.nqtxc_cmd =
+ txq->txq_nq_descs[txq->txq_next].nqtx_ctx.nqtxc_sn = 0;
+ txq->txq_nq_descs[txq->txq_next].nqtx_ctx.nqtxc_cmd =
htole32(cmdc);
- txq->txq_nq_descs[txq->txq_next].nqrx_ctx.nqtxc_mssidx =
+ txq->txq_nq_descs[txq->txq_next].nqtx_ctx.nqtxc_mssidx =
htole32(mssidx);
wm_cdtxsync(txq, txq->txq_next, 1, BUS_DMASYNC_PREWRITE);
DPRINTF(sc, WM_DEBUG_TX,
@@ -8974,7 +8983,7 @@
DPRINTF(sc, WM_DEBUG_TX,
("%s: TX: have packet to transmit: %p\n",
- device_xname(sc->sc_dev), m0));
+ device_xname(sc->sc_dev), m0));
txs = &txq->txq_soft[txq->txq_snext];
dmamap = txs->txs_dmamap;
@@ -10075,9 +10084,13 @@
wm_sched_handle_queue(struct wm_softc *sc, struct wm_queue *wmq)
{
- if (wmq->wmq_txrx_use_workqueue)
- workqueue_enqueue(sc->sc_queue_wq, &wmq->wmq_cookie, curcpu());
- else
+ if (wmq->wmq_txrx_use_workqueue) {
+ if (!wmq->wmq_wq_enqueued) {
+ wmq->wmq_wq_enqueued = true;
+ workqueue_enqueue(sc->sc_queue_wq, &wmq->wmq_cookie,
+ curcpu());
+ }
+ } else
softint_schedule(wmq->wmq_si);
}
@@ -10376,8 +10389,10 @@
struct wm_queue *wmq = container_of(wk, struct wm_queue, wmq_cookie);
/*
- * "enqueued flag" is not required here.
- */
+ * Some qemu environment workaround. They don't stop interrupt
+ * immediately.
+ */
+ wmq->wmq_wq_enqueued = false;
wm_handle_queue(wmq);
}
@@ -11824,7 +11839,7 @@
*/
static int
wm_access_phy_wakeup_reg_bm(device_t dev, int offset, int16_t *val, int rd,
- bool page_set)
+ bool page_set)
{
struct wm_softc *sc = device_private(dev);
uint16_t regnum = BM_PHY_REG_NUM(offset);
@@ -12191,8 +12206,8 @@
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
CSR_WRITE(sc, WMREG_TCTL, sc->sc_tctl);
- CSR_WRITE(sc, (sc->sc_type < WM_T_82543) ? WMREG_OLD_FCRTL
- : WMREG_FCRTL, sc->sc_fcrtl);
+ CSR_WRITE(sc, (sc->sc_type < WM_T_82543) ?
+ WMREG_OLD_FCRTL : WMREG_FCRTL, sc->sc_fcrtl);
if (sc->sc_type == WM_T_80003) {
switch (IFM_SUBTYPE(mii->mii_media_active)) {
case IFM_1000_T:
Home |
Main Index |
Thread Index |
Old Index