xref: /linux/drivers/net/ethernet/intel/igbvf/mbx.c (revision dee1ad47f2ee75f5146d83ca757c1b7861c34c3b)
1*dee1ad47SJeff Kirsher /*******************************************************************************
2*dee1ad47SJeff Kirsher 
3*dee1ad47SJeff Kirsher   Intel(R) 82576 Virtual Function Linux driver
4*dee1ad47SJeff Kirsher   Copyright(c) 2009 - 2010 Intel Corporation.
5*dee1ad47SJeff Kirsher 
6*dee1ad47SJeff Kirsher   This program is free software; you can redistribute it and/or modify it
7*dee1ad47SJeff Kirsher   under the terms and conditions of the GNU General Public License,
8*dee1ad47SJeff Kirsher   version 2, as published by the Free Software Foundation.
9*dee1ad47SJeff Kirsher 
10*dee1ad47SJeff Kirsher   This program is distributed in the hope it will be useful, but WITHOUT
11*dee1ad47SJeff Kirsher   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12*dee1ad47SJeff Kirsher   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13*dee1ad47SJeff Kirsher   more details.
14*dee1ad47SJeff Kirsher 
15*dee1ad47SJeff Kirsher   You should have received a copy of the GNU General Public License along with
16*dee1ad47SJeff Kirsher   this program; if not, write to the Free Software Foundation, Inc.,
17*dee1ad47SJeff Kirsher   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18*dee1ad47SJeff Kirsher 
19*dee1ad47SJeff Kirsher   The full GNU General Public License is included in this distribution in
20*dee1ad47SJeff Kirsher   the file called "COPYING".
21*dee1ad47SJeff Kirsher 
22*dee1ad47SJeff Kirsher   Contact Information:
23*dee1ad47SJeff Kirsher   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24*dee1ad47SJeff Kirsher   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25*dee1ad47SJeff Kirsher 
26*dee1ad47SJeff Kirsher *******************************************************************************/
27*dee1ad47SJeff Kirsher 
28*dee1ad47SJeff Kirsher #include "mbx.h"
29*dee1ad47SJeff Kirsher 
30*dee1ad47SJeff Kirsher /**
31*dee1ad47SJeff Kirsher  *  e1000_poll_for_msg - Wait for message notification
32*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
33*dee1ad47SJeff Kirsher  *
34*dee1ad47SJeff Kirsher  *  returns SUCCESS if it successfully received a message notification
35*dee1ad47SJeff Kirsher  **/
36*dee1ad47SJeff Kirsher static s32 e1000_poll_for_msg(struct e1000_hw *hw)
37*dee1ad47SJeff Kirsher {
38*dee1ad47SJeff Kirsher 	struct e1000_mbx_info *mbx = &hw->mbx;
39*dee1ad47SJeff Kirsher 	int countdown = mbx->timeout;
40*dee1ad47SJeff Kirsher 
41*dee1ad47SJeff Kirsher 	if (!mbx->ops.check_for_msg)
42*dee1ad47SJeff Kirsher 		goto out;
43*dee1ad47SJeff Kirsher 
44*dee1ad47SJeff Kirsher 	while (countdown && mbx->ops.check_for_msg(hw)) {
45*dee1ad47SJeff Kirsher 		countdown--;
46*dee1ad47SJeff Kirsher 		udelay(mbx->usec_delay);
47*dee1ad47SJeff Kirsher 	}
48*dee1ad47SJeff Kirsher 
49*dee1ad47SJeff Kirsher 	/* if we failed, all future posted messages fail until reset */
50*dee1ad47SJeff Kirsher 	if (!countdown)
51*dee1ad47SJeff Kirsher 		mbx->timeout = 0;
52*dee1ad47SJeff Kirsher out:
53*dee1ad47SJeff Kirsher 	return countdown ? E1000_SUCCESS : -E1000_ERR_MBX;
54*dee1ad47SJeff Kirsher }
55*dee1ad47SJeff Kirsher 
56*dee1ad47SJeff Kirsher /**
57*dee1ad47SJeff Kirsher  *  e1000_poll_for_ack - Wait for message acknowledgement
58*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
59*dee1ad47SJeff Kirsher  *
60*dee1ad47SJeff Kirsher  *  returns SUCCESS if it successfully received a message acknowledgement
61*dee1ad47SJeff Kirsher  **/
62*dee1ad47SJeff Kirsher static s32 e1000_poll_for_ack(struct e1000_hw *hw)
63*dee1ad47SJeff Kirsher {
64*dee1ad47SJeff Kirsher 	struct e1000_mbx_info *mbx = &hw->mbx;
65*dee1ad47SJeff Kirsher 	int countdown = mbx->timeout;
66*dee1ad47SJeff Kirsher 
67*dee1ad47SJeff Kirsher 	if (!mbx->ops.check_for_ack)
68*dee1ad47SJeff Kirsher 		goto out;
69*dee1ad47SJeff Kirsher 
70*dee1ad47SJeff Kirsher 	while (countdown && mbx->ops.check_for_ack(hw)) {
71*dee1ad47SJeff Kirsher 		countdown--;
72*dee1ad47SJeff Kirsher 		udelay(mbx->usec_delay);
73*dee1ad47SJeff Kirsher 	}
74*dee1ad47SJeff Kirsher 
75*dee1ad47SJeff Kirsher 	/* if we failed, all future posted messages fail until reset */
76*dee1ad47SJeff Kirsher 	if (!countdown)
77*dee1ad47SJeff Kirsher 		mbx->timeout = 0;
78*dee1ad47SJeff Kirsher out:
79*dee1ad47SJeff Kirsher 	return countdown ? E1000_SUCCESS : -E1000_ERR_MBX;
80*dee1ad47SJeff Kirsher }
81*dee1ad47SJeff Kirsher 
82*dee1ad47SJeff Kirsher /**
83*dee1ad47SJeff Kirsher  *  e1000_read_posted_mbx - Wait for message notification and receive message
84*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
85*dee1ad47SJeff Kirsher  *  @msg: The message buffer
86*dee1ad47SJeff Kirsher  *  @size: Length of buffer
87*dee1ad47SJeff Kirsher  *
88*dee1ad47SJeff Kirsher  *  returns SUCCESS if it successfully received a message notification and
89*dee1ad47SJeff Kirsher  *  copied it into the receive buffer.
90*dee1ad47SJeff Kirsher  **/
91*dee1ad47SJeff Kirsher static s32 e1000_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size)
92*dee1ad47SJeff Kirsher {
93*dee1ad47SJeff Kirsher 	struct e1000_mbx_info *mbx = &hw->mbx;
94*dee1ad47SJeff Kirsher 	s32 ret_val = -E1000_ERR_MBX;
95*dee1ad47SJeff Kirsher 
96*dee1ad47SJeff Kirsher 	if (!mbx->ops.read)
97*dee1ad47SJeff Kirsher 		goto out;
98*dee1ad47SJeff Kirsher 
99*dee1ad47SJeff Kirsher 	ret_val = e1000_poll_for_msg(hw);
100*dee1ad47SJeff Kirsher 
101*dee1ad47SJeff Kirsher 	/* if ack received read message, otherwise we timed out */
102*dee1ad47SJeff Kirsher 	if (!ret_val)
103*dee1ad47SJeff Kirsher 		ret_val = mbx->ops.read(hw, msg, size);
104*dee1ad47SJeff Kirsher out:
105*dee1ad47SJeff Kirsher 	return ret_val;
106*dee1ad47SJeff Kirsher }
107*dee1ad47SJeff Kirsher 
108*dee1ad47SJeff Kirsher /**
109*dee1ad47SJeff Kirsher  *  e1000_write_posted_mbx - Write a message to the mailbox, wait for ack
110*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
111*dee1ad47SJeff Kirsher  *  @msg: The message buffer
112*dee1ad47SJeff Kirsher  *  @size: Length of buffer
113*dee1ad47SJeff Kirsher  *
114*dee1ad47SJeff Kirsher  *  returns SUCCESS if it successfully copied message into the buffer and
115*dee1ad47SJeff Kirsher  *  received an ack to that message within delay * timeout period
116*dee1ad47SJeff Kirsher  **/
117*dee1ad47SJeff Kirsher static s32 e1000_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size)
118*dee1ad47SJeff Kirsher {
119*dee1ad47SJeff Kirsher 	struct e1000_mbx_info *mbx = &hw->mbx;
120*dee1ad47SJeff Kirsher 	s32 ret_val = -E1000_ERR_MBX;
121*dee1ad47SJeff Kirsher 
122*dee1ad47SJeff Kirsher 	/* exit if we either can't write or there isn't a defined timeout */
123*dee1ad47SJeff Kirsher 	if (!mbx->ops.write || !mbx->timeout)
124*dee1ad47SJeff Kirsher 		goto out;
125*dee1ad47SJeff Kirsher 
126*dee1ad47SJeff Kirsher 	/* send msg*/
127*dee1ad47SJeff Kirsher 	ret_val = mbx->ops.write(hw, msg, size);
128*dee1ad47SJeff Kirsher 
129*dee1ad47SJeff Kirsher 	/* if msg sent wait until we receive an ack */
130*dee1ad47SJeff Kirsher 	if (!ret_val)
131*dee1ad47SJeff Kirsher 		ret_val = e1000_poll_for_ack(hw);
132*dee1ad47SJeff Kirsher out:
133*dee1ad47SJeff Kirsher 	return ret_val;
134*dee1ad47SJeff Kirsher }
135*dee1ad47SJeff Kirsher 
136*dee1ad47SJeff Kirsher /**
137*dee1ad47SJeff Kirsher  *  e1000_read_v2p_mailbox - read v2p mailbox
138*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
139*dee1ad47SJeff Kirsher  *
140*dee1ad47SJeff Kirsher  *  This function is used to read the v2p mailbox without losing the read to
141*dee1ad47SJeff Kirsher  *  clear status bits.
142*dee1ad47SJeff Kirsher  **/
143*dee1ad47SJeff Kirsher static u32 e1000_read_v2p_mailbox(struct e1000_hw *hw)
144*dee1ad47SJeff Kirsher {
145*dee1ad47SJeff Kirsher 	u32 v2p_mailbox = er32(V2PMAILBOX(0));
146*dee1ad47SJeff Kirsher 
147*dee1ad47SJeff Kirsher 	v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox;
148*dee1ad47SJeff Kirsher 	hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS;
149*dee1ad47SJeff Kirsher 
150*dee1ad47SJeff Kirsher 	return v2p_mailbox;
151*dee1ad47SJeff Kirsher }
152*dee1ad47SJeff Kirsher 
153*dee1ad47SJeff Kirsher /**
154*dee1ad47SJeff Kirsher  *  e1000_check_for_bit_vf - Determine if a status bit was set
155*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
156*dee1ad47SJeff Kirsher  *  @mask: bitmask for bits to be tested and cleared
157*dee1ad47SJeff Kirsher  *
158*dee1ad47SJeff Kirsher  *  This function is used to check for the read to clear bits within
159*dee1ad47SJeff Kirsher  *  the V2P mailbox.
160*dee1ad47SJeff Kirsher  **/
161*dee1ad47SJeff Kirsher static s32 e1000_check_for_bit_vf(struct e1000_hw *hw, u32 mask)
162*dee1ad47SJeff Kirsher {
163*dee1ad47SJeff Kirsher 	u32 v2p_mailbox = e1000_read_v2p_mailbox(hw);
164*dee1ad47SJeff Kirsher 	s32 ret_val = -E1000_ERR_MBX;
165*dee1ad47SJeff Kirsher 
166*dee1ad47SJeff Kirsher 	if (v2p_mailbox & mask)
167*dee1ad47SJeff Kirsher 		ret_val = E1000_SUCCESS;
168*dee1ad47SJeff Kirsher 
169*dee1ad47SJeff Kirsher 	hw->dev_spec.vf.v2p_mailbox &= ~mask;
170*dee1ad47SJeff Kirsher 
171*dee1ad47SJeff Kirsher 	return ret_val;
172*dee1ad47SJeff Kirsher }
173*dee1ad47SJeff Kirsher 
174*dee1ad47SJeff Kirsher /**
175*dee1ad47SJeff Kirsher  *  e1000_check_for_msg_vf - checks to see if the PF has sent mail
176*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
177*dee1ad47SJeff Kirsher  *
178*dee1ad47SJeff Kirsher  *  returns SUCCESS if the PF has set the Status bit or else ERR_MBX
179*dee1ad47SJeff Kirsher  **/
180*dee1ad47SJeff Kirsher static s32 e1000_check_for_msg_vf(struct e1000_hw *hw)
181*dee1ad47SJeff Kirsher {
182*dee1ad47SJeff Kirsher 	s32 ret_val = -E1000_ERR_MBX;
183*dee1ad47SJeff Kirsher 
184*dee1ad47SJeff Kirsher 	if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFSTS)) {
185*dee1ad47SJeff Kirsher 		ret_val = E1000_SUCCESS;
186*dee1ad47SJeff Kirsher 		hw->mbx.stats.reqs++;
187*dee1ad47SJeff Kirsher 	}
188*dee1ad47SJeff Kirsher 
189*dee1ad47SJeff Kirsher 	return ret_val;
190*dee1ad47SJeff Kirsher }
191*dee1ad47SJeff Kirsher 
192*dee1ad47SJeff Kirsher /**
193*dee1ad47SJeff Kirsher  *  e1000_check_for_ack_vf - checks to see if the PF has ACK'd
194*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
195*dee1ad47SJeff Kirsher  *
196*dee1ad47SJeff Kirsher  *  returns SUCCESS if the PF has set the ACK bit or else ERR_MBX
197*dee1ad47SJeff Kirsher  **/
198*dee1ad47SJeff Kirsher static s32 e1000_check_for_ack_vf(struct e1000_hw *hw)
199*dee1ad47SJeff Kirsher {
200*dee1ad47SJeff Kirsher 	s32 ret_val = -E1000_ERR_MBX;
201*dee1ad47SJeff Kirsher 
202*dee1ad47SJeff Kirsher 	if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFACK)) {
203*dee1ad47SJeff Kirsher 		ret_val = E1000_SUCCESS;
204*dee1ad47SJeff Kirsher 		hw->mbx.stats.acks++;
205*dee1ad47SJeff Kirsher 	}
206*dee1ad47SJeff Kirsher 
207*dee1ad47SJeff Kirsher 	return ret_val;
208*dee1ad47SJeff Kirsher }
209*dee1ad47SJeff Kirsher 
210*dee1ad47SJeff Kirsher /**
211*dee1ad47SJeff Kirsher  *  e1000_check_for_rst_vf - checks to see if the PF has reset
212*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
213*dee1ad47SJeff Kirsher  *
214*dee1ad47SJeff Kirsher  *  returns true if the PF has set the reset done bit or else false
215*dee1ad47SJeff Kirsher  **/
216*dee1ad47SJeff Kirsher static s32 e1000_check_for_rst_vf(struct e1000_hw *hw)
217*dee1ad47SJeff Kirsher {
218*dee1ad47SJeff Kirsher 	s32 ret_val = -E1000_ERR_MBX;
219*dee1ad47SJeff Kirsher 
220*dee1ad47SJeff Kirsher 	if (!e1000_check_for_bit_vf(hw, (E1000_V2PMAILBOX_RSTD |
221*dee1ad47SJeff Kirsher 	                                 E1000_V2PMAILBOX_RSTI))) {
222*dee1ad47SJeff Kirsher 		ret_val = E1000_SUCCESS;
223*dee1ad47SJeff Kirsher 		hw->mbx.stats.rsts++;
224*dee1ad47SJeff Kirsher 	}
225*dee1ad47SJeff Kirsher 
226*dee1ad47SJeff Kirsher 	return ret_val;
227*dee1ad47SJeff Kirsher }
228*dee1ad47SJeff Kirsher 
229*dee1ad47SJeff Kirsher /**
230*dee1ad47SJeff Kirsher  *  e1000_obtain_mbx_lock_vf - obtain mailbox lock
231*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
232*dee1ad47SJeff Kirsher  *
233*dee1ad47SJeff Kirsher  *  return SUCCESS if we obtained the mailbox lock
234*dee1ad47SJeff Kirsher  **/
235*dee1ad47SJeff Kirsher static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
236*dee1ad47SJeff Kirsher {
237*dee1ad47SJeff Kirsher 	s32 ret_val = -E1000_ERR_MBX;
238*dee1ad47SJeff Kirsher 
239*dee1ad47SJeff Kirsher 	/* Take ownership of the buffer */
240*dee1ad47SJeff Kirsher 	ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
241*dee1ad47SJeff Kirsher 
242*dee1ad47SJeff Kirsher 	/* reserve mailbox for vf use */
243*dee1ad47SJeff Kirsher 	if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU)
244*dee1ad47SJeff Kirsher 		ret_val = E1000_SUCCESS;
245*dee1ad47SJeff Kirsher 
246*dee1ad47SJeff Kirsher 	return ret_val;
247*dee1ad47SJeff Kirsher }
248*dee1ad47SJeff Kirsher 
249*dee1ad47SJeff Kirsher /**
250*dee1ad47SJeff Kirsher  *  e1000_write_mbx_vf - Write a message to the mailbox
251*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
252*dee1ad47SJeff Kirsher  *  @msg: The message buffer
253*dee1ad47SJeff Kirsher  *  @size: Length of buffer
254*dee1ad47SJeff Kirsher  *
255*dee1ad47SJeff Kirsher  *  returns SUCCESS if it successfully copied message into the buffer
256*dee1ad47SJeff Kirsher  **/
257*dee1ad47SJeff Kirsher static s32 e1000_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size)
258*dee1ad47SJeff Kirsher {
259*dee1ad47SJeff Kirsher 	s32 err;
260*dee1ad47SJeff Kirsher 	u16 i;
261*dee1ad47SJeff Kirsher 
262*dee1ad47SJeff Kirsher 	/* lock the mailbox to prevent pf/vf race condition */
263*dee1ad47SJeff Kirsher 	err = e1000_obtain_mbx_lock_vf(hw);
264*dee1ad47SJeff Kirsher 	if (err)
265*dee1ad47SJeff Kirsher 		goto out_no_write;
266*dee1ad47SJeff Kirsher 
267*dee1ad47SJeff Kirsher 	/* flush any ack or msg as we are going to overwrite mailbox */
268*dee1ad47SJeff Kirsher 	e1000_check_for_ack_vf(hw);
269*dee1ad47SJeff Kirsher 	e1000_check_for_msg_vf(hw);
270*dee1ad47SJeff Kirsher 
271*dee1ad47SJeff Kirsher 	/* copy the caller specified message to the mailbox memory buffer */
272*dee1ad47SJeff Kirsher 	for (i = 0; i < size; i++)
273*dee1ad47SJeff Kirsher 		array_ew32(VMBMEM(0), i, msg[i]);
274*dee1ad47SJeff Kirsher 
275*dee1ad47SJeff Kirsher 	/* update stats */
276*dee1ad47SJeff Kirsher 	hw->mbx.stats.msgs_tx++;
277*dee1ad47SJeff Kirsher 
278*dee1ad47SJeff Kirsher 	/* Drop VFU and interrupt the PF to tell it a message has been sent */
279*dee1ad47SJeff Kirsher 	ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_REQ);
280*dee1ad47SJeff Kirsher 
281*dee1ad47SJeff Kirsher out_no_write:
282*dee1ad47SJeff Kirsher 	return err;
283*dee1ad47SJeff Kirsher }
284*dee1ad47SJeff Kirsher 
285*dee1ad47SJeff Kirsher /**
286*dee1ad47SJeff Kirsher  *  e1000_read_mbx_vf - Reads a message from the inbox intended for vf
287*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
288*dee1ad47SJeff Kirsher  *  @msg: The message buffer
289*dee1ad47SJeff Kirsher  *  @size: Length of buffer
290*dee1ad47SJeff Kirsher  *
291*dee1ad47SJeff Kirsher  *  returns SUCCESS if it successfuly read message from buffer
292*dee1ad47SJeff Kirsher  **/
293*dee1ad47SJeff Kirsher static s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size)
294*dee1ad47SJeff Kirsher {
295*dee1ad47SJeff Kirsher 	s32 err;
296*dee1ad47SJeff Kirsher 	u16 i;
297*dee1ad47SJeff Kirsher 
298*dee1ad47SJeff Kirsher 	/* lock the mailbox to prevent pf/vf race condition */
299*dee1ad47SJeff Kirsher 	err = e1000_obtain_mbx_lock_vf(hw);
300*dee1ad47SJeff Kirsher 	if (err)
301*dee1ad47SJeff Kirsher 		goto out_no_read;
302*dee1ad47SJeff Kirsher 
303*dee1ad47SJeff Kirsher 	/* copy the message from the mailbox memory buffer */
304*dee1ad47SJeff Kirsher 	for (i = 0; i < size; i++)
305*dee1ad47SJeff Kirsher 		msg[i] = array_er32(VMBMEM(0), i);
306*dee1ad47SJeff Kirsher 
307*dee1ad47SJeff Kirsher 	/* Acknowledge receipt and release mailbox, then we're done */
308*dee1ad47SJeff Kirsher 	ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_ACK);
309*dee1ad47SJeff Kirsher 
310*dee1ad47SJeff Kirsher 	/* update stats */
311*dee1ad47SJeff Kirsher 	hw->mbx.stats.msgs_rx++;
312*dee1ad47SJeff Kirsher 
313*dee1ad47SJeff Kirsher out_no_read:
314*dee1ad47SJeff Kirsher 	return err;
315*dee1ad47SJeff Kirsher }
316*dee1ad47SJeff Kirsher 
317*dee1ad47SJeff Kirsher /**
318*dee1ad47SJeff Kirsher  *  e1000_init_mbx_params_vf - set initial values for vf mailbox
319*dee1ad47SJeff Kirsher  *  @hw: pointer to the HW structure
320*dee1ad47SJeff Kirsher  *
321*dee1ad47SJeff Kirsher  *  Initializes the hw->mbx struct to correct values for vf mailbox
322*dee1ad47SJeff Kirsher  */
323*dee1ad47SJeff Kirsher s32 e1000_init_mbx_params_vf(struct e1000_hw *hw)
324*dee1ad47SJeff Kirsher {
325*dee1ad47SJeff Kirsher 	struct e1000_mbx_info *mbx = &hw->mbx;
326*dee1ad47SJeff Kirsher 
327*dee1ad47SJeff Kirsher 	/* start mailbox as timed out and let the reset_hw call set the timeout
328*dee1ad47SJeff Kirsher 	 * value to being communications */
329*dee1ad47SJeff Kirsher 	mbx->timeout = 0;
330*dee1ad47SJeff Kirsher 	mbx->usec_delay = E1000_VF_MBX_INIT_DELAY;
331*dee1ad47SJeff Kirsher 
332*dee1ad47SJeff Kirsher 	mbx->size = E1000_VFMAILBOX_SIZE;
333*dee1ad47SJeff Kirsher 
334*dee1ad47SJeff Kirsher 	mbx->ops.read = e1000_read_mbx_vf;
335*dee1ad47SJeff Kirsher 	mbx->ops.write = e1000_write_mbx_vf;
336*dee1ad47SJeff Kirsher 	mbx->ops.read_posted = e1000_read_posted_mbx;
337*dee1ad47SJeff Kirsher 	mbx->ops.write_posted = e1000_write_posted_mbx;
338*dee1ad47SJeff Kirsher 	mbx->ops.check_for_msg = e1000_check_for_msg_vf;
339*dee1ad47SJeff Kirsher 	mbx->ops.check_for_ack = e1000_check_for_ack_vf;
340*dee1ad47SJeff Kirsher 	mbx->ops.check_for_rst = e1000_check_for_rst_vf;
341*dee1ad47SJeff Kirsher 
342*dee1ad47SJeff Kirsher 	mbx->stats.msgs_tx = 0;
343*dee1ad47SJeff Kirsher 	mbx->stats.msgs_rx = 0;
344*dee1ad47SJeff Kirsher 	mbx->stats.reqs = 0;
345*dee1ad47SJeff Kirsher 	mbx->stats.acks = 0;
346*dee1ad47SJeff Kirsher 	mbx->stats.rsts = 0;
347*dee1ad47SJeff Kirsher 
348*dee1ad47SJeff Kirsher 	return E1000_SUCCESS;
349*dee1ad47SJeff Kirsher }
350*dee1ad47SJeff Kirsher 
351