Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2875165rwb; Fri, 11 Nov 2022 16:48:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf6atnic5Di18U2egf9KBGYyfZhB2XFoqFYQFpgzmIc6On479+4/9bGPa9F7C7OgGDkTm5gE X-Received: by 2002:a17:906:3890:b0:791:9801:e4ea with SMTP id q16-20020a170906389000b007919801e4eamr3645357ejd.735.1668214118348; Fri, 11 Nov 2022 16:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668214118; cv=none; d=google.com; s=arc-20160816; b=E3NtWZqvZsXdaiJlJUGSltS7y6tA4kr9vVP0VIZmHTKFq2NH0X6H2rmiqPhXbmVVdr gIaB9r9yvRXauu4FjmWBjszY4mVm1QL9XqH58vn9zrtieGL+xXODiOiqkPfwbMmRRemA 3+PQ3VAOtvItG2jtvNlM6mvTFTV5+BCOAAQZKVktfTFA6vxPi1GOti23N/ladeX1wR3U yFQPYdnz3/CdYwEpSSu7Ij/+WFEJMMFQoDDbcxjZX7wEd3QtS8yA8zvxu/5lYVpOVGcG W73P6qyaDoPihXoSUE6/UIyaS5d9CZT2n64W1XnXkwU8PpeiQnv2Jr3aObX6PeZ0G/92 TtiA== 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=hOjwZzcNBym1jYh8JPbeeK1TzJNtOiX/GrSls8yxePI=; b=IQvcHSotgZHuPWjF8A4Qi2DU+C55qPmv2SRdT4x/WRwdQq0iS4OPndU8NdBHYPkb2K V/aRRhi+C7/uwpOUsiG9QPKPT5V7AZvbXR9hXAlwmluv1fvnkUc0t6w4g57LCIPhzbYc 2KH3PwT1NKQnkZdJSSxH8V/2sdLHH1rR23mqdByiTOQAGEwDNn93q0zi1HoKoW6hMnD/ 0Msj5G9V6qnhe0BtOVS76HO5DQ3ISO0KqDHiYVdh6H4rIruwQH0Px/OTbFDMWyPMOOV5 sUhc+4Tyl1CeK6JYk7pgRDGW1WmNwnX2dvBS62xSCsuY9qz85Gq7ifKdUMyMFcSrbsZ5 dtJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=LYmWzFGl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa6-20020a170907868600b007a45e4f4ff0si3190149ejc.885.2022.11.11.16.48.16; Fri, 11 Nov 2022 16:48:38 -0800 (PST) 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=fail header.i=@nbd.name header.s=20160729 header.b=LYmWzFGl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233870AbiKLAF1 (ORCPT + 90 others); Fri, 11 Nov 2022 19:05:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbiKLAFZ (ORCPT ); Fri, 11 Nov 2022 19:05:25 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F45D252B0; Fri, 11 Nov 2022 16:05:24 -0800 (PST) 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=hOjwZzcNBym1jYh8JPbeeK1TzJNtOiX/GrSls8yxePI=; b=LYmWzFGlPQ9b0AYgsYUpkBGNMh mIlVpjEw7+WUsaJOoVKWn4I1UvcBbs6nreHH+lbXhx5C+X2yz13hjOgQxXX7AHhcFSm86NogYoHem 8xV997J33u1+Xk3+rdf2LFkVDtDwRdMgAoPE/KDoJbEgDxPzuitm+aiODGTll+aHcnuU=; Received: from p54ae9c3f.dip0.t-ipconnect.de ([84.174.156.63] helo=nf.local) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ote1I-001EJk-AF; Sat, 12 Nov 2022 01:05:12 +0100 Message-ID: Date: Sat, 12 Nov 2022 01:05:10 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US To: Vladimir Oltean Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Vivien Didelot , Florian Fainelli , linux-kernel@vger.kernel.org References: <20221110212212.96825-1-nbd@nbd.name> <20221110212212.96825-2-nbd@nbd.name> <20221111233714.pmbc5qvq3g3hemhr@skbuf> From: Felix Fietkau Subject: Re: [PATCH net-next v3 1/4] net: dsa: add support for DSA rx offloading via metadata dst In-Reply-To: <20221111233714.pmbc5qvq3g3hemhr@skbuf> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_NONE 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 On 12.11.22 00:37, Vladimir Oltean wrote: > On Thu, Nov 10, 2022 at 10:22:08PM +0100, Felix Fietkau wrote: >> If a metadata dst is present with the type METADATA_HW_PORT_MUX on a dsa cpu >> port netdev, assume that it carries the port number and that there is no DSA >> tag present in the skb data. >> >> Signed-off-by: Felix Fietkau >> else >> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c >> index 64b14f655b23..0b67622cf905 100644 >> --- a/net/dsa/dsa.c >> +++ b/net/dsa/dsa.c >> @@ -11,6 +11,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "dsa_priv.h" >> >> @@ -216,6 +217,7 @@ static bool dsa_skb_defer_rx_timestamp(struct dsa_slave_priv *p, >> static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, >> struct packet_type *pt, struct net_device *unused) >> { >> + struct metadata_dst *md_dst = skb_metadata_dst(skb); >> struct dsa_port *cpu_dp = dev->dsa_ptr; >> struct sk_buff *nskb = NULL; >> struct dsa_slave_priv *p; >> @@ -229,7 +231,22 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, >> if (!skb) >> return 0; >> >> - nskb = cpu_dp->rcv(skb, dev); >> + if (md_dst && md_dst->type == METADATA_HW_PORT_MUX) { >> + unsigned int port = md_dst->u.port_info.port_id; >> + >> + skb_dst_set(skb, NULL); > > If you insist on not using the refcounting feature and free your > metadata_dst in the master's remove() function, that's going to > invalidate absolutely any point I'm trying to make. Normally I'd leave > you alone, however I really don't like that this is also forcing DSA to > not use the refcount, and therefore, that it's forcing any other driver > to do the same as mtk_eth_soc. Not sure how that's gonna scale in the > hypothetical future when there will be a DSA master which can offload > RX DSA tags, *and* the switch can change tagging protocols dynamically > (which will force the master to allocate/free its metadata dst's at > runtime too). I guess that will be for me to figure out, which I don't > like. > > Jakub, what do you think? Refcounting or no refcounting? If think that refcounting for the metadata dst is useful in this case, I can replace the skb_dst_set call with skb_dst_drop() in v4, so it would work for both cases. - Felix