Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp495906pxb; Thu, 5 Nov 2020 05:49:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOOWE3fJOS1w0kM19yvaM98BkN5ngAT6JHNRAU1z5LT+C9TszMiMrP+27EWxUvAuElxrB0 X-Received: by 2002:a17:906:51dd:: with SMTP id v29mr2408009ejk.69.1604584173668; Thu, 05 Nov 2020 05:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604584173; cv=none; d=google.com; s=arc-20160816; b=PLpUJUEWeYQoYOAVgsRDs7eciYB9eaiaDDeUNmDikeSAFChT9PHfsVw+3p5pew2ZMe oiGvWu1fGfOnAsRJmZ1MrUGCR4EcI7qy3zzpp33pT893IvjNddvpafkSrWGCW1jZ5Mo8 AnptSxBovvq8vBkr9vIM4v4mgM3ZrVU+J76/Ke2JrxsuNCFn2tN9ZsGqfcFuLsDwoeND +zngHYpZW8e41spgMOZSy+dP7tHj0KnreMTKy/xzTbJIBvfb9fg95s4YAg7MBnPrQIoW psyLjaVNjbx/SThbHwd6EH0X3kXRa+axKjIuJWLXjlICG8oDocDnz6KmjmTcuFPQbIlF XAvw== 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; bh=WHaZt4n2Pa32xOz+Oq7GcG5JqsZlfURqFpSseVZgM2k=; b=ZE2IWZNd1sUc/iUNmgkF/LGwWsz5GcQDd9v6Z5hI+iMM2b3zwzVTqo7lRLAd0EkHaD fWRGBL0c2B2YihLBhL1lwHyvFPjTR9SNZKyvstZtCw8PAaLSpeRa7cNNzo8SST6jJvJM reGyA+ekwbX7lzBqm+ykrfCu52t0wUTgtg15rw3f9ZjqsOJvSzSHS3seLPYVLVttiLlQ zF/mJdbiVApVb4swU6KGeor20xOG61sqtJe5IWrdAOk1J6x32yovUB3jQ+jQtSaBt7Dw T4ggq5bWVZYzIyoSg4bo43zjtyeTIWLH8+Qw3f1Mbec7b67AMS88MtvORkfpoqALfUU7 cdvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si1157012edy.496.2020.11.05.05.49.10; Thu, 05 Nov 2020 05:49:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730760AbgKENpS (ORCPT + 99 others); Thu, 5 Nov 2020 08:45:18 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:37210 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgKENpS (ORCPT ); Thu, 5 Nov 2020 08:45:18 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kafZg-005Pek-EM; Thu, 05 Nov 2020 14:45:12 +0100 Date: Thu, 5 Nov 2020 14:45:12 +0100 From: Andrew Lunn To: Ioana Ciornei Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Ioana Ciornei Subject: Re: [RFC 6/9] staging: dpaa2-switch: add .ndo_start_xmit() callback Message-ID: <20201105134512.GJ933237@lunn.ch> References: <20201104165720.2566399-1-ciorneiioana@gmail.com> <20201104165720.2566399-7-ciorneiioana@gmail.com> <20201105010439.GH933237@lunn.ch> <20201105082557.c43odnzis35y7khj@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201105082557.c43odnzis35y7khj@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Where is the TX confirm which uses this stored pointer. I don't see it > > in this file. > > > > The Tx confirm - dpaa2_switch_tx_conf() - is added in patch 5/9. Not so obvious. Could it be moved here? > > It can be expensive to store pointer like this in buffers used for > > DMA. > > Yes, it is. But the hardware does not give us any other indication that > a packet was actually sent so that we can move ahead with consuming the > initial skb. > > > It has to be flushed out of the cache here as part of the > > send. Then the TX complete needs to invalidate and then read it back > > into the cache. Or you use coherent memory which is just slow. > > > > It can be cheaper to keep a parallel ring in cacheable memory which > > never gets flushed. > > I'm afraid I don't really understand your suggestion. In this parallel > ring I would keep the skb pointers of all frames which are in-flight? > Then, when a packet is received on the Tx confirmation queue I would > have to loop over the parallel ring and determine somehow which skb was > this packet initially associated to. Isn't this even more expensive? I don't know this particular hardware, so i will talk in general terms. Generally, you have a transmit ring. You add new frames to be sent to the beginning of the ring, and you take off completed frames from the end of the ring. This is kept in 'expensive' memory, in that either it is coherent, or you need to do flushed/invalidates. It is expected that the hardware keeps to ring order. It does not pick and choose which frames it sends, it does them in order. That means completion also happens in ring order. So the driver can keep a simple linear array the size of the ring, in cachable memory, with pointers to the skbuf. And it just needs a counting index to know which one just completed. Now, your hardware is more complex. You have one queue feeding multiple switch ports. Maybe it does not keep to ring order? If you have one port running at 10M/Half, and another at 10G/Full, does it leave frames for the 10/Half port in the ring when its egress queue it full? That is probably a bad idea, since the 10G/Full port could then starve for lack of free slots in the ring? So my guess would be, the frames get dropped. And so ring order is maintained. If you are paranoid it could get out of sync, keep an array of tuples, address of the frame descriptor and the skbuf. If the fd address does not match what you expect, then do the linear search of the fd address, and increment a counter that something odd has happened. Andrew