-.\" $OpenBSD: ifconfig.8,v 1.390 2023/02/27 14:53:38 jmc Exp $
+.\" $OpenBSD: ifconfig.8,v 1.391 2023/03/07 20:09:47 jan Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd $Mdocdate: February 27 2023 $
+.Dd $Mdocdate: March 7 2023 $
.Dt IFCONFIG 8
.Os
.Sh NAME
.Xr aggr 4 ,
and
.Xr carp 4 .
+It is not possible to use TSO with interfaces attached to a
+.Xr bridge 4 ,
+.Xr veb 4 ,
+or
+.Xr tpmr 4 .
Changing this option will re-initialize the network interface.
.It Cm -tso
Disable TSO.
-/* $OpenBSD: if.c,v 1.684 2023/02/27 09:35:32 jan Exp $ */
+/* $OpenBSD: if.c,v 1.685 2023/03/07 20:09:48 jan Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
}
#endif
- if (ISSET(ifp->if_capabilities, IFCAP_TSO) &&
- ISSET(ifr->ifr_flags, IFXF_TSO) !=
- ISSET(ifp->if_xflags, IFXF_TSO)) {
- if (ISSET(ifr->ifr_flags, IFXF_TSO))
- ifsettso(ifp, 1);
- else
- ifsettso(ifp, 0);
- } else if (!ISSET(ifp->if_capabilities, IFCAP_TSO) &&
- ISSET(ifr->ifr_flags, IFXF_TSO)) {
- ifr->ifr_flags &= ~IFXF_TSO;
- error = ENOTSUP;
- }
+ if (ISSET(ifr->ifr_flags, IFXF_TSO) !=
+ ISSET(ifp->if_xflags, IFXF_TSO))
+ error = ifsettso(ifp, ISSET(ifr->ifr_flags, IFXF_TSO));
if (error == 0)
ifp->if_xflags = (ifp->if_xflags & IFXF_CANTCHANGE) |
}
/* Set/clear TSO flag and restart interface if needed. */
-void
+int
ifsettso(struct ifnet *ifp, int on)
{
struct ifreq ifrq;
+ int error = 0;
int s = splnet();
NET_ASSERT_LOCKED(); /* for ioctl */
KERNEL_ASSERT_LOCKED(); /* for if_flags */
- if (on && !ISSET(ifp->if_xflags, IFXF_TSO))
+ if (on && !ISSET(ifp->if_xflags, IFXF_TSO)) {
+ if (!ISSET(ifp->if_capabilities, IFCAP_TSO)) {
+ error = ENOTSUP;
+ goto out;
+ }
+ if (ether_brport_isset(ifp)) {
+ error = EBUSY;
+ goto out;
+ }
SET(ifp->if_xflags, IFXF_TSO);
- else if (!on && ISSET(ifp->if_xflags, IFXF_TSO))
+ } else if (!on && ISSET(ifp->if_xflags, IFXF_TSO))
CLR(ifp->if_xflags, IFXF_TSO);
else
goto out;
}
out:
splx(s);
+
+ return error;
}
void
-/* $OpenBSD: if.h,v 1.210 2023/02/27 09:35:32 jan Exp $ */
+/* $OpenBSD: if.h,v 1.211 2023/03/07 20:09:48 jan Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
void ifinit(void);
int ifioctl(struct socket *, u_long, caddr_t, struct proc *);
int ifpromisc(struct ifnet *, int);
-void ifsettso(struct ifnet *, int);
+int ifsettso(struct ifnet *, int);
struct ifg_group *if_creategroup(const char *);
int if_addgroup(struct ifnet *, const char *);
int if_delgroup(struct ifnet *, const char *);