Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3790541pxp; Tue, 15 Mar 2022 06:27:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzprp2hYRddg7W/Abd76FiDZDm+SBWHVK/zr6u1/N/MBfjVZTzAMBZ1Fz1D4qsYjCN25lj X-Received: by 2002:a17:907:720c:b0:6db:8e7c:2ec7 with SMTP id dr12-20020a170907720c00b006db8e7c2ec7mr18892047ejc.345.1647350853022; Tue, 15 Mar 2022 06:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647350853; cv=none; d=google.com; s=arc-20160816; b=0sCEhvGjxXksmXtXBdkXnMkQUlh36q1ndqUimKRLTBp+wmr/+JoJhruBtdjbHNo3qs v4A/XUoUKyissUlAlMeximYPz0DIULabYg6Iiaqutj3c5fQRCZMpry/x5CVNU7o5KoOQ Fq6GQkBem5A+vn82erzcvQIpHdRvLuig9SoT2A9alcR7/fCKlvRbKHoK6B8OXI2b1Eqy /BEFkelYmh310/3qTbw2O/DCWr/rl9cbDuUBiT+aSdX0nx97+KuRv9LiN9ZX6be9DCN4 xacTvsVhEHG+oJUSCh2EnlpxtFptRCdCVUO+6qccOrCENkzn+t/YUUVt/KsN4uMXx+rm 36Gg== 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=Va8Dxlyu1EIpGioD0Fw57gxB91rp+cakyHiCKVeug+s=; b=dzvw6T7faVtP0bd48dPZLXBAcRcoHKmq3P9315IZWvHTDOiijEpzseI2d0907i+jEj 1xcB/y+zJdq4wiFKkpRSkVqIBKaTj2Vl9ftgjSyPiBUF3Ac/8DXvVXz0LQkQYgV90keg VArAgqTASNy5bh0HJMxdSDpjpXUztwYPIOgcUWGlo9upHNs7/kS8VMXo++3MH3ChXrgH UOHcNWcv3CXNQyyIU5k7xvx06Gt/6PXaLpEg9QnMNdWi2GSMDeMgzJ2ZWIokxNH0mabr qz+IPajOS+0EWFsHLHlC5ktcsWwqTx52OOZkxf3D3+x2UntVwl94/YXA7CWTdQ2ESGHJ QeJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lbnAbiB+; 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 s10-20020a170906284a00b006a66a6a36a2si10460188ejc.293.2022.03.15.06.27.03; Tue, 15 Mar 2022 06:27:32 -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=@kernel.org header.s=k20201202 header.b=lbnAbiB+; 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 S242802AbiCNP6V (ORCPT + 99 others); Mon, 14 Mar 2022 11:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234054AbiCNP6T (ORCPT ); Mon, 14 Mar 2022 11:58:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC19403E5; Mon, 14 Mar 2022 08:57:09 -0700 (PDT) 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 BA40C61307; Mon, 14 Mar 2022 15:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AAA1C340E9; Mon, 14 Mar 2022 15:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647273427; bh=/rB6touVORwKOdNua1VLyFTBI38m6etM0LeyJRkf28I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lbnAbiB+xjtDfrTmBLaXAYV0gtMZi9Op4qc2ltgm1cEv8n6G4KIxXomoqHSWaULAO LjQIGlmHSernXc6PVtJmbUXfB7KeqA2jtNkS0fBMvDGPDNJZPKRvScjuqunoa5V0tx EBpQfls3GUeL8A4qVU/c7CtWOQOqudfnrrF3qM1zc7qHZ/IVRayFbKZNVkf623qzHX OmbIIALwcruJM1jt8LpHEdV/chD2JR9rinCrpDaNuK1XcLXOASi9kq5DssTAsvu0jr tT97BeNNgh7Rzrmc+PlBkUBQ2rSgc4iZQ8+ezp6HZMGJvb6iGa9rUSgn+zuUC1PPdW a90I4ankoPeSw== Date: Mon, 14 Mar 2022 08:57:05 -0700 From: Jakub Kicinski To: Biao Huang Cc: David Miller , Rob Herring , Bartosz Golaszewski , Fabien Parent , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , "Matthias Brugger" , , , , , , Yinghua Pan , , Macpaul Lin Subject: Re: [PATCH net-next v2 9/9] net: ethernet: mtk-star-emac: separate tx/rx handling with two NAPIs Message-ID: <20220314085705.32033308@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <2d0ab5290e63069f310987a4423ef2a46f02f1b3.camel@mediatek.com> References: <20220127015857.9868-1-biao.huang@mediatek.com> <20220127015857.9868-10-biao.huang@mediatek.com> <20220127194338.01722b3c@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <2bdb6c9b5ec90b6c606b7db8c13f8acb34910b36.camel@mediatek.com> <20220128074454.46d0ca29@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <2d0ab5290e63069f310987a4423ef2a46f02f1b3.camel@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 On Mon, 14 Mar 2022 15:01:23 +0800 Biao Huang wrote: > > Drivers are expected to stop their queues at the end of xmit routine > > if > > the ring can't accommodate another frame. It's more efficient to stop > > the queues early than have to put skbs already dequeued from the > > qdisc > > layer back into the qdiscs. > Yes, if descriptors ring is full, it's meaningful to stop the queue > at the end of xmit; > But driver seems hard to know how many descriptors the next skb will > request, e.g. 3 descriptors are available for next round send, but the > next skb may need 4 descriptors, in this case, we still need judge > whether descriptors are enough for skb transmission, then decide stop > the queue or not, at the beginning of xmit routine. > > Maybe we should judge ring is full or not at the beginning and the end > of xmit routine(seems a little redundancy). Assume the worst case scenario. You set the default ring size to 512, skb can have at most MAX_SKB_FRAGS fragments (usually 17) so the max number of descriptors should not be very high, hard to pre-compute, or problematic compared to the total ring size.