linux/drivers/net/ethernet/synopsys/dwc-xlgmac.h

/* Synopsys DesignWare Core Enterprise Ethernet (XLGMAC) Driver
 *
 * Copyright (c) 2017 Synopsys, Inc. (www.synopsys.com)
 *
 * This program is dual-licensed; you may select either version 2 of
 * the GNU General Public License ("GPL") or BSD license ("BSD").
 *
 * This Synopsys DWC XLGMAC software driver and associated documentation
 * (hereinafter the "Software") is an unsupported proprietary work of
 * Synopsys, Inc. unless otherwise expressly agreed to in writing between
 * Synopsys and you. The Software IS NOT an item of Licensed Software or a
 * Licensed Product under any End User Software License Agreement or
 * Agreement for Licensed Products with Synopsys or any supplement thereto.
 * Synopsys is a registered trademark of Synopsys, Inc. Other names included
 * in the SOFTWARE may be the trademarks of their respective owners.
 */

#ifndef __DWC_XLGMAC_H__
#define __DWC_XLGMAC_H__

#include <linux/dma-mapping.h>
#include <linux/netdevice.h>
#include <linux/workqueue.h>
#include <linux/phy.h>
#include <linux/if_vlan.h>
#include <linux/bitops.h>
#include <linux/timecounter.h>

#define XLGMAC_DRV_NAME
#define XLGMAC_DRV_VERSION
#define XLGMAC_DRV_DESC

/* Descriptor related parameters */
#define XLGMAC_TX_DESC_CNT
#define XLGMAC_TX_DESC_MIN_FREE
#define XLGMAC_TX_DESC_MAX_PROC
#define XLGMAC_RX_DESC_CNT
#define XLGMAC_RX_DESC_MAX_DIRTY

/* Descriptors required for maximum contiguous TSO/GSO packet */
#define XLGMAC_TX_MAX_SPLIT

/* Maximum possible descriptors needed for a SKB */
#define XLGMAC_TX_MAX_DESC_NR

#define XLGMAC_TX_MAX_BUF_SIZE
#define XLGMAC_RX_MIN_BUF_SIZE
#define XLGMAC_RX_BUF_ALIGN

/* Maximum Size for Splitting the Header Data
 * Keep in sync with SKB_ALLOC_SIZE
 * 3'b000: 64 bytes, 3'b001: 128 bytes
 * 3'b010: 256 bytes, 3'b011: 512 bytes
 * 3'b100: 1023 bytes ,   3'b101'3'b111: Reserved
 */
#define XLGMAC_SPH_HDSMS_SIZE
#define XLGMAC_SKB_ALLOC_SIZE

#define XLGMAC_MAX_FIFO

#define XLGMAC_MAX_DMA_CHANNELS
#define XLGMAC_DMA_STOP_TIMEOUT
#define XLGMAC_DMA_INTERRUPT_MASK

/* Default coalescing parameters */
#define XLGMAC_INIT_DMA_TX_USECS
#define XLGMAC_INIT_DMA_TX_FRAMES
#define XLGMAC_INIT_DMA_RX_USECS
#define XLGMAC_INIT_DMA_RX_FRAMES
#define XLGMAC_MAX_DMA_RIWT
#define XLGMAC_MIN_DMA_RIWT

/* Flow control queue count */
#define XLGMAC_MAX_FLOW_CONTROL_QUEUES

/* System clock is 125 MHz */
#define XLGMAC_SYSCLOCK

/* Maximum MAC address hash table size (256 bits = 8 bytes) */
#define XLGMAC_MAC_HASH_TABLE_SIZE

/* Receive Side Scaling */
#define XLGMAC_RSS_HASH_KEY_SIZE
#define XLGMAC_RSS_MAX_TABLE_SIZE
#define XLGMAC_RSS_LOOKUP_TABLE_TYPE
#define XLGMAC_RSS_HASH_KEY_TYPE

#define XLGMAC_STD_PACKET_MTU
#define XLGMAC_JUMBO_PACKET_MTU

/* Helper macro for descriptor handling
 *  Always use XLGMAC_GET_DESC_DATA to access the descriptor data
 */
#define XLGMAC_GET_DESC_DATA(ring, idx)

#define XLGMAC_GET_REG_BITS(var, pos, len)

#define XLGMAC_GET_REG_BITS_LE(var, pos, len)

#define XLGMAC_SET_REG_BITS(var, pos, len, val)

#define XLGMAC_SET_REG_BITS_LE(var, pos, len, val)

struct xlgmac_pdata;

enum xlgmac_int {};

struct xlgmac_stats {};

struct xlgmac_ring_buf {};

/* Common Tx and Rx DMA hardware descriptor */
struct xlgmac_dma_desc {};

/* Page allocation related values */
struct xlgmac_page_alloc {};

/* Ring entry buffer data */
struct xlgmac_buffer_data {};

/* Tx-related desc data */
struct xlgmac_tx_desc_data {};

/* Rx-related desc data */
struct xlgmac_rx_desc_data {};

struct xlgmac_pkt_info {};

struct xlgmac_desc_data {};

struct xlgmac_ring {} ____cacheline_aligned;

struct xlgmac_channel {} ____cacheline_aligned;

struct xlgmac_desc_ops {};

struct xlgmac_hw_ops {};

/* This structure contains flags that indicate what hardware features
 * or configurations are present in the device.
 */
struct xlgmac_hw_features {};

struct xlgmac_resources {};

struct xlgmac_pdata {};

void xlgmac_init_desc_ops(struct xlgmac_desc_ops *desc_ops);
void xlgmac_init_hw_ops(struct xlgmac_hw_ops *hw_ops);
const struct net_device_ops *xlgmac_get_netdev_ops(void);
const struct ethtool_ops *xlgmac_get_ethtool_ops(void);
void xlgmac_dump_tx_desc(struct xlgmac_pdata *pdata,
			 struct xlgmac_ring *ring,
			 unsigned int idx,
			 unsigned int count,
			 unsigned int flag);
void xlgmac_dump_rx_desc(struct xlgmac_pdata *pdata,
			 struct xlgmac_ring *ring,
			 unsigned int idx);
void xlgmac_print_pkt(struct net_device *netdev,
		      struct sk_buff *skb, bool tx_rx);
void xlgmac_get_all_hw_features(struct xlgmac_pdata *pdata);
void xlgmac_print_all_hw_features(struct xlgmac_pdata *pdata);
int xlgmac_drv_probe(struct device *dev,
		     struct xlgmac_resources *res);
int xlgmac_drv_remove(struct device *dev);

/* For debug prints */
#ifdef XLGMAC_DEBUG
#define XLGMAC_PR
#else
#define XLGMAC_PR(x...)
#endif

#endif /* __DWC_XLGMAC_H__ */