All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Marcin Wojtas <mw@semihalf.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	davem@davemloft.net, linux@arm.linux.org.uk,
	sebastian.hesselbarth@gmail.com, andrew@lunn.ch,
	jason@lakedaemon.net, thomas.petazzoni@free-electrons.com,
	gregory.clement@free-electrons.com, nadavh@marvell.com,
	alior@marvell.com, simon.guinot@sequanux.org,
	nitroshift@yahoo.com, jaz@semihalf.com
Subject: Re: [PATCH net-next 1/2] net: mvneta: add xmit_more support
Date: Tue, 13 Sep 2016 07:33:02 -0700	[thread overview]
Message-ID: <1473777182.18970.118.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <1473750006-21199-2-git-send-email-mw@semihalf.com>

On Tue, 2016-09-13 at 09:00 +0200, Marcin Wojtas wrote:
> From: Simon Guinot <simon.guinot@sequanux.org>
> 
> Basing on xmit_more flag of the skb, TX descriptors can be concatenated
> before flushing. This commit delay Tx descriptor flush if the queue is
> running and if there is more skb's to send.
> 
> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index d41c28d..b9dccea 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -512,6 +512,7 @@ struct mvneta_tx_queue {
>  	 * descriptor ring
>  	 */
>  	int count;
> +	int pending;
>  	int tx_stop_threshold;
>  	int tx_wake_threshold;
>  
> @@ -802,8 +803,9 @@ static void mvneta_txq_pend_desc_add(struct mvneta_port *pp,
>  	/* Only 255 descriptors can be added at once ; Assume caller
>  	 * process TX desriptors in quanta less than 256
>  	 */

Hi Marcin

Well, given the above comment, and fact that MVNETA_MAX_TXD == 532, it
looks like you might add a bug if more than 256 skb are given to your
ndo_start_xmit() with skb->xmit_more = 1

I therefore suggest you make sure it does not happen.

txq->pending += frags;
if (!skb->xmit_more ||
    txq->pending > 256 - MVNETA_MAX_SKB_DESCS ||
    netif_xmit_stopped(nq))
	mvneta_txq_pend_desc_add(pp, txq)

WARNING: multiple messages have this Message-ID (diff)
From: eric.dumazet@gmail.com (Eric Dumazet)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next 1/2] net: mvneta: add xmit_more support
Date: Tue, 13 Sep 2016 07:33:02 -0700	[thread overview]
Message-ID: <1473777182.18970.118.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <1473750006-21199-2-git-send-email-mw@semihalf.com>

On Tue, 2016-09-13 at 09:00 +0200, Marcin Wojtas wrote:
> From: Simon Guinot <simon.guinot@sequanux.org>
> 
> Basing on xmit_more flag of the skb, TX descriptors can be concatenated
> before flushing. This commit delay Tx descriptor flush if the queue is
> running and if there is more skb's to send.
> 
> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index d41c28d..b9dccea 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -512,6 +512,7 @@ struct mvneta_tx_queue {
>  	 * descriptor ring
>  	 */
>  	int count;
> +	int pending;
>  	int tx_stop_threshold;
>  	int tx_wake_threshold;
>  
> @@ -802,8 +803,9 @@ static void mvneta_txq_pend_desc_add(struct mvneta_port *pp,
>  	/* Only 255 descriptors can be added at once ; Assume caller
>  	 * process TX desriptors in quanta less than 256
>  	 */

Hi Marcin

Well, given the above comment, and fact that MVNETA_MAX_TXD == 532, it
looks like you might add a bug if more than 256 skb are given to your
ndo_start_xmit() with skb->xmit_more = 1

I therefore suggest you make sure it does not happen.

txq->pending += frags;
if (!skb->xmit_more ||
    txq->pending > 256 - MVNETA_MAX_SKB_DESCS ||
    netif_xmit_stopped(nq))
	mvneta_txq_pend_desc_add(pp, txq)

  reply	other threads:[~2016-09-13 14:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13  7:00 [PATCH net-next 0/2] mvneta xmit_more and bql support Marcin Wojtas
2016-09-13  7:00 ` Marcin Wojtas
2016-09-13  7:00 ` [PATCH net-next 1/2] net: mvneta: add xmit_more support Marcin Wojtas
2016-09-13  7:00   ` Marcin Wojtas
2016-09-13 14:33   ` Eric Dumazet [this message]
2016-09-13 14:33     ` Eric Dumazet
2016-09-13 14:42     ` Eric Dumazet
2016-09-13 14:42       ` Eric Dumazet
2016-09-13  7:00 ` [PATCH net-next 2/2] net: mvneta: add BQL support Marcin Wojtas
2016-09-13  7:00   ` Marcin Wojtas

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=1473777182.18970.118.camel@edumazet-glaptop3.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=jaz@semihalf.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=nitroshift@yahoo.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=simon.guinot@sequanux.org \
    --cc=thomas.petazzoni@free-electrons.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.