ixgbe_mbx.c revision 1.15 1 1.15 msaitoh /* $NetBSD: ixgbe_mbx.c,v 1.15 2021/12/24 05:03:37 msaitoh Exp $ */
2 1.7 msaitoh
3 1.1 dyoung /******************************************************************************
4 1.9 msaitoh SPDX-License-Identifier: BSD-3-Clause
5 1.1 dyoung
6 1.14 msaitoh Copyright (c) 2001-2020, Intel Corporation
7 1.1 dyoung All rights reserved.
8 1.7 msaitoh
9 1.7 msaitoh Redistribution and use in source and binary forms, with or without
10 1.1 dyoung modification, are permitted provided that the following conditions are met:
11 1.7 msaitoh
12 1.7 msaitoh 1. Redistributions of source code must retain the above copyright notice,
13 1.1 dyoung this list of conditions and the following disclaimer.
14 1.7 msaitoh
15 1.7 msaitoh 2. Redistributions in binary form must reproduce the above copyright
16 1.7 msaitoh notice, this list of conditions and the following disclaimer in the
17 1.1 dyoung documentation and/or other materials provided with the distribution.
18 1.7 msaitoh
19 1.7 msaitoh 3. Neither the name of the Intel Corporation nor the names of its
20 1.7 msaitoh contributors may be used to endorse or promote products derived from
21 1.1 dyoung this software without specific prior written permission.
22 1.7 msaitoh
23 1.1 dyoung THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 1.7 msaitoh AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.7 msaitoh IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.7 msaitoh ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 1.7 msaitoh LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 1.7 msaitoh CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 1.7 msaitoh SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 1.7 msaitoh INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 1.7 msaitoh CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 1.1 dyoung ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 1.1 dyoung POSSIBILITY OF SUCH DAMAGE.
34 1.1 dyoung
35 1.1 dyoung ******************************************************************************/
36 1.10 msaitoh /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.c 326022 2017-11-20 19:36:21Z pfg $*/
37 1.1 dyoung
38 1.12 msaitoh #include <sys/cdefs.h>
39 1.15 msaitoh __KERNEL_RCSID(0, "$NetBSD: ixgbe_mbx.c,v 1.15 2021/12/24 05:03:37 msaitoh Exp $");
40 1.12 msaitoh
41 1.1 dyoung #include "ixgbe_type.h"
42 1.1 dyoung #include "ixgbe_mbx.h"
43 1.1 dyoung
44 1.1 dyoung /**
45 1.15 msaitoh * ixgbe_read_mbx - Reads a message from the mailbox
46 1.15 msaitoh * @hw: pointer to the HW structure
47 1.15 msaitoh * @msg: The message buffer
48 1.15 msaitoh * @size: Length of buffer
49 1.15 msaitoh * @mbx_id: id of mailbox to read
50 1.15 msaitoh *
51 1.15 msaitoh * returns SUCCESS if it successfully read message from buffer
52 1.15 msaitoh **/
53 1.15 msaitoh s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
54 1.15 msaitoh {
55 1.15 msaitoh struct ixgbe_mbx_info *mbx = &hw->mbx;
56 1.15 msaitoh s32 ret_val = IXGBE_ERR_MBX;
57 1.15 msaitoh
58 1.15 msaitoh DEBUGFUNC("ixgbe_read_mbx");
59 1.15 msaitoh
60 1.15 msaitoh /* limit read to size of mailbox */
61 1.15 msaitoh if (size > mbx->size)
62 1.15 msaitoh size = mbx->size;
63 1.15 msaitoh
64 1.15 msaitoh if (mbx->ops.read)
65 1.15 msaitoh ret_val = mbx->ops.read(hw, msg, size, mbx_id);
66 1.15 msaitoh
67 1.15 msaitoh return ret_val;
68 1.15 msaitoh }
69 1.15 msaitoh
70 1.15 msaitoh /**
71 1.15 msaitoh * ixgbe_write_mbx - Write a message to the mailbox
72 1.15 msaitoh * @hw: pointer to the HW structure
73 1.15 msaitoh * @msg: The message buffer
74 1.15 msaitoh * @size: Length of buffer
75 1.15 msaitoh * @mbx_id: id of mailbox to write
76 1.15 msaitoh *
77 1.15 msaitoh * returns SUCCESS if it successfully copied message into the buffer
78 1.15 msaitoh **/
79 1.15 msaitoh s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
80 1.15 msaitoh {
81 1.15 msaitoh struct ixgbe_mbx_info *mbx = &hw->mbx;
82 1.15 msaitoh s32 ret_val = IXGBE_SUCCESS;
83 1.15 msaitoh
84 1.15 msaitoh DEBUGFUNC("ixgbe_write_mbx");
85 1.15 msaitoh
86 1.15 msaitoh if (size > mbx->size) {
87 1.15 msaitoh ret_val = IXGBE_ERR_MBX;
88 1.15 msaitoh ERROR_REPORT2(IXGBE_ERROR_ARGUMENT,
89 1.15 msaitoh "Invalid mailbox message size %d", size);
90 1.15 msaitoh } else if (mbx->ops.write)
91 1.15 msaitoh ret_val = mbx->ops.write(hw, msg, size, mbx_id);
92 1.15 msaitoh
93 1.15 msaitoh return ret_val;
94 1.15 msaitoh }
95 1.15 msaitoh
96 1.15 msaitoh /**
97 1.15 msaitoh * ixgbe_check_for_msg - checks to see if someone sent us mail
98 1.15 msaitoh * @hw: pointer to the HW structure
99 1.15 msaitoh * @mbx_id: id of mailbox to check
100 1.15 msaitoh *
101 1.15 msaitoh * returns SUCCESS if the Status bit was found or else ERR_MBX
102 1.15 msaitoh **/
103 1.15 msaitoh s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
104 1.15 msaitoh {
105 1.15 msaitoh struct ixgbe_mbx_info *mbx = &hw->mbx;
106 1.15 msaitoh s32 ret_val = IXGBE_ERR_MBX;
107 1.15 msaitoh
108 1.15 msaitoh DEBUGFUNC("ixgbe_check_for_msg");
109 1.15 msaitoh
110 1.15 msaitoh if (mbx->ops.check_for_msg)
111 1.15 msaitoh ret_val = mbx->ops.check_for_msg(hw, mbx_id);
112 1.15 msaitoh
113 1.15 msaitoh return ret_val;
114 1.15 msaitoh }
115 1.15 msaitoh
116 1.15 msaitoh /**
117 1.15 msaitoh * ixgbe_check_for_ack - checks to see if someone sent us ACK
118 1.15 msaitoh * @hw: pointer to the HW structure
119 1.15 msaitoh * @mbx_id: id of mailbox to check
120 1.15 msaitoh *
121 1.15 msaitoh * returns SUCCESS if the Status bit was found or else ERR_MBX
122 1.15 msaitoh **/
123 1.15 msaitoh s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
124 1.15 msaitoh {
125 1.15 msaitoh struct ixgbe_mbx_info *mbx = &hw->mbx;
126 1.15 msaitoh s32 ret_val = IXGBE_ERR_MBX;
127 1.15 msaitoh
128 1.15 msaitoh DEBUGFUNC("ixgbe_check_for_ack");
129 1.15 msaitoh
130 1.15 msaitoh if (mbx->ops.check_for_ack)
131 1.15 msaitoh ret_val = mbx->ops.check_for_ack(hw, mbx_id);
132 1.15 msaitoh
133 1.15 msaitoh return ret_val;
134 1.15 msaitoh }
135 1.15 msaitoh
136 1.15 msaitoh /**
137 1.15 msaitoh * ixgbe_check_for_rst - checks to see if other side has reset
138 1.15 msaitoh * @hw: pointer to the HW structure
139 1.15 msaitoh * @mbx_id: id of mailbox to check
140 1.15 msaitoh *
141 1.15 msaitoh * returns SUCCESS if the Status bit was found or else ERR_MBX
142 1.15 msaitoh **/
143 1.15 msaitoh s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id)
144 1.15 msaitoh {
145 1.15 msaitoh struct ixgbe_mbx_info *mbx = &hw->mbx;
146 1.15 msaitoh s32 ret_val = IXGBE_ERR_MBX;
147 1.15 msaitoh
148 1.15 msaitoh DEBUGFUNC("ixgbe_check_for_rst");
149 1.15 msaitoh
150 1.15 msaitoh if (mbx->ops.check_for_rst)
151 1.15 msaitoh ret_val = mbx->ops.check_for_rst(hw, mbx_id);
152 1.15 msaitoh
153 1.15 msaitoh return ret_val;
154 1.15 msaitoh }
155 1.15 msaitoh
156 1.15 msaitoh /**
157 1.13 msaitoh * ixgbe_clear_mbx - Clear Mailbox Memory
158 1.13 msaitoh * @hw: pointer to the HW structure
159 1.13 msaitoh * @vf_number: id of mailbox to write
160 1.11 msaitoh *
161 1.13 msaitoh * Set VFMBMEM of given VF to 0x0.
162 1.11 msaitoh **/
163 1.11 msaitoh s32 ixgbe_clear_mbx(struct ixgbe_hw *hw, u16 vf_number)
164 1.11 msaitoh {
165 1.11 msaitoh struct ixgbe_mbx_info *mbx = &hw->mbx;
166 1.11 msaitoh s32 ret_val = IXGBE_SUCCESS;
167 1.11 msaitoh
168 1.11 msaitoh DEBUGFUNC("ixgbe_clear_mbx");
169 1.11 msaitoh
170 1.11 msaitoh if (mbx->ops.clear)
171 1.11 msaitoh ret_val = mbx->ops.clear(hw, vf_number);
172 1.11 msaitoh
173 1.11 msaitoh return ret_val;
174 1.11 msaitoh }
175 1.11 msaitoh
176 1.11 msaitoh /**
177 1.13 msaitoh * ixgbe_poll_for_msg - Wait for message notification
178 1.13 msaitoh * @hw: pointer to the HW structure
179 1.13 msaitoh * @mbx_id: id of mailbox to write
180 1.1 dyoung *
181 1.13 msaitoh * returns SUCCESS if it successfully received a message notification
182 1.1 dyoung **/
183 1.1 dyoung static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
184 1.1 dyoung {
185 1.1 dyoung struct ixgbe_mbx_info *mbx = &hw->mbx;
186 1.1 dyoung int countdown = mbx->timeout;
187 1.1 dyoung
188 1.1 dyoung DEBUGFUNC("ixgbe_poll_for_msg");
189 1.1 dyoung
190 1.1 dyoung if (!countdown || !mbx->ops.check_for_msg)
191 1.1 dyoung goto out;
192 1.1 dyoung
193 1.1 dyoung while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) {
194 1.1 dyoung countdown--;
195 1.1 dyoung if (!countdown)
196 1.1 dyoung break;
197 1.1 dyoung usec_delay(mbx->usec_delay);
198 1.1 dyoung }
199 1.1 dyoung
200 1.4 msaitoh if (countdown == 0)
201 1.4 msaitoh ERROR_REPORT2(IXGBE_ERROR_POLLING,
202 1.4 msaitoh "Polling for VF%d mailbox message timedout", mbx_id);
203 1.4 msaitoh
204 1.1 dyoung out:
205 1.1 dyoung return countdown ? IXGBE_SUCCESS : IXGBE_ERR_MBX;
206 1.1 dyoung }
207 1.1 dyoung
208 1.1 dyoung /**
209 1.13 msaitoh * ixgbe_poll_for_ack - Wait for message acknowledgment
210 1.13 msaitoh * @hw: pointer to the HW structure
211 1.13 msaitoh * @mbx_id: id of mailbox to write
212 1.1 dyoung *
213 1.13 msaitoh * returns SUCCESS if it successfully received a message acknowledgment
214 1.1 dyoung **/
215 1.1 dyoung static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
216 1.1 dyoung {
217 1.1 dyoung struct ixgbe_mbx_info *mbx = &hw->mbx;
218 1.1 dyoung int countdown = mbx->timeout;
219 1.1 dyoung
220 1.1 dyoung DEBUGFUNC("ixgbe_poll_for_ack");
221 1.1 dyoung
222 1.1 dyoung if (!countdown || !mbx->ops.check_for_ack)
223 1.1 dyoung goto out;
224 1.1 dyoung
225 1.1 dyoung while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) {
226 1.1 dyoung countdown--;
227 1.1 dyoung if (!countdown)
228 1.1 dyoung break;
229 1.1 dyoung usec_delay(mbx->usec_delay);
230 1.1 dyoung }
231 1.1 dyoung
232 1.4 msaitoh if (countdown == 0)
233 1.4 msaitoh ERROR_REPORT2(IXGBE_ERROR_POLLING,
234 1.4 msaitoh "Polling for VF%d mailbox ack timedout", mbx_id);
235 1.4 msaitoh
236 1.1 dyoung out:
237 1.1 dyoung return countdown ? IXGBE_SUCCESS : IXGBE_ERR_MBX;
238 1.1 dyoung }
239 1.1 dyoung
240 1.1 dyoung /**
241 1.13 msaitoh * ixgbe_read_posted_mbx - Wait for message notification and receive message
242 1.13 msaitoh * @hw: pointer to the HW structure
243 1.13 msaitoh * @msg: The message buffer
244 1.13 msaitoh * @size: Length of buffer
245 1.13 msaitoh * @mbx_id: id of mailbox to write
246 1.1 dyoung *
247 1.13 msaitoh * returns SUCCESS if it successfully received a message notification and
248 1.13 msaitoh * copied it into the receive buffer.
249 1.1 dyoung **/
250 1.15 msaitoh s32 ixgbe_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
251 1.1 dyoung {
252 1.1 dyoung struct ixgbe_mbx_info *mbx = &hw->mbx;
253 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
254 1.1 dyoung
255 1.1 dyoung DEBUGFUNC("ixgbe_read_posted_mbx");
256 1.1 dyoung
257 1.1 dyoung if (!mbx->ops.read)
258 1.1 dyoung goto out;
259 1.1 dyoung
260 1.1 dyoung ret_val = ixgbe_poll_for_msg(hw, mbx_id);
261 1.1 dyoung
262 1.1 dyoung /* if ack received read message, otherwise we timed out */
263 1.1 dyoung if (!ret_val)
264 1.1 dyoung ret_val = mbx->ops.read(hw, msg, size, mbx_id);
265 1.1 dyoung out:
266 1.1 dyoung return ret_val;
267 1.1 dyoung }
268 1.1 dyoung
269 1.1 dyoung /**
270 1.13 msaitoh * ixgbe_write_posted_mbx - Write a message to the mailbox, wait for ack
271 1.13 msaitoh * @hw: pointer to the HW structure
272 1.13 msaitoh * @msg: The message buffer
273 1.13 msaitoh * @size: Length of buffer
274 1.13 msaitoh * @mbx_id: id of mailbox to write
275 1.1 dyoung *
276 1.13 msaitoh * returns SUCCESS if it successfully copied message into the buffer and
277 1.13 msaitoh * received an ack to that message within delay * timeout period
278 1.1 dyoung **/
279 1.15 msaitoh s32 ixgbe_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,
280 1.15 msaitoh u16 mbx_id)
281 1.1 dyoung {
282 1.1 dyoung struct ixgbe_mbx_info *mbx = &hw->mbx;
283 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
284 1.1 dyoung
285 1.1 dyoung DEBUGFUNC("ixgbe_write_posted_mbx");
286 1.1 dyoung
287 1.1 dyoung /* exit if either we can't write or there isn't a defined timeout */
288 1.1 dyoung if (!mbx->ops.write || !mbx->timeout)
289 1.1 dyoung goto out;
290 1.1 dyoung
291 1.1 dyoung /* send msg */
292 1.1 dyoung ret_val = mbx->ops.write(hw, msg, size, mbx_id);
293 1.1 dyoung
294 1.1 dyoung /* if msg sent wait until we receive an ack */
295 1.1 dyoung if (!ret_val)
296 1.1 dyoung ret_val = ixgbe_poll_for_ack(hw, mbx_id);
297 1.1 dyoung out:
298 1.1 dyoung return ret_val;
299 1.1 dyoung }
300 1.1 dyoung
301 1.1 dyoung /**
302 1.13 msaitoh * ixgbe_init_mbx_ops_generic - Initialize MB function pointers
303 1.13 msaitoh * @hw: pointer to the HW structure
304 1.1 dyoung *
305 1.13 msaitoh * Setups up the mailbox read and write message function pointers
306 1.1 dyoung **/
307 1.1 dyoung void ixgbe_init_mbx_ops_generic(struct ixgbe_hw *hw)
308 1.1 dyoung {
309 1.1 dyoung struct ixgbe_mbx_info *mbx = &hw->mbx;
310 1.1 dyoung
311 1.1 dyoung mbx->ops.read_posted = ixgbe_read_posted_mbx;
312 1.1 dyoung mbx->ops.write_posted = ixgbe_write_posted_mbx;
313 1.1 dyoung }
314 1.1 dyoung
315 1.1 dyoung /**
316 1.13 msaitoh * ixgbe_read_v2p_mailbox - read v2p mailbox
317 1.13 msaitoh * @hw: pointer to the HW structure
318 1.1 dyoung *
319 1.13 msaitoh * This function is used to read the v2p mailbox without losing the read to
320 1.13 msaitoh * clear status bits.
321 1.1 dyoung **/
322 1.1 dyoung static u32 ixgbe_read_v2p_mailbox(struct ixgbe_hw *hw)
323 1.1 dyoung {
324 1.1 dyoung u32 v2p_mailbox = IXGBE_READ_REG(hw, IXGBE_VFMAILBOX);
325 1.1 dyoung
326 1.1 dyoung v2p_mailbox |= hw->mbx.v2p_mailbox;
327 1.1 dyoung hw->mbx.v2p_mailbox |= v2p_mailbox & IXGBE_VFMAILBOX_R2C_BITS;
328 1.1 dyoung
329 1.1 dyoung return v2p_mailbox;
330 1.1 dyoung }
331 1.1 dyoung
332 1.1 dyoung /**
333 1.13 msaitoh * ixgbe_check_for_bit_vf - Determine if a status bit was set
334 1.13 msaitoh * @hw: pointer to the HW structure
335 1.13 msaitoh * @mask: bitmask for bits to be tested and cleared
336 1.1 dyoung *
337 1.13 msaitoh * This function is used to check for the read to clear bits within
338 1.13 msaitoh * the V2P mailbox.
339 1.1 dyoung **/
340 1.1 dyoung static s32 ixgbe_check_for_bit_vf(struct ixgbe_hw *hw, u32 mask)
341 1.1 dyoung {
342 1.1 dyoung u32 v2p_mailbox = ixgbe_read_v2p_mailbox(hw);
343 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
344 1.1 dyoung
345 1.1 dyoung if (v2p_mailbox & mask)
346 1.1 dyoung ret_val = IXGBE_SUCCESS;
347 1.1 dyoung
348 1.1 dyoung hw->mbx.v2p_mailbox &= ~mask;
349 1.1 dyoung
350 1.1 dyoung return ret_val;
351 1.1 dyoung }
352 1.1 dyoung
353 1.1 dyoung /**
354 1.13 msaitoh * ixgbe_check_for_msg_vf - checks to see if the PF has sent mail
355 1.13 msaitoh * @hw: pointer to the HW structure
356 1.13 msaitoh * @mbx_id: id of mailbox to check
357 1.1 dyoung *
358 1.13 msaitoh * returns SUCCESS if the PF has set the Status bit or else ERR_MBX
359 1.1 dyoung **/
360 1.1 dyoung static s32 ixgbe_check_for_msg_vf(struct ixgbe_hw *hw, u16 mbx_id)
361 1.1 dyoung {
362 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
363 1.1 dyoung
364 1.2 msaitoh UNREFERENCED_1PARAMETER(mbx_id);
365 1.1 dyoung DEBUGFUNC("ixgbe_check_for_msg_vf");
366 1.1 dyoung
367 1.1 dyoung if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFSTS)) {
368 1.1 dyoung ret_val = IXGBE_SUCCESS;
369 1.8 msaitoh hw->mbx.stats.reqs.ev_count++;
370 1.1 dyoung }
371 1.1 dyoung
372 1.1 dyoung return ret_val;
373 1.1 dyoung }
374 1.1 dyoung
375 1.1 dyoung /**
376 1.13 msaitoh * ixgbe_check_for_ack_vf - checks to see if the PF has ACK'd
377 1.13 msaitoh * @hw: pointer to the HW structure
378 1.13 msaitoh * @mbx_id: id of mailbox to check
379 1.1 dyoung *
380 1.13 msaitoh * returns SUCCESS if the PF has set the ACK bit or else ERR_MBX
381 1.1 dyoung **/
382 1.1 dyoung static s32 ixgbe_check_for_ack_vf(struct ixgbe_hw *hw, u16 mbx_id)
383 1.1 dyoung {
384 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
385 1.1 dyoung
386 1.2 msaitoh UNREFERENCED_1PARAMETER(mbx_id);
387 1.1 dyoung DEBUGFUNC("ixgbe_check_for_ack_vf");
388 1.1 dyoung
389 1.1 dyoung if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFACK)) {
390 1.1 dyoung ret_val = IXGBE_SUCCESS;
391 1.8 msaitoh hw->mbx.stats.acks.ev_count++;
392 1.1 dyoung }
393 1.1 dyoung
394 1.1 dyoung return ret_val;
395 1.1 dyoung }
396 1.1 dyoung
397 1.1 dyoung /**
398 1.13 msaitoh * ixgbe_check_for_rst_vf - checks to see if the PF has reset
399 1.13 msaitoh * @hw: pointer to the HW structure
400 1.13 msaitoh * @mbx_id: id of mailbox to check
401 1.1 dyoung *
402 1.13 msaitoh * returns TRUE if the PF has set the reset done bit or else FALSE
403 1.1 dyoung **/
404 1.1 dyoung static s32 ixgbe_check_for_rst_vf(struct ixgbe_hw *hw, u16 mbx_id)
405 1.1 dyoung {
406 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
407 1.1 dyoung
408 1.2 msaitoh UNREFERENCED_1PARAMETER(mbx_id);
409 1.1 dyoung DEBUGFUNC("ixgbe_check_for_rst_vf");
410 1.1 dyoung
411 1.1 dyoung if (!ixgbe_check_for_bit_vf(hw, (IXGBE_VFMAILBOX_RSTD |
412 1.2 msaitoh IXGBE_VFMAILBOX_RSTI))) {
413 1.1 dyoung ret_val = IXGBE_SUCCESS;
414 1.8 msaitoh hw->mbx.stats.rsts.ev_count++;
415 1.1 dyoung }
416 1.1 dyoung
417 1.1 dyoung return ret_val;
418 1.1 dyoung }
419 1.1 dyoung
420 1.1 dyoung /**
421 1.13 msaitoh * ixgbe_obtain_mbx_lock_vf - obtain mailbox lock
422 1.13 msaitoh * @hw: pointer to the HW structure
423 1.1 dyoung *
424 1.13 msaitoh * return SUCCESS if we obtained the mailbox lock
425 1.1 dyoung **/
426 1.1 dyoung static s32 ixgbe_obtain_mbx_lock_vf(struct ixgbe_hw *hw)
427 1.1 dyoung {
428 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
429 1.1 dyoung
430 1.1 dyoung DEBUGFUNC("ixgbe_obtain_mbx_lock_vf");
431 1.1 dyoung
432 1.1 dyoung /* Take ownership of the buffer */
433 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_VFU);
434 1.1 dyoung
435 1.1 dyoung /* reserve mailbox for vf use */
436 1.1 dyoung if (ixgbe_read_v2p_mailbox(hw) & IXGBE_VFMAILBOX_VFU)
437 1.1 dyoung ret_val = IXGBE_SUCCESS;
438 1.1 dyoung
439 1.1 dyoung return ret_val;
440 1.1 dyoung }
441 1.1 dyoung
442 1.1 dyoung /**
443 1.13 msaitoh * ixgbe_write_mbx_vf - Write a message to the mailbox
444 1.13 msaitoh * @hw: pointer to the HW structure
445 1.13 msaitoh * @msg: The message buffer
446 1.13 msaitoh * @size: Length of buffer
447 1.13 msaitoh * @mbx_id: id of mailbox to write
448 1.1 dyoung *
449 1.13 msaitoh * returns SUCCESS if it successfully copied message into the buffer
450 1.1 dyoung **/
451 1.1 dyoung static s32 ixgbe_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
452 1.2 msaitoh u16 mbx_id)
453 1.1 dyoung {
454 1.1 dyoung s32 ret_val;
455 1.1 dyoung u16 i;
456 1.1 dyoung
457 1.2 msaitoh UNREFERENCED_1PARAMETER(mbx_id);
458 1.1 dyoung
459 1.1 dyoung DEBUGFUNC("ixgbe_write_mbx_vf");
460 1.1 dyoung
461 1.1 dyoung /* lock the mailbox to prevent pf/vf race condition */
462 1.1 dyoung ret_val = ixgbe_obtain_mbx_lock_vf(hw);
463 1.1 dyoung if (ret_val)
464 1.1 dyoung goto out_no_write;
465 1.1 dyoung
466 1.1 dyoung /* flush msg and acks as we are overwriting the message buffer */
467 1.1 dyoung ixgbe_check_for_msg_vf(hw, 0);
468 1.1 dyoung ixgbe_check_for_ack_vf(hw, 0);
469 1.1 dyoung
470 1.1 dyoung /* copy the caller specified message to the mailbox memory buffer */
471 1.1 dyoung for (i = 0; i < size; i++)
472 1.1 dyoung IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
473 1.1 dyoung
474 1.1 dyoung /* update stats */
475 1.8 msaitoh hw->mbx.stats.msgs_tx.ev_count++;
476 1.1 dyoung
477 1.1 dyoung /* Drop VFU and interrupt the PF to tell it a message has been sent */
478 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_REQ);
479 1.1 dyoung
480 1.1 dyoung out_no_write:
481 1.1 dyoung return ret_val;
482 1.1 dyoung }
483 1.1 dyoung
484 1.1 dyoung /**
485 1.13 msaitoh * ixgbe_read_mbx_vf - Reads a message from the inbox intended for vf
486 1.13 msaitoh * @hw: pointer to the HW structure
487 1.13 msaitoh * @msg: The message buffer
488 1.13 msaitoh * @size: Length of buffer
489 1.13 msaitoh * @mbx_id: id of mailbox to read
490 1.1 dyoung *
491 1.13 msaitoh * returns SUCCESS if it successfully read message from buffer
492 1.1 dyoung **/
493 1.1 dyoung static s32 ixgbe_read_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
494 1.2 msaitoh u16 mbx_id)
495 1.1 dyoung {
496 1.1 dyoung s32 ret_val = IXGBE_SUCCESS;
497 1.1 dyoung u16 i;
498 1.1 dyoung
499 1.1 dyoung DEBUGFUNC("ixgbe_read_mbx_vf");
500 1.2 msaitoh UNREFERENCED_1PARAMETER(mbx_id);
501 1.1 dyoung
502 1.1 dyoung /* lock the mailbox to prevent pf/vf race condition */
503 1.1 dyoung ret_val = ixgbe_obtain_mbx_lock_vf(hw);
504 1.1 dyoung if (ret_val)
505 1.1 dyoung goto out_no_read;
506 1.1 dyoung
507 1.1 dyoung /* copy the message from the mailbox memory buffer */
508 1.1 dyoung for (i = 0; i < size; i++)
509 1.1 dyoung msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_VFMBMEM, i);
510 1.1 dyoung
511 1.1 dyoung /* Acknowledge receipt and release mailbox, then we're done */
512 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);
513 1.1 dyoung
514 1.1 dyoung /* update stats */
515 1.8 msaitoh hw->mbx.stats.msgs_rx.ev_count++;
516 1.1 dyoung
517 1.1 dyoung out_no_read:
518 1.1 dyoung return ret_val;
519 1.1 dyoung }
520 1.1 dyoung
521 1.1 dyoung /**
522 1.13 msaitoh * ixgbe_init_mbx_params_vf - set initial values for vf mailbox
523 1.13 msaitoh * @hw: pointer to the HW structure
524 1.1 dyoung *
525 1.13 msaitoh * Initializes the hw->mbx struct to correct values for vf mailbox
526 1.1 dyoung */
527 1.1 dyoung void ixgbe_init_mbx_params_vf(struct ixgbe_hw *hw)
528 1.1 dyoung {
529 1.1 dyoung struct ixgbe_mbx_info *mbx = &hw->mbx;
530 1.1 dyoung
531 1.1 dyoung /* start mailbox as timed out and let the reset_hw call set the timeout
532 1.1 dyoung * value to begin communications */
533 1.1 dyoung mbx->timeout = 0;
534 1.1 dyoung mbx->usec_delay = IXGBE_VF_MBX_INIT_DELAY;
535 1.1 dyoung
536 1.1 dyoung mbx->size = IXGBE_VFMAILBOX_SIZE;
537 1.1 dyoung
538 1.1 dyoung mbx->ops.read = ixgbe_read_mbx_vf;
539 1.1 dyoung mbx->ops.write = ixgbe_write_mbx_vf;
540 1.1 dyoung mbx->ops.read_posted = ixgbe_read_posted_mbx;
541 1.1 dyoung mbx->ops.write_posted = ixgbe_write_posted_mbx;
542 1.1 dyoung mbx->ops.check_for_msg = ixgbe_check_for_msg_vf;
543 1.1 dyoung mbx->ops.check_for_ack = ixgbe_check_for_ack_vf;
544 1.1 dyoung mbx->ops.check_for_rst = ixgbe_check_for_rst_vf;
545 1.11 msaitoh mbx->ops.clear = NULL;
546 1.1 dyoung
547 1.8 msaitoh mbx->stats.msgs_tx.ev_count = 0;
548 1.8 msaitoh mbx->stats.msgs_rx.ev_count = 0;
549 1.8 msaitoh mbx->stats.reqs.ev_count = 0;
550 1.8 msaitoh mbx->stats.acks.ev_count = 0;
551 1.8 msaitoh mbx->stats.rsts.ev_count = 0;
552 1.1 dyoung }
553 1.1 dyoung
554 1.1 dyoung static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)
555 1.1 dyoung {
556 1.1 dyoung u32 mbvficr = IXGBE_READ_REG(hw, IXGBE_MBVFICR(index));
557 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
558 1.1 dyoung
559 1.1 dyoung if (mbvficr & mask) {
560 1.1 dyoung ret_val = IXGBE_SUCCESS;
561 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_MBVFICR(index), mask);
562 1.1 dyoung }
563 1.1 dyoung
564 1.1 dyoung return ret_val;
565 1.1 dyoung }
566 1.1 dyoung
567 1.1 dyoung /**
568 1.13 msaitoh * ixgbe_check_for_msg_pf - checks to see if the VF has sent mail
569 1.13 msaitoh * @hw: pointer to the HW structure
570 1.13 msaitoh * @vf_number: the VF index
571 1.1 dyoung *
572 1.13 msaitoh * returns SUCCESS if the VF has set the Status bit or else ERR_MBX
573 1.1 dyoung **/
574 1.1 dyoung static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number)
575 1.1 dyoung {
576 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
577 1.1 dyoung s32 index = IXGBE_MBVFICR_INDEX(vf_number);
578 1.1 dyoung u32 vf_bit = vf_number % 16;
579 1.1 dyoung
580 1.1 dyoung DEBUGFUNC("ixgbe_check_for_msg_pf");
581 1.1 dyoung
582 1.1 dyoung if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFREQ_VF1 << vf_bit,
583 1.2 msaitoh index)) {
584 1.1 dyoung ret_val = IXGBE_SUCCESS;
585 1.8 msaitoh hw->mbx.stats.reqs.ev_count++;
586 1.1 dyoung }
587 1.1 dyoung
588 1.1 dyoung return ret_val;
589 1.1 dyoung }
590 1.1 dyoung
591 1.1 dyoung /**
592 1.13 msaitoh * ixgbe_check_for_ack_pf - checks to see if the VF has ACKed
593 1.13 msaitoh * @hw: pointer to the HW structure
594 1.13 msaitoh * @vf_number: the VF index
595 1.1 dyoung *
596 1.13 msaitoh * returns SUCCESS if the VF has set the Status bit or else ERR_MBX
597 1.1 dyoung **/
598 1.1 dyoung static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number)
599 1.1 dyoung {
600 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
601 1.1 dyoung s32 index = IXGBE_MBVFICR_INDEX(vf_number);
602 1.1 dyoung u32 vf_bit = vf_number % 16;
603 1.1 dyoung
604 1.1 dyoung DEBUGFUNC("ixgbe_check_for_ack_pf");
605 1.1 dyoung
606 1.1 dyoung if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFACK_VF1 << vf_bit,
607 1.2 msaitoh index)) {
608 1.1 dyoung ret_val = IXGBE_SUCCESS;
609 1.8 msaitoh hw->mbx.stats.acks.ev_count++;
610 1.1 dyoung }
611 1.1 dyoung
612 1.1 dyoung return ret_val;
613 1.1 dyoung }
614 1.1 dyoung
615 1.1 dyoung /**
616 1.13 msaitoh * ixgbe_check_for_rst_pf - checks to see if the VF has reset
617 1.13 msaitoh * @hw: pointer to the HW structure
618 1.13 msaitoh * @vf_number: the VF index
619 1.1 dyoung *
620 1.13 msaitoh * returns SUCCESS if the VF has set the Status bit or else ERR_MBX
621 1.1 dyoung **/
622 1.1 dyoung static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)
623 1.1 dyoung {
624 1.1 dyoung u32 reg_offset = (vf_number < 32) ? 0 : 1;
625 1.1 dyoung u32 vf_shift = vf_number % 32;
626 1.1 dyoung u32 vflre = 0;
627 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
628 1.1 dyoung
629 1.1 dyoung DEBUGFUNC("ixgbe_check_for_rst_pf");
630 1.1 dyoung
631 1.1 dyoung switch (hw->mac.type) {
632 1.1 dyoung case ixgbe_mac_82599EB:
633 1.1 dyoung vflre = IXGBE_READ_REG(hw, IXGBE_VFLRE(reg_offset));
634 1.1 dyoung break;
635 1.4 msaitoh case ixgbe_mac_X550:
636 1.4 msaitoh case ixgbe_mac_X550EM_x:
637 1.7 msaitoh case ixgbe_mac_X550EM_a:
638 1.2 msaitoh case ixgbe_mac_X540:
639 1.2 msaitoh vflre = IXGBE_READ_REG(hw, IXGBE_VFLREC(reg_offset));
640 1.2 msaitoh break;
641 1.1 dyoung default:
642 1.1 dyoung break;
643 1.1 dyoung }
644 1.1 dyoung
645 1.1 dyoung if (vflre & (1 << vf_shift)) {
646 1.1 dyoung ret_val = IXGBE_SUCCESS;
647 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_VFLREC(reg_offset), (1 << vf_shift));
648 1.8 msaitoh hw->mbx.stats.rsts.ev_count++;
649 1.1 dyoung }
650 1.1 dyoung
651 1.1 dyoung return ret_val;
652 1.1 dyoung }
653 1.1 dyoung
654 1.1 dyoung /**
655 1.13 msaitoh * ixgbe_obtain_mbx_lock_pf - obtain mailbox lock
656 1.13 msaitoh * @hw: pointer to the HW structure
657 1.13 msaitoh * @vf_number: the VF index
658 1.1 dyoung *
659 1.13 msaitoh * return SUCCESS if we obtained the mailbox lock
660 1.1 dyoung **/
661 1.1 dyoung static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number)
662 1.1 dyoung {
663 1.1 dyoung s32 ret_val = IXGBE_ERR_MBX;
664 1.1 dyoung u32 p2v_mailbox;
665 1.1 dyoung
666 1.1 dyoung DEBUGFUNC("ixgbe_obtain_mbx_lock_pf");
667 1.1 dyoung
668 1.1 dyoung /* Take ownership of the buffer */
669 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_PFU);
670 1.1 dyoung
671 1.1 dyoung /* reserve mailbox for vf use */
672 1.1 dyoung p2v_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_number));
673 1.1 dyoung if (p2v_mailbox & IXGBE_PFMAILBOX_PFU)
674 1.1 dyoung ret_val = IXGBE_SUCCESS;
675 1.4 msaitoh else
676 1.4 msaitoh ERROR_REPORT2(IXGBE_ERROR_POLLING,
677 1.4 msaitoh "Failed to obtain mailbox lock for VF%d", vf_number);
678 1.4 msaitoh
679 1.1 dyoung
680 1.1 dyoung return ret_val;
681 1.1 dyoung }
682 1.1 dyoung
683 1.1 dyoung /**
684 1.13 msaitoh * ixgbe_write_mbx_pf - Places a message in the mailbox
685 1.13 msaitoh * @hw: pointer to the HW structure
686 1.13 msaitoh * @msg: The message buffer
687 1.13 msaitoh * @size: Length of buffer
688 1.13 msaitoh * @vf_number: the VF index
689 1.1 dyoung *
690 1.13 msaitoh * returns SUCCESS if it successfully copied message into the buffer
691 1.1 dyoung **/
692 1.1 dyoung static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
693 1.2 msaitoh u16 vf_number)
694 1.1 dyoung {
695 1.1 dyoung s32 ret_val;
696 1.1 dyoung u16 i;
697 1.1 dyoung
698 1.1 dyoung DEBUGFUNC("ixgbe_write_mbx_pf");
699 1.1 dyoung
700 1.1 dyoung /* lock the mailbox to prevent pf/vf race condition */
701 1.1 dyoung ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
702 1.1 dyoung if (ret_val)
703 1.1 dyoung goto out_no_write;
704 1.1 dyoung
705 1.1 dyoung /* flush msg and acks as we are overwriting the message buffer */
706 1.1 dyoung ixgbe_check_for_msg_pf(hw, vf_number);
707 1.1 dyoung ixgbe_check_for_ack_pf(hw, vf_number);
708 1.1 dyoung
709 1.1 dyoung /* copy the caller specified message to the mailbox memory buffer */
710 1.1 dyoung for (i = 0; i < size; i++)
711 1.1 dyoung IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, msg[i]);
712 1.1 dyoung
713 1.1 dyoung /* Interrupt VF to tell it a message has been sent and release buffer*/
714 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_STS);
715 1.1 dyoung
716 1.1 dyoung /* update stats */
717 1.8 msaitoh hw->mbx.stats.msgs_tx.ev_count++;
718 1.1 dyoung
719 1.1 dyoung out_no_write:
720 1.1 dyoung return ret_val;
721 1.1 dyoung
722 1.1 dyoung }
723 1.1 dyoung
724 1.1 dyoung /**
725 1.13 msaitoh * ixgbe_read_mbx_pf - Read a message from the mailbox
726 1.13 msaitoh * @hw: pointer to the HW structure
727 1.13 msaitoh * @msg: The message buffer
728 1.13 msaitoh * @size: Length of buffer
729 1.13 msaitoh * @vf_number: the VF index
730 1.13 msaitoh *
731 1.13 msaitoh * This function copies a message from the mailbox buffer to the caller's
732 1.13 msaitoh * memory buffer. The presumption is that the caller knows that there was
733 1.13 msaitoh * a message due to a VF request so no polling for message is needed.
734 1.1 dyoung **/
735 1.1 dyoung static s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
736 1.2 msaitoh u16 vf_number)
737 1.1 dyoung {
738 1.1 dyoung s32 ret_val;
739 1.1 dyoung u16 i;
740 1.1 dyoung
741 1.1 dyoung DEBUGFUNC("ixgbe_read_mbx_pf");
742 1.1 dyoung
743 1.1 dyoung /* lock the mailbox to prevent pf/vf race condition */
744 1.1 dyoung ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
745 1.1 dyoung if (ret_val)
746 1.1 dyoung goto out_no_read;
747 1.1 dyoung
748 1.1 dyoung /* copy the message to the mailbox memory buffer */
749 1.1 dyoung for (i = 0; i < size; i++)
750 1.1 dyoung msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i);
751 1.1 dyoung
752 1.1 dyoung /* Acknowledge the message and release buffer */
753 1.1 dyoung IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_ACK);
754 1.1 dyoung
755 1.1 dyoung /* update stats */
756 1.8 msaitoh hw->mbx.stats.msgs_rx.ev_count++;
757 1.1 dyoung
758 1.1 dyoung out_no_read:
759 1.1 dyoung return ret_val;
760 1.1 dyoung }
761 1.1 dyoung
762 1.1 dyoung /**
763 1.13 msaitoh * ixgbe_clear_mbx_pf - Clear Mailbox Memory
764 1.13 msaitoh * @hw: pointer to the HW structure
765 1.13 msaitoh * @vf_number: the VF index
766 1.11 msaitoh *
767 1.13 msaitoh * Set VFMBMEM of given VF to 0x0.
768 1.11 msaitoh **/
769 1.11 msaitoh static s32 ixgbe_clear_mbx_pf(struct ixgbe_hw *hw, u16 vf_number)
770 1.11 msaitoh {
771 1.11 msaitoh u16 mbx_size = hw->mbx.size;
772 1.11 msaitoh u16 i;
773 1.11 msaitoh
774 1.11 msaitoh if (vf_number > 63)
775 1.11 msaitoh return IXGBE_ERR_PARAM;
776 1.11 msaitoh
777 1.11 msaitoh for (i = 0; i < mbx_size; ++i)
778 1.11 msaitoh IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, 0x0);
779 1.11 msaitoh
780 1.11 msaitoh return IXGBE_SUCCESS;
781 1.11 msaitoh }
782 1.11 msaitoh
783 1.11 msaitoh /**
784 1.13 msaitoh * ixgbe_init_mbx_params_pf - set initial values for pf mailbox
785 1.13 msaitoh * @hw: pointer to the HW structure
786 1.1 dyoung *
787 1.13 msaitoh * Initializes the hw->mbx struct to correct values for pf mailbox
788 1.1 dyoung */
789 1.1 dyoung void ixgbe_init_mbx_params_pf(struct ixgbe_hw *hw)
790 1.1 dyoung {
791 1.1 dyoung struct ixgbe_mbx_info *mbx = &hw->mbx;
792 1.1 dyoung
793 1.2 msaitoh if (hw->mac.type != ixgbe_mac_82599EB &&
794 1.4 msaitoh hw->mac.type != ixgbe_mac_X550 &&
795 1.4 msaitoh hw->mac.type != ixgbe_mac_X550EM_x &&
796 1.7 msaitoh hw->mac.type != ixgbe_mac_X550EM_a &&
797 1.2 msaitoh hw->mac.type != ixgbe_mac_X540)
798 1.1 dyoung return;
799 1.1 dyoung
800 1.1 dyoung mbx->timeout = 0;
801 1.1 dyoung mbx->usec_delay = 0;
802 1.1 dyoung
803 1.1 dyoung mbx->size = IXGBE_VFMAILBOX_SIZE;
804 1.1 dyoung
805 1.1 dyoung mbx->ops.read = ixgbe_read_mbx_pf;
806 1.1 dyoung mbx->ops.write = ixgbe_write_mbx_pf;
807 1.1 dyoung mbx->ops.read_posted = ixgbe_read_posted_mbx;
808 1.1 dyoung mbx->ops.write_posted = ixgbe_write_posted_mbx;
809 1.1 dyoung mbx->ops.check_for_msg = ixgbe_check_for_msg_pf;
810 1.1 dyoung mbx->ops.check_for_ack = ixgbe_check_for_ack_pf;
811 1.1 dyoung mbx->ops.check_for_rst = ixgbe_check_for_rst_pf;
812 1.11 msaitoh mbx->ops.clear = ixgbe_clear_mbx_pf;
813 1.1 dyoung
814 1.8 msaitoh mbx->stats.msgs_tx.ev_count = 0;
815 1.8 msaitoh mbx->stats.msgs_rx.ev_count = 0;
816 1.8 msaitoh mbx->stats.reqs.ev_count = 0;
817 1.8 msaitoh mbx->stats.acks.ev_count = 0;
818 1.8 msaitoh mbx->stats.rsts.ev_count = 0;
819 1.1 dyoung }
820