Blog
Community
Development
Documentation
CNDP
22.08.0
Toggle main menu visibility
Loading...
Searching...
No Matches
txbuff.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright (c) 2019-2022 Intel Corporation.
3
*/
4
5
#ifndef __TXBUFF_H
6
#define __TXBUFF_H
7
17
18
#include <stdint.h>
// for uint16_t, uint32_t
19
#include <
cne_common.h
>
// for CNDP_API, CNE_STD_C11
20
#include <
pktmbuf.h
>
// for pktmbuf_t
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
struct
txbuff
;
27
38
typedef
void (*
txbuff_error_fn
)(
struct
txbuff
*buffer, uint16_t unsent, uint16_t sent);
39
44
typedef
struct
txbuff
{
45
CNE_STD_C11
46
union
{
47
void
*info;
48
uint16_t lport_id;
49
};
50
txbuff_error_fn
error_cb
;
51
void
*
userdata
;
52
uint32_t
txtype
;
53
uint16_t
size
;
54
uint16_t
length
;
55
pktmbuf_t *
pkts
[];
56
}
txbuff_t
;
57
61
enum
{ TXBUFF_PKTDEV_FLAG = 0, TXBUFF_XSKDEV_FLAG = 1 };
62
69
#define TXBUFF_SIZE(sz) (sizeof(txbuff_t) + (sz) * sizeof(pktmbuf_t *))
70
85
CNDP_API
txbuff_t
*
txbuff_pktdev_create
(uint16_t size,
txbuff_error_fn
cbfn,
void
*cb_arg,
86
uint16_t lport_id);
87
102
CNDP_API
txbuff_t
*
txbuff_xskdev_create
(uint16_t size,
txbuff_error_fn
cbfn,
void
*cb_arg,
103
void
*xinfo);
104
111
CNDP_API
void
txbuff_free
(
txbuff_t
*buffer);
112
135
CNDP_API
int
txbuff_set_err_callback
(
txbuff_t
*buffer,
txbuff_error_fn
callback,
void
*userdata);
136
155
CNDP_API
void
txbuff_drop_callback
(
txbuff_t
*buffer, uint16_t sent, uint16_t unsent);
156
180
CNDP_API
void
txbuff_count_callback
(
txbuff_t
*buffer, uint16_t sent, uint16_t unsent);
181
197
CNDP_API uint16_t
txbuff_flush
(
txbuff_t
*buffer);
198
223
CNDP_API uint16_t
txbuff_add
(
txbuff_t
*buffer, pktmbuf_t *tx_pkt);
224
233
static
inline
int
234
txbuff_count
(
txbuff_t
*buffer)
235
{
236
return
(!buffer) ? -1 : buffer->
length
;
237
}
238
239
#ifdef __cplusplus
240
}
241
#endif
242
243
#endif
/* __TXBUFF_H */
cne_common.h
CNE_STD_C11
#define CNE_STD_C11
Definition
cne_common.h:91
pktmbuf.h
txbuff
Definition
txbuff.h:44
txbuff::error_cb
txbuff_error_fn error_cb
Definition
txbuff.h:50
txbuff::length
uint16_t length
Definition
txbuff.h:54
txbuff::txtype
uint32_t txtype
Definition
txbuff.h:52
txbuff::pkts
pktmbuf_t * pkts[]
Definition
txbuff.h:55
txbuff::size
uint16_t size
Definition
txbuff.h:53
txbuff::userdata
void * userdata
Definition
txbuff.h:51
txbuff_drop_callback
CNDP_API void txbuff_drop_callback(txbuff_t *buffer, uint16_t sent, uint16_t unsent)
txbuff_pktdev_create
CNDP_API txbuff_t * txbuff_pktdev_create(uint16_t size, txbuff_error_fn cbfn, void *cb_arg, uint16_t lport_id)
txbuff_add
CNDP_API uint16_t txbuff_add(txbuff_t *buffer, pktmbuf_t *tx_pkt)
txbuff_count_callback
CNDP_API void txbuff_count_callback(txbuff_t *buffer, uint16_t sent, uint16_t unsent)
txbuff_error_fn
void(*) txbuff_error_fn(struct txbuff *buffer, uint16_t unsent, uint16_t sent)
Definition
txbuff.h:38
txbuff_free
CNDP_API void txbuff_free(txbuff_t *buffer)
txbuff_t
struct txbuff txbuff_t
txbuff_xskdev_create
CNDP_API txbuff_t * txbuff_xskdev_create(uint16_t size, txbuff_error_fn cbfn, void *cb_arg, void *xinfo)
txbuff_set_err_callback
CNDP_API int txbuff_set_err_callback(txbuff_t *buffer, txbuff_error_fn callback, void *userdata)
txbuff_count
static int txbuff_count(txbuff_t *buffer)
Definition
txbuff.h:234
txbuff_flush
CNDP_API uint16_t txbuff_flush(txbuff_t *buffer)
lib
core
txbuff
txbuff.h
Generated by
1.18.0