Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2011 18:52:52 -0500
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        beezarliu <beezarliu@yahoo.com.cn>
Cc:        freebsd-net@freebsd.org, Jack Vogel <jfvogel@gmail.com>, "bug-followup@FreeBSD.org" <bug-followup@freebsd.org>
Subject:   Re: Re: Re: kern/150516: [em] e1000 receive queue handling problem
Message-ID:  <AANLkTim0NFT2GrhMq77=K-=-4Q6xnh7saHy3c-Bid03N@mail.gmail.com>
In-Reply-To: <AANLkTik3x0qzffoizHMhfsOrYVG9UWKzyY7wf3pKO5QL@mail.gmail.com>
References:  <AANLkTi=HW4XqZ3PTB69fL5h-Qpqpae4C2sfLLdJSFxrs@mail.gmail.com> <201102231218136253955@yahoo.com.cn> <AANLkTinD%2B7Xo0RRZH818%2BM9cLKNYhC0eKAsVZPJbR1GK@mail.gmail.com> <201102231404144686577@yahoo.com.cn> <AANLkTik3x0qzffoizHMhfsOrYVG9UWKzyY7wf3pKO5QL@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Hi,

What is the point to invent a complex logic to detected a situation
the chip warn you about ?

The attached patch has currently survived longer than anything I've
been ever tested, without dirty hack, like raising `nmbclusters'.

Thanks in advance,
 - Arnaud

ps: this is a temporary patch, for my 82754 based system, I am aware
there is other user of IMS_ENABLE_MASK.

On Wed, Feb 23, 2011 at 2:52 AM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> 2011/2/23 beezarliu <beezarliu@yahoo.com.cn>:
>> I think you can replace sys/dev/e1000/*  with the files in stable/8,
>> and then uses this patch. It's much simpler.
>> :)
>>
> agree. I switched to the driver of 8-STABLE, applied your patch
> (without any conflict), fixed a bad version check (see [0]), built the
> kernel, rebooted, ran the test... and hung em(4) RX again. 141k missed
> packets (growing) and about 3k cluster allocations denied (constant)
> currently. TX is fine, but the NIC is unable to process ARP and ICMP
> reply sent back by the machine on the LAN.
>
> I did not test igb(4) as I do not have any on the path I directly
> control, but the fix in trunk survived a few day of similar testing.
>
>  - Arnaud
>
> [0]:
> diff --git a/sys/dev/e1000/if_igb.h b/sys/dev/e1000/if_igb.h
> index 4388e07..adef0af 100644
> --- a/sys/dev/e1000/if_igb.h
> +++ b/sys/dev/e1000/if_igb.h
> @@ -508,7 +508,7 @@ struct igb_rx_buf {
>        cur |= new;                             \
>  }
>
> -#if __FreeBSD_version < 800504
> +#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
>  static __inline int
>  drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
>  {
>

[-- Attachment #2 --]
From 265747561a2060469fe0c21094e77d44b2c0a39a Mon Sep 17 00:00:00 2001
From: Arnaud Lacombe <lacombar@gmail.com>
Date: Fri, 25 Feb 2011 18:47:48 -0500
Subject: [PATCH] if_em: handle RX overrun

---
 sys/dev/e1000/e1000_defines.h |    1 +
 sys/dev/e1000/if_em.c         |   21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h
index 5d09ad9..e0f51c4 100644
--- a/sys/dev/e1000/e1000_defines.h
+++ b/sys/dev/e1000/e1000_defines.h
@@ -865,6 +865,7 @@
 #define IMS_ENABLE_MASK ( \
     E1000_IMS_RXT0   |    \
     E1000_IMS_TXDW   |    \
+    E1000_IMS_RXO    |    \
     E1000_IMS_RXDMT0 |    \
     E1000_IMS_RXSEQ  |    \
     E1000_IMS_LSC)
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index e004cc7..d5e118a 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -283,6 +283,7 @@ static void	em_msix_link(void *);
 static void	em_handle_tx(void *context, int pending);
 static void	em_handle_rx(void *context, int pending);
 static void	em_handle_link(void *context, int pending);
+static void	em_handle_rx_overrun(void *context);
 
 static void	em_add_rx_process_limit(struct adapter *, const char *,
 		    const char *, int *, int);
@@ -1567,9 +1568,12 @@ em_msix_link(void *arg)
 	if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
 		adapter->hw.mac.get_link_status = 1;
 		em_handle_link(adapter, 0);
+	} else if (reg_icr & E1000_ICR_RXO) {
+		adapter->rx_overruns++;
+		em_handle_rx_overrun(adapter);
 	} else
 		E1000_WRITE_REG(&adapter->hw, E1000_IMS,
-		    EM_MSIX_LINK | E1000_IMS_LSC);
+		    EM_MSIX_LINK | E1000_IMS_LSC | E1000_IMS_RXO);
 	return;
 }
 
@@ -1627,6 +1631,21 @@ em_handle_link(void *context, int pending)
 	EM_CORE_UNLOCK(adapter);
 }
 
+static void
+em_handle_rx_overrun(void *context)
+{
+	struct adapter	*adapter = context;
+	struct ifnet *ifp = adapter->ifp;
+	struct rx_ring *rxr = adapter->rx_rings;
+
+	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+		return;
+
+	EM_CORE_LOCK(adapter);
+	em_refresh_mbufs(rxr, rxr->next_to_check);
+	E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_RXO);
+	EM_CORE_UNLOCK(adapter);
+}
 
 /*********************************************************************
  *
-- 
1.7.3.3.418.g704f6.dirty

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim0NFT2GrhMq77=K-=-4Q6xnh7saHy3c-Bid03N>