[Skyeye-developer] SOLVED: The source code of 8019 netcard driver that can run onSkyEye

Michael.Kang blackfin.kang at gmail.com
Sun Aug 26 11:25:26 CST 2007


         After quick try,  I have not reproduced your result on
uClinux-dist-20070130 and skyeye-1.2.3 version. What is your
uClinux-dist version?Even I can not ping host machine from SkyEye.
       I will go on dig into the cause and will try uClinux-dist-20040408.

-- Thanks
-- Michael.Kang

On 8/26/07, Stanislav Meduna <stano at meduna.org> wrote:
> Stanislav Meduna wrote:
>
> >> Once I found that something wrong within the IRQ handling of
> >> the linux driver, I tried to fixed it and tested successfully by
> >> downloading lots on S3C44B0X simulation from the server
> >> running CrobFtp.
>
> OK, I got it to work. Two major problems in the linux part:
>
> - First, the uClinux is probably broken for this platform -
>   it sends EOI commands, but as data value it sends the same
>   as the address. As this happens in the deep assembler
>   part of linux, I was unable to fix it. However, commenting
>   the EOI routine in SkyEye had no ill effects and did not
>   make things worse.
>
> - Second, the rtl8019.c has indeed a grave bug - on interrupt
>   it reads one packet, even if there are more available.
>   On the next interrupt the oldest one (and only one)
>   is read etc. I fixed it by adding a loop and it seems
>   to work.
>
>
> Smaller problems in the skyeye's rtl8019:
>
> - The time compare routine is suspicious - I think it
>   did not work for some values of seconds and microseconds.
>   Fixed.
>
> - The timeout scheduling is suspicious - it schedules the
>   'packet was transmitted' interrupt <packet-length> _milliseconds_
>   after it arrived. Changed this to 10 ms fix, seems to work.
>
> - Promiscuos/multicast handling is broken - first the test
>   for broadcast is inverted, second the tuntap's MAC matches
>   the test for multicast address sometimes. Commented this
>   all out (so we are always promiscuos) - on tuntap
>   it does not make any difference anyway.
>
> I now have a SkyEye-version that is able to reliably respond to pings
> and passes a ftp smoke-test (I have to do some more tests).
>
> Please, review the changes and if the skyeye's part makes sense,
> include them to the svn trunk. The diffs are against svn r290.
> The original rtl8019.c can be found in one of the previous mails
> in this thread.
>
> > But I can't provide the modified source because my old machine
> > was gone.
>
> Hopefully the mailing list archive will be a better backup now ;)
>
> Thanks
> --
>                                     Stano
>
> --- linux-2.4.x/drivers/net/rtl8019.c.orig      2007-08-25 17:57:48.000000000 +0200
> +++ linux-2.4.x/drivers/net/rtl8019.c   2007-08-25 18:00:29.000000000 +0200
> @@ -99,6 +99,7 @@
>         }
>
>         if (RxStatus & 1) {
> +readpacket:
>                 TRACE("Receivex packet....\n");
>                 outportb(ISR, 0x1);              //clr Rx interupt
>                 SetRegPage(1);
> @@ -199,6 +200,9 @@
>                 priv->stats.rx_packets++;
>                 priv->stats.rx_bytes +=RxLength;
>                 netif_rx(skb);
> +               /* Process all unread data */
> +               if (RxPageEnd != RxNextPage)
> +                       goto readpacket;
>         } else {
>                 outportb(ISR, 0xfe);
>         }
>
> Index: device/net/dev_net_rtl8019.c
> ===================================================================
> --- device/net/dev_net_rtl8019.c        (revision 290)
> +++ device/net/dev_net_rtl8019.c        (working copy)
> @@ -69,7 +69,7 @@
>         (memcmp(&tv1, &tv2, sizeof(struct timeval)) == 0 ?              \
>          0 : (                                                          \
>                 tv1.tv_sec < tv2.tv_sec ? -1 : (                        \
> -                       tv1.tv_usec < tv2.tv_usec ? -1 : 1              \
> +                       (tv1.tv_sec == tv2.tv_sec && tv1.tv_usec < tv2.tv_usec) ? -1 : 1                \
>         )))
>
>  static void set_time(int index, int packets)
> @@ -78,6 +78,7 @@
>
>         if (packets <= 0) return;
>         if (gettimeofday(&eth_timeout[index], NULL) != 0) return;
> +       packets=10; /* In 10 ms - no reason to wait 1 second for a big packet */
>
>         TIMEVAL_ADD_USEC(eth_timeout[index], packets * 1000);
>         eth_timeout_flags[index] = 1;
> @@ -815,9 +816,14 @@
>         frame_header[3] = (rtl8019_len >> 8);   //high 8 bit
>
>         /* check if we are in in promiscuous mode */
> +       /* The tuntap does sometimes match the multicast address and
> +        * we _want_ to get broadcasts. Ignore this all and play
> +        * promisc.
> +        */
> +#if 0
>         if (!(io->RCR & RCR_PRO)) {
>                 /* not in promiscuous mode */
> -               if (!is_broadcast (buf)) {
> +               if (is_broadcast (buf)) {
>                         DBG_PRINT
>                                 (" destination address is a broadcast address!!!\n");
>                         if (!(io->RCR & RCR_AB)) {
> @@ -839,6 +845,7 @@
>                         return;
>                 }
>         }
> +#endif
>
>         sramptr = &io->sram[(io->CURR - START_PAGE) * PAGE_SIZE];
>
> Index: arch/arm/mach/skyeye_mach_at91.c
> ===================================================================
> --- arch/arm/mach/skyeye_mach_at91.c    (revision 290)
> +++ arch/arm/mach/skyeye_mach_at91.c    (working copy)
> @@ -684,8 +684,14 @@
>                 break;
>         case 0xfffff130:        /* EOI */
>                 DBG_PRINT (stderr, "EOI=0x%x\n", data);
> +               /* 2.4.32 in uClinux is broken somehow and always sends
> +                * 0xfffff130 as both address and data, sometimes clearing
> +                * not yet processed interrupt. Anyway, the thing
> +                * works without the following */
> +#if 0
>                 io.eoicr = data;
>                 io.ipr &= ~data;
> +#endif
>                 at91_update_int (state);
>                 break;
>         case 0xfff00000:        /* CPU ID */
>
> _______________________________________________
> Skyeye-developer mailing list
> Skyeye-developer at lists.gro.clinux.org
> http://lists.gro.clinux.org/cgi-bin/mailman/listinfo/skyeye-developer
>
>


-- 
www.skyeye.org



More information about the Skyeye-developer mailing list