From owner-freebsd-net@FreeBSD.ORG Thu Apr 30 13:11:29 2009 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 E34D810656B7 for ; Thu, 30 Apr 2009 13:11:28 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 5EC3C8FC08 for ; Thu, 30 Apr 2009 13:11:28 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by bwz9 with SMTP id 9so1776019bwz.43 for ; Thu, 30 Apr 2009 06:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=5RdD2I0HEMdJ6OO/PBFjVwGgp4Za1ghbbdsJUDKI/Zg=; b=g5LdFs9NffJwU+WAeoNEroMtmbGczOUdYSLE5foVpzAUrefxj8RgR6V+HgaN99tGcu qAMFWkQ5KEUTaHiPtgBLC+8xblC/mucxdkS6oq/rEvdzuZUkS8qaAO+yjMxoIi78bWyx lALSNHomQQmsgn6dtv6YXTpsjcX7C7EA73Xrk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=oXbqBy765jK3i4a+W4QCtO6Ix3RG4fGrikuyRRXZBw0yffdw3ZmvUz1jhdS/6YmuUN 4HG7yiOzHhUw5VaNhxRVQwgF2rVcIHFFuNMAr2RGR1LcR+rFVslZpIGBCq1E8aMc5c0L dZwXqbtM6DoKHzhDaJ0YnO7qFAlMLRCCVu5WE= MIME-Version: 1.0 Received: by 10.204.55.142 with SMTP id u14mr1449966bkg.121.1241097087299; Thu, 30 Apr 2009 06:11:27 -0700 (PDT) In-Reply-To: References: <5E915E92-2B82-4331-9493-739568CC6E8C@gmail.com> <2e77fc10904290733m4858172ayd96654f3a9a3a8a@mail.gmail.com> Date: Thu, 30 Apr 2009 17:11:27 +0400 Message-ID: From: pluknet To: Nikolay Denev Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-net@freebsd.org Subject: Re: bce(4) sees all incoming frames as 2026 bytes in length 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: Thu, 30 Apr 2009 13:11:29 -0000 2009/4/30 Nikolay Denev : > On Apr 29, 2009, at 7:04 PM, pluknet wrote: > >> 2009/4/29 Niki Denev : >> >>> bce1: mem >>> 0xf8000000-0xf9ffffff irq 16 at device 0.0 on pci3 >>> bce1: Ethernet address: 00:22:19:xx:xx:xx >>> bce1: [ITHREAD] >>> bce1: ASIC (0x57081020); Rev (B2); Bus (PCI-X, 64-bit, 133MHz); B/C >>> (0x04040105); Flags( MFW MSI ) >>> >>> bce1: flags=3D8843 metric 0 mtu >>> 1500 >>> >>> =A0options=3D1bb >>> =A0 =A0 =A0ether 00:22:19:xx:xx:xx >>> =A0 =A0 =A0inet 10.18.2.1 netmask 0xffffff00 broadcast 10.18.2.255 >>> =A0 =A0 =A0media: Ethernet autoselect (1000baseTX ) >>> =A0 =A0 =A0status: active >>> >>> And here is a tcpdump that shows the problem : >>> >>> 16:27:32.593808 00:22:19:yy:yy:yy > 00:22:19:xx:xx:xx, ethertype IPv4 >>> (0x0800), length 2026: (tos 0x0, ttl 64, id 45347, offset 0, flags >>> [none], proto ICMP (1), length 84) 10.18.2.2 > 10.18.2.1: ICMP echo >>> request, id 13578, seq 36, length 64 >>> 16:27:32.593817 00:22:19:xx:xx:xx > 00:22:19:yy:yy:yy, ethertype IPv4 >>> (0x0800), length 98: (tos 0x0, ttl 64, id 18415, offset 0, flags >>> [none], proto ICMP (1), length 84) 10.18.2.1 > 10.18.2.2: ICMP echo >>> reply, id 13578, seq 36, length 64 >> >> Ok, now I see. A link level length is 2026 for me too for some sort of >> packets >> (in opposite to proto's len where all is ok). >> >> Mine nic is >> (same as yours). >> >> Looks like a regression. >> I just also tested 7.1-R and it shows expected LL-length. >> >> >> -- >> wbr, >> pluknet > > > I think I got it. > > It seems that the mbuf fields m_pkthdr.len and m_len are not updated to t= he > real packet size pkt_len. > Well, actually they are updated, but only if we have ZERO_COPY_SOCKETS > defined. > > After I added this : > > =A0 m0->m_pkthdr.len =3D m0->m_len =3D pkt_len; > > at about line 5930 in if_bce.c, the frame length reported by tcpdump seem= s > correct. > JFYI In 7.1-R driver version there was length updating and it seems to be lost in 7.2-R. /* Skip over the l2_fhdr when passing the data up t= he s m_adj(m, sizeof(struct l2_fhdr) + ETHER_ALIGN); /* Adjust the packet length to match the received d= ata. m->m_pkthdr.len =3D m->m_len =3D len; /* Send the packet to the appropriate interface. */ m->m_pkthdr.rcvif =3D ifp; > P.S.: I guess this could be the cause for the lagg(4) over bce(4) problem= s > too? > > P.S.2: This fix will probably break the ZERO_COPY_SOCKETS case, but shoul= d > be fairly easy to make it a "proper" fix. At least it can be ifndef'ed out in ZERO_COPY_SOCKETS case. @@ -5926,6 +5926,11 @@ goto bce_rx_int_next_rx; } +#ifndef ZERO_COPY_SOCKETS + /* Set the total packet length. */ + m0->m_pkthdr.len =3D m0->m_len =3D pkt_len; +#endif + /* Send the packet to the appropriate interface. */ m0->m_pkthdr.rcvif =3D ifp; -eop- --=20 wbr, pluknet