18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2013 Johannes Berg <johannes@sipsolutions.net>
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *  This file is free software: you may copy, redistribute and/or modify it
58c2ecf20Sopenharmony_ci *  under the terms of the GNU General Public License as published by the
68c2ecf20Sopenharmony_ci *  Free Software Foundation, either version 2 of the License, or (at your
78c2ecf20Sopenharmony_ci *  option) any later version.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci *  This file is distributed in the hope that it will be useful, but
108c2ecf20Sopenharmony_ci *  WITHOUT ANY WARRANTY; without even the implied warranty of
118c2ecf20Sopenharmony_ci *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
128c2ecf20Sopenharmony_ci *  General Public License for more details.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci *  You should have received a copy of the GNU General Public License
158c2ecf20Sopenharmony_ci *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * This file incorporates work covered by the following copyright and
188c2ecf20Sopenharmony_ci * permission notice:
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * Copyright (c) 2012 Qualcomm Atheros, Inc.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
238c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
248c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
278c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
288c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
298c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
308c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
318c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
328c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef ALX_HW_H_
368c2ecf20Sopenharmony_ci#define ALX_HW_H_
378c2ecf20Sopenharmony_ci#include <linux/types.h>
388c2ecf20Sopenharmony_ci#include <linux/mdio.h>
398c2ecf20Sopenharmony_ci#include <linux/pci.h>
408c2ecf20Sopenharmony_ci#include <linux/if_vlan.h>
418c2ecf20Sopenharmony_ci#include "reg.h"
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* Transmit Packet Descriptor, contains 4 32-bit words.
448c2ecf20Sopenharmony_ci *
458c2ecf20Sopenharmony_ci *   31               16               0
468c2ecf20Sopenharmony_ci *   +----------------+----------------+
478c2ecf20Sopenharmony_ci *   |    vlan-tag    |   buf length   |
488c2ecf20Sopenharmony_ci *   +----------------+----------------+
498c2ecf20Sopenharmony_ci *   |              Word 1             |
508c2ecf20Sopenharmony_ci *   +----------------+----------------+
518c2ecf20Sopenharmony_ci *   |      Word 2: buf addr lo        |
528c2ecf20Sopenharmony_ci *   +----------------+----------------+
538c2ecf20Sopenharmony_ci *   |      Word 3: buf addr hi        |
548c2ecf20Sopenharmony_ci *   +----------------+----------------+
558c2ecf20Sopenharmony_ci *
568c2ecf20Sopenharmony_ci * Word 2 and 3 combine to form a 64-bit buffer address
578c2ecf20Sopenharmony_ci *
588c2ecf20Sopenharmony_ci * Word 1 has three forms, depending on the state of bit 8/12/13:
598c2ecf20Sopenharmony_ci * if bit8 =='1', the definition is just for custom checksum offload.
608c2ecf20Sopenharmony_ci * if bit8 == '0' && bit12 == '1' && bit13 == '1', the *FIRST* descriptor
618c2ecf20Sopenharmony_ci *     for the skb is special for LSO V2, Word 2 become total skb length ,
628c2ecf20Sopenharmony_ci *     Word 3 is meaningless.
638c2ecf20Sopenharmony_ci * other condition, the definition is for general skb or ip/tcp/udp
648c2ecf20Sopenharmony_ci *     checksum or LSO(TSO) offload.
658c2ecf20Sopenharmony_ci *
668c2ecf20Sopenharmony_ci * Here is the depiction:
678c2ecf20Sopenharmony_ci *
688c2ecf20Sopenharmony_ci *   0-+                                  0-+
698c2ecf20Sopenharmony_ci *   1 |                                  1 |
708c2ecf20Sopenharmony_ci *   2 |                                  2 |
718c2ecf20Sopenharmony_ci *   3 |    Payload offset                3 |    L4 header offset
728c2ecf20Sopenharmony_ci *   4 |        (7:0)                     4 |        (7:0)
738c2ecf20Sopenharmony_ci *   5 |                                  5 |
748c2ecf20Sopenharmony_ci *   6 |                                  6 |
758c2ecf20Sopenharmony_ci *   7-+                                  7-+
768c2ecf20Sopenharmony_ci *   8      Custom csum enable = 1        8      Custom csum enable = 0
778c2ecf20Sopenharmony_ci *   9      General IPv4 checksum         9      General IPv4 checksum
788c2ecf20Sopenharmony_ci *   10     General TCP checksum          10     General TCP checksum
798c2ecf20Sopenharmony_ci *   11     General UDP checksum          11     General UDP checksum
808c2ecf20Sopenharmony_ci *   12     Large Send Segment enable     12     Large Send Segment enable
818c2ecf20Sopenharmony_ci *   13     Large Send Segment type       13     Large Send Segment type
828c2ecf20Sopenharmony_ci *   14     VLAN tagged                   14     VLAN tagged
838c2ecf20Sopenharmony_ci *   15     Insert VLAN tag               15     Insert VLAN tag
848c2ecf20Sopenharmony_ci *   16     IPv4 packet                   16     IPv4 packet
858c2ecf20Sopenharmony_ci *   17     Ethernet frame type           17     Ethernet frame type
868c2ecf20Sopenharmony_ci *   18-+                                 18-+
878c2ecf20Sopenharmony_ci *   19 |                                 19 |
888c2ecf20Sopenharmony_ci *   20 |                                 20 |
898c2ecf20Sopenharmony_ci *   21 |   Custom csum offset            21 |
908c2ecf20Sopenharmony_ci *   22 |       (25:18)                   22 |
918c2ecf20Sopenharmony_ci *   23 |                                 23 |   MSS (30:18)
928c2ecf20Sopenharmony_ci *   24 |                                 24 |
938c2ecf20Sopenharmony_ci *   25-+                                 25 |
948c2ecf20Sopenharmony_ci *   26-+                                 26 |
958c2ecf20Sopenharmony_ci *   27 |                                 27 |
968c2ecf20Sopenharmony_ci *   28 |   Reserved                      28 |
978c2ecf20Sopenharmony_ci *   29 |                                 29 |
988c2ecf20Sopenharmony_ci *   30-+                                 30-+
998c2ecf20Sopenharmony_ci *   31     End of packet                 31     End of packet
1008c2ecf20Sopenharmony_ci */
1018c2ecf20Sopenharmony_cistruct alx_txd {
1028c2ecf20Sopenharmony_ci	__le16 len;
1038c2ecf20Sopenharmony_ci	__le16 vlan_tag;
1048c2ecf20Sopenharmony_ci	__le32 word1;
1058c2ecf20Sopenharmony_ci	union {
1068c2ecf20Sopenharmony_ci		__le64 addr;
1078c2ecf20Sopenharmony_ci		struct {
1088c2ecf20Sopenharmony_ci			__le32 pkt_len;
1098c2ecf20Sopenharmony_ci			__le32 resvd;
1108c2ecf20Sopenharmony_ci		} l;
1118c2ecf20Sopenharmony_ci	} adrl;
1128c2ecf20Sopenharmony_ci} __packed;
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/* tpd word 1 */
1158c2ecf20Sopenharmony_ci#define TPD_CXSUMSTART_MASK		0x00FF
1168c2ecf20Sopenharmony_ci#define TPD_CXSUMSTART_SHIFT		0
1178c2ecf20Sopenharmony_ci#define TPD_L4HDROFFSET_MASK		0x00FF
1188c2ecf20Sopenharmony_ci#define TPD_L4HDROFFSET_SHIFT		0
1198c2ecf20Sopenharmony_ci#define TPD_CXSUM_EN_MASK		0x0001
1208c2ecf20Sopenharmony_ci#define TPD_CXSUM_EN_SHIFT		8
1218c2ecf20Sopenharmony_ci#define TPD_IP_XSUM_MASK		0x0001
1228c2ecf20Sopenharmony_ci#define TPD_IP_XSUM_SHIFT		9
1238c2ecf20Sopenharmony_ci#define TPD_TCP_XSUM_MASK		0x0001
1248c2ecf20Sopenharmony_ci#define TPD_TCP_XSUM_SHIFT		10
1258c2ecf20Sopenharmony_ci#define TPD_UDP_XSUM_MASK		0x0001
1268c2ecf20Sopenharmony_ci#define TPD_UDP_XSUM_SHIFT		11
1278c2ecf20Sopenharmony_ci#define TPD_LSO_EN_MASK			0x0001
1288c2ecf20Sopenharmony_ci#define TPD_LSO_EN_SHIFT		12
1298c2ecf20Sopenharmony_ci#define TPD_LSO_V2_MASK			0x0001
1308c2ecf20Sopenharmony_ci#define TPD_LSO_V2_SHIFT		13
1318c2ecf20Sopenharmony_ci#define TPD_VLTAGGED_MASK		0x0001
1328c2ecf20Sopenharmony_ci#define TPD_VLTAGGED_SHIFT		14
1338c2ecf20Sopenharmony_ci#define TPD_INS_VLTAG_MASK		0x0001
1348c2ecf20Sopenharmony_ci#define TPD_INS_VLTAG_SHIFT		15
1358c2ecf20Sopenharmony_ci#define TPD_IPV4_MASK			0x0001
1368c2ecf20Sopenharmony_ci#define TPD_IPV4_SHIFT			16
1378c2ecf20Sopenharmony_ci#define TPD_ETHTYPE_MASK		0x0001
1388c2ecf20Sopenharmony_ci#define TPD_ETHTYPE_SHIFT		17
1398c2ecf20Sopenharmony_ci#define TPD_CXSUMOFFSET_MASK		0x00FF
1408c2ecf20Sopenharmony_ci#define TPD_CXSUMOFFSET_SHIFT		18
1418c2ecf20Sopenharmony_ci#define TPD_MSS_MASK			0x1FFF
1428c2ecf20Sopenharmony_ci#define TPD_MSS_SHIFT			18
1438c2ecf20Sopenharmony_ci#define TPD_EOP_MASK			0x0001
1448c2ecf20Sopenharmony_ci#define TPD_EOP_SHIFT			31
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci#define DESC_GET(_x, _name) ((_x) >> _name##SHIFT & _name##MASK)
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/* Receive Free Descriptor */
1498c2ecf20Sopenharmony_cistruct alx_rfd {
1508c2ecf20Sopenharmony_ci	__le64 addr;		/* data buffer address, length is
1518c2ecf20Sopenharmony_ci				 * declared in register --- every
1528c2ecf20Sopenharmony_ci				 * buffer has the same size
1538c2ecf20Sopenharmony_ci				 */
1548c2ecf20Sopenharmony_ci} __packed;
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/* Receive Return Descriptor, contains 4 32-bit words.
1578c2ecf20Sopenharmony_ci *
1588c2ecf20Sopenharmony_ci *   31               16               0
1598c2ecf20Sopenharmony_ci *   +----------------+----------------+
1608c2ecf20Sopenharmony_ci *   |              Word 0             |
1618c2ecf20Sopenharmony_ci *   +----------------+----------------+
1628c2ecf20Sopenharmony_ci *   |     Word 1: RSS Hash value      |
1638c2ecf20Sopenharmony_ci *   +----------------+----------------+
1648c2ecf20Sopenharmony_ci *   |              Word 2             |
1658c2ecf20Sopenharmony_ci *   +----------------+----------------+
1668c2ecf20Sopenharmony_ci *   |              Word 3             |
1678c2ecf20Sopenharmony_ci *   +----------------+----------------+
1688c2ecf20Sopenharmony_ci *
1698c2ecf20Sopenharmony_ci * Word 0 depiction         &            Word 2 depiction:
1708c2ecf20Sopenharmony_ci *
1718c2ecf20Sopenharmony_ci *   0--+                                 0--+
1728c2ecf20Sopenharmony_ci *   1  |                                 1  |
1738c2ecf20Sopenharmony_ci *   2  |                                 2  |
1748c2ecf20Sopenharmony_ci *   3  |                                 3  |
1758c2ecf20Sopenharmony_ci *   4  |                                 4  |
1768c2ecf20Sopenharmony_ci *   5  |                                 5  |
1778c2ecf20Sopenharmony_ci *   6  |                                 6  |
1788c2ecf20Sopenharmony_ci *   7  |    IP payload checksum          7  |     VLAN tag
1798c2ecf20Sopenharmony_ci *   8  |         (15:0)                  8  |      (15:0)
1808c2ecf20Sopenharmony_ci *   9  |                                 9  |
1818c2ecf20Sopenharmony_ci *   10 |                                 10 |
1828c2ecf20Sopenharmony_ci *   11 |                                 11 |
1838c2ecf20Sopenharmony_ci *   12 |                                 12 |
1848c2ecf20Sopenharmony_ci *   13 |                                 13 |
1858c2ecf20Sopenharmony_ci *   14 |                                 14 |
1868c2ecf20Sopenharmony_ci *   15-+                                 15-+
1878c2ecf20Sopenharmony_ci *   16-+                                 16-+
1888c2ecf20Sopenharmony_ci *   17 |     Number of RFDs              17 |
1898c2ecf20Sopenharmony_ci *   18 |        (19:16)                  18 |
1908c2ecf20Sopenharmony_ci *   19-+                                 19 |     Protocol ID
1918c2ecf20Sopenharmony_ci *   20-+                                 20 |      (23:16)
1928c2ecf20Sopenharmony_ci *   21 |                                 21 |
1938c2ecf20Sopenharmony_ci *   22 |                                 22 |
1948c2ecf20Sopenharmony_ci *   23 |                                 23-+
1958c2ecf20Sopenharmony_ci *   24 |                                 24 |     Reserved
1968c2ecf20Sopenharmony_ci *   25 |     Start index of RFD-ring     25-+
1978c2ecf20Sopenharmony_ci *   26 |         (31:20)                 26 |     RSS Q-num (27:25)
1988c2ecf20Sopenharmony_ci *   27 |                                 27-+
1998c2ecf20Sopenharmony_ci *   28 |                                 28-+
2008c2ecf20Sopenharmony_ci *   29 |                                 29 |     RSS Hash algorithm
2018c2ecf20Sopenharmony_ci *   30 |                                 30 |      (31:28)
2028c2ecf20Sopenharmony_ci *   31-+                                 31-+
2038c2ecf20Sopenharmony_ci *
2048c2ecf20Sopenharmony_ci * Word 3 depiction:
2058c2ecf20Sopenharmony_ci *
2068c2ecf20Sopenharmony_ci *   0--+
2078c2ecf20Sopenharmony_ci *   1  |
2088c2ecf20Sopenharmony_ci *   2  |
2098c2ecf20Sopenharmony_ci *   3  |
2108c2ecf20Sopenharmony_ci *   4  |
2118c2ecf20Sopenharmony_ci *   5  |
2128c2ecf20Sopenharmony_ci *   6  |
2138c2ecf20Sopenharmony_ci *   7  |    Packet length (include FCS)
2148c2ecf20Sopenharmony_ci *   8  |         (13:0)
2158c2ecf20Sopenharmony_ci *   9  |
2168c2ecf20Sopenharmony_ci *   10 |
2178c2ecf20Sopenharmony_ci *   11 |
2188c2ecf20Sopenharmony_ci *   12 |
2198c2ecf20Sopenharmony_ci *   13-+
2208c2ecf20Sopenharmony_ci *   14      L4 Header checksum error
2218c2ecf20Sopenharmony_ci *   15      IPv4 checksum error
2228c2ecf20Sopenharmony_ci *   16      VLAN tagged
2238c2ecf20Sopenharmony_ci *   17-+
2248c2ecf20Sopenharmony_ci *   18 |    Protocol ID (19:17)
2258c2ecf20Sopenharmony_ci *   19-+
2268c2ecf20Sopenharmony_ci *   20      Receive error summary
2278c2ecf20Sopenharmony_ci *   21      FCS(CRC) error
2288c2ecf20Sopenharmony_ci *   22      Frame alignment error
2298c2ecf20Sopenharmony_ci *   23      Truncated packet
2308c2ecf20Sopenharmony_ci *   24      Runt packet
2318c2ecf20Sopenharmony_ci *   25      Incomplete packet due to insufficient rx-desc
2328c2ecf20Sopenharmony_ci *   26      Broadcast packet
2338c2ecf20Sopenharmony_ci *   27      Multicast packet
2348c2ecf20Sopenharmony_ci *   28      Ethernet type (EII or 802.3)
2358c2ecf20Sopenharmony_ci *   29      FIFO overflow
2368c2ecf20Sopenharmony_ci *   30      Length error (for 802.3, length field mismatch with actual len)
2378c2ecf20Sopenharmony_ci *   31      Updated, indicate to driver that this RRD is refreshed.
2388c2ecf20Sopenharmony_ci */
2398c2ecf20Sopenharmony_cistruct alx_rrd {
2408c2ecf20Sopenharmony_ci	__le32 word0;
2418c2ecf20Sopenharmony_ci	__le32 rss_hash;
2428c2ecf20Sopenharmony_ci	__le32 word2;
2438c2ecf20Sopenharmony_ci	__le32 word3;
2448c2ecf20Sopenharmony_ci} __packed;
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci/* rrd word 0 */
2478c2ecf20Sopenharmony_ci#define RRD_XSUM_MASK		0xFFFF
2488c2ecf20Sopenharmony_ci#define RRD_XSUM_SHIFT		0
2498c2ecf20Sopenharmony_ci#define RRD_NOR_MASK		0x000F
2508c2ecf20Sopenharmony_ci#define RRD_NOR_SHIFT		16
2518c2ecf20Sopenharmony_ci#define RRD_SI_MASK		0x0FFF
2528c2ecf20Sopenharmony_ci#define RRD_SI_SHIFT		20
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci/* rrd word 2 */
2558c2ecf20Sopenharmony_ci#define RRD_VLTAG_MASK		0xFFFF
2568c2ecf20Sopenharmony_ci#define RRD_VLTAG_SHIFT		0
2578c2ecf20Sopenharmony_ci#define RRD_PID_MASK		0x00FF
2588c2ecf20Sopenharmony_ci#define RRD_PID_SHIFT		16
2598c2ecf20Sopenharmony_ci/* non-ip packet */
2608c2ecf20Sopenharmony_ci#define RRD_PID_NONIP		0
2618c2ecf20Sopenharmony_ci/* ipv4(only) */
2628c2ecf20Sopenharmony_ci#define RRD_PID_IPV4		1
2638c2ecf20Sopenharmony_ci/* tcp/ipv6 */
2648c2ecf20Sopenharmony_ci#define RRD_PID_IPV6TCP		2
2658c2ecf20Sopenharmony_ci/* tcp/ipv4 */
2668c2ecf20Sopenharmony_ci#define RRD_PID_IPV4TCP		3
2678c2ecf20Sopenharmony_ci/* udp/ipv6 */
2688c2ecf20Sopenharmony_ci#define RRD_PID_IPV6UDP		4
2698c2ecf20Sopenharmony_ci/* udp/ipv4 */
2708c2ecf20Sopenharmony_ci#define RRD_PID_IPV4UDP		5
2718c2ecf20Sopenharmony_ci/* ipv6(only) */
2728c2ecf20Sopenharmony_ci#define RRD_PID_IPV6		6
2738c2ecf20Sopenharmony_ci/* LLDP packet */
2748c2ecf20Sopenharmony_ci#define RRD_PID_LLDP		7
2758c2ecf20Sopenharmony_ci/* 1588 packet */
2768c2ecf20Sopenharmony_ci#define RRD_PID_1588		8
2778c2ecf20Sopenharmony_ci#define RRD_RSSQ_MASK		0x0007
2788c2ecf20Sopenharmony_ci#define RRD_RSSQ_SHIFT		25
2798c2ecf20Sopenharmony_ci#define RRD_RSSALG_MASK		0x000F
2808c2ecf20Sopenharmony_ci#define RRD_RSSALG_SHIFT	28
2818c2ecf20Sopenharmony_ci#define RRD_RSSALG_TCPV6	0x1
2828c2ecf20Sopenharmony_ci#define RRD_RSSALG_IPV6		0x2
2838c2ecf20Sopenharmony_ci#define RRD_RSSALG_TCPV4	0x4
2848c2ecf20Sopenharmony_ci#define RRD_RSSALG_IPV4		0x8
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci/* rrd word 3 */
2878c2ecf20Sopenharmony_ci#define RRD_PKTLEN_MASK		0x3FFF
2888c2ecf20Sopenharmony_ci#define RRD_PKTLEN_SHIFT	0
2898c2ecf20Sopenharmony_ci#define RRD_ERR_L4_MASK		0x0001
2908c2ecf20Sopenharmony_ci#define RRD_ERR_L4_SHIFT	14
2918c2ecf20Sopenharmony_ci#define RRD_ERR_IPV4_MASK	0x0001
2928c2ecf20Sopenharmony_ci#define RRD_ERR_IPV4_SHIFT	15
2938c2ecf20Sopenharmony_ci#define RRD_VLTAGGED_MASK	0x0001
2948c2ecf20Sopenharmony_ci#define RRD_VLTAGGED_SHIFT	16
2958c2ecf20Sopenharmony_ci#define RRD_OLD_PID_MASK	0x0007
2968c2ecf20Sopenharmony_ci#define RRD_OLD_PID_SHIFT	17
2978c2ecf20Sopenharmony_ci#define RRD_ERR_RES_MASK	0x0001
2988c2ecf20Sopenharmony_ci#define RRD_ERR_RES_SHIFT	20
2998c2ecf20Sopenharmony_ci#define RRD_ERR_FCS_MASK	0x0001
3008c2ecf20Sopenharmony_ci#define RRD_ERR_FCS_SHIFT	21
3018c2ecf20Sopenharmony_ci#define RRD_ERR_FAE_MASK	0x0001
3028c2ecf20Sopenharmony_ci#define RRD_ERR_FAE_SHIFT	22
3038c2ecf20Sopenharmony_ci#define RRD_ERR_TRUNC_MASK	0x0001
3048c2ecf20Sopenharmony_ci#define RRD_ERR_TRUNC_SHIFT	23
3058c2ecf20Sopenharmony_ci#define RRD_ERR_RUNT_MASK	0x0001
3068c2ecf20Sopenharmony_ci#define RRD_ERR_RUNT_SHIFT	24
3078c2ecf20Sopenharmony_ci#define RRD_ERR_ICMP_MASK	0x0001
3088c2ecf20Sopenharmony_ci#define RRD_ERR_ICMP_SHIFT	25
3098c2ecf20Sopenharmony_ci#define RRD_BCAST_MASK		0x0001
3108c2ecf20Sopenharmony_ci#define RRD_BCAST_SHIFT		26
3118c2ecf20Sopenharmony_ci#define RRD_MCAST_MASK		0x0001
3128c2ecf20Sopenharmony_ci#define RRD_MCAST_SHIFT		27
3138c2ecf20Sopenharmony_ci#define RRD_ETHTYPE_MASK	0x0001
3148c2ecf20Sopenharmony_ci#define RRD_ETHTYPE_SHIFT	28
3158c2ecf20Sopenharmony_ci#define RRD_ERR_FIFOV_MASK	0x0001
3168c2ecf20Sopenharmony_ci#define RRD_ERR_FIFOV_SHIFT	29
3178c2ecf20Sopenharmony_ci#define RRD_ERR_LEN_MASK	0x0001
3188c2ecf20Sopenharmony_ci#define RRD_ERR_LEN_SHIFT	30
3198c2ecf20Sopenharmony_ci#define RRD_UPDATED_MASK	0x0001
3208c2ecf20Sopenharmony_ci#define RRD_UPDATED_SHIFT	31
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci#define ALX_MAX_SETUP_LNK_CYCLE	50
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci/* for FlowControl */
3268c2ecf20Sopenharmony_ci#define ALX_FC_RX		0x01
3278c2ecf20Sopenharmony_ci#define ALX_FC_TX		0x02
3288c2ecf20Sopenharmony_ci#define ALX_FC_ANEG		0x04
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci/* for sleep control */
3318c2ecf20Sopenharmony_ci#define ALX_SLEEP_WOL_PHY	0x00000001
3328c2ecf20Sopenharmony_ci#define ALX_SLEEP_WOL_MAGIC	0x00000002
3338c2ecf20Sopenharmony_ci#define ALX_SLEEP_CIFS		0x00000004
3348c2ecf20Sopenharmony_ci#define ALX_SLEEP_ACTIVE	(ALX_SLEEP_WOL_PHY | \
3358c2ecf20Sopenharmony_ci				 ALX_SLEEP_WOL_MAGIC | \
3368c2ecf20Sopenharmony_ci				 ALX_SLEEP_CIFS)
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci/* for RSS hash type */
3398c2ecf20Sopenharmony_ci#define ALX_RSS_HASH_TYPE_IPV4		0x1
3408c2ecf20Sopenharmony_ci#define ALX_RSS_HASH_TYPE_IPV4_TCP	0x2
3418c2ecf20Sopenharmony_ci#define ALX_RSS_HASH_TYPE_IPV6		0x4
3428c2ecf20Sopenharmony_ci#define ALX_RSS_HASH_TYPE_IPV6_TCP	0x8
3438c2ecf20Sopenharmony_ci#define ALX_RSS_HASH_TYPE_ALL		(ALX_RSS_HASH_TYPE_IPV4 | \
3448c2ecf20Sopenharmony_ci					 ALX_RSS_HASH_TYPE_IPV4_TCP | \
3458c2ecf20Sopenharmony_ci					 ALX_RSS_HASH_TYPE_IPV6 | \
3468c2ecf20Sopenharmony_ci					 ALX_RSS_HASH_TYPE_IPV6_TCP)
3478c2ecf20Sopenharmony_ci#define ALX_FRAME_PAD		16
3488c2ecf20Sopenharmony_ci#define ALX_RAW_MTU(_mtu)	(_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN)
3498c2ecf20Sopenharmony_ci#define ALX_MAX_FRAME_LEN(_mtu)	(ALIGN((ALX_RAW_MTU(_mtu) + ALX_FRAME_PAD), 8))
3508c2ecf20Sopenharmony_ci#define ALX_DEF_RXBUF_SIZE	ALX_MAX_FRAME_LEN(1500)
3518c2ecf20Sopenharmony_ci#define ALX_MAX_JUMBO_PKT_SIZE	(9*1024)
3528c2ecf20Sopenharmony_ci#define ALX_MAX_TSO_PKT_SIZE	(7*1024)
3538c2ecf20Sopenharmony_ci#define ALX_MAX_FRAME_SIZE	ALX_MAX_JUMBO_PKT_SIZE
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci#define ALX_MAX_RX_QUEUES	8
3568c2ecf20Sopenharmony_ci#define ALX_MAX_TX_QUEUES	4
3578c2ecf20Sopenharmony_ci#define ALX_MAX_HANDLED_INTRS	5
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci#define ALX_ISR_MISC		(ALX_ISR_PCIE_LNKDOWN | \
3608c2ecf20Sopenharmony_ci				 ALX_ISR_DMAW | \
3618c2ecf20Sopenharmony_ci				 ALX_ISR_DMAR | \
3628c2ecf20Sopenharmony_ci				 ALX_ISR_SMB | \
3638c2ecf20Sopenharmony_ci				 ALX_ISR_MANU | \
3648c2ecf20Sopenharmony_ci				 ALX_ISR_TIMER)
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci#define ALX_ISR_FATAL		(ALX_ISR_PCIE_LNKDOWN | \
3678c2ecf20Sopenharmony_ci				 ALX_ISR_DMAW | ALX_ISR_DMAR)
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci#define ALX_ISR_ALERT		(ALX_ISR_RXF_OV | \
3708c2ecf20Sopenharmony_ci				 ALX_ISR_TXF_UR | \
3718c2ecf20Sopenharmony_ci				 ALX_ISR_RFD_UR)
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci#define ALX_ISR_ALL_QUEUES	(ALX_ISR_TX_Q0 | \
3748c2ecf20Sopenharmony_ci				 ALX_ISR_TX_Q1 | \
3758c2ecf20Sopenharmony_ci				 ALX_ISR_TX_Q2 | \
3768c2ecf20Sopenharmony_ci				 ALX_ISR_TX_Q3 | \
3778c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q0 | \
3788c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q1 | \
3798c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q2 | \
3808c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q3 | \
3818c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q4 | \
3828c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q5 | \
3838c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q6 | \
3848c2ecf20Sopenharmony_ci				 ALX_ISR_RX_Q7)
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci/* Statistics counters collected by the MAC
3878c2ecf20Sopenharmony_ci *
3888c2ecf20Sopenharmony_ci * The order of the fields must match the strings in alx_gstrings_stats
3898c2ecf20Sopenharmony_ci * All stats fields should be u64
3908c2ecf20Sopenharmony_ci * See ethtool.c
3918c2ecf20Sopenharmony_ci */
3928c2ecf20Sopenharmony_cistruct alx_hw_stats {
3938c2ecf20Sopenharmony_ci	/* rx */
3948c2ecf20Sopenharmony_ci	u64 rx_ok;		/* good RX packets */
3958c2ecf20Sopenharmony_ci	u64 rx_bcast;		/* good RX broadcast packets */
3968c2ecf20Sopenharmony_ci	u64 rx_mcast;		/* good RX multicast packets */
3978c2ecf20Sopenharmony_ci	u64 rx_pause;		/* RX pause frames */
3988c2ecf20Sopenharmony_ci	u64 rx_ctrl;		/* RX control packets other than pause frames */
3998c2ecf20Sopenharmony_ci	u64 rx_fcs_err;		/* RX packets with bad FCS */
4008c2ecf20Sopenharmony_ci	u64 rx_len_err;		/* RX packets with length != actual size */
4018c2ecf20Sopenharmony_ci	u64 rx_byte_cnt;	/* good bytes received. FCS is NOT included */
4028c2ecf20Sopenharmony_ci	u64 rx_runt;		/* RX packets < 64 bytes with good FCS */
4038c2ecf20Sopenharmony_ci	u64 rx_frag;		/* RX packets < 64 bytes with bad FCS */
4048c2ecf20Sopenharmony_ci	u64 rx_sz_64B;		/* 64 byte RX packets */
4058c2ecf20Sopenharmony_ci	u64 rx_sz_127B;		/* 65-127 byte RX packets */
4068c2ecf20Sopenharmony_ci	u64 rx_sz_255B;		/* 128-255 byte RX packets */
4078c2ecf20Sopenharmony_ci	u64 rx_sz_511B;		/* 256-511 byte RX packets */
4088c2ecf20Sopenharmony_ci	u64 rx_sz_1023B;	/* 512-1023 byte RX packets */
4098c2ecf20Sopenharmony_ci	u64 rx_sz_1518B;	/* 1024-1518 byte RX packets */
4108c2ecf20Sopenharmony_ci	u64 rx_sz_max;		/* 1519 byte to MTU RX packets */
4118c2ecf20Sopenharmony_ci	u64 rx_ov_sz;		/* truncated RX packets, size > MTU */
4128c2ecf20Sopenharmony_ci	u64 rx_ov_rxf;		/* frames dropped due to RX FIFO overflow */
4138c2ecf20Sopenharmony_ci	u64 rx_ov_rrd;		/* frames dropped due to RRD overflow */
4148c2ecf20Sopenharmony_ci	u64 rx_align_err;	/* alignment errors */
4158c2ecf20Sopenharmony_ci	u64 rx_bc_byte_cnt;	/* RX broadcast bytes, excluding FCS */
4168c2ecf20Sopenharmony_ci	u64 rx_mc_byte_cnt;	/* RX multicast bytes, excluding FCS */
4178c2ecf20Sopenharmony_ci	u64 rx_err_addr;	/* packets dropped due to address filtering */
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci	/* tx */
4208c2ecf20Sopenharmony_ci	u64 tx_ok;		/* good TX packets */
4218c2ecf20Sopenharmony_ci	u64 tx_bcast;		/* good TX broadcast packets */
4228c2ecf20Sopenharmony_ci	u64 tx_mcast;		/* good TX multicast packets */
4238c2ecf20Sopenharmony_ci	u64 tx_pause;		/* TX pause frames */
4248c2ecf20Sopenharmony_ci	u64 tx_exc_defer;	/* TX packets deferred excessively */
4258c2ecf20Sopenharmony_ci	u64 tx_ctrl;		/* TX control frames, excluding pause frames */
4268c2ecf20Sopenharmony_ci	u64 tx_defer;		/* TX packets deferred */
4278c2ecf20Sopenharmony_ci	u64 tx_byte_cnt;	/* bytes transmitted, FCS is NOT included */
4288c2ecf20Sopenharmony_ci	u64 tx_sz_64B;		/* 64 byte TX packets */
4298c2ecf20Sopenharmony_ci	u64 tx_sz_127B;		/* 65-127 byte TX packets */
4308c2ecf20Sopenharmony_ci	u64 tx_sz_255B;		/* 128-255 byte TX packets */
4318c2ecf20Sopenharmony_ci	u64 tx_sz_511B;		/* 256-511 byte TX packets */
4328c2ecf20Sopenharmony_ci	u64 tx_sz_1023B;	/* 512-1023 byte TX packets */
4338c2ecf20Sopenharmony_ci	u64 tx_sz_1518B;	/* 1024-1518 byte TX packets */
4348c2ecf20Sopenharmony_ci	u64 tx_sz_max;		/* 1519 byte to MTU TX packets */
4358c2ecf20Sopenharmony_ci	u64 tx_single_col;	/* packets TX after a single collision */
4368c2ecf20Sopenharmony_ci	u64 tx_multi_col;	/* packets TX after multiple collisions */
4378c2ecf20Sopenharmony_ci	u64 tx_late_col;	/* TX packets with late collisions */
4388c2ecf20Sopenharmony_ci	u64 tx_abort_col;	/* TX packets aborted w/excessive collisions */
4398c2ecf20Sopenharmony_ci	u64 tx_underrun;	/* TX packets aborted due to TX FIFO underrun
4408c2ecf20Sopenharmony_ci				 * or TRD FIFO underrun
4418c2ecf20Sopenharmony_ci				 */
4428c2ecf20Sopenharmony_ci	u64 tx_trd_eop;		/* reads beyond the EOP into the next frame
4438c2ecf20Sopenharmony_ci				 * when TRD was not written timely
4448c2ecf20Sopenharmony_ci				 */
4458c2ecf20Sopenharmony_ci	u64 tx_len_err;		/* TX packets where length != actual size */
4468c2ecf20Sopenharmony_ci	u64 tx_trunc;		/* TX packets truncated due to size > MTU */
4478c2ecf20Sopenharmony_ci	u64 tx_bc_byte_cnt;	/* broadcast bytes transmitted, excluding FCS */
4488c2ecf20Sopenharmony_ci	u64 tx_mc_byte_cnt;	/* multicast bytes transmitted, excluding FCS */
4498c2ecf20Sopenharmony_ci	u64 update;
4508c2ecf20Sopenharmony_ci};
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci/* maximum interrupt vectors for msix */
4548c2ecf20Sopenharmony_ci#define ALX_MAX_MSIX_INTRS	16
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci#define ALX_GET_FIELD(_data, _field)					\
4578c2ecf20Sopenharmony_ci	(((_data) >> _field ## _SHIFT) & _field ## _MASK)
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci#define ALX_SET_FIELD(_data, _field, _value)	do {			\
4608c2ecf20Sopenharmony_ci		(_data) &= ~(_field ## _MASK << _field ## _SHIFT);	\
4618c2ecf20Sopenharmony_ci		(_data) |= ((_value) & _field ## _MASK) << _field ## _SHIFT;\
4628c2ecf20Sopenharmony_ci	} while (0)
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_cistruct alx_hw {
4658c2ecf20Sopenharmony_ci	struct pci_dev *pdev;
4668c2ecf20Sopenharmony_ci	u8 __iomem *hw_addr;
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci	/* current & permanent mac addr */
4698c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];
4708c2ecf20Sopenharmony_ci	u8 perm_addr[ETH_ALEN];
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci	u16 mtu;
4738c2ecf20Sopenharmony_ci	u16 imt;
4748c2ecf20Sopenharmony_ci	u8 dma_chnl;
4758c2ecf20Sopenharmony_ci	u8 max_dma_chnl;
4768c2ecf20Sopenharmony_ci	/* tpd threshold to trig INT */
4778c2ecf20Sopenharmony_ci	u32 ith_tpd;
4788c2ecf20Sopenharmony_ci	u32 rx_ctrl;
4798c2ecf20Sopenharmony_ci	u32 mc_hash[2];
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci	u32 smb_timer;
4828c2ecf20Sopenharmony_ci	/* SPEED_* + DUPLEX_*, SPEED_UNKNOWN if link is down */
4838c2ecf20Sopenharmony_ci	int link_speed;
4848c2ecf20Sopenharmony_ci	u8 duplex;
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci	/* auto-neg advertisement or force mode config */
4878c2ecf20Sopenharmony_ci	u8 flowctrl;
4888c2ecf20Sopenharmony_ci	u32 adv_cfg;
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci	spinlock_t mdio_lock;
4918c2ecf20Sopenharmony_ci	struct mdio_if_info mdio;
4928c2ecf20Sopenharmony_ci	u16 phy_id[2];
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_ci	/* PHY link patch flag */
4958c2ecf20Sopenharmony_ci	bool lnk_patch;
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci	/* cumulated stats from the hardware (registers are cleared on read) */
4988c2ecf20Sopenharmony_ci	struct alx_hw_stats stats;
4998c2ecf20Sopenharmony_ci};
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_cistatic inline int alx_hw_revision(struct alx_hw *hw)
5028c2ecf20Sopenharmony_ci{
5038c2ecf20Sopenharmony_ci	return hw->pdev->revision >> ALX_PCI_REVID_SHIFT;
5048c2ecf20Sopenharmony_ci}
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_cistatic inline bool alx_hw_with_cr(struct alx_hw *hw)
5078c2ecf20Sopenharmony_ci{
5088c2ecf20Sopenharmony_ci	return hw->pdev->revision & 1;
5098c2ecf20Sopenharmony_ci}
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_cistatic inline bool alx_hw_giga(struct alx_hw *hw)
5128c2ecf20Sopenharmony_ci{
5138c2ecf20Sopenharmony_ci	return hw->pdev->device & 1;
5148c2ecf20Sopenharmony_ci}
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_cistatic inline void alx_write_mem8(struct alx_hw *hw, u32 reg, u8 val)
5178c2ecf20Sopenharmony_ci{
5188c2ecf20Sopenharmony_ci	writeb(val, hw->hw_addr + reg);
5198c2ecf20Sopenharmony_ci}
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_cistatic inline void alx_write_mem16(struct alx_hw *hw, u32 reg, u16 val)
5228c2ecf20Sopenharmony_ci{
5238c2ecf20Sopenharmony_ci	writew(val, hw->hw_addr + reg);
5248c2ecf20Sopenharmony_ci}
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_cistatic inline u16 alx_read_mem16(struct alx_hw *hw, u32 reg)
5278c2ecf20Sopenharmony_ci{
5288c2ecf20Sopenharmony_ci	return readw(hw->hw_addr + reg);
5298c2ecf20Sopenharmony_ci}
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_cistatic inline void alx_write_mem32(struct alx_hw *hw, u32 reg, u32 val)
5328c2ecf20Sopenharmony_ci{
5338c2ecf20Sopenharmony_ci	writel(val, hw->hw_addr + reg);
5348c2ecf20Sopenharmony_ci}
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_cistatic inline u32 alx_read_mem32(struct alx_hw *hw, u32 reg)
5378c2ecf20Sopenharmony_ci{
5388c2ecf20Sopenharmony_ci	return readl(hw->hw_addr + reg);
5398c2ecf20Sopenharmony_ci}
5408c2ecf20Sopenharmony_ci
5418c2ecf20Sopenharmony_cistatic inline void alx_post_write(struct alx_hw *hw)
5428c2ecf20Sopenharmony_ci{
5438c2ecf20Sopenharmony_ci	readl(hw->hw_addr);
5448c2ecf20Sopenharmony_ci}
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ciint alx_get_perm_macaddr(struct alx_hw *hw, u8 *addr);
5478c2ecf20Sopenharmony_civoid alx_reset_phy(struct alx_hw *hw);
5488c2ecf20Sopenharmony_civoid alx_reset_pcie(struct alx_hw *hw);
5498c2ecf20Sopenharmony_civoid alx_enable_aspm(struct alx_hw *hw, bool l0s_en, bool l1_en);
5508c2ecf20Sopenharmony_ciint alx_setup_speed_duplex(struct alx_hw *hw, u32 ethadv, u8 flowctrl);
5518c2ecf20Sopenharmony_civoid alx_post_phy_link(struct alx_hw *hw);
5528c2ecf20Sopenharmony_ciint alx_read_phy_reg(struct alx_hw *hw, u16 reg, u16 *phy_data);
5538c2ecf20Sopenharmony_ciint alx_write_phy_reg(struct alx_hw *hw, u16 reg, u16 phy_data);
5548c2ecf20Sopenharmony_ciint alx_read_phy_ext(struct alx_hw *hw, u8 dev, u16 reg, u16 *pdata);
5558c2ecf20Sopenharmony_ciint alx_write_phy_ext(struct alx_hw *hw, u8 dev, u16 reg, u16 data);
5568c2ecf20Sopenharmony_ciint alx_read_phy_link(struct alx_hw *hw);
5578c2ecf20Sopenharmony_ciint alx_clear_phy_intr(struct alx_hw *hw);
5588c2ecf20Sopenharmony_civoid alx_cfg_mac_flowcontrol(struct alx_hw *hw, u8 fc);
5598c2ecf20Sopenharmony_civoid alx_start_mac(struct alx_hw *hw);
5608c2ecf20Sopenharmony_ciint alx_reset_mac(struct alx_hw *hw);
5618c2ecf20Sopenharmony_civoid alx_set_macaddr(struct alx_hw *hw, const u8 *addr);
5628c2ecf20Sopenharmony_cibool alx_phy_configured(struct alx_hw *hw);
5638c2ecf20Sopenharmony_civoid alx_configure_basic(struct alx_hw *hw);
5648c2ecf20Sopenharmony_civoid alx_mask_msix(struct alx_hw *hw, int index, bool mask);
5658c2ecf20Sopenharmony_civoid alx_disable_rss(struct alx_hw *hw);
5668c2ecf20Sopenharmony_cibool alx_get_phy_info(struct alx_hw *hw);
5678c2ecf20Sopenharmony_civoid alx_update_hw_stats(struct alx_hw *hw);
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_cistatic inline u32 alx_speed_to_ethadv(int speed, u8 duplex)
5708c2ecf20Sopenharmony_ci{
5718c2ecf20Sopenharmony_ci	if (speed == SPEED_1000 && duplex == DUPLEX_FULL)
5728c2ecf20Sopenharmony_ci		return ADVERTISED_1000baseT_Full;
5738c2ecf20Sopenharmony_ci	if (speed == SPEED_100 && duplex == DUPLEX_FULL)
5748c2ecf20Sopenharmony_ci		return ADVERTISED_100baseT_Full;
5758c2ecf20Sopenharmony_ci	if (speed == SPEED_100 && duplex== DUPLEX_HALF)
5768c2ecf20Sopenharmony_ci		return ADVERTISED_100baseT_Half;
5778c2ecf20Sopenharmony_ci	if (speed == SPEED_10 && duplex == DUPLEX_FULL)
5788c2ecf20Sopenharmony_ci		return ADVERTISED_10baseT_Full;
5798c2ecf20Sopenharmony_ci	if (speed == SPEED_10 && duplex == DUPLEX_HALF)
5808c2ecf20Sopenharmony_ci		return ADVERTISED_10baseT_Half;
5818c2ecf20Sopenharmony_ci	return 0;
5828c2ecf20Sopenharmony_ci}
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_ci#endif
585