From sp@rvrng.ra.alkor.ru  Sat Nov  8 09:49:42 2003
Return-Path: <sp@rvrng.ra.alkor.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 847A016A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  8 Nov 2003 09:49:42 -0800 (PST)
Received: from rvrng.alkor.ru (rvrng.ra.alkor.ru [194.186.122.164])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7891043FBD
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  8 Nov 2003 09:49:40 -0800 (PST)
	(envelope-from sp@rvrng.ra.alkor.ru)
Received: from rvrng.alkor.ru (localhost [127.0.0.1])
	by rvrng.alkor.ru (8.12.9p2/8.12.9) with ESMTP id hA8He3N3002066
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 8 Nov 2003 20:40:03 +0300 (MSK)
	(envelope-from sp@rvrng.ra.alkor.ru)
Received: (from sp@localhost)
	by rvrng.alkor.ru (8.12.9p2/8.12.9/Submit) id hA8He2gF002065;
	Sat, 8 Nov 2003 20:40:02 +0300 (MSK)
	(envelope-from sp)
Message-Id: <200311081740.hA8He2gF002065@rvrng.alkor.ru>
Date: Sat, 8 Nov 2003 20:40:02 +0300 (MSK)
From: sp@alkor.ru
Reply-To: sp@alkor.ru
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: nge0 swaps vlan tag bytes.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         59062
>Category:       kern
>Synopsis:       nge0 swaps vlan tag bytes.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 08 09:50:14 PST 2003
>Closed-Date:    Fri Jul 23 17:19:16 GMT 2004
>Last-Modified:  Fri Jul 23 17:19:16 GMT 2004
>Originator:     
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
>Environment:
System: FreeBSD rvrng.alkor.ru 4.9-STABLE FreeBSD 4.9-STABLE #3: Sat Nov 1 23:12:12 MSK 2003 root@rvrng.alkor.ru:/usr/obj/usr/src/sys/RVRNG i386


>Description:
	Ethernet adapter: Surecom Technology EP-320G-TX
	Driver nge.

	nge driver reports vlan_id in swapped byteorder. Of course
	problem may be somewhere else.

	For example with vlan_id 121 I've got vlan_id 2304 = (121*256) & 0x0fff;

	Will FreeBSD team support nge driver in future or it's abandoned now?

>How-To-Repeat:
	Need a lot of equipment.
	Simplest way tcpdump -n -i nge0 vlan on port with vlan encapsulation
	with known vlan ids.

>Fix:
	May be it's a time to buy another gigabit card :(
>Release-Note:
>Audit-Trail:

From: Sergey Potapov <sp@ws.alkor.ru>
To: freebsd-gnats-submit@FreeBSD.org, sp@alkor.ru
Cc:  
Subject: Re: kern/59062: nge0 swaps vlan tag bytes.
Date: Sun, 9 Nov 2003 20:13:52 +0300

 Addition.
 
 After applying simple path:
 =================================================================================
 --- if_nge.c.orig       Thu Feb  6 01:03:57 2003
 +++ if_nge.c    Sun Nov  9 18:41:27 2003
 @@ -1467,7 +1467,7 @@
                  * to vlan_input() instead of ether_input().
                  */
                 if (extsts & NGE_RXEXTSTS_VLANPKT) {
 -                       VLAN_INPUT_TAG(eh, m, extsts & NGE_RXEXTSTS_VTCI);
 +                       VLAN_INPUT_TAG(eh, m, ntohs(extsts & NGE_RXEXTSTS_VTCI));
                          continue;
                  }
 =================================================================================
 I've got the following results:
 
 1. I can see right vlan tag and vlan interface receives packets as
 desired.
 2. vlan inteface if configured as -link0 (software tag insertion in
 4.9-STABLE) sends vlan tag as desired, and if configured with link0
 sends something other.
 3. In any case packets with maximal MTU are'n send in right way,
 receiving is not tested.
 
 

From: Sergey Potapov <sp@ws.alkor.ru>
To: freebsd-gnats-submit@FreeBSD.org, sp@alkor.ru
Cc:  
Subject: Re: kern/59062: nge0 swaps vlan tag bytes.
Date: Sun, 9 Nov 2003 20:31:01 +0300

 The following patch seems helps (on 4.9-Stable) if you config
 vlan interface:
 
 ifconfig vlan0 1.2.3.4/24 vlan 5 vlandev nge0 mtu 1500 -link0
 
 by default mtu will be 1496 and -link0 is in effect.
 if you set link0 flag you will see received packets and send
 something wrong.
 
 --- if_nge.c.orig       Thu Feb  6 01:03:57 2003
 +++ if_nge.c    Sun Nov  9 18:41:27 2003
 @@ -1467,7 +1467,7 @@
                  * to vlan_input() instead of ether_input().
                  */
                 if (extsts & NGE_RXEXTSTS_VLANPKT) {
 -                       VLAN_INPUT_TAG(eh, m, extsts & NGE_RXEXTSTS_VTCI);
 +                       VLAN_INPUT_TAG(eh, m, ntohs(extsts & NGE_RXEXTSTS_VTCI));
                          continue;
                  }
 
 
Responsible-Changed-From-To: freebsd-bugs->wpaul 
Responsible-Changed-By: ru 
Responsible-Changed-When: Wed Nov 12 07:47:23 PST 2003 
Responsible-Changed-Why:  
See if Bill still cares about this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59062 
State-Changed-From-To: open->closed 
State-Changed-By: brooks 
State-Changed-When: Fri Jul 23 17:18:35 GMT 2004 
State-Changed-Why:  
A variant on this patch appears to have been commited. 


Responsible-Changed-From-To: wpaul->ru 
Responsible-Changed-By: brooks 
Responsible-Changed-When: Fri Jul 23 17:18:35 GMT 2004 
Responsible-Changed-Why:  
ru commited a varient of this patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59062 
>Unformatted:
