All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: "Huang, Xiong" <xiong@qca.qualcomm.com>,
	"Ben Hutchings" <ben@decadent.org.uk>,
	"Anders Boström" <anders@netinsight.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"565404@bugs.debian.org" <565404@bugs.debian.org>
Subject: Re: Bug#565404: linux-image-2.6.26-2-amd64: atl1e: TSO is broken
Date: Tue, 02 Apr 2013 15:34:53 -0700	[thread overview]
Message-ID: <1364942093.5113.189.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130402221520.GF4924@order.stressinduktion.org>

On Wed, 2013-04-03 at 00:15 +0200, Hannes Frederic Sowa wrote:
> On Tue, Apr 02, 2013 at 03:00:38PM -0700, Eric Dumazet wrote:
> > On Tue, 2013-04-02 at 23:15 +0200, Hannes Frederic Sowa wrote:
> > 
> > > The error vanishes as soon as I put a gso size limit of MAX_TX_BUF_LEN
> > > in the driver. MAX_TX_BUF_LEN seems to be arbitrary set to 0x2000. I
> > > can even raise it to 0x3000 and don't see any tcp retransmits. Do you
> > > have an advice on how to size this value (e.g. should we switch to the
> > > windows values)?
> > 
> > This looks like an overflow error...
> 
> Thanks for your input, Eric.
> 
> I am limited in my time to work on this today but nontheless just tested
> your patch without any of my changes and count a lot of TcpRetransSegs
> again. Either there is really some hardware limitation or another
> overflow.

Another overflow...

Really I don't understand why people use u16 instead of u32.

u16 is slower most of the time, and more prone to overflows.

diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 7e0a822..48ac487 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -1569,18 +1569,17 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb)
 {
 	int i = 0;
 	u16 tpd_req = 1;
-	u16 fg_size = 0;
-	u16 proto_hdr_len = 0;
 
 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
-		fg_size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
+		u32 fg_size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
+
 		tpd_req += ((fg_size + MAX_TX_BUF_LEN - 1) >> MAX_TX_BUF_SHIFT);
 	}
 
 	if (skb_is_gso(skb)) {
 		if (skb->protocol == htons(ETH_P_IP) ||
 		   (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6)) {
-			proto_hdr_len = skb_transport_offset(skb) +
+			u32 proto_hdr_len = skb_transport_offset(skb) +
 					tcp_hdrlen(skb);
 			if (proto_hdr_len < skb_headlen(skb)) {
 				tpd_req += ((skb_headlen(skb) - proto_hdr_len +
@@ -1670,7 +1669,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
 {
 	struct atl1e_tpd_desc *use_tpd = NULL;
 	struct atl1e_tx_buffer *tx_buffer = NULL;
-	u16 buf_len = skb_headlen(skb);
+	u32 buf_len = skb_headlen(skb);
 	u16 map_len = 0;
 	u16 mapped_len = 0;
 	u16 hdr_len = 0;

  reply	other threads:[~2013-04-02 22:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100115.142502.968775035345957525.anders@netinsight.net>
     [not found] ` <1263767939.8876.94.camel@localhost>
2010-01-18 14:43   ` Bug#565404: linux-image-2.6.26-2-amd64: atl1e: TSO is broken Anders Boström
2010-01-20  6:03     ` Jie Yang
2010-01-20  9:27       ` Anders Boström
2010-01-21  5:37         ` Jie Yang
2010-01-21 16:42           ` Anders Boström
2010-01-23 15:29             ` Ben Hutchings
2010-01-24  1:36               ` Herbert Xu
2010-01-25  5:41             ` Jie Yang
2010-01-25 15:36               ` Anders Boström
2010-01-26  2:04                 ` Jie Yang
2010-01-26  8:34                   ` Anders Boström
2013-03-31  0:25                     ` Ben Hutchings
2013-03-31  0:43                       ` Huang, Xiong
2013-03-31  1:18                       ` Huang, Xiong
2013-03-31  2:10                         ` Ben Hutchings
2013-04-01  2:51                           ` Huang, Xiong
2013-04-02 21:15                             ` Hannes Frederic Sowa
2013-04-02 21:51                               ` Huang, Xiong
2013-04-02 22:19                                 ` Hannes Frederic Sowa
2013-04-02 22:23                                   ` Huang, Xiong
2013-04-03  0:00                                     ` Hannes Frederic Sowa
2013-04-03  0:12                                       ` Huang, Xiong
2013-04-03  0:43                                         ` Hannes Frederic Sowa
2013-04-02 22:00                               ` Eric Dumazet
2013-04-02 22:15                                 ` Hannes Frederic Sowa
2013-04-02 22:34                                   ` Eric Dumazet [this message]
2013-04-02 23:24                                     ` Hannes Frederic Sowa
2013-04-03  0:38                                     ` Hannes Frederic Sowa
2013-03-31 21:11                       ` Hannes Frederic Sowa
2013-04-02  7:35                       ` Anders Boström
2013-04-02  9:41                         ` Hannes Frederic Sowa
2013-04-02 12:22                           ` Anders Boström

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=1364942093.5113.189.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=565404@bugs.debian.org \
    --cc=anders@netinsight.net \
    --cc=ben@decadent.org.uk \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiong@qca.qualcomm.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.