i40e_adminq.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*******************************************************************************
  2. *
  3. * Intel Ethernet Controller XL710 Family Linux Virtual Function 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. * The full GNU General Public License is included in this distribution in
  16. * the file called "COPYING".
  17. *
  18. * Contact Information:
  19. * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  20. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  21. *
  22. ******************************************************************************/
  23. #ifndef _I40E_ADMINQ_H_
  24. #define _I40E_ADMINQ_H_
  25. #include "i40e_osdep.h"
  26. #include "i40e_adminq_cmd.h"
  27. #define I40E_ADMINQ_DESC(R, i) \
  28. (&(((struct i40e_aq_desc *)((R).desc_buf.va))[i]))
  29. #define I40E_ADMINQ_DESC_ALIGNMENT 4096
  30. struct i40e_adminq_ring {
  31. struct i40e_virt_mem dma_head; /* space for dma structures */
  32. struct i40e_dma_mem desc_buf; /* descriptor ring memory */
  33. struct i40e_virt_mem cmd_buf; /* command buffer memory */
  34. union {
  35. struct i40e_dma_mem *asq_bi;
  36. struct i40e_dma_mem *arq_bi;
  37. } r;
  38. u16 count; /* Number of descriptors */
  39. u16 rx_buf_len; /* Admin Receive Queue buffer length */
  40. /* used for interrupt processing */
  41. u16 next_to_use;
  42. u16 next_to_clean;
  43. /* used for queue tracking */
  44. u32 head;
  45. u32 tail;
  46. u32 len;
  47. };
  48. /* ASQ transaction details */
  49. struct i40e_asq_cmd_details {
  50. void *callback; /* cast from type I40E_ADMINQ_CALLBACK */
  51. u64 cookie;
  52. u16 flags_ena;
  53. u16 flags_dis;
  54. bool async;
  55. bool postpone;
  56. };
  57. #define I40E_ADMINQ_DETAILS(R, i) \
  58. (&(((struct i40e_asq_cmd_details *)((R).cmd_buf.va))[i]))
  59. /* ARQ event information */
  60. struct i40e_arq_event_info {
  61. struct i40e_aq_desc desc;
  62. u16 msg_size;
  63. u8 *msg_buf;
  64. };
  65. /* Admin Queue information */
  66. struct i40e_adminq_info {
  67. struct i40e_adminq_ring arq; /* receive queue */
  68. struct i40e_adminq_ring asq; /* send queue */
  69. u16 num_arq_entries; /* receive queue depth */
  70. u16 num_asq_entries; /* send queue depth */
  71. u16 arq_buf_size; /* receive queue buffer size */
  72. u16 asq_buf_size; /* send queue buffer size */
  73. u16 fw_maj_ver; /* firmware major version */
  74. u16 fw_min_ver; /* firmware minor version */
  75. u16 api_maj_ver; /* api major version */
  76. u16 api_min_ver; /* api minor version */
  77. struct mutex asq_mutex; /* Send queue lock */
  78. struct mutex arq_mutex; /* Receive queue lock */
  79. /* last status values on send and receive queues */
  80. enum i40e_admin_queue_err asq_last_status;
  81. enum i40e_admin_queue_err arq_last_status;
  82. };
  83. /* general information */
  84. #define I40E_AQ_LARGE_BUF 512
  85. #define I40E_ASQ_CMD_TIMEOUT 100000 /* usecs */
  86. void i40evf_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
  87. u16 opcode);
  88. #endif /* _I40E_ADMINQ_H_ */