octeon-ethernet.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /**********************************************************************
  2. * Author: Cavium Networks
  3. *
  4. * Contact: support@caviumnetworks.com
  5. * This file is part of the OCTEON SDK
  6. *
  7. * Copyright (c) 2003-2010 Cavium Networks
  8. *
  9. * This file is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License, Version 2, as
  11. * published by the Free Software Foundation.
  12. *
  13. * This file is distributed in the hope that it will be useful, but
  14. * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
  15. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
  16. * NONINFRINGEMENT. See the GNU General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this file; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22. * or visit http://www.gnu.org/licenses/.
  23. *
  24. * This file may also be available under a different license from Cavium.
  25. * Contact Cavium Networks for more information
  26. **********************************************************************/
  27. /*
  28. * External interface for the Cavium Octeon ethernet driver.
  29. */
  30. #ifndef OCTEON_ETHERNET_H
  31. #define OCTEON_ETHERNET_H
  32. #include <linux/of.h>
  33. /**
  34. * This is the definition of the Ethernet driver's private
  35. * driver state stored in netdev_priv(dev).
  36. */
  37. struct octeon_ethernet {
  38. /* PKO hardware output port */
  39. int port;
  40. /* PKO hardware queue for the port */
  41. int queue;
  42. /* Hardware fetch and add to count outstanding tx buffers */
  43. int fau;
  44. /* My netdev. */
  45. struct net_device *netdev;
  46. /*
  47. * Type of port. This is one of the enums in
  48. * cvmx_helper_interface_mode_t
  49. */
  50. int imode;
  51. /* List of outstanding tx buffers per queue */
  52. struct sk_buff_head tx_free_list[16];
  53. /* Device statistics */
  54. struct net_device_stats stats;
  55. struct phy_device *phydev;
  56. unsigned int last_link;
  57. /* Last negotiated link state */
  58. uint64_t link_info;
  59. /* Called periodically to check link status */
  60. void (*poll)(struct net_device *dev);
  61. struct delayed_work port_periodic_work;
  62. struct work_struct port_work; /* may be unused. */
  63. struct device_node *of_node;
  64. };
  65. int cvm_oct_free_work(void *work_queue_entry);
  66. extern int cvm_oct_rgmii_init(struct net_device *dev);
  67. extern void cvm_oct_rgmii_uninit(struct net_device *dev);
  68. extern int cvm_oct_rgmii_open(struct net_device *dev);
  69. extern int cvm_oct_rgmii_stop(struct net_device *dev);
  70. extern int cvm_oct_sgmii_init(struct net_device *dev);
  71. extern void cvm_oct_sgmii_uninit(struct net_device *dev);
  72. extern int cvm_oct_sgmii_open(struct net_device *dev);
  73. extern int cvm_oct_sgmii_stop(struct net_device *dev);
  74. extern int cvm_oct_spi_init(struct net_device *dev);
  75. extern void cvm_oct_spi_uninit(struct net_device *dev);
  76. extern int cvm_oct_xaui_init(struct net_device *dev);
  77. extern void cvm_oct_xaui_uninit(struct net_device *dev);
  78. extern int cvm_oct_xaui_open(struct net_device *dev);
  79. extern int cvm_oct_xaui_stop(struct net_device *dev);
  80. extern int cvm_oct_common_init(struct net_device *dev);
  81. extern void cvm_oct_common_uninit(struct net_device *dev);
  82. void cvm_oct_adjust_link(struct net_device *dev);
  83. int cvm_oct_common_stop(struct net_device *dev);
  84. extern int always_use_pow;
  85. extern int pow_send_group;
  86. extern int pow_receive_group;
  87. extern char pow_send_list[];
  88. extern struct net_device *cvm_oct_device[];
  89. extern struct workqueue_struct *cvm_oct_poll_queue;
  90. extern atomic_t cvm_oct_poll_queue_stopping;
  91. extern u64 cvm_oct_tx_poll_interval;
  92. extern int max_rx_cpus;
  93. extern int rx_napi_weight;
  94. #endif