sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-28 00:32:54 +00:00
parent 0ed6f4de41
commit 4ee2459da1
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
16 changed files with 382 additions and 157 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pckbc.c,v 1.54 2023/07/25 10:00:44 miod Exp $ */
/* $OpenBSD: pckbc.c,v 1.55 2023/08/26 15:01:00 jmc Exp $ */
/* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */
/*
@ -459,7 +459,7 @@ pckbc_release_console(void)
* In that case, we want to release ourselves from console
* duties, unless we have been able to attach a mouse,
* which would mean this is a real PS/2 controller
* afterwards.
* after all.
*/
if (pckbc_console != 0) {
extern void wscn_input_init(int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_iwx.c,v 1.175 2023/07/05 15:07:28 stsp Exp $ */
/* $OpenBSD: if_iwx.c,v 1.176 2023/08/26 09:05:34 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@ -425,7 +425,7 @@ void iwx_scan_umac_dwell_v10(struct iwx_softc *,
void iwx_scan_umac_fill_general_p_v10(struct iwx_softc *,
struct iwx_scan_general_params_v10 *, uint16_t, int);
void iwx_scan_umac_fill_ch_p_v6(struct iwx_softc *,
struct iwx_scan_channel_params_v6 *, uint32_t, int, int);
struct iwx_scan_channel_params_v6 *, uint32_t, int);
int iwx_umac_scan_v14(struct iwx_softc *, int);
void iwx_mcc_update(struct iwx_softc *, struct iwx_mcc_chub_notif *);
uint8_t iwx_ridx2rate(struct ieee80211_rateset *, int);
@ -6855,7 +6855,7 @@ iwx_rm_sta(struct iwx_softc *sc, struct iwx_node *in)
uint8_t
iwx_umac_scan_fill_channels(struct iwx_softc *sc,
struct iwx_scan_channel_cfg_umac *chan, size_t chan_nitems,
int n_ssids, int bgscan)
int n_ssids, uint32_t channel_cfg_flags)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_channel *c;
@ -6886,8 +6886,8 @@ iwx_umac_scan_fill_channels(struct iwx_softc *sc,
chan->v1.iter_count = 1;
chan->v1.iter_interval = htole16(0);
}
if (n_ssids != 0 && !bgscan)
chan->flags = htole32(1 << 0); /* select SSID 0 */
chan->flags = htole32(channel_cfg_flags);
chan++;
nchan++;
}
@ -7128,12 +7128,12 @@ iwx_scan_umac_fill_general_p_v10(struct iwx_softc *sc,
void
iwx_scan_umac_fill_ch_p_v6(struct iwx_softc *sc,
struct iwx_scan_channel_params_v6 *cp, uint32_t channel_cfg_flags,
int n_ssid, int bgscan)
int n_ssid)
{
cp->flags = IWX_SCAN_CHANNEL_FLAG_ENABLE_CHAN_ORDER;
cp->count = iwx_umac_scan_fill_channels(sc, cp->channel_config,
nitems(cp->channel_config), n_ssid, bgscan);
nitems(cp->channel_config), n_ssid, channel_cfg_flags);
cp->n_aps_override[0] = IWX_SCAN_ADWELL_N_APS_GO_FRIENDLY;
cp->n_aps_override[1] = IWX_SCAN_ADWELL_N_APS_SOCIAL_CHS;
@ -7188,7 +7188,7 @@ iwx_umac_scan_v14(struct iwx_softc *sc, int bgscan)
}
iwx_scan_umac_fill_ch_p_v6(sc, &scan_p->channel_params, bitmap_ssid,
n_ssid, bgscan);
n_ssid);
hcmd.len[0] = sizeof(*cmd);
hcmd.data[0] = (void *)cmd;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_umb.c,v 1.51 2023/04/18 22:01:23 mvs Exp $ */
/* $OpenBSD: if_umb.c,v 1.52 2023/08/26 11:33:46 dlg Exp $ */
/*
* Copyright (c) 2016 genua mbH
@ -138,7 +138,6 @@ void umb_close_bulkpipes(struct umb_softc *);
int umb_ioctl(struct ifnet *, u_long, caddr_t);
int umb_output(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *);
void umb_input(struct ifnet *, struct mbuf *);
void umb_start(struct ifnet *);
void umb_rtrequest(struct ifnet *, int, struct rtentry *);
void umb_watchdog(struct ifnet *);
@ -610,7 +609,8 @@ umb_attach(struct device *parent, struct device *self, void *aux)
sizeof (struct ncm_pointer16);
ifp->if_mtu = 1500; /* use a common default */
ifp->if_hardmtu = sc->sc_maxpktlen;
ifp->if_input = umb_input;
ifp->if_bpf_mtap = p2p_bpf_mtap;
ifp->if_input = p2p_input;
ifp->if_output = umb_output;
if_attach(ifp);
if_alloc_sadl(ifp);
@ -910,48 +910,6 @@ umb_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
return if_enqueue(ifp, m);
}
void
umb_input(struct ifnet *ifp, struct mbuf *m)
{
uint32_t af;
if ((ifp->if_flags & IFF_UP) == 0) {
m_freem(m);
return;
}
if (m->m_pkthdr.len < sizeof (struct ip) + sizeof(af)) {
ifp->if_ierrors++;
DPRINTFN(4, "%s: dropping short packet (len %d)\n", __func__,
m->m_pkthdr.len);
m_freem(m);
return;
}
m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
/* pop off DLT_LOOP header, no longer needed */
af = *mtod(m, uint32_t *);
m_adj(m, sizeof (af));
af = ntohl(af);
ifp->if_ibytes += m->m_pkthdr.len;
switch (af) {
case AF_INET:
ipv4_input(ifp, m);
return;
#ifdef INET6
case AF_INET6:
ipv6_input(ifp, m);
return;
#endif /* INET6 */
default:
ifp->if_ierrors++;
DPRINTFN(4, "%s: dropping packet with bad IP version (af %d)\n",
__func__, af);
m_freem(m);
return;
}
}
static inline int
umb_align(size_t bufsz, int offs, int alignment, int remainder)
{
@ -2376,7 +2334,7 @@ umb_decap(struct umb_softc *sc, struct usbd_xfer *xfer)
struct ifnet *ifp = GET_IFP(sc);
int s;
void *buf;
uint32_t len, af = 0;
uint32_t len;
char *dp;
struct ncm_header16 *hdr16;
struct ncm_header32 *hdr32;
@ -2499,20 +2457,14 @@ umb_decap(struct umb_softc *sc, struct usbd_xfer *xfer)
ifp->if_iqdrops++;
continue;
}
m = m_prepend(m, sizeof(uint32_t), M_DONTWAIT);
if (m == NULL) {
ifp->if_iqdrops++;
continue;
}
switch (*dp & 0xf0) {
case 4 << 4:
af = htonl(AF_INET);
m->m_pkthdr.ph_family = AF_INET;
break;
case 6 << 4:
af = htonl(AF_INET6);
m->m_pkthdr.ph_family = AF_INET6;
break;
}
*mtod(m, uint32_t *) = af;
ml_enqueue(&ml, m);
}
done:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_clockintr.c,v 1.32 2023/08/21 17:22:04 cheloha Exp $ */
/* $OpenBSD: kern_clockintr.c,v 1.33 2023/08/26 22:21:00 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@ -49,6 +49,8 @@ uint64_t clockintr_nsecuptime(const struct clockintr *);
void clockintr_schedule(struct clockintr *, uint64_t);
void clockintr_schedule_locked(struct clockintr *, uint64_t);
void clockintr_statclock(struct clockintr *, void *);
void clockqueue_intrclock_install(struct clockintr_queue *,
const struct intrclock *);
uint64_t clockqueue_next(const struct clockintr_queue *);
void clockqueue_reset_intrclock(struct clockintr_queue *);
uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t);
@ -106,10 +108,8 @@ clockintr_cpu_init(const struct intrclock *ic)
KASSERT(ISSET(clockintr_flags, CL_INIT));
if (ic != NULL && !ISSET(cq->cq_flags, CQ_INTRCLOCK)) {
cq->cq_intrclock = *ic;
SET(cq->cq_flags, CQ_INTRCLOCK);
}
if (ic != NULL)
clockqueue_intrclock_install(cq, ic);
/* TODO: Remove these from struct clockintr_queue. */
if (cq->cq_hardclock == NULL) {
@ -533,6 +533,18 @@ clockqueue_init(struct clockintr_queue *cq)
SET(cq->cq_flags, CQ_INIT);
}
void
clockqueue_intrclock_install(struct clockintr_queue *cq,
const struct intrclock *ic)
{
mtx_enter(&cq->cq_mtx);
if (!ISSET(cq->cq_flags, CQ_INTRCLOCK)) {
cq->cq_intrclock = *ic;
SET(cq->cq_flags, CQ_INTRCLOCK);
}
mtx_leave(&cq->cq_mtx);
}
uint64_t
clockqueue_next(const struct clockintr_queue *cq)
{