Date: Thu, 4 Jul 2024 16:57:53 GMT From: Zhenlei Huang <zlei@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 09164454aa4c - main - ethernet: Retire M_HASFCS Message-ID: <202407041657.464Gvrr6034082@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=09164454aa4c1868abf1ea724ec6160c4a556bdd commit 09164454aa4c1868abf1ea724ec6160c4a556bdd Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2024-07-04 16:53:51 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2024-07-04 16:53:51 +0000 ethernet: Retire M_HASFCS The mbuf flag M_HASFCS was introduced for drivers to indicate the net stack that packets include FCS (Frame Check Sequence). In principle, to be efficient, FCS should always be processed by hardware, firmware, or at last sort the driver. Well, Ethernet specifies that damaged frames should be discarded, thus only good ones will be passed up to the net stack, then it makes no senses for the net stack to see FCS just to trim it. The last consumer of the flag M_HASFCS has been removed since change [1]. It is time to retire it. 1. 105a4f7b3cb6 ng_atmllc: remove Reviewed by: kp MFC after: never Differential Revision: https://reviews.freebsd.org/D42391 --- sys/net/debugnet.c | 4 ---- sys/net/ethernet.h | 1 - sys/net/if_ethersubr.c | 10 ---------- 3 files changed, 15 deletions(-) diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index c6f57ec84618..8b1419bcaa28 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -570,10 +570,6 @@ debugnet_input_one(struct ifnet *ifp, struct mbuf *m) m->m_len, m->m_pkthdr.len); goto done; } - if ((m->m_flags & M_HASFCS) != 0) { - m_adj(m, -ETHER_CRC_LEN); - m->m_flags &= ~M_HASFCS; - } eh = mtod(m, struct ether_header *); etype = ntohs(eh->ether_type); if ((m->m_flags & M_VLANTAG) != 0 || etype == ETHERTYPE_VLAN) { diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index e7313e78c5bb..cf92145eea8f 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -40,7 +40,6 @@ /* * Ethernet-specific mbuf flags. */ -#define M_HASFCS M_PROTO5 /* FCS included at end of frame */ #define M_BRIDGE_INJECT M_PROTO6 /* if_bridge-injected frame */ /* diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index eeb2c1ea4ef3..6cd5cefa9609 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -588,16 +588,6 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m) */ ETHER_BPF_MTAP(ifp, m); - /* - * If the CRC is still on the packet, trim it off. We do this once - * and once only in case we are re-entered. Nothing else on the - * Ethernet receive path expects to see the FCS. - */ - if (m->m_flags & M_HASFCS) { - m_adj(m, -ETHER_CRC_LEN); - m->m_flags &= ~M_HASFCS; - } - if (!(ifp->if_capenable & IFCAP_HWSTATS)) if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407041657.464Gvrr6034082>