Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Start to switch from OpenBSD timeout(9) API to c...
details: https://anonhg.NetBSD.org/src/rev/00a00dff1424
branches: trunk
changeset: 1006375:00a00dff1424
user: sevan <sevan%NetBSD.org@localhost>
date: Sun Jan 12 23:22:12 2020 +0000
description:
Start to switch from OpenBSD timeout(9) API to callout(9) and workqueue(9)
Replace functions with NetBSD counterparts.
diffstat:
sys/dev/pci/if_rge.c | 32 ++++++++++++++++++++------------
sys/dev/pci/if_rgereg.h | 4 ++--
2 files changed, 22 insertions(+), 14 deletions(-)
diffs (125 lines):
diff -r db23407c7f03 -r 00a00dff1424 sys/dev/pci/if_rge.c
--- a/sys/dev/pci/if_rge.c Sun Jan 12 22:03:22 2020 +0000
+++ b/sys/dev/pci/if_rge.c Sun Jan 12 23:22:12 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rge.c,v 1.2 2020/01/11 21:05:45 sevan Exp $ */
+/* $NetBSD: if_rge.c,v 1.3 2020/01/12 23:22:12 sevan Exp $ */
/* $OpenBSD: if_rge.c,v 1.2 2020/01/02 09:00:45 kevlo Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.2 2020/01/11 21:05:45 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.3 2020/01/12 23:22:12 sevan Exp $");
/* #include "bpfilter.h" Sevan */
/* #include "vlan.h" Sevan */
@@ -34,6 +34,8 @@
#include <sys/socket.h>
#include <sys/device.h>
#include <sys/endian.h>
+#include <sys/callout.h>
+#include <sys/workqueue.h>
#include <net/if.h>
@@ -69,6 +71,12 @@
struct mbuf *ml_tail;
u_int ml_len;
};
+#ifdef NET_MPSAFE
+#define RGE_MPSAFE 1
+#define CALLOUT_FLAGS CALLOUT_MPSAFE
+#else
+#define CALLOUT_FLAGS 0
+#endif
#endif
static int rge_match(device_t, cfdata_t, void *);
@@ -113,7 +121,7 @@
void rge_write_phy_ocp(struct rge_softc *, uint16_t, uint16_t);
uint16_t rge_read_phy_ocp(struct rge_softc *, uint16_t);
int rge_get_link_status(struct rge_softc *);
-void rge_txstart(void *);
+void rge_txstart(struct work *, void *);
void rge_tick(void *);
void rge_link_state(struct rge_softc *);
@@ -284,8 +292,9 @@
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
#endif
- timeout_set(&sc->sc_timeout, rge_tick, sc);
- task_set(&sc->sc_task, rge_txstart, sc);
+ callout_init(&sc->sc_timeout, CALLOUT_FLAGS);
+ callout_setfunc(&sc->sc_timeout, rge_tick, sc);
+ rge_txstart(&sc->sc_task, sc);
/* Initialize ifmedia structures. */
ifmedia_init(&sc->sc_media, IFM_IMASK, rge_ifmedia_upd,
@@ -521,9 +530,8 @@
}
void
-rge_start(struct ifnet *ifq)
+rge_start(struct ifnet *ifp)
{
- struct ifnet *ifp = ifq->ifq_if;
struct rge_softc *sc = ifp->if_softc;
struct mbuf *m;
int free, idx, used;
@@ -546,11 +554,11 @@
for (;;) {
if (RGE_TX_NSEGS >= free + 2) {
- ifq_set_oactive(&ifp->if_snd);
+ SET(ifp->if_flags, IFF_OACTIVE);
break;
}
- m = ifq_dequeue(ifq);
+ IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == NULL)
break;
@@ -763,9 +771,9 @@
rge_setup_intr(sc, RGE_IMTYPE_SIM);
ifp->if_flags |= IFF_RUNNING;
- ifq_clr_oactive(&ifp->if_snd);
+ CLR(ifp->if_flags, IFF_OACTIVE);
- timeout_add_sec(&sc->sc_timeout, 1);
+ callout_schedule(&sc->sc_timeout, 1);
return (0);
}
@@ -2004,7 +2012,7 @@
}
void
-rge_txstart(void *arg)
+rge_txstart(struct work *wk, void *arg)
{
struct rge_softc *sc = arg;
diff -r db23407c7f03 -r 00a00dff1424 sys/dev/pci/if_rgereg.h
--- a/sys/dev/pci/if_rgereg.h Sun Jan 12 22:03:22 2020 +0000
+++ b/sys/dev/pci/if_rgereg.h Sun Jan 12 23:22:12 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rgereg.h,v 1.2 2020/01/11 21:05:45 sevan Exp $ */
+/* $NetBSD: if_rgereg.h,v 1.3 2020/01/12 23:22:12 sevan Exp $ */
/* $OpenBSD: if_rgereg.h,v 1.1 2019/11/18 03:03:37 kevlo Exp $ */
/*
@@ -291,7 +291,7 @@
struct rge_list_data rge_ldata;
-/* struct task sc_task; Sevan */
+ struct work sc_task;
callout_t sc_timeout; /* tick timeout */
Home |
Main Index |
Thread Index |
Old Index