Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1693710rwe; Sat, 27 Aug 2022 14:31:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5yH2Z6F9gWENJt50rsLmh4trJzkgestKKaR3Yd7aI1W69QfJ7y6WMTxEinNvY/yRPPVvcp X-Received: by 2002:a63:182:0:b0:42b:291d:59fd with SMTP id 124-20020a630182000000b0042b291d59fdmr8559112pgb.90.1661635885814; Sat, 27 Aug 2022 14:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661635885; cv=none; d=google.com; s=arc-20160816; b=F6yIeYHLnCqYUiCC793pU1cq5lvUAp8siUMgyKPdCq6GDoZHH11QCPrc/tuMbpucU0 lg2xQpcLJAVd8z5zrzRwsP6B/5tGiPFpA4IZ3MhWab2BaTH1k6rSZrC1hgksLQqeUQyO OiTXwdDUBfLSpsjXfu2zj5FNG9i9Nk4d8UgsMcSE4DU+j81cUX0CCELQRFnJhTm6wmfo chbwo1Y/yWlu6ukDNJIEwvofhThKUQCH8HiebKEhu4wB1bwEqIB93jpwxrVHJFHOLrtO xhbIFg+FtfkG1sGbSVsKPjhhjOE6grv8Olvndohvx5GMcvcuFksx6gsceJ18XPxCaGXG mLNw== 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=CRZqPZ0CsJnbLBgq0fHZrQhxCISGhcMs7TmVXtYQckM=; b=i279Deb/4P09ZKFUjipkm/nmHEg9acdQW8ou7/v3OWxcs0PVUMu/a2ijbjHcUXLQUK 6VIAmtjRU34cPAfBcxKy/CA/j7vr9GalMxBc6oeL29MjgU7TrTJ3n+pEM5QJwApGjiiQ UhnHoJGPkS+uIXKFFcmhvcVgIxB91wm5dkJr78lLCgBD9fKTaijVUwHO1cOHgTbraZeR mGjoufL6u7RjvsXT+VR7KihbLmWnws1+Ga98ixA4oeFXK905al1NqP8c7s/1uZKU/Jql mcACS66HfWTmYBBy4IavGyQnQ0aqo47aXKKIU0ZiuLuzEhfJ2UyXmMK1qnba6XyRVuEq 00Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=WyrT+Vxx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w189-20020a6382c6000000b00408add1cf0bsi1853617pgd.43.2022.08.27.14.31.14; Sat, 27 Aug 2022 14:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=WyrT+Vxx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbiH0TMN (ORCPT + 99 others); Sat, 27 Aug 2022 15:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230450AbiH0TMM (ORCPT ); Sat, 27 Aug 2022 15:12:12 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6484DF14E7; Sat, 27 Aug 2022 12:12:11 -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=CRZqPZ0CsJnbLBgq0fHZrQhxCISGhcMs7TmVXtYQckM=; b=WyrT+VxxQPukJxBRdRmbYAgwsg gCgQRmHiKVN7qyRTKGAw+U9pPBNxKQOQ7DmbjyrTgO+fEn2+ix1FgdWzqFQFkUIiivoH0JEW2GYu1 s8gZcmuMKuuros8c4c2UFAZnLivSPW3D6883DaeamrtIChVB4JR4rOYA4I+3I6sNHfk8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oS1Dx-00EnYY-O0; Sat, 27 Aug 2022 21:12:05 +0200 Date: Sat, 27 Aug 2022 21:12:05 +0200 From: Andrew Lunn To: Maxime Chevallier Cc: davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Vladimir Oltean , Luka Perkov , Robert Marko Subject: Re: [PATCH net-next v3 3/5] net: ipqess: Add out-of-band DSA tagging support Message-ID: References: <20220826154650.615582-1-maxime.chevallier@bootlin.com> <20220826154650.615582-4-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220826154650.615582-4-maxime.chevallier@bootlin.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 > @@ -409,6 +412,12 @@ static int ipqess_rx_poll(struct ipqess_rx_ring *rx_ring, int budget) > __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), > rd->rrd4); > > + if (netdev_uses_dsa(rx_ring->ess->netdev)) { > + tag_info.dp = FIELD_GET(IPQESS_RRD_PORT_ID_MASK, rd->rrd1); > + tag_info.proto = DSA_TAG_PROTO_OOB; > + dsa_oob_tag_push(skb, &tag_info); > + } > + > napi_gro_receive(&rx_ring->napi_rx, skb); > > rx_ring->ess->stats.rx_packets++; > @@ -713,6 +722,22 @@ static void ipqess_rollback_tx(struct ipqess *eth, > tx_ring->head = start_index; > } > > +static void ipqess_process_dsa_tag_sh(struct ipqess *ess, struct sk_buff *skb, > + u32 *word3) > +{ > + struct dsa_oob_tag_info tag_info; > + > + if (!netdev_uses_dsa(ess->netdev)) > + return; > + > + if (dsa_oob_tag_pop(skb, &tag_info)) > + return; > + > + *word3 |= tag_info.dp << IPQESS_TPD_PORT_BITMAP_SHIFT; > + *word3 |= BIT(IPQESS_TPD_FROM_CPU_SHIFT); > + *word3 |= 0x3e << IPQESS_TPD_PORT_BITMAP_SHIFT; > +} Using netdev_uses_dsa() here will work, but you are on the fast path. You are following a lot of pointers, which could be bad on the cache. You might want to consider caching this as a bool in struct ipqess. Maybe update the cache on NETDEV_CHANGEUPPER? Andrew