git: 57e7572fcbe8 - stable/15 - iflib: handle transient errors from isc_txd_encap()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Oct 2026 06:03:05 UTC
The branch stable/15 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=57e7572fcbe84d45de5eddfba4b9c387c47c325f
commit 57e7572fcbe84d45de5eddfba4b9c387c47c325f
Author: Andrew Gallatin <gallatin@FreeBSD.org>
AuthorDate: 2026-06-15 14:20:41 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 05:28:16 +0000
iflib: handle transient errors from isc_txd_encap()
Until we introduced support for nic ktls offload, all error returns
from isc_txd_encap() indicated a permanent failure. Iflib remapped all
those failures to ENOMEM, which was treated by the tcp stack as a
permanent error and passed back to the caller. This was done to avoid
creating "infinite loops" where a packet couldn't be mapped for
transmit, and kept being sent over and over.
Now that we have support for nic ktls offload, some ktls offload
drivers may return ENOBUFS from their encap function to indicate that,
for example, the ktls context may not yet be fully initialized. This
needs to be treated as a transient error so that the TCP stack may
re-try at a later time. To achieve this, pass the raw error back to
the caller when the encap routine returns an error aside from EFBIG.
Note that I audited all in-tree iflib drivers. Only ice and ixl ran
return anything other than 0 from their encap, which is EFBIG. both of
which are still treated as they were before.
Testing with an out-of-tree ktls offload nic using iflib showed ENOMEM
errors from sendmsg() before this change, and no more errors passed
back to userspace after this change.
Reviewed by: kp, sumit.saxena_broadcom.com
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D57550
(cherry picked from commit 074ff8746388b3ed8581a84a7eea7b4b3e1bfe23)
---
sys/net/iflib.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 3f7b1b84b514..f8403ff7c1a4 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -3824,8 +3824,9 @@ defrag:
remap = 1;
goto defrag;
}
+ goto defrag_failed;
}
- goto defrag_failed;
+ goto out_with_error;
}
/*
* err can't possibly be non-zero here, so we don't neet to test it
@@ -3834,13 +3835,15 @@ defrag:
return (err);
defrag_failed:
+ err = ENOMEM;
txq->ift_mbuf_defrag_failed++;
+out_with_error:
txq->ift_map_failed++;
m_freem(*m_headp);
DBG_COUNTER_INC(tx_frees);
*m_headp = NULL;
DBG_COUNTER_INC(encap_txd_encap_fail);
- return (ENOMEM);
+ return (err);
}
static void