Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167149561
D58786.id183874.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D58786.id183874.diff
View Options
diff --git a/share/man/man4/epair.4 b/share/man/man4/epair.4
--- a/share/man/man4/epair.4
+++ b/share/man/man4/epair.4
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 30, 2026
+.Dd August 11, 2026
.Dt EPAIR 4
.Os
.Sh NAME
@@ -111,8 +111,12 @@
.Pp
The
.Nm
-has RXCSUM and RXCSUM6 enabled because it may receive a packet where the
-checksum has already been validated by a physical interface.
+supports RXCSUM and RXCSUM6 but does not validate a checksum.
+In case an interface previously validated the checksum,
+.Nm
+leaves the flags set that indicate a valid checksum if RXCSUM and RXCSUM6 are
+enabled or unsets these flags if RXCSUM and RXCSUM6 are disabled.
+Note that RXCSUM and RXCSUM6 can only be enabled or disabled as a pair.
.Pp
The
.Nm
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -242,6 +242,9 @@
epair_clear_mbuf(m);
if_setrcvif(m, src_ifp);
M_SETFIB(m, src_ifp->if_fib);
+ if ((if_getcapenable(src_ifp) & IFCAP_RXCSUM) == 0)
+ m->m_pkthdr.csum_flags &= ~(CSUM_L3_CALC | CSUM_L3_VALID |
+ CSUM_L4_CALC | CSUM_L4_VALID);
MPASS(m->m_nextpkt == NULL);
MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0);
@@ -455,7 +458,7 @@
{
struct epair_softc *sc;
struct ifreq *ifr;
- int error;
+ int error, cap;
ifr = (struct ifreq *)data;
switch (cmd) {
@@ -484,14 +487,19 @@
break;
case SIOCSIFCAP:
/*
- * Enable/disable capabilities as requested, besides
- * IFCAP_RXCSUM(_IPV6), which always remain enabled.
- * Incoming packets may have the mbuf flag CSUM_DATA_VALID set.
- * Without IFCAP_RXCSUM(_IPV6), this flag would have to be
- * removed, which does not seem helpful.
+ * Enable/disable capabilities as requested, but treat
+ * IFCAP_RXCSUM and IFCAP_RXCSUM_IPV6 special as they can only
+ * be set or unset as pair.
*/
- ifp->if_capenable = ifr->ifr_reqcap | IFCAP_RXCSUM |
- IFCAP_RXCSUM_IPV6;
+ cap = ifr->ifr_reqcap;
+ if (((cap & IFCAP_RXCSUM) == 0) !=
+ ((cap & IFCAP_RXCSUM_IPV6) == 0)) {
+ if ((ifp->if_capenable & IFCAP_RXCSUM) == 0)
+ cap |= (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
+ else
+ cap &= ~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
+ }
+ ifp->if_capenable = cap;
epair_caps_changed(ifp);
VLAN_CAPABILITIES(ifp);
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Aug 20, 12:23 PM (4 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36947616
Default Alt Text
D58786.id183874.diff (2 KB)
Attached To
Mode
D58786: epair: allow disabling receive checksum offloading
Attached
Detach File
Event Timeline
Log In to Comment