synopGMAC_Host.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #ifndef SYNOP_GMAC_HOST_H
  2. #define SYNOP_GMAC_HOST_H 1
  3. /*
  4. #include <linux/pci.h>
  5. #include <linux/netdevice.h>
  6. #include <linux/etherdevice.h>
  7. */
  8. #include "synopGMAC_plat.h"
  9. //#include "synopGMAC_pci_bus_interface.h"
  10. #include "synopGMAC_Dev.h"
  11. #include "mii.h"
  12. //#define ENH_DESC
  13. //#define ENH_DESC_8W
  14. struct net_device_stats
  15. {
  16. unsigned long rx_packets; /* total packets received */
  17. unsigned long tx_packets; /* total packets transmitted */
  18. unsigned long rx_bytes; /* total bytes received */
  19. unsigned long tx_bytes; /* total bytes transmitted */
  20. unsigned long rx_errors; /* bad packets received */
  21. unsigned long tx_errors; /* packet transmit problems */
  22. unsigned long rx_dropped; /* no space in linux buffers */
  23. unsigned long tx_dropped; /* no space available in linux */
  24. unsigned long multicast; /* multicast packets received */
  25. unsigned long collisions;
  26. /* detailed rx_errors: */
  27. unsigned long rx_length_errors;
  28. unsigned long rx_over_errors; /* receiver ring buff overflow */
  29. unsigned long rx_crc_errors; /* recved pkt with crc error */
  30. unsigned long rx_frame_errors; /* recv'd frame alignment error */
  31. unsigned long rx_fifo_errors; /* recv'r fifo overrun */
  32. unsigned long rx_missed_errors; /* receiver missed packet */
  33. /* detailed tx_errors */
  34. unsigned long tx_aborted_errors;
  35. unsigned long tx_carrier_errors;
  36. unsigned long tx_fifo_errors;
  37. unsigned long tx_heartbeat_errors;
  38. unsigned long tx_window_errors;
  39. /* for cslip etc */
  40. unsigned long rx_compressed;
  41. unsigned long tx_compressed;
  42. };
  43. /*
  44. struct PmonInet{
  45. struct device sc_dev;
  46. void *sc_ih;
  47. struct arpcom arpcom;
  48. // struct mii_data sc_mii; // MII media information
  49. char dev_addr[6]; //the net interface's address
  50. unsigned long ioaddr;
  51. // int flags;
  52. // int mc_count;
  53. };
  54. */
  55. //typedef struct synopGMACAdapterStruct{
  56. #if 0
  57. struct synopGMACAdapterStruct{
  58. /*Device Dependent Data structur*/
  59. struct synopGMACdevice * synopGMACdev;
  60. /*Os/Platform Dependent Data Structures*/
  61. //struct pci_dev * synopGMACpcidev;
  62. //struct net_device *synopGMACnetdev;
  63. struct net_device_stats synopGMACNetStats;
  64. //u32 synopGMACPciState[16];
  65. struct PmonInet * PInetdev;
  66. //} synopGMACPciNetworkAdapter;
  67. }synopGMACNetworkAdapter;
  68. #endif
  69. typedef struct synopGMACNetworkAdapter{
  70. /*Device Dependent Data structur*/
  71. synopGMACdevice * synopGMACdev;
  72. /*Os/Platform Dependent Data Structures*/
  73. //struct pci_dev * synopGMACpcidev;
  74. //struct net_device *synopGMACnetdev;
  75. struct net_device_stats synopGMACNetStats;
  76. //u32 synopGMACPciState[16];
  77. //struct PmonInet * PInetdev;
  78. struct mii_if_info mii;
  79. } synopGMACPciNetworkAdapter;
  80. /*
  81. static struct mbuf * getmbuf(struct synopGMACNetworkAdapter * tp)
  82. {
  83. struct mbuf *m;
  84. // struct PomnInet * tp = adapter->PInetDev;
  85. MGETHDR(m, M_DONTWAIT, MT_DATA);
  86. if(m == NULL){
  87. printf("getmbuf failed, Out of memory!!!\n");
  88. return NULL;
  89. } else {
  90. MCLGET(m, M_DONTWAIT);
  91. if ((m->m_flags & M_EXT) == 0) {
  92. m_freem(m);
  93. return NULL;
  94. }
  95. if(m->m_data != m->m_ext.ext_buf){
  96. printf("m_data not equal to ext_buf!!!\n");
  97. }
  98. }
  99. #if defined(__mips__)
  100. // pci_sync_cache(tp->sc_pc, (vm_offset_t)tp->tx_buffer[entry], len, SYNC_W);
  101. ;
  102. #define RFA_ALIGNMENT_FUDGE 2
  103. m->m_data += RFA_ALIGNMENT_FUDGE;
  104. #else
  105. m->m_data += RFA_ALIGNMENT_FUDGE;
  106. #endif
  107. return m;
  108. }
  109. */
  110. #endif