linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Haozhe Chang (常浩哲)" <Haozhe.Chang@mediatek.com>
To: "loic.poulain@linaro.org" <loic.poulain@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linuxwwan@intel.com" <linuxwwan@intel.com>,
	"m.chetan.kumar@linux.intel.com" <m.chetan.kumar@linux.intel.com>,
	"Haijun Liu (刘海军)" <haijun.liu@mediatek.com>,
	"chiranjeevi.rapolu@linux.intel.com"
	<chiranjeevi.rapolu@linux.intel.com>,
	"ryazanov.s.a@gmail.com" <ryazanov.s.a@gmail.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"Xiayu Zhang (张夏宇)" <Xiayu.Zhang@mediatek.com>,
	"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
	"chandrashekar.devegowda@intel.com"
	<chandrashekar.devegowda@intel.com>,
	"edumazet@google.com" <edumazet@google.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"Lambert Wang (王伟)" <Lambert.Wang@mediatek.com>,
	"ricardo.martinez@linux.intel.com"
	<ricardo.martinez@linux.intel.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"srv_heupstream@mediatek.com" <srv_heupstream@mediatek.com>
Subject: Re: [PATCH] wwan: core: Support slicing in port TX flow of WWAN subsystem
Date: Wed, 2 Nov 2022 05:27:07 +0000	[thread overview]
Message-ID: <fc0793c2e87d1944780a243258328cd148088c01.camel@mediatek.com> (raw)
In-Reply-To: <CAMZdPi-LCzrzM1eGsA_mKH-GZ1LgYXQqs4k8r=8gQAC3BRUFNg@mail.gmail.com>

On Sat, 2022-10-29 at 10:04 +0200, Loic Poulain wrote:
> On Thu, 27 Oct 2022 at 03:19, haozhe chang <haozhe.chang@mediatek.com
> > wrote:
> > 
> > On Wed, 2022-10-26 at 22:27 +0800, Loic Poulain wrote:
> > > On Wed, 26 Oct 2022 at 13:45, haozhe chang <
> > > haozhe.chang@mediatek.com
> > > > wrote:
> > > > 
> > > > On Wed, 2022-10-26 at 15:28 +0800, Loic Poulain wrote:
> > > > > Hi Haozhe,
> > > > > 
> > > > > On Wed, 26 Oct 2022 at 03:16, <haozhe.chang@mediatek.com>
> > > > > wrote:
> > > > > > 
> > > > > > From: haozhe chang <haozhe.chang@mediatek.com>
> > > > > > 
> > > > > > wwan_port_fops_write inputs the SKB parameter to the TX
> > > > > > callback of
> > > > > > the WWAN device driver. However, the WWAN device (e.g.,
> > > > > > t7xx)
> > > > > > may
> > > > > > have an MTU less than the size of SKB, causing the TX
> > > > > > buffer to
> > > > > > be
> > > > > > sliced and copied once more in the WWAN device driver.
> > > > > 
> > > > > The benefit of putting data in an skb is that it is easy to
> > > > > manipulate, so not sure why there is an additional copy in
> > > > > the
> > > > > first
> > > > > place. Isn't possible for the t7xx driver to consume the skb
> > > > > progressively (without intermediate copy), according to its
> > > > > own
> > > > > MTU
> > > > > limitation?
> > > > > 
> > > > 
> > > > t7xx driver needs to add metadata to the SKB head for each
> > > > fragment, so
> > > > the driver has to allocate a new buffer to copy
> > > > data(skb_put_data)
> > > > and
> > > > insert metadata.
> > > 
> > > Normally, once the first part (chunk) of the skb has been
> > > consumed
> > > (skb_pull) and written to the device, it will become part of the
> > > skb headroom, which can then be used for appending (skb_push) the
> > > header (metadata) of the second chunks, and so... right?
> > > 
> > > Just want to avoid a bunch of unnecessary copy/alloc here.
> > > 
> > 
> > t7xx DMA can transfer multiple fragments at once, if done as
> > recomended, the DMA performance will be inhibited.
> 
> OK, so the skb fragmentation is valid in t7xx case, but the way of
> doing it is kind of specific to t7xx. Maybe a more acceptable
> solution
> for a generic fragmentation feature would be to keep the extra
> fragments part of the 'main' skb, using skb chaining. That would
> allow
> the fragments to stay linked to a specific user transfer. So if
> fragmentation is enabled for a given driver, core only fills the
> initial skb with MTU size, and appends additional skb as fragments,
> you can look at mhi_net_skb_agg() for skb chaining example.
> 
OK, It is a good suggestion, I will implement it in patch v2. Also, any
advice on reserved headroom?
> Regards,
> Loic

      reply	other threads:[~2022-11-02  5:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  1:15 [PATCH] wwan: core: Support slicing in port TX flow of WWAN subsystem haozhe.chang
2022-10-26  7:28 ` Loic Poulain
2022-10-26 11:45   ` haozhe chang
2022-10-26 14:27     ` Loic Poulain
2022-10-27  1:19       ` haozhe chang
2022-10-29  8:04         ` Loic Poulain
2022-11-02  5:27           ` Haozhe Chang (常浩哲) [this message]

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=fc0793c2e87d1944780a243258328cd148088c01.camel@mediatek.com \
    --to=haozhe.chang@mediatek.com \
    --cc=Lambert.Wang@mediatek.com \
    --cc=Xiayu.Zhang@mediatek.com \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=chiranjeevi.rapolu@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=haijun.liu@mediatek.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxwwan@intel.com \
    --cc=loic.poulain@linaro.org \
    --cc=m.chetan.kumar@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ricardo.martinez@linux.intel.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=srv_heupstream@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;
as well as URLs for NNTP newsgroup(s).