From owner-freebsd-net@freebsd.org Wed Jan 13 22:14:52 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86301A815D8; Wed, 13 Jan 2016 22:14:52 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward6h.cmail.yandex.net (forward6h.cmail.yandex.net [87.250.230.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4458B1DC0; Wed, 13 Jan 2016 22:14:51 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from web11h.yandex.ru (web11h.yandex.ru [IPv6:2a02:6b8:0:f05::21]) by forward6h.cmail.yandex.net (Yandex) with ESMTP id 3549C210F2; Thu, 14 Jan 2016 01:14:21 +0300 (MSK) Received: from 127.0.0.1 (localhost [127.0.0.1]) by web11h.yandex.ru (Yandex) with ESMTP id 540A31226BF; Thu, 14 Jan 2016 01:14:21 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1452723261; bh=Lcy6LSFjnSgPJ2i5Fn2YvhYFwdy7kQpobPvVfz2aQLA=; h=From:To:In-Reply-To:References:Subject:Date; b=LQ6xsbZbXYs568YtNbpjbIzqQ4/C0l01nw+88blM9jXcbkSnsFnkdttKHciYRsC0O 4tbw6mCEImOC02uCMuKBSB84mwZhnbfcG3PSbF/J1PbvJEfZ06as9ix5grCBNxTrWy lpznQVzjWg4FvPdJzcMNDhki9e/3ut+WRoWjPAzg= Received: by web11h.yandex.ru with HTTP; Thu, 14 Jan 2016 01:14:21 +0300 From: Alexander V. Chernikov To: Karim Fodil-Lemelin , "freebsd-ipfw@freebsd.org" , freebsd-net In-Reply-To: <5696ABBE.4050709@gmail.com> References: null <5696ABBE.4050709@gmail.com> Subject: Re: ipfw NAT, igb and hardware checksums MIME-Version: 1.0 Message-Id: <552671452723261@web11h.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 14 Jan 2016 01:14:21 +0300 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2016 22:14:52 -0000 13.01.2016, 22:56, "Karim Fodil-Lemelin" : > Hi, > > I've hit a very interesting problem with ipfw-nat and local TCP traffic > that has enough TCP options to hit a special case in m_megapullup(). > Here is the story: > > I am using the following NIC: > > igb0@pci0:4:0:0: class=0x020000 card=0x00008086 chip=0x150e8086 > rev=0x01 hdr=0x00 > > And when I do ipfw nat to locally emitted packets I see packets not > being processed in the igb driver for HW checksum. Now a quick search > for m_pullup in the igb driver code will show that our igb driver > expects a contiguous ethernet + ip header in igb_tx_ctx_setup(). Now the > friendly m_megapullup() in alias.c doesn't reserve any space before the > ip header for the ethernet header after its call to m_getcl like > tcp_output.c (see m->m_data += max_linkhdr in tcp_output.c). > > So the call to M_PREPEND() in ether_output() is forced to prepend a new > mbuf for the ethernet header, leading to a non contiguous ether + ip. > This in turn leads to a failure to properly read the IP protocol in the > igb driver and apply the proper HW checksum function. Particularly this > call in igb_tcp_ctx_setup(): ip = (struct ip *)(mp->m_data + ehdrlen); Thanks for the detailed explanation. Looks reasonable. I'll do several more tests on that and commit. > > It would be nice if some FBSD comitter could review and hopefully add > this patch to FBSD. > > Thank you, > > Karim. > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"