ixgbe_api.c revision 181003
1224133Sdim/******************************************************************************
2224133Sdim
3224133Sdim  Copyright (c) 2001-2008, Intel Corporation
4224133Sdim  All rights reserved.
5224133Sdim
6224133Sdim  Redistribution and use in source and binary forms, with or without
7224133Sdim  modification, are permitted provided that the following conditions are met:
8224133Sdim
9224133Sdim   1. Redistributions of source code must retain the above copyright notice,
10224133Sdim      this list of conditions and the following disclaimer.
11224133Sdim
12224133Sdim   2. Redistributions in binary form must reproduce the above copyright
13224133Sdim      notice, this list of conditions and the following disclaimer in the
14224133Sdim      documentation and/or other materials provided with the distribution.
15249423Sdim
16224133Sdim   3. Neither the name of the Intel Corporation nor the names of its
17224133Sdim      contributors may be used to endorse or promote products derived from
18224133Sdim      this software without specific prior written permission.
19224133Sdim
20224133Sdim  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21276479Sdim  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22224133Sdim  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23234353Sdim  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24224133Sdim  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25288943Sdim  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26234353Sdim  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27224133Sdim  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28224133Sdim  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29234353Sdim  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30234353Sdim  POSSIBILITY OF SUCH DAMAGE.
31224133Sdim
32261991Sdim******************************************************************************/
33234353Sdim/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 181003 2008-07-30 18:15:18Z jfv $*/
34234353Sdim
35234353Sdim#include "ixgbe_api.h"
36224133Sdim#include "ixgbe_common.h"
37226633Sdim
38226633Sdimextern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
39234353Sdim
40224133Sdim/**
41224133Sdim *  ixgbe_init_shared_code - Initialize the shared code
42224133Sdim *  @hw: pointer to hardware structure
43234353Sdim *
44234353Sdim *  This will assign function pointers and assign the MAC type and PHY code.
45234353Sdim *  Does not touch the hardware. This function must be called prior to any
46234353Sdim *  other function in the shared code. The ixgbe_hw structure should be
47234353Sdim *  memset to 0 prior to calling this function.  The following fields in
48234353Sdim *  hw structure should be filled in prior to calling this function:
49234353Sdim *  hw_addr, back, device_id, vendor_id, subsystem_device_id,
50234353Sdim *   subsystem_vendor_id, and revision_id
51234353Sdim **/
52234353Sdims32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
53234353Sdim{
54234353Sdim	s32 status;
55234353Sdim
56234353Sdim	/*
57234353Sdim	 * Set the mac type
58234353Sdim	 */
59234353Sdim	ixgbe_set_mac_type(hw);
60234353Sdim
61234353Sdim	switch (hw->mac.type) {
62234353Sdim	case ixgbe_mac_82598EB:
63239462Sdim		status = ixgbe_init_ops_82598(hw);
64239462Sdim		break;
65244628Sdim	default:
66244628Sdim		status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
67244628Sdim		break;
68244628Sdim	}
69224133Sdim
70224133Sdim	return status;
71224133Sdim}
72234353Sdim
73234353Sdim/**
74234353Sdim *  ixgbe_set_mac_type - Sets MAC type
75224133Sdim *  @hw: pointer to the HW structure
76234353Sdim *
77261991Sdim *  This function sets the mac type of the adapter based on the
78239462Sdim *  vendor ID and device ID stored in the hw structure.
79234353Sdim **/
80224133Sdims32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
81234353Sdim{
82234353Sdim	s32 ret_val = IXGBE_SUCCESS;
83239462Sdim
84234353Sdim	DEBUGFUNC("ixgbe_set_mac_type\n");
85224133Sdim
86234353Sdim	if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
87234353Sdim		switch (hw->device_id) {
88239462Sdim		case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
89234353Sdim		case IXGBE_DEV_ID_82598AF_DUAL_PORT:
90224133Sdim		case IXGBE_DEV_ID_82598AT:
91288943Sdim		case IXGBE_DEV_ID_82598AT_DUAL_PORT:
92288943Sdim		case IXGBE_DEV_ID_82598EB_CX4:
93288943Sdim		case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
94288943Sdim		case IXGBE_DEV_ID_82598EB_XF_LR:
95288943Sdim			hw->mac.type = ixgbe_mac_82598EB;
96234353Sdim			break;
97234353Sdim		default:
98234353Sdim			ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
99224133Sdim			break;
100234353Sdim		}
101234353Sdim	} else {
102239462Sdim		ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
103234353Sdim	}
104224133Sdim
105234353Sdim	DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
106234353Sdim	          hw->mac.type, ret_val);
107224133Sdim	return ret_val;
108234353Sdim}
109288943Sdim
110234353Sdim/**
111234353Sdim *  ixgbe_init_hw - Initialize the hardware
112288943Sdim *  @hw: pointer to hardware structure
113234353Sdim *
114234353Sdim *  Initialize the hardware by resetting and then starting the hardware
115234353Sdim **/
116234353Sdims32 ixgbe_init_hw(struct ixgbe_hw *hw)
117288943Sdim{
118288943Sdim	return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
119288943Sdim	                       IXGBE_NOT_IMPLEMENTED);
120224133Sdim}
121224133Sdim
122239462Sdim/**
123239462Sdim *  ixgbe_reset_hw - Performs a hardware reset
124239462Sdim *  @hw: pointer to hardware structure
125239462Sdim *
126234353Sdim *  Resets the hardware by resetting the transmit and receive units, masks and
127234353Sdim *  clears all interrupts, performs a PHY reset, and performs a MAC reset
128234353Sdim **/
129234353Sdims32 ixgbe_reset_hw(struct ixgbe_hw *hw)
130234353Sdim{
131234353Sdim	return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
132239462Sdim	                       IXGBE_NOT_IMPLEMENTED);
133234353Sdim}
134239462Sdim
135234353Sdim/**
136226633Sdim *  ixgbe_start_hw - Prepares hardware for Rx/Tx
137234353Sdim *  @hw: pointer to hardware structure
138226633Sdim *
139234353Sdim *  Starts the hardware by filling the bus info structure and media type,
140226633Sdim *  clears all on chip counters, initializes receive address registers,
141226633Sdim *  multicast table, VLAN filter table, calls routine to setup link and
142226633Sdim *  flow control settings, and leaves transmit and receive units disabled
143288943Sdim *  and uninitialized.
144226633Sdim **/
145288943Sdims32 ixgbe_start_hw(struct ixgbe_hw *hw)
146226633Sdim{
147226633Sdim	return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
148226633Sdim	                       IXGBE_NOT_IMPLEMENTED);
149288943Sdim}
150226633Sdim
151226633Sdim/**
152226633Sdim *  ixgbe_clear_hw_cntrs - Clear hardware counters
153234353Sdim *  @hw: pointer to hardware structure
154234353Sdim *
155234353Sdim *  Clears all hardware statistics counters by reading them from the hardware
156226633Sdim *  Statistics counters are clear on read.
157226633Sdim **/
158226633Sdims32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
159226633Sdim{
160226633Sdim	return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
161276479Sdim	                       IXGBE_NOT_IMPLEMENTED);
162276479Sdim}
163276479Sdim
164288943Sdim/**
165288943Sdim *  ixgbe_get_media_type - Get media type
166288943Sdim *  @hw: pointer to hardware structure
167276479Sdim *
168288943Sdim *  Returns the media type (fiber, copper, backplane)
169276479Sdim **/
170276479Sdimenum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
171276479Sdim{
172276479Sdim	return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
173276479Sdim	                       ixgbe_media_type_unknown);
174276479Sdim}
175276479Sdim
176276479Sdim/**
177276479Sdim *  ixgbe_get_mac_addr - Get MAC address
178276479Sdim *  @hw: pointer to hardware structure
179276479Sdim *  @mac_addr: Adapter MAC address
180276479Sdim *
181276479Sdim *  Reads the adapter's MAC address from the first Receive Address Register
182276479Sdim *  (RAR0) A reset of the adapter must have been performed prior to calling
183276479Sdim *  this function in order for the MAC address to have been loaded from the
184276479Sdim *  EEPROM into RAR0
185276479Sdim **/
186276479Sdims32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
187276479Sdim{
188276479Sdim	return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
189276479Sdim	                       (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
190276479Sdim}
191276479Sdim
192276479Sdim/**
193276479Sdim *  ixgbe_get_bus_info - Set PCI bus info
194276479Sdim *  @hw: pointer to hardware structure
195276479Sdim *
196276479Sdim *  Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
197276479Sdim **/
198276479Sdims32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
199276479Sdim{
200276479Sdim	return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
201276479Sdim	                       IXGBE_NOT_IMPLEMENTED);
202276479Sdim}
203276479Sdim
204276479Sdim/**
205276479Sdim *  ixgbe_get_num_of_tx_queues - Get Tx queues
206276479Sdim *  @hw: pointer to hardware structure
207276479Sdim *
208276479Sdim *  Returns the number of transmit queues for the given adapter.
209276479Sdim **/
210276479Sdimu32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
211276479Sdim{
212276479Sdim	return hw->mac.max_tx_queues;
213276479Sdim}
214276479Sdim
215276479Sdim/**
216276479Sdim *  ixgbe_get_num_of_rx_queues - Get Rx queues
217276479Sdim *  @hw: pointer to hardware structure
218276479Sdim *
219276479Sdim *  Returns the number of receive queues for the given adapter.
220276479Sdim **/
221276479Sdimu32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
222276479Sdim{
223276479Sdim	return hw->mac.max_rx_queues;
224276479Sdim}
225276479Sdim
226224133Sdim/**
227276479Sdim *  ixgbe_stop_adapter - Disable Rx/Tx units
228276479Sdim *  @hw: pointer to hardware structure
229276479Sdim *
230224133Sdim *  Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
231234353Sdim *  disables transmit and receive units. The adapter_stopped flag is used by
232224133Sdim *  the shared code and drivers to determine if the adapter is in a stopped
233224133Sdim *  state and should not touch the hardware.
234226633Sdim **/
235224133Sdims32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
236226633Sdim{
237226633Sdim	return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
238224133Sdim	                       IXGBE_NOT_IMPLEMENTED);
239224133Sdim}
240234353Sdim
241/**
242 *  ixgbe_read_pba_num - Reads part number from EEPROM
243 *  @hw: pointer to hardware structure
244 *  @pba_num: stores the part number from the EEPROM
245 *
246 *  Reads the part number from the EEPROM.
247 **/
248s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
249{
250	return ixgbe_read_pba_num_generic(hw, pba_num);
251}
252
253/**
254 *  ixgbe_identify_phy - Get PHY type
255 *  @hw: pointer to hardware structure
256 *
257 *  Determines the physical layer module found on the current adapter.
258 **/
259s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
260{
261	s32 status = IXGBE_SUCCESS;
262
263	if (hw->phy.type == ixgbe_phy_unknown) {
264		status = ixgbe_call_func(hw,
265		                         hw->phy.ops.identify,
266		                         (hw),
267		                         IXGBE_NOT_IMPLEMENTED);
268	}
269
270	return status;
271}
272
273/**
274 *  ixgbe_reset_phy - Perform a PHY reset
275 *  @hw: pointer to hardware structure
276 **/
277s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
278{
279	s32 status = IXGBE_SUCCESS;
280
281	if (hw->phy.type == ixgbe_phy_unknown) {
282		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) {
283		    status = IXGBE_ERR_PHY;
284		}
285	}
286
287	if (status == IXGBE_SUCCESS) {
288		status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
289		                         IXGBE_NOT_IMPLEMENTED);
290	}
291	return status;
292}
293
294/**
295 *  ixgbe_get_phy_firmware_version -
296 *  @hw: pointer to hardware structure
297 *  @firmware_version: pointer to firmware version
298 **/
299s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
300{
301	s32 status = IXGBE_SUCCESS;
302
303	status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
304	                         (hw, firmware_version),
305	                         IXGBE_NOT_IMPLEMENTED);
306	return status;
307}
308
309/**
310 *  ixgbe_read_phy_reg - Read PHY register
311 *  @hw: pointer to hardware structure
312 *  @reg_addr: 32 bit address of PHY register to read
313 *  @phy_data: Pointer to read data from PHY register
314 *
315 *  Reads a value from a specified PHY register
316 **/
317s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
318                       u16 *phy_data)
319{
320	return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
321	                       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
322}
323
324/**
325 *  ixgbe_write_phy_reg - Write PHY register
326 *  @hw: pointer to hardware structure
327 *  @reg_addr: 32 bit PHY register to write
328 *  @phy_data: Data to write to the PHY register
329 *
330 *  Writes a value to specified PHY register
331 **/
332s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
333                        u16 phy_data)
334{
335	return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
336	                       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
337}
338
339/**
340 *  ixgbe_setup_phy_link - Restart PHY autoneg
341 *  @hw: pointer to hardware structure
342 *
343 *  Restart autonegotiation and PHY and waits for completion.
344 **/
345s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
346{
347	return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
348	                       IXGBE_NOT_IMPLEMENTED);
349}
350
351/**
352 *  ixgbe_check_phy_link - Determine link and speed status
353 *  @hw: pointer to hardware structure
354 *
355 *  Reads a PHY register to determine if link is up and the current speed for
356 *  the PHY.
357 **/
358s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
359                         bool *link_up)
360{
361	return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
362	                       link_up), IXGBE_NOT_IMPLEMENTED);
363}
364
365/**
366 *  ixgbe_setup_phy_link_speed - Set auto advertise
367 *  @hw: pointer to hardware structure
368 *  @speed: new link speed
369 *  @autoneg: TRUE if autonegotiation enabled
370 *
371 *  Sets the auto advertised capabilities
372 **/
373s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
374                               bool autoneg,
375                               bool autoneg_wait_to_complete)
376{
377	return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
378	                       autoneg, autoneg_wait_to_complete),
379	                       IXGBE_NOT_IMPLEMENTED);
380}
381
382/**
383 *  ixgbe_setup_link - Configure link settings
384 *  @hw: pointer to hardware structure
385 *
386 *  Configures link settings based on values in the ixgbe_hw struct.
387 *  Restarts the link.  Performs autonegotiation if needed.
388 **/
389s32 ixgbe_setup_link(struct ixgbe_hw *hw)
390{
391	return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw),
392	                       IXGBE_NOT_IMPLEMENTED);
393}
394
395/**
396 *  ixgbe_check_link - Get link and speed status
397 *  @hw: pointer to hardware structure
398 *
399 *  Reads the links register to determine if link is up and the current speed
400 **/
401s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
402                     bool *link_up, bool link_up_wait_to_complete)
403{
404	return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
405	                       link_up, link_up_wait_to_complete),
406	                       IXGBE_NOT_IMPLEMENTED);
407}
408
409/**
410 *  ixgbe_setup_link_speed - Set link speed
411 *  @hw: pointer to hardware structure
412 *  @speed: new link speed
413 *  @autoneg: TRUE if autonegotiation enabled
414 *
415 *  Set the link speed and restarts the link.
416 **/
417s32 ixgbe_setup_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
418                           bool autoneg,
419                           bool autoneg_wait_to_complete)
420{
421	return ixgbe_call_func(hw, hw->mac.ops.setup_link_speed, (hw, speed,
422	                       autoneg, autoneg_wait_to_complete),
423	                       IXGBE_NOT_IMPLEMENTED);
424}
425
426/**
427 *  ixgbe_get_link_capabilities - Returns link capabilities
428 *  @hw: pointer to hardware structure
429 *
430 *  Determines the link capabilities of the current configuration.
431 **/
432s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
433                                bool *autoneg)
434{
435	return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
436	                       speed, autoneg), IXGBE_NOT_IMPLEMENTED);
437}
438
439/**
440 *  ixgbe_led_on - Turn on LEDs
441 *  @hw: pointer to hardware structure
442 *  @index: led number to turn on
443 *
444 *  Turns on the software controllable LEDs.
445 **/
446s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
447{
448	return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
449	                       IXGBE_NOT_IMPLEMENTED);
450}
451
452/**
453 *  ixgbe_led_off - Turn off LEDs
454 *  @hw: pointer to hardware structure
455 *  @index: led number to turn off
456 *
457 *  Turns off the software controllable LEDs.
458 **/
459s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
460{
461	return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
462	                       IXGBE_NOT_IMPLEMENTED);
463}
464
465/**
466 *  ixgbe_blink_led_start - Blink LEDs
467 *  @hw: pointer to hardware structure
468 *  @index: led number to blink
469 *
470 *  Blink LED based on index.
471 **/
472s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
473{
474	return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
475	                       IXGBE_NOT_IMPLEMENTED);
476}
477
478/**
479 *  ixgbe_blink_led_stop - Stop blinking LEDs
480 *  @hw: pointer to hardware structure
481 *
482 *  Stop blinking LED based on index.
483 **/
484s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
485{
486	return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
487	                       IXGBE_NOT_IMPLEMENTED);
488}
489
490/**
491 *  ixgbe_init_eeprom_params - Initialize EEPROM parameters
492 *  @hw: pointer to hardware structure
493 *
494 *  Initializes the EEPROM parameters ixgbe_eeprom_info within the
495 *  ixgbe_hw struct in order to set up EEPROM access.
496 **/
497s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
498{
499	return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
500	                       IXGBE_NOT_IMPLEMENTED);
501}
502
503
504/**
505 *  ixgbe_write_eeprom - Write word to EEPROM
506 *  @hw: pointer to hardware structure
507 *  @offset: offset within the EEPROM to be written to
508 *  @data: 16 bit word to be written to the EEPROM
509 *
510 *  Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
511 *  called after this function, the EEPROM will most likely contain an
512 *  invalid checksum.
513 **/
514s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
515{
516	return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
517	                       IXGBE_NOT_IMPLEMENTED);
518}
519
520/**
521 *  ixgbe_read_eeprom - Read word from EEPROM
522 *  @hw: pointer to hardware structure
523 *  @offset: offset within the EEPROM to be read
524 *  @data: read 16 bit value from EEPROM
525 *
526 *  Reads 16 bit value from EEPROM
527 **/
528s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
529{
530	return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
531	                       IXGBE_NOT_IMPLEMENTED);
532}
533
534/**
535 *  ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
536 *  @hw: pointer to hardware structure
537 *  @checksum_val: calculated checksum
538 *
539 *  Performs checksum calculation and validates the EEPROM checksum
540 **/
541s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
542{
543	return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
544	                       (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
545}
546
547/**
548 *  ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
549 *  @hw: pointer to hardware structure
550 **/
551s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
552{
553	return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
554	                       IXGBE_NOT_IMPLEMENTED);
555}
556
557/**
558 *  ixgbe_set_rar - Set Rx address register
559 *  @hw: pointer to hardware structure
560 *  @index: Receive address register to write
561 *  @addr: Address to put into receive address register
562 *  @vmdq: VMDq "set"
563 *  @enable_addr: set flag that address is active
564 *
565 *  Puts an ethernet address into a receive address register.
566 **/
567s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
568                  u32 enable_addr)
569{
570	return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
571	                       enable_addr), IXGBE_NOT_IMPLEMENTED);
572}
573
574/**
575 *  ixgbe_clear_rar - Clear Rx address register
576 *  @hw: pointer to hardware structure
577 *  @index: Receive address register to write
578 *
579 *  Puts an ethernet address into a receive address register.
580 **/
581s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
582{
583	return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
584	                       IXGBE_NOT_IMPLEMENTED);
585}
586
587/**
588 *  ixgbe_set_vmdq - Associate a VMDq index with a receive address
589 *  @hw: pointer to hardware structure
590 *  @rar: receive address register index to associate with VMDq index
591 *  @vmdq: VMDq set or pool index
592 **/
593s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
594{
595	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
596	                       IXGBE_NOT_IMPLEMENTED);
597}
598
599/**
600 *  ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
601 *  @hw: pointer to hardware structure
602 *  @rar: receive address register index to disassociate with VMDq index
603 *  @vmdq: VMDq set or pool index
604 **/
605s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
606{
607	return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
608	                       IXGBE_NOT_IMPLEMENTED);
609}
610
611/**
612 *  ixgbe_init_rx_addrs - Initializes receive address filters.
613 *  @hw: pointer to hardware structure
614 *
615 *  Places the MAC address in receive address register 0 and clears the rest
616 *  of the receive address registers. Clears the multicast table. Assumes
617 *  the receiver is in reset when the routine is called.
618 **/
619s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
620{
621	return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
622	                       IXGBE_NOT_IMPLEMENTED);
623}
624
625/**
626 *  ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
627 *  @hw: pointer to hardware structure
628 **/
629u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
630{
631	return hw->mac.num_rar_entries;
632}
633
634/**
635 *  ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
636 *  @hw: pointer to hardware structure
637 *  @addr_list: the list of new multicast addresses
638 *  @addr_count: number of addresses
639 *  @func: iterator function to walk the multicast address list
640 *
641 *  The given list replaces any existing list. Clears the secondary addrs from
642 *  receive address registers. Uses unused receive address registers for the
643 *  first secondary addresses, and falls back to promiscuous mode as needed.
644 **/
645s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
646                              u32 addr_count, ixgbe_mc_addr_itr func)
647{
648	return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
649	                       addr_list, addr_count, func),
650	                       IXGBE_NOT_IMPLEMENTED);
651}
652
653/**
654 *  ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
655 *  @hw: pointer to hardware structure
656 *  @mc_addr_list: the list of new multicast addresses
657 *  @mc_addr_count: number of addresses
658 *  @func: iterator function to walk the multicast address list
659 *
660 *  The given list replaces any existing list. Clears the MC addrs from receive
661 *  address registers and the multicast table. Uses unused receive address
662 *  registers for the first multicast addresses, and hashes the rest into the
663 *  multicast table.
664 **/
665s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
666                              u32 mc_addr_count, ixgbe_mc_addr_itr func)
667{
668	return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
669	                       mc_addr_list, mc_addr_count, func),
670	                       IXGBE_NOT_IMPLEMENTED);
671}
672
673/**
674 *  ixgbe_enable_mc - Enable multicast address in RAR
675 *  @hw: pointer to hardware structure
676 *
677 *  Enables multicast address in RAR and the use of the multicast hash table.
678 **/
679s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
680{
681	return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
682	                       IXGBE_NOT_IMPLEMENTED);
683}
684
685/**
686 *  ixgbe_disable_mc - Disable multicast address in RAR
687 *  @hw: pointer to hardware structure
688 *
689 *  Disables multicast address in RAR and the use of the multicast hash table.
690 **/
691s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
692{
693	return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
694	                       IXGBE_NOT_IMPLEMENTED);
695}
696
697/**
698 *  ixgbe_clear_vfta - Clear VLAN filter table
699 *  @hw: pointer to hardware structure
700 *
701 *  Clears the VLAN filer table, and the VMDq index associated with the filter
702 **/
703s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
704{
705	return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
706	                       IXGBE_NOT_IMPLEMENTED);
707}
708
709/**
710 *  ixgbe_set_vfta - Set VLAN filter table
711 *  @hw: pointer to hardware structure
712 *  @vlan: VLAN id to write to VLAN filter
713 *  @vind: VMDq output index that maps queue to VLAN id in VFTA
714 *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
715 *
716 *  Turn on/off specified VLAN in the VLAN filter table.
717 **/
718s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
719{
720	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
721	                       vlan_on), IXGBE_NOT_IMPLEMENTED);
722}
723
724/**
725 *  ixgbe_setup_fc - Set flow control
726 *  @hw: pointer to hardware structure
727 *  @packetbuf_num: packet buffer number (0-7)
728 *
729 *  Configures the flow control settings based on SW configuration.
730 **/
731s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
732{
733	return ixgbe_call_func(hw, hw->mac.ops.setup_fc, (hw, packetbuf_num),
734	                       IXGBE_NOT_IMPLEMENTED);
735}
736
737/**
738 *  ixgbe_read_analog_reg8 - Reads 8 bit analog register
739 *  @hw: pointer to hardware structure
740 *  @reg: analog register to read
741 *  @val: read value
742 *
743 *  Performs write operation to analog register specified.
744 **/
745s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
746{
747	return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
748	                       val), IXGBE_NOT_IMPLEMENTED);
749}
750
751/**
752 *  ixgbe_write_analog_reg8 - Writes 8 bit analog register
753 *  @hw: pointer to hardware structure
754 *  @reg: analog register to write
755 *  @val: value to write
756 *
757 *  Performs write operation to Atlas analog register specified.
758 **/
759s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
760{
761	return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
762	                       val), IXGBE_NOT_IMPLEMENTED);
763}
764
765/**
766 *  ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
767 *  @hw: pointer to hardware structure
768 *
769 * Initializes the Unicast Table Arrays to zero on device load.  This
770 * is part of the Rx init addr execution path.
771 **/
772s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
773{
774	return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
775	                       IXGBE_NOT_IMPLEMENTED);
776}
777