From owner-freebsd-net@FreeBSD.ORG Fri Aug 23 07:02:16 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D08A458A for ; Fri, 23 Aug 2013 07:02:16 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2A18F2164 for ; Fri, 23 Aug 2013 07:02:15 +0000 (UTC) Received: (qmail 84608 invoked from network); 23 Aug 2013 07:44:55 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 23 Aug 2013 07:44:55 -0000 Message-ID: <521708E8.4000105@freebsd.org> Date: Fri, 23 Aug 2013 09:02:00 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Harika Tandra Subject: Re: Netmap ixgbe stripping Vlan tags References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2013 07:02:16 -0000 On 23.08.2013 00:36, Harika Tandra wrote: > Hi all, > > I am running Netmap with "intel 10G 82598EB" card in promiscuous mode. > While capturing packets via Netmap the driver is stripping off Vlan tags. > I tested my setup, I am able to see Vlan tags when the same card is in promiscuous > mode without Netmap. > > This maybe due to the netmap related changes to the device driver code. > But I don't know much about drivers. I would appreciate any help or pointer > regarding this. This is standard behavior in FreeBSD drivers where the vlan header is removed and the vlan tag is placed in an mbuf field. Together with netmap it doesn't make sense of course and the driver should disable it when switching to netmap mode. The general usefulness of hardware vlan tag stripping/insertion is debatable as it doesn't gain much, if anything, and was intended for an entirely different purpose, namely to help the windows kernel over its total lack of vlan awareness. There an interface can be put into vlan mode where it simply listens to just one vlan as if it was native. The driver then delivers normal ethernet frames with vlan tags removed to the kernel and the other way around on send. It makes a lot of sense when the kernel isn't vlan aware because inserting and removing the vlan tag is painful then. In FreeBSD we don't have that problem as the kernel is fully vlan aware and can easily parse and insert the vlan tag itself at the same time it copies in the normal ethernet header. Packets coming down the stack have sufficient reserved leading space to add a couple of (stacked) vlan tags. Packets going up the stack can just as easily be parsed for vlan tags as well. It can be argued that in FreeBSD hardware vlan tag insert/removal is an unnecessary misfeature and only complicates things. Especially in the context of multi-vlan stacking. Doing it in software would be in fact just as fast remove a bit of code from the drivers. -- Andre