DPDK  18.11.11
rte_distributor.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4 
5 #ifndef _RTE_DISTRIBUTOR_H_
6 #define _RTE_DISTRIBUTOR_H_
7 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /* Type of distribution (burst/single) */
21 enum rte_distributor_alg_type {
22  RTE_DIST_ALG_BURST = 0,
23  RTE_DIST_ALG_SINGLE,
24  RTE_DIST_NUM_ALG_TYPES
25 };
26 
27 struct rte_distributor;
28 struct rte_mbuf;
29 
50 struct rte_distributor *
51 rte_distributor_create(const char *name, unsigned int socket_id,
52  unsigned int num_workers,
53  unsigned int alg_type);
54 
55 /* *** APIS to be called on the distributor lcore *** */
56 /*
57  * The following APIs are the public APIs which are designed for use on a
58  * single lcore which acts as the distributor lcore for a given distributor
59  * instance. These functions cannot be called on multiple cores simultaneously
60  * without using locking to protect access to the internals of the distributor.
61  *
62  * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore
63  * for the same distributor instance, otherwise deadlock will result.
64  */
65 
87 int
88 rte_distributor_process(struct rte_distributor *d,
89  struct rte_mbuf **mbufs, unsigned int num_mbufs);
90 
105 int
106 rte_distributor_returned_pkts(struct rte_distributor *d,
107  struct rte_mbuf **mbufs, unsigned int max_mbufs);
108 
120 int
121 rte_distributor_flush(struct rte_distributor *d);
122 
132 void
133 rte_distributor_clear_returns(struct rte_distributor *d);
134 
135 /* *** APIS to be called on the worker lcores *** */
136 /*
137  * The following APIs are the public APIs which are designed for use on
138  * multiple lcores which act as workers for a distributor. Each lcore should use
139  * a unique worker id when requesting packets.
140  *
141  * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore
142  * for the same distributor instance, otherwise deadlock will result.
143  */
144 
165 int
166 rte_distributor_get_pkt(struct rte_distributor *d,
167  unsigned int worker_id, struct rte_mbuf **pkts,
168  struct rte_mbuf **oldpkt, unsigned int retcount);
169 
184 int
185 rte_distributor_return_pkt(struct rte_distributor *d,
186  unsigned int worker_id, struct rte_mbuf **oldpkt, int num);
187 
210 void
211 rte_distributor_request_pkt(struct rte_distributor *d,
212  unsigned int worker_id, struct rte_mbuf **oldpkt,
213  unsigned int count);
214 
234 int
235 rte_distributor_poll_pkt(struct rte_distributor *d,
236  unsigned int worker_id, struct rte_mbuf **mbufs);
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #endif
int rte_distributor_process(struct rte_distributor *d, struct rte_mbuf **mbufs, unsigned int num_mbufs)
int rte_distributor_get_pkt(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **pkts, struct rte_mbuf **oldpkt, unsigned int retcount)
struct rte_distributor * rte_distributor_create(const char *name, unsigned int socket_id, unsigned int num_workers, unsigned int alg_type)
int rte_distributor_returned_pkts(struct rte_distributor *d, struct rte_mbuf **mbufs, unsigned int max_mbufs)
int rte_distributor_return_pkt(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **oldpkt, int num)
void rte_distributor_request_pkt(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **oldpkt, unsigned int count)
int rte_distributor_flush(struct rte_distributor *d)
void rte_distributor_clear_returns(struct rte_distributor *d)
int rte_distributor_poll_pkt(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **mbufs)