Imported Upstream version 16.07-rc1
[deb_dpdk.git] / drivers / net / qede / base / ecore_vf_api.h
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 #ifndef __ECORE_VF_API_H__
10 #define __ECORE_VF_API_H__
11
12 #include "ecore_sp_api.h"
13 #include "ecore_mcp_api.h"
14
15 #ifdef CONFIG_ECORE_SRIOV
16 /**
17  * @brief Read the VF bulletin and act on it if needed
18  *
19  * @param p_hwfn
20  * @param p_change - ecore fills 1 iff bulletin board has changed, 0 otherwise.
21  *
22  * @return enum _ecore_status
23  */
24 enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn,
25                                             u8 *p_change);
26
27 /**
28  * @brief Get link parameters for VF from ecore
29  *
30  * @param p_hwfn
31  * @param params - the link params structure to be filled for the VF
32  */
33 void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
34                               struct ecore_mcp_link_params *params);
35
36 /**
37  * @brief Get link state for VF from ecore
38  *
39  * @param p_hwfn
40  * @param link - the link state structure to be filled for the VF
41  */
42 void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
43                              struct ecore_mcp_link_state *link);
44
45 /**
46  * @brief Get link capabilities for VF from ecore
47  *
48  * @param p_hwfn
49  * @param p_link_caps - the link capabilities structure to be filled for the VF
50  */
51 void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
52                             struct ecore_mcp_link_capabilities *p_link_caps);
53
54 /**
55  * @brief Get number of Rx queues allocated for VF by ecore
56  *
57  *  @param p_hwfn
58  *  @param num_rxqs - allocated RX queues
59  */
60 void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn, u8 *num_rxqs);
61
62 /**
63  * @brief Get port mac address for VF
64  *
65  * @param p_hwfn
66  * @param port_mac - destination location for port mac
67  */
68 void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn, u8 *port_mac);
69
70 /**
71  * @brief Get number of VLAN filters allocated for VF by ecore
72  *
73  *  @param p_hwfn
74  *  @param num_rxqs - allocated VLAN filters
75  */
76 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
77                                    u8 *num_vlan_filters);
78
79 /**
80  * @brief Get number of MAC filters allocated for VF by ecore
81  *
82  *  @param p_hwfn
83  *  @param num_mac - allocated MAC filters
84  */
85 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
86                                   u32 *num_mac_filters);
87
88 /**
89  * @brief Check if VF can set a MAC address
90  *
91  * @param p_hwfn
92  * @param mac
93  *
94  * @return bool
95  */
96 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac);
97
98 /**
99  * @brief Copy forced MAC address from bulletin board
100  *
101  * @param hwfn
102  * @param dst_mac
103  * @param p_is_forced - out param which indicate in case mac
104  *              exist if it forced or not.
105  *
106  * @return bool       - return true if mac exist and false if
107  *                      not.
108  */
109 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
110                                       u8 *p_is_forced);
111
112 /**
113  * @brief Check if force vlan is set and copy the forced vlan
114  *        from bulletin board
115  *
116  * @param hwfn
117  * @param dst_pvid
118  * @return bool
119  */
120 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid);
121
122 /**
123  * @brief Set firmware version information in dev_info from VFs acquire response
124  *        tlv
125  *
126  * @param p_hwfn
127  * @param fw_major
128  * @param fw_minor
129  * @param fw_rev
130  * @param fw_eng
131  */
132 void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
133                              u16 *fw_major,
134                              u16 *fw_minor, u16 *fw_rev, u16 *fw_eng);
135 #else
136 static OSAL_INLINE enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn
137                                                                *p_hwfn,
138                                                                u8 *p_change)
139 {
140         return ECORE_INVAL;
141 }
142
143 static OSAL_INLINE void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
144                                                  struct ecore_mcp_link_params
145                                                  *params)
146 {
147 }
148
149 static OSAL_INLINE void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
150                                                 struct ecore_mcp_link_state
151                                                 *link)
152 {
153 }
154
155 static OSAL_INLINE void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
156                                                struct
157                                                ecore_mcp_link_capabilities
158                                                * p_link_caps)
159 {
160 }
161
162 static OSAL_INLINE void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn,
163                                               u8 *num_rxqs)
164 {
165 }
166
167 static OSAL_INLINE void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
168                                               u8 *port_mac)
169 {
170 }
171
172 static OSAL_INLINE void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
173                                                       u8 *num_vlan_filters)
174 {
175 }
176
177 static OSAL_INLINE void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
178                                                      u32 *num_mac)
179 {
180 }
181
182 static OSAL_INLINE bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac)
183 {
184         return false;
185 }
186
187 static OSAL_INLINE bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn
188                                                          *hwfn, u8 *dst_mac,
189                                                          u8 *p_is_forced)
190 {
191         return false;
192 }
193
194 static OSAL_INLINE void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
195                                                 u16 *fw_major, u16 *fw_minor,
196                                                 u16 *fw_rev, u16 *fw_eng)
197 {
198 }
199 #endif
200 #endif