From owner-freebsd-net@FreeBSD.ORG Tue May 6 07:45:13 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D0AE106567B for ; Tue, 6 May 2008 07:45:13 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.31]) by mx1.freebsd.org (Postfix) with ESMTP id 1950F8FC1F for ; Tue, 6 May 2008 07:45:12 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so659768ywe.13 for ; Tue, 06 May 2008 00:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=Bhn2/X2cDmt+kj6uobw4RrMkeYqoO0k/kwYVwT1STs4=; b=KwegexvT7Xq6oP6wjSl4boo5oXBE6PGc2FBOPRJ0Z4sBHIKPtlgeOoI0VAJoBh2I5+b2Cz1i8EmM9sDvbfR4azaxANZVuMfr/tB+UYB7sjkV6FNfaQ4pgH6MAApv5JXp7ZzBaPov76BDBYn4B5/ZvlUpb6a2i0vCX9mUCHF0rCw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=IFfEfdleMt+JEhTyjqkBp2Wn4/pAhIDYFoyozRRxB3HfhdJR7QeUmIdZ/Vg1KFCOjVIinF+tpL0ZWHOuE4e1S0E7Xt9VjJkZWfSbENwbEqh6+RPicPhs8e7h5Ferwh85ZwXOQIfckoHzh/Qion4f+JUrw5mbSnmV7CyzTiPFQ/U= Received: by 10.150.86.10 with SMTP id j10mr369820ybb.211.1210059907199; Tue, 06 May 2008 00:45:07 -0700 (PDT) Received: by 10.151.84.2 with HTTP; Tue, 6 May 2008 00:45:07 -0700 (PDT) Message-ID: <20def4870805060045l2660b363o5c42631b706f61b6@mail.gmail.com> Date: Tue, 6 May 2008 10:45:07 +0300 From: "Mr Y" To: "Yehonatan Yossef" In-Reply-To: <6C2C79E72C305246B504CBA17B5500C903E6C7C6@mtlexch01.mtl.com> MIME-Version: 1.0 References: <6C2C79E72C305246B504CBA17B5500C903E6C7C6@mtlexch01.mtl.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Tom Judge , freebsd-net@freebsd.org, Sam Leffler , freebsd-questions@freebsd.org Subject: Re: OS throws away large packets X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2008 07:45:13 -0000 > > > >>> Hi all, > > >>> > > >>> I'm trying to implement Large Recieve Offload for an > > >>> > > >> Ethernet driver > > >> > > >>> on FreeBSD 6.3, but all my >MTU packets are being thrown > > by the OS. > > >>> I'm using mbuf chains in this imlpementation, each mbuf is > > >>> > > >> a cluster > > >> > > >>> of MCLBYTES bytes. They are linked by the m_next pointer. > > >>> The first packet being thrown away is 2945 bytes long. > > >>> > > >> Wireshark shows > > >> > > >>> the packet that is being passed to the OS is correct. > > >>> > > >>> Do I need to set some OS parameter to make it recieve mbuf chains? > > >>> > > >>> Please help. > > >>> > > >>> > > >> Hi Yony, > > >> > > >> I seem to remember some discussion about this list last > > year see the > > >> following threads: > > >> > > >> > > >> > > > > > > http://lists.freebsd.org/pipermail/freebsd-net/2007-September/015250.htm > l > > > > > > > > > http://lists.freebsd.org/pipermail/freebsd-net/2007-September/015350.htm > l > > > > > > >From my limited reading of these threads just now and possibly bad > > > memory. It would seem that the MRU to MTU relationship is > > defined in > > > the nic driver rather than > > > > > >> enforced further up the stack or at least that seamed to > > be the case > > >> > > > with the bce driver. > > > > > >> Hope this is helpful, > > >> > > >> Tom > > >> > > > > > > Hi Tom, > > > > > > >From what I understand these threads are referring to the bce > > > >hardware > > > configuration (bus configuration) and driver mbuf > > allocation size. Am > > > I correct? > > > In my case I'm not trying to receive packets >MTU from the > > HW, but to > > > chain mbuf clusters, each is MCLBYTES long, and pass the > > mbuf chain to > > > the OS. > > > Since tcpdump (analyzed by wireshark) catches the packets above the > > > driver and reports a good packet (and 2945 bytes long), I assume my > > > driver functionality is ok. From what I know tcpdump is supposed to > > > immitate the way the stack sees the packet, yet it is discarded. > > > My logic says there is an OS parameter handled by the > > driver (at net > > > device init time for example) that will set the OS to receive large > > > mbuf chains, or a kernel tcp parameter. Is the tcp stack > > submitted to > > > the mtu somehow? > > > > > > > > I don't see where you've identified what version of the os you're > > working with. There's a check in the 802.3 input path on earlier > > systems to discard frames >mtu. This was removed not too long ago > > with LRO in mind; check the history of sys/net/if_ethersubr.c. > > > > Sam > > > > Hi Sam, I have mentioned working on 6.3. > > FreeBSD 6.2 had this check in if_ethersubr.c / ether_input: > > 539 if (m->m_pkthdr.len > > 540 ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) { > 541 if_printf(ifp, "discard oversize frame " > 542 "(ether type %x flags %x len %u > > max %lu)\n", > 543 etype, m->m_flags, m->m_pkthdr.len, > 544 ETHER_MAX_FRAME(ifp, etype, > 545 m->m_flags & > M_HASFCS)); > 546 ifp->if_ierrors++; > 547 m_freem(m); > 548 return; > 549 } > > Patching it was explained by neterion in > http://trac.neterion.com/cgi-bin/trac.cgi/wiki/FreeBSD. > This check no longer exists in 6.3, nor any other oversize packet > handling (I couldn't find any so far). > I also get no error prints from the OS. > The problem was in my packet, after I put some traces in netinet/ip_input.c I found out my m_pkthdr.len was not properly updated. Thanks