netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@linaro.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: davem@davemloft.net, Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Hemant Kumar <hemantk@codeaurora.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: Re: [PATCH v4 1/2] net: Add mhi-net driver
Date: Fri, 16 Oct 2020 10:27:16 +0200	[thread overview]
Message-ID: <CAMZdPi_RtJRQu0hA=KBZyAWLryoDZW+a=x_GoHJrUP4APVstHQ@mail.gmail.com> (raw)
In-Reply-To: <62605ecb-3974-38a9-1f64-b08df6a72663@gmail.com>

Hi Eric,

On Thu, 15 Oct 2020 at 20:56, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 10/15/20 3:29 PM, Loic Poulain wrote:
> > On Thu, 15 Oct 2020 at 14:41, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >>
> >>
> >>
> >> On 10/15/20 12:31 PM, Loic Poulain wrote:
> >>> This patch adds a new network driver implementing MHI transport for
> >>> network packets. Packets can be in any format, though QMAP (rmnet)
> >>> is the usual protocol (flow control + PDN mux).
> >>>
> >>> It support two MHI devices, IP_HW0 which is, the path to the IPA
> >>> (IP accelerator) on qcom modem, And IP_SW0 which is the software
> >>> driven IP path (to modem CPU).
> >>>
> >>>
> >>> +static int mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev)
> >>> +{
> >>> +     struct mhi_net_dev *mhi_netdev = netdev_priv(ndev);
> >>> +     struct mhi_device *mdev = mhi_netdev->mdev;
> >>> +     int err;
> >>> +
> >>> +     skb_tx_timestamp(skb);
> >>> +
> >>> +     /* mhi_queue_skb is not thread-safe, but xmit is serialized by the
> >>> +      * network core. Once MHI core will be thread save, migrate to
> >>> +      * NETIF_F_LLTX support.
> >>> +      */
> >>> +     err = mhi_queue_skb(mdev, DMA_TO_DEVICE, skb, skb->len, MHI_EOT);
> >>> +     if (err == -ENOMEM) {
> >>> +             netif_stop_queue(ndev);
> >>
> >> If you return NETDEV_TX_BUSY, this means this skb will be requeues,
> >> then sent again right away, and this will potentially loop forever.
> >
> > The TX queue is stopped in that case, so the net core will not loop, right?
>
> -ENOMEM suggests a memory allocation failed.
>
> What is going to restart the queue when memory is available ?

The queue is restarted as soon as new ring elements are available, in
the tx complete callback (mhi_net_ul_callback).

>
> -ENOMEM seems weird if used for queue being full.

Regarding MHI core, that means no element is available in the ring to
push the buffer, so maybe -ENOSPC would be more suitable? This change
could be done in a subsequent series since it would request to modify
MHI core and other MHI drivers.

I'm not sure this is the right way, but this 'stop-queue and return
busy' is a pattern used in various other network drivers. However, I
understand that a better solution would be to stop the queue earlier,
as soon as ring is full and prevent this abnormal situation.

>
> >
> >>
> >> Also skb_tx_timestamp() would be called multiple times.
> >
> > OK so I'm going to remove that, maybe the MHI layer should mark
> > timestamp instead.
>
> Yes, probably.
>

      reply	other threads:[~2020-10-16  8:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 10:31 [PATCH v4 1/2] net: Add mhi-net driver Loic Poulain
2020-10-15 10:33 ` Loic Poulain
2020-10-15 12:41 ` Eric Dumazet
2020-10-15 13:29   ` Loic Poulain
2020-10-15 18:56     ` Eric Dumazet
2020-10-16  8:27       ` Loic Poulain [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='CAMZdPi_RtJRQu0hA=KBZyAWLryoDZW+a=x_GoHJrUP4APVstHQ@mail.gmail.com' \
    --to=loic.poulain@linaro.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=hemantk@codeaurora.org \
    --cc=kuba@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=netdev@vger.kernel.org \
    /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).