From owner-freebsd-net@FreeBSD.ORG Fri Nov 26 02:51:07 2010 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 DB028106564A for ; Fri, 26 Nov 2010 02:51:07 +0000 (UTC) (envelope-from beezarliu@yahoo.com.cn) Received: from nm11-vm0.bullet.mail.ne1.yahoo.com (nm11-vm0.bullet.mail.ne1.yahoo.com [98.138.90.58]) by mx1.freebsd.org (Postfix) with SMTP id 977C68FC16 for ; Fri, 26 Nov 2010 02:51:07 +0000 (UTC) Received: from [98.138.90.49] by nm11.bullet.mail.ne1.yahoo.com with NNFMP; 26 Nov 2010 02:37:16 -0000 Received: from [98.138.84.39] by tm2.bullet.mail.ne1.yahoo.com with NNFMP; 26 Nov 2010 02:37:16 -0000 Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 26 Nov 2010 02:37:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.cn; s=s1024; t=1290739036; bh=ofcc7AxKxakVvca2V7b9wHEI42Cbr1eNfFfoCuoGeho=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Subject:Message-ID:X-mailer:Mime-Version:Content-Type; b=MlEDyQW+Z6WyWz6BcwosRBiAm0Wokljq0W0TEWP6qMGM0LgmzVw8n5bU2y/0RnKQkIacKi8gT/W/nFuUK+Wof5/UpucO8hKy2PssRXmtj0CKDjujkDjSWiL0XCAekl2ij36DqB+Wl4g2PrzlRIF3aIM33SlL2TVXJhuRHmAALB4= X-Yahoo-Newman-Id: 132881.95386.bm@smtp107.mail.ne1.yahoo.com Received: from china (beezarliu@180.168.37.66 with login) by smtp107.mail.ne1.yahoo.com with SMTP; 25 Nov 2010 18:37:15 -0800 PST X-Yahoo-SMTP: YP5UPy2swBBHZGZlvbmOrntlD3fotw-- X-YMail-OSG: 4wZrMQwVM1kJwLElyRy15isUQnKEBmS8PmNGwB1mDU8InUd GBJ0amSy.IoLQrcxx9X7b_tmNEQNFhmTzEibawzk5SsIoNsJn.lg3.Talw_G 9A7OOz0C6nNQsNjS95XbK50T.XrbCRqHY0q.dZN7ET8imdTx6ats8J_ujnNp 8Rn1Nmi3O56xa7NMiIGoMXBnd6afXHqQIzv6IPxlwugKkBh4tnQcgOPjp9AT noguElvHNyK8UlUqWEwcuBnn4eOktuysgr5RnuuQ- X-Yahoo-Newman-Property: ymail-3 Date: Fri, 26 Nov 2010 10:37:12 +0800 From: "beezarliu" To: "freebsd-net" Message-ID: <201011261037105152721@yahoo.com.cn> X-mailer: Foxmail 6, 10, 201, 20 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: 82599 receiving packets with vlan tag=0 (vlan strip problem)? 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: Fri, 26 Nov 2010 02:51:07 -0000 Hi, We currently did a testing with a Intel dual-port 10G NICs. The driver version is "2.0.1". A: 82599, the chipset id is 0x10fb. B: 82598. When I config a vlan 77 on both machines, and ping B from A, I captured the packets on A: tcpdump: WARNING: ix0: no IPv4 address assigned tcpdump: listening on ix0, link-type EN10MB (Ethernet), capture size 50000 bytes 15:12:18.508614 00:0c:bd:00:9d:82 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 77, p 0, ethertype ARP, arp who-has 192.168.111.1 tell 192.168.111.2 0x0000: ffff ffff ffff 000c bd00 9d82 8100 004d ...............M 0x0010: 0806 0001 0800 0604 0001 000c bd00 9d82 ................ 0x0020: c0a8 6f02 0000 0000 0000 c0a8 6f01 ..o.........o. 15:12:18.508913 00:1b:21:3b:e6:39 > 00:0c:bd:00:9d:82, ethertype 802.1Q (0x8100), length 64: vlan 0, p 0, ethertype 802.1Q, vlan 77, p 0, ethertype ARP, arp reply 192.168.111.1 is-at 00:1b:21:3b:e6:39 0x0000: 000c bd00 9d82 001b 213b e639 8100 0000 ........!;.9.... 0x0010: 8100 004d 0806 0001 0800 0604 0002 001b ...M............ 0x0020: 213b e639 c0a8 6f01 000c bd00 9d82 c0a8 !;.9..o......... 0x0030: 6f02 0000 0000 0000 0000 0000 0000 0000 o............... At the same time, I captured the following packets on B: 15:13:03.958850 00:0c:bd:00:9d:82 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 56: arp who-has 192.168.111.1 tell 192.168.111.2 0x0000: ffff ffff ffff 000c bd00 9d82 0806 0001 ................ 0x0010: 0800 0604 0001 000c bd00 9d82 c0a8 6f02 ..............o. 0x0020: 0000 0000 0000 c0a8 6f01 0000 0000 0000 ........o....... 0x0030: 0000 0000 0000 0000 ........ 15:13:03.958864 00:1b:21:3b:e6:39 > 00:0c:bd:00:9d:82, ethertype ARP (0x0806), length 42: arp reply 192.168.111.1 is-at 00:1b:21:3b:e6:39 0x0000: 000c bd00 9d82 001b 213b e639 0806 0001 ........!;.9.... 0x0010: 0800 0604 0002 001b 213b e639 c0a8 6f01 ........!;.9..o. 0x0020: 000c bd00 9d82 c0a8 6f02 ........o. As you can see, the second packet A received had two vlan tags, the outer is 0, the inner is 77. So I digged into the source and added debugging information on our running system, and found the vlan stripping for 82599 work very strange. The VP bit in receiving descriptor is set, but vlan tag is still zero, and the real tag is not stripped! The datasheet says: 7.4.3.2 Stripping 802.1q Tags on Receives Software might instruct the 82599 to strip 802.1q VLAN tags from received packets. The policy whether to strip the VLAN tag is configurable per queue. If the RXDCTL.VME bit for a given queue is set to 1b, and the incoming packet is an 802.1q VLAN packet (that is, its Ethernet Type field matched the VLNCTRL.VET), then the 82599 strips the 4-byte VLAN tag from the packet, and stores the TCI in the VLAN Tag field of the receive descriptor. The 82599 also sets the VP bit in the receive descriptor to indicate that the packet had a VLAN tag that was stripped. If the RXDCTL.VME bit is not set, the 802.1q packets can still be received if they pass the receive filter, but the VLAN tag is not stripped and the VP bit is not set. Any commet? Thanks 2010-11-26 beezarliu