On 21/01/16 08:21, Savolainen, Petri (Nokia - FI/Espoo) wrote:
-----Original Message-----
From: lng-odp [mailto:[email protected]] On Behalf Of EXT
Zoltan Kiss
Sent: Wednesday, January 20, 2016 6:37 PM
To: [email protected]
Subject: [lng-odp] [PATCH 1/2] linux-generic: packet: hide frame_len
behind accessor
The classification code accesses this variable directly, which prevents
reusing that code e.g. in ODP-DPDK.
Signed-off-by: Zoltan Kiss <[email protected]>
---
platform/linux-generic/include/odp_classification_inlines.h | 5 +++--
platform/linux-generic/include/odp_packet_internal.h | 5 +++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/platform/linux-generic/include/odp_classification_inlines.h
b/platform/linux-generic/include/odp_classification_inlines.h
index e9739aa..e4d87c9 100644
--- a/platform/linux-generic/include/odp_classification_inlines.h
+++ b/platform/linux-generic/include/odp_classification_inlines.h
@@ -24,6 +24,7 @@ extern "C" {
#include <odp/helper/ipsec.h>
#include <odp/helper/udp.h>
#include <odp/helper/tcp.h>
+#include <odp_packet_internal.h>
/* PMR term value verification function
These functions verify the given PMR term value with the value in the
packet
@@ -33,7 +34,7 @@ These following functions return 1 on success and 0 on
failure
static inline int verify_pmr_packet_len(odp_packet_hdr_t *pkt_hdr,
pmr_term_value_t *term_value)
{
- if (term_value->val == (pkt_hdr->frame_len &
+ if (term_value->val == (packet_hdr_len(pkt_hdr) &
term_value->mask))
return 1;
@@ -240,7 +241,7 @@ static inline int verify_pmr_custom_frame(const
uint8_t *pkt_addr,
ODP_ASSERT(val_sz <= ODP_PMR_TERM_BYTES_MAX);
- if (pkt_hdr->frame_len <= offset + val_sz)
+ if (packet_hdr_len(pkt_hdr) <= offset + val_sz)
return 0;
memcpy(&val, pkt_addr + offset, val_sz);
diff --git a/platform/linux-generic/include/odp_packet_internal.h
b/platform/linux-generic/include/odp_packet_internal.h
index 12e9cca..0b2e9d0 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -214,6 +214,11 @@ static inline void pull_tail(odp_packet_hdr_t
*pkt_hdr, size_t len)
pkt_hdr->frame_len -= len;
}
+static inline uint32_t packet_hdr_len(odp_packet_hdr_t* pkt_hdr)
Since it's an accessor for frame length and not header length, better call it
packet_frame_len() or packet_len() (which matches packet_set_len() under).
Makes sense, I'll use packet_len()
-Petri
+{
+ return pkt_hdr->frame_len;
+}
+
static inline void packet_set_len(odp_packet_t pkt, uint32_t len)
{
odp_packet_hdr(pkt)->frame_len = len;
--
1.9.1
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp