netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Mike McCormack <mikem@ring3k.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] sky2: Account for VLAN tag in tx_le_req
Date: Fri, 11 Sep 2009 21:42:18 -0700	[thread overview]
Message-ID: <20090911214218.0cac5253@nehalam> (raw)
In-Reply-To: <4AAB12C9.3070707@ring3k.org>

On Sat, 12 Sep 2009 12:17:29 +0900
Mike McCormack <mikem@ring3k.org> wrote:

> With VLAN enabled, tx_le_req would return on less list elements than required,
>  leading to a potential wrap around of the transmit ring buffer.
> 
> Signed-off-by: Mike McCormack <mikem@ring3k.org>
> ---
>  drivers/net/sky2.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> index 00bc65a..018aa58 100644
> --- a/drivers/net/sky2.c
> +++ b/drivers/net/sky2.c
> @@ -66,7 +66,7 @@
>  
>  /* This is the worst case number of transmit list elements for a single skb:
>     VLAN + TSO + CKSUM + Data + skb_frags * DMA */
> -#define MAX_SKB_TX_LE	(4 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS)
> +#define MAX_SKB_TX_LE	(5 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS)
>  #define TX_MIN_PENDING		(MAX_SKB_TX_LE+1)
>  #define TX_MAX_PENDING		4096
>  #define TX_DEF_PENDING		127
> @@ -1576,6 +1576,11 @@ static unsigned tx_le_req(const struct sk_buff *skb)
>  	if (skb->ip_summed == CHECKSUM_PARTIAL)
>  		++count;
>  
> +#ifdef SKY2_VLAN_TAG_USED
> +	if (vlan_tx_tag_present(skb))
> +		++count;
> +#endif
> +
>  	return count;
>  }
>  

The vlan tag can be nested with either ADDR64 or GSO element.
The correct test would be to do something like:

    	if (skb_is_gso(skb))
		++count;
        else if (sizeof(dma_addr_t) == sizeof(u32) && 
                 vlan_tx_tag_present(skb))
                ++count;

And the MAX_SKB_TX_LE value is fine. 

-- 

      reply	other threads:[~2009-09-12  4:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12  3:17 [PATCH] sky2: Account for VLAN tag in tx_le_req Mike McCormack
2009-09-12  4:42 ` Stephen Hemminger [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=20090911214218.0cac5253@nehalam \
    --to=shemminger@linux-foundation.org \
    --cc=mikem@ring3k.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).