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