ixgbe_api.c revision 181003
1/******************************************************************************
2
3  Copyright (c) 2001-2008, Intel Corporation
4  All rights reserved.
5
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions are met:
8
9   1. Redistributions of source code must retain the above copyright notice,
10      this list of conditions and the following disclaimer.
11
12   2. Redistributions in binary form must reproduce the above copyright
13      notice, this list of conditions and the following disclaimer in the
14      documentation and/or other materials provided with the distribution.
15
16   3. Neither the name of the Intel Corporation nor the names of its
17      contributors may be used to endorse or promote products derived from
18      this software without specific prior written permission.
19
20  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  POSSIBILITY OF SUCH DAMAGE.
31
32******************************************************************************/
33/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 181003 2008-07-30 18:15:18Z jfv $*/
34
35#include "ixgbe_api.h"
36#include "ixgbe_common.h"
37
38extern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
39
40/**
41 *  ixgbe_init_shared_code - Initialize the shared code
42 *  @hw: pointer to hardware structure
43 *
44 *  This will assign function pointers and assign the MAC type and PHY code.
45 *  Does not touch the hardware. This function must be called prior to any
46 *  other function in the shared code. The ixgbe_hw structure should be
47 *  memset to 0 prior to calling this function.  The following fields in
48 *  hw structure should be filled in prior to calling this function:
49 *  hw_addr, back, device_id, vendor_id, subsystem_device_id,
50 *   subsystem_vendor_id, and revision_id
51 **/
52s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
53{
54	s32 status;
55
56	/*
57	 * Set the mac type
58	 */
59	ixgbe_set_mac_type(hw);
60
61	switch (hw->mac.type) {
62	case ixgbe_mac_82598EB:
63		status = ixgbe_init_ops_82598(hw);
64		break;
65	default:
66		status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
67		break;
68	}
69
70	return status;
71}
72
73/**
74 *  ixgbe_set_mac_type - Sets MAC type
75 *  @hw: pointer to the HW structure
76 *
77 *  This function sets the mac type of the adapter based on the
78 *  vendor ID and device ID stored in the hw structure.
79 **/
80s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
81{
82	s32 ret_val = IXGBE_SUCCESS;
83
84	DEBUGFUNC("ixgbe_set_mac_type\n");
85
86	if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
87		switch (hw->device_id) {
88		case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
89		case IXGBE_DEV_ID_82598AF_DUAL_PORT:
90		case IXGBE_DEV_ID_82598AT:
91		case IXGBE_DEV_ID_82598AT_DUAL_PORT:
92		case IXGBE_DEV_ID_82598EB_CX4:
93		case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
94		case IXGBE_DEV_ID_82598EB_XF_LR:
95			hw->mac.type = ixgbe_mac_82598EB;
96			break;
97		default:
98			ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
99			break;
100		}
101	} else {
102		ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
103	}
104
105	DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
106	          hw->mac.type, ret_val);
107	return ret_val;
108}
109
110/**
111 *  ixgbe_init_hw - Initialize the hardware
112 *  @hw: pointer to hardware structure
113 *
114 *  Initialize the hardware by resetting and then starting the hardware
115 **/
116s32 ixgbe_init_hw(struct ixgbe_hw *hw)
117{
118	return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
119	                       IXGBE_NOT_IMPLEMENTED);
120}
121
122/**
123 *  ixgbe_reset_hw - Performs a hardware reset
124 *  @hw: pointer to hardware structure
125 *
126 *  Resets the hardware by resetting the transmit and receive units, masks and
127 *  clears all interrupts, performs a PHY reset, and performs a MAC reset
128 **/
129s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
130{
131	return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
132	                       IXGBE_NOT_IMPLEMENTED);
133}
134
135/**
136 *  ixgbe_start_hw - Prepares hardware for Rx/Tx
137 *  @hw: pointer to hardware structure
138 *
139 *  Starts the hardware by filling the bus info structure and media type,
140 *  clears all on chip counters, initializes receive address registers,
141 *  multicast table, VLAN filter table, calls routine to setup link and
142 *  flow control settings, and leaves transmit and receive units disabled
143 *  and uninitialized.
144 **/
145s32 ixgbe_start_hw(struct ixgbe_hw *hw)
146{
147	return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
148	                       IXGBE_NOT_IMPLEMENTED);
149}
150
151/**
152 *  ixgbe_clear_hw_cntrs - Clear hardware counters
153 *  @hw: pointer to hardware structure
154 *
155 *  Clears all hardware statistics counters by reading them from the hardware
156 *  Statistics counters are clear on read.
157 **/
158s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
159{
160	return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
161	                       IXGBE_NOT_IMPLEMENTED);
162}
163
164/**
165 *  ixgbe_get_media_type - Get media type
166 *  @hw: pointer to hardware structure
167 *
168 *  Returns the media type (fiber, copper, backplane)
169 **/
170enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
171{
172	return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
173	                       ixgbe_media_type_unknown);
174}
175
176/**
177 *  ixgbe_get_mac_addr - Get MAC address
178 *  @hw: pointer to hardware structure
179 *  @mac_addr: Adapter MAC address
180 *
181 *  Reads the adapter's MAC address from the first Receive Address Register
182 *  (RAR0) A reset of the adapter must have been performed prior to calling
183 *  this function in order for the MAC address to have been loaded from the
184 *  EEPROM into RAR0
185 **/
186s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
187{
188	return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
189	                       (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
190}
191
192/**
193 *  ixgbe_get_bus_info - Set PCI bus info
194 *  @hw: pointer to hardware structure
195 *
196 *  Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
197 **/
198s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
199{
200	return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
201	                       IXGBE_NOT_IMPLEMENTED);
202}
203
204/**
205 *  ixgbe_get_num_of_tx_queues - Get Tx queues
206 *  @hw: pointer to hardware structure
207 *
208 *  Returns the number of transmit queues for the given adapter.
209 **/
210u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
211{
212	return hw->mac.max_tx_queues;
213}
214
215/**
216 *  ixgbe_get_num_of_rx_queues - Get Rx queues
217 *  @hw: pointer to hardware structure
218 *
219 *  Returns the number of receive queues for the given adapter.
220 **/
221u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
222{
223	return hw->mac.max_rx_queues;
224}
225
226/**
227 *  ixgbe_stop_adapter - Disable Rx/Tx units
228 *  @hw: pointer to hardware structure
229 *
230 *  Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
231 *  disables transmit and receive units. The adapter_stopped flag is used by
232 *  the shared code and drivers to determine if the adapter is in a stopped
233 *  state and should not touch the hardware.
234 **/
235s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
236{
237	return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
238	                       IXGBE_NOT_IMPLEMENTED);
239}
240
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