Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2013 23:00:12 +0000
From:      "De La Gueronniere, Marc" <mdelagueronniere@verisign.com>
To:        Andre Oppermann <andre@freebsd.org>
Cc:        Juli Mallett <jmallett@freebsd.org>, "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, Harika Tandra <htandra@gloriad.org>, "Miller,  Vincent \(Rick\)" <vmiller@verisign.com>
Subject:   Re: Netmap ixgbe stripping Vlan tags
Message-ID:  <CE3D92C7.287AD%mdelagueronniere@verisign.com>
In-Reply-To: <52176B3A.1040804@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]


On 8/23/13 4:01 PM, "Andre Oppermann" <andre@freebsd.org> wrote:

>On 23.08.2013 15:12, Harika Tandra wrote:
>> Hi all,
>>
>> I agree with Andre's statement
>>> A netmap consumer
>>> typically doesn't expect packets be mangled at all, mostly likely
>>>netmap is
>>> expressly used to get the packet exactly as they were seen on the wire.
>>
>> For my application I want to see the whole packet as is (as seen on the
>>wire).
>> I am sure it is important for many users who are interested in
>> using netmap for speedup of packet capture in network
>>security/monitoring applications.
>>
>> When I disable "vlanhwfilter" flag on the interface. It is behaving as
>>expected and is
>> not stripping the Vlan tags when placed in promiscuous mode. Netmap
>>seems to be ignoring
>> his setting or is resetting this option  someplace (??). Any suggestion
>>on where in Netmap
>> code this maybe ?
>
>When you switch an interface to netmap mode it does a soft-reset first.
>That reverts the vlanhwfilter configuration to default on.  It's not
>netmap that does it but the driver.  It seems to happen in or around
>ixgbe_setup_vlan_hw_support().


Hi all,

I ran into this issue last week. We are using a vlan interface on top of
an ixgbe interface in netmap mode. I think there are at least two separate
problems:

-ixgbe does not let you turn off vlan tag stripping (via ifconfig
-vlanhwtag ). I am not completely sure this is a bug since vlanhwtag exact
semantic is unclear to me.

-In my opinion netmap should automatically disable vlan tag stripping and
generation since it does not support carrying the 802.1q metadata over.

I have a couple patches that I will be testing on Monday. See attachments.

Marc


>
>-- 
>Andre
>
>_______________________________________________
>freebsd-net@freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-net
>To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


[-- Attachment #2 --]
From cd7f145ca8028bf87bac6113ea5ae47525f48c0d Mon Sep 17 00:00:00 2001
From: Marc de la Gueronniere <mdelagueronniere@verisign.com>
Date: Thu, 22 Aug 2013 19:56:05 +0000
Subject: [PATCH 1/2] ixgbe: if IFCAP_VLAN_HWTAGGING is not set actually turn off vlan tag stripping.

---
 sys/dev/ixgbe/ixgbe.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c
index fcf5b6b..4483e45 100644
--- a/sys/dev/ixgbe/ixgbe.c
+++ b/sys/dev/ixgbe/ixgbe.c
@@ -4811,6 +4811,8 @@ ixgbe_setup_vlan_hw_support(struct adapter *adapter)
 	*/
 	if (adapter->num_vlans == 0)
 		return;
+	const bool hwstrip = !!(ifp->if_capenable & IFCAP_VLAN_HWTAGGING);
+
 
 	/*
 	** A soft reset zero's out the VFTA, so
@@ -4827,10 +4829,12 @@ ixgbe_setup_vlan_hw_support(struct adapter *adapter)
 		ctrl &= ~IXGBE_VLNCTRL_CFIEN;
 		ctrl |= IXGBE_VLNCTRL_VFE;
 	}
-	if (hw->mac.type == ixgbe_mac_82598EB)
+	if (hw->mac.type == ixgbe_mac_82598EB && hwstrip)
 		ctrl |= IXGBE_VLNCTRL_VME;
 	IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
 
+	if (!hwstrip)
+		return;
 	/* Setup the queues for vlans */
 	for (int i = 0; i < adapter->num_rx_queues; i++) {
 		rxr = &adapter->rx_rings[i];
-- 
1.7.4.1


[-- Attachment #3 --]
From 699af1cf596a999ed643da8b60cdd8c3f0e5fe93 Mon Sep 17 00:00:00 2001
From: Marc de la Gueronniere <mdelagueronniere@verisign.com>
Date: Fri, 23 Aug 2013 20:40:53 +0000
Subject: [PATCH 2/2] Force VLAN_HWTAGGING off in Netmap mode

---
 sys/dev/ixgbe/ixgbe.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c
index 4483e45..84abf19 100644
--- a/sys/dev/ixgbe/ixgbe.c
+++ b/sys/dev/ixgbe/ixgbe.c
@@ -4811,7 +4811,8 @@ ixgbe_setup_vlan_hw_support(struct adapter *adapter)
 	*/
 	if (adapter->num_vlans == 0)
 		return;
-	const bool hwstrip = !!(ifp->if_capenable & IFCAP_VLAN_HWTAGGING);
+	const bool hwstrip = (ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
+		&& !(ifp->if_capenable & IFCAP_NETMAP);
 
 
 	/*
-- 
1.7.4.1


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CE3D92C7.287AD%mdelagueronniere>