sync with OpenBSD -current
This commit is contained in:
parent
c9341f2e4a
commit
22b3fbc138
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: a_time_tm.c,v 1.38 2024/04/11 06:49:19 tb Exp $ */
|
||||
/* $OpenBSD: a_time_tm.c,v 1.42 2024/05/03 18:33:27 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2015 Bob Beck <beck@openbsd.org>
|
||||
*
|
||||
@ -88,9 +88,6 @@ tm_to_gentime(struct tm *tm, ASN1_TIME *atime)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (atime == NULL)
|
||||
return 1;
|
||||
|
||||
if (asprintf(&time_str, "%04u%02u%02u%02u%02u%02uZ", tm->tm_year + 1900,
|
||||
tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min,
|
||||
tm->tm_sec) == -1) {
|
||||
@ -117,9 +114,6 @@ tm_to_utctime(struct tm *tm, ASN1_TIME *atime)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (atime == NULL)
|
||||
return 1;
|
||||
|
||||
if (asprintf(&time_str, "%02u%02u%02u%02u%02u%02uZ",
|
||||
tm->tm_year % 100, tm->tm_mon + 1, tm->tm_mday,
|
||||
tm->tm_hour, tm->tm_min, tm->tm_sec) == -1) {
|
||||
@ -293,7 +287,6 @@ asn1_time_parse_cbs(const CBS *cbs, int is_gentime, struct tm *out_tm)
|
||||
int
|
||||
ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode)
|
||||
{
|
||||
struct tm tml, *tmp = tm ? tm : &tml;
|
||||
int type = 0;
|
||||
CBS cbs;
|
||||
|
||||
@ -306,7 +299,7 @@ ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode)
|
||||
type = V_ASN1_UTCTIME;
|
||||
if (CBS_len(&cbs) == GENTIME_LENGTH)
|
||||
type = V_ASN1_GENERALIZEDTIME;
|
||||
if (asn1_time_parse_cbs(&cbs, type == V_ASN1_GENERALIZEDTIME, tmp)) {
|
||||
if (asn1_time_parse_cbs(&cbs, type == V_ASN1_GENERALIZEDTIME, tm)) {
|
||||
if (mode != 0 && mode != type)
|
||||
return -1;
|
||||
return type;
|
||||
@ -323,15 +316,19 @@ static int
|
||||
ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode)
|
||||
{
|
||||
struct tm tm;
|
||||
int type;
|
||||
|
||||
if ((type = ASN1_time_parse(str, strlen(str), &tm, mode)) == -1)
|
||||
if (ASN1_time_parse(str, strlen(str), &tm, mode) == -1)
|
||||
return 0;
|
||||
|
||||
/* Only check str's format, as documented. */
|
||||
if (s == NULL)
|
||||
return 1;
|
||||
|
||||
switch (mode) {
|
||||
case V_ASN1_UTCTIME:
|
||||
return type == mode && tm_to_utctime(&tm, s);
|
||||
return tm_to_utctime(&tm, s);
|
||||
case V_ASN1_GENERALIZEDTIME:
|
||||
return type == mode && tm_to_gentime(&tm, s);
|
||||
return tm_to_gentime(&tm, s);
|
||||
case RFC5280:
|
||||
return tm_to_rfc5280_time(&tm, s);
|
||||
default:
|
||||
|
@ -16,12 +16,18 @@ static inline bool
|
||||
static_cpu_has(uint16_t f)
|
||||
{
|
||||
switch (f) {
|
||||
case X86_FEATURE_CLFLUSH:
|
||||
return curcpu()->ci_cflushsz != 0;
|
||||
case X86_FEATURE_XMM4_1:
|
||||
return (cpu_ecxfeature & CPUIDECX_SSE41) != 0;
|
||||
#ifdef __amd64__
|
||||
case X86_FEATURE_CLFLUSH:
|
||||
case X86_FEATURE_PAT:
|
||||
return true;
|
||||
#else
|
||||
case X86_FEATURE_CLFLUSH:
|
||||
return curcpu()->ci_cflushsz != 0;
|
||||
case X86_FEATURE_PAT:
|
||||
return (curcpu()->ci_feature_flags & CPUID_PAT) != 0;
|
||||
#endif
|
||||
case X86_FEATURE_HYPERVISOR:
|
||||
return (cpu_ecxfeature & CPUIDECX_HV) != 0;
|
||||
default:
|
||||
@ -32,7 +38,7 @@ static_cpu_has(uint16_t f)
|
||||
static inline bool
|
||||
pat_enabled(void)
|
||||
{
|
||||
return ((curcpu()->ci_feature_flags & CPUID_PAT) != 0);
|
||||
return static_cpu_has(X86_FEATURE_PAT);
|
||||
}
|
||||
|
||||
#define boot_cpu_has(x) static_cpu_has(x)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: if_igc.c,v 1.20 2024/04/12 19:27:43 jan Exp $ */
|
||||
/* $OpenBSD: if_igc.c,v 1.21 2024/05/04 13:35:26 mbuhl Exp $ */
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
@ -44,10 +44,14 @@
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/route.h>
|
||||
#include <net/toeplitz.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcp_timer.h>
|
||||
#include <netinet/tcp_var.h>
|
||||
|
||||
#if NBPFILTER > 0
|
||||
#include <net/bpf.h>
|
||||
@ -796,6 +800,7 @@ igc_setup_interface(struct igc_softc *sc)
|
||||
ifp->if_capabilities |= IFCAP_CSUM_IPv4;
|
||||
ifp->if_capabilities |= IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
|
||||
ifp->if_capabilities |= IFCAP_CSUM_TCPv6 | IFCAP_CSUM_UDPv6;
|
||||
ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6;
|
||||
|
||||
/* Initialize ifmedia structures. */
|
||||
ifmedia_init(&sc->media, IFM_IMASK, igc_media_change, igc_media_status);
|
||||
@ -2025,13 +2030,11 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod,
|
||||
{
|
||||
struct ether_extracted ext;
|
||||
struct igc_adv_tx_context_desc *txdesc;
|
||||
uint32_t mss_l4len_idx = 0;
|
||||
uint32_t type_tucmd_mlhl = 0;
|
||||
uint32_t vlan_macip_lens = 0;
|
||||
int off = 0;
|
||||
|
||||
ether_extract_headers(mp, &ext);
|
||||
vlan_macip_lens |= (sizeof(*ext.eh) << IGC_ADVTXD_MACLEN_SHIFT);
|
||||
|
||||
/*
|
||||
* In advanced descriptors the vlan tag must
|
||||
* be placed into the context descriptor. Hence
|
||||
@ -2046,6 +2049,10 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod,
|
||||
}
|
||||
#endif
|
||||
|
||||
ether_extract_headers(mp, &ext);
|
||||
|
||||
vlan_macip_lens |= (sizeof(*ext.eh) << IGC_ADVTXD_MACLEN_SHIFT);
|
||||
|
||||
if (ext.ip4) {
|
||||
type_tucmd_mlhl |= IGC_ADVTXD_TUCMD_IPV4;
|
||||
if (ISSET(mp->m_pkthdr.csum_flags, M_IPV4_CSUM_OUT)) {
|
||||
@ -2075,6 +2082,30 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod,
|
||||
}
|
||||
}
|
||||
|
||||
if (ISSET(mp->m_pkthdr.csum_flags, M_TCP_TSO)) {
|
||||
if (ext.tcp) {
|
||||
uint32_t hdrlen, thlen, paylen, outlen;
|
||||
|
||||
thlen = ext.tcphlen;
|
||||
|
||||
outlen = mp->m_pkthdr.ph_mss;
|
||||
mss_l4len_idx |= outlen << IGC_ADVTXD_MSS_SHIFT;
|
||||
mss_l4len_idx |= thlen << IGC_ADVTXD_L4LEN_SHIFT;
|
||||
|
||||
hdrlen = sizeof(*ext.eh) + ext.iphlen + thlen;
|
||||
paylen = mp->m_pkthdr.len - hdrlen;
|
||||
CLR(*olinfo_status, IGC_ADVTXD_PAYLEN_MASK);
|
||||
*olinfo_status |= paylen << IGC_ADVTXD_PAYLEN_SHIFT;
|
||||
|
||||
*cmd_type_len |= IGC_ADVTXD_DCMD_TSE;
|
||||
off = 1;
|
||||
|
||||
tcpstat_add(tcps_outpkttso,
|
||||
(paylen + outlen - 1) / outlen);
|
||||
} else
|
||||
tcpstat_inc(tcps_outbadtso);
|
||||
}
|
||||
|
||||
if (off == 0)
|
||||
return 0;
|
||||
|
||||
@ -2085,7 +2116,7 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod,
|
||||
htolem32(&txdesc->vlan_macip_lens, vlan_macip_lens);
|
||||
htolem32(&txdesc->type_tucmd_mlhl, type_tucmd_mlhl);
|
||||
htolem32(&txdesc->seqnum_seed, 0);
|
||||
htolem32(&txdesc->mss_l4len_idx, 0);
|
||||
htolem32(&txdesc->mss_l4len_idx, mss_l4len_idx);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: igc_base.h,v 1.2 2024/03/25 20:25:13 mbuhl Exp $ */
|
||||
/* $OpenBSD: igc_base.h,v 1.3 2024/05/04 13:35:26 mbuhl Exp $ */
|
||||
/*-
|
||||
* Copyright 2021 Intel Corp
|
||||
* Copyright 2021 Rubicon Communications, LLC (Netgate)
|
||||
@ -66,6 +66,7 @@ struct igc_adv_tx_context_desc {
|
||||
#define IGC_ADVTXD_POPTS_ISCO_FULL 0x00001800
|
||||
#define IGC_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */
|
||||
#define IGC_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */
|
||||
#define IGC_ADVTXD_PAYLEN_MASK 0xFFFFD000 /* Adv desc PAYLEN shift */
|
||||
|
||||
/* Advanced Transmit Context Descriptor Config */
|
||||
#define IGC_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uipc_socket.c,v 1.332 2024/05/02 11:55:31 mvs Exp $ */
|
||||
/* $OpenBSD: uipc_socket.c,v 1.333 2024/05/03 17:43:09 mvs Exp $ */
|
||||
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
|
||||
|
||||
/*
|
||||
@ -159,14 +159,15 @@ soalloc(const struct protosw *prp, int wait)
|
||||
case AF_INET6:
|
||||
switch (prp->pr_type) {
|
||||
case SOCK_RAW:
|
||||
so->so_snd.sb_flags |= SB_MTXLOCK | SB_OWNLOCK;
|
||||
so->so_snd.sb_flags |= SB_MTXLOCK;
|
||||
/* FALLTHROUGH */
|
||||
case SOCK_DGRAM:
|
||||
so->so_rcv.sb_flags |= SB_MTXLOCK | SB_OWNLOCK;
|
||||
so->so_rcv.sb_flags |= SB_MTXLOCK;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AF_UNIX:
|
||||
so->so_snd.sb_flags |= SB_MTXLOCK;
|
||||
so->so_rcv.sb_flags |= SB_MTXLOCK;
|
||||
break;
|
||||
}
|
||||
@ -354,18 +355,16 @@ sofree(struct socket *so, int keep_lock)
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
|
||||
/*
|
||||
* Regardless on '_locked' postfix, must release solock() before
|
||||
* call sorflush_locked() for SB_OWNLOCK marked socket. Can't
|
||||
* release solock() and call sorflush() because solock() release
|
||||
* is unwanted for tcp(4) socket.
|
||||
* Unlocked dispose and cleanup is safe. Socket is unlinked
|
||||
* from everywhere. Even concurrent sotask() thread will not
|
||||
* call somove().
|
||||
*/
|
||||
if (so->so_proto->pr_flags & PR_RIGHTS &&
|
||||
so->so_proto->pr_domain->dom_dispose)
|
||||
(*so->so_proto->pr_domain->dom_dispose)(so->so_rcv.sb_mb);
|
||||
m_purge(so->so_rcv.sb_mb);
|
||||
|
||||
if (so->so_rcv.sb_flags & SB_OWNLOCK)
|
||||
sounlock(so);
|
||||
|
||||
sorflush_locked(so);
|
||||
|
||||
if (!((so->so_rcv.sb_flags & SB_OWNLOCK) || keep_lock))
|
||||
if (!keep_lock)
|
||||
sounlock(so);
|
||||
|
||||
#ifdef SOCKET_SPLICE
|
||||
@ -574,7 +573,7 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
|
||||
size_t resid;
|
||||
int error;
|
||||
int atomic = sosendallatonce(so) || top;
|
||||
int dosolock = ((so->so_snd.sb_flags & SB_OWNLOCK) == 0);
|
||||
int dosolock = ((so->so_snd.sb_flags & SB_MTXLOCK) == 0);
|
||||
|
||||
if (uio)
|
||||
resid = uio->uio_resid;
|
||||
@ -846,7 +845,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
|
||||
const struct protosw *pr = so->so_proto;
|
||||
struct mbuf *nextrecord;
|
||||
size_t resid, orig_resid = uio->uio_resid;
|
||||
int dosolock = ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0);
|
||||
int dosolock = ((so->so_rcv.sb_flags & SB_MTXLOCK) == 0);
|
||||
|
||||
mp = mp0;
|
||||
if (paddr)
|
||||
@ -945,7 +944,7 @@ restart:
|
||||
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 1");
|
||||
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 1");
|
||||
|
||||
if (so->so_rcv.sb_flags & (SB_MTXLOCK | SB_OWNLOCK)) {
|
||||
if (so->so_rcv.sb_flags & SB_MTXLOCK) {
|
||||
sbunlock_locked(so, &so->so_rcv);
|
||||
if (dosolock)
|
||||
sounlock_shared(so);
|
||||
@ -1247,7 +1246,11 @@ dontblock:
|
||||
SBLASTMBUFCHK(&so->so_rcv, "soreceive 4");
|
||||
if (pr->pr_flags & PR_WANTRCVD) {
|
||||
sb_mtx_unlock(&so->so_rcv);
|
||||
if (!dosolock)
|
||||
solock_shared(so);
|
||||
pru_rcvd(so);
|
||||
if (!dosolock)
|
||||
sounlock_shared(so);
|
||||
sb_mtx_lock(&so->so_rcv);
|
||||
}
|
||||
}
|
||||
@ -1306,17 +1309,17 @@ sorflush_locked(struct socket *so)
|
||||
const struct protosw *pr = so->so_proto;
|
||||
int error;
|
||||
|
||||
if ((sb->sb_flags & SB_OWNLOCK) == 0)
|
||||
if ((sb->sb_flags & SB_MTXLOCK) == 0)
|
||||
soassertlocked(so);
|
||||
|
||||
error = sblock(so, sb, SBL_WAIT | SBL_NOINTR);
|
||||
/* with SBL_WAIT and SLB_NOINTR sblock() must not fail */
|
||||
KASSERT(error == 0);
|
||||
|
||||
if (sb->sb_flags & SB_OWNLOCK)
|
||||
if (sb->sb_flags & SB_MTXLOCK)
|
||||
solock(so);
|
||||
socantrcvmore(so);
|
||||
if (sb->sb_flags & SB_OWNLOCK)
|
||||
if (sb->sb_flags & SB_MTXLOCK)
|
||||
sounlock(so);
|
||||
|
||||
mtx_enter(&sb->sb_mtx);
|
||||
@ -1334,10 +1337,10 @@ sorflush_locked(struct socket *so)
|
||||
void
|
||||
sorflush(struct socket *so)
|
||||
{
|
||||
if ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0)
|
||||
if ((so->so_rcv.sb_flags & SB_MTXLOCK) == 0)
|
||||
solock_shared(so);
|
||||
sorflush_locked(so);
|
||||
if ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0)
|
||||
if ((so->so_rcv.sb_flags & SB_MTXLOCK) == 0)
|
||||
sounlock_shared(so);
|
||||
}
|
||||
|
||||
@ -1383,7 +1386,7 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv)
|
||||
membar_consumer();
|
||||
}
|
||||
|
||||
if (so->so_rcv.sb_flags & SB_OWNLOCK) {
|
||||
if (so->so_rcv.sb_flags & SB_MTXLOCK) {
|
||||
if ((error = sblock(so, &so->so_rcv, SBL_WAIT)) != 0)
|
||||
return (error);
|
||||
solock(so);
|
||||
@ -1471,7 +1474,7 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv)
|
||||
release:
|
||||
sbunlock(sosp, &sosp->so_snd);
|
||||
out:
|
||||
if (so->so_rcv.sb_flags & SB_OWNLOCK) {
|
||||
if (so->so_rcv.sb_flags & SB_MTXLOCK) {
|
||||
sounlock(so);
|
||||
sbunlock(so, &so->so_rcv);
|
||||
} else {
|
||||
@ -1885,7 +1888,8 @@ sorwakeup(struct socket *so)
|
||||
void
|
||||
sowwakeup(struct socket *so)
|
||||
{
|
||||
soassertlocked_readonly(so);
|
||||
if ((so->so_snd.sb_flags & SB_MTXLOCK) == 0)
|
||||
soassertlocked_readonly(so);
|
||||
|
||||
#ifdef SOCKET_SPLICE
|
||||
if (so->so_snd.sb_flags & SB_SPLICE)
|
||||
@ -1976,7 +1980,7 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m)
|
||||
if ((long)cnt <= 0)
|
||||
cnt = 1;
|
||||
|
||||
if (((sb->sb_flags & SB_OWNLOCK) == 0))
|
||||
if (((sb->sb_flags & SB_MTXLOCK) == 0))
|
||||
solock(so);
|
||||
mtx_enter(&sb->sb_mtx);
|
||||
|
||||
@ -2003,7 +2007,7 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m)
|
||||
}
|
||||
|
||||
mtx_leave(&sb->sb_mtx);
|
||||
if (((sb->sb_flags & SB_OWNLOCK) == 0))
|
||||
if (((sb->sb_flags & SB_MTXLOCK) == 0))
|
||||
sounlock(so);
|
||||
|
||||
break;
|
||||
@ -2380,7 +2384,8 @@ filt_sowrite(struct knote *kn, long hint)
|
||||
int rv;
|
||||
|
||||
MUTEX_ASSERT_LOCKED(&so->so_snd.sb_mtx);
|
||||
soassertlocked_readonly(so);
|
||||
if ((so->so_snd.sb_flags & SB_MTXLOCK) == 0)
|
||||
soassertlocked_readonly(so);
|
||||
|
||||
kn->kn_data = sbspace(so, &so->so_snd);
|
||||
if (so->so_snd.sb_state & SS_CANTSENDMORE) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uipc_socket2.c,v 1.152 2024/05/02 21:26:52 mvs Exp $ */
|
||||
/* $OpenBSD: uipc_socket2.c,v 1.153 2024/05/03 17:43:09 mvs Exp $ */
|
||||
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
|
||||
|
||||
/*
|
||||
@ -228,9 +228,10 @@ sonewconn(struct socket *head, int connstatus, int wait)
|
||||
*/
|
||||
if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat))
|
||||
goto fail;
|
||||
|
||||
mtx_enter(&head->so_snd.sb_mtx);
|
||||
so->so_snd.sb_wat = head->so_snd.sb_wat;
|
||||
so->so_snd.sb_lowat = head->so_snd.sb_lowat;
|
||||
mtx_enter(&head->so_snd.sb_mtx);
|
||||
so->so_snd.sb_timeo_nsecs = head->so_snd.sb_timeo_nsecs;
|
||||
mtx_leave(&head->so_snd.sb_mtx);
|
||||
|
||||
@ -543,7 +544,7 @@ sblock(struct socket *so, struct sockbuf *sb, int flags)
|
||||
{
|
||||
int error = 0, prio = PSOCK;
|
||||
|
||||
if (sb->sb_flags & SB_OWNLOCK) {
|
||||
if (sb->sb_flags & SB_MTXLOCK) {
|
||||
int rwflags = RW_WRITE;
|
||||
|
||||
if (!(flags & SBL_NOINTR || sb->sb_flags & SB_NOINTR))
|
||||
@ -586,7 +587,7 @@ out:
|
||||
void
|
||||
sbunlock_locked(struct socket *so, struct sockbuf *sb)
|
||||
{
|
||||
if (sb->sb_flags & SB_OWNLOCK) {
|
||||
if (sb->sb_flags & SB_MTXLOCK) {
|
||||
rw_exit(&sb->sb_lock);
|
||||
return;
|
||||
}
|
||||
@ -603,7 +604,7 @@ sbunlock_locked(struct socket *so, struct sockbuf *sb)
|
||||
void
|
||||
sbunlock(struct socket *so, struct sockbuf *sb)
|
||||
{
|
||||
if (sb->sb_flags & SB_OWNLOCK) {
|
||||
if (sb->sb_flags & SB_MTXLOCK) {
|
||||
rw_exit(&sb->sb_lock);
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uipc_usrreq.c,v 1.205 2024/05/02 17:10:55 mvs Exp $ */
|
||||
/* $OpenBSD: uipc_usrreq.c,v 1.206 2024/05/03 17:43:09 mvs Exp $ */
|
||||
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
|
||||
|
||||
/*
|
||||
@ -477,20 +477,24 @@ uipc_dgram_shutdown(struct socket *so)
|
||||
void
|
||||
uipc_rcvd(struct socket *so)
|
||||
{
|
||||
struct unpcb *unp = sotounpcb(so);
|
||||
struct socket *so2;
|
||||
|
||||
if ((so2 = unp_solock_peer(so)) == NULL)
|
||||
if (unp->unp_conn == NULL)
|
||||
return;
|
||||
so2 = unp->unp_conn->unp_socket;
|
||||
|
||||
/*
|
||||
* Adjust backpressure on sender
|
||||
* and wakeup any waiting to write.
|
||||
*/
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
mtx_enter(&so2->so_snd.sb_mtx);
|
||||
so2->so_snd.sb_mbcnt = so->so_rcv.sb_mbcnt;
|
||||
so2->so_snd.sb_cc = so->so_rcv.sb_cc;
|
||||
mtx_leave(&so2->so_snd.sb_mtx);
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
sowwakeup(so2);
|
||||
sounlock(so2);
|
||||
}
|
||||
|
||||
int
|
||||
@ -509,10 +513,6 @@ uipc_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (so->so_snd.sb_state & SS_CANTSENDMORE) {
|
||||
error = EPIPE;
|
||||
goto dispose;
|
||||
}
|
||||
if (unp->unp_conn == NULL) {
|
||||
error = ENOTCONN;
|
||||
goto dispose;
|
||||
@ -525,11 +525,23 @@ uipc_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
|
||||
* send buffer counts to maintain backpressure.
|
||||
* Wake up readers.
|
||||
*/
|
||||
/*
|
||||
* sbappend*() should be serialized together
|
||||
* with so_snd modification.
|
||||
*/
|
||||
mtx_enter(&so2->so_rcv.sb_mtx);
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
if (so->so_snd.sb_state & SS_CANTSENDMORE) {
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
mtx_leave(&so2->so_rcv.sb_mtx);
|
||||
error = EPIPE;
|
||||
goto dispose;
|
||||
}
|
||||
if (control) {
|
||||
if (sbappendcontrol(so2, &so2->so_rcv, m, control)) {
|
||||
control = NULL;
|
||||
} else {
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
mtx_leave(&so2->so_rcv.sb_mtx);
|
||||
error = ENOBUFS;
|
||||
goto dispose;
|
||||
@ -542,6 +554,7 @@ uipc_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
|
||||
so->so_snd.sb_cc = so2->so_rcv.sb_cc;
|
||||
if (so2->so_rcv.sb_cc > 0)
|
||||
dowakeup = 1;
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
mtx_leave(&so2->so_rcv.sb_mtx);
|
||||
|
||||
if (dowakeup)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: fifo_vnops.c,v 1.104 2024/03/26 09:46:47 mvs Exp $ */
|
||||
/* $OpenBSD: fifo_vnops.c,v 1.105 2024/05/03 17:43:09 mvs Exp $ */
|
||||
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
|
||||
|
||||
/*
|
||||
@ -174,10 +174,10 @@ fifo_open(void *v)
|
||||
return (error);
|
||||
}
|
||||
fip->fi_readers = fip->fi_writers = 0;
|
||||
solock(wso);
|
||||
mtx_enter(&wso->so_snd.sb_mtx);
|
||||
wso->so_snd.sb_state |= SS_CANTSENDMORE;
|
||||
wso->so_snd.sb_lowat = PIPE_BUF;
|
||||
sounlock(wso);
|
||||
mtx_leave(&wso->so_snd.sb_mtx);
|
||||
} else {
|
||||
rso = fip->fi_readsock;
|
||||
wso = fip->fi_writesock;
|
||||
@ -185,9 +185,9 @@ fifo_open(void *v)
|
||||
if (ap->a_mode & FREAD) {
|
||||
fip->fi_readers++;
|
||||
if (fip->fi_readers == 1) {
|
||||
solock(wso);
|
||||
mtx_enter(&wso->so_snd.sb_mtx);
|
||||
wso->so_snd.sb_state &= ~SS_CANTSENDMORE;
|
||||
sounlock(wso);
|
||||
mtx_leave(&wso->so_snd.sb_mtx);
|
||||
if (fip->fi_writers > 0)
|
||||
wakeup(&fip->fi_writers);
|
||||
}
|
||||
@ -554,7 +554,6 @@ filt_fifowrite(struct knote *kn, long hint)
|
||||
struct socket *so = kn->kn_hook;
|
||||
int rv;
|
||||
|
||||
soassertlocked(so);
|
||||
MUTEX_ASSERT_LOCKED(&so->so_snd.sb_mtx);
|
||||
|
||||
kn->kn_data = sbspace(so, &so->so_snd);
|
||||
@ -625,11 +624,9 @@ filt_fifowmodify(struct kevent *kev, struct knote *kn)
|
||||
struct socket *so = kn->kn_hook;
|
||||
int rv;
|
||||
|
||||
solock(so);
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
rv = knote_modify(kev, kn);
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
sounlock(so);
|
||||
|
||||
return (rv);
|
||||
}
|
||||
@ -640,11 +637,9 @@ filt_fifowprocess(struct knote *kn, struct kevent *kev)
|
||||
struct socket *so = kn->kn_hook;
|
||||
int rv;
|
||||
|
||||
solock(so);
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
rv = knote_process(kn, kev);
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
sounlock(so);
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: nfs.h,v 1.53 2017/02/22 11:42:46 mpi Exp $ */
|
||||
/* $OpenBSD: nfs.h,v 1.54 2024/05/04 10:53:37 jsg Exp $ */
|
||||
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
@ -43,7 +43,6 @@
|
||||
#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
|
||||
#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
|
||||
#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
|
||||
#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
|
||||
#define NFS_TIMEOUTMUL 2 /* Timeout/Delay multiplier */
|
||||
#define NFS_MAXREXMIT 100 /* Stop counting after this many */
|
||||
#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
|
||||
@ -74,19 +73,6 @@
|
||||
(((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
|
||||
NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
|
||||
|
||||
/*
|
||||
* sys/malloc.h needs M_NFSDIROFF, M_NFSRVDESC and M_NFSBIGFH added.
|
||||
*/
|
||||
#ifndef M_NFSRVDESC
|
||||
#define M_NFSRVDESC M_TEMP
|
||||
#endif
|
||||
#ifndef M_NFSDIROFF
|
||||
#define M_NFSDIROFF M_TEMP
|
||||
#endif
|
||||
#ifndef M_NFSBIGFH
|
||||
#define M_NFSBIGFH M_TEMP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The B_INVAFTERWRITE flag should be set to whatever is required by the
|
||||
* buffer cache code to say "Invalidate the block after it is written back".
|
||||
@ -159,13 +145,8 @@ struct nfsstats {
|
||||
/*
|
||||
* Flags for nfssvc() system call.
|
||||
*/
|
||||
#define NFSSVC_BIOD 0x002
|
||||
#define NFSSVC_NFSD 0x004
|
||||
#define NFSSVC_ADDSOCK 0x008
|
||||
#define NFSSVC_AUTHIN 0x010
|
||||
#define NFSSVC_GOTAUTH 0x040
|
||||
#define NFSSVC_AUTHINFAIL 0x080
|
||||
#define NFSSVC_MNTD 0x100
|
||||
|
||||
/*
|
||||
* fs.nfs sysctl(3) identifiers
|
||||
@ -306,8 +287,6 @@ struct nfsd {
|
||||
/* Bits for "nfsd_flag" */
|
||||
#define NFSD_WAITING 0x01
|
||||
#define NFSD_REQINPROG 0x02
|
||||
#define NFSD_NEEDAUTH 0x04
|
||||
#define NFSD_AUTHFAIL 0x08
|
||||
|
||||
/*
|
||||
* This structure is used by the server for describing each request.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: nfs_var.h,v 1.64 2024/04/30 17:04:23 miod Exp $ */
|
||||
/* $OpenBSD: nfs_var.h,v 1.65 2024/05/04 11:25:24 jsg Exp $ */
|
||||
/* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
@ -66,8 +66,6 @@ int nfs_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
|
||||
int nfs_readrpc(struct vnode *, struct uio *);
|
||||
int nfs_writerpc(struct vnode *, struct uio *, int *, int *);
|
||||
int nfs_removeit(struct sillyrename *);
|
||||
int nfs_mmap(void *);
|
||||
int nfs_blkatoff(void *);
|
||||
int nfs_writebp(struct buf *, int);
|
||||
|
||||
#define nfs_ioctl ((int (*)(void *))enoioctl)
|
||||
@ -153,7 +151,6 @@ void nfsm_uiotombuf(struct mbuf **, struct uio *, size_t);
|
||||
void nfsm_strtombuf(struct mbuf **, void *, size_t);
|
||||
void nfsm_buftombuf(struct mbuf **, void *, size_t);
|
||||
int nfs_adv(struct mbuf **, caddr_t *, int, int);
|
||||
int nfsm_strtmbuf(struct mbuf **, char **, char *, long);
|
||||
int nfs_vfs_init(struct vfsconf *);
|
||||
int nfs_attrtimeo(struct nfsnode *);
|
||||
int nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *,
|
||||
@ -190,7 +187,6 @@ void nfsm_srvfhtom(struct mbuf **, fhandle_t *, int);
|
||||
/* nfs_syscalls.c */
|
||||
int sys_nfssvc(struct proc *, void *, register_t *);
|
||||
void nfsrv_init(int);
|
||||
void start_nfsio(void *);
|
||||
void nfs_getset_niothreads(int);
|
||||
|
||||
/* nfs_kq.c */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: socketvar.h,v 1.129 2024/04/11 13:32:51 mvs Exp $ */
|
||||
/* $OpenBSD: socketvar.h,v 1.130 2024/05/03 17:43:09 mvs Exp $ */
|
||||
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
|
||||
|
||||
/*-
|
||||
@ -134,8 +134,7 @@ struct socket {
|
||||
#define SB_ASYNC 0x0010 /* ASYNC I/O, need signals */
|
||||
#define SB_SPLICE 0x0020 /* buffer is splice source or drain */
|
||||
#define SB_NOINTR 0x0040 /* operations not interruptible */
|
||||
#define SB_MTXLOCK 0x0080 /* use sb_mtx for sockbuf protection */
|
||||
#define SB_OWNLOCK 0x0100 /* sblock() doesn't need solock() */
|
||||
#define SB_MTXLOCK 0x0080 /* sblock() doesn't need solock() */
|
||||
|
||||
void (*so_upcall)(struct socket *so, caddr_t arg, int waitf);
|
||||
caddr_t so_upcallarg; /* Arg for above */
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: aucat.1,v 1.120 2024/03/20 08:42:11 ratchov Exp $
|
||||
.\" $OpenBSD: aucat.1,v 1.121 2024/05/03 16:48:41 ratchov Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2006 Alexandre Ratchov <alex@caoua.org>
|
||||
.\"
|
||||
@ -14,7 +14,7 @@
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: March 20 2024 $
|
||||
.Dd $Mdocdate: May 3 2024 $
|
||||
.Dt AUCAT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -224,26 +224,26 @@ MIDI control is intended to be used together with
|
||||
.Xr sndiod 8 .
|
||||
For instance, the following command will create two devices:
|
||||
the default
|
||||
.Va snd/0
|
||||
.Va snd/default
|
||||
and a MMC-controlled one
|
||||
.Va snd/0.mmc :
|
||||
.Va snd/defaul.mmc :
|
||||
.Bd -literal -offset indent
|
||||
$ sndiod -r 48000 -z 480 -s default -t slave -s mmc
|
||||
.Ed
|
||||
.Pp
|
||||
Programs using
|
||||
.Va snd/0
|
||||
.Va snd/default
|
||||
behave normally, while programs using
|
||||
.Va snd/0.mmc
|
||||
.Va snd/mmc
|
||||
wait for the MMC start signal and start synchronously.
|
||||
Then, the following command will play a file on the
|
||||
.Va snd/0.mmc
|
||||
.Va snd/mmc
|
||||
audio device, giving full control to MIDI software or hardware
|
||||
connected to the
|
||||
.Va midithru/0
|
||||
MIDI port:
|
||||
.Bd -literal -offset indent
|
||||
$ aucat -f snd/0.mmc -q midithru/0 -i file.wav
|
||||
$ aucat -f snd/mmc -q midithru/0 -i file.wav
|
||||
.Ed
|
||||
.Pp
|
||||
At this stage,
|
||||
@ -253,9 +253,9 @@ actions in the MIDI sequencer, assuming it's configured to
|
||||
transmit MMC on
|
||||
.Va midithru/0
|
||||
and
|
||||
.Va snd/0.mmc .
|
||||
.Va snd/mmc .
|
||||
Furthermore, the MIDI sequencer could be configured to use the
|
||||
.Va snd/0.mmc
|
||||
.Va snd/mmc
|
||||
port as MTC clock source, assured to be synchronous to playback of
|
||||
.Pa file.wav .
|
||||
.Sh EXAMPLES
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: sndiod.8,v 1.16 2022/03/07 08:58:33 ratchov Exp $
|
||||
.\" $OpenBSD: sndiod.8,v 1.17 2024/05/03 16:47:15 ratchov Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2006-2012 Alexandre Ratchov <alex@caoua.org>
|
||||
.\"
|
||||
@ -14,7 +14,7 @@
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: March 7 2022 $
|
||||
.Dd $Mdocdate: May 3 2024 $
|
||||
.Dt SNDIOD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -404,7 +404,7 @@ is
|
||||
and the default sub-device exposed by
|
||||
.Nm
|
||||
is
|
||||
.Pa snd/0 .
|
||||
.Pa snd/default .
|
||||
.Pp
|
||||
If
|
||||
.Nm
|
||||
@ -506,17 +506,17 @@ are recommended:
|
||||
.Pp
|
||||
For instance, the following command will create two devices:
|
||||
the default
|
||||
.Va snd/0
|
||||
.Va snd/default
|
||||
and a MIDI-controlled
|
||||
.Va snd/0.mmc :
|
||||
.Va snd/mmc :
|
||||
.Bd -literal -offset indent
|
||||
$ sndiod -r 48000 -z 400 -s default -t slave -s mmc
|
||||
.Ed
|
||||
.Pp
|
||||
Streams connected to
|
||||
.Va snd/0
|
||||
.Va snd/default
|
||||
behave normally, while streams connected to
|
||||
.Va snd/0.mmc
|
||||
.Va snd/mmc
|
||||
wait for the MMC start signal and start synchronously.
|
||||
Regardless of which device a stream is connected to,
|
||||
its playback volume knob is exposed.
|
||||
@ -547,9 +547,9 @@ and to fall back to the PCI one when it's disconnected.
|
||||
Start server using default parameters, creating an
|
||||
additional sub-device for output to channels 2:3 only (rear speakers
|
||||
on most cards), exposing the
|
||||
.Pa snd/0
|
||||
.Pa snd/default
|
||||
and
|
||||
.Pa snd/0.rear
|
||||
.Pa snd/rear
|
||||
devices:
|
||||
.Bd -literal -offset indent
|
||||
$ sndiod -s default -c 2:3 -s rear
|
||||
@ -557,9 +557,9 @@ $ sndiod -s default -c 2:3 -s rear
|
||||
.Pp
|
||||
Start server creating the default sub-device with low volume and
|
||||
an additional sub-device for high volume output, exposing the
|
||||
.Pa snd/0
|
||||
.Pa snd/default
|
||||
and
|
||||
.Pa snd/0.max
|
||||
.Pa snd/max
|
||||
devices:
|
||||
.Bd -literal -offset indent
|
||||
$ sndiod -v 65 -s default -v 127 -s max
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: vmctl.8,v 1.77 2024/05/02 15:46:10 mlarkin Exp $
|
||||
.\" $OpenBSD: vmctl.8,v 1.78 2024/05/04 07:51:21 jmc Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2015-2024 Mike Larkin <mlarkin@openbsd.org>
|
||||
.\"
|
||||
@ -14,7 +14,7 @@
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: May 2 2024 $
|
||||
.Dd $Mdocdate: May 4 2024 $
|
||||
.Dt VMCTL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -143,7 +143,7 @@ not the disk image.
|
||||
In order to move a VM from one host to another, disk files must be
|
||||
synced between the send and the receive processes and must be located
|
||||
under the same path.
|
||||
.It Cm show Op Ar id
|
||||
.It Cm show Oo Fl r Oc Op Ar id
|
||||
An alias for the
|
||||
.Cm status
|
||||
command.
|
||||
|
Loading…
Reference in New Issue
Block a user