i40e_adminq.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*******************************************************************************
  2. *
  3. * Intel Ethernet Controller XL710 Family Linux Driver
  4. * Copyright(c) 2013 Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with
  16. * this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. * The full GNU General Public License is included in this distribution in
  20. * the file called "COPYING".
  21. *
  22. * Contact Information:
  23. * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  24. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  25. *
  26. ******************************************************************************/
  27. #ifndef _I40E_ADMINQ_H_
  28. #define _I40E_ADMINQ_H_
  29. #include "i40e_osdep.h"
  30. #include "i40e_adminq_cmd.h"
  31. #define I40E_ADMINQ_DESC(R, i) \
  32. (&(((struct i40e_aq_desc *)((R).desc))[i]))
  33. #define I40E_ADMINQ_DESC_ALIGNMENT 4096
  34. struct i40e_adminq_ring {
  35. void *desc; /* Descriptor ring memory */
  36. void *details; /* ASQ details */
  37. union {
  38. struct i40e_dma_mem *asq_bi;
  39. struct i40e_dma_mem *arq_bi;
  40. } r;
  41. u64 dma_addr; /* Physical address of the ring */
  42. u16 count; /* Number of descriptors */
  43. u16 rx_buf_len; /* Admin Receive Queue buffer length */
  44. /* used for interrupt processing */
  45. u16 next_to_use;
  46. u16 next_to_clean;
  47. /* used for queue tracking */
  48. u32 head;
  49. u32 tail;
  50. };
  51. /* ASQ transaction details */
  52. struct i40e_asq_cmd_details {
  53. void *callback; /* cast from type I40E_ADMINQ_CALLBACK */
  54. u64 cookie;
  55. u16 flags_ena;
  56. u16 flags_dis;
  57. bool async;
  58. bool postpone;
  59. };
  60. #define I40E_ADMINQ_DETAILS(R, i) \
  61. (&(((struct i40e_asq_cmd_details *)((R).details))[i]))
  62. /* ARQ event information */
  63. struct i40e_arq_event_info {
  64. struct i40e_aq_desc desc;
  65. u16 msg_size;
  66. u8 *msg_buf;
  67. };
  68. /* Admin Queue information */
  69. struct i40e_adminq_info {
  70. struct i40e_adminq_ring arq; /* receive queue */
  71. struct i40e_adminq_ring asq; /* send queue */
  72. u16 num_arq_entries; /* receive queue depth */
  73. u16 num_asq_entries; /* send queue depth */
  74. u16 arq_buf_size; /* receive queue buffer size */
  75. u16 asq_buf_size; /* send queue buffer size */
  76. u16 fw_maj_ver; /* firmware major version */
  77. u16 fw_min_ver; /* firmware minor version */
  78. u16 api_maj_ver; /* api major version */
  79. u16 api_min_ver; /* api minor version */
  80. struct mutex asq_mutex; /* Send queue lock */
  81. struct mutex arq_mutex; /* Receive queue lock */
  82. struct i40e_dma_mem asq_mem; /* send queue dynamic memory */
  83. struct i40e_dma_mem arq_mem; /* receive queue dynamic memory */
  84. /* last status values on send and receive queues */
  85. enum i40e_admin_queue_err asq_last_status;
  86. enum i40e_admin_queue_err arq_last_status;
  87. };
  88. /* general information */
  89. #define I40E_AQ_LARGE_BUF 512
  90. #define I40E_ASQ_CMD_TIMEOUT 100000 /* usecs */
  91. void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
  92. u16 opcode);
  93. #endif /* _I40E_ADMINQ_H_ */