sync with OpenBSD -current

This commit is contained in:
purplerain 2024-10-05 01:49:01 +00:00
parent 074e641852
commit 8d26df7b18
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
19 changed files with 436 additions and 412 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_ix.c,v 1.217 2024/09/04 07:54:52 mglocker Exp $ */
/* $OpenBSD: if_ix.c,v 1.218 2024/10/04 05:22:10 yasuoka Exp $ */
/******************************************************************************
@ -508,8 +508,7 @@ ixgbe_start(struct ifqueue *ifq)
* hardware that this frame is available to transmit.
*/
if (post)
IXGBE_WRITE_REG(&sc->hw, IXGBE_TDT(txr->me),
txr->next_avail_desc);
IXGBE_WRITE_REG(&sc->hw, txr->tail, txr->next_avail_desc);
}
/*********************************************************************
@ -706,7 +705,7 @@ ixgbe_watchdog(struct ifnet * ifp)
for (i = 0; i < sc->num_queues; i++, txr++) {
printf("%s: Queue(%d) tdh = %d, hw tdt = %d\n", ifp->if_xname, i,
IXGBE_READ_REG(hw, IXGBE_TDH(i)),
IXGBE_READ_REG(hw, IXGBE_TDT(i)));
IXGBE_READ_REG(hw, sc->tx_rings[i].tail));
printf("%s: TX(%d) Next TX to Clean = %d\n", ifp->if_xname,
i, txr->next_to_clean);
}
@ -826,7 +825,7 @@ ixgbe_init(void *arg)
msec_delay(1);
}
IXGBE_WRITE_FLUSH(&sc->hw);
IXGBE_WRITE_REG(&sc->hw, IXGBE_RDT(i), rxr->last_desc_filled);
IXGBE_WRITE_REG(&sc->hw, rxr[i].tail, rxr->last_desc_filled);
}
/* Set up VLAN support and filter */
@ -2365,9 +2364,12 @@ ixgbe_initialize_transmit_units(struct ix_softc *sc)
IXGBE_WRITE_REG(hw, IXGBE_TDLEN(i),
sc->num_tx_desc * sizeof(struct ixgbe_legacy_tx_desc));
/* Set Tx Tail register */
txr->tail = IXGBE_TDT(i);
/* Setup the HW Tx Head and Tail descriptor pointers */
IXGBE_WRITE_REG(hw, IXGBE_TDH(i), 0);
IXGBE_WRITE_REG(hw, IXGBE_TDT(i), 0);
IXGBE_WRITE_REG(hw, txr->tail, 0);
/* Setup Transmit Descriptor Cmd Settings */
txr->txd_cmd = IXGBE_TXD_CMD_IFCS;
@ -2844,8 +2846,7 @@ ixgbe_rxrefill(void *xrxr)
if (ixgbe_rxfill(rxr)) {
/* Advance the Rx Queue "Tail Pointer" */
IXGBE_WRITE_REG(&sc->hw, IXGBE_RDT(rxr->me),
rxr->last_desc_filled);
IXGBE_WRITE_REG(&sc->hw, rxr->tail, rxr->last_desc_filled);
} else if (if_rxr_inuse(&rxr->rx_ring) == 0)
timeout_add(&rxr->rx_refill, 1);
@ -2940,6 +2941,9 @@ ixgbe_initialize_receive_units(struct ix_softc *sc)
srrctl = bufsz | IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(i), srrctl);
/* Capture Rx Tail index */
rxr->tail = IXGBE_RDT(i);
if (ISSET(ifp->if_xflags, IFXF_LRO)) {
rdrxctl = IXGBE_READ_REG(&sc->hw, IXGBE_RSCCTL(i));
@ -2952,7 +2956,7 @@ ixgbe_initialize_receive_units(struct ix_softc *sc)
/* Setup the HW Rx Head and Tail Descriptor Pointers */
IXGBE_WRITE_REG(hw, IXGBE_RDH(i), 0);
IXGBE_WRITE_REG(hw, IXGBE_RDT(i), 0);
IXGBE_WRITE_REG(hw, rxr->tail, 0);
}
if (sc->hw.mac.type != ixgbe_mac_82598EB) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_ix.h,v 1.47 2024/05/21 11:19:39 bluhm Exp $ */
/* $OpenBSD: if_ix.h,v 1.48 2024/10/04 05:22:10 yasuoka Exp $ */
/******************************************************************************
@ -169,6 +169,7 @@ struct ix_txring {
struct ix_softc *sc;
struct ifqueue *ifq;
uint32_t me;
uint32_t tail;
uint32_t watchdog_timer;
union ixgbe_adv_tx_desc *tx_base;
struct ixgbe_tx_buf *tx_buffers;
@ -194,6 +195,7 @@ struct ix_rxring {
struct ix_softc *sc;
struct ifiqueue *ifiq;
uint32_t me;
uint32_t tail;
union ixgbe_adv_rx_desc *rx_base;
struct ixgbe_dma_alloc rxdma;
#if 0
@ -244,6 +246,7 @@ struct ix_softc {
uint16_t num_segs;
uint32_t link_speed;
bool link_up;
bool link_enabled;
uint32_t linkvec;
struct rwlock sfflock;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mcx.c,v 1.115 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: if_mcx.c,v 1.116 2024/10/04 06:37:22 jmatthew Exp $ */
/*
* Copyright (c) 2017 David Gwynne <dlg@openbsd.org>
@ -2927,23 +2927,25 @@ mcx_attach(struct device *parent, struct device *self, void *aux)
goto teardown;
}
printf(", %s, address %s\n", intrstr,
ether_sprintf(sc->sc_ac.ac_enaddr));
msix--; /* admin ops took one */
sc->sc_intrmap = intrmap_create(&sc->sc_dev, msix, MCX_MAX_QUEUES,
INTRMAP_POWEROF2);
if (sc->sc_intrmap == NULL) {
printf("%s: unable to create interrupt map\n", DEVNAME(sc));
printf(": unable to create interrupt map\n");
goto teardown;
}
sc->sc_queues = mallocarray(intrmap_count(sc->sc_intrmap),
sizeof(*sc->sc_queues), M_DEVBUF, M_WAITOK|M_ZERO);
if (sc->sc_queues == NULL) {
printf("%s: unable to create queues\n", DEVNAME(sc));
printf(": unable to create queues\n");
goto intrunmap;
}
printf(", %s, %d queue%s, address %s\n", intrstr,
intrmap_count(sc->sc_intrmap),
intrmap_count(sc->sc_intrmap) > 1 ? "s" : "",
ether_sprintf(sc->sc_ac.ac_enaddr));
strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_qwx_pci.c,v 1.22 2024/07/06 05:34:35 patrick Exp $ */
/* $OpenBSD: if_qwx_pci.c,v 1.23 2024/10/04 07:46:33 kevlo Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@ -374,11 +374,9 @@ struct qwx_pci_softc {
struct qwx_dmamem *cmd_ctxt;
struct qwx_pci_xfer_ring xfer_rings[4];
#define QWX_PCI_XFER_RING_LOOPBACK_OUTBOUND 0
#define QWX_PCI_XFER_RING_LOOPBACK_INBOUND 1
#define QWX_PCI_XFER_RING_IPCR_OUTBOUND 2
#define QWX_PCI_XFER_RING_IPCR_INBOUND 3
struct qwx_pci_xfer_ring xfer_rings[2];
#define QWX_PCI_XFER_RING_IPCR_OUTBOUND 0
#define QWX_PCI_XFER_RING_IPCR_INBOUND 1
struct qwx_pci_event_ring event_rings[QWX_NUM_EVENT_CTX];
struct qwx_pci_cmd_ring cmd_ring;
};
@ -745,7 +743,6 @@ qwx_pci_attach(struct device *parent, struct device *self, void *aux)
struct ieee80211com *ic = &sc->sc_ic;
struct ifnet *ifp = &ic->ic_if;
uint32_t soc_hw_version_major, soc_hw_version_minor;
const struct qwx_pci_ops *pci_ops;
struct pci_attach_args *pa = aux;
pci_intr_handle_t ih;
pcireg_t memtype, reg;
@ -884,6 +881,9 @@ qwx_pci_attach(struct device *parent, struct device *self, void *aux)
pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0);
/* register PCI ops */
psc->sc_pci_ops = &qwx_pci_ops_qca6390;
switch (PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_QUALCOMM_QCA6390:
qwx_pci_read_hw_version(sc, &soc_hw_version_major,
@ -898,11 +898,10 @@ qwx_pci_attach(struct device *parent, struct device *self, void *aux)
return;
}
pci_ops = &qwx_pci_ops_qca6390;
psc->max_chan = QWX_MHI_CONFIG_QCA6390_MAX_CHANNELS;
break;
case PCI_PRODUCT_QUALCOMM_QCN9074:
pci_ops = &qwx_pci_ops_qcn9074;
psc->sc_pci_ops = &qwx_pci_ops_qcn9074;
sc->sc_hw_rev = ATH11K_HW_QCN9074_HW10;
psc->max_chan = QWX_MHI_CONFIG_QCA9074_MAX_CHANNELS;
break;
@ -932,7 +931,6 @@ unsupported_wcn6855_soc:
return;
}
pci_ops = &qwx_pci_ops_qca6390;
psc->max_chan = QWX_MHI_CONFIG_QCA6390_MAX_CHANNELS;
break;
default:
@ -940,9 +938,6 @@ unsupported_wcn6855_soc:
return;
}
/* register PCI ops */
psc->sc_pci_ops = pci_ops;
error = qwx_pcic_init_msi_config(sc);
if (error)
goto err_pci_free_region;
@ -1296,18 +1291,6 @@ qwx_pci_alloc_xfer_rings_qca6390(struct qwx_pci_softc *psc)
struct qwx_softc *sc = &psc->sc_sc;
int ret;
ret = qwx_pci_alloc_xfer_ring(sc,
&psc->xfer_rings[QWX_PCI_XFER_RING_LOOPBACK_OUTBOUND],
0, MHI_CHAN_TYPE_OUTBOUND, 0, 32);
if (ret)
goto fail;
ret = qwx_pci_alloc_xfer_ring(sc,
&psc->xfer_rings[QWX_PCI_XFER_RING_LOOPBACK_INBOUND],
1, MHI_CHAN_TYPE_INBOUND, 0, 32);
if (ret)
goto fail;
ret = qwx_pci_alloc_xfer_ring(sc,
&psc->xfer_rings[QWX_PCI_XFER_RING_IPCR_OUTBOUND],
20, MHI_CHAN_TYPE_OUTBOUND, 1, 64);
@ -1332,18 +1315,6 @@ qwx_pci_alloc_xfer_rings_qcn9074(struct qwx_pci_softc *psc)
struct qwx_softc *sc = &psc->sc_sc;
int ret;
ret = qwx_pci_alloc_xfer_ring(sc,
&psc->xfer_rings[QWX_PCI_XFER_RING_LOOPBACK_OUTBOUND],
0, MHI_CHAN_TYPE_OUTBOUND, 1, 32);
if (ret)
goto fail;
ret = qwx_pci_alloc_xfer_ring(sc,
&psc->xfer_rings[QWX_PCI_XFER_RING_LOOPBACK_INBOUND],
1, MHI_CHAN_TYPE_INBOUND, 1, 32);
if (ret)
goto fail;
ret = qwx_pci_alloc_xfer_ring(sc,
&psc->xfer_rings[QWX_PCI_XFER_RING_IPCR_OUTBOUND],
20, MHI_CHAN_TYPE_OUTBOUND, 1, 32);