-/* $OpenBSD: qwx.c,v 1.48 2024/02/20 11:48:19 stsp Exp $ */
+/* $OpenBSD: qwx.c,v 1.49 2024/02/22 09:06:11 stsp Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
bus_dmamap_destroy(dmat, adm->map);
free(adm, M_DEVBUF, sizeof(*adm));
}
+
+int
+qwx_activate(struct device *self, int act)
+{
+ struct qwx_softc *sc = (struct qwx_softc *)self;
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
+ int err = 0;
+
+ switch (act) {
+ case DVACT_QUIESCE:
+ if (ifp->if_flags & IFF_RUNNING) {
+ rw_enter_write(&sc->ioctl_rwl);
+ qwx_stop(ifp);
+ rw_exit(&sc->ioctl_rwl);
+ }
+ break;
+ case DVACT_RESUME:
+ break;
+ case DVACT_WAKEUP:
+ if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == IFF_UP) {
+ err = qwx_init(ifp);
+ if (err)
+ printf("%s: could not initialize hardware\n",
+ sc->sc_dev.dv_xname);
+ }
+ break;
+ }
+
+ return 0;
+}
-/* $OpenBSD: qwxvar.h,v 1.20 2024/02/16 14:13:45 stsp Exp $ */
+/* $OpenBSD: qwxvar.h,v 1.21 2024/02/22 09:06:11 stsp Exp $ */
/*
* Copyright (c) 2018-2019 The Linux Foundation.
int qwx_init_hw_params(struct qwx_softc *);
int qwx_attach(struct qwx_softc *);
void qwx_detach(struct qwx_softc *);
+int qwx_activate(struct device *, int);
void qwx_core_deinit(struct qwx_softc *);
void qwx_ce_cleanup_pipes(struct qwx_softc *);
-/* $OpenBSD: if_qwx_pci.c,v 1.10 2024/02/16 16:37:42 stsp Exp $ */
+/* $OpenBSD: if_qwx_pci.c,v 1.11 2024/02/22 09:06:11 stsp Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
void qwx_pci_attach(struct device *, struct device *, void *);
int qwx_pci_detach(struct device *, int);
void qwx_pci_attach_hook(struct device *);
-int qwx_pci_activate(struct device *, int);
void qwx_pci_free_xfer_rings(struct qwx_pci_softc *);
int qwx_pci_alloc_xfer_ring(struct qwx_softc *, struct qwx_pci_xfer_ring *,
uint32_t, uint32_t, uint32_t, size_t);
qwx_pci_match,
qwx_pci_attach,
qwx_pci_detach,
- qwx_pci_activate
+ qwx_activate
};
/* XXX pcidev */
splx(s);
}
-int
-qwx_pci_activate(struct device *self, int act)
-{
- switch (act) {
- case DVACT_SUSPEND:
- break;
- case DVACT_WAKEUP:
- break;
- }
-
- return 0;
-}
-
void
qwx_pci_free_xfer_rings(struct qwx_pci_softc *psc)
{