blob: ad94d1b57fb99cd6ab4a4bfbb31645e389ef6894 (
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
115
116
117
118
119
120
121
122
123
124
|
/* Copyright (c) 2014, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* ODP Packet IO
*/
#ifndef ODP_PACKET_IO_H_
#define ODP_PACKET_IO_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp_std_types.h>
#include <odp_platform_types.h>
#include <odp_buffer_pool.h>
#include <odp_packet.h>
#include <odp_queue.h>
/**
* Open an ODP packet IO instance
*
* @param dev Packet IO device
* @param pool Pool to use for packet IO
*
* @return ODP packet IO handle or ODP_PKTIO_INVALID on error
*/
odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool);
/**
* Close an ODP packet IO instance
*
* @param id ODP packet IO handle
*
* @return 0 on success or -1 on error
*/
int odp_pktio_close(odp_pktio_t id);
/**
* Receive packets
*
* @param id ODP packet IO handle
* @param pkt_table[] Storage for received packets (filled by function)
* @param len Length of pkt_table[], i.e. max number of pkts to receive
*
* @return Number of packets received or -1 on error
*/
int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len);
/**
* Send packets
*
* @param id ODP packet IO handle
* @param pkt_table[] Array of packets to send
* @param len length of pkt_table[]
*
* @return Number of packets sent or -1 on error
*/
int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len);
/**
* Set the default input queue to be associated with a pktio handle
*
* @param id ODP packet IO handle
* @param queue default input queue set
* @return 0 on success or -1 on error
*/
int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue);
/**
* Get default input queue associated with a pktio handle
*
* @param id ODP packet IO handle
*
* @return Default input queue set or ODP_QUEUE_INVALID on error
*/
odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id);
/**
* Remove default input queue (if set)
*
* @param id ODP packet IO handle
*
* @return 0 on success or -1 on error
*/
int odp_pktio_inq_remdef(odp_pktio_t id);
/**
* Query default output queue
*
* @param id ODP packet IO handle
*
* @return Default out queue or ODP_QUEUE_INVALID on error
*/
odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id);
/**
* Defines the maximum length of mac address supported by this platform
*/
#define ODP_MAC_ADDR_MAX_LENGTH ETH_ALEN
/**
* Get mac address of the interface
*
* @param id ODP packet IO handle
* @param mac_addr Storage for Mac address of the packet IO interface
* Storage provided by the caller should be equal
* to ODP_MAC_ADDR_MAX_LENGTH (filled by function)
* @return 0 on success or -1 on error
**/
int odp_pktio_get_mac_addr(odp_pktio_t id, unsigned char *mac_addr);
#ifdef __cplusplus
}
#endif
#endif
|