Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2255490pxf; Sat, 3 Apr 2021 17:48:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFS9a+ksM+Pmf9oQiXZTY0J/2Njm+wYFW9N09bFllqP04k8JJ39SckyRvMBFcMEkDxaGwW X-Received: by 2002:a05:6638:13cc:: with SMTP id i12mr18189291jaj.128.1617497290726; Sat, 03 Apr 2021 17:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617497290; cv=none; d=google.com; s=arc-20160816; b=f1206/FmZqAVC2rcjx09fCofloQUOtLvTlVTipTDo+SJRQWC/1ct0lm9ZJTbTZYHSR 3pBC4AxdS7jnT1ytQ5n2OEGar2+Jq0vlcPPxSdcz/uKqQDXxjrshZ4lHL8uu7NtuO9g9 q8RwbsvPdpKfhuQHJeyAZQ9LVx0ymKPUD7LPM2o5KOodO1xmtrKrx7aHl6qPwgYSdhGT a/C6dlS5cGb4ARL5BpV/aipdRfvsc1qGFbszc+63VfRt3+X4CLDLaWOe6uXq7g32zz6X f/jHUePpD90LH1A76Etpyse1Fsre3MgWdxwBXsx2vCLepyKq8iopdZw443dlD1Ul/bs0 TTMg== 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; bh=DCyvXMwSI7m1t6emzNn9kseMvtWRROHiQjD2u9Noj5A=; b=cKmrlbSwvoiNPREgw1A0LzdAoUcyqZwMNxp44U5f/D3Ibl8u2rdCgVx1q9P4Y32G+B IZ/R2fmi6pm805phN7XNZqBLVzyilD/6ZE3C0wwHYO7gddGbIjir8VhdzWvQn95oBhAM wt32skhRv4gSmZPfQ69c3wRg3X4QdC+h0r8QY/nrKAvIQ4M9DdKjCHmPJMrQ3D8a2Qg3 nXW+0Uy85+xkzpQFUEFLnEoTgSpN5fOycweYXctCj0FliarkED9TJySTyzuuezb1kjVA YSCTv6bgVgCO46TzQeyghPbnpDyy+CILeoCHgkhho87lKnsNWvJLP429te/ikVhNFLju 56jA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si10769706iop.79.2021.04.03.17.47.57; Sat, 03 Apr 2021 17:48:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236618AbhDDAqX (ORCPT + 99 others); Sat, 3 Apr 2021 20:46:23 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:33090 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236526AbhDDAqX (ORCPT ); Sat, 3 Apr 2021 20:46:23 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lSqu0-00EhXI-4U; Sun, 04 Apr 2021 02:46:08 +0200 Date: Sun, 4 Apr 2021 02:46:08 +0200 From: Andrew Lunn To: Vladimir Oltean Cc: Oleksij Rempel , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King , Pengutronix Kernel Team , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: Re: [PATCH net-next v1 5/9] net: dsa: qca: ar9331: add forwarding database support Message-ID: References: <20210403114848.30528-1-o.rempel@pengutronix.de> <20210403114848.30528-6-o.rempel@pengutronix.de> <20210403234847.jceg4ubljdq3g7n5@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210403234847.jceg4ubljdq3g7n5@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Plus, i'm not actually sure we should be issuing warnings here. What > > does the bridge code do in this case? Is it silent and just does it, > > or does it issue a warning? > > :D > > What Oleksij doesn't know, I bet, is that he's using the bridge bypass > commands: > > bridge fdb add dev lan0 00:01:02:03:04:05 > > That is the deprecated way of managing FDB entries, and has several > disadvantages such as: > - the bridge software FDB never gets updated with this entry, so other > drivers which might be subscribed to DSA's FDB (imagine a non-DSA > driver having the same logic as our ds->assisted_learning_on_cpu_port) > will never see these FDB entries > - you have to manage duplicates yourself I was actually meaning a pure software bridge, with unaccelerated interfaces. It has a dynamic MAC address in its tables, and the user adds a static. Ideally, we want the same behaviour. And i think the answer is: static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source, const unsigned char *addr, u16 vid) { struct net_bridge_fdb_entry *fdb; if (!is_valid_ether_addr(addr)) return -EINVAL; fdb = br_fdb_find(br, addr, vid); if (fdb) { /* it is okay to have multiple ports with same * address, just use the first one. */ if (test_bit(BR_FDB_LOCAL, &fdb->flags)) return 0; br_warn(br, "adding interface %s with same address as a received packet (addr:%pM, vlan:%u)\n", source ? source->dev->name : br->dev->name, addr, vid); fdb_delete(br, fdb, true); } fdb = fdb_create(br, source, addr, vid, BIT(BR_FDB_LOCAL) | BIT(BR_FDB_STATIC)); if (!fdb) return -ENOMEM; fdb_add_hw_addr(br, addr); fdb_notify(br, fdb, RTM_NEWNEIGH, true); return 0; } So it looks like it warns and then replaces the dynamic entry. So having the DSA driver also warn is maybe O.K. Having said that, i don't think any other DSA driver does. Andrew