DPDK  18.05.1
rte_distributor_v20.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef _RTE_DISTRIB_V20_H_
6 #define _RTE_DISTRIB_V20_H_
7 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #define RTE_DISTRIBUTOR_NAMESIZE 32
22 struct rte_distributor_v20;
23 struct rte_mbuf;
24 
41 struct rte_distributor_v20 *
42 rte_distributor_create_v20(const char *name, unsigned int socket_id,
43  unsigned int num_workers);
44 
45 /* *** APIS to be called on the distributor lcore *** */
46 /*
47  * The following APIs are the public APIs which are designed for use on a
48  * single lcore which acts as the distributor lcore for a given distributor
49  * instance. These functions cannot be called on multiple cores simultaneously
50  * without using locking to protect access to the internals of the distributor.
51  *
52  * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore
53  * for the same distributor instance, otherwise deadlock will result.
54  */
55 
76 int
77 rte_distributor_process_v20(struct rte_distributor_v20 *d,
78  struct rte_mbuf **mbufs, unsigned int num_mbufs);
79 
94 int
95 rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d,
96  struct rte_mbuf **mbufs, unsigned int max_mbufs);
97 
109 int
110 rte_distributor_flush_v20(struct rte_distributor_v20 *d);
111 
121 void
122 rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d);
123 
124 /* *** APIS to be called on the worker lcores *** */
125 /*
126  * The following APIs are the public APIs which are designed for use on
127  * multiple lcores which act as workers for a distributor. Each lcore should use
128  * a unique worker id when requesting packets.
129  *
130  * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore
131  * for the same distributor instance, otherwise deadlock will result.
132  */
133 
150 struct rte_mbuf *
151 rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d,
152  unsigned int worker_id, struct rte_mbuf *oldpkt);
153 
166 int
167 rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d,
168  unsigned int worker_id, struct rte_mbuf *mbuf);
169 
190 void
191 rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d,
192  unsigned int worker_id, struct rte_mbuf *oldpkt);
193 
210 struct rte_mbuf *
211 rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d,
212  unsigned int worker_id);
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif