blob: 034162fb2d221633c851ad710ed8fde521860d15 (
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
|
/* Copyright (c) 2013, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* ODP packet descriptor - implementation internal
*/
#ifndef ODP_PACKET_INTERNAL_H_
#define ODP_PACKET_INTERNAL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp_align.h>
#include <odp_debug.h>
#include <odp_buffer_internal.h>
#include <odp_packet.h>
#include <odp_packet_io.h>
typedef struct {
uint32_t l2:1;
uint32_t l3:1;
uint32_t l4:1;
uint32_t macsec:1;
uint32_t vlan:1;
uint32_t vlan_double:1;
uint32_t ipv4:1;
uint32_t ipv6:1;
uint32_t ip_frag:1;
uint32_t udp:1;
uint32_t tcp:1;
uint32_t icmp:1;
} proto_flags_t;
typedef struct {
uint32_t frame_len:1;
uint32_t l2_chksum:1;
uint32_t ip_err:1;
uint32_t tcp_err:1;
uint32_t udp_err:1;
} error_flags_t;
typedef struct {
uint32_t calc_l4_chksum:1;
} output_flags_t;
/**
* Internal Packet header
*/
typedef struct odp_packet_hdr_t {
/* common buffer header */
odp_buffer_hdr_t buf_hdr;
proto_flags_t proto_flags;
error_flags_t error_flags;
output_flags_t output_flags;
uint32_t l2_offset;
uint32_t l3_offset;
uint32_t l4_offset;
uint32_t frame_len;
odp_pktio_t input;
uint8_t payload[];
} odp_packet_hdr_t;
ODP_ASSERT(sizeof(odp_packet_hdr_t) == ODP_OFFSETOF(odp_packet_hdr_t, payload),
ODP_PACKET_HDR_T__SIZE_ERR);
/**
* Return the packet header
*/
static inline odp_packet_hdr_t *odp_packet_hdr(odp_packet_t pkt)
{
return (odp_packet_hdr_t *)odp_buf_to_hdr((odp_buffer_t)pkt);
}
/**
* Parse packet and set internal metadata
*/
void odp_packet_parse(odp_packet_t pkt, size_t len, size_t l2_offset);
#ifdef __cplusplus
}
#endif
#endif
|