13998e2a0SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 23998e2a0SBruce Richardson * Copyright(c) 2010-2014 Intel Corporation 3af75078fSIntel */ 4af75078fSIntel 5af75078fSIntel #ifndef _COMMON_H_ 6af75078fSIntel #define _COMMON_H_ 7af75078fSIntel 8af75078fSIntel #define MAX_CLIENTS 16 9af75078fSIntel 10af75078fSIntel /* 11af75078fSIntel * Shared port info, including statistics information for display by server. 12af75078fSIntel * Structure will be put in a memzone. 13af75078fSIntel * - All port id values share one cache line as this data will be read-only 14af75078fSIntel * during operation. 15af75078fSIntel * - All rx statistic values share cache lines, as this data is written only 16af75078fSIntel * by the server process. (rare reads by stats display) 17af75078fSIntel * - The tx statistics have values for all ports per cache line, but the stats 18af75078fSIntel * themselves are written by the clients, so we have a distinct set, on different 19af75078fSIntel * cache lines for each client to use. 20af75078fSIntel */ 21*7e06c0deSTyler Retzlaff struct __rte_cache_aligned rx_stats { 22af75078fSIntel uint64_t rx[RTE_MAX_ETHPORTS]; 23*7e06c0deSTyler Retzlaff }; 24af75078fSIntel 25*7e06c0deSTyler Retzlaff struct __rte_cache_aligned tx_stats { 26af75078fSIntel uint64_t tx[RTE_MAX_ETHPORTS]; 27af75078fSIntel uint64_t tx_drop[RTE_MAX_ETHPORTS]; 28*7e06c0deSTyler Retzlaff }; 29af75078fSIntel 30af75078fSIntel struct port_info { 31f8244c63SZhiyong Yang uint16_t num_ports; 32f8244c63SZhiyong Yang uint16_t id[RTE_MAX_ETHPORTS]; 33af75078fSIntel volatile struct rx_stats rx_stats; 34af75078fSIntel volatile struct tx_stats tx_stats[MAX_CLIENTS]; 35af75078fSIntel }; 36af75078fSIntel 37af75078fSIntel /* define common names for structures shared between server and client */ 38af75078fSIntel #define MP_CLIENT_RXQ_NAME "MProc_Client_%u_RX" 39af75078fSIntel #define PKTMBUF_POOL_NAME "MProc_pktmbuf_pool" 40af75078fSIntel #define MZ_PORT_INFO "MProc_port_info" 41af75078fSIntel 42af75078fSIntel /* 43af75078fSIntel * Given the rx queue name template above, get the queue name 44af75078fSIntel */ 45af75078fSIntel static inline const char * get_rx_queue_name(uint8_t id)4627b549c1SBruce Richardsonget_rx_queue_name(uint8_t id) 47af75078fSIntel { 48af75078fSIntel /* buffer for return value. Size calculated by %u being replaced 49af75078fSIntel * by maximum 3 digits (plus an extra byte for safety) */ 50af75078fSIntel static char buffer[sizeof(MP_CLIENT_RXQ_NAME) + 2]; 51af75078fSIntel 52f4be6a9aSMichael Santana snprintf(buffer, sizeof(buffer), MP_CLIENT_RXQ_NAME, id); 53af75078fSIntel return buffer; 54af75078fSIntel } 55af75078fSIntel 56af75078fSIntel #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 57af75078fSIntel 58af75078fSIntel #endif 59