Received: by 10.213.65.68 with SMTP id h4csp991839imn; Sat, 31 Mar 2018 15:49:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/1yMQCqEQhYlZ4clJ962XqxUOTCbgx0aux0TtbU1kDrY71GQRKx3tBV/ltp9Q5es6bWfxq X-Received: by 2002:a17:902:6184:: with SMTP id u4-v6mr4494978plj.390.1522536572302; Sat, 31 Mar 2018 15:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522536572; cv=none; d=google.com; s=arc-20160816; b=gIMyEnHRghIWA2s7RoWU56xwEv7jZbztmCoQkf9wA6L3vzDpmh08k9oBboVPleJLmx cfd2eNBzyRRvt01pFsCvIlreiTPNWiHY8gNFEfP/xH4mDqAKed/O+5ajCK4EWkOTk3Wx B3VczdWyL9sjttjx1JaGptXSpOvukWkkaxZRULPCKBfsPM2cJQIj2ouJTiBk4SaERbX9 x9d83EvwhA2p97W4uLlZ0i2acVTkq82tw8SlnUKamo/KO3J6mE4tm8rIIKX3tMCwN5hz yxeRtwNlAG4nw+k4s703t5SEUj1naoxRvqj+VUjWKStSYdCtnN/DOo6WfUjBAMdmLYf7 3iVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=d8x2hcjwmlYNaXm6mxeWI3iMN71sfj8nxBSyeB1rxRY=; b=lSIz1cM7/sgmv3vAsIxmIDRW1TWeM3QhpKF11aGQWsgIttKwJvrCF3Sa6CJAtcm83A a+v+I38ukHWobLMjiAqxtov1f+NvRSAvrsESzXPlCkEy4lhBNmsMg7bvT+3/QhHPQCaW XAaXcb8YoseJD2qjSx6CeblY76dm/waiAhQdHj2rDX5OcAx3x8msQikQeuszkoPvy5H6 +xvyNcz2mLRtP4Qc0Skn0jflcs5D14qnXya/6pxAfKvliC/uc1v5Iw7C1qbzxwWciUQ/ D1p4E5cigO4yEtqh5eUQH63uEtEQVIoA7DeqT9AaOzM7vpMtP6iY8Py6iqYXyCLPABGA Gspg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CLcUV0ID; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f14si7691219pgu.742.2018.03.31.15.49.04; Sat, 31 Mar 2018 15:49:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CLcUV0ID; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752924AbeCaWre (ORCPT + 99 others); Sat, 31 Mar 2018 18:47:34 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:41836 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752826AbeCaWrb (ORCPT ); Sat, 31 Mar 2018 18:47:31 -0400 Received: by mail-oi0-f67.google.com with SMTP id 188-v6so10292125oih.8; Sat, 31 Mar 2018 15:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=d8x2hcjwmlYNaXm6mxeWI3iMN71sfj8nxBSyeB1rxRY=; b=CLcUV0IDV0akQ6A+VcjR0kim1j8aL+Du/3gacpq+YH57rY3bLGihCgTzNtGG55a5SN 9o6IEZt/04pl8UCEWfJhC4Wnz6AT+FSxwVewt+qJTya7I98WKS35xPQzaKCEF7XkWvw/ wmr0nXCzvvpLIogCBdPpt4QR+9IAHuYilOmARj8zZXLjFLkCXUnGzLK5weE2oiA/IRi9 ThzySUW6DEVzPReoj8CeAVMVkojRN2/pFbR6XTZvKPkZENPvocPc1ZNevRs3XuRZBiCP DdG9oWxK4SvvDlufVCPx+i2MScWHB67/OCazrvGZs83PT7Em4qH9j/volnLhpsJXOdZl 8ivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=d8x2hcjwmlYNaXm6mxeWI3iMN71sfj8nxBSyeB1rxRY=; b=M0xfQy2hurAiIvyxgsxA9Tjt8d7mlbFkIPrMSnqlLlPDsfhursy+HMc1Jvht83H+4F SKsJB6gFiBpenaP+Q2+/r9dRq0opP/8wPNTDn9aG1swZzuT99BQBkShQspSSUwDfUwiF 1/nsAnLJA/XEwY1lmR7Jow0OcSWbAUWXlA5TN11JmEKTopWPpFeprsXTmM0OshVk+6Jj lJ5ncj1ZjTYaB1wMv9UQV6LMWwZnWT6Cp5rqqZ8nTUZIAk9yS4cy+0runaRDloZCy8z5 Tlq2Ke7BEsOcST6L5Xt0tNrODPEApdob+O89ztZGDMRalCczq8616q6LA0tea6JTZJyL kXCw== X-Gm-Message-State: ALQs6tAo70/Jcvfq4ty62DP2pVIlHE2sKQhok0ughxzzbcjmcqa47foR 9M3koxp6KiaJu+btRt6kNdvAVGx3 X-Received: by 2002:aca:5484:: with SMTP id i126-v6mr2102584oib.219.1522536450469; Sat, 31 Mar 2018 15:47:30 -0700 (PDT) Received: from [192.168.1.2] (ip68-109-195-31.pv.oc.cox.net. [68.109.195.31]) by smtp.googlemail.com with ESMTPSA id s9-v6sm5845799ote.47.2018.03.31.15.47.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Mar 2018 15:47:29 -0700 (PDT) Subject: Re: [PATCH net-next 5/8] net: mscc: Add initial Ocelot switch support To: Andrew Lunn , Alexandre Belloni Cc: "David S . Miller" , Allan Nielsen , razvan.stefanescu@nxp.com, po.liu@nxp.com, Thomas Petazzoni , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org References: <20180323201117.8416-1-alexandre.belloni@bootlin.com> <20180323201117.8416-6-alexandre.belloni@bootlin.com> <1df0a932-f7c1-f1b5-9a35-3c16d0c551e5@gmail.com> <20180330124537.GC14180@piout.net> <20180330135422.GA28244@lunn.ch> <20180330141634.GD14180@piout.net> <20180330145008.GE28244@lunn.ch> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+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7wAnBcOkbZ9BPJPNCbqU6dowLOiy8AuTYQ48m vIyQ4Ijnb6GTrtxIUDQeOBNuQC/gyyx3nbL/lVlHbxr4tb6YkhkO6shjXhQh7nQb33FjGO4P WU11Nr9i/qoV8QCo12MQEo244RRA6VMud06y/E449rWZFSTwGqb0FS0seTcYNvxt8PB2izX+ HZA8SL54j479ubxhfuoTu5nXdtFYFj5Lj5x34LKPx7MpgAmj0H7SDhpFWF2FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJU X9LxBQkeXB3fAAoJEGFXmRW1Y3YOj4UAn3nrFLPZekMeqX5aD/aq/dsbXSfyAKC45Go0YyxV HGuUuzv+GKZ6nsysJw== Message-ID: <244d3f20-f8f8-d9a2-a6b5-1a8fa4f0b655@gmail.com> Date: Sat, 31 Mar 2018 15:47:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180330145008.GE28244@lunn.ch> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 03/30/18 à 07:50, Andrew Lunn a écrit : > On Fri, Mar 30, 2018 at 04:16:34PM +0200, Alexandre Belloni wrote: >> On 30/03/2018 at 15:54:22 +0200, Andrew Lunn wrote: >>>>> All of this sounds like it should be moved into the br_join/leave, this >>>>> does not appear to be the right place to do that. >>>>> >>>> >>>> No, I've triple checked because this is a comment that both Andrew and >>>> you had. Once a port is added to the PGID MASK, it will start forwarding >>>> frames so we really want that to happen only when the port is in >>>> BR_STATE_FORWARDING state. Else, we may forward frames between the >>>> addition of the port to the bridge and setting the port to the >>>> BR_STATE_BLOCKING state. >>> >>> Hi Alexandre >>> >>> Interesting observation. I took a look at some of the other join >>> implementations. mv88e6xxx does the join immediately. mt7539 does it >>> immediately, if the port is enabled. lan9303 does it immediately. >>> qca8k does it immediately. b53 does it immediately. >>> >> >> I had a look at b53, my impression was that b53_br_join() adds the port >> to the bridge but b53_br_set_stp_state() actually enables forwarding. So >> as long as the default on the port is PORT_CTRL_DIS_STATE, the port will >> not be forwarding frames. And this is the case because b53_enable_port() >> does put 0 in B53_PORT_CTRL. > > https://elixir.bootlin.com/linux/latest/source/drivers/net/dsa/b53/b53_regs.h#L71 > > It seems like, 0 means no STP at all. Which to me would mean, forward > all packets. But i could be wrong. Florian? Correct, 0 disables STP and therefore means forward all packets. > >> The fact is that ocelot doesn't have separate controls. The port is >> either forwarding or not. If it is not forwarding, then there is nothing >> to tell the HW to do. > > Think about the following sequence: > > ip link set lan0 up > > After this command, i expect to see packets on lan0 arrive at the > host, tcpdump to work, etc. This probably means the port is in > 'forwarding' mode, or for B53, STP is disabled. In net/dsa/port.c::dsa_port_enable we have the following: u8 stp_state = dp->bridge_dev ? BR_STATE_BLOCKING : BR_STATE_FORWARDING; > > ip link add name br0 type bridge > ip link set dev br0 up > ip link set dev lan0 master br0 > > When the port is added to the bridge, there is a window of time > between the join and the STP change to blocking/learning, when the > port is in forwarding mode. You avoid this window. But the other > drivers don't appear to. > > So i would like to fix this of every driver. I'm not sure how yet... Agreed, there does appear to be a window like you outlined in your example if the port was already UP where we may be in an inconsistent STP state. This window does not appear to be existing in case the port was not UP prior to joining the bridge though. It seems to me like the most natural place where to fix this would be in the bridge code, but this has the potential to break several drivers so within the scope of DSA, it might be as simple as this: diff --git a/net/dsa/port.c b/net/dsa/port.c index 7acc1169d75e..e692b6f1a710 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -116,6 +116,8 @@ int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br) if (err) dp->bridge_dev = NULL; + dsa_port_set_state_now(dp, BR_STATE_BLOCKING); + return err; } -- Florian