DPDK  20.08.0
rte_distributor_single.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_SINGLE_H_
6 #define _RTE_DISTRIB_SINGLE_H_
7 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #define RTE_DISTRIBUTOR_NAMESIZE 32
22 struct rte_distributor_single;
23 struct rte_mbuf;
24 
41 struct rte_distributor_single *
42 rte_distributor_create_single(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_single(struct rte_distributor_single *d,
78  struct rte_mbuf **mbufs, unsigned int num_mbufs);
79 
94 int
95 rte_distributor_returned_pkts_single(struct rte_distributor_single *d,
96  struct rte_mbuf **mbufs, unsigned int max_mbufs);
97 
109 int
110 rte_distributor_flush_single(struct rte_distributor_single *d);
111 
121 void
122 rte_distributor_clear_returns_single(struct rte_distributor_single *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_single(struct rte_distributor_single *d,
152  unsigned int worker_id, struct rte_mbuf *oldpkt);
153 
166 int
167 rte_distributor_return_pkt_single(struct rte_distributor_single *d,
168  unsigned int worker_id, struct rte_mbuf *mbuf);
169 
190 void
191 rte_distributor_request_pkt_single(struct rte_distributor_single *d,
192  unsigned int worker_id, struct rte_mbuf *oldpkt);
193 
210 struct rte_mbuf *
211 rte_distributor_poll_pkt_single(struct rte_distributor_single *d,
212  unsigned int worker_id);
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif
void rte_distributor_request_pkt_single(struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *oldpkt)
int rte_distributor_return_pkt_single(struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *mbuf)
int rte_distributor_process_single(struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned int num_mbufs)
int rte_distributor_returned_pkts_single(struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned int max_mbufs)
struct rte_mbuf * rte_distributor_get_pkt_single(struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *oldpkt)
struct rte_distributor_single * rte_distributor_create_single(const char *name, unsigned int socket_id, unsigned int num_workers)
void rte_distributor_clear_returns_single(struct rte_distributor_single *d)
struct rte_mbuf * rte_distributor_poll_pkt_single(struct rte_distributor_single *d, unsigned int worker_id)
int rte_distributor_flush_single(struct rte_distributor_single *d)