home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / pcc / v08n03 / netwrk.exe / WDPOST.ZIP / WDPOST.TAR / wdpost.dir / super / unix53 / wd.h < prev    next >
C/C++ Source or Header  |  1988-06-21  |  6KB  |  203 lines

  1. /*
  2.  * Module: WD8003
  3.  * Project: System V ViaNet
  4.  *
  5.  *        Copyright (c) 1987, 1988 by Western Digital Corporation.
  6.  *        All rights reserved.  Contains confidential information and
  7.  *        trade secrets proprietary to
  8.  *            Western Digital Corporation
  9.  *            2445 McCabe Way
  10.  *            Irvine, California 92714
  11.  */
  12.  
  13. #ident "@(#)wd.h    1.9    1/6/88"
  14.  
  15. /*
  16.  * Configuration options for WD 8003
  17.  */
  18.  
  19. #define WDVPKTSZ    (3*256)
  20. #define WDHIWAT        (16*WDVPKTSZ)
  21. #define WDLOWAT        (8*WDVPKTSZ)
  22. #define WDMAXPKT    1500
  23. #define WDMAXPKTLLC    1497    /* max packet when using LLC1 */
  24. #define WDMINSEND    60    /* 64 - 4 bytes CRC */
  25.  
  26. struct wddev {
  27.    unsigned short  wd_flags;    /* flags to indicate various status' */
  28.    unsigned short  wd_type;    /* LLC/Ether */
  29.    queue_t      *wd_qptr;    /* points queue associated with open device */
  30.    unsigned short  wd_mask;    /* mask for ether type or LLC SAPs */
  31.    unsigned short  wd_state;    /* state variable for DL_INFO */
  32.    unsigned short  wd_sap;    /* sap or ethertype depending on wd_type */
  33.    unsigned short  wd_snap[3];    /* for SNAP and other extentions */
  34.    unsigned short  wd_rws;    /* receive window size - for LLC2 */
  35.    unsigned short  wd_sws;    /* send window size - for LLC2 */
  36.    unsigned short  wd_rseq;    /* receive sequence number - for LLC2 */
  37.    unsigned short  wd_sseq;    /* send sequence number - for LLC2 */
  38. };
  39.  
  40. /* status bits */
  41. #define WDS_OPEN    0x01    /* minor device is opened */
  42. #define WDS_PROM    0x02    /* promiscuous mode enabled */
  43. #define WDS_XWAIT    0x04    /* waiting to be rescheduled */
  44. #define WDS_SU        0x80    /* opened by priviledged user */
  45. #define WDS_RWAIT    0x100    /* waiting for read reschedule */
  46. /* link protocol type */
  47. /* defined in lihdr.h */
  48.  
  49. struct wdparams {
  50.    short    wd_int;        /* interrupt level */
  51.    short    wd_ioaddr;        /* I/O port for device */
  52.    caddr_t  wd_base;        /* address of board's memory */
  53.    long     wd_memsize;        /* size of on-board memory */
  54. };
  55.  
  56. /* Debug Flags and other info */
  57.  
  58. #define WDSYSCALL    0x01    /* trace syscall functions */
  59. #define WDPUTPROC    0x02    /* trace put procedures */
  60. #define WDSRVPROC    0x04    /* trace service procedures */
  61. #define WDRECV        0x08    /* trace receive processing */
  62. #define WDRCVERR    0x10    /* trace receive errors */
  63. #define WDDLPRIM    0x20    /* trace DL primitives */
  64. #define WDINFODMP    0x40    /* dump info req data */
  65. #define WDDLPRIMERR    0x80    /* mostly llccmds errors */
  66. #define WDDLSTATE      0x100    /* print state chages */
  67. #define WDTRACE           0x200    /* trace loops */
  68. #define WDINTR           0x400    /* trace interrupt processing */
  69. #define WDBOARD           0x800    /* trace access to the board */
  70. #define WDLLC1          0x1000    /* trace llc1 processing */
  71. #define WDSEND          0x2000    /* trace sending */
  72. #define WDBUFFER      0x4000    /* trace buffer/canput fails */
  73. #define WDSCHED       0x8000    /* trace scheduler calls */
  74. #define WDXTRACE      0x10000    /* trace wdsend attempts */
  75.  
  76. /* define llc class 1 and mac structures and macros */
  77.  
  78. struct llctype {
  79.    unsigned short    llc_length;
  80.    unsigned char    llc_dsap;
  81.    unsigned char    llc_ssap;
  82.    unsigned char    llc_control;
  83.    unsigned char    llc_info[1];
  84. };
  85.  
  86. struct ethertype {
  87.    unsigned short ether_type;
  88.    unsigned char ether_data[1];
  89. };
  90.  
  91. struct wd_machdr {
  92.    unsigned char mac_dst[6];
  93.    unsigned char mac_src[6];
  94.    union {
  95.       struct ethertype ether;
  96.       struct llctype llc;
  97.    } mac_llc;
  98. };
  99.  
  100. typedef struct wd_machdr machdr_t;
  101.  
  102. #define LLC_SAP_LEN    1    /* length of sap only field */
  103. #define LLC_LSAP_LEN    2    /* length of sap/type field  */
  104. #define LLC_TYPE_LEN    2    /* ethernet type field length */
  105. #define LLC_ADDR_LEN    6    /* length of 802.3/ethernet address */
  106. #define LLC_LSAP_HDR_SIZE 3
  107. #define LLC_HDR_SIZE    (LLC_ADDR_LEN+LLC_ADDR_LEN+LLC_LSAP_HDR_SIZE+LLC_LSAP_LEN)
  108. #define LLC_EHDR_SIZE    (LLC_ADDR_LEN+LLC_ADDR_LEN+LLC_TYPE_LEN)
  109.  
  110. #define LLC_LIADDR_LEN    (LLC_ADDR_LEN+LLC_SAP_LEN)
  111. #define LLC_ENADDR_LEN  (LLC_ADDR_LEN+LLC_TYPE_LEN)
  112.  
  113. union llc_bind_fmt {
  114.    struct llca {
  115.       unsigned char  lbf_addr[LLC_ADDR_LEN];
  116.       unsigned short lbf_sap;
  117.    } llca;
  118.    struct llcb {
  119.       unsigned char  lbf_addr[LLC_ADDR_LEN];
  120.       unsigned short lbf_sap;
  121.       unsigned long  lbf_xsap;
  122.       unsigned long  lbf_type;
  123.    } llcb;
  124.    struct llcc {
  125.       unsigned char lbf_addr[LLC_ADDR_LEN];
  126.       unsigned char lbf_sap;
  127.    } llcc;
  128. };
  129.  
  130. #define LLC_LENGTH(m)    ntohs(((struct wd_machdr *)m)->mac_llc.llc.llc_length)
  131. #define LLC_DSAP(m)    (((struct wd_machdr *)m)->mac_llc.llc.llc_dsap)
  132. #define LLC_SSAP(m)    (((struct wd_machdr *)m)->mac_llc.llc.llc_ssap)
  133. #define LLC_CONTROL(m)    (((struct wd_machdr *)m)->mac_llc.llc.llc_control)
  134.  
  135. #define ETHER_TYPE(m)    ntohs(((struct wd_machdr *)m)->mac_llc.ether.ether_type)
  136.  
  137. #define WDMAXSAPVALUE    0xFF    /* larges LSAP value */
  138.  
  139. /* other useful macros */
  140.  
  141. #define HIGH(x) ((x>>8)&0xFF)
  142. #define LOW(x)    (x&0xFF)
  143.  
  144. /* recoverable error conditions */
  145.  
  146. #define WDE_OK        0    /* normal condition */
  147. #define WDE_NOBUFFER    1    /* couldn't allocb */
  148. #define WDE_INVALID    2    /* operation isn't valid at this time */
  149. #define WDE_BOUND    3    /* stream is already bound */
  150. #define WDE_BLOCKED    4    /* blocked at next queue */
  151.  
  152. /* LLC specific data - should be in separate header (later) */
  153.  
  154. #define LLC_UI        0x03    /* unnumbered information field */
  155. #define LLC_XID        0xAF    /* XID with P == 0 */
  156. #define LLC_TEST    0xE3    /* TEST with P == 0 */
  157.  
  158. #define LLC_P        0x10    /* P bit for use with XID/TEST */
  159. #define LLC_XID_FMTID    0x81    /* XID format identifier */
  160. #define LLC_SERVICES    0x01    /* Services supported */
  161. #define LLC_GLOBAL_SAP    0XFF    /* Global SAP address */
  162. #define LLC_GROUP_ADDR    0x01    /* indication in DSAP of a group address */
  163. #define LLC_RESPONSE    0x01    /* indication in SSAP of a response */
  164.  
  165. #define LLC_XID_INFO_SIZE    3 /* length of the INFO field */
  166.  
  167. struct rcv_buf {
  168.     unsigned char    status;
  169.     unsigned char    nxtpg;
  170.     short        datalen;
  171.     machdr_t    pkthdr;
  172. };
  173.  
  174. typedef struct rcv_buf rcv_buf_t;
  175.  
  176. /*
  177.  * WD 800X event statistics
  178.  */
  179.  
  180. struct wdstats {
  181.    /* transmit */
  182.    ulong    wds_xpkts;    /* 0 */
  183.    ulong    wds_xbytes;    /* 1 */
  184.    ulong    wds_excoll;    /* 2 */
  185.    ulong    wds_coll;    /* 3 */
  186.    ulong    wds_fifounder;    /* 4 */
  187.    ulong    wds_carrier;    /* 5 */
  188.  
  189.    /* receive */
  190.    ulong    wds_rpkts;    /* 6 */
  191.    ulong    wds_rbytes;    /* 7 */
  192.    ulong    wds_crc;    /* 8 */
  193.    ulong    wds_align;    /* 9 */
  194.    ulong    wds_fifoover;    /* 10 */
  195.    ulong    wds_lost;    /* 11 */
  196.    ulong    wds_multicast;    /* 12 */
  197.  
  198.    /* non-hardware */
  199.    ulong    wds_nobuffer;    /* 13 */
  200.    ulong    wds_blocked;    /* 14 */
  201.    ulong    wds_blocked2;    /* 15 */
  202. };
  203.