dgrs_ether.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * A filtering function. There are two filters/port. Filter "0"
  3. * is the input filter, and filter "1" is the output filter.
  4. */
  5. typedef int (FILTER_FUNC)(uchar *pktp, int pktlen, ulong *scratch, int port);
  6. #define NFILTERS 2
  7. /*
  8. * The per port structure
  9. */
  10. typedef struct
  11. {
  12. int chan; /* Channel number (0-3) */
  13. ulong portaddr; /* address of 596 port register */
  14. volatile ulong *ca; /* address of 596 chan attention */
  15. ulong intmask; /* Interrupt mask for this port */
  16. ulong intack; /* Ack bit for this port */
  17. uchar ethaddr[6]; /* Ethernet address of this port */
  18. int is_promisc; /* Port is promiscuous */
  19. int debug; /* Debugging turned on */
  20. I596_ISCP *iscpp; /* Uncached ISCP pointer */
  21. I596_SCP *scpp; /* Uncached SCP pointer */
  22. I596_SCB *scbp; /* Uncached SCB pointer */
  23. I596_ISCP iscp;
  24. I596_SCB scb;
  25. /* Command Queue */
  26. I596_CB *cb0;
  27. I596_CB *cbN;
  28. I596_CB *cb_head;
  29. I596_CB *cb_tail;
  30. /* Receive Queue */
  31. I596_RFD *rfd0;
  32. I596_RFD *rfdN;
  33. I596_RFD *rfd_head;
  34. I596_RFD *rfd_tail;
  35. /* Receive Buffers */
  36. I596_RBD *rbd0;
  37. I596_RBD *rbdN;
  38. I596_RBD *rbd_head;
  39. I596_RBD *rbd_tail;
  40. int buf_size; /* Size of an RBD buffer */
  41. int buf_cnt; /* Total RBD's allocated */
  42. /* Rx Statistics */
  43. ulong cnt_rx_cnt; /* Total packets rcvd, good and bad */
  44. ulong cnt_rx_good; /* Total good packets rcvd */
  45. ulong cnt_rx_bad; /* Total of all bad packets rcvd */
  46. /* Subtotals can be gotten from SCB */
  47. ulong cnt_rx_nores; /* No resources */
  48. ulong cnt_rx_bytes; /* Total bytes rcvd */
  49. /* Tx Statistics */
  50. ulong cnt_tx_queued;
  51. ulong cnt_tx_done;
  52. ulong cnt_tx_freed;
  53. ulong cnt_tx_nores; /* No resources */
  54. ulong cnt_tx_bad;
  55. ulong cnt_tx_err_late;
  56. ulong cnt_tx_err_nocrs;
  57. ulong cnt_tx_err_nocts;
  58. ulong cnt_tx_err_under;
  59. ulong cnt_tx_err_maxcol;
  60. ulong cnt_tx_collisions;
  61. /* Special stuff for host */
  62. # define rfd_freed cnt_rx_cnt
  63. ulong rbd_freed;
  64. int host_timer;
  65. /* Added after first beta */
  66. ulong cnt_tx_races; /* Counts race conditions */
  67. int spanstate;
  68. ulong cnt_st_tx; /* send span tree pkts */
  69. ulong cnt_st_fail_tx; /* Failures to send span tree pkts */
  70. ulong cnt_st_fail_rbd;/* Failures to send span tree pkts */
  71. ulong cnt_st_rx; /* rcv span tree pkts */
  72. ulong cnt_st_rx_bad; /* bogus st packets rcvd */
  73. ulong cnt_rx_fwd; /* Rcvd packets that were forwarded */
  74. ulong cnt_rx_mcast; /* Multicast pkts received */
  75. ulong cnt_tx_mcast; /* Multicast pkts transmitted */
  76. ulong cnt_tx_bytes; /* Bytes transmitted */
  77. /*
  78. * Packet filtering
  79. * Filter 0: input filter
  80. * Filter 1: output filter
  81. */
  82. ulong *filter_space[NFILTERS];
  83. FILTER_FUNC *filter_func[NFILTERS];
  84. ulong filter_cnt[NFILTERS];
  85. ulong filter_len[NFILTERS];
  86. ulong pad[ (512-300) / 4];
  87. } PORT;
  88. /*
  89. * Port[0] is host interface
  90. * Port[1..SE_NPORTS] are external 10 Base T ports. Fewer may be in
  91. * use, depending on whether this is an SE-4 or
  92. * an SE-6.
  93. * Port[SE_NPORTS] Pseudo-port for Spanning tree and SNMP
  94. */
  95. extern PORT Port[1+SE_NPORTS+1];
  96. extern int Nports; /* Number of genuine ethernet controllers */
  97. extern int Nchan; /* ... plus one for host interface */
  98. extern int FirstChan; /* 0 or 1, depedning on whether host is used */
  99. extern int NumChan; /* 4 or 5 */
  100. /*
  101. * A few globals
  102. */
  103. extern int IsPromisc;
  104. extern int MultiNicMode;
  105. /*
  106. * Functions
  107. */
  108. extern void eth_xmit_spew_on(PORT *p, int cnt);
  109. extern void eth_xmit_spew_off(PORT *p);
  110. extern I596_RBD *alloc_rbds(PORT *p, int num);
  111. extern I596_CB * eth_cb_alloc(PORT *p);