From owner-freebsd-net@FreeBSD.ORG Thu Apr 30 13:33:02 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 189A2106566B for ; Thu, 30 Apr 2009 13:33:02 +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 9177B8FC08 for ; Thu, 30 Apr 2009 13:33:01 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by bwz9 with SMTP id 9so1788489bwz.43 for ; Thu, 30 Apr 2009 06:33:00 -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=TGH4RcTncfDC5DugFZaEv7uiNUrBXWEyjRS4Rs3fUk0=; b=DSu2Lulwht6y5Fg5ZkW1q12DbB0pijxmaVHAHDFot7e8FG6d88Wa+mlh1ZTFtfMIgm Cmpmm0qR62kLMQALZpAMOvOkjQRdnKgenKnSuNZ0xx6Cjd/dHGB18cvZqWxTxMPU0NIs NtDe+86lznOZZSwazOm1gMjxpVQx4cbyBAFow= 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=iiwiaXYOXVudNhXR5mV8SOq23edOfOwRLK88QT5nX2aTA5zMgmS0jZU/PYGR0Bgp26 V+g/hh4aY3y4nh6tH5TEjelz8VyobGiVwHsSaEfQJUvzrhEEDv7wzBdHLE6Ls5kZND1j 9A3+8nd7f2wch6c/OUZKkCZwTFERi3PIKxmLU= MIME-Version: 1.0 Received: by 10.103.165.18 with SMTP id s18mr949035muo.124.1241098380259; Thu, 30 Apr 2009 06:33:00 -0700 (PDT) In-Reply-To: References: <5E915E92-2B82-4331-9493-739568CC6E8C@gmail.com> <2e77fc10904290733m4858172ayd96654f3a9a3a8a@mail.gmail.com> <5FD800FE-23E5-482E-8491-564FE52D91D5@gmail.com> Date: Thu, 30 Apr 2009 17:33:00 +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) and lagg(4) fix [was: 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:33:02 -0000 2009/4/30 Nikolay Denev : > On Apr 30, 2009, at 3:04 PM, Nikolay Denev wrote: > [snip] >>> >>> I think I got it. >>> >>> It seems that the mbuf fields m_pkthdr.len and m_len are not updated to >>> the 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 >>> seems correct. >>> >>> P.S.: I guess this could be the cause for the lagg(4) over bce(4) >>> problems too? >>> >>> P.S.2: This fix will probably break the ZERO_COPY_SOCKETS case, but >>> should be fairly easy to make it a "proper" fix. >>> >>> Regards, >>> Niki Denev >>> >> >> I can confirm that with this fix I was able to create lagg(4) interface = in >> "failover" mode with only one member, a =A0bce(4) interface, and it seem= s to >> work OK. >> >> > > Here is the patch : > > --- sys/dev/bce/if_bce.c.orig =A0 2009-04-30 14:06:54.000000000 +0200 > +++ sys/dev/bce/if_bce.c =A0 =A0 =A0 =A02009-04-30 14:11:32.000000000 +02= 00 > @@ -5926,6 +5926,11 @@ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto bce_rx_int_next_rx; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > +#ifndef ZERO_COPY_SOCKETS > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Adjust the packet length to match the re= ceived data. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 m0->m_pkthdr.len =3D m0->m_len =3D pkt_len; > +#endif > + > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Send the packet to the appropriate inte= rface. */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m0->m_pkthdr.rcvif =3D ifp; > Ha-ha, you was fast! The only note: I think the comment part should be consistent with ZERO_COPY_SOCKETS case. Thank you. --=20 wbr, pluknet