]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/dpdk/examples/server_node_efd/shared/common.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / seastar / dpdk / examples / server_node_efd / shared / common.h
CommitLineData
9f95a23c
TL
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
7c673cae
FG
3 */
4
5#ifndef _COMMON_H_
6#define _COMMON_H_
7
11fdf7f2
TL
8#include <rte_hash_crc.h>
9#include <rte_hash.h>
7c673cae 10
11fdf7f2 11#define MAX_NODES 16
7c673cae
FG
12/*
13 * Shared port info, including statistics information for display by server.
14 * Structure will be put in a memzone.
15 * - All port id values share one cache line as this data will be read-only
16 * during operation.
17 * - All rx statistic values share cache lines, as this data is written only
18 * by the server process. (rare reads by stats display)
19 * - The tx statistics have values for all ports per cache line, but the stats
11fdf7f2
TL
20 * themselves are written by the nodes, so we have a distinct set, on different
21 * cache lines for each node to use.
7c673cae 22 */
11fdf7f2 23struct rx_stats {
7c673cae
FG
24 uint64_t rx[RTE_MAX_ETHPORTS];
25} __rte_cache_aligned;
26
11fdf7f2 27struct tx_stats {
7c673cae
FG
28 uint64_t tx[RTE_MAX_ETHPORTS];
29 uint64_t tx_drop[RTE_MAX_ETHPORTS];
30} __rte_cache_aligned;
31
11fdf7f2
TL
32struct filter_stats {
33 uint64_t drop;
34 uint64_t passed;
35} __rte_cache_aligned;
36
37struct shared_info {
38 uint8_t num_nodes;
9f95a23c 39 uint16_t num_ports;
11fdf7f2 40 uint32_t num_flows;
9f95a23c 41 uint16_t id[RTE_MAX_ETHPORTS];
11fdf7f2
TL
42 struct rx_stats rx_stats;
43 struct tx_stats tx_stats[MAX_NODES];
44 struct filter_stats filter_stats[MAX_NODES];
7c673cae
FG
45};
46
11fdf7f2
TL
47/* define common names for structures shared between server and node */
48#define MP_NODE_RXQ_NAME "MProc_Node_%u_RX"
7c673cae 49#define PKTMBUF_POOL_NAME "MProc_pktmbuf_pool"
11fdf7f2 50#define MZ_SHARED_INFO "MProc_shared_info"
7c673cae
FG
51
52/*
53 * Given the rx queue name template above, get the queue name
54 */
55static inline const char *
11fdf7f2 56get_rx_queue_name(unsigned int id)
7c673cae 57{
11fdf7f2
TL
58 /*
59 * Buffer for return value. Size calculated by %u being replaced
60 * by maximum 3 digits (plus an extra byte for safety)
61 */
62 static char buffer[sizeof(MP_NODE_RXQ_NAME) + 2];
7c673cae 63
11fdf7f2 64 snprintf(buffer, sizeof(buffer) - 1, MP_NODE_RXQ_NAME, id);
7c673cae
FG
65 return buffer;
66}
67
68#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
69
70#endif