From b6af0abdc4c53aa47b2efd006d9ce9134971fafa Mon Sep 17 00:00:00 2001 From: Andrew Gallatin Date: Mon, 11 Jun 2007 14:59:56 +0000 Subject: [PATCH] Allow drivers, such as cxgb and mxge, which support LRO to bypass the MTU check in ether_input() on LRO merged frames. Discussed with: kmacy --- sys/dev/mxge/mxge_lro.c | 1 + sys/net/if_ethersubr.c | 3 ++- sys/sys/mbuf.h | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/mxge/mxge_lro.c b/sys/dev/mxge/mxge_lro.c index 7080588b396c..78e12202e2ad 100644 --- a/sys/dev/mxge/mxge_lro.c +++ b/sys/dev/mxge/mxge_lro.c @@ -99,6 +99,7 @@ mxge_lro_flush(mxge_softc_t *mgp, struct lro_entry *lro) CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR; lro->m_head->m_pkthdr.csum_data = 0xffff; lro->m_head->m_pkthdr.len = lro->len; + lro->m_head->m_flags |= M_LRO; /* incorporate the latest ack into the tcp header */ tcp = (struct tcphdr *) (ip + 1); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 1fabaca614dc..41a24674c966 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -542,7 +542,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m) } eh = mtod(m, struct ether_header *); etype = ntohs(eh->ether_type); - if (m->m_pkthdr.len > + if ((m->m_flags & M_LRO) == 0 && + m->m_pkthdr.len > ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) { if_printf(ifp, "discard oversize frame " "(ether type %x flags %x len %u > max %lu)\n", diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 10e7915309a1..345e9d3debb1 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -192,6 +192,7 @@ struct mbuf { #define M_LASTFRAG 0x2000 /* packet is last fragment */ #define M_VLANTAG 0x10000 /* ether_vtag is valid */ #define M_PROMISC 0x20000 /* packet was not for us */ +#define M_LRO 0x40000 /* packet is LRO merged and may exceed mtu */ /* * External buffer types: identify ext_buf type. @@ -214,7 +215,7 @@ struct mbuf { #define M_COPYFLAGS (M_PKTHDR|M_EOR|M_RDONLY|M_PROTO1|M_PROTO1|M_PROTO2|\ M_PROTO3|M_PROTO4|M_PROTO5|M_SKIP_FIREWALL|\ M_BCAST|M_MCAST|M_FRAG|M_FIRSTFRAG|M_LASTFRAG|\ - M_VLANTAG|M_PROMISC) + M_VLANTAG|M_PROMISC|M_LRO) /* * Flags to purge when crossing layers.