2 * AMD 10Gb Ethernet driver
4 * This file is available to you under your choice of the following two
9 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
11 * This file is free software; you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 2 of the License, or (at
14 * your option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * This file incorporates work covered by the following copyright and
26 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
27 * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
28 * Inc. unless otherwise expressly agreed to in writing between Synopsys
31 * The Software IS NOT an item of Licensed Software or Licensed Product
32 * under any End User Software License Agreement or Agreement for Licensed
33 * Product with Synopsys or any supplement thereto. Permission is hereby
34 * granted, free of charge, to any person obtaining a copy of this software
35 * annotated with this license and the Software, to deal in the Software
36 * without restriction, including without limitation the rights to use,
37 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
38 * of the Software, and to permit persons to whom the Software is furnished
39 * to do so, subject to the following conditions:
41 * The above copyright notice and this permission notice shall be included
42 * in all copies or substantial portions of the Software.
44 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
45 * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
46 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
47 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
48 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
50 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
54 * THE POSSIBILITY OF SUCH DAMAGE.
57 * License 2: Modified BSD
59 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
60 * All rights reserved.
62 * Redistribution and use in source and binary forms, with or without
63 * modification, are permitted provided that the following conditions are met:
64 * * Redistributions of source code must retain the above copyright
65 * notice, this list of conditions and the following disclaimer.
66 * * Redistributions in binary form must reproduce the above copyright
67 * notice, this list of conditions and the following disclaimer in the
68 * documentation and/or other materials provided with the distribution.
69 * * Neither the name of Advanced Micro Devices, Inc. nor the
70 * names of its contributors may be used to endorse or promote products
71 * derived from this software without specific prior written permission.
73 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
74 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
75 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
76 * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
77 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
78 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
79 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
80 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
81 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
82 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
84 * This file incorporates work covered by the following copyright and
86 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
87 * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
88 * Inc. unless otherwise expressly agreed to in writing between Synopsys
91 * The Software IS NOT an item of Licensed Software or Licensed Product
92 * under any End User Software License Agreement or Agreement for Licensed
93 * Product with Synopsys or any supplement thereto. Permission is hereby
94 * granted, free of charge, to any person obtaining a copy of this software
95 * annotated with this license and the Software, to deal in the Software
96 * without restriction, including without limitation the rights to use,
97 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98 * of the Software, and to permit persons to whom the Software is furnished
99 * to do so, subject to the following conditions:
101 * The above copyright notice and this permission notice shall be included
102 * in all copies or substantial portions of the Software.
104 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
105 * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
106 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
107 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
108 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
109 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
110 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
111 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
112 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
113 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
114 * THE POSSIBILITY OF SUCH DAMAGE.
120 #include <linux/dma-mapping.h>
121 #include <linux/netdevice.h>
122 #include <linux/workqueue.h>
123 #include <linux/phy.h>
124 #include <linux/if_vlan.h>
125 #include <linux/bitops.h>
126 #include <linux/ptp_clock_kernel.h>
127 #include <linux/timecounter.h>
128 #include <linux/net_tstamp.h>
129 #include <net/dcbnl.h>
130 #include <linux/completion.h>
131 #include <linux/cpumask.h>
132 #include <linux/interrupt.h>
133 #include <linux/dcache.h>
134 #include <linux/ethtool.h>
135 #include <linux/list.h>
137 #define XGBE_DRV_NAME "amd-xgbe"
138 #define XGBE_DRV_VERSION "1.0.3"
139 #define XGBE_DRV_DESC "AMD 10 Gigabit Ethernet Driver"
141 /* Descriptor related defines */
142 #define XGBE_TX_DESC_CNT 512
143 #define XGBE_TX_DESC_MIN_FREE (XGBE_TX_DESC_CNT >> 3)
144 #define XGBE_TX_DESC_MAX_PROC (XGBE_TX_DESC_CNT >> 1)
145 #define XGBE_RX_DESC_CNT 512
147 #define XGBE_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1))
149 /* Descriptors required for maximum contiguous TSO/GSO packet */
150 #define XGBE_TX_MAX_SPLIT ((GSO_MAX_SIZE / XGBE_TX_MAX_BUF_SIZE) + 1)
152 /* Maximum possible descriptors needed for an SKB:
153 * - Maximum number of SKB frags
154 * - Maximum descriptors for contiguous TSO/GSO packet
155 * - Possible context descriptor
156 * - Possible TSO header descriptor
158 #define XGBE_TX_MAX_DESCS (MAX_SKB_FRAGS + XGBE_TX_MAX_SPLIT + 2)
160 #define XGBE_RX_MIN_BUF_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
161 #define XGBE_RX_BUF_ALIGN 64
162 #define XGBE_SKB_ALLOC_SIZE 256
163 #define XGBE_SPH_HDSMS_SIZE 2 /* Keep in sync with SKB_ALLOC_SIZE */
165 #define XGBE_MAX_DMA_CHANNELS 16
166 #define XGBE_MAX_QUEUES 16
167 #define XGBE_PRIORITY_QUEUES 8
168 #define XGBE_DMA_STOP_TIMEOUT 1
170 /* DMA cache settings - Outer sharable, write-back, write-allocate */
171 #define XGBE_DMA_OS_ARCR 0x002b2b2b
172 #define XGBE_DMA_OS_AWCR 0x2f2f2f2f
174 /* DMA cache settings - System, no caches used */
175 #define XGBE_DMA_SYS_ARCR 0x00303030
176 #define XGBE_DMA_SYS_AWCR 0x30303030
178 /* DMA cache settings - PCI device */
179 #define XGBE_DMA_PCI_ARCR 0x00000003
180 #define XGBE_DMA_PCI_AWCR 0x13131313
181 #define XGBE_DMA_PCI_AWARCR 0x00000313
183 /* DMA channel interrupt modes */
184 #define XGBE_IRQ_MODE_EDGE 0
185 #define XGBE_IRQ_MODE_LEVEL 1
187 #define XGMAC_MIN_PACKET 60
188 #define XGMAC_STD_PACKET_MTU 1500
189 #define XGMAC_MAX_STD_PACKET 1518
190 #define XGMAC_JUMBO_PACKET_MTU 9000
191 #define XGMAC_MAX_JUMBO_PACKET 9018
192 #define XGMAC_ETH_PREAMBLE (12 + 8) /* Inter-frame gap + preamble */
194 #define XGMAC_PFC_DATA_LEN 46
195 #define XGMAC_PFC_DELAYS 14000
197 #define XGMAC_PRIO_QUEUES(_cnt) \
198 min_t(unsigned int, IEEE_8021QAZ_MAX_TCS, (_cnt))
200 /* Common property names */
201 #define XGBE_MAC_ADDR_PROPERTY "mac-address"
202 #define XGBE_PHY_MODE_PROPERTY "phy-mode"
203 #define XGBE_DMA_IRQS_PROPERTY "amd,per-channel-interrupt"
204 #define XGBE_SPEEDSET_PROPERTY "amd,speed-set"
206 /* Device-tree clock names */
207 #define XGBE_DMA_CLOCK "dma_clk"
208 #define XGBE_PTP_CLOCK "ptp_clk"
210 /* ACPI property names */
211 #define XGBE_ACPI_DMA_FREQ "amd,dma-freq"
212 #define XGBE_ACPI_PTP_FREQ "amd,ptp-freq"
214 /* PCI BAR mapping */
215 #define XGBE_XGMAC_BAR 0
216 #define XGBE_XPCS_BAR 1
217 #define XGBE_MAC_PROP_OFFSET 0x1d000
218 #define XGBE_I2C_CTRL_OFFSET 0x1e000
220 /* PCI MSI/MSIx support */
221 #define XGBE_MSI_BASE_COUNT 4
222 #define XGBE_MSI_MIN_COUNT (XGBE_MSI_BASE_COUNT + 1)
224 /* PCI clock frequencies */
225 #define XGBE_V2_DMA_CLOCK_FREQ 500000000 /* 500 MHz */
226 #define XGBE_V2_PTP_CLOCK_FREQ 125000000 /* 125 MHz */
228 /* Timestamp support - values based on 50MHz PTP clock
231 #define XGBE_TSTAMP_SSINC 20
232 #define XGBE_TSTAMP_SNSINC 0
234 /* Driver PMT macros */
235 #define XGMAC_DRIVER_CONTEXT 1
236 #define XGMAC_IOCTL_CONTEXT 2
238 #define XGMAC_FIFO_MIN_ALLOC 2048
239 #define XGMAC_FIFO_UNIT 256
240 #define XGMAC_FIFO_ALIGN(_x) \
241 (((_x) + XGMAC_FIFO_UNIT - 1) & ~(XGMAC_FIFO_UNIT - 1))
242 #define XGMAC_FIFO_FC_OFF 2048
243 #define XGMAC_FIFO_FC_MIN 4096
245 #define XGBE_TC_MIN_QUANTUM 10
247 /* Helper macro for descriptor handling
248 * Always use XGBE_GET_DESC_DATA to access the descriptor data
249 * since the index is free-running and needs to be and-ed
250 * with the descriptor count value of the ring to index to
251 * the proper descriptor data.
253 #define XGBE_GET_DESC_DATA(_ring, _idx) \
255 ((_idx) & ((_ring)->rdesc_count - 1)))
257 /* Default coalescing parameters */
258 #define XGMAC_INIT_DMA_TX_USECS 1000
259 #define XGMAC_INIT_DMA_TX_FRAMES 25
261 #define XGMAC_MAX_DMA_RIWT 0xff
262 #define XGMAC_INIT_DMA_RX_USECS 30
263 #define XGMAC_INIT_DMA_RX_FRAMES 25
265 /* Flow control queue count */
266 #define XGMAC_MAX_FLOW_CONTROL_QUEUES 8
268 /* Flow control threshold units */
269 #define XGMAC_FLOW_CONTROL_UNIT 512
270 #define XGMAC_FLOW_CONTROL_ALIGN(_x) \
271 (((_x) + XGMAC_FLOW_CONTROL_UNIT - 1) & ~(XGMAC_FLOW_CONTROL_UNIT - 1))
272 #define XGMAC_FLOW_CONTROL_VALUE(_x) \
273 (((_x) < 1024) ? 0 : ((_x) / XGMAC_FLOW_CONTROL_UNIT) - 2)
274 #define XGMAC_FLOW_CONTROL_MAX 33280
276 /* Maximum MAC address hash table size (256 bits = 8 bytes) */
277 #define XGBE_MAC_HASH_TABLE_SIZE 8
279 /* Receive Side Scaling */
280 #define XGBE_RSS_HASH_KEY_SIZE 40
281 #define XGBE_RSS_MAX_TABLE_SIZE 256
282 #define XGBE_RSS_LOOKUP_TABLE_TYPE 0
283 #define XGBE_RSS_HASH_KEY_TYPE 1
285 /* Auto-negotiation */
286 #define XGBE_AN_MS_TIMEOUT 500
287 #define XGBE_LINK_TIMEOUT 5
289 #define XGBE_SGMII_AN_LINK_STATUS BIT(1)
290 #define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3))
291 #define XGBE_SGMII_AN_LINK_SPEED_100 0x04
292 #define XGBE_SGMII_AN_LINK_SPEED_1000 0x08
293 #define XGBE_SGMII_AN_LINK_DUPLEX BIT(4)
295 /* ECC correctable error notification window (seconds) */
296 #define XGBE_ECC_LIMIT 60
298 /* MDIO port types */
299 #define XGMAC_MAX_C22_PORT 3
301 /* Link mode bit operations */
302 #define XGBE_ZERO_SUP(_ls) \
303 ethtool_link_ksettings_zero_link_mode((_ls), supported)
305 #define XGBE_SET_SUP(_ls, _mode) \
306 ethtool_link_ksettings_add_link_mode((_ls), supported, _mode)
308 #define XGBE_CLR_SUP(_ls, _mode) \
309 ethtool_link_ksettings_del_link_mode((_ls), supported, _mode)
311 #define XGBE_IS_SUP(_ls, _mode) \
312 ethtool_link_ksettings_test_link_mode((_ls), supported, _mode)
314 #define XGBE_ZERO_ADV(_ls) \
315 ethtool_link_ksettings_zero_link_mode((_ls), advertising)
317 #define XGBE_SET_ADV(_ls, _mode) \
318 ethtool_link_ksettings_add_link_mode((_ls), advertising, _mode)
320 #define XGBE_CLR_ADV(_ls, _mode) \
321 ethtool_link_ksettings_del_link_mode((_ls), advertising, _mode)
323 #define XGBE_ADV(_ls, _mode) \
324 ethtool_link_ksettings_test_link_mode((_ls), advertising, _mode)
326 #define XGBE_ZERO_LP_ADV(_ls) \
327 ethtool_link_ksettings_zero_link_mode((_ls), lp_advertising)
329 #define XGBE_SET_LP_ADV(_ls, _mode) \
330 ethtool_link_ksettings_add_link_mode((_ls), lp_advertising, _mode)
332 #define XGBE_CLR_LP_ADV(_ls, _mode) \
333 ethtool_link_ksettings_del_link_mode((_ls), lp_advertising, _mode)
335 #define XGBE_LP_ADV(_ls, _mode) \
336 ethtool_link_ksettings_test_link_mode((_ls), lp_advertising, _mode)
338 #define XGBE_LM_COPY(_dst, _dname, _src, _sname) \
339 bitmap_copy((_dst)->link_modes._dname, \
340 (_src)->link_modes._sname, \
341 __ETHTOOL_LINK_MODE_MASK_NBITS)
343 struct xgbe_prv_data
;
345 struct xgbe_packet_data
{
348 unsigned int attributes
;
352 unsigned int rdesc_count
;
355 unsigned int header_len
;
356 unsigned int tcp_header_len
;
357 unsigned int tcp_payload_len
;
360 unsigned short vlan_ctag
;
365 enum pkt_hash_types rss_hash_type
;
367 unsigned int tx_packets
;
368 unsigned int tx_bytes
;
371 /* Common Rx and Tx descriptor mapping */
372 struct xgbe_ring_desc
{
379 /* Page allocation related values */
380 struct xgbe_page_alloc
{
382 unsigned int pages_len
;
383 unsigned int pages_offset
;
385 dma_addr_t pages_dma
;
388 /* Ring entry buffer data */
389 struct xgbe_buffer_data
{
390 struct xgbe_page_alloc pa
;
391 struct xgbe_page_alloc pa_unmap
;
394 unsigned long dma_off
;
395 unsigned int dma_len
;
398 /* Tx-related ring data */
399 struct xgbe_tx_ring_data
{
400 unsigned int packets
; /* BQL packet count */
401 unsigned int bytes
; /* BQL byte count */
404 /* Rx-related ring data */
405 struct xgbe_rx_ring_data
{
406 struct xgbe_buffer_data hdr
; /* Header locations */
407 struct xgbe_buffer_data buf
; /* Payload locations */
409 unsigned short hdr_len
; /* Length of received header */
410 unsigned short len
; /* Length of received packet */
413 /* Structure used to hold information related to the descriptor
414 * and the packet associated with the descriptor (always use
415 * use the XGBE_GET_DESC_DATA macro to access this data from the ring)
417 struct xgbe_ring_data
{
418 struct xgbe_ring_desc
*rdesc
; /* Virtual address of descriptor */
419 dma_addr_t rdesc_dma
; /* DMA address of descriptor */
421 struct sk_buff
*skb
; /* Virtual address of SKB */
422 dma_addr_t skb_dma
; /* DMA address of SKB data */
423 unsigned int skb_dma_len
; /* Length of SKB DMA area */
425 struct xgbe_tx_ring_data tx
; /* Tx-related data */
426 struct xgbe_rx_ring_data rx
; /* Rx-related data */
428 unsigned int mapped_as_page
;
430 /* Incomplete receive save location. If the budget is exhausted
431 * or the last descriptor (last normal descriptor or a following
432 * context descriptor) has not been DMA'd yet the current state
433 * of the receive processing needs to be saved.
435 unsigned int state_saved
;
444 /* Ring lock - used just for TX rings at the moment */
447 /* Per packet related information */
448 struct xgbe_packet_data packet_data
;
450 /* Virtual/DMA addresses and count of allocated descriptor memory */
451 struct xgbe_ring_desc
*rdesc
;
452 dma_addr_t rdesc_dma
;
453 unsigned int rdesc_count
;
455 /* Array of descriptor data corresponding the descriptor memory
456 * (always use the XGBE_GET_DESC_DATA macro to access this data)
458 struct xgbe_ring_data
*rdata
;
460 /* Page allocation for RX buffers */
461 struct xgbe_page_alloc rx_hdr_pa
;
462 struct xgbe_page_alloc rx_buf_pa
;
466 * cur - Tx: index of descriptor to be used for current transfer
467 * Rx: index of descriptor to check for packet availability
468 * dirty - Tx: index of descriptor to check for transfer complete
469 * Rx: index of descriptor to check for buffer reallocation
474 /* Coalesce frame count used for interrupt bit setting */
475 unsigned int coalesce_count
;
479 unsigned int queue_stopped
;
480 unsigned int xmit_more
;
481 unsigned short cur_mss
;
482 unsigned short cur_vlan_ctag
;
485 } ____cacheline_aligned
;
487 /* Structure used to describe the descriptor rings associated with
490 struct xgbe_channel
{
493 /* Address of private data area for device */
494 struct xgbe_prv_data
*pdata
;
496 /* Queue index and base address of queue's DMA registers */
497 unsigned int queue_index
;
498 void __iomem
*dma_regs
;
500 /* Per channel interrupt irq number */
502 char dma_irq_name
[IFNAMSIZ
+ 32];
504 /* Netdev related settings */
505 struct napi_struct napi
;
507 /* Per channel interrupt enablement tracker */
508 unsigned int curr_ier
;
509 unsigned int saved_ier
;
511 unsigned int tx_timer_active
;
512 struct timer_list tx_timer
;
514 struct xgbe_ring
*tx_ring
;
515 struct xgbe_ring
*rx_ring
;
518 cpumask_t affinity_mask
;
519 } ____cacheline_aligned
;
529 XGMAC_INT_DMA_CH_SR_TI
,
530 XGMAC_INT_DMA_CH_SR_TPS
,
531 XGMAC_INT_DMA_CH_SR_TBU
,
532 XGMAC_INT_DMA_CH_SR_RI
,
533 XGMAC_INT_DMA_CH_SR_RBU
,
534 XGMAC_INT_DMA_CH_SR_RPS
,
535 XGMAC_INT_DMA_CH_SR_TI_RI
,
536 XGMAC_INT_DMA_CH_SR_FBE
,
540 enum xgbe_int_state
{
541 XGMAC_INT_STATE_SAVE
,
542 XGMAC_INT_STATE_RESTORE
,
558 enum xgbe_xpcs_access
{
559 XGBE_XPCS_ACCESS_V1
= 0,
564 XGBE_AN_MODE_CL73
= 0,
565 XGBE_AN_MODE_CL73_REDRV
,
567 XGBE_AN_MODE_CL37_SGMII
,
573 XGBE_AN_PAGE_RECEIVED
,
574 XGBE_AN_INCOMPAT_LINK
,
588 XGBE_MODE_KX_1000
= 0,
593 XGBE_MODE_SGMII_1000
,
599 XGBE_SPEEDSET_1000_10000
= 0,
600 XGBE_SPEEDSET_2500_10000
,
603 enum xgbe_mdio_mode
{
604 XGBE_MDIO_MODE_NONE
= 0,
610 struct ethtool_link_ksettings lks
;
626 XGBE_I2C_CMD_READ
= 0,
631 enum xgbe_i2c_cmd cmd
;
639 struct xgbe_i2c_op_state
{
640 struct xgbe_i2c_op
*op
;
643 unsigned char *tx_buf
;
646 unsigned char *rx_buf
;
648 unsigned int tx_abort_source
;
654 unsigned int started
;
655 unsigned int max_speed_mode
;
656 unsigned int rx_fifo_size
;
657 unsigned int tx_fifo_size
;
659 struct xgbe_i2c_op_state op_state
;
662 struct xgbe_mmc_stats
{
666 u64 txbroadcastframes_g
;
667 u64 txmulticastframes_g
;
669 u64 tx65to127octets_gb
;
670 u64 tx128to255octets_gb
;
671 u64 tx256to511octets_gb
;
672 u64 tx512to1023octets_gb
;
673 u64 tx1024tomaxoctets_gb
;
674 u64 txunicastframes_gb
;
675 u64 txmulticastframes_gb
;
676 u64 txbroadcastframes_gb
;
677 u64 txunderflowerror
;
687 u64 rxbroadcastframes_g
;
688 u64 rxmulticastframes_g
;
695 u64 rx65to127octets_gb
;
696 u64 rx128to255octets_gb
;
697 u64 rx256to511octets_gb
;
698 u64 rx512to1023octets_gb
;
699 u64 rx1024tomaxoctets_gb
;
700 u64 rxunicastframes_g
;
702 u64 rxoutofrangetype
;
709 struct xgbe_ext_stats
{
711 u64 rx_split_header_packets
;
712 u64 rx_buffer_unavailable
;
714 u64 txq_packets
[XGBE_MAX_DMA_CHANNELS
];
715 u64 txq_bytes
[XGBE_MAX_DMA_CHANNELS
];
716 u64 rxq_packets
[XGBE_MAX_DMA_CHANNELS
];
717 u64 rxq_bytes
[XGBE_MAX_DMA_CHANNELS
];
719 u64 tx_vxlan_packets
;
720 u64 rx_vxlan_packets
;
722 u64 rx_vxlan_csum_errors
;
726 int (*tx_complete
)(struct xgbe_ring_desc
*);
728 int (*set_mac_address
)(struct xgbe_prv_data
*, u8
*addr
);
729 int (*config_rx_mode
)(struct xgbe_prv_data
*);
731 int (*enable_rx_csum
)(struct xgbe_prv_data
*);
732 int (*disable_rx_csum
)(struct xgbe_prv_data
*);
734 int (*enable_rx_vlan_stripping
)(struct xgbe_prv_data
*);
735 int (*disable_rx_vlan_stripping
)(struct xgbe_prv_data
*);
736 int (*enable_rx_vlan_filtering
)(struct xgbe_prv_data
*);
737 int (*disable_rx_vlan_filtering
)(struct xgbe_prv_data
*);
738 int (*update_vlan_hash_table
)(struct xgbe_prv_data
*);
740 int (*read_mmd_regs
)(struct xgbe_prv_data
*, int, int);
741 void (*write_mmd_regs
)(struct xgbe_prv_data
*, int, int, int);
742 int (*set_speed
)(struct xgbe_prv_data
*, int);
744 int (*set_ext_mii_mode
)(struct xgbe_prv_data
*, unsigned int,
745 enum xgbe_mdio_mode
);
746 int (*read_ext_mii_regs
)(struct xgbe_prv_data
*, int, int);
747 int (*write_ext_mii_regs
)(struct xgbe_prv_data
*, int, int, u16
);
749 int (*set_gpio
)(struct xgbe_prv_data
*, unsigned int);
750 int (*clr_gpio
)(struct xgbe_prv_data
*, unsigned int);
752 void (*enable_tx
)(struct xgbe_prv_data
*);
753 void (*disable_tx
)(struct xgbe_prv_data
*);
754 void (*enable_rx
)(struct xgbe_prv_data
*);
755 void (*disable_rx
)(struct xgbe_prv_data
*);
757 void (*powerup_tx
)(struct xgbe_prv_data
*);
758 void (*powerdown_tx
)(struct xgbe_prv_data
*);
759 void (*powerup_rx
)(struct xgbe_prv_data
*);
760 void (*powerdown_rx
)(struct xgbe_prv_data
*);
762 int (*init
)(struct xgbe_prv_data
*);
763 int (*exit
)(struct xgbe_prv_data
*);
765 int (*enable_int
)(struct xgbe_channel
*, enum xgbe_int
);
766 int (*disable_int
)(struct xgbe_channel
*, enum xgbe_int
);
767 void (*dev_xmit
)(struct xgbe_channel
*);
768 int (*dev_read
)(struct xgbe_channel
*);
769 void (*tx_desc_init
)(struct xgbe_channel
*);
770 void (*rx_desc_init
)(struct xgbe_channel
*);
771 void (*tx_desc_reset
)(struct xgbe_ring_data
*);
772 void (*rx_desc_reset
)(struct xgbe_prv_data
*, struct xgbe_ring_data
*,
774 int (*is_last_desc
)(struct xgbe_ring_desc
*);
775 int (*is_context_desc
)(struct xgbe_ring_desc
*);
776 void (*tx_start_xmit
)(struct xgbe_channel
*, struct xgbe_ring
*);
779 int (*config_tx_flow_control
)(struct xgbe_prv_data
*);
780 int (*config_rx_flow_control
)(struct xgbe_prv_data
*);
782 /* For RX coalescing */
783 int (*config_rx_coalesce
)(struct xgbe_prv_data
*);
784 int (*config_tx_coalesce
)(struct xgbe_prv_data
*);
785 unsigned int (*usec_to_riwt
)(struct xgbe_prv_data
*, unsigned int);
786 unsigned int (*riwt_to_usec
)(struct xgbe_prv_data
*, unsigned int);
788 /* For RX and TX threshold config */
789 int (*config_rx_threshold
)(struct xgbe_prv_data
*, unsigned int);
790 int (*config_tx_threshold
)(struct xgbe_prv_data
*, unsigned int);
792 /* For RX and TX Store and Forward Mode config */
793 int (*config_rsf_mode
)(struct xgbe_prv_data
*, unsigned int);
794 int (*config_tsf_mode
)(struct xgbe_prv_data
*, unsigned int);
796 /* For TX DMA Operate on Second Frame config */
797 int (*config_osp_mode
)(struct xgbe_prv_data
*);
799 /* For MMC statistics */
800 void (*rx_mmc_int
)(struct xgbe_prv_data
*);
801 void (*tx_mmc_int
)(struct xgbe_prv_data
*);
802 void (*read_mmc_stats
)(struct xgbe_prv_data
*);
804 /* For Timestamp config */
805 int (*config_tstamp
)(struct xgbe_prv_data
*, unsigned int);
806 void (*update_tstamp_addend
)(struct xgbe_prv_data
*, unsigned int);
807 void (*set_tstamp_time
)(struct xgbe_prv_data
*, unsigned int sec
,
809 u64 (*get_tstamp_time
)(struct xgbe_prv_data
*);
810 u64 (*get_tx_tstamp
)(struct xgbe_prv_data
*);
812 /* For Data Center Bridging config */
813 void (*config_tc
)(struct xgbe_prv_data
*);
814 void (*config_dcb_tc
)(struct xgbe_prv_data
*);
815 void (*config_dcb_pfc
)(struct xgbe_prv_data
*);
817 /* For Receive Side Scaling */
818 int (*enable_rss
)(struct xgbe_prv_data
*);
819 int (*disable_rss
)(struct xgbe_prv_data
*);
820 int (*set_rss_hash_key
)(struct xgbe_prv_data
*, const u8
*);
821 int (*set_rss_lookup_table
)(struct xgbe_prv_data
*, const u32
*);
824 void (*disable_ecc_ded
)(struct xgbe_prv_data
*);
825 void (*disable_ecc_sec
)(struct xgbe_prv_data
*, enum xgbe_ecc_sec
);
828 void (*enable_vxlan
)(struct xgbe_prv_data
*);
829 void (*disable_vxlan
)(struct xgbe_prv_data
*);
830 void (*set_vxlan_id
)(struct xgbe_prv_data
*);
833 /* This structure represents implementation specific routines for an
834 * implementation of a PHY. All routines are required unless noted below.
836 * kr_training_pre, kr_training_post
838 struct xgbe_phy_impl_if
{
839 /* Perform Setup/teardown actions */
840 int (*init
)(struct xgbe_prv_data
*);
841 void (*exit
)(struct xgbe_prv_data
*);
843 /* Perform start/stop specific actions */
844 int (*reset
)(struct xgbe_prv_data
*);
845 int (*start
)(struct xgbe_prv_data
*);
846 void (*stop
)(struct xgbe_prv_data
*);
848 /* Return the link status */
849 int (*link_status
)(struct xgbe_prv_data
*, int *);
851 /* Indicate if a particular speed is valid */
852 bool (*valid_speed
)(struct xgbe_prv_data
*, int);
854 /* Check if the specified mode can/should be used */
855 bool (*use_mode
)(struct xgbe_prv_data
*, enum xgbe_mode
);
856 /* Switch the PHY into various modes */
857 void (*set_mode
)(struct xgbe_prv_data
*, enum xgbe_mode
);
858 /* Retrieve mode needed for a specific speed */
859 enum xgbe_mode (*get_mode
)(struct xgbe_prv_data
*, int);
860 /* Retrieve new/next mode when trying to auto-negotiate */
861 enum xgbe_mode (*switch_mode
)(struct xgbe_prv_data
*);
862 /* Retrieve current mode */
863 enum xgbe_mode (*cur_mode
)(struct xgbe_prv_data
*);
865 /* Retrieve current auto-negotiation mode */
866 enum xgbe_an_mode (*an_mode
)(struct xgbe_prv_data
*);
868 /* Configure auto-negotiation settings */
869 int (*an_config
)(struct xgbe_prv_data
*);
871 /* Set/override auto-negotiation advertisement settings */
872 void (*an_advertising
)(struct xgbe_prv_data
*,
873 struct ethtool_link_ksettings
*);
875 /* Process results of auto-negotiation */
876 enum xgbe_mode (*an_outcome
)(struct xgbe_prv_data
*);
878 /* Pre/Post KR training enablement support */
879 void (*kr_training_pre
)(struct xgbe_prv_data
*);
880 void (*kr_training_post
)(struct xgbe_prv_data
*);
884 /* For PHY setup/teardown */
885 int (*phy_init
)(struct xgbe_prv_data
*);
886 void (*phy_exit
)(struct xgbe_prv_data
*);
888 /* For PHY support when setting device up/down */
889 int (*phy_reset
)(struct xgbe_prv_data
*);
890 int (*phy_start
)(struct xgbe_prv_data
*);
891 void (*phy_stop
)(struct xgbe_prv_data
*);
893 /* For PHY support while device is up */
894 void (*phy_status
)(struct xgbe_prv_data
*);
895 int (*phy_config_aneg
)(struct xgbe_prv_data
*);
897 /* For PHY settings validation */
898 bool (*phy_valid_speed
)(struct xgbe_prv_data
*, int);
900 /* For single interrupt support */
901 irqreturn_t (*an_isr
)(struct xgbe_prv_data
*);
903 /* PHY implementation specific services */
904 struct xgbe_phy_impl_if phy_impl
;
908 /* For initial I2C setup */
909 int (*i2c_init
)(struct xgbe_prv_data
*);
911 /* For I2C support when setting device up/down */
912 int (*i2c_start
)(struct xgbe_prv_data
*);
913 void (*i2c_stop
)(struct xgbe_prv_data
*);
915 /* For performing I2C operations */
916 int (*i2c_xfer
)(struct xgbe_prv_data
*, struct xgbe_i2c_op
*);
918 /* For single interrupt support */
919 irqreturn_t (*i2c_isr
)(struct xgbe_prv_data
*);
922 struct xgbe_desc_if
{
923 int (*alloc_ring_resources
)(struct xgbe_prv_data
*);
924 void (*free_ring_resources
)(struct xgbe_prv_data
*);
925 int (*map_tx_skb
)(struct xgbe_channel
*, struct sk_buff
*);
926 int (*map_rx_buffer
)(struct xgbe_prv_data
*, struct xgbe_ring
*,
927 struct xgbe_ring_data
*);
928 void (*unmap_rdata
)(struct xgbe_prv_data
*, struct xgbe_ring_data
*);
929 void (*wrapper_tx_desc_init
)(struct xgbe_prv_data
*);
930 void (*wrapper_rx_desc_init
)(struct xgbe_prv_data
*);
933 /* This structure contains flags that indicate what hardware features
934 * or configurations are present in the device.
936 struct xgbe_hw_features
{
938 unsigned int version
;
940 /* HW Feature Register0 */
941 unsigned int gmii
; /* 1000 Mbps support */
942 unsigned int vlhash
; /* VLAN Hash Filter */
943 unsigned int sma
; /* SMA(MDIO) Interface */
944 unsigned int rwk
; /* PMT remote wake-up packet */
945 unsigned int mgk
; /* PMT magic packet */
946 unsigned int mmc
; /* RMON module */
947 unsigned int aoe
; /* ARP Offload */
948 unsigned int ts
; /* IEEE 1588-2008 Advanced Timestamp */
949 unsigned int eee
; /* Energy Efficient Ethernet */
950 unsigned int tx_coe
; /* Tx Checksum Offload */
951 unsigned int rx_coe
; /* Rx Checksum Offload */
952 unsigned int addn_mac
; /* Additional MAC Addresses */
953 unsigned int ts_src
; /* Timestamp Source */
954 unsigned int sa_vlan_ins
; /* Source Address or VLAN Insertion */
955 unsigned int vxn
; /* VXLAN/NVGRE */
957 /* HW Feature Register1 */
958 unsigned int rx_fifo_size
; /* MTL Receive FIFO Size */
959 unsigned int tx_fifo_size
; /* MTL Transmit FIFO Size */
960 unsigned int adv_ts_hi
; /* Advance Timestamping High Word */
961 unsigned int dma_width
; /* DMA width */
962 unsigned int dcb
; /* DCB Feature */
963 unsigned int sph
; /* Split Header Feature */
964 unsigned int tso
; /* TCP Segmentation Offload */
965 unsigned int dma_debug
; /* DMA Debug Registers */
966 unsigned int rss
; /* Receive Side Scaling */
967 unsigned int tc_cnt
; /* Number of Traffic Classes */
968 unsigned int hash_table_size
; /* Hash Table Size */
969 unsigned int l3l4_filter_num
; /* Number of L3-L4 Filters */
971 /* HW Feature Register2 */
972 unsigned int rx_q_cnt
; /* Number of MTL Receive Queues */
973 unsigned int tx_q_cnt
; /* Number of MTL Transmit Queues */
974 unsigned int rx_ch_cnt
; /* Number of DMA Receive Channels */
975 unsigned int tx_ch_cnt
; /* Number of DMA Transmit Channels */
976 unsigned int pps_out_num
; /* Number of PPS outputs */
977 unsigned int aux_snap_num
; /* Number of Aux snapshot inputs */
980 struct xgbe_version_data
{
981 void (*init_function_ptrs_phy_impl
)(struct xgbe_phy_if
*);
982 enum xgbe_xpcs_access xpcs_access
;
983 unsigned int mmc_64bit
;
984 unsigned int tx_max_fifo_size
;
985 unsigned int rx_max_fifo_size
;
986 unsigned int tx_tstamp_workaround
;
987 unsigned int ecc_support
;
988 unsigned int i2c_support
;
989 unsigned int irq_reissue_support
;
990 unsigned int tx_desc_prefetch
;
991 unsigned int rx_desc_prefetch
;
994 struct xgbe_vxlan_data
{
995 struct list_head list
;
996 sa_family_t sa_family
;
1000 struct xgbe_prv_data
{
1001 struct net_device
*netdev
;
1002 struct pci_dev
*pcidev
;
1003 struct platform_device
*platdev
;
1004 struct acpi_device
*adev
;
1006 struct platform_device
*phy_platdev
;
1007 struct device
*phy_dev
;
1009 /* Version related data */
1010 struct xgbe_version_data
*vdata
;
1012 /* ACPI or DT flag */
1013 unsigned int use_acpi
;
1015 /* XGMAC/XPCS related mmio registers */
1016 void __iomem
*xgmac_regs
; /* XGMAC CSRs */
1017 void __iomem
*xpcs_regs
; /* XPCS MMD registers */
1018 void __iomem
*rxtx_regs
; /* SerDes Rx/Tx CSRs */
1019 void __iomem
*sir0_regs
; /* SerDes integration registers (1/2) */
1020 void __iomem
*sir1_regs
; /* SerDes integration registers (2/2) */
1021 void __iomem
*xprop_regs
; /* XGBE property registers */
1022 void __iomem
*xi2c_regs
; /* XGBE I2C CSRs */
1024 /* Overall device lock */
1027 /* XPCS indirect addressing lock */
1028 spinlock_t xpcs_lock
;
1029 unsigned int xpcs_window_def_reg
;
1030 unsigned int xpcs_window_sel_reg
;
1031 unsigned int xpcs_window
;
1032 unsigned int xpcs_window_size
;
1033 unsigned int xpcs_window_mask
;
1035 /* RSS addressing mutex */
1036 struct mutex rss_mutex
;
1038 /* Flags representing xgbe_state */
1039 unsigned long dev_state
;
1042 unsigned long tx_sec_period
;
1043 unsigned long tx_ded_period
;
1044 unsigned long rx_sec_period
;
1045 unsigned long rx_ded_period
;
1046 unsigned long desc_sec_period
;
1047 unsigned long desc_ded_period
;
1049 unsigned int tx_sec_count
;
1050 unsigned int tx_ded_count
;
1051 unsigned int rx_sec_count
;
1052 unsigned int rx_ded_count
;
1053 unsigned int desc_ded_count
;
1054 unsigned int desc_sec_count
;
1059 int channel_irq
[XGBE_MAX_DMA_CHANNELS
];
1061 unsigned int per_channel_irq
;
1062 unsigned int irq_count
;
1063 unsigned int channel_irq_count
;
1064 unsigned int channel_irq_mode
;
1066 char ecc_name
[IFNAMSIZ
+ 32];
1068 struct xgbe_hw_if hw_if
;
1069 struct xgbe_phy_if phy_if
;
1070 struct xgbe_desc_if desc_if
;
1071 struct xgbe_i2c_if i2c_if
;
1073 /* AXI DMA settings */
1074 unsigned int coherent
;
1077 unsigned int awarcr
;
1079 /* Service routine support */
1080 struct workqueue_struct
*dev_workqueue
;
1081 struct work_struct service_work
;
1082 struct timer_list service_timer
;
1084 /* Rings for Tx/Rx on a DMA channel */
1085 struct xgbe_channel
*channel
[XGBE_MAX_DMA_CHANNELS
];
1086 unsigned int tx_max_channel_count
;
1087 unsigned int rx_max_channel_count
;
1088 unsigned int channel_count
;
1089 unsigned int tx_ring_count
;
1090 unsigned int tx_desc_count
;
1091 unsigned int rx_ring_count
;
1092 unsigned int rx_desc_count
;
1094 unsigned int tx_max_q_count
;
1095 unsigned int rx_max_q_count
;
1096 unsigned int tx_q_count
;
1097 unsigned int rx_q_count
;
1099 /* Tx/Rx common settings */
1103 unsigned int rd_osr_limit
;
1104 unsigned int wr_osr_limit
;
1107 unsigned int tx_sf_mode
;
1108 unsigned int tx_threshold
;
1109 unsigned int tx_osp_mode
;
1110 unsigned int tx_max_fifo_size
;
1113 unsigned int rx_sf_mode
;
1114 unsigned int rx_threshold
;
1115 unsigned int rx_max_fifo_size
;
1117 /* Tx coalescing settings */
1118 unsigned int tx_usecs
;
1119 unsigned int tx_frames
;
1121 /* Rx coalescing settings */
1122 unsigned int rx_riwt
;
1123 unsigned int rx_usecs
;
1124 unsigned int rx_frames
;
1126 /* Current Rx buffer size */
1127 unsigned int rx_buf_size
;
1129 /* Flow control settings */
1130 unsigned int pause_autoneg
;
1131 unsigned int tx_pause
;
1132 unsigned int rx_pause
;
1133 unsigned int rx_rfa
[XGBE_MAX_QUEUES
];
1134 unsigned int rx_rfd
[XGBE_MAX_QUEUES
];
1136 /* Receive Side Scaling settings */
1137 u8 rss_key
[XGBE_RSS_HASH_KEY_SIZE
];
1138 u32 rss_table
[XGBE_RSS_MAX_TABLE_SIZE
];
1141 /* VXLAN settings */
1142 unsigned int vxlan_port_set
;
1143 unsigned int vxlan_offloads_set
;
1144 unsigned int vxlan_force_disable
;
1145 unsigned int vxlan_port_count
;
1146 struct list_head vxlan_ports
;
1148 netdev_features_t vxlan_features
;
1150 /* Netdev related settings */
1151 unsigned char mac_addr
[ETH_ALEN
];
1152 netdev_features_t netdev_features
;
1153 struct napi_struct napi
;
1154 struct xgbe_mmc_stats mmc_stats
;
1155 struct xgbe_ext_stats ext_stats
;
1157 /* Filtering support */
1158 unsigned long active_vlans
[BITS_TO_LONGS(VLAN_N_VID
)];
1162 unsigned long sysclk_rate
;
1164 unsigned long ptpclk_rate
;
1166 /* Timestamp support */
1167 spinlock_t tstamp_lock
;
1168 struct ptp_clock_info ptp_clock_info
;
1169 struct ptp_clock
*ptp_clock
;
1170 struct hwtstamp_config tstamp_config
;
1171 struct cyclecounter tstamp_cc
;
1172 struct timecounter tstamp_tc
;
1173 unsigned int tstamp_addend
;
1174 struct work_struct tx_tstamp_work
;
1175 struct sk_buff
*tx_tstamp_skb
;
1179 struct ieee_ets
*ets
;
1180 struct ieee_pfc
*pfc
;
1181 unsigned int q2tc_map
[XGBE_MAX_QUEUES
];
1182 unsigned int prio2q_map
[IEEE_8021QAZ_MAX_TCS
];
1183 unsigned int pfcq
[XGBE_MAX_QUEUES
];
1184 unsigned int pfc_rfa
;
1187 /* Hardware features of the device */
1188 struct xgbe_hw_features hw_feat
;
1190 /* Device work structures */
1191 struct work_struct restart_work
;
1192 struct work_struct stopdev_work
;
1194 /* Keeps track of power mode */
1195 unsigned int power_down
;
1197 /* Network interface message level setting */
1200 /* Current PHY settings */
1201 phy_interface_t phy_mode
;
1205 /* MDIO/PHY related settings */
1206 unsigned int phy_started
;
1208 struct xgbe_phy phy
;
1210 unsigned long link_check
;
1211 struct completion mdio_complete
;
1213 unsigned int kr_redrv
;
1215 char an_name
[IFNAMSIZ
+ 32];
1216 struct workqueue_struct
*an_workqueue
;
1219 struct work_struct an_irq_work
;
1221 /* Auto-negotiation state machine support */
1222 unsigned int an_int
;
1223 unsigned int an_status
;
1224 struct mutex an_mutex
;
1225 enum xgbe_an an_result
;
1226 enum xgbe_an an_state
;
1227 enum xgbe_rx kr_state
;
1228 enum xgbe_rx kx_state
;
1229 struct work_struct an_work
;
1230 unsigned int an_supported
;
1231 unsigned int parallel_detect
;
1232 unsigned int fec_ability
;
1233 unsigned long an_start
;
1234 enum xgbe_an_mode an_mode
;
1237 struct xgbe_i2c i2c
;
1238 struct mutex i2c_mutex
;
1239 struct completion i2c_complete
;
1240 char i2c_name
[IFNAMSIZ
+ 32];
1242 unsigned int lpm_ctrl
; /* CTRL1 for resume */
1244 unsigned int isr_as_tasklet
;
1245 struct tasklet_struct tasklet_dev
;
1246 struct tasklet_struct tasklet_ecc
;
1247 struct tasklet_struct tasklet_i2c
;
1248 struct tasklet_struct tasklet_an
;
1250 struct dentry
*xgbe_debugfs
;
1252 unsigned int debugfs_xgmac_reg
;
1254 unsigned int debugfs_xpcs_mmd
;
1255 unsigned int debugfs_xpcs_reg
;
1257 unsigned int debugfs_xprop_reg
;
1259 unsigned int debugfs_xi2c_reg
;
1262 /* Function prototypes*/
1263 struct xgbe_prv_data
*xgbe_alloc_pdata(struct device
*);
1264 void xgbe_free_pdata(struct xgbe_prv_data
*);
1265 void xgbe_set_counts(struct xgbe_prv_data
*);
1266 int xgbe_config_netdev(struct xgbe_prv_data
*);
1267 void xgbe_deconfig_netdev(struct xgbe_prv_data
*);
1269 int xgbe_platform_init(void);
1270 void xgbe_platform_exit(void);
1272 int xgbe_pci_init(void);
1273 void xgbe_pci_exit(void);
1275 static inline int xgbe_pci_init(void) { return 0; }
1276 static inline void xgbe_pci_exit(void) { }
1279 void xgbe_init_function_ptrs_dev(struct xgbe_hw_if
*);
1280 void xgbe_init_function_ptrs_phy(struct xgbe_phy_if
*);
1281 void xgbe_init_function_ptrs_phy_v1(struct xgbe_phy_if
*);
1282 void xgbe_init_function_ptrs_phy_v2(struct xgbe_phy_if
*);
1283 void xgbe_init_function_ptrs_desc(struct xgbe_desc_if
*);
1284 void xgbe_init_function_ptrs_i2c(struct xgbe_i2c_if
*);
1285 const struct net_device_ops
*xgbe_get_netdev_ops(void);
1286 const struct ethtool_ops
*xgbe_get_ethtool_ops(void);
1288 #ifdef CONFIG_AMD_XGBE_DCB
1289 const struct dcbnl_rtnl_ops
*xgbe_get_dcbnl_ops(void);
1292 void xgbe_ptp_register(struct xgbe_prv_data
*);
1293 void xgbe_ptp_unregister(struct xgbe_prv_data
*);
1294 void xgbe_dump_tx_desc(struct xgbe_prv_data
*, struct xgbe_ring
*,
1295 unsigned int, unsigned int, unsigned int);
1296 void xgbe_dump_rx_desc(struct xgbe_prv_data
*, struct xgbe_ring
*,
1298 void xgbe_print_pkt(struct net_device
*, struct sk_buff
*, bool);
1299 void xgbe_get_all_hw_features(struct xgbe_prv_data
*);
1300 int xgbe_powerup(struct net_device
*, unsigned int);
1301 int xgbe_powerdown(struct net_device
*, unsigned int);
1302 void xgbe_init_rx_coalesce(struct xgbe_prv_data
*);
1303 void xgbe_init_tx_coalesce(struct xgbe_prv_data
*);
1305 #ifdef CONFIG_DEBUG_FS
1306 void xgbe_debugfs_init(struct xgbe_prv_data
*);
1307 void xgbe_debugfs_exit(struct xgbe_prv_data
*);
1308 void xgbe_debugfs_rename(struct xgbe_prv_data
*pdata
);
1310 static inline void xgbe_debugfs_init(struct xgbe_prv_data
*pdata
) {}
1311 static inline void xgbe_debugfs_exit(struct xgbe_prv_data
*pdata
) {}
1312 static inline void xgbe_debugfs_rename(struct xgbe_prv_data
*pdata
) {}
1313 #endif /* CONFIG_DEBUG_FS */
1315 /* NOTE: Uncomment for function trace log messages in KERNEL LOG */
1321 /* For debug prints */
1323 #define DBGPR(x...) pr_alert(x)
1325 #define DBGPR(x...) do { } while (0)
1329 #define DBGPR_MDIO(x...) pr_alert(x)
1331 #define DBGPR_MDIO(x...) do { } while (0)