[En-Nut-Discussion] Time needed to get packet from RTL on ATmega128
Harald Kipp
harald.kipp at egnite.de
Sat Jan 8 12:06:19 CET 2005
Hi Dusan,
Not sure, what you are looking for.
The code below may indeed produce '@' on the debug
output.
(*ifn->if_recv)(dev, nb) is non-deterministic. With UDP
it ends up at NutEventPost(&sock->so_rx_rdy) in
udpin.c, where any higher priority thread may take over.
May be you can be more precisely about the actual problem
you are hunting.
Harald
At 12:22 07.01.2005 +0100, you wrote:
>Hi,
>
>can sb tell me the amount of time (approx. us) CPU spends with reading a
>packet in dev/nicrtl.c:THREAD(NicRx) with NicGetPacket ? (I would like to
>know times for ARP /short/, average UDP and full 1514 packet)
>
>I noticed that latest nicrtl driver removed check for serving max 10
>packets. We added following check (see below) based on tick count (whole
>time spent processing a packet) and characters '@' really appear in
>debugging output.
>
>I think it is not necessary to disable RTL ints because NutEventPost
>signals ni->ni_tx_rdy from NicInterrupt. When NicRx enters NutEventWait it
>should then proceed without waiting in NutEventWait.
>
>----
>...
> >> #define MAX_RECEIVING_TIME 100 //ms
> >> unsigned long end_tick_count;
>
> while (1) {
> NutEventWait(&ni->ni_rx_rdy, 0);
>
> >> end_tick_count = NutGetTickCount() + (MAX_RECEIVING_TIME*2)/125;
>
> /*
> * Fetch all packets from the NIC's internal
> * buffer and pass them to the registered handler.
> */
> do {
>
> nb = NicGetPacket();
>
> /* The sanity check may fail because the controller is too busy.
> restart the NIC. */
> if ((u_short) nb == 0xFFFF) {
> NicStart(ifn->if_mac);
> ni->ni_rx_size_errors++;
> } else if (nb) {
> ni->ni_rx_packets++;
> (*ifn->if_recv) (dev, nb);
> }
> >> if ((NutGetTickCount() >= end_tick_count))
> >> putchar('@');
>
> >> } while (nb && (NutGetTickCount() < end_tick_count));
>
>
>Dusan
>
>_______________________________________________
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de
>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
More information about the En-Nut-Discussion
mailing list