enic.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_rss.h"
  30. #define DRV_NAME "enic"
  31. #define DRV_DESCRIPTION "Cisco 10G Ethernet Driver"
  32. #define DRV_VERSION "1.0.0.933"
  33. #define DRV_COPYRIGHT "Copyright 2008 Cisco Systems, Inc"
  34. #define PFX DRV_NAME ": "
  35. #define ENIC_LRO_MAX_DESC 8
  36. #define ENIC_LRO_MAX_AGGR 64
  37. enum enic_cq_index {
  38. ENIC_CQ_RQ,
  39. ENIC_CQ_WQ,
  40. ENIC_CQ_MAX,
  41. };
  42. enum enic_intx_intr_index {
  43. ENIC_INTX_WQ_RQ,
  44. ENIC_INTX_ERR,
  45. ENIC_INTX_NOTIFY,
  46. ENIC_INTX_MAX,
  47. };
  48. enum enic_msix_intr_index {
  49. ENIC_MSIX_RQ,
  50. ENIC_MSIX_WQ,
  51. ENIC_MSIX_ERR,
  52. ENIC_MSIX_NOTIFY,
  53. ENIC_MSIX_MAX,
  54. };
  55. struct enic_msix_entry {
  56. int requested;
  57. char devname[IFNAMSIZ];
  58. irqreturn_t (*isr)(int, void *);
  59. void *devid;
  60. };
  61. /* Per-instance private data structure */
  62. struct enic {
  63. struct net_device *netdev;
  64. struct pci_dev *pdev;
  65. struct vnic_enet_config config;
  66. struct vnic_dev_bar bar0;
  67. struct vnic_dev *vdev;
  68. struct timer_list notify_timer;
  69. struct work_struct reset;
  70. struct msix_entry msix_entry[ENIC_MSIX_MAX];
  71. struct enic_msix_entry msix[ENIC_MSIX_MAX];
  72. u32 msg_enable;
  73. spinlock_t devcmd_lock;
  74. u8 mac_addr[ETH_ALEN];
  75. u8 mc_addr[ENIC_MULTICAST_PERFECT_FILTERS][ETH_ALEN];
  76. unsigned int mc_count;
  77. int csum_rx_enabled;
  78. u32 port_mtu;
  79. /* work queue cache line section */
  80. ____cacheline_aligned struct vnic_wq wq[1];
  81. spinlock_t wq_lock[1];
  82. unsigned int wq_count;
  83. struct vlan_group *vlan_group;
  84. /* receive queue cache line section */
  85. ____cacheline_aligned struct vnic_rq rq[1];
  86. unsigned int rq_count;
  87. int (*rq_alloc_buf)(struct vnic_rq *rq);
  88. u64 rq_bad_fcs;
  89. struct napi_struct napi;
  90. struct net_lro_mgr lro_mgr;
  91. struct net_lro_desc lro_desc[ENIC_LRO_MAX_DESC];
  92. /* interrupt resource cache line section */
  93. ____cacheline_aligned struct vnic_intr intr[ENIC_MSIX_MAX];
  94. unsigned int intr_count;
  95. u32 __iomem *legacy_pba; /* memory-mapped */
  96. /* completion queue cache line section */
  97. ____cacheline_aligned struct vnic_cq cq[ENIC_CQ_MAX];
  98. unsigned int cq_count;
  99. };
  100. #endif /* _ENIC_H_ */