1 /*- 2 * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26 #ifndef __MLX5_VPORT_H__ 27 #define __MLX5_VPORT_H__ 28 29 #include <dev/mlx5/driver.h> 30 31 enum { 32 MLX5_CAP_INLINE_MODE_L2, 33 MLX5_CAP_INLINE_MODE_VPORT_CONTEXT, 34 MLX5_CAP_INLINE_MODE_NOT_REQUIRED, 35 }; 36 37 int mlx5_vport_alloc_q_counter(struct mlx5_core_dev *mdev, int client_id, 38 u16 *counter_set_id); 39 int mlx5_vport_dealloc_q_counter(struct mlx5_core_dev *mdev, int client_id, 40 u16 counter_set_id); 41 int mlx5_vport_query_q_counter(struct mlx5_core_dev *mdev, 42 u16 counter_set_id, 43 int reset, 44 void *out, 45 int out_size); 46 int mlx5_vport_query_out_of_rx_buffer(struct mlx5_core_dev *mdev, 47 u16 counter_set_id, 48 u32 *out_of_rx_buffer); 49 enum mlx5_local_lb_selection { 50 MLX5_LOCAL_MC_LB, 51 MLX5_LOCAL_UC_LB 52 }; 53 54 int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, 55 enum mlx5_local_lb_selection selection, 56 u8 *value); 57 int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable); 58 int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev, 59 enum mlx5_local_lb_selection selection, 60 u8 value); 61 u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); 62 u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, 63 u16 vport); 64 int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, 65 u16 vport, u8 state); 66 67 int mlx5_query_vport_mtu(struct mlx5_core_dev *mdev, int *mtu); 68 int mlx5_set_vport_mtu(struct mlx5_core_dev *mdev, int mtu); 69 int mlx5_query_min_wqe_header(struct mlx5_core_dev *dev, int *min_header); 70 int mlx5_set_vport_min_wqe_header(struct mlx5_core_dev *mdev, u8 vport, 71 int min_header); 72 int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev, 73 u16 vport, 74 int *promisc_uc, 75 int *promisc_mc, 76 int *promisc_all); 77 78 int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev, 79 int promisc_uc, 80 int promisc_mc, 81 int promisc_all); 82 int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, 83 u16 vport, u8 *addr); 84 int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, 85 u16 vport, u8 *addr); 86 int mlx5_set_nic_vport_current_mac(struct mlx5_core_dev *mdev, int vport, 87 bool other_vport, u8 *addr); 88 int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, 89 u16 vport, u8 *min_inline); 90 int mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); 91 int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev, 92 u16 vport, u8 min_inline); 93 int mlx5_modify_nic_vport_port_guid(struct mlx5_core_dev *mdev, 94 u32 vport, u64 port_guid); 95 int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, 96 u32 vport, u64 node_guid); 97 int mlx5_set_nic_vport_vlan_list(struct mlx5_core_dev *dev, u16 vport, 98 u16 *vlan_list, int list_len); 99 int mlx5_set_nic_vport_mc_list(struct mlx5_core_dev *mdev, int vport, 100 u64 *addr_list, size_t addr_list_len); 101 int mlx5_set_nic_vport_promisc(struct mlx5_core_dev *mdev, int vport, 102 bool promisc_mc, bool promisc_uc, 103 bool promisc_all); 104 int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, 105 u16 vport, 106 enum mlx5_list_type list_type, 107 u8 addr_list[][ETH_ALEN], 108 int *list_size); 109 int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev, 110 u16 vport, 111 u16 vlans[], 112 int *size); 113 int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev, 114 u16 vlans[], 115 int list_size); 116 int mlx5_query_nic_vport_roce_en(struct mlx5_core_dev *mdev, u8 *enable); 117 int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev, 118 enum mlx5_list_type list_type, 119 u8 addr_list[][ETH_ALEN], 120 int list_size); 121 int mlx5_set_nic_vport_permanent_mac(struct mlx5_core_dev *mdev, int vport, 122 u8 *addr); 123 int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev); 124 int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev); 125 int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport, 126 int vf, u8 port_num, void *out, 127 size_t out_sz); 128 int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, 129 u64 *system_image_guid); 130 int mlx5_query_vport_system_image_guid(struct mlx5_core_dev *dev, 131 u64 *sys_image_guid); 132 int mlx5_query_vport_node_guid(struct mlx5_core_dev *dev, u64 *node_guid); 133 int mlx5_query_vport_port_guid(struct mlx5_core_dev *dev, u64 *port_guid); 134 int mlx5_query_hca_vport_state(struct mlx5_core_dev *dev, u8 *vport_state); 135 int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); 136 int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev, 137 u16 *qkey_viol_cntr); 138 int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); 139 int mlx5_query_hca_vport_system_image_guid(struct mlx5_core_dev *mdev, 140 u64 *system_image_guid); 141 int mlx5_query_hca_vport_context(struct mlx5_core_dev *mdev, 142 u8 port_num, u8 vport_num, u32 *out, 143 int outlen); 144 int mlx5_query_hca_vport_pkey(struct mlx5_core_dev *dev, u8 other_vport, 145 u8 port_num, u16 vf_num, u16 pkey_index, 146 u16 *pkey); 147 int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 port_num, 148 u16 vport_num, u16 gid_index, union ib_gid *gid); 149 int mlx5_set_eswitch_cvlan_info(struct mlx5_core_dev *mdev, u8 vport, 150 u8 insert_mode, u8 strip_mode, 151 u16 vlan, u8 cfi, u8 pcp); 152 int mlx5_query_vport_counter(struct mlx5_core_dev *dev, 153 u8 port_num, u16 vport_num, 154 void *out, int out_size); 155 int mlx5_get_vport_counters(struct mlx5_core_dev *dev, u8 port_num, 156 struct mlx5_vport_counters *vc); 157 int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev, 158 u8 port_num, void *out, size_t sz); 159 #endif /* __MLX5_VPORT_H__ */ 160