Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp815989pxb; Tue, 12 Apr 2022 14:14:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydLlLLKj72/7FblrXH11u7f0VLRhHprGRVAJbL/1hUntKt2MsG9Ik7LPcdWoawxfqxK0z1 X-Received: by 2002:a17:90b:3805:b0:1c7:6e7a:3e01 with SMTP id mq5-20020a17090b380500b001c76e7a3e01mr7024445pjb.213.1649798050997; Tue, 12 Apr 2022 14:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649798050; cv=none; d=google.com; s=arc-20160816; b=zq2BEtj4cG9h0+bCm/3jEnonx8tLyXKIg0JL0AY9iLzZRb0x5BvIF76nRwMAXZejIH sCmZQGF1DhZxeePOXM5ZBCpKbq7wj3Nyg5rdoEVs7e2GKG4LGmdwvp3f3zf/Xtd3yXNg 4aN1JFtT0M9XesQ0v7/pAu4bnKO6J+9lHKvgPh6J0g91Bss1s7KtsbuaUcTHtuomdU6e nMyhoIGJnFd7VhUmK8UPT6fu1DZrg5v1hDBNozCMFugSUc3Ombhlv7N64EumeR3YBx+T Fa7esOxzpLOlNZuyt9STYKC233FEn48sCQsViLA9LLQ6YpCiJtBhZhFlTJ66e9gDqoR7 Vc8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=DqKc8iJWKXFesV4tUBomdbYhQAx3J3hZZcgttBI4x2Y=; b=V7HhGMl/vVnrwq+JtGxuVThwlqyY/MtSoU9iBZcu6NnPy9MWu186TXe0neTx4jiv3D feRvEsFFwOMlEG7yg2soUObxPIsNGfhaVCiZVDPhe4DyNx759UF/4ywqufnLS8z7Ag// k4CMD+uB4wCW8oML1MwxjyMS7fiFZXNeOlg2YKGiL1shZVBopQqAAA+hXdxZkAZsXG54 1sIuRHgk/W9uXjGWYG0edpBWr52/yxSx8BVDhWwwU6nBwCBsWJtcgFuOYI2RM9Rx+9lX 7BcqH1+H7PCZj9z2fd1e6RVKkTRxm9br1/wmiH4u3XRoA+3ZAhGfhrHI4j+S3UzZy5iw UNLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=lUcIljzL; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r19-20020a63d913000000b003836f42cdb3si3461568pgg.590.2022.04.12.14.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:14:10 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=lUcIljzL; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 04D32ECC5B; Tue, 12 Apr 2022 13:29:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352735AbiDLNw2 (ORCPT + 99 others); Tue, 12 Apr 2022 09:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238580AbiDLNwY (ORCPT ); Tue, 12 Apr 2022 09:52:24 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66CC350B0A; Tue, 12 Apr 2022 06:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:Subject: From:References:Cc:To:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=DqKc8iJWKXFesV4tUBomdbYhQAx3J3hZZcgttBI4x2Y=; b=lUcIljzLQVkGDAXHQvO3ekCQ9M JW4E1mqnOh350Gj+Eo1iyNXxUT+ph4jRyeLYG3/8bpC3qR5mSIBj1whJKWuTaAsjmIKKYhUDNBrnj 06RlAEIaL8dX8lKiR47oFmu0ZI/9BKYRTXp8vJ4av43r3Y3xyLnM47QGCmqTDWbqLZK8=; Received: from p57a6f1f9.dip0.t-ipconnect.de ([87.166.241.249] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1neGu0-00074w-2t; Tue, 12 Apr 2022 15:49:52 +0200 Message-ID: Date: Tue, 12 Apr 2022 15:49:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: Andrew Lunn Cc: netdev@vger.kernel.org, John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Jiri Pirko , Ido Schimmel , Florian Fainelli , Vladimir Oltean References: <20220405195755.10817-1-nbd@nbd.name> <20220405195755.10817-15-nbd@nbd.name> From: Felix Fietkau Subject: Re: [PATCH v2 14/14] net: ethernet: mtk_eth_soc: support creating mac address based offload entries In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.04.22 15:07, Andrew Lunn wrote: >> > > > > I'm trying to understand the architecture here. >> > > > > We have an Ethernet interface and a Wireless interface. The slow >> > > path >> > > > is that frames ingress from one of these interfaces, Linux decides >> > > > what to do with them, either L2 or L3, and they then egress probably >> > > > out the other interface. >> > > > > The hardware will look at the frames and try to spot flows? It >> > > will >> > > > then report any it finds. You can then add an offload, telling it for >> > > > a flow it needs to perform L2 or L3 processing, and egress out a >> > > > specific port? Linux then no longer sees the frame, the hardware >> > > > handles it, until the flow times out? >> > > Yes, the hw handles it until either the flow times out, or the corresponding >> > > offload entry is removed. >> > > >> > > For OpenWrt I also wrote a daemon that uses tc classifier BPF to accelerate >> > > the software bridge and create hardware offload entries as well via hardware >> > > TC flower rules: https://github.com/nbd168/bridger >> > > It works in combination with these changes. >> > >> > What about the bridge? In Linux, it is the software bridge which >> > controls all this at L2, and it should be offloading the flows, via >> > switchdev. The egress port you derive here is from the software bridge >> > FDB? > >> My code uses netlink to fetch and monitor the bridge configuration, >> including fdb, port state, vlans, etc. and it uses that for the offload path >> - no extra configuration needed. > > So this is where we get into architecture issues. Do we really want > Linux to have two ways for setting up L2 networking? It was decided > that users should not need to know about how to use an accelerator, > they should not use additional tools, it should just look like > linux. The user should just add the WiFi netdev to the bridge and > switchdev will do the rest to offload L2 switching to the hardware. > > You appear to be saying you need a daemon in userspace. That is not > how every other accelerate works in Linux networking. > > We the Linux network community need to decided if we want this? The problem here is that it can't be fully transparent. Enabling hardware offload for LAN -> WiFi comes at a cost of bypassing airtime fairness and mac80211's bufferbloat mitigation. Some people want this anyway (often but not always for benchmark/marketing purposes), but it's not something that I would want to have enabled by default simply by a wifi netdev to a bridge. Initially, I wanted to put more of the state tracking code in the kernel. I made the first implementation of my acceleration code as a patch to the network bridge - speeding up bridge unicast forwarding significantly for any device regardless of hardware support. I wanted to build on that to avoid putting a lot of FDB/VLAN related tracking directly into the driver. That approach was immediately rejected and I was told to use BPF instead. That said, I really don't think it's a good idea to put all the code for tracking the bridge state, and all possible forwarding destinations into the driver directly. I believe the combination of doing the bridge state tracking in user space + using the standard TC API for programming offloading rules into the hardware is a reasonable compromise. - Felix