[En-Nut-Discussion] Time needed to get packet from RTL on ATmega128

Dusan Ferbas dferbas at dfsoft.cz
Fri Jan 7 12:22:13 CET 2005


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  




More information about the En-Nut-Discussion mailing list