enic.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  3. * Copyright 2007 Nuova Systems, Inc. All rights reserved.
  4. *
  5. * This program is free software; you may redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; version 2 of the License.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  12. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  13. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  14. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  16. * SOFTWARE.
  17. *
  18. */
  19. #ifndef _ENIC_H_
  20. #define _ENIC_H_
  21. #include <linux/inet_lro.h>
  22. #include "vnic_enet.h"
  23. #include "vnic_dev.h"
  24. #include "vnic_wq.h"
  25. #include "vnic_rq.h"
  26. #include "vnic_cq.h"
  27. #include "vnic_intr.h"
  28. #include "vnic_stats.h"
  29. #include "vnic_nic.h"
  30. #include "vnic_rss.h"
  31. #define DRV_NAME "enic"
  32. #define DRV_DESCRIPTION "Cisco 10G Ethernet Driver"
  33. #define DRV_VERSION "1.1.0.100"
  34. #define DRV_COPYRIGHT "Copyright 2008-2009 Cisco Systems, Inc"
  35. #define PFX DRV_NAME ": "
  36. #define ENIC_LRO_MAX_DESC 8
  37. #define ENIC_LRO_MAX_AGGR 64
  38. #define ENIC_BARS_MAX 6
  39. #define ENIC_WQ_MAX 8
  40. #define ENIC_RQ_MAX 8
  41. #define ENIC_CQ_MAX (ENIC_WQ_MAX + ENIC_RQ_MAX)
  42. #define ENIC_INTR_MAX (ENIC_CQ_MAX + 2)
  43. enum enic_cq_index {
  44. ENIC_CQ_RQ,
  45. ENIC_CQ_WQ,
  46. };
  47. enum enic_intx_intr_index {
  48. ENIC_INTX_WQ_RQ,
  49. ENIC_INTX_ERR,
  50. ENIC_INTX_NOTIFY,
  51. };
  52. enum enic_msix_intr_index {
  53. ENIC_MSIX_RQ,
  54. ENIC_MSIX_WQ,
  55. ENIC_MSIX_ERR,
  56. ENIC_MSIX_NOTIFY,
  57. ENIC_MSIX_MAX,
  58. };
  59. struct enic_msix_entry {
  60. int requested;
  61. char devname[IFNAMSIZ];
  62. irqreturn_t (*isr)(int, void *);
  63. void *devid;
  64. };
  65. /* Per-instance private data structure */
  66. struct enic {
  67. struct net_device *netdev;
  68. struct pci_dev *pdev;
  69. struct vnic_enet_config config;
  70. struct vnic_dev_bar bar[ENIC_BARS_MAX];
  71. struct vnic_dev *vdev;
  72. struct timer_list notify_timer;
  73. struct work_struct reset;
  74. struct msix_entry msix_entry[ENIC_MSIX_MAX];
  75. struct enic_msix_entry msix[ENIC_MSIX_MAX];
  76. u32 msg_enable;
  77. spinlock_t devcmd_lock;
  78. u8 mac_addr[ETH_ALEN];
  79. u8 mc_addr[ENIC_MULTICAST_PERFECT_FILTERS][ETH_ALEN];
  80. unsigned int mc_count;
  81. int csum_rx_enabled;
  82. u32 port_mtu;
  83. /* work queue cache line section */
  84. ____cacheline_aligned struct vnic_wq wq[ENIC_WQ_MAX];
  85. spinlock_t wq_lock[ENIC_WQ_MAX];
  86. unsigned int wq_count;
  87. struct vlan_group *vlan_group;
  88. /* receive queue cache line section */
  89. ____cacheline_aligned struct vnic_rq rq[ENIC_RQ_MAX];
  90. unsigned int rq_count;
  91. int (*rq_alloc_buf)(struct vnic_rq *rq);
  92. u64 rq_truncated_pkts;
  93. u64 rq_bad_fcs;
  94. struct napi_struct napi;
  95. struct net_lro_mgr lro_mgr;
  96. struct net_lro_desc lro_desc[ENIC_LRO_MAX_DESC];
  97. /* interrupt resource cache line section */
  98. ____cacheline_aligned struct vnic_intr intr[ENIC_INTR_MAX];
  99. unsigned int intr_count;
  100. u32 __iomem *legacy_pba; /* memory-mapped */
  101. /* completion queue cache line section */
  102. ____cacheline_aligned struct vnic_cq cq[ENIC_CQ_MAX];
  103. unsigned int cq_count;
  104. };
  105. #endif /* _ENIC_H_ */