tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
if_ethersubr.c: if_ierrors -> if_iqdrops?
After noticing for some time now, an excessive no. of errors in my
alc(4) card's stats, this weekend, I decided to find out what
ailed it. But after poking around adding printf()s all over the
shop and comparing against 9.2_STABLE, FreeBSD-13.0 and Linux 5.0.0,
I figured out that there was nothing wrong with my card or with my
cables.
---
alc0 at pci2 dev 0 function 0: Atheros AR8162 PCIe Fast Ethernet
alc0: interrupting at ioapic0 pin 19
alc0: Ethernet address 50:46:5d:32:67:54
atphy0 at alc0 phy 0: Atheros AR8035 10/100/1000 PHY, rev. 9
---
Turns out, in 9.99.X, if_ethersubr.c is classifying all dropped/
unprocessed packets as "errors". Most of these error packets
were etype 0x88CA (TIPC (Transparent Inter Process Communication,)
or 0x893A (IEEE 1905) generated by other devices on the home LAN.
So, I hacked up a small patch to put most of these into the
"if_iqdrops" bucket. The rest (following FreeBSD) remain as errors.
As far as I'm concerned, you can silently chuck most of these errors
away--like FreeBSD does, or classify them as "dropped" like Linux does.
Either way is fine with me--just not "if_ierrors": that's too confusing.
Now, I see:
$ ifconfig -v alc0
alc0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ec_capabilities=0x3<VLAN_MTU,VLAN_HWTAGGING>
ec_enabled=0x2<VLAN_HWTAGGING>
address: 50:46:5d:32:67:54
media: Ethernet autoselect (100baseTX full-duplex,flowcontrol,rxpause,txpause)
status: active
input: 46480 packets, 60797107 bytes, 2159 multicasts, 192 queue drops
output: 25821 packets, 5636368 bytes, 37 multicasts
inet6 fe80::5246:5dff:fe32:6754%alc0/64 flags 0 scopeid 0x1
inet 192.168.68.121/24 broadcast 192.168.68.255 flags 0
$
whereas, before, all those would've been errors instead.
Thanks,
-RVP
---PATCH START---
--- sys/net/if_ethersubr.c.orig 2021-10-26 03:32:02.634325919 +0000
+++ sys/net/if_ethersubr.c 2021-11-07 23:30:56.213254316 +0000
@@ -668,8 +668,10 @@
#endif
if (__predict_false(m->m_len < sizeof(*eh))) {
- if ((m = m_pullup(m, sizeof(*eh))) == NULL)
- goto dropped;
+ if ((m = m_pullup(m, sizeof(*eh))) == NULL) {
+ if_statinc(ifp, if_ierrors);
+ return;
+ }
}
eh = mtod(m, struct ether_header *);
@@ -870,7 +872,7 @@
default:
if (subtype == 0 || subtype > 10) {
/* illegal value */
- goto drop;
+ goto error;
}
/* unknown subtype */
break;
@@ -895,7 +897,7 @@
ether_input_llc(ifp, m, eh);
return;
#else
- goto drop;
+ goto error;
#endif
}
@@ -966,7 +968,7 @@
if (__predict_false(!inq)) {
/* Should not happen. */
- goto drop;
+ goto error;
}
IFQ_ENQUEUE_ISR(inq, m, isr);
@@ -974,8 +976,12 @@
drop:
m_freem(m);
-dropped:
+ if_statinc(ifp, if_iqdrops); /* XXX should have a dedicated counter? */
+ return;
+error:
+ m_freem(m);
if_statinc(ifp, if_ierrors); /* XXX should have a dedicated counter? */
+ return;
}
/*
---PATCH END---
Home |
Main Index |
Thread Index |
Old Index