aq_nic.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * aQuantia Corporation Network Driver
  3. * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. */
  9. /* File aq_nic.h: Declaration of common code for NIC. */
  10. #ifndef AQ_NIC_H
  11. #define AQ_NIC_H
  12. #include "aq_common.h"
  13. #include "aq_rss.h"
  14. struct aq_ring_s;
  15. struct aq_pci_func_s;
  16. struct aq_hw_ops;
  17. #define AQ_NIC_FC_OFF 0U
  18. #define AQ_NIC_FC_TX 1U
  19. #define AQ_NIC_FC_RX 2U
  20. #define AQ_NIC_FC_FULL 3U
  21. #define AQ_NIC_FC_AUTO 4U
  22. #define AQ_NIC_RATE_10G BIT(0)
  23. #define AQ_NIC_RATE_5G BIT(1)
  24. #define AQ_NIC_RATE_5GSR BIT(2)
  25. #define AQ_NIC_RATE_2GS BIT(3)
  26. #define AQ_NIC_RATE_1G BIT(4)
  27. #define AQ_NIC_RATE_100M BIT(5)
  28. struct aq_nic_cfg_s {
  29. struct aq_hw_caps_s *aq_hw_caps;
  30. u64 hw_features;
  31. u32 rxds; /* rx ring size, descriptors # */
  32. u32 txds; /* tx ring size, descriptors # */
  33. u32 vecs; /* vecs==allocated irqs */
  34. u32 irq_type;
  35. u32 itr;
  36. u32 num_rss_queues;
  37. u32 mtu;
  38. u32 ucp_0x364;
  39. u32 flow_control;
  40. u32 link_speed_msk;
  41. u32 vlan_id;
  42. u16 is_mc_list_enabled;
  43. u16 mc_list_count;
  44. bool is_autoneg;
  45. bool is_interrupt_moderation;
  46. bool is_polling;
  47. bool is_rss;
  48. bool is_lro;
  49. u8 tcs;
  50. struct aq_rss_parameters aq_rss;
  51. };
  52. #define AQ_NIC_FLAG_STARTED 0x00000004U
  53. #define AQ_NIC_FLAG_STOPPING 0x00000008U
  54. #define AQ_NIC_FLAG_RESETTING 0x00000010U
  55. #define AQ_NIC_FLAG_CLOSING 0x00000020U
  56. #define AQ_NIC_LINK_DOWN 0x04000000U
  57. #define AQ_NIC_FLAG_ERR_UNPLUG 0x40000000U
  58. #define AQ_NIC_FLAG_ERR_HW 0x80000000U
  59. #define AQ_NIC_TCVEC2RING(_NIC_, _TC_, _VEC_) \
  60. ((_TC_) * AQ_CFG_TCS_MAX + (_VEC_))
  61. struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops,
  62. const struct ethtool_ops *et_ops,
  63. struct device *dev,
  64. struct aq_pci_func_s *aq_pci_func,
  65. unsigned int port,
  66. const struct aq_hw_ops *aq_hw_ops);
  67. int aq_nic_ndev_init(struct aq_nic_s *self);
  68. struct aq_nic_s *aq_nic_alloc_hot(struct net_device *ndev);
  69. void aq_nic_set_tx_ring(struct aq_nic_s *self, unsigned int idx,
  70. struct aq_ring_s *ring);
  71. struct device *aq_nic_get_dev(struct aq_nic_s *self);
  72. struct net_device *aq_nic_get_ndev(struct aq_nic_s *self);
  73. int aq_nic_init(struct aq_nic_s *self);
  74. int aq_nic_cfg_start(struct aq_nic_s *self);
  75. int aq_nic_ndev_register(struct aq_nic_s *self);
  76. void aq_nic_ndev_queue_start(struct aq_nic_s *self, unsigned int idx);
  77. void aq_nic_ndev_queue_stop(struct aq_nic_s *self, unsigned int idx);
  78. void aq_nic_ndev_free(struct aq_nic_s *self);
  79. int aq_nic_start(struct aq_nic_s *self);
  80. int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb);
  81. int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p);
  82. int aq_nic_get_regs_count(struct aq_nic_s *self);
  83. void aq_nic_get_stats(struct aq_nic_s *self, u64 *data);
  84. int aq_nic_stop(struct aq_nic_s *self);
  85. void aq_nic_deinit(struct aq_nic_s *self);
  86. void aq_nic_free_hot_resources(struct aq_nic_s *self);
  87. int aq_nic_set_mtu(struct aq_nic_s *self, int new_mtu);
  88. int aq_nic_set_mac(struct aq_nic_s *self, struct net_device *ndev);
  89. int aq_nic_set_packet_filter(struct aq_nic_s *self, unsigned int flags);
  90. int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev);
  91. unsigned int aq_nic_get_link_speed(struct aq_nic_s *self);
  92. void aq_nic_get_link_ksettings(struct aq_nic_s *self,
  93. struct ethtool_link_ksettings *cmd);
  94. int aq_nic_set_link_ksettings(struct aq_nic_s *self,
  95. const struct ethtool_link_ksettings *cmd);
  96. struct aq_nic_cfg_s *aq_nic_get_cfg(struct aq_nic_s *self);
  97. u32 aq_nic_get_fw_version(struct aq_nic_s *self);
  98. int aq_nic_change_pm_state(struct aq_nic_s *self, pm_message_t *pm_msg);
  99. #endif /* AQ_NIC_H */