aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_eventdev/rte_event_timer_adapter_pmd.h
blob: cf3509dc6f51a9d35bd61289aa667c5217bf7f28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2017-2018 Intel Corporation.
 * All rights reserved.
 */

#ifndef __RTE_EVENT_TIMER_ADAPTER_PMD_H__
#define __RTE_EVENT_TIMER_ADAPTER_PMD_H__

/**
 * @file
 * RTE Event Timer Adapter API (PMD Side)
 *
 * @note
 * This file provides implementation helpers for internal use by PMDs.  They
 * are not intended to be exposed to applications and are not subject to ABI
 * versioning.
 *
 */

#ifdef __cplusplus
extern "C" {
#endif

#include "rte_event_timer_adapter.h"

/*
 * Definitions of functions exported by an event timer adapter implementation
 * through *rte_event_timer_adapter_ops* structure supplied in the
 * *rte_event_timer_adapter* structure associated with an event timer adapter.
 */

typedef int (*rte_event_timer_adapter_init_t)(
		struct rte_event_timer_adapter *adapter);
/**< @internal Event timer adapter implementation setup */
typedef int (*rte_event_timer_adapter_uninit_t)(
		struct rte_event_timer_adapter *adapter);
/**< @internal Event timer adapter implementation teardown */
typedef int (*rte_event_timer_adapter_start_t)(
		const struct rte_event_timer_adapter *adapter);
/**< @internal Start running event timer adapter */
typedef int (*rte_event_timer_adapter_stop_t)(
		const struct rte_event_timer_adapter *adapter);
/**< @internal Stop running event timer adapter */
typedef void (*rte_event_timer_adapter_get_info_t)(
		const struct rte_event_timer_adapter *adapter,
		struct rte_event_timer_adapter_info *adapter_info);
/**< @internal Get contextual information for event timer adapter */
typedef int (*rte_event_timer_adapter_stats_get_t)(
		const struct rte_event_timer_adapter *adapter,
		struct rte_event_timer_adapter_stats *stats);
/**< @internal Get statistics for event timer adapter */
typedef int (*rte_event_timer_adapter_stats_reset_t)(
		const struct rte_event_timer_adapter *adapter);
/**< @internal Reset statistics for event timer adapter */

/**
 * @internal Structure containing the functions exported by an event timer
 * adapter implementation.
 */
struct rte_event_timer_adapter_ops {
	rte_event_timer_adapter_init_t		init;  /**< Set up adapter */
	rte_event_timer_adapter_uninit_t	uninit;/**< Tear down adapter */
	rte_event_timer_adapter_start_t		start; /**< Start adapter */
	rte_event_timer_adapter_stop_t		stop;  /**< Stop adapter */
	rte_event_timer_adapter_get_info_t	get_info;
	/**< Get info from driver */
	rte_event_timer_adapter_stats_get_t	stats_get;
	/**< Get adapter statistics */
	rte_event_timer_adapter_stats_reset_t	stats_reset;
	/**< Reset adapter statistics */
	rte_event_timer_arm_burst_t		arm_burst;
	/**< Arm one or more event timers */
	rte_event_timer_arm_tmo_tick_burst_t	arm_tmo_tick_burst;
	/**< Arm event timers with same expiration time */
	rte_event_timer_cancel_burst_t		cancel_burst;
	/**< Cancel one or more event timers */
};

/**
 * @internal Adapter data; structure to be placed in shared memory to be
 * accessible by various processes in a multi-process configuration.
 */
struct rte_event_timer_adapter_data {
	uint8_t id;
	/**< Event timer adapter ID */
	uint8_t event_dev_id;
	/**< Event device ID */
	uint32_t socket_id;
	/**< Socket ID where memory is allocated */
	uint8_t event_port_id;
	/**< Optional: event port ID used when the inbuilt port is absent */
	const struct rte_memzone *mz;
	/**< Event timer adapter memzone pointer */
	struct rte_event_timer_adapter_conf conf;
	/**< Configuration used to configure the adapter. */
	uint32_t caps;
	/**< Adapter capabilities */
	void *adapter_priv;
	/**< Timer adapter private data*/
	uint8_t service_inited;
	/**< Service initialization state */
	uint32_t service_id;
	/**< Service ID*/

	RTE_STD_C11
	uint8_t started : 1;
	/**< Flag to indicate adapter started. */
} __rte_cache_aligned;

#ifdef __cplusplus
}
#endif

#endif /* __RTE_EVENT_TIMER_ADAPTER_PMD_H__ */