/* apetqdrp.c */ /* Set probablistic drop threshold.. */ /* Random dropping works as follows: A 15 bit integer is */ /* randomly (we hope!) derived from the low order bits */ /* of the cycle counter. If the random value is > the */ /* drop threshold value the packet is dropped. */ /* Input to this program is drop percentage. */ #include #include #include "atmxram.h" #include "ape25.h" #include "atmuser.h" #include #include struct timezone dummy = {0,0}; char buf[1024]; int iobuf[4]; main( int argc, char **argv) { int fd; int tmq; int qln; fd = open("/dev/ape25", O_RDWR); if (argc < 2) { printf("You must give drop percentage as parm 1. \n"); exit(1); } sscanf(argv[1], "%d", iobuf); iobuf[0] = 100 - iobuf[0]; /* keep percentage */ iobuf[0] = (iobuf[0] * 32767) / 100; ioctl(fd, AIO_SETDROPTHRESH, iobuf); }