2 * aQuantia Corporation Network Driver
3 * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
10 /* File aq_hw.h: Declaraion of abstract interface for NIC hardware specific
17 #include "aq_common.h"
19 /* NIC H/W capabilities */
23 unsigned int hw_priv_flags
;
45 struct aq_hw_link_status_s
{
49 #define AQ_HW_IRQ_INVALID 0U
50 #define AQ_HW_IRQ_LEGACY 1U
51 #define AQ_HW_IRQ_MSI 2U
52 #define AQ_HW_IRQ_MSIX 3U
54 #define AQ_HW_POWER_STATE_D0 0U
55 #define AQ_HW_POWER_STATE_D3 3U
57 #define AQ_HW_FLAG_STARTED 0x00000004U
58 #define AQ_HW_FLAG_STOPPING 0x00000008U
59 #define AQ_HW_FLAG_RESETTING 0x00000010U
60 #define AQ_HW_FLAG_CLOSING 0x00000020U
61 #define AQ_HW_LINK_DOWN 0x04000000U
62 #define AQ_HW_FLAG_ERR_UNPLUG 0x40000000U
63 #define AQ_HW_FLAG_ERR_HW 0x80000000U
65 #define AQ_HW_FLAG_ERRORS (AQ_HW_FLAG_ERR_HW | AQ_HW_FLAG_ERR_UNPLUG)
68 struct aq_obj_s header
;
69 struct aq_nic_cfg_s
*aq_nic_cfg
;
70 struct aq_pci_func_s
*aq_pci_func
;
72 unsigned int not_ff_addr
;
73 struct aq_hw_link_status_s aq_link_status
;
77 struct aq_ring_param_s
;
82 struct aq_hw_s
*(*create
)(struct aq_pci_func_s
*aq_pci_func
,
83 unsigned int port
, struct aq_hw_ops
*ops
);
85 void (*destroy
)(struct aq_hw_s
*self
);
87 int (*get_hw_caps
)(struct aq_hw_s
*self
,
88 struct aq_hw_caps_s
*aq_hw_caps
,
89 unsigned short device
,
90 unsigned short subsystem_device
);
92 int (*hw_ring_tx_xmit
)(struct aq_hw_s
*self
, struct aq_ring_s
*aq_ring
,
95 int (*hw_ring_rx_receive
)(struct aq_hw_s
*self
,
96 struct aq_ring_s
*aq_ring
);
98 int (*hw_ring_rx_fill
)(struct aq_hw_s
*self
, struct aq_ring_s
*aq_ring
,
99 unsigned int sw_tail_old
);
101 int (*hw_ring_tx_head_update
)(struct aq_hw_s
*self
,
102 struct aq_ring_s
*aq_ring
);
104 int (*hw_get_mac_permanent
)(struct aq_hw_s
*self
,
105 struct aq_hw_caps_s
*aq_hw_caps
,
108 int (*hw_set_mac_address
)(struct aq_hw_s
*self
, u8
*mac_addr
);
110 int (*hw_get_link_status
)(struct aq_hw_s
*self
);
112 int (*hw_set_link_speed
)(struct aq_hw_s
*self
, u32 speed
);
114 int (*hw_reset
)(struct aq_hw_s
*self
);
116 int (*hw_init
)(struct aq_hw_s
*self
, struct aq_nic_cfg_s
*aq_nic_cfg
,
119 int (*hw_start
)(struct aq_hw_s
*self
);
121 int (*hw_stop
)(struct aq_hw_s
*self
);
123 int (*hw_ring_tx_init
)(struct aq_hw_s
*self
, struct aq_ring_s
*aq_ring
,
124 struct aq_ring_param_s
*aq_ring_param
);
126 int (*hw_ring_tx_start
)(struct aq_hw_s
*self
,
127 struct aq_ring_s
*aq_ring
);
129 int (*hw_ring_tx_stop
)(struct aq_hw_s
*self
,
130 struct aq_ring_s
*aq_ring
);
132 int (*hw_ring_rx_init
)(struct aq_hw_s
*self
,
133 struct aq_ring_s
*aq_ring
,
134 struct aq_ring_param_s
*aq_ring_param
);
136 int (*hw_ring_rx_start
)(struct aq_hw_s
*self
,
137 struct aq_ring_s
*aq_ring
);
139 int (*hw_ring_rx_stop
)(struct aq_hw_s
*self
,
140 struct aq_ring_s
*aq_ring
);
142 int (*hw_irq_enable
)(struct aq_hw_s
*self
, u64 mask
);
144 int (*hw_irq_disable
)(struct aq_hw_s
*self
, u64 mask
);
146 int (*hw_irq_read
)(struct aq_hw_s
*self
, u64
*mask
);
148 int (*hw_packet_filter_set
)(struct aq_hw_s
*self
,
149 unsigned int packet_filter
);
151 int (*hw_multicast_list_set
)(struct aq_hw_s
*self
,
152 u8 ar_mac
[AQ_CFG_MULTICAST_ADDRESS_MAX
]
156 int (*hw_interrupt_moderation_set
)(struct aq_hw_s
*self
);
158 int (*hw_rss_set
)(struct aq_hw_s
*self
,
159 struct aq_rss_parameters
*rss_params
);
161 int (*hw_rss_hash_set
)(struct aq_hw_s
*self
,
162 struct aq_rss_parameters
*rss_params
);
164 int (*hw_get_regs
)(struct aq_hw_s
*self
,
165 struct aq_hw_caps_s
*aq_hw_caps
, u32
*regs_buff
);
167 int (*hw_update_stats
)(struct aq_hw_s
*self
);
169 int (*hw_get_hw_stats
)(struct aq_hw_s
*self
, u64
*data
,
170 unsigned int *p_count
);
172 int (*hw_get_fw_version
)(struct aq_hw_s
*self
, u32
*fw_version
);
174 int (*hw_deinit
)(struct aq_hw_s
*self
);
176 int (*hw_set_power
)(struct aq_hw_s
*self
, unsigned int power_state
);