net/ice/base: add helper function to redirect flags
[dpdk.git] / drivers / net / txgbe / base / txgbe_mbx.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015-2020 Beijing WangXun Technology Co., Ltd.
3  * Copyright(c) 2010-2017 Intel Corporation
4  */
5
6 #include "txgbe_type.h"
7
8 #include "txgbe_mbx.h"
9
10 /**
11  *  txgbe_read_mbx - Reads a message from the mailbox
12  *  @hw: pointer to the HW structure
13  *  @msg: The message buffer
14  *  @size: Length of buffer
15  *  @mbx_id: id of mailbox to read
16  *
17  *  returns 0 if it successfully read message from buffer
18  **/
19 s32 txgbe_read_mbx(struct txgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
20 {
21         struct txgbe_mbx_info *mbx = &hw->mbx;
22         s32 ret_val = TXGBE_ERR_MBX;
23
24         DEBUGFUNC("txgbe_read_mbx");
25
26         /* limit read to size of mailbox */
27         if (size > mbx->size)
28                 size = mbx->size;
29
30         if (mbx->read)
31                 ret_val = mbx->read(hw, msg, size, mbx_id);
32
33         return ret_val;
34 }
35
36 /**
37  *  txgbe_write_mbx - Write a message to the mailbox
38  *  @hw: pointer to the HW structure
39  *  @msg: The message buffer
40  *  @size: Length of buffer
41  *  @mbx_id: id of mailbox to write
42  *
43  *  returns 0 if it successfully copied message into the buffer
44  **/
45 s32 txgbe_write_mbx(struct txgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
46 {
47         struct txgbe_mbx_info *mbx = &hw->mbx;
48         s32 ret_val = 0;
49
50         DEBUGFUNC("txgbe_write_mbx");
51
52         if (size > mbx->size) {
53                 ret_val = TXGBE_ERR_MBX;
54                 DEBUGOUT("Invalid mailbox message size %d", size);
55         } else if (mbx->write) {
56                 ret_val = mbx->write(hw, msg, size, mbx_id);
57         }
58
59         return ret_val;
60 }
61
62 /**
63  *  txgbe_check_for_msg - checks to see if someone sent us mail
64  *  @hw: pointer to the HW structure
65  *  @mbx_id: id of mailbox to check
66  *
67  *  returns 0 if the Status bit was found or else ERR_MBX
68  **/
69 s32 txgbe_check_for_msg(struct txgbe_hw *hw, u16 mbx_id)
70 {
71         struct txgbe_mbx_info *mbx = &hw->mbx;
72         s32 ret_val = TXGBE_ERR_MBX;
73
74         DEBUGFUNC("txgbe_check_for_msg");
75
76         if (mbx->check_for_msg)
77                 ret_val = mbx->check_for_msg(hw, mbx_id);
78
79         return ret_val;
80 }
81
82 /**
83  *  txgbe_check_for_ack - checks to see if someone sent us ACK
84  *  @hw: pointer to the HW structure
85  *  @mbx_id: id of mailbox to check
86  *
87  *  returns 0 if the Status bit was found or else ERR_MBX
88  **/
89 s32 txgbe_check_for_ack(struct txgbe_hw *hw, u16 mbx_id)
90 {
91         struct txgbe_mbx_info *mbx = &hw->mbx;
92         s32 ret_val = TXGBE_ERR_MBX;
93
94         DEBUGFUNC("txgbe_check_for_ack");
95
96         if (mbx->check_for_ack)
97                 ret_val = mbx->check_for_ack(hw, mbx_id);
98
99         return ret_val;
100 }
101
102 /**
103  *  txgbe_check_for_rst - checks to see if other side has reset
104  *  @hw: pointer to the HW structure
105  *  @mbx_id: id of mailbox to check
106  *
107  *  returns 0 if the Status bit was found or else ERR_MBX
108  **/
109 s32 txgbe_check_for_rst(struct txgbe_hw *hw, u16 mbx_id)
110 {
111         struct txgbe_mbx_info *mbx = &hw->mbx;
112         s32 ret_val = TXGBE_ERR_MBX;
113
114         DEBUGFUNC("txgbe_check_for_rst");
115
116         if (mbx->check_for_rst)
117                 ret_val = mbx->check_for_rst(hw, mbx_id);
118
119         return ret_val;
120 }
121
122 /**
123  *  txgbe_poll_for_msg - Wait for message notification
124  *  @hw: pointer to the HW structure
125  *  @mbx_id: id of mailbox to write
126  *
127  *  returns SUCCESS if it successfully received a message notification
128  **/
129 STATIC s32 txgbe_poll_for_msg(struct txgbe_hw *hw, u16 mbx_id)
130 {
131         struct txgbe_mbx_info *mbx = &hw->mbx;
132         int countdown = mbx->timeout;
133
134         DEBUGFUNC("txgbe_poll_for_msg");
135
136         if (!countdown || !mbx->check_for_msg)
137                 goto out;
138
139         while (countdown && mbx->check_for_msg(hw, mbx_id)) {
140                 countdown--;
141                 if (!countdown)
142                         break;
143                 usec_delay(mbx->usec_delay);
144         }
145
146         if (countdown == 0)
147                 DEBUGOUT("Polling for VF%d mailbox message timedout", mbx_id);
148
149 out:
150         return countdown ? 0 : TXGBE_ERR_MBX;
151 }
152
153 /**
154  *  txgbe_poll_for_ack - Wait for message acknowledgment
155  *  @hw: pointer to the HW structure
156  *  @mbx_id: id of mailbox to write
157  *
158  *  returns SUCCESS if it successfully received a message acknowledgment
159  **/
160 STATIC s32 txgbe_poll_for_ack(struct txgbe_hw *hw, u16 mbx_id)
161 {
162         struct txgbe_mbx_info *mbx = &hw->mbx;
163         int countdown = mbx->timeout;
164
165         DEBUGFUNC("txgbe_poll_for_ack");
166
167         if (!countdown || !mbx->check_for_ack)
168                 goto out;
169
170         while (countdown && mbx->check_for_ack(hw, mbx_id)) {
171                 countdown--;
172                 if (!countdown)
173                         break;
174                 usec_delay(mbx->usec_delay);
175         }
176
177         if (countdown == 0)
178                 DEBUGOUT("Polling for VF%d mailbox ack timedout", mbx_id);
179
180 out:
181         return countdown ? 0 : TXGBE_ERR_MBX;
182 }
183
184 /**
185  *  txgbe_read_posted_mbx - Wait for message notification and receive message
186  *  @hw: pointer to the HW structure
187  *  @msg: The message buffer
188  *  @size: Length of buffer
189  *  @mbx_id: id of mailbox to write
190  *
191  *  returns SUCCESS if it successfully received a message notification and
192  *  copied it into the receive buffer.
193  **/
194 s32 txgbe_read_posted_mbx(struct txgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
195 {
196         struct txgbe_mbx_info *mbx = &hw->mbx;
197         s32 ret_val = TXGBE_ERR_MBX;
198
199         DEBUGFUNC("txgbe_read_posted_mbx");
200
201         if (!mbx->read)
202                 goto out;
203
204         ret_val = txgbe_poll_for_msg(hw, mbx_id);
205
206         /* if ack received read message, otherwise we timed out */
207         if (!ret_val)
208                 ret_val = mbx->read(hw, msg, size, mbx_id);
209 out:
210         return ret_val;
211 }
212
213 /**
214  *  txgbe_write_posted_mbx - Write a message to the mailbox, wait for ack
215  *  @hw: pointer to the HW structure
216  *  @msg: The message buffer
217  *  @size: Length of buffer
218  *  @mbx_id: id of mailbox to write
219  *
220  *  returns SUCCESS if it successfully copied message into the buffer and
221  *  received an ack to that message within delay * timeout period
222  **/
223 s32 txgbe_write_posted_mbx(struct txgbe_hw *hw, u32 *msg, u16 size,
224                            u16 mbx_id)
225 {
226         struct txgbe_mbx_info *mbx = &hw->mbx;
227         s32 ret_val = TXGBE_ERR_MBX;
228
229         DEBUGFUNC("txgbe_write_posted_mbx");
230
231         /* exit if either we can't write or there isn't a defined timeout */
232         if (!mbx->write || !mbx->timeout)
233                 goto out;
234
235         /* send msg */
236         ret_val = mbx->write(hw, msg, size, mbx_id);
237
238         /* if msg sent wait until we receive an ack */
239         if (!ret_val)
240                 ret_val = txgbe_poll_for_ack(hw, mbx_id);
241 out:
242         return ret_val;
243 }
244
245 /**
246  *  txgbe_read_v2p_mailbox - read v2p mailbox
247  *  @hw: pointer to the HW structure
248  *
249  *  This function is used to read the v2p mailbox without losing the read to
250  *  clear status bits.
251  **/
252 STATIC u32 txgbe_read_v2p_mailbox(struct txgbe_hw *hw)
253 {
254         u32 v2p_mailbox = rd32(hw, TXGBE_VFMBCTL);
255
256         v2p_mailbox |= hw->mbx.v2p_mailbox;
257         hw->mbx.v2p_mailbox |= v2p_mailbox & TXGBE_VFMBCTL_R2C_BITS;
258
259         return v2p_mailbox;
260 }
261
262 /**
263  *  txgbe_check_for_bit_vf - Determine if a status bit was set
264  *  @hw: pointer to the HW structure
265  *  @mask: bitmask for bits to be tested and cleared
266  *
267  *  This function is used to check for the read to clear bits within
268  *  the V2P mailbox.
269  **/
270 STATIC s32 txgbe_check_for_bit_vf(struct txgbe_hw *hw, u32 mask)
271 {
272         u32 v2p_mailbox = txgbe_read_v2p_mailbox(hw);
273         s32 ret_val = TXGBE_ERR_MBX;
274
275         if (v2p_mailbox & mask)
276                 ret_val = 0;
277
278         hw->mbx.v2p_mailbox &= ~mask;
279
280         return ret_val;
281 }
282
283 /**
284  *  txgbe_check_for_msg_vf - checks to see if the PF has sent mail
285  *  @hw: pointer to the HW structure
286  *  @mbx_id: id of mailbox to check
287  *
288  *  returns SUCCESS if the PF has set the Status bit or else ERR_MBX
289  **/
290 s32 txgbe_check_for_msg_vf(struct txgbe_hw *hw, u16 mbx_id)
291 {
292         s32 ret_val = TXGBE_ERR_MBX;
293
294         UNREFERENCED_PARAMETER(mbx_id);
295         DEBUGFUNC("txgbe_check_for_msg_vf");
296
297         if (!txgbe_check_for_bit_vf(hw, TXGBE_VFMBCTL_PFSTS)) {
298                 ret_val = 0;
299                 hw->mbx.stats.reqs++;
300         }
301
302         return ret_val;
303 }
304
305 /**
306  *  txgbe_check_for_ack_vf - checks to see if the PF has ACK'd
307  *  @hw: pointer to the HW structure
308  *  @mbx_id: id of mailbox to check
309  *
310  *  returns SUCCESS if the PF has set the ACK bit or else ERR_MBX
311  **/
312 s32 txgbe_check_for_ack_vf(struct txgbe_hw *hw, u16 mbx_id)
313 {
314         s32 ret_val = TXGBE_ERR_MBX;
315
316         UNREFERENCED_PARAMETER(mbx_id);
317         DEBUGFUNC("txgbe_check_for_ack_vf");
318
319         if (!txgbe_check_for_bit_vf(hw, TXGBE_VFMBCTL_PFACK)) {
320                 ret_val = 0;
321                 hw->mbx.stats.acks++;
322         }
323
324         return ret_val;
325 }
326
327 /**
328  *  txgbe_check_for_rst_vf - checks to see if the PF has reset
329  *  @hw: pointer to the HW structure
330  *  @mbx_id: id of mailbox to check
331  *
332  *  returns true if the PF has set the reset done bit or else false
333  **/
334 s32 txgbe_check_for_rst_vf(struct txgbe_hw *hw, u16 mbx_id)
335 {
336         s32 ret_val = TXGBE_ERR_MBX;
337
338         UNREFERENCED_PARAMETER(mbx_id);
339         DEBUGFUNC("txgbe_check_for_rst_vf");
340
341         if (!txgbe_check_for_bit_vf(hw, (TXGBE_VFMBCTL_RSTD |
342             TXGBE_VFMBCTL_RSTI))) {
343                 ret_val = 0;
344                 hw->mbx.stats.rsts++;
345         }
346
347         return ret_val;
348 }
349
350 /**
351  *  txgbe_obtain_mbx_lock_vf - obtain mailbox lock
352  *  @hw: pointer to the HW structure
353  *
354  *  return SUCCESS if we obtained the mailbox lock
355  **/
356 STATIC s32 txgbe_obtain_mbx_lock_vf(struct txgbe_hw *hw)
357 {
358         s32 ret_val = TXGBE_ERR_MBX;
359
360         DEBUGFUNC("txgbe_obtain_mbx_lock_vf");
361
362         /* Take ownership of the buffer */
363         wr32(hw, TXGBE_VFMBCTL, TXGBE_VFMBCTL_VFU);
364
365         /* reserve mailbox for vf use */
366         if (txgbe_read_v2p_mailbox(hw) & TXGBE_VFMBCTL_VFU)
367                 ret_val = 0;
368
369         return ret_val;
370 }
371
372 /**
373  *  txgbe_write_mbx_vf - Write a message to the mailbox
374  *  @hw: pointer to the HW structure
375  *  @msg: The message buffer
376  *  @size: Length of buffer
377  *  @mbx_id: id of mailbox to write
378  *
379  *  returns SUCCESS if it successfully copied message into the buffer
380  **/
381 s32 txgbe_write_mbx_vf(struct txgbe_hw *hw, u32 *msg, u16 size,
382                               u16 mbx_id)
383 {
384         s32 ret_val;
385         u16 i;
386
387         UNREFERENCED_PARAMETER(mbx_id);
388
389         DEBUGFUNC("txgbe_write_mbx_vf");
390
391         /* lock the mailbox to prevent pf/vf race condition */
392         ret_val = txgbe_obtain_mbx_lock_vf(hw);
393         if (ret_val)
394                 goto out_no_write;
395
396         /* flush msg and acks as we are overwriting the message buffer */
397         txgbe_check_for_msg_vf(hw, 0);
398         txgbe_check_for_ack_vf(hw, 0);
399
400         /* copy the caller specified message to the mailbox memory buffer */
401         for (i = 0; i < size; i++)
402                 wr32a(hw, TXGBE_VFMBX, i, msg[i]);
403
404         /* update stats */
405         hw->mbx.stats.msgs_tx++;
406
407         /* Drop VFU and interrupt the PF to tell it a message has been sent */
408         wr32(hw, TXGBE_VFMBCTL, TXGBE_VFMBCTL_REQ);
409
410 out_no_write:
411         return ret_val;
412 }
413
414 /**
415  *  txgbe_read_mbx_vf - Reads a message from the inbox intended for vf
416  *  @hw: pointer to the HW structure
417  *  @msg: The message buffer
418  *  @size: Length of buffer
419  *  @mbx_id: id of mailbox to read
420  *
421  *  returns SUCCESS if it successfully read message from buffer
422  **/
423 s32 txgbe_read_mbx_vf(struct txgbe_hw *hw, u32 *msg, u16 size,
424                              u16 mbx_id)
425 {
426         s32 ret_val = 0;
427         u16 i;
428
429         DEBUGFUNC("txgbe_read_mbx_vf");
430         UNREFERENCED_PARAMETER(mbx_id);
431
432         /* lock the mailbox to prevent pf/vf race condition */
433         ret_val = txgbe_obtain_mbx_lock_vf(hw);
434         if (ret_val)
435                 goto out_no_read;
436
437         /* copy the message from the mailbox memory buffer */
438         for (i = 0; i < size; i++)
439                 msg[i] = rd32a(hw, TXGBE_VFMBX, i);
440
441         /* Acknowledge receipt and release mailbox, then we're done */
442         wr32(hw, TXGBE_VFMBCTL, TXGBE_VFMBCTL_ACK);
443
444         /* update stats */
445         hw->mbx.stats.msgs_rx++;
446
447 out_no_read:
448         return ret_val;
449 }
450
451 /**
452  *  txgbe_init_mbx_params_vf - set initial values for vf mailbox
453  *  @hw: pointer to the HW structure
454  *
455  *  Initializes the hw->mbx struct to correct values for vf mailbox
456  */
457 void txgbe_init_mbx_params_vf(struct txgbe_hw *hw)
458 {
459         struct txgbe_mbx_info *mbx = &hw->mbx;
460
461         /* start mailbox as timed out and let the reset_hw call set the timeout
462          * value to begin communications
463          */
464         mbx->timeout = 0;
465         mbx->usec_delay = TXGBE_VF_MBX_INIT_DELAY;
466
467         mbx->size = TXGBE_P2VMBX_SIZE;
468
469         mbx->stats.msgs_tx = 0;
470         mbx->stats.msgs_rx = 0;
471         mbx->stats.reqs = 0;
472         mbx->stats.acks = 0;
473         mbx->stats.rsts = 0;
474 }
475
476 STATIC s32 txgbe_check_for_bit_pf(struct txgbe_hw *hw, u32 mask, s32 index)
477 {
478         u32 mbvficr = rd32(hw, TXGBE_MBVFICR(index));
479         s32 ret_val = TXGBE_ERR_MBX;
480
481         if (mbvficr & mask) {
482                 ret_val = 0;
483                 wr32(hw, TXGBE_MBVFICR(index), mask);
484         }
485
486         return ret_val;
487 }
488
489 /**
490  *  txgbe_check_for_msg_pf - checks to see if the VF has sent mail
491  *  @hw: pointer to the HW structure
492  *  @vf_number: the VF index
493  *
494  *  returns 0 if the VF has set the Status bit or else ERR_MBX
495  **/
496 s32 txgbe_check_for_msg_pf(struct txgbe_hw *hw, u16 vf_number)
497 {
498         s32 ret_val = TXGBE_ERR_MBX;
499         s32 index = TXGBE_MBVFICR_INDEX(vf_number);
500         u32 vf_bit = vf_number % 16;
501
502         DEBUGFUNC("txgbe_check_for_msg_pf");
503
504         if (!txgbe_check_for_bit_pf(hw, TXGBE_MBVFICR_VFREQ_VF1 << vf_bit,
505                                     index)) {
506                 ret_val = 0;
507                 hw->mbx.stats.reqs++;
508         }
509
510         return ret_val;
511 }
512
513 /**
514  *  txgbe_check_for_ack_pf - checks to see if the VF has ACKed
515  *  @hw: pointer to the HW structure
516  *  @vf_number: the VF index
517  *
518  *  returns 0 if the VF has set the Status bit or else ERR_MBX
519  **/
520 s32 txgbe_check_for_ack_pf(struct txgbe_hw *hw, u16 vf_number)
521 {
522         s32 ret_val = TXGBE_ERR_MBX;
523         s32 index = TXGBE_MBVFICR_INDEX(vf_number);
524         u32 vf_bit = vf_number % 16;
525
526         DEBUGFUNC("txgbe_check_for_ack_pf");
527
528         if (!txgbe_check_for_bit_pf(hw, TXGBE_MBVFICR_VFACK_VF1 << vf_bit,
529                                     index)) {
530                 ret_val = 0;
531                 hw->mbx.stats.acks++;
532         }
533
534         return ret_val;
535 }
536
537 /**
538  *  txgbe_check_for_rst_pf - checks to see if the VF has reset
539  *  @hw: pointer to the HW structure
540  *  @vf_number: the VF index
541  *
542  *  returns 0 if the VF has set the Status bit or else ERR_MBX
543  **/
544 s32 txgbe_check_for_rst_pf(struct txgbe_hw *hw, u16 vf_number)
545 {
546         u32 reg_offset = (vf_number < 32) ? 0 : 1;
547         u32 vf_shift = vf_number % 32;
548         u32 vflre = 0;
549         s32 ret_val = TXGBE_ERR_MBX;
550
551         DEBUGFUNC("txgbe_check_for_rst_pf");
552
553         vflre = rd32(hw, TXGBE_FLRVFE(reg_offset));
554         if (vflre & (1 << vf_shift)) {
555                 ret_val = 0;
556                 wr32(hw, TXGBE_FLRVFEC(reg_offset), (1 << vf_shift));
557                 hw->mbx.stats.rsts++;
558         }
559
560         return ret_val;
561 }
562
563 /**
564  *  txgbe_obtain_mbx_lock_pf - obtain mailbox lock
565  *  @hw: pointer to the HW structure
566  *  @vf_number: the VF index
567  *
568  *  return 0 if we obtained the mailbox lock
569  **/
570 STATIC s32 txgbe_obtain_mbx_lock_pf(struct txgbe_hw *hw, u16 vf_number)
571 {
572         s32 ret_val = TXGBE_ERR_MBX;
573         u32 p2v_mailbox;
574
575         DEBUGFUNC("txgbe_obtain_mbx_lock_pf");
576
577         /* Take ownership of the buffer */
578         wr32(hw, TXGBE_MBCTL(vf_number), TXGBE_MBCTL_PFU);
579
580         /* reserve mailbox for vf use */
581         p2v_mailbox = rd32(hw, TXGBE_MBCTL(vf_number));
582         if (p2v_mailbox & TXGBE_MBCTL_PFU)
583                 ret_val = 0;
584         else
585                 DEBUGOUT("Failed to obtain mailbox lock for VF%d", vf_number);
586
587
588         return ret_val;
589 }
590
591 /**
592  *  txgbe_write_mbx_pf - Places a message in the mailbox
593  *  @hw: pointer to the HW structure
594  *  @msg: The message buffer
595  *  @size: Length of buffer
596  *  @vf_number: the VF index
597  *
598  *  returns 0 if it successfully copied message into the buffer
599  **/
600 s32 txgbe_write_mbx_pf(struct txgbe_hw *hw, u32 *msg, u16 size, u16 vf_number)
601 {
602         s32 ret_val;
603         u16 i;
604
605         DEBUGFUNC("txgbe_write_mbx_pf");
606
607         /* lock the mailbox to prevent pf/vf race condition */
608         ret_val = txgbe_obtain_mbx_lock_pf(hw, vf_number);
609         if (ret_val)
610                 goto out_no_write;
611
612         /* flush msg and acks as we are overwriting the message buffer */
613         txgbe_check_for_msg_pf(hw, vf_number);
614         txgbe_check_for_ack_pf(hw, vf_number);
615
616         /* copy the caller specified message to the mailbox memory buffer */
617         for (i = 0; i < size; i++)
618                 wr32a(hw, TXGBE_MBMEM(vf_number), i, msg[i]);
619
620         /* Interrupt VF to tell it a message has been sent and release buffer*/
621         wr32(hw, TXGBE_MBCTL(vf_number), TXGBE_MBCTL_STS);
622
623         /* update stats */
624         hw->mbx.stats.msgs_tx++;
625
626 out_no_write:
627         return ret_val;
628 }
629
630 /**
631  *  txgbe_read_mbx_pf - Read a message from the mailbox
632  *  @hw: pointer to the HW structure
633  *  @msg: The message buffer
634  *  @size: Length of buffer
635  *  @vf_number: the VF index
636  *
637  *  This function copies a message from the mailbox buffer to the caller's
638  *  memory buffer.  The presumption is that the caller knows that there was
639  *  a message due to a VF request so no polling for message is needed.
640  **/
641 s32 txgbe_read_mbx_pf(struct txgbe_hw *hw, u32 *msg, u16 size, u16 vf_number)
642 {
643         s32 ret_val;
644         u16 i;
645
646         DEBUGFUNC("txgbe_read_mbx_pf");
647
648         /* lock the mailbox to prevent pf/vf race condition */
649         ret_val = txgbe_obtain_mbx_lock_pf(hw, vf_number);
650         if (ret_val)
651                 goto out_no_read;
652
653         /* copy the message to the mailbox memory buffer */
654         for (i = 0; i < size; i++)
655                 msg[i] = rd32a(hw, TXGBE_MBMEM(vf_number), i);
656
657         /* Acknowledge the message and release buffer */
658         wr32(hw, TXGBE_MBCTL(vf_number), TXGBE_MBCTL_ACK);
659
660         /* update stats */
661         hw->mbx.stats.msgs_rx++;
662
663 out_no_read:
664         return ret_val;
665 }
666
667 /**
668  *  txgbe_init_mbx_params_pf - set initial values for pf mailbox
669  *  @hw: pointer to the HW structure
670  *
671  *  Initializes the hw->mbx struct to correct values for pf mailbox
672  */
673 void txgbe_init_mbx_params_pf(struct txgbe_hw *hw)
674 {
675         struct txgbe_mbx_info *mbx = &hw->mbx;
676
677         mbx->timeout = 0;
678         mbx->usec_delay = 0;
679
680         mbx->size = TXGBE_P2VMBX_SIZE;
681
682         mbx->stats.msgs_tx = 0;
683         mbx->stats.msgs_rx = 0;
684         mbx->stats.reqs = 0;
685         mbx->stats.acks = 0;
686         mbx->stats.rsts = 0;
687 }