netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] mv643xx_eth: hook up skb recycling
Date: Wed, 03 Sep 2008 16:25:34 +0200	[thread overview]
Message-ID: <48BE9E5E.2010702@cosmosbay.com> (raw)
In-Reply-To: <1220450101-21317-3-git-send-email-buytenh@wantstofly.org>

Lennert Buytenhek a écrit :
> This increases the maximum loss-free packet forwarding rate in
> routing workloads by typically about 25%.
> 
> Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
>


Interesting...

>  	refilled = 0;
>  	while (refilled < budget && rxq->rx_desc_count < rxq->rx_ring_size) {
>  		struct sk_buff *skb;
>  		int unaligned;
>  		int rx;
>  
> -		skb = dev_alloc_skb(skb_size + dma_get_cache_alignment() - 1);
> +		skb = __skb_dequeue(&mp->rx_recycle);

Here you take one skb at the head of queue

> +		if (skb == NULL)
> +			skb = dev_alloc_skb(mp->skb_size +
> +					    dma_get_cache_alignment() - 1);
> +
>  		if (skb == NULL) {
>  			mp->work_rx_oom |= 1 << rxq->index;
>  			goto oom;
> @@ -600,8 +591,8 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
>  			rxq->rx_used_desc = 0;
>  
>  		rxq->rx_desc_area[rx].buf_ptr = dma_map_single(NULL, skb->data,
> -						skb_size, DMA_FROM_DEVICE);
> -		rxq->rx_desc_area[rx].buf_size = skb_size;
> +						mp->skb_size, DMA_FROM_DEVICE);
> +		rxq->rx_desc_area[rx].buf_size = mp->skb_size;
>  		rxq->rx_skb[rx] = skb;
>  		wmb();
>  		rxq->rx_desc_area[rx].cmd_sts = BUFFER_OWNED_BY_DMA |
> @@ -905,8 +896,13 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
>  		else
>  			dma_unmap_page(NULL, addr, count, DMA_TO_DEVICE);
>  
> -		if (skb)
> -			dev_kfree_skb(skb);
> +		if (skb != NULL) {
> +			if (skb_queue_len(&mp->rx_recycle) < 1000 &&
> +			    skb_recycle_check(skb, mp->skb_size))
> +				__skb_queue_tail(&mp->rx_recycle, skb);
> +			else
> +				dev_kfree_skb(skb);
> +		}

Here you put a skb at the head of queue. So you use a FIFO mode.

To have best performance (cpu cache hot), you might try to use a LIFO mode (use __skb_queue_head()) ?

Could you give us your actual bench results (number of packets received per second, number of transmited packets per second), 
and your machine setup.

Thank you




  reply	other threads:[~2008-09-03 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-03 13:54 [PATCH,RFC 0/2] skb recycling (and example implementation for mv643xx_eth) Lennert Buytenhek
2008-09-03 13:55 ` [PATCH 1/2] [NET] add skb_recycle_check() to enable netdriver skb recycling Lennert Buytenhek
2008-09-03 13:55 ` [PATCH 2/2] mv643xx_eth: hook up " Lennert Buytenhek
2008-09-03 14:25   ` Eric Dumazet [this message]
2008-09-04  4:20     ` Lennert Buytenhek
2008-09-04  4:50       ` Eric Dumazet
2008-09-14 19:30         ` Lennert Buytenhek

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=48BE9E5E.2010702@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=buytenh@wantstofly.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).