Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3449424pxb; Fri, 4 Feb 2022 08:46:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXIZMLYTGvpEhyr9b31AZYVy1yvQPWUvkXXaPPULlb32z4uRfeyzP5t+zgyAwVk44B3bDx X-Received: by 2002:a17:907:1ca0:: with SMTP id nb32mr1196882ejc.395.1643993217088; Fri, 04 Feb 2022 08:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643993217; cv=none; d=google.com; s=arc-20160816; b=pw9NrjOYgXrMym2l90WfemldF9HoEKaJfiNp9uxvpa12VBlo2t3+PPI5q0SD0XOm88 T4yDDP9F1JFq5qvjedt9fI9vC/jabT9R8y/KL1RYkkgqlB41heYEGKHR0NoZWypYcl4h wcWLRuaSw7pbeSGjk1dCfX582423TzSrXTX8vN7TqBbMPRq0YoFtz2w4isgzKm2c3u7X +gUhxc5Fr3sXvJ6Dwv9dv6JiBNIEzuZ7fyv30HYBlH5xFzn8EqL69yAyUJRORNHPO6Xu /n1Zi8cQ12Pi3P4lKyCC2cZncXKnLVH4VsIwADSNWwaJlfWlDGuQNqA4wPQYhLbx+gL5 ++Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=vcIvMmyP46qb9TUidLri9xOGpmSdRVD6QipnitcaCdg=; b=fGt6kByjrA9WQEExZapoujWkNcvInz5e+qZ+HtI3YABgLNGKEX0b5+z9hLcKRhJIzZ uZARNv391y5aTXB53JQVQ5F1bTk7QXusheD+LGVfNjVZJ6iB0XDhaJlCVQ1vE+sWPfDZ X/UBVk29Eqi+dYitHYig7bHY5Mk4o5N/rFGwqGt3OKdtcl3lxk/O5mpD6+Z5+uRXgy/a QVKiTY7oEHkLYLmgchzV8KrMpQQHyIvfB2IbrF5KJs5EOHHAawlDsLR67+5Ia340q2VL OigLumzVmr2vMp1oLQT2gEb4h/NuDOjRUJL0BYR45u3zWGU0jWHCxnWb1Wc17lklCfzc RlLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mG9OBgnD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he20si1544620ejc.771.2022.02.04.08.46.30; Fri, 04 Feb 2022 08:46:57 -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=pass header.i=@kernel.org header.s=k20201202 header.b=mG9OBgnD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345721AbiBCUKb (ORCPT + 99 others); Thu, 3 Feb 2022 15:10:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231625AbiBCUKa (ORCPT ); Thu, 3 Feb 2022 15:10:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C7D5C061714; Thu, 3 Feb 2022 12:10:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 817F1619E6; Thu, 3 Feb 2022 20:10:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96F71C340E8; Thu, 3 Feb 2022 20:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643919028; bh=tdemnrdxS55d4CRNdh8HseqTkfZMq5xOxf+vvygaoTE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mG9OBgnDnMTatUgZ92dcn7rkUf1wn39vweLw3nEOcVbz2mgOw1oeaYHVvbYpdmZlt G4fPP/OfiTDlNgKnjV6u0qzU3gacNknksYYymRgTx4kUIbbSTyDDjhdi8YSMQcNLAE zrhGTtc3wauOgM7RJIL3/sPxyJENbFBGcTl2D9hgTEt/gBD8wp63vMFu3v9FxzFJ2T hGHIMZsAkKhPMnGt1kGQBH0i8x8bQ654KgfhwJDjocwsf1p5yGFvvanjP/rZqocLWB uaxxNpKjlMubZsFxh9CRRsLDZ12KH3HfVt0gZGZqBy+VgVsns5o9Ym2cym49bZnq+J NuYYjO6awc6sg== Date: Thu, 3 Feb 2022 12:10:27 -0800 From: Jakub Kicinski To: Vladimir Oltean Cc: Ansuel Smith , Florian Fainelli , Andrew Lunn , Vivien Didelot , "David S. Miller" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [RFC PATCH v7 00/16] Add support for qca8k mdio rw in Ethernet packet Message-ID: <20220203121027.7a6ea0f8@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20220203182128.z6xflse7fezccvhx@skbuf> References: <20220123013337.20945-1-ansuelsmth@gmail.com> <20220203182128.z6xflse7fezccvhx@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Feb 2022 20:21:28 +0200 Vladimir Oltean wrote: > To my knowledge, when you call dev_queue_xmit(), the skb is no longer > yours, end of story, it doesn't matter whether you increase the refcount > on it or not. The DSA master may choose to do whatever it wishes with > that buffer after its TX completion interrupt fires: it may not call > napi_consume_skb() but directly recycle that buffer in its pool of RX > buffers, as part of some weird buffer recycling scheme. So you'll think > that the buffer is yours, but it isn't, because the driver hasn't > returned it to the allocator, and your writes for the next packet may be > concurrent with some RX DMA transactions. I don't have a mainline > example to give you, but I've seen the pattern, and I don't think it's > illegal (although of course, I stand to be corrected if necessary). Are we talking about holding onto the Tx skb here or also recycling the Rx one? Sorry for another out of context comment in advance.. AFAIK in theory shared skbs are supposed to be untouched or unshared explicitly by the driver on Tx. pktgen takes advantage of it. We have IFF_TX_SKB_SHARING. In practice everyone gets opted into SKB_SHARING because ether_setup() sets the flag. A lot of drivers are not aware of the requirement and will assume full ownership (and for example use skb->cb[]) :/ I don't think there is any Tx completion -> Rx pool recycling scheme inside the drivers (if that's what you described).