public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: Alexander Lobakin <alexandr.lobakin@intel.com>
Cc: netdev@vger.kernel.org, John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] net: ethernet: mtk_eth_soc: work around issue with sending small fragments
Date: Tue, 27 Dec 2022 10:55:57 +0100	[thread overview]
Message-ID: <9e4685a4-5dd1-9f7b-1235-30aebcc9dfd3@nbd.name> (raw)
In-Reply-To: <20221124175410.5684-1-alexandr.lobakin@intel.com>

On 24.11.22 18:54, Alexander Lobakin wrote:
> From: Felix Fietkau <nbd@nbd.name>
> 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


  reply	other threads:[~2022-12-27  9:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  9:57 [PATCH 1/5] net: ethernet: mtk_eth_soc: account for vlan in rx header length Felix Fietkau
2022-11-23  9:57 ` [PATCH 2/5] net: ethernet: mtk_eth_soc: compile out netsys v2 code on mt7621 Felix Fietkau
2022-11-23  9:57 ` [PATCH 3/5] net: ethernet: mtk_eth_soc: work around issue with sending small fragments Felix Fietkau
2022-11-24 17:54   ` Alexander Lobakin
2022-12-27  9:55     ` Felix Fietkau [this message]
2022-11-23  9:57 ` [PATCH 4/5] net: ethernet: mtk_eth_soc: fix flow_offload related refcount bug Felix Fietkau
2022-11-23  9:57 ` [PATCH 5/5] net: ethernet: mtk_eth_soc: drop generic vlan rx offload, only use DSA untagging Felix Fietkau
2022-12-04 12:35   ` Aw: " Frank Wunderlich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e4685a4-5dd1-9f7b-1235-30aebcc9dfd3@nbd.name \
    --to=nbd@nbd.name \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox