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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 785DAC10F1B for ; Tue, 27 Dec 2022 09:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:Subject:From:References:Cc:To: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QU71iXq96Bvv9KhI+UYDKBK23iQdttSfFJ7vcFha1vE=; b=jGMtuXew/rNOuW P2QpY/kPsEwFsthchy+vUwl/9drjRoL66gyC+arf0bOgMv5HICFx4w/E/f49xO2UdOajKdp62HQQn IcuIBd8oLhBG5t5Hg5AkR/L7YA9NpgkVFY902zdIMg9w1g3G5DjKiIc7sT6BIi0m7lOc6xmG4QRoX k9zqY5yfVRR0+wRYjkLTOsGW1I4/xqkOp58b/pPOKX0aoXzrRJfQlZbRboN4qCF4tEH/eJL5Pn2mg iaD6p5PA311szOgSXUsZ4F80I0q01ytXfsa5JbMdX8+BB1OWdqCK1F1t3t7z+tfMPdpbRw231etBs mGki63d3TzLu347ezqMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pA6hC-00BugO-MK; Tue, 27 Dec 2022 09:56:32 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pA6h6-00Bubg-SC; Tue, 27 Dec 2022 09:56:28 +0000 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=s5JtDBhzmiCYKFeCcbSGtbqGBoUAybbEuGC/hLArT4c=; b=B97kKfoQET0Oyt2jzS6spXRM+8 cxFwF2+lFIxzjjK9Ac9AbfmW7XMiyrPZKaTTjYu0qKmEq4ZaErxCCb5Ipx81PfEYKBN7VUMcO87Cr JZu72Bo8zT8nbFbZNGGfdH6Rvc/MhGhjNuzSZ3cQaZrCWJ1cUDTv7Xu2xuKdAbYXPyUE=; Received: from p200300daa720fc040c81ba64b0a9b1e5.dip0.t-ipconnect.de ([2003:da:a720:fc04:c81:ba64:b0a9:b1e5] 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 1pA6gg-00C1ck-GN; Tue, 27 Dec 2022 10:55:58 +0100 Message-ID: <9e4685a4-5dd1-9f7b-1235-30aebcc9dfd3@nbd.name> Date: Tue, 27 Dec 2022 10:55:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 To: Alexander Lobakin Cc: netdev@vger.kernel.org, John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org References: <20221123095754.36821-1-nbd@nbd.name> <20221123095754.36821-3-nbd@nbd.name> <20221124175410.5684-1-alexandr.lobakin@intel.com> Content-Language: en-US From: Felix Fietkau Subject: Re: [PATCH 3/5] net: ethernet: mtk_eth_soc: work around issue with sending small fragments In-Reply-To: <20221124175410.5684-1-alexandr.lobakin@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221227_015626_896061_63DCF042 X-CRM114-Status: GOOD ( 20.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 24.11.22 18:54, Alexander Lobakin wrote: > From: Felix Fietkau > Date: Wed, 23 Nov 2022 10:57:52 +0100 > >> When frames are sent with very small fragments, the DMA engine appears to >> lock up and transmit attempts time out. Fix this by detecting the presence >> of small fragments and use skb_gso_segment + skb_linearize to deal with >> them > > Nit: all of your commit messages don't have a trailing dot (.), not > sure if it's important, but my eye is missing it definitely :D > > skb_gso_segment() and skb_linearize() are slow as hell. I think you > can do it differently. I guess only the first (head) and the last > frag can be so small, right? > > So, if a frag from shinfo->frags is less than 16, get a new frag of > the minimum acceptable size via netdev_alloc_frag(), copy the data > to it and pad the rest with zeroes. Then increase skb->len and > skb->data_len, skb_frag_unref() the current, "invalid" frag and > replace the pointer to the new frag. I didn't miss anything I > believe... Zero padding the tail is usual thing for NICs. skb frag > substitution is less common, but should be legit. > > If skb_headlen() is less than 16, try doing pskb_may_pull() + > __skb_pull() at first. The argument would be `16 - headlen`. If > pskb_may_pull() returns false, then yeah, you have no choice other > than segmenting and linearizing ._. I looked into this some more and spoke with people at MTK. It appears that in principle, the DMA engine is able to process very small fragments. However, when it is being flooded with them, a FIFO can overflow, which causes the hang that I was observing. I think your suggestion likely would not fix the issue completely. A MTK engineer also confirmed that my approach is the correct one for handling this. I will send v2 with an updated description. Thanks, - Felix _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel