aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
Diffstat (limited to 'helper')
-rw-r--r--helper/Makefile.am5
-rw-r--r--helper/chksum.c6
-rw-r--r--helper/cuckootable.c1
-rw-r--r--helper/hashtable.c3
-rw-r--r--helper/include/odp/helper/icmp.h11
-rw-r--r--helper/include/odp/helper/ip.h3
-rw-r--r--helper/include/odp/helper/linux.h27
-rw-r--r--helper/include/odp/helper/strong_types.h3
-rw-r--r--helper/include/odp/helper/table.h2
-rw-r--r--helper/include/odp/helper/tcp.h35
-rw-r--r--helper/include/odp/helper/threads.h7
-rw-r--r--helper/iplookuptable.c8
-rw-r--r--helper/lineartable.c3
13 files changed, 76 insertions, 38 deletions
diff --git a/helper/Makefile.am b/helper/Makefile.am
index 5757c7c81..2c5452dcc 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -1,7 +1,7 @@
include $(top_srcdir)/platform/@with_platform@/Makefile.inc
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = $(top_builddir)/pkgconfig/libodphelper-linux-generic.pc
+pkgconfig_DATA = $(top_builddir)/pkgconfig/libodphelper.pc
LIB = $(top_builddir)/lib
AM_CFLAGS += -I$(srcdir)/include
@@ -32,6 +32,9 @@ helperinclude_HEADERS = \
$(srcdir)/include/odp/helper/udp.h
if helper_linux
+helperinclude_HEADERS += \
+ $(srcdir)/include/odp/helper/linux.h
+
helperlinuxincludedir = $(includedir)/odp/helper/linux
helperlinuxinclude_HEADERS = \
$(srcdir)/include/odp/helper/linux/pthread.h \
diff --git a/helper/chksum.c b/helper/chksum.c
index f740618d3..ae70d97e6 100644
--- a/helper/chksum.c
+++ b/helper/chksum.c
@@ -128,7 +128,7 @@ static inline int odph_process_l4_hdr(odp_packet_t odp_pkt,
* should come from the udp header, unlike for TCP where is
* derived. */
l4_len = odp_be_to_cpu_16(udp_hdr_ptr->length);
- pkt_chksum_ptr = &udp_hdr_ptr->chksum;
+ pkt_chksum_ptr = (uint16_t *)(void *)&udp_hdr_ptr->chksum;
pkt_chksum_offset = l4_offset + offsetof(odph_udphdr_t, chksum);
} else if (odp_packet_has_tcp(odp_pkt)) {
tcp_hdr_ptr = (odph_tcphdr_t *)l4_ptr;
@@ -139,7 +139,7 @@ static inline int odph_process_l4_hdr(odp_packet_t odp_pkt,
ODPH_TCPHDR_LEN, tcp_hdr_ptr);
}
- pkt_chksum_ptr = &tcp_hdr_ptr->cksm;
+ pkt_chksum_ptr = (uint16_t *)(void *)&tcp_hdr_ptr->cksm;
pkt_chksum_offset = l4_offset + offsetof(odph_tcphdr_t, cksm);
is_tcp = true;
} else {
@@ -203,7 +203,7 @@ static inline int odph_process_l3_hdr(odp_packet_t odp_pkt,
ipv4_hdr_ptr = &ipv4_hdr;
}
- addrs_ptr = (uint16_t *)&ipv4_hdr_ptr->src_addr;
+ addrs_ptr = (uint16_t *)(void *)&ipv4_hdr_ptr->src_addr;
addrs_len = 2 * ODPH_IPV4ADDR_LEN;
protocol = ipv4_hdr_ptr->proto;
l3_len = odp_be_to_cpu_16(ipv4_hdr_ptr->tot_len);
diff --git a/helper/cuckootable.c b/helper/cuckootable.c
index 80ff49893..0d46300e0 100644
--- a/helper/cuckootable.c
+++ b/helper/cuckootable.c
@@ -256,6 +256,7 @@ odph_cuckoo_table_create(
/* initialize free_slots queue */
odp_queue_param_init(&qparam);
qparam.type = ODP_QUEUE_TYPE_PLAIN;
+ qparam.size = capacity;
snprintf(queue_name, sizeof(queue_name), "fs_%s", name);
queue = odp_queue_create(queue_name, &qparam);
diff --git a/helper/hashtable.c b/helper/hashtable.c
index 9d4114445..f26b18b27 100644
--- a/helper/hashtable.c
+++ b/helper/hashtable.c
@@ -76,8 +76,7 @@ odph_table_t odph_hash_table_create(const char *name, uint32_t capacity,
ODPH_DBG("create para input error!\n");
return NULL;
}
- tbl = (odph_hash_table_imp *)odp_shm_addr(odp_shm_lookup(name));
- if (tbl != NULL) {
+ if (odp_shm_lookup(name) != ODP_SHM_INVALID) {
ODPH_DBG("name already exist\n");
return NULL;
}
diff --git a/helper/include/odp/helper/icmp.h b/helper/include/odp/helper/icmp.h
index e25646ad0..bef967842 100644
--- a/helper/include/odp/helper/icmp.h
+++ b/helper/include/odp/helper/icmp.h
@@ -32,15 +32,18 @@ typedef struct ODP_PACKED {
uint8_t type; /**< message type */
uint8_t code; /**< type sub-code */
odp_u16sum_t chksum; /**< checksum of icmp header */
+ /** Variant mappings of ICMP fields */
union {
+ /** Fields used for ICMP echo msgs */
struct {
- odp_u16be_t id;
- odp_u16be_t sequence;
+ odp_u16be_t id; /**< id */
+ odp_u16be_t sequence; /**< sequence */
} echo; /**< echo datagram */
odp_u32be_t gateway; /**< gateway address */
+ /** Fields used for ICMP frag msgs */
struct {
- odp_u16be_t __unused;
- odp_u16be_t mtu;
+ odp_u16be_t __unused; /**< @internal */
+ odp_u16be_t mtu; /**< mtu */
} frag; /**< path mtu discovery */
} un; /**< icmp sub header */
} odph_icmphdr_t;
diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h
index ba6e675f4..91776fad6 100644
--- a/helper/include/odp/helper/ip.h
+++ b/helper/include/odp/helper/ip.h
@@ -205,13 +205,14 @@ typedef struct ODP_PACKED {
* IP protocol values (IPv4:'proto' or IPv6:'next_hdr')
* @{*/
#define ODPH_IPPROTO_HOPOPTS 0x00 /**< IPv6 hop-by-hop options */
-#define ODPH_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol (1) */
+#define ODPH_IPPROTO_ICMPv4 0x01 /**< Internet Control Message Protocol (1) */
#define ODPH_IPPROTO_TCP 0x06 /**< Transmission Control Protocol (6) */
#define ODPH_IPPROTO_UDP 0x11 /**< User Datagram Protocol (17) */
#define ODPH_IPPROTO_ROUTE 0x2B /**< IPv6 Routing header (43) */
#define ODPH_IPPROTO_FRAG 0x2C /**< IPv6 Fragment (44) */
#define ODPH_IPPROTO_AH 0x33 /**< Authentication Header (51) */
#define ODPH_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */
+#define ODPH_IPPROTO_ICMPv6 0x3A /**< Internet Control Message Protocol (58) */
#define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
/**@}*/
diff --git a/helper/include/odp/helper/linux.h b/helper/include/odp/helper/linux.h
new file mode 100644
index 000000000..396203a27
--- /dev/null
+++ b/helper/include/odp/helper/linux.h
@@ -0,0 +1,27 @@
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * All ODP Linux helpers
+ *
+ */
+
+#ifndef ODP_HELPER_LINUX_H_
+#define ODP_HELPER_LINUX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/helper/linux/process.h>
+#include <odp/helper/linux/pthread.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/helper/include/odp/helper/strong_types.h b/helper/include/odp/helper/strong_types.h
index 13e35a438..501d0f28f 100644
--- a/helper/include/odp/helper/strong_types.h
+++ b/helper/include/odp/helper/strong_types.h
@@ -20,10 +20,11 @@
/** Use strong typing for ODP types */
#ifdef __cplusplus
+/** @internal C++ helper macro for strong typing @param type @return */
#define ODPH_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type
#else
#define odph_handle_t struct { uint8_t unused_dummy_var; } *
-/** C/C++ helper macro for strong typing */
+/** @internal C helper macro for strong typing @param type @return */
#define ODPH_HANDLE_T(type) odph_handle_t type
#endif
diff --git a/helper/include/odp/helper/table.h b/helper/include/odp/helper/table.h
index b3440ef53..96c9c5fe7 100644
--- a/helper/include/odp/helper/table.h
+++ b/helper/include/odp/helper/table.h
@@ -94,7 +94,7 @@ extern "C" {
#define ODPH_TABLE_NAME_LEN 32
#include <odp/helper/strong_types.h>
-/** ODP table handle */
+/** @internal ODPH table handle @return */
typedef ODPH_HANDLE_T(odph_table_t);
/**
diff --git a/helper/include/odp/helper/tcp.h b/helper/include/odp/helper/tcp.h
index fd234e583..e91b52e24 100644
--- a/helper/include/odp/helper/tcp.h
+++ b/helper/include/odp/helper/tcp.h
@@ -32,8 +32,9 @@ typedef struct ODP_PACKED {
odp_u16be_t dst_port; /**< Destination port */
odp_u32be_t seq_no; /**< Sequence number */
odp_u32be_t ack_no; /**< Acknowledgment number */
+ /** Variant maps for TCP header fields */
union {
- odp_u16be_t doffset_flags;
+ odp_u16be_t doffset_flags; /**< TCP Flags aggregate */
#if ODP_BIG_ENDIAN_BITFIELD
struct {
odp_u16be_t rsvd1:8;
@@ -42,14 +43,14 @@ typedef struct ODP_PACKED {
struct {
odp_u16be_t hl:4; /**< Hdr len, in words */
odp_u16be_t rsvd3:4; /**< Reserved */
- odp_u16be_t cwr:1;
- odp_u16be_t ece:1;
- odp_u16be_t urg:1;
- odp_u16be_t ack:1;
- odp_u16be_t psh:1;
- odp_u16be_t rst:1;
- odp_u16be_t syn:1;
- odp_u16be_t fin:1;
+ odp_u16be_t cwr:1; /**< cwr bit */
+ odp_u16be_t ece:1; /**< ece bit */
+ odp_u16be_t urg:1; /**< urg bit */
+ odp_u16be_t ack:1; /**< ack bit */
+ odp_u16be_t psh:1; /**< psh bit */
+ odp_u16be_t rst:1; /**< rst bit */
+ odp_u16be_t syn:1; /**< syn bit */
+ odp_u16be_t fin:1; /**< fin bit */
};
#elif ODP_LITTLE_ENDIAN_BITFIELD
struct {
@@ -59,14 +60,14 @@ typedef struct ODP_PACKED {
struct {
odp_u16be_t rsvd3:4; /**< Reserved */
odp_u16be_t hl:4; /**< Hdr len, in words */
- odp_u16be_t fin:1;
- odp_u16be_t syn:1;
- odp_u16be_t rst:1;
- odp_u16be_t psh:1;
- odp_u16be_t ack:1;
- odp_u16be_t urg:1;
- odp_u16be_t ece:1;
- odp_u16be_t cwr:1;
+ odp_u16be_t fin:1; /**< fin bit */
+ odp_u16be_t syn:1; /**< syn bit */
+ odp_u16be_t rst:1; /**< rst bit */
+ odp_u16be_t psh:1; /**< psh bit */
+ odp_u16be_t ack:1; /**< ack bit */
+ odp_u16be_t urg:1; /**< urg bit */
+ odp_u16be_t ece:1; /**< ece bit */
+ odp_u16be_t cwr:1; /**< cwr bit */
};
#else
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h
index 5682bab99..526f0d489 100644
--- a/helper/include/odp/helper/threads.h
+++ b/helper/include/odp/helper/threads.h
@@ -80,12 +80,15 @@ typedef struct {
odph_odpthread_start_args_t start_args; /**< start arguments */
int cpu; /**< CPU ID */
int last; /**< true if last table entry */
+ /** Variant field mappings for thread/process modes */
union {
- struct { /* for thread implementation */
+ /** For thread implementation */
+ struct {
pthread_t thread_id; /**< Pthread ID */
pthread_attr_t attr; /**< Pthread attributes */
} thread;
- struct { /* for process implementation */
+ /** For process implementation */
+ struct {
pid_t pid; /**< Process ID */
int status; /**< Process state chge status*/
} proc;
diff --git a/helper/iplookuptable.c b/helper/iplookuptable.c
index aae219945..37d31e368 100644
--- a/helper/iplookuptable.c
+++ b/helper/iplookuptable.c
@@ -42,6 +42,10 @@
*/
typedef struct {
union {
+ odp_buffer_t nexthop;
+ void *ptr;
+ };
+ union {
uint8_t u8;
struct {
#if ODP_BYTE_ORDER == ODP_BIG_ENDIAN
@@ -53,10 +57,6 @@ typedef struct {
#endif
};
};
- union {
- odp_buffer_t nexthop;
- void *ptr;
- };
} prefix_entry_t;
#define ENTRY_SIZE (sizeof(prefix_entry_t) + sizeof(odp_buffer_t))
diff --git a/helper/lineartable.c b/helper/lineartable.c
index 32c4956ee..dd4a59958 100644
--- a/helper/lineartable.c
+++ b/helper/lineartable.c
@@ -55,8 +55,7 @@ odph_table_t odph_linear_table_create(const char *name, uint32_t capacity,
return NULL;
}
/* check name confict in shm*/
- tbl = (odph_linear_table_imp *)odp_shm_addr(odp_shm_lookup(name));
- if (tbl != NULL) {
+ if (odp_shm_lookup(name) != ODP_SHM_INVALID) {
ODPH_DBG("name already exist\n");
return NULL;
}