gmac.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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, see <http://www.gnu.org/licenses/>. *
  16. * *
  17. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED *
  18. * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF *
  19. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
  20. * *
  21. * http://www.chelsio.com *
  22. * *
  23. * Copyright (c) 2003 - 2005 Chelsio Communications, Inc. *
  24. * All rights reserved. *
  25. * *
  26. * Maintainers: maintainers@chelsio.com *
  27. * *
  28. * Authors: Dimitrios Michailidis <dm@chelsio.com> *
  29. * Tina Yang <tainay@chelsio.com> *
  30. * Felix Marti <felix@chelsio.com> *
  31. * Scott Bardone <sbardone@chelsio.com> *
  32. * Kurt Ottaway <kottaway@chelsio.com> *
  33. * Frank DiMambro <frank@chelsio.com> *
  34. * *
  35. * History: *
  36. * *
  37. ****************************************************************************/
  38. #ifndef _CXGB_GMAC_H_
  39. #define _CXGB_GMAC_H_
  40. #include "common.h"
  41. enum {
  42. MAC_STATS_UPDATE_FAST,
  43. MAC_STATS_UPDATE_FULL
  44. };
  45. enum {
  46. MAC_DIRECTION_RX = 1,
  47. MAC_DIRECTION_TX = 2
  48. };
  49. struct cmac_statistics {
  50. /* Transmit */
  51. u64 TxOctetsOK;
  52. u64 TxOctetsBad;
  53. u64 TxUnicastFramesOK;
  54. u64 TxMulticastFramesOK;
  55. u64 TxBroadcastFramesOK;
  56. u64 TxPauseFrames;
  57. u64 TxFramesWithDeferredXmissions;
  58. u64 TxLateCollisions;
  59. u64 TxTotalCollisions;
  60. u64 TxFramesAbortedDueToXSCollisions;
  61. u64 TxUnderrun;
  62. u64 TxLengthErrors;
  63. u64 TxInternalMACXmitError;
  64. u64 TxFramesWithExcessiveDeferral;
  65. u64 TxFCSErrors;
  66. u64 TxJumboFramesOK;
  67. u64 TxJumboOctetsOK;
  68. /* Receive */
  69. u64 RxOctetsOK;
  70. u64 RxOctetsBad;
  71. u64 RxUnicastFramesOK;
  72. u64 RxMulticastFramesOK;
  73. u64 RxBroadcastFramesOK;
  74. u64 RxPauseFrames;
  75. u64 RxFCSErrors;
  76. u64 RxAlignErrors;
  77. u64 RxSymbolErrors;
  78. u64 RxDataErrors;
  79. u64 RxSequenceErrors;
  80. u64 RxRuntErrors;
  81. u64 RxJabberErrors;
  82. u64 RxInternalMACRcvError;
  83. u64 RxInRangeLengthErrors;
  84. u64 RxOutOfRangeLengthField;
  85. u64 RxFrameTooLongErrors;
  86. u64 RxJumboFramesOK;
  87. u64 RxJumboOctetsOK;
  88. };
  89. struct cmac_ops {
  90. void (*destroy)(struct cmac *);
  91. int (*reset)(struct cmac *);
  92. int (*interrupt_enable)(struct cmac *);
  93. int (*interrupt_disable)(struct cmac *);
  94. int (*interrupt_clear)(struct cmac *);
  95. int (*interrupt_handler)(struct cmac *);
  96. int (*enable)(struct cmac *, int);
  97. int (*disable)(struct cmac *, int);
  98. int (*loopback_enable)(struct cmac *);
  99. int (*loopback_disable)(struct cmac *);
  100. int (*set_mtu)(struct cmac *, int mtu);
  101. int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm);
  102. int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc);
  103. int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex,
  104. int *fc);
  105. const struct cmac_statistics *(*statistics_update)(struct cmac *, int);
  106. int (*macaddress_get)(struct cmac *, u8 mac_addr[6]);
  107. int (*macaddress_set)(struct cmac *, u8 mac_addr[6]);
  108. };
  109. typedef struct _cmac_instance cmac_instance;
  110. struct cmac {
  111. struct cmac_statistics stats;
  112. adapter_t *adapter;
  113. const struct cmac_ops *ops;
  114. cmac_instance *instance;
  115. };
  116. struct gmac {
  117. unsigned int stats_update_period;
  118. struct cmac *(*create)(adapter_t *adapter, int index);
  119. int (*reset)(adapter_t *);
  120. };
  121. extern const struct gmac t1_pm3393_ops;
  122. extern const struct gmac t1_vsc7326_ops;
  123. #endif /* _CXGB_GMAC_H_ */