From owner-cvs-src@FreeBSD.ORG Mon Jul 7 10:09:05 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3753C37B401; Mon, 7 Jul 2003 10:09:05 -0700 (PDT) Received: from kazi.fit.vutbr.cz (kazi.fit.vutbr.cz [147.229.8.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id C669843F75; Mon, 7 Jul 2003 10:09:03 -0700 (PDT) (envelope-from cejkar@fit.vutbr.cz) Received: from kazi.fit.vutbr.cz (localhost [127.0.0.1]) by kazi.fit.vutbr.cz (8.12.9/8.12.9) with ESMTP id h67H92nI017259 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 7 Jul 2003 19:09:02 +0200 (CEST) Received: (from cejkar@localhost) by kazi.fit.vutbr.cz (8.12.9/8.12.5/Submit) id h67H91qd017258; Mon, 7 Jul 2003 19:09:01 +0200 (CEST) X-Authentication-Warning: kazi.fit.vutbr.cz: cejkar set sender to cejkar@fit.vutbr.cz using -f Date: Mon, 7 Jul 2003 19:09:01 +0200 From: Rudolf Cejka To: Bill Paul Message-ID: <20030707170901.GA14558@fit.vutbr.cz> References: <200307060324.h663OPYE087830@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200307060324.h663OPYE087830@repoman.freebsd.org> User-Agent: Mutt/1.4.1i X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/net if_vlan.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 17:09:05 -0000 Bill Paul wrote (2003/07/05): > Modified files: > sys/net if_vlan.c > ... > - In vlan_input(), we have to extract the 16-bit tag value from the > received frame and use it to figure out which vlan interface gets > the frame. VLAN is determined just by 12-bit vlan identifier (VID) in the 16-bit tag (802.1q, page 68, 9.3.2.3 VID format). The others are 3 priority bits and 1 canonical format identifier bit (CFI), which all have to be masked before VLAN identification. > for (ifv = LIST_FIRST(&ifv_list); ifv != NULL; > ifv = LIST_NEXT(ifv, ifv_list)) > if (ifp == ifv->ifv_p && tag == ifv->ifv_tag) > break; It seems that variable name "tag" is confusing and it should be renamed to "vid", because you have to compare VIDs, not tags. > In the case where the interface supports hardware VLAN tag > extraction and calls VLAN_INPUT_TAG(), we do this: > tag = *(u_int*)(mtag+1); > But in the software emulation case, we do this > tag = EVL_VLANOFTAG(ntohs(evl->evl_tag)); However for VLAN identification, you have to extract VID from tag vid = EVL_VLANOFTAG(tag); and compare VIDs. > To see how this can be a problem, do something like > ifconfig vlan0 vlan 12345 vlandev foo0 and observe the results. 12345 is an illegal VLAN number, the maximum allowed number is 4094 (or 4095, but it is reserved). The bigger problem is with arrived packets with non-zero priority, where VLAN support in FreeBSD is still broken - in the past just for cards with hardware VLAN support (excluding em - see below), but now for almost all cards. > I'm not quite sure what the right thing is to do here. It seems that you had to miss my mail from February 27 2003 to you. Here is relevant part of it (and please see mentioned PRs too): -- Subject: Re: cvs commit: src/sys/dev/fxp if_fxp.c if_fxpreg.h if_fxpvar.h Bill Paul wrote (2003/02/26): > Modified files: > sys/dev/fxp if_fxp.c if_fxpreg.h if_fxpvar.h > This chip has hardware VLAN support as well. I hope to enable > support for this eventually. Hello, are you really interested in hardware VLAN support? If so, please look at kern/46405 - it seems that drivers with implemented hardware VLAN support does not work correctly if there is packet priority != 0. It has been fixed in em driver by Prafulla Deuskar (kern/45907 and kern/46028), but according to sources it seems that other drivers with hardware VLAN support still does not work. There is function vlan_input_tag() with parameter "t" and I think that it is expected to be "VLAN Tag" containing ID and Priority and drivers do it in this way (except for em driver, which masks VLAN ID from VLAN Tag thanks to fix from Prafulla). However, we think that it should be fixed directly in vlan_input_tag() function and this function should mask VLAN ID from VLAN Tag inside itself - but it does not do it. -- Best regards. -- Rudolf Cejka http://www.fit.vutbr.cz/~cejkar Brno University of Technology, Faculty of Information Technology Bozetechova 2, 612 66 Brno, Czech Republic