xref: /freebsd/sys/dev/mlx5/vport.h (revision 3fc36ee018bb836bd1796067cf4ef8683f166ebc)
1 /*-
2  * Copyright (c) 2013-2015, 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  * $FreeBSD$
26  */
27 
28 #ifndef __MLX5_VPORT_H__
29 #define __MLX5_VPORT_H__
30 
31 #include <dev/mlx5/driver.h>
32 int mlx5_vport_alloc_q_counter(struct mlx5_core_dev *mdev,
33 			       int *counter_set_id);
34 int mlx5_vport_dealloc_q_counter(struct mlx5_core_dev *mdev,
35 				 int counter_set_id);
36 int mlx5_vport_query_out_of_rx_buffer(struct mlx5_core_dev *mdev,
37 				      int counter_set_id,
38 				      u32 *out_of_rx_buffer);
39 
40 u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod);
41 int mlx5_arm_vport_context_events(struct mlx5_core_dev *mdev,
42 				  u8 vport,
43 				  u32 events_mask);
44 int mlx5_query_vport_promisc(struct mlx5_core_dev *mdev,
45 			     u32 vport,
46 			     u8 *promisc_uc,
47 			     u8 *promisc_mc,
48 			     u8 *promisc_all);
49 int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
50 				  int promisc_uc,
51 				  int promisc_mc,
52 				  int promisc_all);
53 int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
54 				     u32 vport, u8 *addr);
55 int mlx5_set_nic_vport_current_mac(struct mlx5_core_dev *mdev, int vport,
56 				   bool other_vport, u8 *addr);
57 int mlx5_set_nic_vport_vlan_list(struct mlx5_core_dev *dev, u32 vport,
58 				 u16 *vlan_list, int list_len);
59 int mlx5_set_nic_vport_mc_list(struct mlx5_core_dev *mdev, int vport,
60 			       u64 *addr_list, size_t addr_list_len);
61 int mlx5_set_nic_vport_promisc(struct mlx5_core_dev *mdev, int vport,
62 			       bool promisc_mc, bool promisc_uc,
63 			       bool promisc_all);
64 int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
65 				  u32 vport,
66 				  enum mlx5_list_type list_type,
67 				  u8 addr_list[][ETH_ALEN],
68 				  int *list_size);
69 int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
70 				   enum mlx5_list_type list_type,
71 				   u8 addr_list[][ETH_ALEN],
72 				   int list_size);
73 int mlx5_query_nic_vport_vlan_list(struct mlx5_core_dev *dev,
74 				   u32 vport,
75 				   u16 *vlan_list,
76 				   int *list_size);
77 int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
78 				u16 vlans[],
79 				int list_size);
80 int mlx5_set_nic_vport_permanent_mac(struct mlx5_core_dev *mdev, int vport,
81 				     u8 *addr);
82 int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev);
83 int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev);
84 int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
85 					   u64 *system_image_guid);
86 int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
87 int mlx5_query_nic_vport_port_guid(struct mlx5_core_dev *mdev, u64 *port_guid);
88 int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
89 					u16 *qkey_viol_cntr);
90 int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
91 int mlx5_query_hca_vport_system_image_guid(struct mlx5_core_dev *mdev,
92 					   u64 *system_image_guid);
93 int mlx5_query_hca_vport_context(struct mlx5_core_dev *mdev,
94 				 u8 port_num, u8 vport_num, u32 *out,
95 				 int outlen);
96 int mlx5_query_hca_vport_pkey(struct mlx5_core_dev *dev, u8 other_vport,
97 			      u8 port_num, u16 vf_num, u16 pkey_index,
98 			      u16 *pkey);
99 int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 port_num,
100 			     u16 vport_num, u16 gid_index, union ib_gid *gid);
101 int mlx5_set_eswitch_cvlan_info(struct mlx5_core_dev *mdev, u8 vport,
102 				u8 insert_mode, u8 strip_mode,
103 				u16 vlan, u8 cfi, u8 pcp);
104 int mlx5_query_vport_counter(struct mlx5_core_dev *dev,
105 			     u8 port_num, u16 vport_num,
106 			     void *out, int out_size);
107 int mlx5_get_vport_counters(struct mlx5_core_dev *dev, u8 port_num,
108 			    struct mlx5_vport_counters *vc);
109 #endif /* __MLX5_VPORT_H__ */
110