18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright (c)  2018 Intel Corporation */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _IGC_BASE_H_
58c2ecf20Sopenharmony_ci#define _IGC_BASE_H_
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* forward declaration */
88c2ecf20Sopenharmony_civoid igc_rx_fifo_flush_base(struct igc_hw *hw);
98c2ecf20Sopenharmony_civoid igc_power_down_phy_copper_base(struct igc_hw *hw);
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Transmit Descriptor - Advanced */
128c2ecf20Sopenharmony_ciunion igc_adv_tx_desc {
138c2ecf20Sopenharmony_ci	struct {
148c2ecf20Sopenharmony_ci		__le64 buffer_addr;    /* Address of descriptor's data buf */
158c2ecf20Sopenharmony_ci		__le32 cmd_type_len;
168c2ecf20Sopenharmony_ci		__le32 olinfo_status;
178c2ecf20Sopenharmony_ci	} read;
188c2ecf20Sopenharmony_ci	struct {
198c2ecf20Sopenharmony_ci		__le64 rsvd;       /* Reserved */
208c2ecf20Sopenharmony_ci		__le32 nxtseq_seed;
218c2ecf20Sopenharmony_ci		__le32 status;
228c2ecf20Sopenharmony_ci	} wb;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Context descriptors */
268c2ecf20Sopenharmony_cistruct igc_adv_tx_context_desc {
278c2ecf20Sopenharmony_ci	__le32 vlan_macip_lens;
288c2ecf20Sopenharmony_ci	__le32 launch_time;
298c2ecf20Sopenharmony_ci	__le32 type_tucmd_mlhl;
308c2ecf20Sopenharmony_ci	__le32 mss_l4len_idx;
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Adv Transmit Descriptor Config Masks */
348c2ecf20Sopenharmony_ci#define IGC_ADVTXD_MAC_TSTAMP	0x00080000 /* IEEE1588 Timestamp packet */
358c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DTYP_CTXT	0x00200000 /* Advanced Context Descriptor */
368c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DTYP_DATA	0x00300000 /* Advanced Data Descriptor */
378c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DCMD_EOP	0x01000000 /* End of Packet */
388c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DCMD_IFCS	0x02000000 /* Insert FCS (Ethernet CRC) */
398c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DCMD_RS	0x08000000 /* Report Status */
408c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DCMD_DEXT	0x20000000 /* Descriptor extension (1=Adv) */
418c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DCMD_VLE	0x40000000 /* VLAN pkt enable */
428c2ecf20Sopenharmony_ci#define IGC_ADVTXD_DCMD_TSE	0x80000000 /* TCP Seg enable */
438c2ecf20Sopenharmony_ci#define IGC_ADVTXD_PAYLEN_SHIFT	14 /* Adv desc PAYLEN shift */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define IGC_RAR_ENTRIES		16
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Receive Descriptor - Advanced */
488c2ecf20Sopenharmony_ciunion igc_adv_rx_desc {
498c2ecf20Sopenharmony_ci	struct {
508c2ecf20Sopenharmony_ci		__le64 pkt_addr; /* Packet buffer address */
518c2ecf20Sopenharmony_ci		__le64 hdr_addr; /* Header buffer address */
528c2ecf20Sopenharmony_ci	} read;
538c2ecf20Sopenharmony_ci	struct {
548c2ecf20Sopenharmony_ci		struct {
558c2ecf20Sopenharmony_ci			union {
568c2ecf20Sopenharmony_ci				__le32 data;
578c2ecf20Sopenharmony_ci				struct {
588c2ecf20Sopenharmony_ci					__le16 pkt_info; /*RSS type, Pkt type*/
598c2ecf20Sopenharmony_ci					/* Split Header, header buffer len */
608c2ecf20Sopenharmony_ci					__le16 hdr_info;
618c2ecf20Sopenharmony_ci				} hs_rss;
628c2ecf20Sopenharmony_ci			} lo_dword;
638c2ecf20Sopenharmony_ci			union {
648c2ecf20Sopenharmony_ci				__le32 rss; /* RSS Hash */
658c2ecf20Sopenharmony_ci				struct {
668c2ecf20Sopenharmony_ci					__le16 ip_id; /* IP id */
678c2ecf20Sopenharmony_ci					__le16 csum; /* Packet Checksum */
688c2ecf20Sopenharmony_ci				} csum_ip;
698c2ecf20Sopenharmony_ci			} hi_dword;
708c2ecf20Sopenharmony_ci		} lower;
718c2ecf20Sopenharmony_ci		struct {
728c2ecf20Sopenharmony_ci			__le32 status_error; /* ext status/error */
738c2ecf20Sopenharmony_ci			__le16 length; /* Packet length */
748c2ecf20Sopenharmony_ci			__le16 vlan; /* VLAN tag */
758c2ecf20Sopenharmony_ci		} upper;
768c2ecf20Sopenharmony_ci	} wb;  /* writeback */
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* Additional Transmit Descriptor Control definitions */
808c2ecf20Sopenharmony_ci#define IGC_TXDCTL_QUEUE_ENABLE	0x02000000 /* Ena specific Tx Queue */
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* Additional Receive Descriptor Control definitions */
838c2ecf20Sopenharmony_ci#define IGC_RXDCTL_QUEUE_ENABLE	0x02000000 /* Ena specific Rx Queue */
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* SRRCTL bit definitions */
868c2ecf20Sopenharmony_ci#define IGC_SRRCTL_BSIZEPKT_SHIFT		10 /* Shift _right_ */
878c2ecf20Sopenharmony_ci#define IGC_SRRCTL_BSIZEHDRSIZE_SHIFT		2  /* Shift _left_ */
888c2ecf20Sopenharmony_ci#define IGC_SRRCTL_DESCTYPE_ADV_ONEBUF	0x02000000
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#endif /* _IGC_BASE_H */
91