How can this condition work in minix first network driver DP8390 ?!

43 views
Skip to first unread message

Julien

unread,
Mar 18, 2021, 3:30:25 PM3/18/21
to minix3
Hello I'm reading the minix (book version) tcp/ip network stack starting from the driver DP8390
I can't see how the driver code can report error like collisions or fifo underrun. It's all about a weird if else condition :


In the interrupt routine the code check for error in the Interrupt Status Register (isr variable) by using the AND operator with ISR_TXE flag (transmit error) 
if (isr & ISR_TXE)
  dep->de_stat.ets_sendErr++; // if there is a transmission error then it increments a error stat counter
else {  // else if there is no transmission error
  tsr = inb_reg0(dep, DP_TSR); // check the Transmit Status Register
  if (tsr & TSR_COL)
     dep->de_stat.ets_collision++; // log collision errors
   if (tsr & TSR_ABT) 
       dep->de_stat.ets_transAb++; // log transmit aborts
 ...
 }
 
How can we have collision error or transmit aborts errors in the TSR (transmit status register) with the ISR_TXE (transmit errors) flag not set in the (Interrupt status register) ?


I must have missed something,
Thank you for your help

 Julien.

Peter Shkenev

unread,
Mar 18, 2021, 6:37:09 PM3/18/21
to minix3
Hello,

Here is what I've found about dp8390 card:
http://osdever.net/documents/WritingDriversForTheDP8390.pdf

According to this document, you may not only transmit a frame, but also receive one. In latter case, tsr does not have sense, Maybe, same holds if ISR_TXE bit is set.

Best regards,
Peter
четверг, 18 марта 2021 г. в 22:30:25 UTC+3, Julien:

Julien Paillé

unread,
Mar 19, 2021, 3:55:44 AM3/19/21
to min...@googlegroups.com
Hello Peter,

Indeed the dp8390 can also receive packets but the code I mentioned previously is enclosed in this if condition which filters only transmissions :
if (isr & (ISR_PTX | ISR_TXE)) // True if interrupt status register signal a packet transmitted or a transmit errors

Thank you !

--
You received this message because you are subscribed to a topic in the Google Groups "minix3" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/minix3/8Sg4-XsPCCM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to minix3+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/minix3/32aa8312-4b7b-4561-b21b-11f4ca156be1n%40googlegroups.com.

Peter Shkenev

unread,
Mar 20, 2021, 4:12:12 AM3/20/21
to minix3
Hello,

I mean that tsr may be undefined if ISR_TXE is set. If I understand correctly, ISR_TXE may be set, for example, when the wire is cut (some unexpected event), while TSR may capture, for example, collisions, which is known event.

Best regards,
Peter
пятница, 19 марта 2021 г. в 10:55:44 UTC+3, Julien:

Julien Paillé

unread,
Mar 20, 2021, 4:57:04 AM3/20/21
to min...@googlegroups.com
Ok so maybe there is no correlation between the ISR_TXE flag and TSR errors. It would reports different errors.


it says about the TXE flag : (page 20)
  TRANSMIT ERROR: Set when packet transmitted with one or more of the following errors: Excessive Collisions, FIFO Underrun

it says about the TSR : (page 24)
This register records events that occur on the media during transmission of a packet. It is cleared when the next transmission is initiated by the host. All bits remain low unless the event that corresponds to a particular bit occurs during transmission. Each transmission should be followed by a read of this register. Events are :
   FIFO UNDERRUN: If the NIC cannot gain access of the bus before the FIFO empties, this bit is set. Transmission of the packet will be aborted.
   TRANSMIT ABORTED: Indicates the NIC aborted transmission because of excessive collisions. (Total number of transmissions including original transmission attempt equals 16).

Reading the datasheet I would say both are correlated, but maybe it's not the case 🤷‍♂️

Thank you Peter to take time to help me with this retro driver ! 

Have a nice day !

You received this message because you are subscribed to the Google Groups "minix3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minix3+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/minix3/548b9d29-ebf8-44f7-b25d-9a9fa5f8cbc1n%40googlegroups.com.

Peter Shkenev

unread,
Mar 20, 2021, 4:08:18 PM3/20/21
to minix3
Hello,

Well, looks like that is a strange code....

Best regards,
Peter

суббота, 20 марта 2021 г. в 11:57:04 UTC+3, Julien:
Reply all
Reply to author
Forward
0 new messages