efx.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /****************************************************************************
  2. * Driver for Solarflare Solarstorm network controllers and boards
  3. * Copyright 2005-2006 Fen Systems Ltd.
  4. * Copyright 2006-2009 Solarflare Communications Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation, incorporated herein by reference.
  9. */
  10. #ifndef EFX_EFX_H
  11. #define EFX_EFX_H
  12. #include "net_driver.h"
  13. /* PCI IDs */
  14. #define EFX_VENDID_SFC 0x1924
  15. #define FALCON_A_P_DEVID 0x0703
  16. #define FALCON_A_S_DEVID 0x6703
  17. #define FALCON_B_P_DEVID 0x0710
  18. #define BETHPAGE_A_P_DEVID 0x0803
  19. #define SIENA_A_P_DEVID 0x0813
  20. /* Solarstorm controllers use BAR 0 for I/O space and BAR 2(&3) for memory */
  21. #define EFX_MEM_BAR 2
  22. /* TX */
  23. extern int efx_probe_tx_queue(struct efx_tx_queue *tx_queue);
  24. extern void efx_remove_tx_queue(struct efx_tx_queue *tx_queue);
  25. extern void efx_init_tx_queue(struct efx_tx_queue *tx_queue);
  26. extern void efx_fini_tx_queue(struct efx_tx_queue *tx_queue);
  27. extern void efx_release_tx_buffers(struct efx_tx_queue *tx_queue);
  28. extern netdev_tx_t
  29. efx_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev);
  30. extern netdev_tx_t
  31. efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
  32. extern void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
  33. extern void efx_stop_queue(struct efx_channel *channel);
  34. extern void efx_wake_queue(struct efx_channel *channel);
  35. #define EFX_TXQ_SIZE 1024
  36. #define EFX_TXQ_MASK (EFX_TXQ_SIZE - 1)
  37. /* RX */
  38. extern int efx_probe_rx_queue(struct efx_rx_queue *rx_queue);
  39. extern void efx_remove_rx_queue(struct efx_rx_queue *rx_queue);
  40. extern void efx_init_rx_queue(struct efx_rx_queue *rx_queue);
  41. extern void efx_fini_rx_queue(struct efx_rx_queue *rx_queue);
  42. extern void efx_rx_strategy(struct efx_channel *channel);
  43. extern void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue);
  44. extern void efx_rx_slow_fill(unsigned long context);
  45. extern void __efx_rx_packet(struct efx_channel *channel,
  46. struct efx_rx_buffer *rx_buf, bool checksummed);
  47. extern void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
  48. unsigned int len, bool checksummed, bool discard);
  49. extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue);
  50. #define EFX_RXQ_SIZE 1024
  51. #define EFX_RXQ_MASK (EFX_RXQ_SIZE - 1)
  52. /* Channels */
  53. extern void efx_process_channel_now(struct efx_channel *channel);
  54. #define EFX_EVQ_SIZE 4096
  55. #define EFX_EVQ_MASK (EFX_EVQ_SIZE - 1)
  56. /* Ports */
  57. extern int efx_reconfigure_port(struct efx_nic *efx);
  58. extern int __efx_reconfigure_port(struct efx_nic *efx);
  59. /* Ethtool support */
  60. extern int efx_ethtool_get_settings(struct net_device *net_dev,
  61. struct ethtool_cmd *ecmd);
  62. extern int efx_ethtool_set_settings(struct net_device *net_dev,
  63. struct ethtool_cmd *ecmd);
  64. extern const struct ethtool_ops efx_ethtool_ops;
  65. /* Reset handling */
  66. extern int efx_reset(struct efx_nic *efx, enum reset_type method);
  67. extern void efx_reset_down(struct efx_nic *efx, enum reset_type method);
  68. extern int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok);
  69. /* Global */
  70. extern void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
  71. extern void efx_init_irq_moderation(struct efx_nic *efx, int tx_usecs,
  72. int rx_usecs, bool rx_adaptive);
  73. extern int efx_request_power(struct efx_nic *efx, int mw, const char *name);
  74. extern void efx_hex_dump(const u8 *, unsigned int, const char *);
  75. /* Dummy PHY ops for PHY drivers */
  76. extern int efx_port_dummy_op_int(struct efx_nic *efx);
  77. extern void efx_port_dummy_op_void(struct efx_nic *efx);
  78. extern void
  79. efx_port_dummy_op_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
  80. extern bool efx_port_dummy_op_poll(struct efx_nic *efx);
  81. /* MTD */
  82. #ifdef CONFIG_SFC_MTD
  83. extern int efx_mtd_probe(struct efx_nic *efx);
  84. extern void efx_mtd_rename(struct efx_nic *efx);
  85. extern void efx_mtd_remove(struct efx_nic *efx);
  86. #else
  87. static inline int efx_mtd_probe(struct efx_nic *efx) { return 0; }
  88. static inline void efx_mtd_rename(struct efx_nic *efx) {}
  89. static inline void efx_mtd_remove(struct efx_nic *efx) {}
  90. #endif
  91. extern unsigned int efx_monitor_interval;
  92. static inline void efx_schedule_channel(struct efx_channel *channel)
  93. {
  94. netif_vdbg(channel->efx, intr, channel->efx->net_dev,
  95. "channel %d scheduling NAPI poll on CPU%d\n",
  96. channel->channel, raw_smp_processor_id());
  97. channel->work_pending = true;
  98. napi_schedule(&channel->napi_str);
  99. }
  100. extern void efx_link_status_changed(struct efx_nic *efx);
  101. extern void efx_link_set_advertising(struct efx_nic *efx, u32);
  102. extern void efx_link_set_wanted_fc(struct efx_nic *efx, enum efx_fc_type);
  103. #endif /* EFX_EFX_H */