gmac.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*****************************************************************************
  2. * *
  3. * File: gmac.h *
  4. * $Revision: 1.6 $ *
  5. * $Date: 2005/06/21 18:29:47 $ *
  6. * Description: *
  7. * Generic MAC functionality. *
  8. * part of the Chelsio 10Gb Ethernet Driver. *
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License, version 2, as *
  12. * published by the Free Software Foundation. *
  13. * *
  14. * You should have received a copy of the GNU General Public License along *
  15. * with this program; if not, write to the Free Software Foundation, Inc., *
  16. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  17. * *
  18. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED *
  19. * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF *
  20. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
  21. * *
  22. * http://www.chelsio.com *
  23. * *
  24. * Copyright (c) 2003 - 2005 Chelsio Communications, Inc. *
  25. * All rights reserved. *
  26. * *
  27. * Maintainers: maintainers@chelsio.com *
  28. * *
  29. * Authors: Dimitrios Michailidis <dm@chelsio.com> *
  30. * Tina Yang <tainay@chelsio.com> *
  31. * Felix Marti <felix@chelsio.com> *
  32. * Scott Bardone <sbardone@chelsio.com> *
  33. * Kurt Ottaway <kottaway@chelsio.com> *
  34. * Frank DiMambro <frank@chelsio.com> *
  35. * *
  36. * History: *
  37. * *
  38. ****************************************************************************/
  39. #ifndef _CXGB_GMAC_H_
  40. #define _CXGB_GMAC_H_
  41. #include "common.h"
  42. enum { MAC_STATS_UPDATE_FAST, MAC_STATS_UPDATE_FULL };
  43. enum { MAC_DIRECTION_RX = 1, MAC_DIRECTION_TX = 2 };
  44. struct cmac_statistics {
  45. /* Transmit */
  46. u64 TxOctetsOK;
  47. u64 TxOctetsBad;
  48. u64 TxUnicastFramesOK;
  49. u64 TxMulticastFramesOK;
  50. u64 TxBroadcastFramesOK;
  51. u64 TxPauseFrames;
  52. u64 TxFramesWithDeferredXmissions;
  53. u64 TxLateCollisions;
  54. u64 TxTotalCollisions;
  55. u64 TxFramesAbortedDueToXSCollisions;
  56. u64 TxUnderrun;
  57. u64 TxLengthErrors;
  58. u64 TxInternalMACXmitError;
  59. u64 TxFramesWithExcessiveDeferral;
  60. u64 TxFCSErrors;
  61. /* Receive */
  62. u64 RxOctetsOK;
  63. u64 RxOctetsBad;
  64. u64 RxUnicastFramesOK;
  65. u64 RxMulticastFramesOK;
  66. u64 RxBroadcastFramesOK;
  67. u64 RxPauseFrames;
  68. u64 RxFCSErrors;
  69. u64 RxAlignErrors;
  70. u64 RxSymbolErrors;
  71. u64 RxDataErrors;
  72. u64 RxSequenceErrors;
  73. u64 RxRuntErrors;
  74. u64 RxJabberErrors;
  75. u64 RxInternalMACRcvError;
  76. u64 RxInRangeLengthErrors;
  77. u64 RxOutOfRangeLengthField;
  78. u64 RxFrameTooLongErrors;
  79. };
  80. struct cmac_ops {
  81. void (*destroy)(struct cmac *);
  82. int (*reset)(struct cmac *);
  83. int (*interrupt_enable)(struct cmac *);
  84. int (*interrupt_disable)(struct cmac *);
  85. int (*interrupt_clear)(struct cmac *);
  86. int (*interrupt_handler)(struct cmac *);
  87. int (*enable)(struct cmac *, int);
  88. int (*disable)(struct cmac *, int);
  89. int (*loopback_enable)(struct cmac *);
  90. int (*loopback_disable)(struct cmac *);
  91. int (*set_mtu)(struct cmac *, int mtu);
  92. int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm);
  93. int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc);
  94. int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex,
  95. int *fc);
  96. const struct cmac_statistics *(*statistics_update)(struct cmac *, int);
  97. int (*macaddress_get)(struct cmac *, u8 mac_addr[6]);
  98. int (*macaddress_set)(struct cmac *, u8 mac_addr[6]);
  99. };
  100. typedef struct _cmac_instance cmac_instance;
  101. struct cmac {
  102. struct cmac_statistics stats;
  103. adapter_t *adapter;
  104. struct cmac_ops *ops;
  105. cmac_instance *instance;
  106. };
  107. struct gmac {
  108. unsigned int stats_update_period;
  109. struct cmac *(*create)(adapter_t *adapter, int index);
  110. int (*reset)(adapter_t *);
  111. };
  112. extern struct gmac t1_pm3393_ops;
  113. extern struct gmac t1_chelsio_mac_ops;
  114. extern struct gmac t1_vsc7321_ops;
  115. extern struct gmac t1_ixf1010_ops;
  116. extern struct gmac t1_dummy_mac_ops;
  117. #endif /* _CXGB_GMAC_H_ */