Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177845871
D56338.1795417061.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D56338.1795417061.diff
View Options
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -3478,7 +3478,7 @@
}
static int
-iflib_encap(iflib_txq_t txq, struct mbuf **m_headp)
+iflib_encap(iflib_txq_t txq, struct mbuf **m_headp, int *obytes, int *opkts)
{
if_ctx_t ctx;
if_shared_ctx_t sctx;
@@ -3663,6 +3663,20 @@
*/
txq->ift_pidx = pi.ipi_new_pidx;
txq->ift_npending += pi.ipi_ndescs;
+
+ /*
+ * Update packets / bytes sent
+ */
+ if (flags & IFLIB_TSO) {
+ int hlen = pi.ipi_ehdrlen + pi.ipi_ip_hlen + pi.ipi_tcp_hlen;
+ int tsolen = pi.ipi_len - hlen;
+ int nsegs = (tsolen + pi.ipi_tso_segsz - 1) / pi.ipi_tso_segsz;
+ *obytes += tsolen + nsegs * hlen;
+ *opkts += nsegs;
+ } else {
+ *obytes += pi.ipi_len;
+ *opkts += 1;
+ }
} else {
*m_headp = m_head = iflib_remove_mbuf(txq);
if (err == EFBIG) {
@@ -3918,7 +3932,7 @@
skipped++;
continue;
}
- err = iflib_encap(txq, mp);
+ err = iflib_encap(txq, mp, &bytes_sent, &pkt_sent);
if (__predict_false(err)) {
/* no room - bail out */
if (err == ENOBUFS)
@@ -3927,10 +3941,8 @@
/* we can't send this packet - skip it */
continue;
}
- pkt_sent++;
m = *mp;
DBG_COUNTER_INC(tx_sent);
- bytes_sent += m->m_pkthdr.len;
mcast_sent += !!(m->m_flags & M_MCAST);
if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)))
@@ -7136,6 +7148,8 @@
if_ctx_t ctx;
iflib_txq_t txq;
int error;
+ int bytes_sent = 0;
+ int pkt_sent = 0;
ctx = if_getsoftc(ifp);
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
@@ -7143,7 +7157,7 @@
return (EBUSY);
txq = &ctx->ifc_txqs[0];
- error = iflib_encap(txq, &m);
+ error = iflib_encap(txq, &m, &bytes_sent, &pkt_sent);
if (error == 0)
(void)iflib_txd_db_check(txq, true);
return (error);
@@ -7209,10 +7223,8 @@
txq = iflib_simple_select_queue(ctx, m);
mtx_lock(&txq->ift_mtx);
- error = iflib_encap(txq, &m);
+ error = iflib_encap(txq, &m, &bytes_sent, &pkt_sent);
if (error == 0) {
- pkt_sent++;
- bytes_sent += m->m_pkthdr.len;
mcast_sent += !!(m->m_flags & M_MCAST);
(void)iflib_txd_db_check(txq, true);
} else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 23, 6:57 AM (11 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41899319
Default Alt Text
D56338.1795417061.diff (2 KB)
Attached To
Mode
D56338: iflib: accurately account for TSO packets & transmitted
Attached
Detach File
Event Timeline