[comp.dcom.lans] Problem with NI5210 Packet Driver

richard@mqcomp.mqcc.mq.OZ (Richard Miller) (08/30/90)

Folkez,

I been having a problems writing my own programs that talk to the NI5210
packet driver (verison 6.2.1).  

I can send and receive packets left right and centre (no wuckers) but after 
a random period of time (aprox 0.5 Megs worth of traffic) every thing stops.
My PC stays up, but I stop getting interrupts from the PD completely and
I get seriously mysterfied.

Has anyone else out there with any ideas ?  I've been writing entirely in
Turbo C ( no assembler ) and I'm wondering if I'm missing something. I'm
enclosing a code fragment of my receiver for you to have a squiz at.

Next question: Is Version 6.2.1. the latest - and are there any other 
implementations for the NI5210 out there ?


Thanks in Advance,

Richard.

PS I've also had NCSA Telnet 2.3b8 fall over one when talking to the same
   packet driver.
 ____________________________________________________________________________
|   __                                                                       |
|  /_/ -__ /_ _ _ _ __/  /\/\ -//  _                                         |
| / \ /(_ / /(_/ / (_/  /   ////(~/                                          |
|                                                                            |
| School Math, Physics, Elec and Computing, Macquarie University SYDNEY AUST.|
|  Email: richard@mqcomp.mqcs.mq.oz.au ,Ph:+61 2 8058374, Fax:+61 2 8058983  |
|____________________________________________________________________________|

/*
** recv.c
**
**   This is an improved recv interrupt routine that services interrupts
**   from a Packet Driver.  It uses a whole heap of buffers to reduce the
**   number of packets that we drop.  Next time I'll allocate variable
**   size block.
**
** Richard Miller
** 11/Aug/90
*/

#include <dos.h>
#include "packet.h"

#define HEAPS	20

unsigned int drop_count = 0;
volatile int fullness = 0;

static unsigned char packet_buf[HEAPS][2000];	/* Ether packets are < 1600! */
static unsigned int  packet_size[HEAPS];
volatile static int head = 0, tail = 0;

/*
** Called twice by the packet driver - once to request a
** buffer for an incoming packet and once when the buffer
** has been copied and is ready for use
*/
void interrupt recv(unsigned bp,
		    unsigned di,
		    unsigned si,
		    unsigned ds,
		    unsigned es,
		    unsigned dx,
		    unsigned cx,	/* length */
		    unsigned bx,	/* Handle */
		    unsigned ax,	/* Flag */
		    unsigned ip,
		    unsigned cs,
		    unsigned flags)
{
    /* Request a Buffer */
    if (ax==0) {

	/* Fullness - the head's caught up the tail ! */
	if (fullness==HEAPS) {

	    /* Drop Packet */
	    es = di = 0;
	    drop_count ++;
	}
	else {

	    /* Where we want the packet put */

	    es = FP_SEG(packet_buf[head]);
	    di = FP_OFF(packet_buf[head]);
	    packet_size[head] = cx;

	    head ++;
	    head %= HEAPS;
	}
    }
	
    /* Copy complete - advance the head to the next free buf */
    else 
	fullness++;
}

void drop_buf(void)
{
    tail ++;
    tail %= HEAPS;
    fullness--;
}

-------------------- End Of Fragment --------------------------------------
 ____________________________________________________________________________
|   __                                                                       |
|  /_/ -__ /_ _ _ _ __/  /\/\ -//  _                                         |
| / \ /(_ / /(_/ / (_/  /   ////(~/                                          |
|                                                                            |
| School Math, Physics, Elec and Computing, Macquarie University SYDNEY AUST.|
|  Email: richard@mqcomp.mqcs.mq.oz.au ,Ph:+61 2 8058374, Fax:+61 2 8058983  |
|____________________________________________________________________________|