i40e_virtchnl_pf.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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_VIRTCHNL_PF_H_
  28. #define _I40E_VIRTCHNL_PF_H_
  29. #include "i40e.h"
  30. #define I40E_MAX_MACVLAN_FILTERS 256
  31. #define I40E_MAX_VLAN_FILTERS 256
  32. #define I40E_MAX_VLANID 4095
  33. #define I40E_VIRTCHNL_SUPPORTED_QTYPES 2
  34. #define I40E_DEFAULT_NUM_MDD_EVENTS_ALLOWED 3
  35. #define I40E_DEFAULT_NUM_INVALID_MSGS_ALLOWED 10
  36. #define I40E_VLAN_PRIORITY_SHIFT 12
  37. #define I40E_VLAN_MASK 0xFFF
  38. #define I40E_PRIORITY_MASK 0x7000
  39. /* Various queue ctrls */
  40. enum i40e_queue_ctrl {
  41. I40E_QUEUE_CTRL_UNKNOWN = 0,
  42. I40E_QUEUE_CTRL_ENABLE,
  43. I40E_QUEUE_CTRL_ENABLECHECK,
  44. I40E_QUEUE_CTRL_DISABLE,
  45. I40E_QUEUE_CTRL_DISABLECHECK,
  46. I40E_QUEUE_CTRL_FASTDISABLE,
  47. I40E_QUEUE_CTRL_FASTDISABLECHECK,
  48. };
  49. /* VF states */
  50. enum i40e_vf_states {
  51. I40E_VF_STAT_INIT = 0,
  52. I40E_VF_STAT_ACTIVE,
  53. I40E_VF_STAT_FCOEENA,
  54. I40E_VF_STAT_DISABLED,
  55. };
  56. /* VF capabilities */
  57. enum i40e_vf_capabilities {
  58. I40E_VIRTCHNL_VF_CAP_PRIVILEGE = 0,
  59. I40E_VIRTCHNL_VF_CAP_L2,
  60. };
  61. /* VF information structure */
  62. struct i40e_vf {
  63. struct i40e_pf *pf;
  64. /* vf id in the pf space */
  65. u16 vf_id;
  66. /* all vf vsis connect to the same parent */
  67. enum i40e_switch_element_types parent_type;
  68. /* vf Port Extender (PE) stag if used */
  69. u16 stag;
  70. struct i40e_virtchnl_ether_addr default_lan_addr;
  71. struct i40e_virtchnl_ether_addr default_fcoe_addr;
  72. /* VSI indices - actual VSI pointers are maintained in the PF structure
  73. * When assigned, these will be non-zero, because VSI 0 is always
  74. * the main LAN VSI for the PF.
  75. */
  76. u8 lan_vsi_index; /* index into PF struct */
  77. u8 lan_vsi_id; /* ID as used by firmware */
  78. u8 num_queue_pairs; /* num of qps assigned to vf vsis */
  79. u64 num_mdd_events; /* num of mdd events detected */
  80. u64 num_invalid_msgs; /* num of malformed or invalid msgs detected */
  81. u64 num_valid_msgs; /* num of valid msgs detected */
  82. unsigned long vf_caps; /* vf's adv. capabilities */
  83. unsigned long vf_states; /* vf's runtime states */
  84. };
  85. void i40e_free_vfs(struct i40e_pf *pf);
  86. int i40e_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
  87. int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode,
  88. u32 v_retval, u8 *msg, u16 msglen);
  89. int i40e_vc_process_vflr_event(struct i40e_pf *pf);
  90. int i40e_reset_vf(struct i40e_vf *vf, bool flr);
  91. void i40e_vc_notify_vf_reset(struct i40e_vf *vf);
  92. /* vf configuration related iplink handlers */
  93. int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
  94. int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
  95. int vf_id, u16 vlan_id, u8 qos);
  96. int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int tx_rate);
  97. int i40e_ndo_get_vf_config(struct net_device *netdev,
  98. int vf_id, struct ifla_vf_info *ivi);
  99. void i40e_vc_notify_link_state(struct i40e_pf *pf);
  100. void i40e_vc_notify_reset(struct i40e_pf *pf);
  101. #endif /* _I40E_VIRTCHNL_PF_H_ */