From owner-freebsd-current@FreeBSD.ORG Tue Feb 19 18:54:21 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 844ED670 for ; Tue, 19 Feb 2013 18:54:21 +0000 (UTC) (envelope-from kolyasir@gmail.com) Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id 4CF25E6D for ; Tue, 19 Feb 2013 18:54:21 +0000 (UTC) Received: by mail-qa0-f47.google.com with SMTP id j8so1992912qah.6 for ; Tue, 19 Feb 2013 10:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=UhX5I6DMqGGLo9651b+jZIlUSFiadCsDTgpvUMLIuC4=; b=VdyMskP8QBV6XNGGpLrXTmBZlgx1ykhZScL2QhNa85sy30olSOUcFg+43TwfaZLVn9 s8JDGeIJch8wSzbl7WwnKe1BePUEBjCPtVb6BstXv+jR6qI+BSjQaYSeIepqg2uP+yYd 0V6xJjBnxoq2aNxg6XUHarJfdh/iRmNyOKbBKrimHB89MXlUxxh7xr93Oxg8tTbZiwjV 5nX+JkesBD44O1AphYIFzpivvRFdmQWJbYBxU+NQgyTW3Re2wijrLrqMsNjG3td17R0g zMT6XxYWGytyaHllkCrPXzCSaPx+hVuT5gjszGydYPa0x+fqtsSmkqQitf46//uawwSR yhjg== MIME-Version: 1.0 X-Received: by 10.229.75.140 with SMTP id y12mr1540815qcj.98.1361300054944; Tue, 19 Feb 2013 10:54:14 -0800 (PST) Received: by 10.49.71.232 with HTTP; Tue, 19 Feb 2013 10:54:14 -0800 (PST) In-Reply-To: References: Date: Tue, 19 Feb 2013 23:54:14 +0500 Message-ID: Subject: Re: fail to load vlans into the vlan translation unit From: Yasir hussan To: freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 18:54:21 -0000 i can`t send u complete patch yet, i will send u main point where i think am getting failer, its not bug free code, plz to understand logic u8 portmask=0;//[AR8216_NUM_PORTS]; int i, j; /* flush all vlan translation unit entries */ ar8216_vtu_op(priv, AR8216_VTU_OP_FLUSH, 0); ar8316_vtu_op(sc, AR8316_VTU_OP_LOAD | (1/*vlanid*/ << AR8316_VTU_VID_SHIFT), (3 /*ports*/<< 1) | (1 << AR8316_CPU_PORT)); ar8316_vtu_op(sc, AR8316_VTU_OP_LOAD | (2/*vlanid*/ << AR8316_VTU_VID_SHIFT), (12 /*ports*/<< 1) | (1 << AR8316_CPU_PORT)); /* update the port destination mask registers and tag settings */ for (i = 0; i < AR8216_NUM_PORTS; i++) { int egress, ingress; int pvid; if ( i<3) { pvid =1;//priv->vlan_id[priv->pvid[i]]; } else { pvid = 2//i; } egress = AR8216_OUT_STRIP_VLAN; ingress = AR8216_IN_SECURE; ar8316_reg_update(sc->sc_pdev, AR8316_REG_PORT_CTRL(i), AR8316_PORT_CTRL_LEARN | AR8316_PORT_CTRL_VLAN_MODE | AR8316_PORT_CTRL_SINGLE_VLAN | AR8316_PORT_CTRL_STATE | AR8316_PORT_CTRL_HEADER | AR8316_PORT_CTRL_LEARN_LOCK, AR8316_PORT_CTRL_LEARN | (egress << AR8316_PORT_CTRL_VLAN_MODE_SHIFT) | (AR8316_PORT_STATE_FORWARD << AR8316_PORT_CTRL_STATE_SHIFT)); ar8316_reg_update(sc->sc_pdev, AR8316_REG_PORT_VLAN(i), AR8316_PORT_VLAN_DEST_PORTS | AR8316_PORT_VLAN_MODE | AR8316_PORT_VLAN_DEFAULT_ID, (portmask << AR8316_PORT_VLAN_DEST_PORTS_SHIFT) | (ingress << AR8316_PORT_VLAN_MODE_SHIFT) | (pvid << AR8316_PORT_VLAN_DEFAULT_ID_SHIFT)); } I think two vlan with ids 1,2 should be created which would be working fine by just upgrading registers, if i am missing something u can it... Thanks, On Tue, Feb 19, 2013 at 10:07 PM, Yasir hussan wrote: > hi, > > i am trying to build up vlan feature for chip ar8316 in freebsd, i am yet > able to make a single defualt vlan which is working properly, where i am > failing is i guess is in calculate the port destination masks and load > vlans into the vlan translation unit, i am tring to copy style of > open-wrt, u can also brows it from > https://dev.openwrt.org/browser/trunk/target/linux/generic-2.6/files/drivers/net/phy/ar8216.c?rev=20083 > > > the vlan i tried to add in last is working as defualt vlan but switch > should also add the previous one vlans.I think it should even work if i > dont use loop and just use ar8216_vtu_op funtion to add each vlan, but it > does`t work on me, kindly anyone body have idea what i am missing or have > any suggestion would be arpiciotive.. > > Thanks, >