/* <:copyright-BRCM:2017:DUAL/GPL:standard Copyright (c) 2017 Broadcom All Rights Reserved This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation (the "GPL"). This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A copy of the GPL is available at http://www.broadcom.com/licenses/GPLv2.php, or by writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. :> */ #ifndef _ENET_SYSPORT_DRV_H_ #define _ENET_SYSPORT_DRV_H_ #if defined(CONFIG_BCM963158) #define PKT_DESC_SYSPORT #elif defined(CONFIG_BCM94908) #define PKT_DESC_IUDMA #endif #define ENET_NUM_RX_PKT_DESC (512) #define ENET_NUM_TX_PKT_DESC (512) #define SYSPORT_NUM_RX_PKT_DESC_LOG2 (9) #define SYSPORT_NUM_TX_PKT_DESC_LOG2 (9) #if ( ENET_NUM_TX_PKT_DESC != (1<address = (uint32)VIRT_TO_PHYS((pData)) #define PKT_DESC_ASSIGN_BUF_LEN(pd, len) (pd)->length = (len) #define RX_PKT_DESC_ASSIGN_BUF_ADDR(pd, pData) PKT_DESC_ASSIGN_BUF_ADDR(pd, pData) #define TX_PKT_DESC_ASSIGN_BUF_ADDR(pd, pData) PKT_DESC_ASSIGN_BUF_ADDR(pd, pData) #define TX_PKT_DESC_ASSIGN_BUF_LEN(pd, len) PKT_DESC_ASSIGN_BUF_LEN(pd, len) #define TX_PKT_DESC_ASSIGN_STATUS(pd, status) (pd)->status = status #if defined(PKT_DESC_IUDMA) #define RX_PKT_DESC_ASSIGN_BUF_LEN(pd, len) PKT_DESC_ASSIGN_BUF_LEN(pd, len) #else #define RX_PKT_DESC_ASSIGN_BUF_LEN(pd, len) #endif /* Structure to hold different type of addresses to PktDesc Ring */ typedef struct pkt_desc_ptrs { volatile PktDesc *p_desc_unaligned_addr; /* Unalligned host address */ volatile PktDesc *p_desc_host_addr; /* Aligned host addres */ volatile PktDesc *p_desc_physical_addr; /* Aligned physical address */ }pkt_desc_ptrs; typedef struct pkt_desc_info { pkt_desc_ptrs desc_ptr; /* PktDesc Pointers */ uint32_t total_pkt_desc; /* Total number of PktDesc allocated to this ring */ uint32_t assigned_pkt_desc; /* Number of PktDesc with assigned buffer */ uint32_t tail_idx; /* Driver's view of PktDesc ring */ uint32_t head_idx; /* Driver's view of PktDesc ring */ #if defined(PKT_DESC_IUDMA) volatile DmaChannelCfg *pDmaChCfg; /* */ #else uint16_t rx_c_index; /* Must be 16 bit - RX Consumer Index * rx_c_index tries to catch up to HW-producer-index; * Only used to check if HW has produced a packet * Once SW consumes the packet -- increment */ uint16_t tx_c_index; /* Must be 16 bit - TX Consumer Index * tx_c_index tries to catch up to HW-consumer-index; * Only used to reclaim the transmitted packets * Once HW consumes the packet -- increment */ #endif }pkt_desc_info; typedef void* enet_tx_recycle_ctxt; /* SKB Management */ typedef struct enet_sysport_skb_pool { struct sk_buff *freeSkbList; unsigned char *start_skbs_p; unsigned char *end_skbs_p; struct kmem_cache *enetSkbCache; }enet_sysport_skb_pool; #endif /* _ENET_SYSPORT_DRV_H_*/