From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755823AbbFBGug (ORCPT ); Tue, 2 Jun 2015 02:50:36 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:56246 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891AbbFBGu1 (ORCPT ); Tue, 2 Jun 2015 02:50:27 -0400 Message-ID: <556D522E.90607@roeck-us.net> Date: Mon, 01 Jun 2015 23:50:22 -0700 From: Guenter Roeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Vivien Didelot , netdev@vger.kernel.org CC: "David S. Miller" , Florian Fainelli , Andrew Lunn , Scott Feldman , Jiri Pirko , Jerome Oufella , linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, Chris Healy Subject: Re: [RFC 3/9] net: dsa: mv88e6xxx: add support for VTU ops References: <1433208470-25338-1-git-send-email-vivien.didelot@savoirfairelinux.com> <1433208470-25338-4-git-send-email-vivien.didelot@savoirfairelinux.com> In-Reply-To: <1433208470-25338-4-git-send-email-vivien.didelot@savoirfairelinux.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vivien, On 06/01/2015 06:27 PM, Vivien Didelot wrote: > This commit implements the port_vlan_add and port_vlan_del functions in > the dsa_switch_driver structure for Marvell 88E6xxx compatible switches. > > This allows to access a switch VLAN Table Unit, and thus define VLANs > from standard userspace commands such as "bridge vlan". > > Signed-off-by: Vivien Didelot > --- [ ... ] > + > +int mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, u16 vid, > + u16 bridge_flags) > +{ > + struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); > + struct mv88e6xxx_vtu_entry entry = { 0 }; > + int prev_vid = vid ? vid - 1 : 4095; > + int i, ret; > + > + /* Bringing an interface up adds it to the VLAN 0. Ignore this. */ > + if (!vid) > + return 0; > + Me puzzled ;-). I brought this and the fid question up before. No idea if my e-mail got lost or what happened. Can you explain why we don't need a configuration for vlan 0 ? > + /* The DSA port-based VLAN setup reserves FID 0 to DSA_MAX_PORTS; > + * we will use the next FIDs for 802.1q; > + * thus, forbid the last DSA_MAX_PORTS VLANs. > + */ > + if (vid > 4095 - DSA_MAX_PORTS) > + return -EINVAL; > + > + mutex_lock(&ps->smi_mutex); > + ret = _mv88e6xxx_vtu_getnext(ds, prev_vid, &entry); > + if (ret < 0) > + goto unlock; > + > + /* If the VLAN does not exist, re-initialize the entry for addition */ > + if (entry.vid != vid || !entry.valid) { > + memset(&entry, 0, sizeof(entry)); > + entry.valid = true; > + entry.vid = vid; > + entry.fid = DSA_MAX_PORTS + vid; I brought this up before. No idea if my e-mail got lost or what happened. We use a fid per port, and a fid per bridge group. With VLANs, this is completely ignored, ahd there is only a single fid per vlan for the entire switch. Either per-port fids are unnecessary as well, or something is wrong here, or I am missing something. Can you explain why we only need a single fid per vlan, even if we have multiple bridge groups and the same vlan is configured in all of them ? Thanks, Guenter