sync
This commit is contained in:
parent
ab90ba3a7c
commit
9e5eddc6af
57 changed files with 838 additions and 537 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: trap.c,v 1.44 2023/04/26 12:30:24 kettenis Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.45 2023/05/15 15:02:06 kettenis Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2014 Andrew Turner
|
||||
* All rights reserved.
|
||||
|
@ -94,7 +94,7 @@ udata_abort(struct trapframe *frame, uint64_t esr, uint64_t far, int exe)
|
|||
switch (esr & ISS_DATA_DFSC_MASK) {
|
||||
case ISS_DATA_DFSC_ALIGN:
|
||||
sv.sival_ptr = (void *)far;
|
||||
trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
|
||||
trapsignal(p, SIGBUS, esr, BUS_ADRALN, sv);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
|
@ -132,7 +132,7 @@ udata_abort(struct trapframe *frame, uint64_t esr, uint64_t far, int exe)
|
|||
code = SEGV_MAPERR;
|
||||
}
|
||||
sv.sival_ptr = (void *)far;
|
||||
trapsignal(p, sig, 0, code, sv);
|
||||
trapsignal(p, sig, esr, code, sv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -275,7 +275,7 @@ do_el0_sync(struct trapframe *frame)
|
|||
case EXCP_UNKNOWN:
|
||||
curcpu()->ci_flush_bp();
|
||||
sv.sival_ptr = (void *)frame->tf_elr;
|
||||
trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv);
|
||||
trapsignal(p, SIGILL, esr, ILL_ILLOPC, sv);
|
||||
break;
|
||||
case EXCP_FP_SIMD:
|
||||
case EXCP_TRAP_FP:
|
||||
|
@ -284,7 +284,7 @@ do_el0_sync(struct trapframe *frame)
|
|||
case EXCP_BRANCH_TGT:
|
||||
curcpu()->ci_flush_bp();
|
||||
sv.sival_ptr = (void *)frame->tf_elr;
|
||||
trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv);
|
||||
trapsignal(p, SIGILL, esr, ILL_ILLOPC, sv);
|
||||
break;
|
||||
case EXCP_SVC:
|
||||
svc_handler(frame);
|
||||
|
@ -295,23 +295,23 @@ do_el0_sync(struct trapframe *frame)
|
|||
case EXCP_PC_ALIGN:
|
||||
curcpu()->ci_flush_bp();
|
||||
sv.sival_ptr = (void *)frame->tf_elr;
|
||||
trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
|
||||
trapsignal(p, SIGBUS, esr, BUS_ADRALN, sv);
|
||||
break;
|
||||
case EXCP_SP_ALIGN:
|
||||
curcpu()->ci_flush_bp();
|
||||
sv.sival_ptr = (void *)frame->tf_sp;
|
||||
trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
|
||||
trapsignal(p, SIGBUS, esr, BUS_ADRALN, sv);
|
||||
break;
|
||||
case EXCP_DATA_ABORT_L:
|
||||
udata_abort(frame, esr, far, 0);
|
||||
break;
|
||||
case EXCP_BRK:
|
||||
sv.sival_ptr = (void *)frame->tf_elr;
|
||||
trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv);
|
||||
trapsignal(p, SIGTRAP, esr, TRAP_BRKPT, sv);
|
||||
break;
|
||||
case EXCP_SOFTSTP_EL0:
|
||||
sv.sival_ptr = (void *)frame->tf_elr;
|
||||
trapsignal(p, SIGTRAP, 0, TRAP_TRACE, sv);
|
||||
trapsignal(p, SIGTRAP, esr, TRAP_TRACE, sv);
|
||||
break;
|
||||
default:
|
||||
// panic("Unknown userland exception %x esr_el1 %lx", exception,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_ix.c,v 1.193 2023/04/28 10:18:57 bluhm Exp $ */
|
||||
/* $OpenBSD: if_ix.c,v 1.194 2023/05/16 14:32:54 jan Exp $ */
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
|
@ -1925,7 +1925,7 @@ ixgbe_setup_interface(struct ix_softc *sc)
|
|||
ifp->if_capabilities |= IFCAP_CSUM_IPv4;
|
||||
|
||||
if (sc->hw.mac.type != ixgbe_mac_82598EB)
|
||||
ifp->if_capabilities |= IFCAP_TSO;
|
||||
ifp->if_capabilities |= IFCAP_LRO;
|
||||
|
||||
/*
|
||||
* Specify the media types supported by this sc and register
|
||||
|
@ -2873,13 +2873,13 @@ ixgbe_initialize_receive_units(struct ix_softc *sc)
|
|||
hlreg |= IXGBE_HLREG0_JUMBOEN;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg);
|
||||
|
||||
if (ISSET(ifp->if_xflags, IFXF_TSO)) {
|
||||
if (ISSET(ifp->if_xflags, IFXF_LRO)) {
|
||||
rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
|
||||
|
||||
/* This field has to be set to zero. */
|
||||
rdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
|
||||
|
||||
/* Enable TSO Receive Offloading */
|
||||
/* RSC Coalescing on ACK Change */
|
||||
rdrxctl |= IXGBE_RDRXCTL_RSCACKC;
|
||||
rdrxctl |= IXGBE_RDRXCTL_FCOE_WRFIX;
|
||||
|
||||
|
@ -2902,10 +2902,10 @@ ixgbe_initialize_receive_units(struct ix_softc *sc)
|
|||
srrctl = bufsz | IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(i), srrctl);
|
||||
|
||||
if (ISSET(ifp->if_xflags, IFXF_TSO)) {
|
||||
if (ISSET(ifp->if_xflags, IFXF_LRO)) {
|
||||
rdrxctl = IXGBE_READ_REG(&sc->hw, IXGBE_RSCCTL(i));
|
||||
|
||||
/* Enable TSO Receive Side Coalescing */
|
||||
/* Enable Receive Side Coalescing */
|
||||
rdrxctl |= IXGBE_RSCCTL_RSCEN;
|
||||
rdrxctl |= IXGBE_RSCCTL_MAXDESC_16;
|
||||
|
||||
|
@ -3263,7 +3263,7 @@ ixgbe_setup_vlan_hw_support(struct ix_softc *sc)
|
|||
* We have to disable VLAN striping when using TCP offloading, due to a
|
||||
* firmware bug.
|
||||
*/
|
||||
if (ISSET(ifp->if_xflags, IFXF_TSO)) {
|
||||
if (ISSET(ifp->if_xflags, IFXF_LRO)) {
|
||||
sc->vlan_stripping = 0;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uipc_domain.c,v 1.61 2023/05/04 09:40:36 mvs Exp $ */
|
||||
/* $OpenBSD: uipc_domain.c,v 1.62 2023/05/16 19:36:00 mvs Exp $ */
|
||||
/* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -244,10 +244,12 @@ net_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
|
|||
protocol = name[1];
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
|
||||
if (pr->pr_protocol == protocol && pr->pr_sysctl) {
|
||||
KERNEL_LOCK();
|
||||
if ((pr->pr_flags & PR_MPSYSCTL) == 0)
|
||||
KERNEL_LOCK();
|
||||
error = (*pr->pr_sysctl)(name + 2, namelen - 2,
|
||||
oldp, oldlenp, newp, newlen);
|
||||
KERNEL_UNLOCK();
|
||||
if ((pr->pr_flags & PR_MPSYSCTL) == 0)
|
||||
KERNEL_UNLOCK();
|
||||
return (error);
|
||||
}
|
||||
return (ENOPROTOOPT);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uipc_mbuf.c,v 1.285 2023/05/05 01:19:51 bluhm Exp $ */
|
||||
/* $OpenBSD: uipc_mbuf.c,v 1.286 2023/05/16 20:09:27 mvs Exp $ */
|
||||
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1801,7 +1801,7 @@ sysctl_mq(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
|||
case IFQCTL_MAXLEN:
|
||||
maxlen = mq->mq_maxlen;
|
||||
error = sysctl_int(oldp, oldlenp, newp, newlen, &maxlen);
|
||||
if (!error && maxlen != mq->mq_maxlen)
|
||||
if (error == 0)
|
||||
mq_set_maxlen(mq, maxlen);
|
||||
return (error);
|
||||
case IFQCTL_DROPS:
|
||||
|
|
35
sys/net/if.c
35
sys/net/if.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if.c,v 1.696 2023/05/14 01:46:53 dlg Exp $ */
|
||||
/* $OpenBSD: if.c,v 1.697 2023/05/16 14:32:54 jan Exp $ */
|
||||
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -2109,10 +2109,9 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
|
|||
error = ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ISSET(ifr->ifr_flags, IFXF_TSO) !=
|
||||
ISSET(ifp->if_xflags, IFXF_TSO))
|
||||
error = ifsettso(ifp, ISSET(ifr->ifr_flags, IFXF_TSO));
|
||||
if (ISSET(ifr->ifr_flags, IFXF_LRO) !=
|
||||
ISSET(ifp->if_xflags, IFXF_LRO))
|
||||
error = ifsetlro(ifp, ISSET(ifr->ifr_flags, IFXF_LRO));
|
||||
|
||||
if (error == 0)
|
||||
ifp->if_xflags = (ifp->if_xflags & IFXF_CANTCHANGE) |
|
||||
|
@ -3153,37 +3152,33 @@ ifpromisc(struct ifnet *ifp, int pswitch)
|
|||
return (error);
|
||||
}
|
||||
|
||||
/* Set/clear TSO flag and restart interface if needed. */
|
||||
/* Set/clear LRO flag and restart interface if needed. */
|
||||
int
|
||||
ifsettso(struct ifnet *ifp, int on)
|
||||
ifsetlro(struct ifnet *ifp, int on)
|
||||
{
|
||||
struct ifreq ifrq;
|
||||
int error = 0;
|
||||
int s = splnet();
|
||||
|
||||
if (!ISSET(ifp->if_capabilities, IFCAP_LRO)) {
|
||||
error = ENOTSUP;
|
||||
goto out;
|
||||
}
|
||||
|
||||
NET_ASSERT_LOCKED(); /* for ioctl */
|
||||
KERNEL_ASSERT_LOCKED(); /* for if_flags */
|
||||
|
||||
if (on && !ISSET(ifp->if_xflags, IFXF_TSO)) {
|
||||
if (!ISSET(ifp->if_capabilities, IFCAP_TSO)) {
|
||||
error = ENOTSUP;
|
||||
goto out;
|
||||
}
|
||||
if (on && !ISSET(ifp->if_xflags, IFXF_LRO)) {
|
||||
if (ether_brport_isset(ifp)) {
|
||||
error = EBUSY;
|
||||
goto out;
|
||||
}
|
||||
SET(ifp->if_xflags, IFXF_TSO);
|
||||
} else if (!on && ISSET(ifp->if_xflags, IFXF_TSO))
|
||||
CLR(ifp->if_xflags, IFXF_TSO);
|
||||
SET(ifp->if_xflags, IFXF_LRO);
|
||||
} else if (!on && ISSET(ifp->if_xflags, IFXF_LRO))
|
||||
CLR(ifp->if_xflags, IFXF_LRO);
|
||||
else
|
||||
goto out;
|
||||
|
||||
#if NVLAN > 0
|
||||
/* Change TSO flag also on attached vlan(4) interfaces. */
|
||||
vlan_flags_from_parent(ifp, IFXF_TSO);
|
||||
#endif
|
||||
|
||||
/* restart interface */
|
||||
if (ISSET(ifp->if_flags, IFF_UP)) {
|
||||
/* go down for a moment... */
|
||||
|
|
10
sys/net/if.h
10
sys/net/if.h
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if.h,v 1.211 2023/03/07 20:09:48 jan Exp $ */
|
||||
/* $OpenBSD: if.h,v 1.213 2023/05/16 14:32:54 jan Exp $ */
|
||||
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -231,7 +231,7 @@ struct if_status_description {
|
|||
#define IFXF_INET6_NOSOII 0x40 /* [N] don't do RFC 7217 */
|
||||
#define IFXF_AUTOCONF4 0x80 /* [N] v4 autoconf (aka dhcp) enabled */
|
||||
#define IFXF_MONITOR 0x100 /* [N] only used for bpf */
|
||||
#define IFXF_TSO 0x200 /* [N] TCP segment offloading */
|
||||
#define IFXF_LRO 0x200 /* [N] TCP large recv offload */
|
||||
|
||||
#define IFXF_CANTCHANGE \
|
||||
(IFXF_MPSAFE|IFXF_CLONED)
|
||||
|
@ -251,7 +251,9 @@ struct if_status_description {
|
|||
#define IFCAP_VLAN_HWTAGGING 0x00000020 /* hardware VLAN tag support */
|
||||
#define IFCAP_CSUM_TCPv6 0x00000080 /* can do IPv6/TCP checksums */
|
||||
#define IFCAP_CSUM_UDPv6 0x00000100 /* can do IPv6/UDP checksums */
|
||||
#define IFCAP_TSO 0x00004000 /* TCP segment offloading */
|
||||
#define IFCAP_TSOv4 0x00001000 /* IPv4/TCP segment offload */
|
||||
#define IFCAP_TSOv6 0x00002000 /* IPv6/TCP segment offload */
|
||||
#define IFCAP_LRO 0x00004000 /* TCP large recv offload */
|
||||
#define IFCAP_WOL 0x00008000 /* can do wake on lan */
|
||||
|
||||
#define IFCAP_CSUM_MASK (IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | \
|
||||
|
@ -544,7 +546,7 @@ void if_getdata(struct ifnet *, struct if_data *);
|
|||
void ifinit(void);
|
||||
int ifioctl(struct socket *, u_long, caddr_t, struct proc *);
|
||||
int ifpromisc(struct ifnet *, int);
|
||||
int ifsettso(struct ifnet *, int);
|
||||
int ifsetlro(struct ifnet *, int);
|
||||
struct ifg_group *if_creategroup(const char *);
|
||||
int if_addgroup(struct ifnet *, const char *);
|
||||
int if_delgroup(struct ifnet *, const char *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_aggr.c,v 1.39 2022/02/05 03:56:16 dlg Exp $ */
|
||||
/* $OpenBSD: if_aggr.c,v 1.40 2023/05/16 14:32:54 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 The University of Queensland
|
||||
|
@ -2618,6 +2618,9 @@ aggr_update_capabilities(struct aggr_softc *sc)
|
|||
uint32_t capabilities = ~0;
|
||||
int set = 0;
|
||||
|
||||
/* Do not inherit LRO capabilities. */
|
||||
CLR(capabilities, IFCAP_LRO);
|
||||
|
||||
rw_enter_read(&sc->sc_lock);
|
||||
TAILQ_FOREACH(p, &sc->sc_ports, p_entry) {
|
||||
struct ifnet *ifp0 = p->p_ifp0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_bridge.c,v 1.367 2023/05/13 13:35:17 bluhm Exp $ */
|
||||
/* $OpenBSD: if_bridge.c,v 1.368 2023/05/16 14:32:54 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
|
||||
|
@ -338,7 +338,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||
*/
|
||||
|
||||
NET_LOCK();
|
||||
ifsettso(ifs, 0);
|
||||
ifsetlro(ifs, 0);
|
||||
NET_UNLOCK();
|
||||
|
||||
bif->bridge_sc = sc;
|
||||
|
@ -401,7 +401,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||
}
|
||||
|
||||
NET_LOCK();
|
||||
ifsettso(ifs, 0);
|
||||
ifsetlro(ifs, 0);
|
||||
NET_UNLOCK();
|
||||
|
||||
bif->bridge_sc = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_tpmr.c,v 1.32 2023/02/27 09:35:32 jan Exp $ */
|
||||
/* $OpenBSD: if_tpmr.c,v 1.33 2023/05/16 14:32:54 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 The University of Queensland
|
||||
|
@ -521,7 +521,7 @@ tpmr_add_port(struct tpmr_softc *sc, const struct ifbreq *req)
|
|||
goto put;
|
||||
}
|
||||
|
||||
ifsettso(ifp0, 0);
|
||||
ifsetlro(ifp0, 0);
|
||||
|
||||
p->p_ifp0 = ifp0;
|
||||
p->p_tpmr = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_veb.c,v 1.30 2023/02/27 09:35:32 jan Exp $ */
|
||||
/* $OpenBSD: if_veb.c,v 1.31 2023/05/16 14:32:54 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>
|
||||
|
@ -1465,7 +1465,7 @@ veb_add_port(struct veb_softc *sc, const struct ifbreq *req, unsigned int span)
|
|||
goto put;
|
||||
}
|
||||
|
||||
ifsettso(ifp0, 0);
|
||||
ifsetlro(ifp0, 0);
|
||||
|
||||
p->p_ifp0 = ifp0;
|
||||
p->p_veb = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_vlan.c,v 1.214 2023/04/26 00:14:21 jan Exp $ */
|
||||
/* $OpenBSD: if_vlan.c,v 1.215 2023/05/16 14:32:54 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1998 Massachusetts Institute of Technology
|
||||
|
@ -536,7 +536,8 @@ vlan_up(struct vlan_softc *sc)
|
|||
* Chips that can do hardware-assisted VLAN encapsulation, can
|
||||
* calculate the correct checksum for VLAN tagged packets.
|
||||
*/
|
||||
ifp->if_capabilities = ifp0->if_capabilities & IFCAP_CSUM_MASK;
|
||||
ifp->if_capabilities = ifp0->if_capabilities &
|
||||
(IFCAP_CSUM_MASK | IFCAP_TSOv4 | IFCAP_TSOv6);
|
||||
}
|
||||
|
||||
/* commit the sc */
|
||||
|
@ -560,9 +561,6 @@ vlan_up(struct vlan_softc *sc)
|
|||
/* configure the parent to handle packets for this vlan */
|
||||
vlan_multi_apply(sc, ifp0, SIOCADDMULTI);
|
||||
|
||||
/* Inherit flags from parent interface. */
|
||||
vlan_flags_from_parent(ifp0, IFXF_TSO);
|
||||
|
||||
/* we're running now */
|
||||
SET(ifp->if_flags, IFF_RUNNING);
|
||||
vlan_link_state(sc, ifp0->if_link_state, ifp0->if_baudrate);
|
||||
|
@ -965,28 +963,6 @@ vlan_del_parent(struct vlan_softc *sc)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
vlan_flags_from_parent(struct ifnet *ifp0, int flags)
|
||||
{
|
||||
struct vlan_softc *sc;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < TAG_HASH_SIZE; i++) {
|
||||
SMR_SLIST_FOREACH_LOCKED(sc, &vlan_tagh[i], sc_list) {
|
||||
/* vlan and tso only works with hw tagging */
|
||||
if (!ISSET(ifp0->if_capabilities, IFCAP_VLAN_HWTAGGING))
|
||||
CLR(flags, IFXF_TSO);
|
||||
|
||||
if (sc->sc_ifidx0 == ifp0->if_index) {
|
||||
if (ISSET(ifp0->if_xflags, flags))
|
||||
SET(sc->sc_if.if_xflags, flags);
|
||||
else
|
||||
CLR(sc->sc_if.if_xflags, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
vlan_set_compat(struct ifnet *ifp, struct ifreq *ifr)
|
||||
{
|
||||
|
|
23
sys/net/pf.c
23
sys/net/pf.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pf.c,v 1.1179 2023/05/13 13:35:17 bluhm Exp $ */
|
||||
/* $OpenBSD: pf.c,v 1.1180 2023/05/15 16:34:56 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Daniel Hartmeier
|
||||
|
@ -6555,15 +6555,9 @@ pf_route(struct pf_pdesc *pd, struct pf_state *st)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (ISSET(m0->m_pkthdr.csum_flags, M_TCP_TSO) &&
|
||||
m0->m_pkthdr.ph_mss <= ifp->if_mtu) {
|
||||
if (tcp_chopper(m0, &ml, ifp, m0->m_pkthdr.ph_mss) ||
|
||||
if_output_ml(ifp, &ml, sintosa(dst), rt))
|
||||
goto done;
|
||||
tcpstat_inc(tcps_outswtso);
|
||||
if (tcp_if_output_tso(ifp, &m0, sintosa(dst), rt,
|
||||
IFCAP_TSOv4, ifp->if_mtu) || m0 == NULL)
|
||||
goto done;
|
||||
}
|
||||
CLR(m0->m_pkthdr.csum_flags, M_TCP_TSO);
|
||||
|
||||
/*
|
||||
* Too large for interface; fragment if possible.
|
||||
|
@ -6598,7 +6592,6 @@ void
|
|||
pf_route6(struct pf_pdesc *pd, struct pf_state *st)
|
||||
{
|
||||
struct mbuf *m0;
|
||||
struct mbuf_list ml;
|
||||
struct sockaddr_in6 *dst, sin6;
|
||||
struct rtentry *rt = NULL;
|
||||
struct ip6_hdr *ip6;
|
||||
|
@ -6696,15 +6689,9 @@ pf_route6(struct pf_pdesc *pd, struct pf_state *st)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (ISSET(m0->m_pkthdr.csum_flags, M_TCP_TSO) &&
|
||||
m0->m_pkthdr.ph_mss <= ifp->if_mtu) {
|
||||
if (tcp_chopper(m0, &ml, ifp, m0->m_pkthdr.ph_mss) ||
|
||||
if_output_ml(ifp, &ml, sin6tosa(dst), rt))
|
||||
goto done;
|
||||
tcpstat_inc(tcps_outswtso);
|
||||
if (tcp_if_output_tso(ifp, &m0, sin6tosa(dst), rt,
|
||||
IFCAP_TSOv6, ifp->if_mtu) || m0 == NULL)
|
||||
goto done;
|
||||
}
|
||||
CLR(m0->m_pkthdr.csum_flags, M_TCP_TSO);
|
||||
|
||||
ip6stat_inc(ip6s_cantfrag);
|
||||
if (st->rt != PF_DUPTO)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_proto.c,v 1.99 2022/08/15 09:11:38 mvs Exp $ */
|
||||
/* $OpenBSD: in_proto.c,v 1.100 2023/05/16 19:36:00 mvs Exp $ */
|
||||
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -177,6 +177,7 @@ u_char ip_protox[IPPROTO_MAX];
|
|||
const struct protosw inetsw[] = {
|
||||
{
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_flags = PR_MPSYSCTL,
|
||||
.pr_init = ip_init,
|
||||
.pr_slowtimo = ip_slowtimo,
|
||||
.pr_sysctl = ip_sysctl
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_carp.c,v 1.356 2023/03/08 04:43:09 guenther Exp $ */
|
||||
/* $OpenBSD: ip_carp.c,v 1.357 2023/05/16 14:32:54 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
|
||||
|
@ -1693,7 +1693,7 @@ carp_set_ifp(struct carp_softc *sc, struct ifnet *ifp0)
|
|||
|
||||
sc->sc_carpdevidx = ifp0->if_index;
|
||||
sc->sc_if.if_capabilities = ifp0->if_capabilities &
|
||||
IFCAP_CSUM_MASK;
|
||||
(IFCAP_CSUM_MASK | IFCAP_TSOv4 | IFCAP_TSOv6);
|
||||
|
||||
SRPL_FOREACH_LOCKED(vr, cif, sc_list) {
|
||||
struct carp_vhost_entry *vrhead, *schead;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_input.c,v 1.383 2023/04/05 21:51:47 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_input.c,v 1.384 2023/05/16 19:36:00 mvs Exp $ */
|
||||
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1704,8 +1704,11 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
|
|||
return (ip_sysctl_ipstat(oldp, oldlenp, newp));
|
||||
#ifdef MROUTING
|
||||
case IPCTL_MRTSTATS:
|
||||
return (sysctl_rdstruct(oldp, oldlenp, newp,
|
||||
&mrtstat, sizeof(mrtstat)));
|
||||
KERNEL_LOCK();
|
||||
error = sysctl_rdstruct(oldp, oldlenp, newp,
|
||||
&mrtstat, sizeof(mrtstat));
|
||||
KERNEL_UNLOCK();
|
||||
return (error);
|
||||
case IPCTL_MRTMFC:
|
||||
if (newp)
|
||||
return (EPERM);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_output.c,v 1.386 2023/05/13 13:35:17 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_output.c,v 1.387 2023/05/15 16:34:56 bluhm Exp $ */
|
||||
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -460,15 +460,10 @@ sendit:
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (ISSET(m->m_pkthdr.csum_flags, M_TCP_TSO) &&
|
||||
m->m_pkthdr.ph_mss <= mtu) {
|
||||
if ((error = tcp_chopper(m, &ml, ifp, m->m_pkthdr.ph_mss)) ||
|
||||
(error = if_output_ml(ifp, &ml, sintosa(dst), ro->ro_rt)))
|
||||
goto done;
|
||||
tcpstat_inc(tcps_outswtso);
|
||||
error = tcp_if_output_tso(ifp, &m, sintosa(dst), ro->ro_rt,
|
||||
IFCAP_TSOv4, mtu);
|
||||
if (error || m == NULL)
|
||||
goto done;
|
||||
}
|
||||
CLR(m->m_pkthdr.csum_flags, M_TCP_TSO);
|
||||
|
||||
/*
|
||||
* Too large for interface; fragment if possible.
|
||||
|
@ -1887,10 +1882,15 @@ in_proto_cksum_out(struct mbuf *m, struct ifnet *ifp)
|
|||
u_int16_t csum = 0, offset;
|
||||
|
||||
offset = ip->ip_hl << 2;
|
||||
if (m->m_pkthdr.csum_flags & (M_TCP_CSUM_OUT|M_UDP_CSUM_OUT))
|
||||
if (ISSET(m->m_pkthdr.csum_flags, M_TCP_TSO)) {
|
||||
csum = in_cksum_phdr(ip->ip_src.s_addr,
|
||||
ip->ip_dst.s_addr, htonl(ip->ip_p));
|
||||
} else if (ISSET(m->m_pkthdr.csum_flags,
|
||||
M_TCP_CSUM_OUT|M_UDP_CSUM_OUT)) {
|
||||
csum = in_cksum_phdr(ip->ip_src.s_addr,
|
||||
ip->ip_dst.s_addr, htonl(ntohs(ip->ip_len) -
|
||||
offset + ip->ip_p));
|
||||
}
|
||||
if (ip->ip_p == IPPROTO_TCP)
|
||||
offset += offsetof(struct tcphdr, th_sum);
|
||||
else if (ip->ip_p == IPPROTO_UDP)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_output.c,v 1.137 2023/05/13 13:35:18 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_output.c,v 1.138 2023/05/15 16:34:56 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -80,6 +80,7 @@
|
|||
#include <sys/kernel.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/route.h>
|
||||
#if NPF > 0
|
||||
#include <net/pfvar.h>
|
||||
|
@ -753,7 +754,7 @@ send:
|
|||
|
||||
/* Enable TSO and specify the size of the resulting segments. */
|
||||
if (tso) {
|
||||
m->m_pkthdr.csum_flags |= M_TCP_TSO;
|
||||
SET(m->m_pkthdr.csum_flags, M_TCP_TSO);
|
||||
m->m_pkthdr.ph_mss = tp->t_maxseg;
|
||||
}
|
||||
|
||||
|
@ -1349,3 +1350,45 @@ tcp_chopper(struct mbuf *m0, struct mbuf_list *ml, struct ifnet *ifp,
|
|||
ml_purge(ml);
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
tcp_if_output_tso(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst,
|
||||
struct rtentry *rt, uint32_t ifcap, u_int mtu)
|
||||
{
|
||||
struct mbuf_list ml;
|
||||
int error;
|
||||
|
||||
/* caller must fail later or fragment */
|
||||
if (!ISSET((*mp)->m_pkthdr.csum_flags, M_TCP_TSO))
|
||||
return 0;
|
||||
if ((*mp)->m_pkthdr.ph_mss > mtu) {
|
||||
CLR((*mp)->m_pkthdr.csum_flags, M_TCP_TSO);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* network interface hardware will do TSO */
|
||||
if (in_ifcap_cksum(*mp, ifp, ifcap)) {
|
||||
if (ISSET(ifcap, IFCAP_TSOv4)) {
|
||||
in_hdr_cksum_out(*mp, ifp);
|
||||
in_proto_cksum_out(*mp, ifp);
|
||||
}
|
||||
#ifdef INET6
|
||||
if (ISSET(ifcap, IFCAP_TSOv6))
|
||||
in6_proto_cksum_out(*mp, ifp);
|
||||
#endif
|
||||
error = ifp->if_output(ifp, *mp, dst, rt);
|
||||
if (!error)
|
||||
tcpstat_inc(tcps_outhwtso);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* as fallback do TSO in software */
|
||||
if ((error = tcp_chopper(*mp, &ml, ifp, (*mp)->m_pkthdr.ph_mss)) ||
|
||||
(error = if_output_ml(ifp, &ml, dst, rt)))
|
||||
goto done;
|
||||
tcpstat_inc(tcps_outswtso);
|
||||
|
||||
done:
|
||||
*mp = NULL;
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_var.h,v 1.164 2023/05/10 12:07:16 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_var.h,v 1.165 2023/05/15 16:34:56 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -719,6 +719,8 @@ struct tcpcb *
|
|||
void tcp_notify(struct inpcb *, int);
|
||||
int tcp_output(struct tcpcb *);
|
||||
int tcp_chopper(struct mbuf *, struct mbuf_list *, struct ifnet *, u_int);
|
||||
int tcp_if_output_tso(struct ifnet *, struct mbuf **, struct sockaddr *,
|
||||
struct rtentry *, uint32_t, u_int);
|
||||
void tcp_pulloutofband(struct socket *, u_int, struct mbuf *, int);
|
||||
int tcp_reass(struct tcpcb *, struct tcphdr *, struct mbuf *, int *);
|
||||
void tcp_rscale(struct tcpcb *, u_long);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip6_output.c,v 1.275 2023/05/10 12:07:17 bluhm Exp $ */
|
||||
/* $OpenBSD: ip6_output.c,v 1.276 2023/05/15 16:34:57 bluhm Exp $ */
|
||||
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -706,15 +706,10 @@ reroute:
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (ISSET(m->m_pkthdr.csum_flags, M_TCP_TSO) &&
|
||||
m->m_pkthdr.ph_mss <= mtu) {
|
||||
if ((error = tcp_chopper(m, &ml, ifp, m->m_pkthdr.ph_mss)) ||
|
||||
(error = if_output_ml(ifp, &ml, sin6tosa(dst), ro->ro_rt)))
|
||||
goto done;
|
||||
tcpstat_inc(tcps_outswtso);
|
||||
error = tcp_if_output_tso(ifp, &m, sin6tosa(dst), ro->ro_rt,
|
||||
IFCAP_TSOv6, mtu);
|
||||
if (error || m == NULL)
|
||||
goto done;
|
||||
}
|
||||
CLR(m->m_pkthdr.csum_flags, M_TCP_TSO);
|
||||
|
||||
/*
|
||||
* try to fragment the packet. case 1-b
|
||||
|
@ -2715,8 +2710,13 @@ in6_proto_cksum_out(struct mbuf *m, struct ifnet *ifp)
|
|||
u_int16_t csum;
|
||||
|
||||
offset = ip6_lasthdr(m, 0, IPPROTO_IPV6, &nxt);
|
||||
csum = in6_cksum_phdr(&ip6->ip6_src, &ip6->ip6_dst,
|
||||
htonl(m->m_pkthdr.len - offset), htonl(nxt));
|
||||
if (ISSET(m->m_pkthdr.csum_flags, M_TCP_TSO)) {
|
||||
csum = in6_cksum_phdr(&ip6->ip6_src, &ip6->ip6_dst,
|
||||
htonl(0), htonl(nxt));
|
||||
} else {
|
||||
csum = in6_cksum_phdr(&ip6->ip6_src, &ip6->ip6_dst,
|
||||
htonl(m->m_pkthdr.len - offset), htonl(nxt));
|
||||
}
|
||||
if (nxt == IPPROTO_TCP)
|
||||
offset += offsetof(struct tcphdr, th_sum);
|
||||
else if (nxt == IPPROTO_UDP)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: protosw.h,v 1.59 2022/11/26 17:52:35 mvs Exp $ */
|
||||
/* $OpenBSD: protosw.h,v 1.61 2023/05/16 19:44:55 mvs Exp $ */
|
||||
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -115,22 +115,24 @@ struct protosw {
|
|||
int (*pr_sysctl)(int *, u_int, void *, size_t *, void *, size_t);
|
||||
};
|
||||
|
||||
#define PR_SLOWHZ 2 /* 2 slow timeouts per second */
|
||||
#define PR_FASTHZ 5 /* 5 fast timeouts per second */
|
||||
#define PR_SLOWHZ 2 /* 2 slow timeouts per second */
|
||||
#define PR_FASTHZ 5 /* 5 fast timeouts per second */
|
||||
|
||||
/*
|
||||
* Values for pr_flags.
|
||||
* PR_ADDR requires PR_ATOMIC;
|
||||
* PR_ADDR and PR_CONNREQUIRED are mutually exclusive.
|
||||
*/
|
||||
#define PR_ATOMIC 0x01 /* exchange atomic messages only */
|
||||
#define PR_ADDR 0x02 /* addresses given with messages */
|
||||
#define PR_CONNREQUIRED 0x04 /* connection required by protocol */
|
||||
#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */
|
||||
#define PR_RIGHTS 0x10 /* passes capabilities */
|
||||
#define PR_ABRTACPTDIS 0x20 /* abort on accept(2) to disconnected
|
||||
#define PR_ATOMIC 0x0001 /* exchange atomic messages only */
|
||||
#define PR_ADDR 0x0002 /* addresses given with messages */
|
||||
#define PR_CONNREQUIRED 0x0004 /* connection required by protocol */
|
||||
#define PR_WANTRCVD 0x0008 /* want PRU_RCVD calls */
|
||||
#define PR_RIGHTS 0x0010 /* passes capabilities */
|
||||
#define PR_ABRTACPTDIS 0x0020 /* abort on accept(2) to disconnected
|
||||
socket */
|
||||
#define PR_SPLICE 0x40 /* socket splicing is possible */
|
||||
#define PR_SPLICE 0x0040 /* socket splicing is possible */
|
||||
#define PR_MPSYSCTL 0x0080 /* (*pr_sysctl)() doesn't require
|
||||
kernel lock */
|
||||
|
||||
/*
|
||||
* The arguments to usrreq are:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue