netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Felix Fietkau <nbd@openwrt.org>
Cc: netdev@vger.kernel.org, jgarzik@pobox.com, zambrano@broadcom.com
Subject: Re: [PATCH v2] b44: fix misalignment and wasted space in rx handling
Date: Fri, 9 Jan 2009 23:25:50 +0100	[thread overview]
Message-ID: <200901092325.50955.mb@bu3sch.de> (raw)
In-Reply-To: <4967459D.3070207@openwrt.org>

On Friday 09 January 2009 13:39:57 Felix Fietkau wrote:
> --- a/drivers/net/b44.c
> +++ b/drivers/net/b44.c
> @@ -73,8 +73,8 @@
>  	  (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP))
>  #define NEXT_TX(N)		(((N) + 1) & (B44_TX_RING_SIZE - 1))
>  
> -#define RX_PKT_OFFSET		30
> -#define RX_PKT_BUF_SZ		(1536 + RX_PKT_OFFSET + 64)
> +#define RX_PKT_OFFSET		(RX_HEADER_LEN + 2)
> +#define RX_PKT_BUF_SZ		(1536 + RX_PKT_OFFSET)
>  
>  /* minimum number of free TX descriptors required to wake up TX process */
>  #define B44_TX_WAKEUP_THRESH		(B44_TX_RING_SIZE / 4)
> @@ -682,7 +682,6 @@ static int b44_alloc_rx_skb(struct b44 *
>  	}
>  
>  	rh = (struct rx_header *) skb->data;
> -	skb_reserve(skb, RX_PKT_OFFSET);

Looks correct.

>  	rh->len = 0;
>  	rh->flags = 0;
> @@ -693,13 +692,13 @@ static int b44_alloc_rx_skb(struct b44 *
>  	if (src_map != NULL)
>  		src_map->skb = NULL;
>  
> -	ctrl  = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - RX_PKT_OFFSET));
> +	ctrl = (DESC_CTRL_LEN & RX_PKT_BUF_SZ);

Are you sure this is right? b43 has the same DMA engine, and we
subtract the offset from the buffer size there. So we end up with
the descriptor control field telling the space available for the frame payload.

So I think the correct code would be
	ctrl = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - RX_PKT_OFFSET));

>  	if (dest_idx == (B44_RX_RING_SIZE - 1))
>  		ctrl |= DESC_CTRL_EOT;
>  
>  	dp = &bp->rx_ring[dest_idx];
>  	dp->ctrl = cpu_to_le32(ctrl);
> -	dp->addr = cpu_to_le32((u32) mapping + RX_PKT_OFFSET + bp->dma_offset);
> +	dp->addr = cpu_to_le32((u32) mapping + bp->dma_offset);

This looks correct.

-- 
Greetings, Michael.

  reply	other threads:[~2009-01-09 22:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 12:39 [PATCH v2] b44: fix misalignment and wasted space in rx handling Felix Fietkau
2009-01-09 22:25 ` Michael Buesch [this message]
2009-01-09 22:55   ` Felix Fietkau
2009-01-10  7:08 ` David Miller

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=200901092325.50955.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=jgarzik@pobox.com \
    --cc=nbd@openwrt.org \
    --cc=netdev@vger.kernel.org \
    --cc=zambrano@broadcom.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).