xref: /freebsd/sys/dev/mlx5/vport.h (revision eaa797943eeac5614edfdc8f6309f332343c3dd2)
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, int client_id,
33 			       u16 *counter_set_id);
34 int mlx5_vport_dealloc_q_counter(struct mlx5_core_dev *mdev, int client_id,
35 				 u16 counter_set_id);
36 int mlx5_vport_query_q_counter(struct mlx5_core_dev *mdev,
37 			       u16 counter_set_id,
38 			       int reset,
39 			       void *out,
40 			       int out_size);
41 int mlx5_vport_query_out_of_rx_buffer(struct mlx5_core_dev *mdev,
42 				      u16 counter_set_id,
43 				      u32 *out_of_rx_buffer);
44 
45 u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
46 u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
47 				u16 vport);
48 int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
49 				  u16 vport, u8 state);
50 
51 int mlx5_query_vport_mtu(struct mlx5_core_dev *mdev, int *mtu);
52 int mlx5_set_vport_mtu(struct mlx5_core_dev *mdev, int mtu);
53 int mlx5_query_min_wqe_header(struct mlx5_core_dev *dev, int *min_header);
54 int mlx5_set_vport_min_wqe_header(struct mlx5_core_dev *mdev, u8 vport,
55 				  int min_header);
56 int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev,
57 				 u16 vport,
58 				 int *promisc_uc,
59 				 int *promisc_mc,
60 				 int *promisc_all);
61 
62 int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
63 				  int promisc_uc,
64 				  int promisc_mc,
65 				  int promisc_all);
66 int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
67 				     u16 vport, u8 *addr);
68 int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev,
69 				      u16 vport, u8 mac[ETH_ALEN]);
70 int mlx5_set_nic_vport_current_mac(struct mlx5_core_dev *mdev, int vport,
71 				   bool other_vport, u8 *addr);
72 int mlx5_modify_nic_vport_port_guid(struct mlx5_core_dev *mdev,
73 				    u32 vport, u64 port_guid);
74 int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
75 				    u32 vport, u64 node_guid);
76 int mlx5_set_nic_vport_vlan_list(struct mlx5_core_dev *dev, u16 vport,
77 				 u16 *vlan_list, int list_len);
78 int mlx5_set_nic_vport_mc_list(struct mlx5_core_dev *mdev, int vport,
79 			       u64 *addr_list, size_t addr_list_len);
80 int mlx5_set_nic_vport_promisc(struct mlx5_core_dev *mdev, int vport,
81 			       bool promisc_mc, bool promisc_uc,
82 			       bool promisc_all);
83 int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
84 				  u16 vport,
85 				  enum mlx5_list_type list_type,
86 				  u8 addr_list[][ETH_ALEN],
87 				  int *list_size);
88 int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev,
89 			       u16 vport,
90 			       u16 vlans[],
91 			       int *size);
92 int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
93 				u16 vlans[],
94 				int list_size);
95 int mlx5_query_nic_vport_roce_en(struct mlx5_core_dev *mdev, u8 *enable);
96 int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
97 				   enum mlx5_list_type list_type,
98 				   u8 addr_list[][ETH_ALEN],
99 				   int list_size);
100 int mlx5_set_nic_vport_permanent_mac(struct mlx5_core_dev *mdev, int vport,
101 				     u8 *addr);
102 int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev);
103 int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev);
104 int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
105 					   u64 *system_image_guid);
106 int mlx5_query_vport_system_image_guid(struct mlx5_core_dev *dev,
107 				       u64 *sys_image_guid);
108 int mlx5_query_vport_node_guid(struct mlx5_core_dev *dev, u64 *node_guid);
109 int mlx5_query_vport_port_guid(struct mlx5_core_dev *dev, u64 *port_guid);
110 int mlx5_query_hca_vport_state(struct mlx5_core_dev *dev, u8 *vport_state);
111 int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
112 int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
113 					u16 *qkey_viol_cntr);
114 int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
115 int mlx5_query_hca_vport_system_image_guid(struct mlx5_core_dev *mdev,
116 					   u64 *system_image_guid);
117 int mlx5_query_hca_vport_context(struct mlx5_core_dev *mdev,
118 				 u8 port_num, u8 vport_num, u32 *out,
119 				 int outlen);
120 int mlx5_query_hca_vport_pkey(struct mlx5_core_dev *dev, u8 other_vport,
121 			      u8 port_num, u16 vf_num, u16 pkey_index,
122 			      u16 *pkey);
123 int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 port_num,
124 			     u16 vport_num, u16 gid_index, union ib_gid *gid);
125 int mlx5_set_eswitch_cvlan_info(struct mlx5_core_dev *mdev, u8 vport,
126 				u8 insert_mode, u8 strip_mode,
127 				u16 vlan, u8 cfi, u8 pcp);
128 int mlx5_query_vport_counter(struct mlx5_core_dev *dev,
129 			     u8 port_num, u16 vport_num,
130 			     void *out, int out_size);
131 int mlx5_get_vport_counters(struct mlx5_core_dev *dev, u8 port_num,
132 			    struct mlx5_vport_counters *vc);
133 #endif /* __MLX5_VPORT_H__ */
134