From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 290BFC433E7 for ; Mon, 19 Oct 2020 12:19:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB14522268 for ; Mon, 19 Oct 2020 12:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726742AbgJSMT0 (ORCPT ); Mon, 19 Oct 2020 08:19:26 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:34532 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbgJSMTZ (ORCPT ); Mon, 19 Oct 2020 08:19:25 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kUU8G-002Uan-JZ; Mon, 19 Oct 2020 14:19:20 +0200 Date: Mon, 19 Oct 2020 14:19:20 +0200 From: Andrew Lunn To: Vladimir Oltean Cc: David Laight , 'Florian Fainelli' , "netdev@vger.kernel.org" , "vivien.didelot@gmail.com" , "kuba@kernel.org" , Christian Eggers , Kurt Kanzenbach Subject: Re: [RFC PATCH 02/13] net: dsa: implement a central TX reallocation procedure Message-ID: <20201019121920.GM456889@lunn.ch> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> <20201017213611.2557565-3-vladimir.oltean@nxp.com> <20201017220104.wejlxn2a4seefkfv@skbuf> <049e7fd8f46c43819a05689fe464df25@AcuMS.aculab.com> <20201019103047.oq5ki3jlhnwzz2xv@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201019103047.oq5ki3jlhnwzz2xv@skbuf> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Oct 19, 2020 at 10:30:47AM +0000, Vladimir Oltean wrote: > On Mon, Oct 19, 2020 at 08:33:27AM +0000, David Laight wrote: > > Is it possible to send the extra bytes from a separate buffer fragment? > > The entire area could be allocated (coherent) when the rings are > > allocated. > > That would save having to modify the skb at all. > > > > Even if some bytes of the frame header need 'adjusting' transmitting > > from a copy may be faster - especially on systems with an iommu. > > > > Many (many) moons ago we found the cutoff point for copying frames > > on a system with an iommu to be around 1k bytes. > > Please help me understand better how to implement what you're suggesting. > DSA switches have 3 places where they might insert a tag: > 1. Between the source MAC address and the EtherType (this is the most > common) > 2. Before the destination MAC address > 3. Before the FCS > > I imagine that the most common scenario (1) is also the most difficult > to implement using fragments, since I would need to split the Ethernet > header from the rest of the skb data area, which might defeat the > purpose. We also have length issues. Most scatter/gather DMA engines require the fragments are multiple of 4 bytes. Only the last segment does not have this length restriction. And some of the DSA tag headers are 2 bytes, or 1 byte. So some master devices are going to have to convert the fragments back to a linear buffer. Andrew