#ifndef __CBM_API_H #define __CBM_API_H #include /** * \file cbm_api.h * \brief This file contains all the Central Buffer Manager (CBM) API */ /** * \defgroup CBM_Driver CBM Driver * \brief All API and defines exported by CBM Driver. * \Look at the constants chapter below. */ /** * \defgroup CBM_Driver_Defines CBM Driver Defines * \brief Defines used in the CBM Driver. Look at the constants chapter below. */ /** * \defgroup CBM_Driver_Global_Defines CBM Driver Global Defines * \brief Global Defines used in the CBM Driver. * \Look at the constants chapter below. */ /** * \defgroup CBM_Driver_Port_Allocation_Defines CBM Driver Port Allocation. * \Defines brief CBM Port Allocate Defines. * \Look at the constants chapter below. */ /** * \defgroup CBM_Driver_Port_Defines CBM Driver Port Defines * \brief CBM Port Initialization Defines. Look at the constants chapter below. */ /** * \defgroup CBM_Driver_CPU_Defines CBM Driver CPU Defines * \brief CBM Driver CPU Related Defines. Look at the constants chapter below. */ /** * \defgroup CBM_Driver_QMAP_Defines CBM Driver QMAP Defines * \brief CBM Queue Map Table Field defines. * \Look at the constants chapter below. */ /** * \defgroup CBM_Driver_Port_Structures CBM Driver Port Structures * \brief CBM Port Configuration Structures */ /** * \defgroup CBM_Control_API CBM Control API * \brief CBM Control API allows to configure Interrupt, * \Enqueue and Dequeue manager *- CBM Enqueue Manager *- CBM Dequeue Manager */ /** * \defgroup CBM_Port_Allocation_API CBM Port Allocation API * \brief CBM Port Allocation API allows to allocate and de-allocate * - CBM Enqeuue and Dequeue Ports * - Datapath (PMAC) Ports */ /** * \defgroup CBM_Port_OPS_API CBM Port Operations API * \brief CBM Port Operations API - Initialize/Uninitialize, * \Enable/Disable, Configure CBM port * - CBM Enqeuue and Dequeue Ports */ /** * \defgroup CBM_Stats_API CBM Statistics API * \brief CBM Statistics API * - CBM Enqeuue and Dequeue Ports */ /** * \defgroup CBM_CPU_Port_API CBM CPU Port API * \brief CBM CPU Port API * - CBM Enqeuue and Dequeue Ports */ /** * \defgroup CBM_CPU_IRQ_API CBM CPU IRQ API * \brief CBM CPU IRQ Control and Enable API * - CBM Enqeuue and Dequeue Ports */ /** * \defgroup CBM_CPU_API CBM CPU API * \brief CBM CPU API */ /** * \defgroup CBM_CPU_LOAD_SPREADER_API CBM CPU LOAD SPREADER API * \brief CBM CPU Rx side Load Spreader API. * - Load Spreader module distributes incoming packet load to multiple * Cores/VPEs in GRX500 for maximising SMP Rx Packet performance */ #include "datapath_api.h" #define SINGLE_RX_CH0_ONLY 1 /** \addtogroup CBM_Driver_Global_Defines */ /*! \brief OK return value */ #define CBM_OK 0 /*! \brief Error return value */ #define CBM_ERROR -1 /** \addtogroup CBM_Driver_Port_Allocation_Defines */ /*! \brief Module Flag VRX318 SmartPHY */ #define CBM_MOD_F_VRX318 0x1 /*! \brief Module Flag TSO Engine */ #define CBM_MOD_F_TSO 0x2 /*! \brief Module Flag LRO Engine */ #define CBM_MOD_F_LRO 0x4 /*! \brief Module Flag WAVE500 WLAN */ #define CBM_MOD_F_WAVE500 0x8 /*! \brief Flag Legacy 2-DWORD DMA descriptor */ #define CBM_MOD_F_LEGACY 0x10 /*! \brief Flag Legacy Desc to 4 DW Invert */ #define CBM_MOD_F_DESC_ORDER_INVERT 0x20 /*! \brief Flag CBM Port Type is CPU port */ #define CBM_MOD_F_PORT_TYPE_CPU 0x40 /** \addtogroup CBM_Driver_Port_Defines */ /*! \brief Use Standard Size buffer pool */ #define CBM_PORT_F_STANDARD_BUF 0x1 /*! \brief Use Jumbo size Buffer pool */ #define CBM_PORT_F_JUMBO_BUF 0x2 /*! \brief CBM Dequeue port */ #define CBM_PORT_F_DEQUEUE_PORT 0x4 /*! \brief Disable the CBM port */ #define CBM_PORT_F_DISABLE 0x8 /*! \brief CPU CBM port */ #define CBM_PORT_F_CPU_PORT 0x10 /*! \brief WAVE500 WLAN special CPU port */ #define CBM_PORT_F_WAVE500_PORT 0x20 /** \addtogroup CBM_Driver_CPU_Defines */ /*! \brief Stop Rx i.e. assert backpressure */ #define CBM_CPU_F_RX_STOP 0x1 /*! \brief Start Rx i.e. remove backpressure */ #define CBM_CPU_F_RX_START 0x2 /*! \brief RCNT Decrement flag */ #define CBM_CPU_BUF_DEC_RCNT 0x4 /*! \brief RCNT Increment flag */ #define CBM_CPU_BUF_INC_RCNT 0x8 /** \addtogroup CBM_Driver_QMAP_Defines */ /*! \brief FlowId bits are don't care for map to QueueId */ #define CBM_QUEUE_MAP_F_FLOWID_L_DONTCARE 0x1 #define CBM_QUEUE_MAP_F_FLOWID_H_DONTCARE 0x80 #define CBM_QUEUE_MAP_F_SUBIF_DONTCARE 0x100 #define CBM_QUEUE_MAP_F_EN_DONTCARE 0x2 /*! \brief VPN Decrypt bit is don't care for map to QueueId */ #define CBM_QUEUE_MAP_F_DE_DONTCARE 0x4 /*! \brief MPE1 bit is don't care for map to QueueId */ #define CBM_QUEUE_MAP_F_MPE1_DONTCARE 0x8 /*! \brief MPE2 bit is don't care for map to QueueId */ #define CBM_QUEUE_MAP_F_MPE2_DONTCARE 0x10 /*! \brief EP/Egress Port field is don't care for map to QueueId */ #define CBM_QUEUE_MAP_F_EP_DONTCARE 0x20 /*! \brief TC/Class field is don't care for map to QueueId */ #define CBM_QUEUE_MAP_F_TC_DONTCARE 0x40 /** Special input flag to get the Enqueue port resources*/ #define DP_F_ENQ_CPU_0 0x2 #define DP_F_ENQ_CPU_1 0x3 #define DP_F_ENQ_CPU_2 0x4 #define DP_F_ENQ_CPU_3 0x5 #define DP_F_ENQ_WAVE 0x6 #define DP_F_ENQ_GSWIPL 0x7 #define DP_F_ENQ_PAE 0x8 #define DP_F_ENQ_TSO 0x9 #define DP_F_ENQ_VRX318 0xa #define DP_F_ENQ_DL 0xb #define DP_F_DEQ_CPU 0x2 #define DP_F_DEQ_CPU1 0x3 #define DP_F_DEQ_MPE 0x4 #define DP_F_DEQ_DL 0x5 /** Special input flag to enable/disable datapath queues*/ #define CBM_Q_F_DISABLE 0x10000000 #define CBM_Q_F_NODEQUEUE 0x20000000 #define CBM_Q_F_CKSUM 0x40000000 #define CBM_Q_F_FLUSH 0x80000000 #define CBM_Q_F_FORCE_FLUSH 0x00000001 #define CBM_Q_F_RESTORE_ONLY 0x00000002 #define CQM_MAX_CPU 4 #define CBM_PORT_DP_SET BIT(0) #define CBM_PORT_DQ_SET BIT(1) #define CBM_PORT_DMA_CHAN_SET BIT(2) #define CBM_PORT_PKT_CRDT_SET BIT(3) #define CBM_PORT_BYTE_CRDT_SET BIT(4) #define CBM_PORT_RING_ADDR_SET BIT(5) #define CBM_PORT_RING_SIZE_SET BIT(6) #define CBM_PORT_RING_OFFSET_SET BIT(7) #define CBM_STD_BUF_SIZE 2048 /** \addtogroup CBM_Driver_Port_Structures */ /*! \brief CBM Queue Map table Entry */ typedef struct { uint32_t flowid : 2; /*!< FlowId (Bits 7:6) */ uint32_t dec : 1; /*!< VPN Decrypt flag */ uint32_t enc : 1; /*!< VPN Encrypt flag */ uint32_t mpe1 : 1; /*!< MPE1 Flag */ uint32_t mpe2 : 1; /*!< MPE2 Flag */ uint32_t ep : 4; /*!< PMAC Egress Port number */ uint32_t tc : 4; /*!< Traffic Class */ uint32_t sub_if_id : 12; /*! cqm instance */ int dp_port; /*! dp port id/lpid/ep */ int res_id; /*! resource ID */ int alloc_flags; /*! port alloc_flags */ struct dp_dc_rx_res rx_res; /*! rx resource */ struct dp_dc_tx_res tx_res; /*! tx resource */ }; int cbm_dp_get_dc_config(struct cbm_dc_res *res, int flag); void cbm_track_recv(const void *cbm_ptr, uint8_t sport, uint8_t dport, uint8_t cbm_port); void cbm_track_send(const void *cbm_ptr, uint8_t sport, uint8_t dport, uint8_t cbm_port); /** * cbm_dma_port_config_t * cbm_cpu_port_config_t * cbm_cpu_port_irq_enable_t * cbm_queue_map_entry_t */ #endif