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.
117 #include <linux/spinlock.h>
118 #include <linux/phy.h>
119 #include <linux/net_tstamp.h>
122 #include "xgbe-common.h"
125 char stat_string
[ETH_GSTRING_LEN
];
130 #define XGMAC_MMC_STAT(_string, _var) \
132 FIELD_SIZEOF(struct xgbe_mmc_stats, _var), \
133 offsetof(struct xgbe_prv_data, mmc_stats._var), \
136 #define XGMAC_EXT_STAT(_string, _var) \
138 FIELD_SIZEOF(struct xgbe_ext_stats, _var), \
139 offsetof(struct xgbe_prv_data, ext_stats._var), \
142 static const struct xgbe_stats xgbe_gstring_stats
[] = {
143 XGMAC_MMC_STAT("tx_bytes", txoctetcount_gb
),
144 XGMAC_MMC_STAT("tx_packets", txframecount_gb
),
145 XGMAC_MMC_STAT("tx_unicast_packets", txunicastframes_gb
),
146 XGMAC_MMC_STAT("tx_broadcast_packets", txbroadcastframes_gb
),
147 XGMAC_MMC_STAT("tx_multicast_packets", txmulticastframes_gb
),
148 XGMAC_MMC_STAT("tx_vlan_packets", txvlanframes_g
),
149 XGMAC_EXT_STAT("tx_tso_packets", tx_tso_packets
),
150 XGMAC_MMC_STAT("tx_64_byte_packets", tx64octets_gb
),
151 XGMAC_MMC_STAT("tx_65_to_127_byte_packets", tx65to127octets_gb
),
152 XGMAC_MMC_STAT("tx_128_to_255_byte_packets", tx128to255octets_gb
),
153 XGMAC_MMC_STAT("tx_256_to_511_byte_packets", tx256to511octets_gb
),
154 XGMAC_MMC_STAT("tx_512_to_1023_byte_packets", tx512to1023octets_gb
),
155 XGMAC_MMC_STAT("tx_1024_to_max_byte_packets", tx1024tomaxoctets_gb
),
156 XGMAC_MMC_STAT("tx_underflow_errors", txunderflowerror
),
157 XGMAC_MMC_STAT("tx_pause_frames", txpauseframes
),
159 XGMAC_MMC_STAT("rx_bytes", rxoctetcount_gb
),
160 XGMAC_MMC_STAT("rx_packets", rxframecount_gb
),
161 XGMAC_MMC_STAT("rx_unicast_packets", rxunicastframes_g
),
162 XGMAC_MMC_STAT("rx_broadcast_packets", rxbroadcastframes_g
),
163 XGMAC_MMC_STAT("rx_multicast_packets", rxmulticastframes_g
),
164 XGMAC_MMC_STAT("rx_vlan_packets", rxvlanframes_gb
),
165 XGMAC_MMC_STAT("rx_64_byte_packets", rx64octets_gb
),
166 XGMAC_MMC_STAT("rx_65_to_127_byte_packets", rx65to127octets_gb
),
167 XGMAC_MMC_STAT("rx_128_to_255_byte_packets", rx128to255octets_gb
),
168 XGMAC_MMC_STAT("rx_256_to_511_byte_packets", rx256to511octets_gb
),
169 XGMAC_MMC_STAT("rx_512_to_1023_byte_packets", rx512to1023octets_gb
),
170 XGMAC_MMC_STAT("rx_1024_to_max_byte_packets", rx1024tomaxoctets_gb
),
171 XGMAC_MMC_STAT("rx_undersize_packets", rxundersize_g
),
172 XGMAC_MMC_STAT("rx_oversize_packets", rxoversize_g
),
173 XGMAC_MMC_STAT("rx_crc_errors", rxcrcerror
),
174 XGMAC_MMC_STAT("rx_crc_errors_small_packets", rxrunterror
),
175 XGMAC_MMC_STAT("rx_crc_errors_giant_packets", rxjabbererror
),
176 XGMAC_MMC_STAT("rx_length_errors", rxlengtherror
),
177 XGMAC_MMC_STAT("rx_out_of_range_errors", rxoutofrangetype
),
178 XGMAC_MMC_STAT("rx_fifo_overflow_errors", rxfifooverflow
),
179 XGMAC_MMC_STAT("rx_watchdog_errors", rxwatchdogerror
),
180 XGMAC_MMC_STAT("rx_pause_frames", rxpauseframes
),
181 XGMAC_EXT_STAT("rx_split_header_packets", rx_split_header_packets
),
182 XGMAC_EXT_STAT("rx_buffer_unavailable", rx_buffer_unavailable
),
185 #define XGBE_STATS_COUNT ARRAY_SIZE(xgbe_gstring_stats)
187 static void xgbe_get_strings(struct net_device
*netdev
, u32 stringset
, u8
*data
)
193 for (i
= 0; i
< XGBE_STATS_COUNT
; i
++) {
194 memcpy(data
, xgbe_gstring_stats
[i
].stat_string
,
196 data
+= ETH_GSTRING_LEN
;
202 static void xgbe_get_ethtool_stats(struct net_device
*netdev
,
203 struct ethtool_stats
*stats
, u64
*data
)
205 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
209 pdata
->hw_if
.read_mmc_stats(pdata
);
210 for (i
= 0; i
< XGBE_STATS_COUNT
; i
++) {
211 stat
= (u8
*)pdata
+ xgbe_gstring_stats
[i
].stat_offset
;
212 *data
++ = *(u64
*)stat
;
216 static int xgbe_get_sset_count(struct net_device
*netdev
, int stringset
)
222 ret
= XGBE_STATS_COUNT
;
232 static void xgbe_get_pauseparam(struct net_device
*netdev
,
233 struct ethtool_pauseparam
*pause
)
235 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
237 pause
->autoneg
= pdata
->phy
.pause_autoneg
;
238 pause
->tx_pause
= pdata
->phy
.tx_pause
;
239 pause
->rx_pause
= pdata
->phy
.rx_pause
;
242 static int xgbe_set_pauseparam(struct net_device
*netdev
,
243 struct ethtool_pauseparam
*pause
)
245 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
248 if (pause
->autoneg
&& (pdata
->phy
.autoneg
!= AUTONEG_ENABLE
)) {
250 "autoneg disabled, pause autoneg not avialable\n");
254 pdata
->phy
.pause_autoneg
= pause
->autoneg
;
255 pdata
->phy
.tx_pause
= pause
->tx_pause
;
256 pdata
->phy
.rx_pause
= pause
->rx_pause
;
258 pdata
->phy
.advertising
&= ~ADVERTISED_Pause
;
259 pdata
->phy
.advertising
&= ~ADVERTISED_Asym_Pause
;
261 if (pause
->rx_pause
) {
262 pdata
->phy
.advertising
|= ADVERTISED_Pause
;
263 pdata
->phy
.advertising
|= ADVERTISED_Asym_Pause
;
267 pdata
->phy
.advertising
^= ADVERTISED_Asym_Pause
;
269 if (netif_running(netdev
))
270 ret
= pdata
->phy_if
.phy_config_aneg(pdata
);
275 static int xgbe_get_settings(struct net_device
*netdev
,
276 struct ethtool_cmd
*cmd
)
278 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
280 cmd
->phy_address
= pdata
->phy
.address
;
282 cmd
->supported
= pdata
->phy
.supported
;
283 cmd
->advertising
= pdata
->phy
.advertising
;
284 cmd
->lp_advertising
= pdata
->phy
.lp_advertising
;
286 cmd
->autoneg
= pdata
->phy
.autoneg
;
287 ethtool_cmd_speed_set(cmd
, pdata
->phy
.speed
);
288 cmd
->duplex
= pdata
->phy
.duplex
;
290 cmd
->port
= PORT_NONE
;
291 cmd
->transceiver
= XCVR_INTERNAL
;
296 static int xgbe_set_settings(struct net_device
*netdev
,
297 struct ethtool_cmd
*cmd
)
299 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
303 speed
= ethtool_cmd_speed(cmd
);
305 if (cmd
->phy_address
!= pdata
->phy
.address
) {
306 netdev_err(netdev
, "invalid phy address %hhu\n",
311 if ((cmd
->autoneg
!= AUTONEG_ENABLE
) &&
312 (cmd
->autoneg
!= AUTONEG_DISABLE
)) {
313 netdev_err(netdev
, "unsupported autoneg %hhu\n",
318 if (cmd
->autoneg
== AUTONEG_DISABLE
) {
323 if (pdata
->speed_set
!= XGBE_SPEEDSET_2500_10000
) {
324 netdev_err(netdev
, "unsupported speed %u\n",
330 if (pdata
->speed_set
!= XGBE_SPEEDSET_1000_10000
) {
331 netdev_err(netdev
, "unsupported speed %u\n",
337 netdev_err(netdev
, "unsupported speed %u\n", speed
);
341 if (cmd
->duplex
!= DUPLEX_FULL
) {
342 netdev_err(netdev
, "unsupported duplex %hhu\n",
348 netif_dbg(pdata
, link
, netdev
,
349 "requested advertisement %#x, phy supported %#x\n",
350 cmd
->advertising
, pdata
->phy
.supported
);
352 cmd
->advertising
&= pdata
->phy
.supported
;
353 if ((cmd
->autoneg
== AUTONEG_ENABLE
) && !cmd
->advertising
) {
355 "unsupported requested advertisement\n");
360 pdata
->phy
.autoneg
= cmd
->autoneg
;
361 pdata
->phy
.speed
= speed
;
362 pdata
->phy
.duplex
= cmd
->duplex
;
363 pdata
->phy
.advertising
= cmd
->advertising
;
365 if (cmd
->autoneg
== AUTONEG_ENABLE
)
366 pdata
->phy
.advertising
|= ADVERTISED_Autoneg
;
368 pdata
->phy
.advertising
&= ~ADVERTISED_Autoneg
;
370 if (netif_running(netdev
))
371 ret
= pdata
->phy_if
.phy_config_aneg(pdata
);
376 static void xgbe_get_drvinfo(struct net_device
*netdev
,
377 struct ethtool_drvinfo
*drvinfo
)
379 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
380 struct xgbe_hw_features
*hw_feat
= &pdata
->hw_feat
;
382 strlcpy(drvinfo
->driver
, XGBE_DRV_NAME
, sizeof(drvinfo
->driver
));
383 strlcpy(drvinfo
->version
, XGBE_DRV_VERSION
, sizeof(drvinfo
->version
));
384 strlcpy(drvinfo
->bus_info
, dev_name(pdata
->dev
),
385 sizeof(drvinfo
->bus_info
));
386 snprintf(drvinfo
->fw_version
, sizeof(drvinfo
->fw_version
), "%d.%d.%d",
387 XGMAC_GET_BITS(hw_feat
->version
, MAC_VR
, USERVER
),
388 XGMAC_GET_BITS(hw_feat
->version
, MAC_VR
, DEVID
),
389 XGMAC_GET_BITS(hw_feat
->version
, MAC_VR
, SNPSVER
));
392 static u32
xgbe_get_msglevel(struct net_device
*netdev
)
394 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
396 return pdata
->msg_enable
;
399 static void xgbe_set_msglevel(struct net_device
*netdev
, u32 msglevel
)
401 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
403 pdata
->msg_enable
= msglevel
;
406 static int xgbe_get_coalesce(struct net_device
*netdev
,
407 struct ethtool_coalesce
*ec
)
409 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
411 memset(ec
, 0, sizeof(struct ethtool_coalesce
));
413 ec
->rx_coalesce_usecs
= pdata
->rx_usecs
;
414 ec
->rx_max_coalesced_frames
= pdata
->rx_frames
;
416 ec
->tx_max_coalesced_frames
= pdata
->tx_frames
;
421 static int xgbe_set_coalesce(struct net_device
*netdev
,
422 struct ethtool_coalesce
*ec
)
424 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
425 struct xgbe_hw_if
*hw_if
= &pdata
->hw_if
;
426 unsigned int rx_frames
, rx_riwt
, rx_usecs
;
427 unsigned int tx_frames
;
429 /* Check for not supported parameters */
430 if ((ec
->rx_coalesce_usecs_irq
) ||
431 (ec
->rx_max_coalesced_frames_irq
) ||
432 (ec
->tx_coalesce_usecs
) ||
433 (ec
->tx_coalesce_usecs_irq
) ||
434 (ec
->tx_max_coalesced_frames_irq
) ||
435 (ec
->stats_block_coalesce_usecs
) ||
436 (ec
->use_adaptive_rx_coalesce
) ||
437 (ec
->use_adaptive_tx_coalesce
) ||
438 (ec
->pkt_rate_low
) ||
439 (ec
->rx_coalesce_usecs_low
) ||
440 (ec
->rx_max_coalesced_frames_low
) ||
441 (ec
->tx_coalesce_usecs_low
) ||
442 (ec
->tx_max_coalesced_frames_low
) ||
443 (ec
->pkt_rate_high
) ||
444 (ec
->rx_coalesce_usecs_high
) ||
445 (ec
->rx_max_coalesced_frames_high
) ||
446 (ec
->tx_coalesce_usecs_high
) ||
447 (ec
->tx_max_coalesced_frames_high
) ||
448 (ec
->rate_sample_interval
)) {
449 netdev_err(netdev
, "unsupported coalescing parameter\n");
453 rx_riwt
= hw_if
->usec_to_riwt(pdata
, ec
->rx_coalesce_usecs
);
454 rx_usecs
= ec
->rx_coalesce_usecs
;
455 rx_frames
= ec
->rx_max_coalesced_frames
;
457 /* Use smallest possible value if conversion resulted in zero */
458 if (rx_usecs
&& !rx_riwt
)
461 /* Check the bounds of values for Rx */
462 if (rx_riwt
> XGMAC_MAX_DMA_RIWT
) {
463 netdev_err(netdev
, "rx-usec is limited to %d usecs\n",
464 hw_if
->riwt_to_usec(pdata
, XGMAC_MAX_DMA_RIWT
));
467 if (rx_frames
> pdata
->rx_desc_count
) {
468 netdev_err(netdev
, "rx-frames is limited to %d frames\n",
469 pdata
->rx_desc_count
);
473 tx_frames
= ec
->tx_max_coalesced_frames
;
475 /* Check the bounds of values for Tx */
476 if (tx_frames
> pdata
->tx_desc_count
) {
477 netdev_err(netdev
, "tx-frames is limited to %d frames\n",
478 pdata
->tx_desc_count
);
482 pdata
->rx_riwt
= rx_riwt
;
483 pdata
->rx_usecs
= rx_usecs
;
484 pdata
->rx_frames
= rx_frames
;
485 hw_if
->config_rx_coalesce(pdata
);
487 pdata
->tx_frames
= tx_frames
;
488 hw_if
->config_tx_coalesce(pdata
);
493 static int xgbe_get_rxnfc(struct net_device
*netdev
,
494 struct ethtool_rxnfc
*rxnfc
, u32
*rule_locs
)
496 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
498 switch (rxnfc
->cmd
) {
499 case ETHTOOL_GRXRINGS
:
500 rxnfc
->data
= pdata
->rx_ring_count
;
509 static u32
xgbe_get_rxfh_key_size(struct net_device
*netdev
)
511 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
513 return sizeof(pdata
->rss_key
);
516 static u32
xgbe_get_rxfh_indir_size(struct net_device
*netdev
)
518 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
520 return ARRAY_SIZE(pdata
->rss_table
);
523 static int xgbe_get_rxfh(struct net_device
*netdev
, u32
*indir
, u8
*key
,
526 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
530 for (i
= 0; i
< ARRAY_SIZE(pdata
->rss_table
); i
++)
531 indir
[i
] = XGMAC_GET_BITS(pdata
->rss_table
[i
],
536 memcpy(key
, pdata
->rss_key
, sizeof(pdata
->rss_key
));
539 *hfunc
= ETH_RSS_HASH_TOP
;
544 static int xgbe_set_rxfh(struct net_device
*netdev
, const u32
*indir
,
545 const u8
*key
, const u8 hfunc
)
547 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
548 struct xgbe_hw_if
*hw_if
= &pdata
->hw_if
;
551 if (hfunc
!= ETH_RSS_HASH_NO_CHANGE
&& hfunc
!= ETH_RSS_HASH_TOP
) {
552 netdev_err(netdev
, "unsupported hash function\n");
557 ret
= hw_if
->set_rss_lookup_table(pdata
, indir
);
563 ret
= hw_if
->set_rss_hash_key(pdata
, key
);
571 static int xgbe_get_ts_info(struct net_device
*netdev
,
572 struct ethtool_ts_info
*ts_info
)
574 struct xgbe_prv_data
*pdata
= netdev_priv(netdev
);
576 ts_info
->so_timestamping
= SOF_TIMESTAMPING_TX_SOFTWARE
|
577 SOF_TIMESTAMPING_RX_SOFTWARE
|
578 SOF_TIMESTAMPING_SOFTWARE
|
579 SOF_TIMESTAMPING_TX_HARDWARE
|
580 SOF_TIMESTAMPING_RX_HARDWARE
|
581 SOF_TIMESTAMPING_RAW_HARDWARE
;
583 if (pdata
->ptp_clock
)
584 ts_info
->phc_index
= ptp_clock_index(pdata
->ptp_clock
);
586 ts_info
->phc_index
= -1;
588 ts_info
->tx_types
= (1 << HWTSTAMP_TX_OFF
) | (1 << HWTSTAMP_TX_ON
);
589 ts_info
->rx_filters
= (1 << HWTSTAMP_FILTER_NONE
) |
590 (1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT
) |
591 (1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC
) |
592 (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ
) |
593 (1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT
) |
594 (1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC
) |
595 (1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ
) |
596 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT
) |
597 (1 << HWTSTAMP_FILTER_PTP_V2_SYNC
) |
598 (1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ
) |
599 (1 << HWTSTAMP_FILTER_ALL
);
604 static const struct ethtool_ops xgbe_ethtool_ops
= {
605 .get_settings
= xgbe_get_settings
,
606 .set_settings
= xgbe_set_settings
,
607 .get_drvinfo
= xgbe_get_drvinfo
,
608 .get_msglevel
= xgbe_get_msglevel
,
609 .set_msglevel
= xgbe_set_msglevel
,
610 .get_link
= ethtool_op_get_link
,
611 .get_coalesce
= xgbe_get_coalesce
,
612 .set_coalesce
= xgbe_set_coalesce
,
613 .get_pauseparam
= xgbe_get_pauseparam
,
614 .set_pauseparam
= xgbe_set_pauseparam
,
615 .get_strings
= xgbe_get_strings
,
616 .get_ethtool_stats
= xgbe_get_ethtool_stats
,
617 .get_sset_count
= xgbe_get_sset_count
,
618 .get_rxnfc
= xgbe_get_rxnfc
,
619 .get_rxfh_key_size
= xgbe_get_rxfh_key_size
,
620 .get_rxfh_indir_size
= xgbe_get_rxfh_indir_size
,
621 .get_rxfh
= xgbe_get_rxfh
,
622 .set_rxfh
= xgbe_set_rxfh
,
623 .get_ts_info
= xgbe_get_ts_info
,
626 const struct ethtool_ops
*xgbe_get_ethtool_ops(void)
628 return &xgbe_ethtool_ops
;