Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp53582pxh; Thu, 7 Apr 2022 13:45:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6b7NizyMjzPNxlvnifnQJSeZ4cXiaStaZwUCImm8LEi4kRQokwT/u9ujqtENfj+21RwZc X-Received: by 2002:a17:90a:558a:b0:1ca:a819:d2d1 with SMTP id c10-20020a17090a558a00b001caa819d2d1mr18064556pji.126.1649364345885; Thu, 07 Apr 2022 13:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649364345; cv=none; d=google.com; s=arc-20160816; b=VtmyNq/8wJ4/GwPeHeGxH45Iqw79K2TG77pZf16UJY0quIeTRdMpY6esr6wXwXManA gBF4g+d8sfepF0/s+ii147REb8Eq+bPL3QebDdr1dPALwlN3ZYK+M0CXpTRPq815tRLx 2gm9eos0ddluSJbwAKmTxQ7dGsqBf+lg3pllXhwFqQoNnXEdLELlDxoq6PIgpWPhb/oz LSsYWe8Zj+3hxjyrR5cCYbtQgZ+lT66CvCadNQAFyw7hWFVlp7fHUDdFl3j6E32XrCZ7 MKKnlJhJeuvSA4Dm0SGp3m/G/W+Rmz0PIabUG/S57kvBosQZNv8LRapidloukeuwhiPd Rh5g== 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=DOHMWvbr3Z63nSFUQaulSgXC+Xhq8zHgLVzmAiSOJbc=; b=mSDxl1iJlQ8aUfkvxtNZPSDpRtSiJpGvgS48Sd/cyY4Lv5NLl4xCFdIdD0QjtBwybY kWq0Cr7U2iGaThYO8R+DynOGoKlrbWDMy/K7SSOsiYzU6o3yuCog8ivtWBYGj3dFSn8V K39CXf6h9B3zUVgf4uDr17KXlXcXNH6xzJ1ltp2+4h1BCnbeHR3W+F7rP5EbLYP22hQ1 5jXp9sTIJVMJ2wgdQoa/5BBZVFHTEK5eW28RVgz4vIjadHKKpmlE7zXTvTGZJqMjprhr J4JEZ0LiVV53Ef9zQX3bk7WW/PGSttrmPh7abAZlAzZXJVEt+BSHMn5vUSnkl7BUeQHs M7MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=TQ3yv6Is; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u14-20020a056a00124e00b004fa3a8dffb0si20853086pfi.103.2022.04.07.13.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:45:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=TQ3yv6Is; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 82EC33ABBF2; Thu, 7 Apr 2022 12:54:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346781AbiDGSNA (ORCPT + 99 others); Thu, 7 Apr 2022 14:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232908AbiDGSM6 (ORCPT ); Thu, 7 Apr 2022 14:12:58 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13AFC1903C3; Thu, 7 Apr 2022 11:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=DOHMWvbr3Z63nSFUQaulSgXC+Xhq8zHgLVzmAiSOJbc=; b=TQ3yv6Is+8a+xn3TBSun88S7hr K+KKf0InfVrqJZV4hMGgYIu9AFr/uKOv63e9E77YwbiCQWByyGTLphRK9PCYGiQeFUmtq5Nm7EAN4 9rS8EiLSWZrUBu1P3INVVUCtjbSYWX029mUbmPGc0b+dHR7Ruv88ZdvFUPZV97lROkx4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ncWaj-00Egnx-GF; Thu, 07 Apr 2022 20:10:45 +0200 Date: Thu, 7 Apr 2022 20:10:45 +0200 From: Andrew Lunn To: Felix Fietkau 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 Subject: Re: [PATCH v2 14/14] net: ethernet: mtk_eth_soc: support creating mac address based offload entries Message-ID: References: <20220405195755.10817-1-nbd@nbd.name> <20220405195755.10817-15-nbd@nbd.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220405195755.10817-15-nbd@nbd.name> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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 Tue, Apr 05, 2022 at 09:57:55PM +0200, Felix Fietkau wrote: > This will be used to implement a limited form of bridge offloading. > Since the hardware does not support flow table entries with just source > and destination MAC address, the driver has to emulate it. > > The hardware automatically creates entries entries for incoming flows, even > when they are bridged instead of routed, and reports when packets for these > flows have reached the minimum PPS rate for offloading. > > After this happens, we look up the L2 flow offload entry based on the MAC > header and fill in the output routing information in the flow table. > The dynamically created per-flow entries are automatically removed when > either the hardware flowtable entry expires, is replaced, or if the offload > rule they belong to is removed > + > + if (found) > + goto out; > + > + eh = eth_hdr(skb); > + ether_addr_copy(key.dest_mac, eh->h_dest); > + ether_addr_copy(key.src_mac, eh->h_source); > + tag = skb->data - 2; > + key.vlan = 0; > + switch (skb->protocol) { > +#if IS_ENABLED(CONFIG_NET_DSA) > + case htons(ETH_P_XDSA): > + if (!netdev_uses_dsa(skb->dev) || > + skb->dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK) > + goto out; > + > + tag += 4; > + if (get_unaligned_be16(tag) != ETH_P_8021Q) > + break; > + > + fallthrough; > +#endif > + case htons(ETH_P_8021Q): > + key.vlan = get_unaligned_be16(tag + 2) & VLAN_VID_MASK; > + break; > + default: > + break; > + } 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? So i'm wondering what is going on here. So is this a frame which has ingressed, either from the WiFi, or another switch port, gone to the software bridge, bridges to a DSA slave interface, the DSA tagger has added a tag and now it is in the master interface? Can you accelerate such frames? What is adding the DSA tag on the fast path? And in the opposite direction, frames which egress the switch which have a DSA tag and are heading to the WiFi, what is removing the tag? Does the accelerator also understand the tag and know what to do with it? Andrew