netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: "Haozhe Chang (常浩哲)" <Haozhe.Chang@mediatek.com>
Cc: "stephan@gerhold.net" <stephan@gerhold.net>,
	"oneukum@suse.com" <oneukum@suse.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-remoteproc@vger.kernel.org"
	<linux-remoteproc@vger.kernel.org>,
	"linuxwwan@intel.com" <linuxwwan@intel.com>,
	"m.chetan.kumar@intel.com" <m.chetan.kumar@intel.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"Hua Yang (杨华)" <Hua.Yang@mediatek.com>,
	"chiranjeevi.rapolu@linux.intel.com"
	<chiranjeevi.rapolu@linux.intel.com>,
	"Haijun Liu (刘海军)" <haijun.liu@mediatek.com>,
	"ryazanov.s.a@gmail.com" <ryazanov.s.a@gmail.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"loic.poulain@linaro.org" <loic.poulain@linaro.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
	"chandrashekar.devegowda@intel.com"
	<chandrashekar.devegowda@intel.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"shangxiaojing@huawei.com" <shangxiaojing@huawei.com>,
	"Lambert Wang (王伟)" <Lambert.Wang@mediatek.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"ricardo.martinez@linux.intel.com"
	<ricardo.martinez@linux.intel.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Xiayu Zhang (张夏宇)" <Xiayu.Zhang@mediatek.com>
Subject: Re: [PATCH v3] wwan: core: Support slicing in port TX flow of WWAN subsystem
Date: Mon, 14 Nov 2022 12:40:10 +0100	[thread overview]
Message-ID: <Y3IpGs0SFSgvS0kw@kroah.com> (raw)
In-Reply-To: <82c8728b0b0b20c7da4e25642e90de27af52feca.camel@mediatek.com>

On Mon, Nov 14, 2022 at 11:23:19AM +0000, Haozhe Chang (常浩哲) wrote:
> Hi Greg Kroah-Hartman
> 
> On Fri, 2022-11-11 at 16:02 +0100, Greg Kroah-Hartman wrote:
> > On Fri, Nov 11, 2022 at 06:08:36PM +0800, 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.
> > > 
> > > This patch implements the slicing in the WWAN subsystem and gives
> > > the WWAN devices driver the option to slice(by frag_len) or not. By
> > > doing so, the additional memory copy is reduced.
> > > 
> > > Meanwhile, this patch gives WWAN devices driver the option to
> > > reserve
> > > headroom in fragments for the device-specific metadata.
> > > 
> > > Signed-off-by: haozhe chang <haozhe.chang@mediatek.com>
> > > 
> > > ---
> > > Changes in v2
> > >   -send fragments to device driver by skb frag_list.
> > > 
> > > Changes in v3
> > >   -move frag_len and headroom_len setting to wwan_create_port.
> > > ---
> > >  drivers/net/wwan/iosm/iosm_ipc_port.c  |  3 +-
> > >  drivers/net/wwan/mhi_wwan_ctrl.c       |  2 +-
> > >  drivers/net/wwan/rpmsg_wwan_ctrl.c     |  2 +-
> > >  drivers/net/wwan/t7xx/t7xx_port_wwan.c | 34 +++++++--------
> > >  drivers/net/wwan/wwan_core.c           | 59 ++++++++++++++++++++
> > > ------
> > >  drivers/net/wwan/wwan_hwsim.c          |  2 +-
> > >  drivers/usb/class/cdc-wdm.c            |  2 +-
> > >  include/linux/wwan.h                   |  6 ++-
> > >  8 files changed, 73 insertions(+), 37 deletions(-)
> > > 
> > > diff --git a/drivers/net/wwan/iosm/iosm_ipc_port.c
> > > b/drivers/net/wwan/iosm/iosm_ipc_port.c
> > > index b6d81c627277..dc43b8f0d1af 100644
> > > --- a/drivers/net/wwan/iosm/iosm_ipc_port.c
> > > +++ b/drivers/net/wwan/iosm/iosm_ipc_port.c
> > > @@ -63,7 +63,8 @@ struct iosm_cdev *ipc_port_init(struct iosm_imem
> > > *ipc_imem,
> > >  	ipc_port->ipc_imem = ipc_imem;
> > >  
> > >  	ipc_port->iosm_port = wwan_create_port(ipc_port->dev,
> > > port_type,
> > > -					       &ipc_wwan_ctrl_ops,
> > > ipc_port);
> > > +					       &ipc_wwan_ctrl_ops, 0,
> > > 0,
> > > +					       ipc_port);
> > 
> > How is 0, 0 a valid option here?
> > 
> > and if it is a valid option, shouldn't you just have 2 different
> > functions, one that needs these values and one that does not?  That
> > would make it more descriptive as to what those options are, and
> > ensure
> > that you get them right.
> > 
> 0 is a valid option. 
> frag_len set to 0 means no split, and headroom set to 0 means no 
> reserved headroom in skb. 
> 
> Sorry, I can't understand why it's more descriptive, could you help
> with more information? It seems to me that the device driver needs to
> know what each parameter is and how to set them, and that process is
> also required in your proposed solution - "with 2 different functions",
> right?

When you see random integers in the middle of a function call like this,
you then have to go and look up the function call to determine what
exactly those values are and what is happening.  Using 0, 0 as valid
values helps no one out here at all.

While if the code said:
	ipc_port->iosm_port = wwan_create_port(ipc_port->dev, port_type,
						&ipc_wwan_ctrl_ops,
						NO_SPLIT,
						NO_RESERVED_HEADROOM,
						ipc_port);


or something like that, it would make more sense, right?

Remember, we write code for people to read and understand and maintain
it over time first, for the compiler second.

thanks,

greg k-h

  reply	other threads:[~2022-11-14 11:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 10:08 [PATCH v3] wwan: core: Support slicing in port TX flow of WWAN subsystem haozhe.chang
2022-11-11 15:02 ` Greg Kroah-Hartman
2022-11-14 11:23   ` Haozhe Chang (常浩哲)
2022-11-14 11:40     ` gregkh [this message]
2022-11-21 11:01       ` Haozhe Chang (常浩哲)

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=Y3IpGs0SFSgvS0kw@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Haozhe.Chang@mediatek.com \
    --cc=Hua.Yang@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-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxwwan@intel.com \
    --cc=loic.poulain@linaro.org \
    --cc=m.chetan.kumar@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=pabeni@redhat.com \
    --cc=ricardo.martinez@linux.intel.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=shangxiaojing@huawei.com \
    --cc=stephan@gerhold.net \
    /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).