Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2242848pxt; Sun, 8 Aug 2021 16:54:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjQYAn9V+RkyL5yhR6qlhds4fGsHoVlyu6HE2RUVCwHt0DGnFcknQKLusMzf6UNao01uuX X-Received: by 2002:a92:6408:: with SMTP id y8mr145000ilb.84.1628466845703; Sun, 08 Aug 2021 16:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628466845; cv=none; d=google.com; s=arc-20160816; b=bx0BlZU6dSzQUCnGbWi1kqDwh1ftwPF/wvRefA3JndDnMIjsMQZU3rG3jBxA82WlqC PzLdZKMtDtPR68HKHTrJboxrsUAWynQQ1sD7E5ewvwXHULD7D0h7eDijxxdYEfjSGzbJ K+CVsQmUBww7bDA8qTwMc8tT2/rOFBpfwlBjSS5XtyFMv6vvbcMwbTnW004Ec6BDpUzQ +fHe4i6NvbTPZQUHK1VhKXKeydk4/ueuZ6KyvtvG24MOyBlMUDJySg9SP9WCO6yEcsHh 7mNTa7lEuPJEBf7MRtM4h0Jh0rhzV8C+oF+NU5cjryfurT5a6J+mPPayydUWs0nandwc d9PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g+mMde5qqc4uqYbMYLo0oM6z7/xWv3oSIgHXhyEzI18=; b=PGPhIZstkyad7pBzf2FQOYkcOXGB9KU3rVf8WyCm4THLskHPX5UPlVuAejaccf4tfT T64JQh3kbK7QFEhl2tG8dnkvvgTH3fvxG2yoHuEtd6aEPlTdsR9sgO6mE4O3PBztbMOO gghwXozMm1bct7veqDxKFFJ+ASan03sTwR++v0TypvetKXZbi3H638Ea7SxkNTtyXLbK TZ92u4AWtZU97eELAzqT1QsBBT0EqRachUS3LdvFvOYqbyEO1ojsr7R97/rhuZY/EANu hxQA0ECU6G9yECAab7Z12L3R9pVneVUH+nCCXQDM0X6EO+60T6AxAmJyo1gbWEjcX93s gabg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HG3IPM1H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id w5si1285992ilh.8.2021.08.08.16.53.54; Sun, 08 Aug 2021 16:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HG3IPM1H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230290AbhHHXwY (ORCPT + 99 others); Sun, 8 Aug 2021 19:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229662AbhHHXwX (ORCPT ); Sun, 8 Aug 2021 19:52:23 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C021C061760; Sun, 8 Aug 2021 16:52:04 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id bo19so2609503edb.9; Sun, 08 Aug 2021 16:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=g+mMde5qqc4uqYbMYLo0oM6z7/xWv3oSIgHXhyEzI18=; b=HG3IPM1H6BKAhnp9qibICBx63Uwux2bThByqPA/ojs6WFDEThJtqm+A82+7yz1knMT n1Bh794jpjjyeqMlOQnMCLfj30tuJ/stefGVB0HV/aUH6h7cDeX6rMxvINcrzQbuPtsC VQmmlya7O7WdPHTSyxJfCrGVsqXA4dDSLohHO3GMItkSVYCnf9mRP/vtUgLTWovcRdJR wvT+Zx2QM8Do9ZqGZ8HTR3KtOqiORh4WN666q1ADedsufn0R3RFd1G6PqbilDRgBFtR4 PLoOvUxOzGFGziNHgfvwn0A6gpeCtoyc3MFQsD1lF+xk6W137aSByQWIGlCRXNKRUfqa BwOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=g+mMde5qqc4uqYbMYLo0oM6z7/xWv3oSIgHXhyEzI18=; b=FVm3WEyKn88ZgM2/1JY3CjJpLPEtK/c4OnBGEaLsgc1sAO620QWx6rM1psENKqkmQa u6MWglypeEg9JJt8HHwM4R8sfZQO6hVQ/egWnrdELQUhMGgaljdRIuZU+Ff1yM1UHpPS WtIB+iO6HS205IAn/bFEdTn9yjgyuv5Nxxo0TUffkHDwOxqcLffCEl6fl8hEM8af2FXH ogkC93TJNLi9rWvMPRVrwgJKt3xcQsokxHlBvbwFAHT2QT6fZJV2ryssFMsqHjuQKVR3 SmGXZqft10IEIlhuAUKX5mM0eSjO10QvUDlZ4gq2C2E1Z+yzPb/ADh5GrLdXwhK+7qm9 sqsQ== X-Gm-Message-State: AOAM533YCtXNoytZ8C2YsLBXiD/fiYI44HA2MNmrABQxiIh751Tu4xjp ZhD7wO9qqqbQamM/SvHyNsQ= X-Received: by 2002:a05:6402:31a4:: with SMTP id dj4mr26352070edb.350.1628466722891; Sun, 08 Aug 2021 16:52:02 -0700 (PDT) Received: from skbuf ([188.25.144.60]) by smtp.gmail.com with ESMTPSA id v12sm1572958ejq.36.2021.08.08.16.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Aug 2021 16:52:02 -0700 (PDT) Date: Mon, 9 Aug 2021 02:52:01 +0300 From: Vladimir Oltean To: DENG Qingfang Cc: Eric Woudstra , Sean Wang , Landen Chao , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Matthias Brugger , Tobias Waldekranz , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mt7530 fix mt7530_fdb_write vid missing ivl bit Message-ID: <20210808235201.wvw6mjzyvcpumxgk@skbuf> References: <20210716152213.4213-1-ericwouds@gmail.com> <20210808170024.228363-1-dqfext@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210808170024.228363-1-dqfext@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 09, 2021 at 01:00:24AM +0800, DENG Qingfang wrote: > On Fri, Jul 16, 2021 at 05:22:11PM +0200, ericwouds@gmail.com wrote: > > From: Eric Woudstra <37153012+ericwoud@users.noreply.github.com> > > > > According to reference guides mt7530 (mt7620) and mt7531: > > > > NOTE: When IVL is reset, MAC[47:0] and FID[2:0] will be used to > > read/write the address table. When IVL is set, MAC[47:0] and CVID[11:0] > > will be used to read/write the address table. > > > > Since the function only fills in CVID and no FID, we need to set the > > IVL bit. The existing code does not set it. > > > > This is a fix for the issue I dropped here earlier: > > > > http://lists.infradead.org/pipermail/linux-mediatek/2021-June/025697.html > > > > With this patch, it is now possible to delete the 'self' fdb entry > > manually. However, wifi roaming still has the same issue, the entry > > does not get deleted automatically. Wifi roaming also needs a fix > > somewhere else to function correctly in combination with vlan. > > Sorry to bump this up, but I think I identified the issue: > > Consider a VLAN-aware bridge br0, with two ports set to different PVIDs: > > > bridge vlan > > port vlan-id > > swp0 1 PVID Egress Untagged > > swp1 2 PVID Egress Untagged > > When the bridge core sends a packet to swp1, the packet will be sent to > the CPU port of the switch as untagged because swp1 is set as "Egress > Untagged". However if the switch uses independent VLAN learning, the CPU > port PVID will be used to update the FDB. Sadly the Banana Pi MT7531 reference manual I have does not appear to cover the DSA tagging header, so I am not actually clear what MTK_HDR_XMIT_SA_DIS does when not set. Does it default to the CPU port's value from the PSC register? If it does, then I expect that your patch 0b69c54c74bc ("net: dsa: mt7530: enable assisted learning on CPU port") fixes the issue Eric was seeing, which in turn was caused by your other patch 5e5502e012b8 ("net: dsa: mt7530: fix roaming from DSA user ports"). > As we don't change its PVID > (not reasonable to change it anyway), hardware learning may not update > the correct FDB. > > A possible solution is always send packets as tagged when serving a > VLAN-aware bridge. So as usual, VLANs put the "hard" in "hardware learning on the CPU port". I would say "a possible solution is to not attempt to learn from CPU-injected frames unless they are sent using the tx_fwd_offload framework".... > > mv88e6xxx has been using hardware learning on CPU port since commit > d82f8ab0d874 ("net: dsa: tag_dsa: offload the bridge forwarding process"), > does it have the same issue? ...which ensures that bridge data plane packets are always sent to the CPU port as VLAN-tagged: br_handle_vlan: /* If the skb will be sent using forwarding offload, the assumption is * that the switchdev will inject the packet into hardware together * with the bridge VLAN, so that it can be forwarded according to that * VLAN. The switchdev should deal with popping the VLAN header in * hardware on each egress port as appropriate. So only strip the VLAN * header if forwarding offload is not being used. */ if (v->flags & BRIDGE_VLAN_INFO_UNTAGGED && !br_switchdev_frame_uses_tx_fwd_offload(skb)) __vlan_hwaccel_clear_tag(skb); Seriously, I expect that a packet injected through the CPU port will, under normal circumstances, not default not look up the FDB, not update the FDB, etc etc. As long as you let the frame analyzer look in depth at the packet you do need to ensure that it has a valid VLAN ID. Otherwise it is an actual forwarding correctness issue and not just a "learn in wrong VLAN" issue: https://patchwork.kernel.org/project/netdevbpf/patch/20210426170411.1789186-6-tobias@waldekranz.com/