On Thursday 21 February 2013 18:40:20 Tijs Van Buggenhout wrote:
> On Thursday 21 February 2013 16:13:07 Hauke Mehrtens wrote:
> > On 02/20/2013 02:46 PM, Cezary Jackiewicz wrote:
> > > Dnia 2013-02-20, o godz. 14:11:53
> > > 
> > > Hauke Mehrtens <ha...@hauke-m.de> napisa?(a):
> > >> On my e3200 Ethernet works with the default config. Are there more
> > >> problems discussed in this tread?
> > > 
> > > On my e3200 also ethernet seems to work, but often hangs up with:
> > > 
> > > [  121.980000] bgmac bcma0:1: Hardware reported transmission for empty 
TX
> > > ring slot 120! End of ring: 0 [  121.988000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 121! End of ring: 0 [ 
> > > 121.996000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 122! End of ring: 0 [  122.008000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 123! End of ring: 0 [ 
> > > 122.016000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 124! End of ring: 0 [  122.024000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 125! End of ring: 0 [ 
> > > 122.036000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 126! End of ring: 0 [  122.044000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 127! End of ring: 0 [ 
> > > 122.052000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 0! End of ring: 0 [  122.064000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 1! End of ring: 0 [ 
> > > 122.072000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 2! End of ring: 0 [  122.080000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 3! End of ring: 0 [ 
> > > 122.088000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 4! End of ring: 0 [  122.100000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 5! End of ring: 0 [ 
> > > 122.108000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 6! End of ring: 0 [  122.116000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 7! End of ring: 0 [ 
> > > 122.128000] bgmac bcma0:1: Hardware reported transmission for empty TX
> > > ring slot 8! End of ring: 0 [  122.136000] bgmac bcma0:1: Hardware
> > > reported transmission for empty TX ring slot 9! End of ring: 0
> > > 
> > > etc.
> > 
> > I have seen the same problem with my e3200. When this happens I see
> > ~17MByte/s of garbage traffic on the NIC of my desktop connected to this
> > devices. It looks like it sends out old packages or parts of it in an
> > endless loop. Most of them did not contained a valid Ethernet header but
> > some contained the OpenWrt logo, where I expected an Ethernet or IP
> > header. ;-)
> > 
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> I notice the same behaviour here. I see this happen regularly, when booting 
the device, without network cables plugged in, or no network traffic being 
received. By default, an udhcp client is run on internet interface, which 
sends out packets, but no answer is (ever) returned.
> 
> After about 300 seconds, the driver will start reporting these messages, 
after a while the system reboots.
> 
> I made a tcpdump on the wan port, which shows only udp dhcp requests being 
sent. At the moment the driver starts reporting, I can see two packets being 
echoed from the past (dhcp requests hold the 'seconds elapsed' field, which 
normally only augments).
> 
> Packets sent out, with increasing seconds elapsed: 
> 
> 17:53:54.097432 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.q.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:53:57.098021 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.t.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:00.101515 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.w.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102124 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 
> The following two packets are from the past
> 
> 17:54:03.102145 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gn.....1.Us.................... 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102152 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gn.....1.Us.   .................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 
> After this, the latest packet, with highest seconds elapsed field is being 
repeated indefinately at a high rate:
> 
> 17:54:03.102203 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102232 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102266 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102299 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102333 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102427 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 17:54:03.102434 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, 
Request from 20:aa:4b:21:19:73 (oui Unknown), length 351
> E..{....@.ys.........D.C.gl.....1.Us.z.................. 
.K!.s..........................................................................................................................................................................................................c.Sc5..9..@7.......*<.udhcp
 
1.19.4.................................................................................
> 
> On the other hand, I can stress the device for hours with high network load, 
without seeing this problem.
> 
> Regards,
> Tijs
> 

Hi all,

I tried to debug this some more, and to me it appears as if this is a problem 
of unaligned addressing (currently not supported by bgmac). I derived this 
from adding the following debug code to the driver, comparing the tx 
descriptor pointers returned by the hardware to the slot number/id.

I added some debugging code to the driver, as follows:

--- build_dir/target-mipsel_uClibc-0.9.33.2/linux-
brcm47xx/linux-3.6.11/drivers/net/ethernet/broadcom/bgmac.c.orig      
2013-02-20 12:41:03.122481212 +0100
+++ build_dir/target-mipsel_uClibc-0.9.33.2/linux-
brcm47xx/linux-3.6.11/drivers/net/ethernet/broadcom/bgmac.c   2013-02-22 
17:12:32.840669983 +0100
@@ -120,6 +120,8 @@
                free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS;
        else
                free_slots = ring->start - ring->end;
+       bgmac_warn(bgmac, "free tx slots on ring 0x%0X %d/%u (start %u, end 
%u)\n",
+                  ring->mmio_base, free_slots, ring->num_slots, ring->start, 
ring->end);
        if (free_slots == 1) {
                bgmac_err(bgmac, "TX ring is full, queue should be stopped!
\n");
                netif_stop_queue(net_dev);
@@ -153,8 +155,10 @@
        /* Increase ring->end to point empty slot. We tell hardware the first
         * slot it should *not* read.
         */
-       if (++ring->end >= BGMAC_TX_RING_SLOTS)
+       if (++ring->end >= BGMAC_TX_RING_SLOTS) {
                ring->end = 0;
+               bgmac_warn(bgmac, "rotate ring end to 0 on ring 0x%0X\n", 
ring->mmio_base);
+       }
        bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX,
                    ring->end * sizeof(struct bgmac_dma_desc));
 
@@ -174,13 +178,57 @@
 static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring 
*ring)
 {
        struct device *dma_dev = bgmac->core->dma_dev;
-       int empty_slot;
+       int empty_slot, empty_slot_orig, empty_slot_based;
+       u16 my_empty_slot, my_empty_slot_orig, my_empty_slot_based;
+       u32 ptr_base = lower_32_bits( ring->dma_base );
        bool freed = false;
 
+       if (ring->start == ring->end) {
+               bgmac_warn(bgmac, "Ignore dma_tx_free on empty ring\n");
+               return;
+       }
+
        /* The last slot that hardware didn't consume yet */
        empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
+       empty_slot_orig = empty_slot;
        empty_slot &= BGMAC_DMA_TX_STATDPTR;
+       empty_slot_based = my_empty_slot;
+       empty_slot_based -= ptr_base;
+       empty_slot_based &= BGMAC_DMA_TX_STATDPTR;
        empty_slot /= sizeof(struct bgmac_dma_desc);
+       empty_slot_based /= sizeof(struct bgmac_dma_desc);
+
+       my_empty_slot = bgmac_read(bgmac, ring->mmio_base + 
BGMAC_DMA_TX_STATUS);
+       my_empty_slot_orig = my_empty_slot;
+       my_empty_slot &= BGMAC_DMA_TX_STATDPTR;
+       my_empty_slot_based = my_empty_slot;
+       my_empty_slot_based -= ptr_base;
+       my_empty_slot_based &= BGMAC_DMA_TX_STATDPTR;
+       my_empty_slot /= sizeof(struct bgmac_dma_desc);
+       my_empty_slot_based /= sizeof(struct bgmac_dma_desc);
+
+       bgmac_warn(bgmac, "dma_tx_free - ring 0x%0x empty slot reported by 
hardware %d, "
+                         "as id %d base %d, ring id st %u en %u (uns hw %u id 
%u base %u)\n",
+                         ring->mmio_base, empty_slot_orig, empty_slot, 
empty_slot_based,
+                         ring->start, ring->end,
+                         my_empty_slot_orig, my_empty_slot, 
my_empty_slot_based);
+
+       if ((ring->start == 0) && (my_empty_slot > ring->end)) {
+               bgmac_warn(bgmac, "Bogus TX descriptor pointer %d, start %u, 
end %u\n",
+                                 my_empty_slot, ring->start, ring->end);
+       }
+
+       if ((ring->start == 0) && (empty_slot > ring->end)) {
+               bgmac_warn(bgmac, "Bogus TX descriptor pointer %d, start %u, 
end %u\n",
+                                 empty_slot, ring->start, ring->end);
+               return;
+       }
+
+       if (empty_slot >= BGMAC_TX_RING_SLOTS) {
+               bgmac_warn(bgmac, "Bogus TX descriptor pointer %d, start %u, 
end %u\n",
+                                 empty_slot, ring->start, ring->end);
+               return;
+       }
 
        while (ring->start != empty_slot) {
                struct bgmac_slot_info *slot = &ring->slots[ring->start];
@@ -1077,6 +1125,7 @@
        struct bgmac *bgmac = netdev_priv(dev_id);
 
        u32 int_status = bgmac_read(bgmac, BGMAC_INT_STATUS);
+       bgmac_warn(bgmac, "bgmac_interrupt - interrupt received 0x%0X, after 
mask (0x%0X) 0x%0X\n", int_status, bgmac->int_mask, int_status & bgmac-
>int_mask);
        int_status &= bgmac->int_mask;
 
        if (!int_status)

This excerpt of the serial log shows dma_tx_free succeeding, even after ring 
"rotation". When you look at the log lines, you'll notice that the last two 
numbers of each line (base and id) match each other. Id is the slot id 
reported by the hardware that can be freeed, whereas base represents the same 
id, but for unaligned addressing (subject to an offset to addr register, 
obtained from the lower 32 bits of ring dma_addr).

[  390.020000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 124, 
end 124)
[  390.028000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  390.036000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536872912, as id 125 base 0, ring id st 124 en 125 (uns hw 2000 id 
125 base 125)
[  393.056000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 125, 
end 125)
[  393.068000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  393.076000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536872928, as id 126 base 0, ring id st 125 en 126 (uns hw 2016 id 
126 base 126)
[  396.096000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 126, 
end 126)
[  396.104000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  396.112000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536872944, as id 127 base 0, ring id st 126 en 127 (uns hw 2032 id 
127 base 127)
[  399.132000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 127, 
end 127)
[  399.144000] bgmac bcma0:1: rotate ring end to 0 on ring 0x200
[  399.148000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  399.160000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536870912, as id 0 base 0, ring id st 127 en 0 (uns hw 0 id 0 base 0)
[  402.180000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 0, 
end 0)
[  402.188000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  402.196000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536870928, as id 1 base 0, ring id st 0 en 1 (uns hw 16 id 1 base 1)
[  405.216000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 1, 
end 1)
[  405.224000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  405.232000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536870944, as id 2 base 0, ring id st 1 en 2 (uns hw 32 id 2 base 2)
[  408.252000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 2, 
end 2)
[  408.260000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000

The next log excerpt shows a failing dma_tx_free, reporting errors. Here 
you'll notice that the last two numbers id and base do not match at all.

[  390.100000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 124, 
end 124)
[  390.108000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  390.116000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536872912, as id 125 base 256, ring id st 124 en 125 (uns hw 2000 id 
125 base 381)
[  393.136000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 125, 
end 125)
[  393.148000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  393.156000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536872928, as id 126 base 256, ring id st 125 en 126 (uns hw 2016 id 
126 base 382)
[  396.176000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 126, 
end 126)
[  396.184000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  396.196000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 536872944, as id 127 base 256, ring id st 126 en 127 (uns hw 2032 id 
127 base 383)
[  399.216000] bgmac bcma0:1: free tx slots on ring 0x200 128/128 (start 127, 
end 127)
[  399.224000] bgmac bcma0:1: rotate ring end to 0 on ring 0x200
[  399.228000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  399.240000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 268439984, as id 283 base 256, ring id st 127 en 0 (uns hw 4528 id 
283 base 27)
[  399.256000] bgmac bcma0:1: Bogus TX descriptor pointer 283, start 127, end 
0
[  399.264000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  399.276000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 268440928, as id 342 base 256, ring id st 127 en 0 (uns hw 5472 id 
342 base 86)
[  399.292000] bgmac bcma0:1: Bogus TX descriptor pointer 342, start 127, end 
0
[  399.296000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  399.308000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 268439712, as id 266 base 256, ring id st 127 en 0 (uns hw 4256 id 
266 base 10)
[  399.324000] bgmac bcma0:1: Bogus TX descriptor pointer 266, start 127, end 
0
[  399.332000] bgmac bcma0:1: bgmac_interrupt - interrupt received 0x1000000, 
after mask (0xF01FC00) 0x1000000
[  399.344000] bgmac bcma0:1: dma_tx_free - ring 0x200 empty slot reported by 
hardware 268440608, as id 322 base 256, ring id st 127 en 0 (uns hw 5152 id 
322 base 66)

Regards,
Tijs
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to