Message ID | 1409683080-6860-1-git-send-email-anders.roxell@linaro.org |
---|---|
State | New |
Headers | show |
Merged, thanks! Maxim. On 09/02/2014 10:38 PM, Anders Roxell wrote: > Signed-off-by: Anders Roxell <anders.roxell@linaro.org> > Acked-by: Petri Savolainen <petri.savolainen@linaro.org> > Reviewed-by: Stuart Haslam <stuart.haslam@arm.com> > --- > .gitignore | 6 +- > configure.ac | 4 +- > doc/doxygen.cfg | 2 +- > example/Makefile.inc | 2 +- > example/generator/odp_generator.c | 142 ++++++++++---------- > example/l2fwd/odp_l2fwd.c | 18 +-- > example/odp_example/odp_example.c | 10 +- > example/packet/odp_pktio.c | 28 ++-- > example/packet_netmap/odp_pktio_netmap.c | 32 ++--- > example/timer/odp_timer_test.c | 10 +- > .../odp_chksum.h => helper/include/odph_chksum.h | 0 > helper/include/odph_eth.h | 87 ++++++++++++ > .../odp_icmp.h => helper/include/odph_icmp.h | 12 +- > .../helper/odp_ip.h => helper/include/odph_ip.h | 70 +++++----- > .../odp_linux.h => helper/include/odph_linux.h | 6 +- > .../include/odph_packet.h | 12 +- > .../odp_ring.h => helper/include/odph_ring.h | 98 +++++++------- > .../helper/odp_udp.h => helper/include/odph_udp.h | 32 ++--- > include/helper/odp_eth.h | 87 ------------ > platform/linux-dpdk/Makefile.am | 16 +-- > platform/linux-dpdk/include/odp_packet_dpdk.h | 4 +- > platform/linux-dpdk/odp_linux.c | 6 +- > platform/linux-dpdk/odp_packet.c | 86 ++++++------ > platform/linux-generic/Makefile.am | 16 +-- > platform/linux-generic/include/api/odp_align.h | 2 +- > platform/linux-generic/odp_crypto.c | 4 +- > platform/linux-generic/odp_linux.c | 8 +- > platform/linux-generic/odp_packet.c | 86 ++++++------ > platform/linux-generic/odp_packet_netmap.c | 20 +-- > platform/linux-generic/odp_packet_socket.c | 42 +++--- > platform/linux-generic/odp_ring.c | 148 +++++++++++---------- > platform/linux-keystone2/Makefile.am | 16 +-- > platform/linux-keystone2/odp_packet.c | 86 ++++++------ > test/Makefile.inc | 2 +- > test/api_test/odp_atomic_test.h | 2 +- > test/api_test/odp_common.c | 10 +- > test/api_test/odp_ring_test.c | 76 +++++------ > test/api_test/odp_timer_ping.c | 12 +- > 38 files changed, 654 insertions(+), 646 deletions(-) > rename include/helper/odp_chksum.h => helper/include/odph_chksum.h (100%) > create mode 100644 helper/include/odph_eth.h > rename include/helper/odp_icmp.h => helper/include/odph_icmp.h (93%) > rename include/helper/odp_ip.h => helper/include/odph_ip.h (57%) > rename include/helper/odp_linux.h => helper/include/odph_linux.h (88%) > rename include/helper/odp_packet_helper.h => helper/include/odph_packet.h (83%) > rename include/helper/odp_ring.h => helper/include/odph_ring.h (87%) > rename include/helper/odp_udp.h => helper/include/odph_udp.h (74%) > delete mode 100644 include/helper/odp_eth.h > > diff --git a/.gitignore b/.gitignore > index 39c8d77..6a97f17 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -14,15 +14,15 @@ config.guess > config.sub > configure > depcomp > -include/config.h.in > install-sh > ltmain.sh > m4/*.m4 > missing > config.log > config.status > -include/config.h > -include/stamp-h1 > +helper/config.h.in > +helper/config.h > +helper/stamp-h1 > libtool > pkgconfig/libodp.pc > .deps/ > diff --git a/configure.ac b/configure.ac > index e33e1a5..76cf638 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1,8 +1,8 @@ > AC_PREREQ([2.5]) > AC_INIT([OpenDataPlane], [0.2], [lng-odp@lists.linaro.org]) > AM_INIT_AUTOMAKE([subdir-objects]) > -AC_CONFIG_SRCDIR([include/config.h.in]) > -AM_CONFIG_HEADER([include/config.h]) > +AC_CONFIG_SRCDIR([helper/config.h.in]) > +AM_CONFIG_HEADER([helper/config.h]) > > AC_USE_SYSTEM_EXTENSIONS > AC_SYS_LARGEFILE > diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg > index 939b237..5d1e191 100644 > --- a/doc/doxygen.cfg > +++ b/doc/doxygen.cfg > @@ -9,7 +9,7 @@ TYPEDEF_HIDES_STRUCT = YES > EXTRACT_STATIC = YES > SORT_MEMBER_DOCS = NO > WARN_NO_PARAMDOC = YES > -INPUT = $(SRCDIR)/doc $(SRCDIR)/doc/users-guide $(SRCDIR)/doc/api $(SRCDIR)/platform/linux-generic/include/api $(SRCDIR)/include/helper $(SRCDIR)/example > +INPUT = $(SRCDIR)/doc $(SRCDIR)/doc/users-guide $(SRCDIR)/doc/api $(SRCDIR)/platform/linux-generic/include/api $(SRCDIR)/helper/include $(SRCDIR)/example > FILE_PATTERNS = odp*.h odp*.c *.dox > RECURSIVE = YES > SOURCE_BROWSER = YES > diff --git a/example/Makefile.inc b/example/Makefile.inc > index b549001..4de2feb 100644 > --- a/example/Makefile.inc > +++ b/example/Makefile.inc > @@ -5,6 +5,6 @@ AM_CFLAGS += \ > -I$(srcdir) \ > -I$(top_srcdir)/platform/@with_platform@/include/api \ > -I$(top_srcdir)/platform/linux-generic/include/api \ > - -I$(top_srcdir)/include > + -I$(top_srcdir)/helper/include > > AM_LDFLAGS += -L$(LIB) > diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c > index 9fa9b37..65c2034 100644 > --- a/example/generator/odp_generator.c > +++ b/example/generator/odp_generator.c > @@ -18,12 +18,12 @@ > > #include <odp.h> > #include <odp_packet_io.h> > -#include <helper/odp_linux.h> > -#include <helper/odp_packet_helper.h> > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > -#include <helper/odp_udp.h> > -#include <helper/odp_icmp.h> > +#include <odph_linux.h> > +#include <odph_packet.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > +#include <odph_udp.h> > +#include <odph_icmp.h> > > #define MAX_WORKERS 32 /**< max number of works */ > #define SHM_PKT_POOL_SIZE (512*2048) /**< pkt pool size */ > @@ -47,8 +47,8 @@ typedef struct { > int if_count; /**< Number of interfaces to be used */ > char **if_names; /**< Array of pointers to interface names */ > odp_buffer_pool_t pool; /**< Buffer pool for packet IO */ > - odp_ethaddr_t srcmac; /**< src mac addr */ > - odp_ethaddr_t dstmac; /**< dest mac addr */ > + odph_ethaddr_t srcmac; /**< src mac addr */ > + odph_ethaddr_t dstmac; /**< dest mac addr */ > unsigned int srcip; /**< src ip addr */ > unsigned int dstip; /**< dest ip addr */ > int mode; /**< work mode */ > @@ -94,7 +94,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args); > static void print_info(char *progname, appl_args_t *appl_args); > static void usage(char *progname); > static int scan_ip(char *buf, unsigned int *paddr); > -static int scan_mac(char *in, odp_ethaddr_t *des); > +static int scan_mac(char *in, odph_ethaddr_t *des); > static void tv_sub(struct timeval *recvtime, struct timeval *sendtime); > > /** > @@ -146,7 +146,7 @@ static int scan_ip(char *buf, unsigned int *paddr) > * @param des mac for odp_packet > * @return 1 success, 0 failed > */ > -static int scan_mac(char *in, odp_ethaddr_t *des) > +static int scan_mac(char *in, odph_ethaddr_t *des) > { > int field; > int i; > @@ -173,9 +173,9 @@ static void pack_udp_pkt(odp_buffer_t obuf) > char *buf; > int max; > odp_packet_t pkt; > - odp_ethhdr_t *eth; > - odp_ipv4hdr_t *ip; > - odp_udphdr_t *udp; > + odph_ethhdr_t *eth; > + odph_ipv4hdr_t *ip; > + odph_udphdr_t *udp; > unsigned short seq; > > buf = odp_buffer_addr(obuf); > @@ -188,33 +188,33 @@ static void pack_udp_pkt(odp_buffer_t obuf) > pkt = odp_packet_from_buffer(obuf); > /* ether */ > odp_packet_set_l2_offset(pkt, 0); > - eth = (odp_ethhdr_t *)buf; > - memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODP_ETHADDR_LEN); > - memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODP_ETHADDR_LEN); > - eth->type = odp_cpu_to_be_16(ODP_ETHTYPE_IPV4); > + eth = (odph_ethhdr_t *)buf; > + memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODPH_ETHADDR_LEN); > + memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODPH_ETHADDR_LEN); > + eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); > /* ip */ > - odp_packet_set_l3_offset(pkt, ODP_ETHHDR_LEN); > - ip = (odp_ipv4hdr_t *)(buf + ODP_ETHHDR_LEN); > + odp_packet_set_l3_offset(pkt, ODPH_ETHHDR_LEN); > + ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); > ip->dst_addr = odp_cpu_to_be_32(args->appl.dstip); > ip->src_addr = odp_cpu_to_be_32(args->appl.srcip); > - ip->ver_ihl = ODP_IPV4 << 4 | ODP_IPV4HDR_IHL_MIN; > - ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODP_UDPHDR_LEN + > - ODP_IPV4HDR_LEN); > - ip->proto = ODP_IPPROTO_UDP; > + ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN; > + ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODPH_UDPHDR_LEN + > + ODPH_IPV4HDR_LEN); > + ip->proto = ODPH_IPPROTO_UDP; > seq = odp_atomic_fetch_add_u64(&counters.seq, 1) % 0xFFFF; > ip->id = odp_cpu_to_be_16(seq); > ip->chksum = 0; > - odp_ipv4_csum_update(pkt); > + odph_ipv4_csum_update(pkt); > /* udp */ > - odp_packet_set_l4_offset(pkt, ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN); > - udp = (odp_udphdr_t *)(buf + ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN); > + odp_packet_set_l4_offset(pkt, ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); > + udp = (odph_udphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); > udp->src_port = 0; > udp->dst_port = 0; > - udp->length = odp_cpu_to_be_16(args->appl.payload + ODP_UDPHDR_LEN); > + udp->length = odp_cpu_to_be_16(args->appl.payload + ODPH_UDPHDR_LEN); > udp->chksum = 0; > - udp->chksum = odp_cpu_to_be_16(odp_ipv4_udp_chksum(pkt)); > - odp_packet_set_len(pkt, args->appl.payload + ODP_UDPHDR_LEN + > - ODP_IPV4HDR_LEN + ODP_ETHHDR_LEN); > + udp->chksum = odp_cpu_to_be_16(odph_ipv4_udp_chksum(pkt)); > + odp_packet_set_len(pkt, args->appl.payload + ODPH_UDPHDR_LEN + > + ODPH_IPV4HDR_LEN + ODPH_ETHHDR_LEN); > } > > /** > @@ -227,9 +227,9 @@ static void pack_icmp_pkt(odp_buffer_t obuf) > char *buf; > int max; > odp_packet_t pkt; > - odp_ethhdr_t *eth; > - odp_ipv4hdr_t *ip; > - odp_icmphdr_t *icmp; > + odph_ethhdr_t *eth; > + odph_ipv4hdr_t *ip; > + odph_icmphdr_t *icmp; > struct timeval tval; > uint8_t *tval_d; > unsigned short seq; > @@ -245,41 +245,41 @@ static void pack_icmp_pkt(odp_buffer_t obuf) > pkt = odp_packet_from_buffer(obuf); > /* ether */ > odp_packet_set_l2_offset(pkt, 0); > - eth = (odp_ethhdr_t *)buf; > - memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODP_ETHADDR_LEN); > - memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODP_ETHADDR_LEN); > - eth->type = odp_cpu_to_be_16(ODP_ETHTYPE_IPV4); > + eth = (odph_ethhdr_t *)buf; > + memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODPH_ETHADDR_LEN); > + memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODPH_ETHADDR_LEN); > + eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); > /* ip */ > - odp_packet_set_l3_offset(pkt, ODP_ETHHDR_LEN); > - ip = (odp_ipv4hdr_t *)(buf + ODP_ETHHDR_LEN); > + odp_packet_set_l3_offset(pkt, ODPH_ETHHDR_LEN); > + ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); > ip->dst_addr = odp_cpu_to_be_32(args->appl.dstip); > ip->src_addr = odp_cpu_to_be_32(args->appl.srcip); > - ip->ver_ihl = ODP_IPV4 << 4 | ODP_IPV4HDR_IHL_MIN; > - ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODP_ICMPHDR_LEN + > - ODP_IPV4HDR_LEN); > - ip->proto = ODP_IPPROTO_ICMP; > + ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN; > + ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODPH_ICMPHDR_LEN + > + ODPH_IPV4HDR_LEN); > + ip->proto = ODPH_IPPROTO_ICMP; > seq = odp_atomic_fetch_add_u64(&counters.seq, 1) % 0xffff; > ip->id = odp_cpu_to_be_16(seq); > ip->chksum = 0; > - odp_ipv4_csum_update(pkt); > + odph_ipv4_csum_update(pkt); > /* icmp */ > - icmp = (odp_icmphdr_t *)(buf + ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN); > + icmp = (odph_icmphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); > icmp->type = ICMP_ECHO; > icmp->code = 0; > icmp->un.echo.id = 0; > icmp->un.echo.sequence = ip->id; > - tval_d = (uint8_t *)(buf + ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN + > - ODP_ICMPHDR_LEN); > + tval_d = (uint8_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN + > + ODPH_ICMPHDR_LEN); > /* TODO This should be changed to use an > * ODP timer API once one exists. */ > gettimeofday(&tval, NULL); > memcpy(tval_d, &tval, sizeof(struct timeval)); > icmp->chksum = 0; > icmp->chksum = odp_chksum(icmp, args->appl.payload + > - ODP_ICMPHDR_LEN); > + ODPH_ICMPHDR_LEN); > > - odp_packet_set_len(pkt, args->appl.payload + ODP_ICMPHDR_LEN + > - ODP_IPV4HDR_LEN + ODP_ETHHDR_LEN); > + odp_packet_set_len(pkt, args->appl.payload + ODPH_ICMPHDR_LEN + > + ODPH_IPV4HDR_LEN + ODPH_ETHHDR_LEN); > } > > /** > @@ -380,9 +380,9 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) > { > odp_packet_t pkt; > char *buf; > - odp_ipv4hdr_t *ip; > - odp_udphdr_t *udp; > - odp_icmphdr_t *icmp; > + odph_ipv4hdr_t *ip; > + odph_udphdr_t *udp; > + odph_icmphdr_t *icmp; > struct timeval tvrecv; > struct timeval tvsend; > double rtt; > @@ -401,27 +401,27 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) > odp_atomic_inc_u64(&counters.ip); > rlen += sprintf(msg, "receive Packet proto:IP "); > buf = odp_buffer_addr(odp_buffer_from_packet(pkt)); > - ip = (odp_ipv4hdr_t *)(buf + odp_packet_l3_offset(pkt)); > + ip = (odph_ipv4hdr_t *)(buf + odp_packet_l3_offset(pkt)); > rlen += sprintf(msg + rlen, "id %d ", > odp_be_to_cpu_16(ip->id)); > offset = odp_packet_l4_offset(pkt); > > /* udp */ > - if (ip->proto == ODP_IPPROTO_UDP) { > + if (ip->proto == ODPH_IPPROTO_UDP) { > odp_atomic_inc_u64(&counters.udp); > - udp = (odp_udphdr_t *)(buf + offset); > + udp = (odph_udphdr_t *)(buf + offset); > rlen += sprintf(msg + rlen, "UDP payload %d ", > odp_be_to_cpu_16(udp->length) - > - ODP_UDPHDR_LEN); > + ODPH_UDPHDR_LEN); > } > > /* icmp */ > - if (ip->proto == ODP_IPPROTO_ICMP) { > - icmp = (odp_icmphdr_t *)(buf + offset); > + if (ip->proto == ODPH_IPPROTO_ICMP) { > + icmp = (odph_icmphdr_t *)(buf + offset); > /* echo reply */ > if (icmp->type == ICMP_ECHOREPLY) { > odp_atomic_inc_u64(&counters.icmp); > - memcpy(&tvsend, buf + offset + ODP_ICMPHDR_LEN, > + memcpy(&tvsend, buf + offset + ODPH_ICMPHDR_LEN, > sizeof(struct timeval)); > /* TODO This should be changed to use an > * ODP timer API once one exists. */ > @@ -499,13 +499,13 @@ static void *gen_recv_thread(void *arg) > pkt = odp_packet_from_buffer(buf); > /* Drop packets with errors */ > if (odp_unlikely(odp_packet_error(pkt))) { > - odp_packet_free(pkt); > + odph_packet_free(pkt); > continue; > } > > print_pkts(thr, &pkt, 1); > > - odp_packet_free(pkt); > + odph_packet_free(pkt); > } > > return arg; > @@ -515,7 +515,7 @@ static void *gen_recv_thread(void *arg) > */ > int main(int argc, char *argv[]) > { > - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; > + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; > odp_buffer_pool_t pool; > int thr_id; > int num_workers; > @@ -606,14 +606,14 @@ int main(int argc, char *argv[]) > args->thread[1].pktio_dev = args->appl.if_names[0]; > args->thread[1].pool = pool; > args->thread[1].mode = args->appl.mode; > - odp_linux_pthread_create(&thread_tbl[1], 1, 0, > - gen_recv_thread, &args->thread[1]); > + odph_linux_pthread_create(&thread_tbl[1], 1, 0, > + gen_recv_thread, &args->thread[1]); > > args->thread[0].pktio_dev = args->appl.if_names[0]; > args->thread[0].pool = pool; > args->thread[0].mode = args->appl.mode; > - odp_linux_pthread_create(&thread_tbl[0], 1, 0, > - gen_send_thread, &args->thread[0]); > + odph_linux_pthread_create(&thread_tbl[0], 1, 0, > + gen_send_thread, &args->thread[0]); > > /* only wait send thread to join */ > num_workers = 1; > @@ -644,14 +644,14 @@ int main(int argc, char *argv[]) > * because each thread might get different arguments. > * Calls odp_thread_create(cpu) for each thread > */ > - odp_linux_pthread_create(&thread_tbl[i], 1, > - core, thr_run_func, > - &args->thread[i]); > + odph_linux_pthread_create(&thread_tbl[i], 1, > + core, thr_run_func, > + &args->thread[i]); > } > } > > /* Master thread waits for other threads to exit */ > - odp_linux_pthread_join(thread_tbl, num_workers); > + odph_linux_pthread_join(thread_tbl, num_workers); > printf("Exit\n\n"); > > return 0; > diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c > index d74449a..6a38c1b 100644 > --- a/example/l2fwd/odp_l2fwd.c > +++ b/example/l2fwd/odp_l2fwd.c > @@ -16,10 +16,10 @@ > #include <unistd.h> > > #include <odp.h> > -#include <helper/odp_linux.h> > -#include <helper/odp_packet_helper.h> > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > +#include <odph_linux.h> > +#include <odph_packet.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > > /** @def MAX_WORKERS > * @brief Maximum number of worker threads > @@ -313,7 +313,7 @@ static void *pktio_ifburst_thread(void *arg) > */ > int main(int argc, char *argv[]) > { > - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; > + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; > odp_buffer_pool_t pool; > int thr_id; > void *pool_base; > @@ -446,12 +446,12 @@ int main(int argc, char *argv[]) > thr_run_func = pktio_ifburst_thread; > else /* APPL_MODE_PKT_QUEUE */ > thr_run_func = pktio_queue_thread; > - odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, > - &gbl_args->thread[i]); > + odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, > + &gbl_args->thread[i]); > } > > /* Master thread waits for other threads to exit */ > - odp_linux_pthread_join(thread_tbl, num_workers); > + odph_linux_pthread_join(thread_tbl, num_workers); > > printf("Exit\n\n"); > > @@ -479,7 +479,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) > pkt = pkt_tbl[i]; > > if (odp_unlikely(odp_packet_error(pkt))) { > - odp_packet_free(pkt); /* Drop */ > + odph_packet_free(pkt); /* Drop */ > pkt_cnt--; > } else if (odp_unlikely(i != j++)) { > pkt_tbl[j-1] = pkt; > diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c > index f0bdf29..40d237b 100644 > --- a/example/odp_example/odp_example.c > +++ b/example/odp_example/odp_example.c > @@ -17,7 +17,7 @@ > #include <odp.h> > > /* ODP helper for Linux apps */ > -#include <helper/odp_linux.h> > +#include <odph_linux.h> > > /* Needs librt*/ > #include <time.h> > @@ -933,7 +933,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) > */ > int main(int argc, char *argv[]) > { > - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; > + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; > test_args_t args; > int thr_id; > int num_workers; > @@ -1067,11 +1067,11 @@ int main(int argc, char *argv[]) > odp_barrier_init_count(&test_barrier, num_workers); > > /* Create and launch worker threads */ > - odp_linux_pthread_create(thread_tbl, num_workers, first_core, > - run_thread, NULL); > + odph_linux_pthread_create(thread_tbl, num_workers, first_core, > + run_thread, NULL); > > /* Wait for worker threads to exit */ > - odp_linux_pthread_join(thread_tbl, num_workers); > + odph_linux_pthread_join(thread_tbl, num_workers); > > printf("ODP example complete\n\n"); > > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c > index f247bd0..88ce575 100644 > --- a/example/packet/odp_pktio.c > +++ b/example/packet/odp_pktio.c > @@ -16,10 +16,10 @@ > #include <unistd.h> > > #include <odp.h> > -#include <helper/odp_linux.h> > -#include <helper/odp_packet_helper.h> > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > +#include <odph_linux.h> > +#include <odph_packet.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > > /** @def MAX_WORKERS > * @brief Maximum number of worker threads > @@ -301,7 +301,7 @@ static void *pktio_ifburst_thread(void *arg) > */ > int main(int argc, char *argv[]) > { > - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; > + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; > odp_buffer_pool_t pool; > int thr_id; > int num_workers; > @@ -401,12 +401,12 @@ int main(int argc, char *argv[]) > * because each thread might get different arguments. > * Calls odp_thread_create(cpu) for each thread > */ > - odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, > - &args->thread[i]); > + odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, > + &args->thread[i]); > } > > /* Master thread waits for other threads to exit */ > - odp_linux_pthread_join(thread_tbl, num_workers); > + odph_linux_pthread_join(thread_tbl, num_workers); > > printf("Exit\n\n"); > > @@ -434,7 +434,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) > pkt = pkt_tbl[i]; > > if (odp_unlikely(odp_packet_error(pkt))) { > - odp_packet_free(pkt); /* Drop */ > + odph_packet_free(pkt); /* Drop */ > pkt_cnt--; > } else if (odp_unlikely(i != j++)) { > pkt_tbl[j-1] = pkt; > @@ -454,16 +454,16 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) > static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) > { > odp_packet_t pkt; > - odp_ethhdr_t *eth; > - odp_ethaddr_t tmp_addr; > - odp_ipv4hdr_t *ip; > + odph_ethhdr_t *eth; > + odph_ethaddr_t tmp_addr; > + odph_ipv4hdr_t *ip; > uint32be_t ip_tmp_addr; /* tmp ip addr */ > unsigned i; > > for (i = 0; i < len; ++i) { > pkt = pkt_tbl[i]; > if (odp_packet_inflag_eth(pkt)) { > - eth = (odp_ethhdr_t *)odp_packet_l2(pkt); > + eth = (odph_ethhdr_t *)odp_packet_l2(pkt); > > tmp_addr = eth->dst; > eth->dst = eth->src; > @@ -471,7 +471,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) > > if (odp_packet_inflag_ipv4(pkt)) { > /* IPv4 */ > - ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt); > + ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); > > ip_tmp_addr = ip->src_addr; > ip->src_addr = ip->dst_addr; > diff --git a/example/packet_netmap/odp_pktio_netmap.c b/example/packet_netmap/odp_pktio_netmap.c > index c0eb202..cc2607b 100644 > --- a/example/packet_netmap/odp_pktio_netmap.c > +++ b/example/packet_netmap/odp_pktio_netmap.c > @@ -21,11 +21,11 @@ > #include <arpa/inet.h> > > #include <odp.h> > -#include <helper/odp_linux.h> > -#include <helper/odp_packet_helper.h> > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > -#include <helper/odp_packet_helper.h> > +#include <odph_linux.h> > +#include <odph_packet.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > +#include <odph_packet.h> > > #include <odp_pktio_netmap.h> > > @@ -194,7 +194,7 @@ static void *pktio_queue_thread(void *arg) > > if (odp_packet_copy(pkt_copy, pkt) != 0) { > ODP_ERR("Packet copy failed!\n"); > - odp_packet_free(pkt_copy); > + odph_packet_free(pkt_copy); > } else { > swap_pkt_addrs(&pkt_copy, 1); > odp_queue_enq(outq_def, > @@ -219,7 +219,7 @@ static void *pktio_queue_thread(void *arg) > */ > int main(int argc, char *argv[]) > { > - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; > + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; > odp_buffer_pool_t pool; > int thr_id; > int num_workers; > @@ -360,12 +360,12 @@ int main(int argc, char *argv[]) > * Create threads one-by-one instead of all-at-once, > * because each thread might get different arguments > */ > - odp_linux_pthread_create(&thread_tbl[i], 1, i, > - pktio_queue_thread, NULL); > + odph_linux_pthread_create(&thread_tbl[i], 1, i, > + pktio_queue_thread, NULL); > } > > /* Master thread waits for other threads to exit */ > - odp_linux_pthread_join(thread_tbl, num_workers); > + odph_linux_pthread_join(thread_tbl, num_workers); > > printf("Exit\n\n"); > > @@ -393,7 +393,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) > pkt = pkt_tbl[i]; > > if (odp_unlikely(odp_packet_error(pkt))) { > - odp_packet_free(pkt); /* Drop */ > + odph_packet_free(pkt); /* Drop */ > pkt_cnt--; > } else if (odp_unlikely(i != j++)) { > pkt_tbl[j-1] = pkt; > @@ -412,16 +412,16 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) > static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) > { > odp_packet_t pkt; > - odp_ethhdr_t *eth; > - odp_ethaddr_t tmp_addr; > - odp_ipv4hdr_t *ip; > + odph_ethhdr_t *eth; > + odph_ethaddr_t tmp_addr; > + odph_ipv4hdr_t *ip; > uint32be_t ip_tmp_addr; /* tmp ip addr */ > unsigned i; > > for (i = 0; i < len; ++i) { > pkt = pkt_tbl[i]; > if (odp_packet_inflag_eth(pkt)) { > - eth = (odp_ethhdr_t *)odp_packet_l2(pkt); > + eth = (odph_ethhdr_t *)odp_packet_l2(pkt); > > tmp_addr = eth->dst; > eth->dst = eth->src; > @@ -429,7 +429,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) > > if (odp_packet_inflag_ipv4(pkt)) { > /* IPv4 */ > - ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt); > + ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); > > ip_tmp_addr = ip->src_addr; > ip->src_addr = ip->dst_addr; > diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c > index bf1d7df..4168856 100644 > --- a/example/timer/odp_timer_test.c > +++ b/example/timer/odp_timer_test.c > @@ -17,7 +17,7 @@ > #include <odp.h> > > /* ODP helper for Linux apps */ > -#include <helper/odp_linux.h> > +#include <odph_linux.h> > > /* GNU lib C */ > #include <getopt.h> > @@ -242,7 +242,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) > */ > int main(int argc, char *argv[]) > { > - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; > + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; > test_args_t args; > int thr_id; > int num_workers; > @@ -373,11 +373,11 @@ int main(int argc, char *argv[]) > odp_barrier_init_count(&test_barrier, num_workers); > > /* Create and launch worker threads */ > - odp_linux_pthread_create(thread_tbl, num_workers, first_core, > - run_thread, &args); > + odph_linux_pthread_create(thread_tbl, num_workers, first_core, > + run_thread, &args); > > /* Wait for worker threads to exit */ > - odp_linux_pthread_join(thread_tbl, num_workers); > + odph_linux_pthread_join(thread_tbl, num_workers); > > printf("ODP timer test complete\n\n"); > > diff --git a/include/helper/odp_chksum.h b/helper/include/odph_chksum.h > similarity index 100% > rename from include/helper/odp_chksum.h > rename to helper/include/odph_chksum.h > diff --git a/helper/include/odph_eth.h b/helper/include/odph_eth.h > new file mode 100644 > index 0000000..55a2b1e > --- /dev/null > +++ b/helper/include/odph_eth.h > @@ -0,0 +1,87 @@ > +/* Copyright (c) 2014, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > + > +/** > + * @file > + * > + * ODP ethernet header > + */ > + > +#ifndef ODPH_ETH_H_ > +#define ODPH_ETH_H_ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include <odp_std_types.h> > +#include <odp_byteorder.h> > +#include <odp_align.h> > +#include <odp_debug.h> > + > +#define ODPH_ETHADDR_LEN 6 /**< Ethernet address length */ > +#define ODPH_ETHHDR_LEN 14 /**< Ethernet header length */ > +#define ODPH_VLANHDR_LEN 4 /**< VLAN header length */ > +#define ODPH_ETH_LEN_MIN 60 /**< Min frame length (excl. CRC 4 bytes) */ > +#define ODPH_ETH_LEN_MIN_CRC 64 /**< Min frame length (incl. CRC 4 bytes) */ > +#define ODPH_ETH_LEN_MAX 1514 /**< Max frame length (excl. CRC 4 bytes) */ > +#define ODPH_ETH_LEN_MAX_CRC 1518 /**< Max frame length (incl. CRC 4 bytes) */ > + > +/** > + * Ethernet MAC address > + */ > +typedef struct ODPH_PACKED { > + uint8_t addr[ODPH_ETHADDR_LEN]; /**< @private Address */ > +} odph_ethaddr_t; > + > +/** @internal Compile time assert */ > +ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == ODPH_ETHADDR_LEN, "ODPH_ETHADDR_T__SIZE_ERROR"); > + > +/** > + * Ethernet header > + */ > +typedef struct ODPH_PACKED { > + odph_ethaddr_t dst; /**< Destination address */ > + odph_ethaddr_t src; /**< Source address */ > + uint16be_t type; /**< Type */ > +} odph_ethhdr_t; > + > +/** @internal Compile time assert */ > +ODP_STATIC_ASSERT(sizeof(odph_ethhdr_t) == ODPH_ETHHDR_LEN, "ODPH_ETHHDR_T__SIZE_ERROR"); > + > +/** > + * VLAN header > + * > + * @todo Check usage of tpid vs ethertype. Check outer VLAN TPID. > + */ > +typedef struct ODPH_PACKED { > + uint16be_t tpid; /**< Tag protocol ID (located after ethhdr.src) */ > + uint16be_t tci; /**< Priority / CFI / VLAN ID */ > +} odph_vlanhdr_t; > + > +/** @internal Compile time assert */ > +ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN, "ODPH_VLANHDR_T__SIZE_ERROR"); > + > + > +/* Ethernet header Ether Type ('type') values, a selected few */ > +#define ODPH_ETHTYPE_IPV4 0x0800 /**< Internet Protocol version 4 */ > +#define ODPH_ETHTYPE_ARP 0x0806 /**< Address Resolution Protocol */ > +#define ODPH_ETHTYPE_RARP 0x8035 /**< Reverse Address Resolution Protocol*/ > +#define ODPH_ETHTYPE_VLAN 0x8100 /**< VLAN-tagged frame IEEE 802.1Q */ > +#define ODPH_ETHTYPE_VLAN_OUTER 0x88A8 /**< Stacked VLANs/QinQ, outer-tag/S-TAG*/ > +#define ODPH_ETHTYPE_IPV6 0x86dd /**< Internet Protocol version 6 */ > +#define ODPH_ETHTYPE_FLOW_CTRL 0x8808 /**< Ethernet flow control */ > +#define ODPH_ETHTYPE_MPLS 0x8847 /**< MPLS unicast */ > +#define ODPH_ETHTYPE_MPLS_MCAST 0x8848 /**< MPLS multicast */ > +#define ODPH_ETHTYPE_MACSEC 0x88E5 /**< MAC security IEEE 802.1AE */ > +#define ODPH_ETHTYPE_1588 0x88F7 /**< Precision Time Protocol IEEE 1588 */ > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif > diff --git a/include/helper/odp_icmp.h b/helper/include/odph_icmp.h > similarity index 93% > rename from include/helper/odp_icmp.h > rename to helper/include/odph_icmp.h > index 5ac88b9..8414d7e 100644 > --- a/include/helper/odp_icmp.h > +++ b/helper/include/odph_icmp.h > @@ -11,8 +11,8 @@ > * ODP ICMP header > */ > > -#ifndef ODP_ICMP_H_ > -#define ODP_ICMP_H_ > +#ifndef ODPH_ICMP_H_ > +#define ODPH_ICMP_H_ > > #ifdef __cplusplus > extern "C" { > @@ -23,10 +23,10 @@ extern "C" { > #include <odp_byteorder.h> > > /** ICMP header length */ > -#define ODP_ICMPHDR_LEN 8 > +#define ODPH_ICMPHDR_LEN 8 > > /** ICMP header */ > -typedef struct ODP_PACKED { > +typedef struct ODPH_PACKED { > uint8_t type; /**< message type */ > uint8_t code; /**< type sub-code */ > uint16sum_t chksum; /**< checksum of icmp header */ > @@ -41,7 +41,7 @@ typedef struct ODP_PACKED { > uint16be_t mtu; > } frag; /**< path mtu discovery */ > } un; /**< icmp sub header */ > -} odp_icmphdr_t; > +} odph_icmphdr_t; > > #define ICMP_ECHOREPLY 0 /**< Echo Reply */ > #define ICMP_DEST_UNREACH 3 /**< Destination Unreachable */ > @@ -90,7 +90,7 @@ typedef struct ODP_PACKED { > exceeded*/ > > /** @internal Compile time assert */ > -ODP_STATIC_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN, "ODP_ICMPHDR_T__SIZE_ERROR"); > +ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN, "ODPH_ICMPHDR_T__SIZE_ERROR"); > > #ifdef __cplusplus > } > diff --git a/include/helper/odp_ip.h b/helper/include/odph_ip.h > similarity index 57% > rename from include/helper/odp_ip.h > rename to helper/include/odph_ip.h > index fb04e4d..ca71c44 100644 > --- a/include/helper/odp_ip.h > +++ b/helper/include/odph_ip.h > @@ -11,8 +11,8 @@ > * ODP IP header > */ > > -#ifndef ODP_IP_H_ > -#define ODP_IP_H_ > +#ifndef ODPH_IP_H_ > +#define ODPH_IP_H_ > > #ifdef __cplusplus > extern "C" { > @@ -21,34 +21,34 @@ extern "C" { > #include <odp_align.h> > #include <odp_debug.h> > #include <odp_byteorder.h> > -#include <helper/odp_chksum.h> > +#include <odph_chksum.h> > > #include <string.h> > > -#define ODP_IPV4 4 /**< IP version 4 */ > -#define ODP_IPV4HDR_LEN 20 /**< Min length of IP header (no options) */ > -#define ODP_IPV4HDR_IHL_MIN 5 /**< Minimum IHL value*/ > +#define ODPH_IPV4 4 /**< IP version 4 */ > +#define ODPH_IPV4HDR_LEN 20 /**< Min length of IP header (no options) */ > +#define ODPH_IPV4HDR_IHL_MIN 5 /**< Minimum IHL value*/ > > /** @internal Returns IPv4 version */ > -#define ODP_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4) > +#define ODPH_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4) > > /** @internal Returns IPv4 header length */ > -#define ODP_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f) > +#define ODPH_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f) > > /** @internal Returns IPv4 Don't fragment */ > -#define ODP_IPV4HDR_FLAGS_DONT_FRAG(frag_offset) ((frag_offset) & 0x4000) > +#define ODPH_IPV4HDR_FLAGS_DONT_FRAG(frag_offset) ((frag_offset) & 0x4000) > > /** @internal Returns IPv4 more fragments */ > -#define ODP_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset) ((frag_offset) & 0x2000) > +#define ODPH_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset) ((frag_offset) & 0x2000) > > /** @internal Returns IPv4 fragment offset */ > -#define ODP_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff) > +#define ODPH_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff) > > /** @internal Returns true if IPv4 packet is a fragment */ > -#define ODP_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff) > +#define ODPH_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff) > > /** IPv4 header */ > -typedef struct ODP_PACKED { > +typedef struct ODPH_PACKED { > uint8_t ver_ihl; /**< Version / Header length */ > uint8_t tos; /**< Type of service */ > uint16be_t tot_len; /**< Total length */ > @@ -59,10 +59,10 @@ typedef struct ODP_PACKED { > uint16sum_t chksum; /**< Checksum */ > uint32be_t src_addr; /**< Source address */ > uint32be_t dst_addr; /**< Destination address */ > -} odp_ipv4hdr_t; > +} odph_ipv4hdr_t; > > /** @internal Compile time assert */ > -ODP_STATIC_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, "ODP_IPV4HDR_T__SIZE_ERROR"); > +ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == ODPH_IPV4HDR_LEN, "ODPH_IPV4HDR_T__SIZE_ERROR"); > > /** > * Check if IPv4 checksum is valid > @@ -71,18 +71,18 @@ ODP_STATIC_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, "ODP_IPV4HDR_T__SIZE > * > * @return 1 if checksum is valid, otherwise 0 > */ > -static inline int odp_ipv4_csum_valid(odp_packet_t pkt) > +static inline int odph_ipv4_csum_valid(odp_packet_t pkt) > { > uint16be_t res = 0; > uint16_t *w; > - int nleft = sizeof(odp_ipv4hdr_t); > - odp_ipv4hdr_t ip; > + int nleft = sizeof(odph_ipv4hdr_t); > + odph_ipv4hdr_t ip; > uint16be_t chksum; > > if (!odp_packet_l3_offset(pkt)) > return 0; > > - memcpy(&ip, odp_packet_l3(pkt), sizeof(odp_ipv4hdr_t)); > + memcpy(&ip, odp_packet_l3(pkt), sizeof(odph_ipv4hdr_t)); > w = (uint16_t *)(void *)&ip; > chksum = ip.chksum; > ip.chksum = 0x0; > @@ -101,52 +101,52 @@ static inline int odp_ipv4_csum_valid(odp_packet_t pkt) > * > * @return IPv4 checksum in host cpu order, or 0 on failure > */ > -static inline uint16sum_t odp_ipv4_csum_update(odp_packet_t pkt) > +static inline uint16sum_t odph_ipv4_csum_update(odp_packet_t pkt) > { > uint16_t *w; > - odp_ipv4hdr_t *ip; > - int nleft = sizeof(odp_ipv4hdr_t); > + odph_ipv4hdr_t *ip; > + int nleft = sizeof(odph_ipv4hdr_t); > > if (!odp_packet_l3_offset(pkt)) > return 0; > > - ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt); > + ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); > w = (uint16_t *)(void *)ip; > ip->chksum = odp_chksum(w, nleft); > return ip->chksum; > } > > /** IPv6 version */ > -#define ODP_IPV6 6 > +#define ODPH_IPV6 6 > > /** IPv6 header length */ > -#define ODP_IPV6HDR_LEN 40 > +#define ODPH_IPV6HDR_LEN 40 > > /** > * IPv6 header > */ > -typedef struct ODP_PACKED { > +typedef struct ODPH_PACKED { > uint32be_t ver_tc_flow; /**< Version / Traffic class / Flow label */ > uint16be_t payload_len; /**< Payload length */ > uint8_t next_hdr; /**< Next header */ > uint8_t hop_limit; /**< Hop limit */ > uint8_t src_addr[16]; /**< Source address */ > uint8_t dst_addr[16]; /**< Destination address */ > -} odp_ipv6hdr_t; > +} odph_ipv6hdr_t; > > /** @internal Compile time assert */ > -ODP_STATIC_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN, "ODP_IPV6HDR_T__SIZE_ERROR"); > +ODP_STATIC_ASSERT(sizeof(odph_ipv6hdr_t) == ODPH_IPV6HDR_LEN, "ODPH_IPV6HDR_T__SIZE_ERROR"); > > /** @name > * IP protocol values (IPv4:'proto' or IPv6:'next_hdr') > * @{*/ > -#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol (1) */ > -#define ODP_IPPROTO_TCP 0x06 /**< Transmission Control Protocol (6) */ > -#define ODP_IPPROTO_UDP 0x11 /**< User Datagram Protocol (17) */ > -#define ODP_IPPROTO_SCTP 0x84 /**< Stream Control Transmission Protocol (132) */ > -#define ODP_IPPROTO_FRAG 0x2C /**< Fragment (44) */ > -#define ODP_IPPROTO_AH 0x33 /**< Authentication Header (51) */ > -#define ODP_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */ > +#define ODPH_IPPROTO_ICMP 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_SCTP 0x84 /**< Stream Control Transmission Protocol (132) */ > +#define ODPH_IPPROTO_FRAG 0x2C /**< Fragment (44) */ > +#define ODPH_IPPROTO_AH 0x33 /**< Authentication Header (51) */ > +#define ODPH_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */ > /**@}*/ > > #ifdef __cplusplus > diff --git a/include/helper/odp_linux.h b/helper/include/odph_linux.h > similarity index 88% > rename from include/helper/odp_linux.h > rename to helper/include/odph_linux.h > index 3076c22..1ea349a 100644 > --- a/include/helper/odp_linux.h > +++ b/helper/include/odph_linux.h > @@ -29,7 +29,7 @@ typedef struct { > pthread_t thread; /**< @private Pthread */ > pthread_attr_t attr; /**< @private Pthread attributes */ > > -} odp_linux_pthread_t; > +} odph_linux_pthread_t; > > > /** > @@ -44,7 +44,7 @@ typedef struct { > * @param start_routine Thread start function > * @param arg Thread argument > */ > -void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, > +void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, > int num, int first_core, > void *(*start_routine) (void *), void *arg); > > @@ -58,7 +58,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, > * @param num Number of threads to create > * > */ > -void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num); > +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); > > > #ifdef __cplusplus > diff --git a/include/helper/odp_packet_helper.h b/helper/include/odph_packet.h > similarity index 83% > rename from include/helper/odp_packet_helper.h > rename to helper/include/odph_packet.h > index db12028..c18f48d 100644 > --- a/include/helper/odp_packet_helper.h > +++ b/helper/include/odph_packet.h > @@ -11,8 +11,8 @@ > * Optional ODP packet helper functions > */ > > -#ifndef ODP_PACKET_HELPER_H_ > -#define ODP_PACKET_HELPER_H_ > +#ifndef ODPH_PACKET_HELPER_H_ > +#define ODPH_PACKET_HELPER_H_ > > #ifdef __cplusplus > extern "C" { > @@ -29,7 +29,7 @@ extern "C" { > * > * @return 1 if valid, otherwise 0 > */ > -static inline int odp_packet_is_valid(odp_packet_t pkt) > +static inline int odph_packet_is_valid(odp_packet_t pkt) > { > odp_buffer_t buf = odp_buffer_from_packet(pkt); > > @@ -45,7 +45,7 @@ static inline int odp_packet_is_valid(odp_packet_t pkt) > * > * @return Packet handle or ODP_PACKET_INVALID > */ > -static inline odp_packet_t odp_packet_alloc(odp_buffer_pool_t pool_id) > +static inline odp_packet_t odph_packet_alloc(odp_buffer_pool_t pool_id) > { > odp_packet_t pkt; > odp_buffer_t buf; > @@ -65,7 +65,7 @@ static inline odp_packet_t odp_packet_alloc(odp_buffer_pool_t pool_id) > * > * @param pkt Packet handle > */ > -static inline void odp_packet_free(odp_packet_t pkt) > +static inline void odph_packet_free(odp_packet_t pkt) > { > odp_buffer_t buf = odp_buffer_from_packet(pkt); > > @@ -82,7 +82,7 @@ static inline void odp_packet_free(odp_packet_t pkt) > * > * @return Packet buffer maximum data size > */ > -static inline size_t odp_packet_buf_size(odp_packet_t pkt) > +static inline size_t odph_packet_buf_size(odp_packet_t pkt) > { > odp_buffer_t buf = odp_buffer_from_packet(pkt); > > diff --git a/include/helper/odp_ring.h b/helper/include/odph_ring.h > similarity index 87% > rename from include/helper/odp_ring.h > rename to helper/include/odph_ring.h > index 0911531..76c1db8 100644 > --- a/include/helper/odp_ring.h > +++ b/helper/include/odph_ring.h > @@ -89,8 +89,8 @@ > * > */ > > -#ifndef ODP_RING_H_ > -#define ODP_RING_H_ > +#ifndef ODPH_RING_H_ > +#define ODPH_RING_H_ > > #ifdef __cplusplus > extern "C" { > @@ -103,15 +103,15 @@ extern "C" { > #include <errno.h> > #include <sys/queue.h> > > -enum odp_ring_queue_behavior { > - ODP_RING_QUEUE_FIXED = 0, /**< Enq/Deq a fixed number > +enum odph_ring_queue_behavior { > + ODPH_RING_QUEUE_FIXED = 0, /**< Enq/Deq a fixed number > of items from a ring */ > - ODP_RING_QUEUE_VARIABLE /**< Enq/Deq as many items > + ODPH_RING_QUEUE_VARIABLE /**< Enq/Deq as many items > a possible from ring */ > }; > > > -#define ODP_RING_NAMESIZE 32 /**< The maximum length of a ring name. */ > +#define ODPH_RING_NAMESIZE 32 /**< The maximum length of a ring name. */ > > /** > * An ODP ring structure. > @@ -123,12 +123,12 @@ enum odp_ring_queue_behavior { > * values in a modulo-32bit base: that's why the overflow of the indexes is not > * a problem. > */ > -typedef struct odp_ring { > +typedef struct odph_ring { > /** @private Next in list. */ > - TAILQ_ENTRY(odp_ring) next; > + TAILQ_ENTRY(odph_ring) next; > > /** @private Name of the ring. */ > - char name[ODP_RING_NAMESIZE]; > + char name[ODPH_RING_NAMESIZE]; > /** @private Flags supplied at creation. */ > int flags; > > @@ -153,13 +153,13 @@ typedef struct odp_ring { > > /** @private Memory space of ring starts here. */ > void *ring[0] ODP_ALIGNED_CACHE; > -} odp_ring_t; > +} odph_ring_t; > > > -#define ODP_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer". */ > -#define ODP_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer". */ > -#define ODP_RING_QUOT_EXCEED (1 << 31) /* Quota exceed for burst ops */ > -#define ODP_RING_SZ_MASK (unsigned)(0x0fffffff) /* Ring size mask */ > +#define ODPH_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer".*/ > +#define ODPH_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer".*/ > +#define ODPH_RING_QUOT_EXCEED (1 << 31) /* Quota exceed for burst ops */ > +#define ODPH_RING_SZ_MASK (unsigned)(0x0fffffff) /* Ring size mask */ > > > /** > @@ -191,7 +191,7 @@ typedef struct odp_ring { > * - EEXIST - a memzone with the same name already exists > * - ENOMEM - no appropriate memory area found in which to create memzone > */ > -odp_ring_t *odp_ring_create(const char *name, unsigned count, > +odph_ring_t *odph_ring_create(const char *name, unsigned count, > unsigned flags); > > > @@ -210,14 +210,14 @@ odp_ring_t *odp_ring_create(const char *name, unsigned count, > * @return 0: Success; water mark changed. > * -EINVAL: Invalid water mark value. > */ > -int odp_ring_set_water_mark(odp_ring_t *r, unsigned count); > +int odph_ring_set_water_mark(odph_ring_t *r, unsigned count); > > /** > * Dump the status of the ring to the console. > * > * @param r A pointer to the ring structure. > */ > -void odp_ring_dump(const odp_ring_t *r); > +void odph_ring_dump(const odph_ring_t *r); > > /** > * Enqueue several objects on the ring (multi-producers safe). > @@ -244,8 +244,9 @@ void odp_ring_dump(const odp_ring_t *r); > * if behavior = ODP_RING_QUEUE_VARIABLE > * - n: Actual number of objects enqueued. > */ > -int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior); > +int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table, > + unsigned n, > + enum odph_ring_queue_behavior behavior); > > /** > * Enqueue several objects on a ring (NOT multi-producers safe). > @@ -269,8 +270,9 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, > * if behavior = ODP_RING_QUEUE_VARIABLE > * - n: Actual number of objects enqueued. > */ > -int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior); > +int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table, > + unsigned n, > + enum odph_ring_queue_behavior behavior); > > /** > * Dequeue several objects from a ring (multi-consumers safe). When > @@ -299,8 +301,9 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, > * - n: Actual number of objects dequeued. > */ > > -int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior); > +int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table, > + unsigned n, > + enum odph_ring_queue_behavior behavior); > > /** > * Dequeue several objects from a ring (NOT multi-consumers safe). > @@ -325,8 +328,9 @@ int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, > * if behavior = ODP_RING_QUEUE_VARIABLE > * - n: Actual number of objects dequeued. > */ > -int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior); > +int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table, > + unsigned n, > + enum odph_ring_queue_behavior behavior); > > /** > * Enqueue several objects on the ring (multi-producers safe). > @@ -346,8 +350,8 @@ int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, > * high water mark is exceeded. > * - -ENOBUFS: Not enough room in the ring to enqueue, no object is enqueued. > */ > -int odp_ring_mp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, > - unsigned n); > +int odph_ring_mp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, > + unsigned n); > > /** > * Enqueue several objects on a ring (NOT multi-producers safe). > @@ -364,8 +368,8 @@ int odp_ring_mp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, > * high water mark is exceeded. > * - -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued. > */ > -int odp_ring_sp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, > - unsigned n); > +int odph_ring_sp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, > + unsigned n); > > /** > * Dequeue several objects from a ring (multi-consumers safe). > @@ -384,7 +388,7 @@ int odp_ring_sp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, > * - -ENOENT: Not enough entries in the ring to dequeue; no object is > * dequeued. > */ > -int odp_ring_mc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); > +int odph_ring_mc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n); > > /** > * Dequeue several objects from a ring (NOT multi-consumers safe). > @@ -401,7 +405,7 @@ int odp_ring_mc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); > * - -ENOENT: Not enough entries in the ring to dequeue; no object is > * dequeued. > */ > -int odp_ring_sc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); > +int odph_ring_sc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n); > > /** > * Test if a ring is full. > @@ -412,7 +416,7 @@ int odp_ring_sc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); > * - 1: The ring is full. > * - 0: The ring is not full. > */ > -int odp_ring_full(const odp_ring_t *r); > +int odph_ring_full(const odph_ring_t *r); > > /** > * Test if a ring is empty. > @@ -423,7 +427,7 @@ int odp_ring_full(const odp_ring_t *r); > * - 1: The ring is empty. > * - 0: The ring is not empty. > */ > -int odp_ring_empty(const odp_ring_t *r); > +int odph_ring_empty(const odph_ring_t *r); > > /** > * Return the number of entries in a ring. > @@ -433,7 +437,7 @@ int odp_ring_empty(const odp_ring_t *r); > * @return > * The number of entries in the ring. > */ > -unsigned odp_ring_count(const odp_ring_t *r); > +unsigned odph_ring_count(const odph_ring_t *r); > > /** > * Return the number of free entries in a ring. > @@ -443,14 +447,14 @@ unsigned odp_ring_count(const odp_ring_t *r); > * @return > * The number of free entries in the ring. > */ > -unsigned odp_ring_free_count(const odp_ring_t *r); > +unsigned odph_ring_free_count(const odph_ring_t *r); > > /** > * search ring by name > * @param name ring name to search > * @return pointer to ring otherwise NULL > */ > -odp_ring_t *odp_ring_lookup(const char *name); > +odph_ring_t *odph_ring_lookup(const char *name); > > /** > * Enqueue several objects on the ring (multi-producers safe). > @@ -467,8 +471,8 @@ odp_ring_t *odp_ring_lookup(const char *name); > * @return > * - n: Actual number of objects enqueued. > */ > -int odp_ring_mp_enqueue_burst(odp_ring_t *r, void * const *obj_table, > - unsigned n); > +int odph_ring_mp_enqueue_burst(odph_ring_t *r, void * const *obj_table, > + unsigned n); > > /** > * Enqueue several objects on a ring (NOT multi-producers safe). > @@ -482,8 +486,8 @@ int odp_ring_mp_enqueue_burst(odp_ring_t *r, void * const *obj_table, > * @return > * - n: Actual number of objects enqueued. > */ > -int odp_ring_sp_enqueue_burst(odp_ring_t *r, void * const *obj_table, > - unsigned n); > +int odph_ring_sp_enqueue_burst(odph_ring_t *r, void * const *obj_table, > + unsigned n); > /** > * Enqueue several objects on a ring. > * > @@ -500,8 +504,8 @@ int odp_ring_sp_enqueue_burst(odp_ring_t *r, void * const *obj_table, > * @return > * - n: Actual number of objects enqueued. > */ > -int odp_ring_enqueue_burst(odp_ring_t *r, void * const *obj_table, > - unsigned n); > +int odph_ring_enqueue_burst(odph_ring_t *r, void * const *obj_table, > + unsigned n); > > /** > * Dequeue several objects from a ring (multi-consumers safe). When the request > @@ -520,7 +524,7 @@ int odp_ring_enqueue_burst(odp_ring_t *r, void * const *obj_table, > * @return > * - n: Actual number of objects dequeued, 0 if ring is empty > */ > -int odp_ring_mc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); > +int odph_ring_mc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n); > > /** > * Dequeue several objects from a ring (NOT multi-consumers safe).When the > @@ -536,7 +540,7 @@ int odp_ring_mc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); > * @return > * - n: Actual number of objects dequeued, 0 if ring is empty > */ > -int odp_ring_sc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); > +int odph_ring_sc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n); > > /** > * Dequeue multiple objects from a ring up to a maximum number. > @@ -554,17 +558,17 @@ int odp_ring_sc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); > * @return > * - Number of objects dequeued, or a negative error code on error > */ > -int odp_ring_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); > +int odph_ring_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n); > > /** > * dump the status of all rings on the console > */ > -void odp_ring_list_dump(void); > +void odph_ring_list_dump(void); > > /** > * initialise ring tailq > */ > -void odp_ring_tailq_init(void); > +void odph_ring_tailq_init(void); > > #ifdef __cplusplus > } > diff --git a/include/helper/odp_udp.h b/helper/include/odph_udp.h > similarity index 74% > rename from include/helper/odp_udp.h > rename to helper/include/odph_udp.h > index 966d7f3..3970f00 100644 > --- a/include/helper/odp_udp.h > +++ b/helper/include/odph_udp.h > @@ -11,8 +11,8 @@ > * ODP UDP header > */ > > -#ifndef ODP_UDP_H_ > -#define ODP_UDP_H_ > +#ifndef ODPH_UDP_H_ > +#define ODPH_UDP_H_ > > #ifdef __cplusplus > extern "C" { > @@ -23,24 +23,24 @@ extern "C" { > #include <odp_byteorder.h> > > /** UDP header length */ > -#define ODP_UDPHDR_LEN 8 > +#define ODPH_UDPHDR_LEN 8 > > /** UDP header */ > -typedef struct ODP_PACKED { > +typedef struct ODPH_PACKED { > uint16be_t src_port; /**< Source port */ > uint16be_t dst_port; /**< Destination port */ > uint16be_t length; /**< UDP datagram length in bytes (header+data) */ > uint16be_t chksum; /**< UDP header and data checksum (0 if not used)*/ > -} odp_udphdr_t; > +} odph_udphdr_t; > > /** UDP pseudo header */ > -typedef struct ODP_PACKET { > +typedef struct ODPH_PACKET { > uint32be_t src_addr; /**< Source addr */ > uint32be_t dst_addr; /**< Destination addr */ > uint8_t pad; /**< pad byte */ > uint8_t proto; /**< UDP protocol */ > uint16be_t length; /**< data length */ > -} odp_udpphdr_t; > +} odph_udpphdr_t; > > /** > * UDP checksum > @@ -50,12 +50,12 @@ typedef struct ODP_PACKET { > * @param pkt calculate chksum for pkt > * @return checksum value > */ > -static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) > +static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt) > { > uint32_t sum = 0; > - odp_udpphdr_t phdr; > - odp_udphdr_t *udph; > - odp_ipv4hdr_t *iph; > + odph_udpphdr_t phdr; > + odph_udphdr_t *udph; > + odph_ipv4hdr_t *iph; > uint16_t udplen; > > if (!odp_packet_l3_offset(pkt)) > @@ -64,8 +64,8 @@ static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) > if (!odp_packet_l4_offset(pkt)) > return 0; > > - iph = (odp_ipv4hdr_t *)odp_packet_l3(pkt); > - udph = (odp_udphdr_t *)odp_packet_l4(pkt); > + iph = (odph_ipv4hdr_t *)odp_packet_l3(pkt); > + udph = (odph_udphdr_t *)odp_packet_l4(pkt); > udplen = odp_be_to_cpu_16(udph->length); > > /* the source ip */ > @@ -74,12 +74,12 @@ static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) > phdr.dst_addr = iph->dst_addr; > /* proto */ > phdr.pad = 0; > - phdr.proto = ODP_IPPROTO_UDP; > + phdr.proto = ODPH_IPPROTO_UDP; > /* the length */ > phdr.length = udph->length; > > /* calc UDP pseudo header chksum */ > - sum = (__odp_force uint32_t) odp_chksum(&phdr, sizeof(odp_udpphdr_t)); > + sum = (__odp_force uint32_t) odp_chksum(&phdr, sizeof(odph_udpphdr_t)); > /* calc udp header and data chksum */ > sum += (__odp_force uint32_t) odp_chksum(udph, udplen); > > @@ -93,7 +93,7 @@ static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) > } > > /** @internal Compile time assert */ > -ODP_STATIC_ASSERT(sizeof(odp_udphdr_t) == ODP_UDPHDR_LEN, "ODP_UDPHDR_T__SIZE_ERROR"); > +ODP_STATIC_ASSERT(sizeof(odph_udphdr_t) == ODPH_UDPHDR_LEN, "ODPH_UDPHDR_T__SIZE_ERROR"); > > #ifdef __cplusplus > } > diff --git a/include/helper/odp_eth.h b/include/helper/odp_eth.h > deleted file mode 100644 > index 542594b..0000000 > --- a/include/helper/odp_eth.h > +++ /dev/null > @@ -1,87 +0,0 @@ > -/* Copyright (c) 2014, Linaro Limited > - * All rights reserved. > - * > - * SPDX-License-Identifier: BSD-3-Clause > - */ > - > - > -/** > - * @file > - * > - * ODP ethernet header > - */ > - > -#ifndef ODP_ETH_H_ > -#define ODP_ETH_H_ > - > -#ifdef __cplusplus > -extern "C" { > -#endif > - > -#include <odp_std_types.h> > -#include <odp_byteorder.h> > -#include <odp_align.h> > -#include <odp_debug.h> > - > -#define ODP_ETHADDR_LEN 6 /**< Ethernet address length */ > -#define ODP_ETHHDR_LEN 14 /**< Ethernet header length */ > -#define ODP_VLANHDR_LEN 4 /**< VLAN header length */ > -#define ODP_ETH_LEN_MIN 60 /**< Min frame length (excl. CRC 4 bytes) */ > -#define ODP_ETH_LEN_MIN_CRC 64 /**< Min frame length (incl. CRC 4 bytes) */ > -#define ODP_ETH_LEN_MAX 1514 /**< Max frame length (excl. CRC 4 bytes) */ > -#define ODP_ETH_LEN_MAX_CRC 1518 /**< Max frame length (incl. CRC 4 bytes) */ > - > -/** > - * Ethernet MAC address > - */ > -typedef struct ODP_PACKED { > - uint8_t addr[ODP_ETHADDR_LEN]; /**< @private Address */ > -} odp_ethaddr_t; > - > -/** @internal Compile time assert */ > -ODP_STATIC_ASSERT(sizeof(odp_ethaddr_t) == ODP_ETHADDR_LEN, "ODP_ETHADDR_T__SIZE_ERROR"); > - > -/** > - * Ethernet header > - */ > -typedef struct ODP_PACKED { > - odp_ethaddr_t dst; /**< Destination address */ > - odp_ethaddr_t src; /**< Source address */ > - uint16be_t type; /**< Type */ > -} odp_ethhdr_t; > - > -/** @internal Compile time assert */ > -ODP_STATIC_ASSERT(sizeof(odp_ethhdr_t) == ODP_ETHHDR_LEN, "ODP_ETHHDR_T__SIZE_ERROR"); > - > -/** > - * VLAN header > - * > - * @todo Check usage of tpid vs ethertype. Check outer VLAN TPID. > - */ > -typedef struct ODP_PACKED { > - uint16be_t tpid; /**< Tag protocol ID (located after ethhdr.src) */ > - uint16be_t tci; /**< Priority / CFI / VLAN ID */ > -} odp_vlanhdr_t; > - > -/** @internal Compile time assert */ > -ODP_STATIC_ASSERT(sizeof(odp_vlanhdr_t) == ODP_VLANHDR_LEN, "ODP_VLANHDR_T__SIZE_ERROR"); > - > - > -/* Ethernet header Ether Type ('type') values, a selected few */ > -#define ODP_ETHTYPE_IPV4 0x0800 /**< Internet Protocol version 4 */ > -#define ODP_ETHTYPE_ARP 0x0806 /**< Address Resolution Protocol */ > -#define ODP_ETHTYPE_RARP 0x8035 /**< Reverse Address Resolution Protocol*/ > -#define ODP_ETHTYPE_VLAN 0x8100 /**< VLAN-tagged frame IEEE 802.1Q */ > -#define ODP_ETHTYPE_VLAN_OUTER 0x88A8 /**< Stacked VLANs/QinQ, outer-tag/S-TAG*/ > -#define ODP_ETHTYPE_IPV6 0x86dd /**< Internet Protocol version 6 */ > -#define ODP_ETHTYPE_FLOW_CTRL 0x8808 /**< Ethernet flow control */ > -#define ODP_ETHTYPE_MPLS 0x8847 /**< MPLS unicast */ > -#define ODP_ETHTYPE_MPLS_MCAST 0x8848 /**< MPLS multicast */ > -#define ODP_ETHTYPE_MACSEC 0x88E5 /**< MAC security IEEE 802.1AE */ > -#define ODP_ETHTYPE_1588 0x88F7 /**< Precision Time Protocol IEEE 1588 */ > - > -#ifdef __cplusplus > -} > -#endif > - > -#endif > diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am > index ff49b7d..a59435f 100644 > --- a/platform/linux-dpdk/Makefile.am > +++ b/platform/linux-dpdk/Makefile.am > @@ -16,7 +16,7 @@ AM_CFLAGS += -I$(srcdir)/include > AM_CFLAGS += -I$(srcdir)/include/api > AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include > AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include/api > -AM_CFLAGS += -I$(top_srcdir)/include > +AM_CFLAGS += -I$(top_srcdir)/helper/include > > DPDK_LIBS="-lintel_dpdk -ldl" > LIBS += $(DPDK_LIBS) > @@ -54,13 +54,13 @@ include_HEADERS = \ > > subdirheadersdir = $(includedir)/helper > subdirheaders_HEADERS = \ > - $(top_srcdir)/include/helper/odp_chksum.h \ > - $(top_srcdir)/include/helper/odp_eth.h \ > - $(top_srcdir)/include/helper/odp_ip.h \ > - $(top_srcdir)/include/helper/odp_linux.h \ > - $(top_srcdir)/include/helper/odp_packet_helper.h \ > - $(top_srcdir)/include/helper/odp_ring.h \ > - $(top_srcdir)/include/helper/odp_udp.h > + $(top_srcdir)/helper/include/odph_chksum.h \ > + $(top_srcdir)/helper/include/odph_eth.h \ > + $(top_srcdir)/helper/include/odph_ip.h \ > + $(top_srcdir)/helper/include/odph_linux.h \ > + $(top_srcdir)/helper/include/odph_packet.h \ > + $(top_srcdir)/helper/include/odph_ring.h \ > + $(top_srcdir)/helper/include/odph_udp.h > > __LIB__libodp_la_SOURCES = \ > ../linux-generic/odp_barrier.c \ > diff --git a/platform/linux-dpdk/include/odp_packet_dpdk.h b/platform/linux-dpdk/include/odp_packet_dpdk.h > index bcf9aa5..c3a2b70 100644 > --- a/platform/linux-dpdk/include/odp_packet_dpdk.h > +++ b/platform/linux-dpdk/include/odp_packet_dpdk.h > @@ -10,8 +10,8 @@ > #include <stdint.h> > #include <net/if.h> > > -#include <helper/odp_eth.h> > -#include <helper/odp_packet_helper.h> > +#include <odph_eth.h> > +#include <odph_packet.h> > #include <odp_align.h> > #include <odp_debug.h> > #include <odp_packet.h> > diff --git a/platform/linux-dpdk/odp_linux.c b/platform/linux-dpdk/odp_linux.c > index 067bd99..96c91a5 100644 > --- a/platform/linux-dpdk/odp_linux.c > +++ b/platform/linux-dpdk/odp_linux.c > @@ -14,7 +14,7 @@ > #include <stdio.h> > #include <assert.h> > > -#include <helper/odp_linux.h> > +#include <odph_linux.h> > #include <odp_internal.h> > #include <odp_thread.h> > #include <odp_init.h> > @@ -41,7 +41,7 @@ static void *odp_run_start_routine(void *arg) > } > > > -void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, > +void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, int num, > int first_core, void *(*start_routine) (void *), void *arg) > { > int i; > @@ -82,7 +82,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, > } > > > -void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num) > +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) > { > uint32_t lcore_id; > > diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c > index c34e626..edfd06d 100644 > --- a/platform/linux-dpdk/odp_packet.c > +++ b/platform/linux-dpdk/odp_packet.c > @@ -9,16 +9,16 @@ > #include <odp_hints.h> > #include <odp_byteorder.h> > > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > > #include <string.h> > #include <stdio.h> > > -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > - size_t *offset_out); > -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, > - size_t *offset_out); > +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, > + odph_ipv4hdr_t *ipv4, size_t *offset_out); > +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, > + odph_ipv6hdr_t *ipv6, size_t *offset_out); > > void odp_packet_init(odp_packet_t pkt) > { > @@ -144,10 +144,10 @@ void odp_packet_set_l4_offset(odp_packet_t pkt, size_t offset) > void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > { > odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); > - odp_ethhdr_t *eth; > - odp_vlanhdr_t *vlan; > - odp_ipv4hdr_t *ipv4; > - odp_ipv6hdr_t *ipv6; > + odph_ethhdr_t *eth; > + odph_vlanhdr_t *vlan; > + odph_ipv4hdr_t *ipv4; > + odph_ipv6hdr_t *ipv6; > uint16_t ethtype; > size_t offset = 0; > uint8_t ip_proto = 0; > @@ -156,10 +156,10 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > pkt_hdr->frame_offset = frame_offset; > pkt_hdr->frame_len = len; > > - if (odp_unlikely(len < ODP_ETH_LEN_MIN)) { > + if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) { > pkt_hdr->error_flags.frame_len = 1; > return; > - } else if (len > ODP_ETH_LEN_MAX) { > + } else if (len > ODPH_ETH_LEN_MAX) { > pkt_hdr->input_flags.jumbo = 1; > } > > @@ -167,40 +167,40 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > pkt_hdr->input_flags.l2 = 1; > pkt_hdr->l2_offset = frame_offset; > > - eth = (odp_ethhdr_t *)odp_packet_start(pkt); > + eth = (odph_ethhdr_t *)odp_packet_start(pkt); > ethtype = odp_be_to_cpu_16(eth->type); > - vlan = (odp_vlanhdr_t *)ð->type; > + vlan = (odph_vlanhdr_t *)ð->type; > > - if (ethtype == ODP_ETHTYPE_VLAN_OUTER) { > + if (ethtype == ODPH_ETHTYPE_VLAN_OUTER) { > pkt_hdr->input_flags.vlan_qinq = 1; > ethtype = odp_be_to_cpu_16(vlan->tpid); > - offset += sizeof(odp_vlanhdr_t); > + offset += sizeof(odph_vlanhdr_t); > vlan = &vlan[1]; > } > > - if (ethtype == ODP_ETHTYPE_VLAN) { > + if (ethtype == ODPH_ETHTYPE_VLAN) { > pkt_hdr->input_flags.vlan = 1; > ethtype = odp_be_to_cpu_16(vlan->tpid); > - offset += sizeof(odp_vlanhdr_t); > + offset += sizeof(odph_vlanhdr_t); > } > > /* Set l3_offset+flag only for known ethtypes */ > switch (ethtype) { > - case ODP_ETHTYPE_IPV4: > + case ODPH_ETHTYPE_IPV4: > pkt_hdr->input_flags.ipv4 = 1; > pkt_hdr->input_flags.l3 = 1; > - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; > - ipv4 = (odp_ipv4hdr_t *)odp_packet_l3(pkt); > + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; > + ipv4 = (odph_ipv4hdr_t *)odp_packet_l3(pkt); > ip_proto = parse_ipv4(pkt_hdr, ipv4, &offset); > break; > - case ODP_ETHTYPE_IPV6: > + case ODPH_ETHTYPE_IPV6: > pkt_hdr->input_flags.ipv6 = 1; > pkt_hdr->input_flags.l3 = 1; > - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; > - ipv6 = (odp_ipv6hdr_t *)odp_packet_l3(pkt); > + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; > + ipv6 = (odph_ipv6hdr_t *)odp_packet_l3(pkt); > ip_proto = parse_ipv6(pkt_hdr, ipv6, &offset); > break; > - case ODP_ETHTYPE_ARP: > + case ODPH_ETHTYPE_ARP: > pkt_hdr->input_flags.arp = 1; > /* fall through */ > default: > @@ -209,22 +209,22 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > } > > switch (ip_proto) { > - case ODP_IPPROTO_UDP: > + case ODPH_IPPROTO_UDP: > pkt_hdr->input_flags.udp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_TCP: > + case ODPH_IPPROTO_TCP: > pkt_hdr->input_flags.tcp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_SCTP: > + case ODPH_IPPROTO_SCTP: > pkt_hdr->input_flags.sctp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_ICMP: > + case ODPH_IPPROTO_ICMP: > pkt_hdr->input_flags.icmp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > @@ -239,19 +239,19 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > } > } > > -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > - size_t *offset_out) > +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, > + odph_ipv4hdr_t *ipv4, size_t *offset_out) > { > uint8_t ihl; > uint16_t frag_offset; > > - ihl = ODP_IPV4HDR_IHL(ipv4->ver_ihl); > - if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) { > + ihl = ODPH_IPV4HDR_IHL(ipv4->ver_ihl); > + if (odp_unlikely(ihl < ODPH_IPV4HDR_IHL_MIN)) { > pkt_hdr->error_flags.ip_err = 1; > return 0; > } > > - if (odp_unlikely(ihl > ODP_IPV4HDR_IHL_MIN)) { > + if (odp_unlikely(ihl > ODPH_IPV4HDR_IHL_MIN)) { > pkt_hdr->input_flags.ipopt = 1; > return 0; > } > @@ -262,13 +262,13 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > * "fragment offset" field is nonzero (all fragments except the first) > */ > frag_offset = odp_be_to_cpu_16(ipv4->frag_offset); > - if (odp_unlikely(ODP_IPV4HDR_IS_FRAGMENT(frag_offset))) { > + if (odp_unlikely(ODPH_IPV4HDR_IS_FRAGMENT(frag_offset))) { > pkt_hdr->input_flags.ipfrag = 1; > return 0; > } > > - if (ipv4->proto == ODP_IPPROTO_ESP || > - ipv4->proto == ODP_IPPROTO_AH) { > + if (ipv4->proto == ODPH_IPPROTO_ESP || > + ipv4->proto == ODPH_IPPROTO_AH) { > pkt_hdr->input_flags.ipsec = 1; > return 0; > } > @@ -279,24 +279,24 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > return ipv4->proto; > } > > -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, > - size_t *offset_out) > +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, > + odph_ipv6hdr_t *ipv6, size_t *offset_out) > { > - if (ipv6->next_hdr == ODP_IPPROTO_ESP || > - ipv6->next_hdr == ODP_IPPROTO_AH) { > + if (ipv6->next_hdr == ODPH_IPPROTO_ESP || > + ipv6->next_hdr == ODPH_IPPROTO_AH) { > pkt_hdr->input_flags.ipopt = 1; > pkt_hdr->input_flags.ipsec = 1; > return 0; > } > > - if (odp_unlikely(ipv6->next_hdr == ODP_IPPROTO_FRAG)) { > + if (odp_unlikely(ipv6->next_hdr == ODPH_IPPROTO_FRAG)) { > pkt_hdr->input_flags.ipopt = 1; > pkt_hdr->input_flags.ipfrag = 1; > return 0; > } > > /* Don't step through more extensions */ > - *offset_out = ODP_IPV6HDR_LEN; > + *offset_out = ODPH_IPV6HDR_LEN; > return ipv6->next_hdr; > } > > diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am > index f4dfdc1..949b8d1 100644 > --- a/platform/linux-generic/Makefile.am > +++ b/platform/linux-generic/Makefile.am > @@ -3,7 +3,7 @@ include $(top_srcdir)/platform/Makefile.inc > > AM_CFLAGS += -I$(srcdir)/include > AM_CFLAGS += -I$(srcdir)/include/api > -AM_CFLAGS += -I$(top_srcdir)/include > +AM_CFLAGS += -I$(top_srcdir)/helper/include > > include_HEADERS = \ > $(top_srcdir)/platform/linux-generic/include/api/odp.h \ > @@ -42,13 +42,13 @@ include_HEADERS = \ > > subdirheadersdir = $(includedir)/helper > subdirheaders_HEADERS = \ > - $(top_srcdir)/include/helper/odp_chksum.h \ > - $(top_srcdir)/include/helper/odp_eth.h \ > - $(top_srcdir)/include/helper/odp_ip.h \ > - $(top_srcdir)/include/helper/odp_linux.h \ > - $(top_srcdir)/include/helper/odp_packet_helper.h \ > - $(top_srcdir)/include/helper/odp_ring.h \ > - $(top_srcdir)/include/helper/odp_udp.h > + $(top_srcdir)/helper/include/odph_chksum.h \ > + $(top_srcdir)/helper/include/odph_eth.h \ > + $(top_srcdir)/helper/include/odph_ip.h \ > + $(top_srcdir)/helper/include/odph_linux.h \ > + $(top_srcdir)/helper/include/odph_packet.h \ > + $(top_srcdir)/helper/include/odph_ring.h \ > + $(top_srcdir)/helper/include/odph_udp.h > > __LIB__libodp_la_SOURCES = \ > odp_barrier.c \ > diff --git a/platform/linux-generic/include/api/odp_align.h b/platform/linux-generic/include/api/odp_align.h > index 5ee61be..a93dd24 100644 > --- a/platform/linux-generic/include/api/odp_align.h > +++ b/platform/linux-generic/include/api/odp_align.h > @@ -31,7 +31,7 @@ extern "C" { > /** > * Defines type/struct to be packed > */ > -#define ODP_PACKED __attribute__((__packed__)) > +#define ODPH_PACKED __attribute__((__packed__)) > > /** > * Returns offset of member in type > diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c > index bdd4694..fae546c 100644 > --- a/platform/linux-generic/odp_crypto.c > +++ b/platform/linux-generic/odp_crypto.c > @@ -14,7 +14,7 @@ > #include <odp_shared_memory.h> > #include <odp_crypto_internal.h> > #include <odp_hints.h> > -#include <helper/odp_packet_helper.h> > +#include <odph_packet.h> > > #include <string.h> > > @@ -370,7 +370,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params, > if (completion_event == odp_buffer_from_packet(params->pkt)) > completion_event = > odp_buffer_from_packet(params->out_pkt); > - odp_packet_free(params->pkt); > + odph_packet_free(params->pkt); > params->pkt = ODP_PACKET_INVALID; > } > > diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c > index 6e2b448..e21e467 100644 > --- a/platform/linux-generic/odp_linux.c > +++ b/platform/linux-generic/odp_linux.c > @@ -14,7 +14,7 @@ > #include <stdio.h> > #include <assert.h> > > -#include <helper/odp_linux.h> > +#include <odph_linux.h> > #include <odp_internal.h> > #include <odp_thread.h> > #include <odp_init.h> > @@ -45,7 +45,7 @@ static void *odp_run_start_routine(void *arg) > } > > > -void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, > +void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, int num, > int first_core, void *(*start_routine) (void *), void *arg) > { > int i; > @@ -59,7 +59,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, > assert((first_core >= 0) && (first_core < core_count)); > assert((num >= 0) && (num <= core_count)); > > - memset(thread_tbl, 0, num * sizeof(odp_linux_pthread_t)); > + memset(thread_tbl, 0, num * sizeof(odph_linux_pthread_t)); > > for (i = 0; i < num; i++) { > pthread_attr_init(&thread_tbl[i].attr); > @@ -85,7 +85,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, > } > > > -void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num) > +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) > { > int i; > > diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c > index 13e2471..20137d0 100644 > --- a/platform/linux-generic/odp_packet.c > +++ b/platform/linux-generic/odp_packet.c > @@ -9,16 +9,16 @@ > #include <odp_hints.h> > #include <odp_byteorder.h> > > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > > #include <string.h> > #include <stdio.h> > > -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > - size_t *offset_out); > -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, > - size_t *offset_out); > +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, > + odph_ipv4hdr_t *ipv4, size_t *offset_out); > +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, > + odph_ipv6hdr_t *ipv6, size_t *offset_out); > > void odp_packet_init(odp_packet_t pkt) > { > @@ -160,10 +160,10 @@ int odp_packet_seg_count(odp_packet_t pkt) > void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > { > odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); > - odp_ethhdr_t *eth; > - odp_vlanhdr_t *vlan; > - odp_ipv4hdr_t *ipv4; > - odp_ipv6hdr_t *ipv6; > + odph_ethhdr_t *eth; > + odph_vlanhdr_t *vlan; > + odph_ipv4hdr_t *ipv4; > + odph_ipv6hdr_t *ipv6; > uint16_t ethtype; > size_t offset = 0; > uint8_t ip_proto = 0; > @@ -172,10 +172,10 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > pkt_hdr->frame_offset = frame_offset; > pkt_hdr->frame_len = len; > > - if (odp_unlikely(len < ODP_ETH_LEN_MIN)) { > + if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) { > pkt_hdr->error_flags.frame_len = 1; > return; > - } else if (len > ODP_ETH_LEN_MAX) { > + } else if (len > ODPH_ETH_LEN_MAX) { > pkt_hdr->input_flags.jumbo = 1; > } > > @@ -183,40 +183,40 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > pkt_hdr->input_flags.l2 = 1; > pkt_hdr->l2_offset = frame_offset; > > - eth = (odp_ethhdr_t *)odp_packet_start(pkt); > + eth = (odph_ethhdr_t *)odp_packet_start(pkt); > ethtype = odp_be_to_cpu_16(eth->type); > - vlan = (odp_vlanhdr_t *)ð->type; > + vlan = (odph_vlanhdr_t *)ð->type; > > - if (ethtype == ODP_ETHTYPE_VLAN_OUTER) { > + if (ethtype == ODPH_ETHTYPE_VLAN_OUTER) { > pkt_hdr->input_flags.vlan_qinq = 1; > ethtype = odp_be_to_cpu_16(vlan->tpid); > - offset += sizeof(odp_vlanhdr_t); > + offset += sizeof(odph_vlanhdr_t); > vlan = &vlan[1]; > } > > - if (ethtype == ODP_ETHTYPE_VLAN) { > + if (ethtype == ODPH_ETHTYPE_VLAN) { > pkt_hdr->input_flags.vlan = 1; > ethtype = odp_be_to_cpu_16(vlan->tpid); > - offset += sizeof(odp_vlanhdr_t); > + offset += sizeof(odph_vlanhdr_t); > } > > /* Set l3_offset+flag only for known ethtypes */ > switch (ethtype) { > - case ODP_ETHTYPE_IPV4: > + case ODPH_ETHTYPE_IPV4: > pkt_hdr->input_flags.ipv4 = 1; > pkt_hdr->input_flags.l3 = 1; > - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; > - ipv4 = (odp_ipv4hdr_t *)odp_packet_l3(pkt); > + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; > + ipv4 = (odph_ipv4hdr_t *)odp_packet_l3(pkt); > ip_proto = parse_ipv4(pkt_hdr, ipv4, &offset); > break; > - case ODP_ETHTYPE_IPV6: > + case ODPH_ETHTYPE_IPV6: > pkt_hdr->input_flags.ipv6 = 1; > pkt_hdr->input_flags.l3 = 1; > - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; > - ipv6 = (odp_ipv6hdr_t *)odp_packet_l3(pkt); > + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; > + ipv6 = (odph_ipv6hdr_t *)odp_packet_l3(pkt); > ip_proto = parse_ipv6(pkt_hdr, ipv6, &offset); > break; > - case ODP_ETHTYPE_ARP: > + case ODPH_ETHTYPE_ARP: > pkt_hdr->input_flags.arp = 1; > /* fall through */ > default: > @@ -225,22 +225,22 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > } > > switch (ip_proto) { > - case ODP_IPPROTO_UDP: > + case ODPH_IPPROTO_UDP: > pkt_hdr->input_flags.udp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_TCP: > + case ODPH_IPPROTO_TCP: > pkt_hdr->input_flags.tcp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_SCTP: > + case ODPH_IPPROTO_SCTP: > pkt_hdr->input_flags.sctp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_ICMP: > + case ODPH_IPPROTO_ICMP: > pkt_hdr->input_flags.icmp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > @@ -255,19 +255,19 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > } > } > > -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > - size_t *offset_out) > +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, > + odph_ipv4hdr_t *ipv4, size_t *offset_out) > { > uint8_t ihl; > uint16_t frag_offset; > > - ihl = ODP_IPV4HDR_IHL(ipv4->ver_ihl); > - if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) { > + ihl = ODPH_IPV4HDR_IHL(ipv4->ver_ihl); > + if (odp_unlikely(ihl < ODPH_IPV4HDR_IHL_MIN)) { > pkt_hdr->error_flags.ip_err = 1; > return 0; > } > > - if (odp_unlikely(ihl > ODP_IPV4HDR_IHL_MIN)) { > + if (odp_unlikely(ihl > ODPH_IPV4HDR_IHL_MIN)) { > pkt_hdr->input_flags.ipopt = 1; > return 0; > } > @@ -278,13 +278,13 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > * "fragment offset" field is nonzero (all fragments except the first) > */ > frag_offset = odp_be_to_cpu_16(ipv4->frag_offset); > - if (odp_unlikely(ODP_IPV4HDR_IS_FRAGMENT(frag_offset))) { > + if (odp_unlikely(ODPH_IPV4HDR_IS_FRAGMENT(frag_offset))) { > pkt_hdr->input_flags.ipfrag = 1; > return 0; > } > > - if (ipv4->proto == ODP_IPPROTO_ESP || > - ipv4->proto == ODP_IPPROTO_AH) { > + if (ipv4->proto == ODPH_IPPROTO_ESP || > + ipv4->proto == ODPH_IPPROTO_AH) { > pkt_hdr->input_flags.ipsec = 1; > return 0; > } > @@ -295,24 +295,24 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > return ipv4->proto; > } > > -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, > - size_t *offset_out) > +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, > + odph_ipv6hdr_t *ipv6, size_t *offset_out) > { > - if (ipv6->next_hdr == ODP_IPPROTO_ESP || > - ipv6->next_hdr == ODP_IPPROTO_AH) { > + if (ipv6->next_hdr == ODPH_IPPROTO_ESP || > + ipv6->next_hdr == ODPH_IPPROTO_AH) { > pkt_hdr->input_flags.ipopt = 1; > pkt_hdr->input_flags.ipsec = 1; > return 0; > } > > - if (odp_unlikely(ipv6->next_hdr == ODP_IPPROTO_FRAG)) { > + if (odp_unlikely(ipv6->next_hdr == ODPH_IPPROTO_FRAG)) { > pkt_hdr->input_flags.ipopt = 1; > pkt_hdr->input_flags.ipfrag = 1; > return 0; > } > > /* Don't step through more extensions */ > - *offset_out = ODP_IPV6HDR_LEN; > + *offset_out = ODPH_IPV6HDR_LEN; > return ipv6->next_hdr; > } > > diff --git a/platform/linux-generic/odp_packet_netmap.c b/platform/linux-generic/odp_packet_netmap.c > index e2215ab..5942789 100644 > --- a/platform/linux-generic/odp_packet_netmap.c > +++ b/platform/linux-generic/odp_packet_netmap.c > @@ -31,9 +31,9 @@ > #include <odp_hints.h> > #include <odp_thread.h> > > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > -#include <helper/odp_packet_helper.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > +#include <odph_packet.h> > > #define NETMAP_WITH_LIBS > #include <odp_packet_netmap.h> > @@ -41,8 +41,8 @@ > /** Eth buffer start offset from u32-aligned address to make sure the following > * header (e.g. IP) starts at a 32-bit aligned address. > */ > -#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODP_ETHHDR_LEN, sizeof(uint32_t)) \ > - - ODP_ETHHDR_LEN) > +#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODPH_ETHHDR_LEN, sizeof(uint32_t)) \ > + - ODPH_ETHHDR_LEN) > > /** Round up buffer address to get a properly aliged eth buffer, i.e. aligned > * so that the next header always starts at a 32bit aligned address. > @@ -135,7 +135,7 @@ int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, > /* save netmap_mode for later use */ > pkt_nm->netmap_mode = nm_params->netmap_mode; > > - odp_packet_free(pkt); > + odph_packet_free(pkt); > > if (nm_params->netmap_mode == ODP_NETMAP_MODE_SW) > ringid = NETMAP_SW_RING; > @@ -322,7 +322,7 @@ int recv_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], > /* drop the frame, reuse pkt next interation */ > continue; > } > - if (odp_unlikely(frame_len < ODP_ETH_LEN_MIN)) { > + if (odp_unlikely(frame_len < ODPH_ETH_LEN_MIN)) { > if (odp_unlikely(pkt_nm->netmap_mode != > ODP_NETMAP_MODE_SW)) { > ODP_ERR("RX: Frame truncated: %u\n", > @@ -330,8 +330,8 @@ int recv_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], > continue; > } > memset(l2_hdr + frame_len, 0, > - ODP_ETH_LEN_MIN - frame_len); > - frame_len = ODP_ETH_LEN_MIN; > + ODPH_ETH_LEN_MIN - frame_len); > + frame_len = ODPH_ETH_LEN_MIN; > } > > /* For now copy the data in the mbuf, > @@ -447,7 +447,7 @@ int send_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], > ODP_DBG("===> sent %03u frames to netmap adapter\n", nb_tx); > > for (tx = 0; tx < len; tx++) > - odp_packet_free(pkt_table[tx]); > + odph_packet_free(pkt_table[tx]); > > return nb_tx; > } > diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c > index 352d517..d1ea087 100644 > --- a/platform/linux-generic/odp_packet_socket.c > +++ b/platform/linux-generic/odp_packet_socket.c > @@ -38,9 +38,9 @@ > #include <odp_packet_internal.h> > #include <odp_hints.h> > > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > -#include <helper/odp_packet_helper.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > +#include <odph_packet.h> > > /** Provide a sendmmsg wrapper for systems with no libc or kernel support. > * As it is implemented as a weak symbol, it has zero effect on systems > @@ -93,8 +93,8 @@ static odp_spinlock_t raw_sockets_lock; > /** Eth buffer start offset from u32-aligned address to make sure the following > * header (e.g. IP) starts at a 32-bit aligned address. > */ > -#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODP_ETHHDR_LEN, sizeof(uint32_t)) \ > - - ODP_ETHHDR_LEN) > +#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODPH_ETHHDR_LEN, sizeof(uint32_t)) \ > + - ODPH_ETHHDR_LEN) > > /** Round up buffer address to get a properly aliged eth buffer, i.e. aligned > * so that the next header always starts at a 32bit aligned address. > @@ -186,8 +186,8 @@ int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev, > return -1; > pkt_sock->pool = pool; > > - pkt = odp_packet_alloc(pool); > - if (!odp_packet_is_valid(pkt)) > + pkt = odph_packet_alloc(pool); > + if (!odph_packet_is_valid(pkt)) > return -1; > > pkt_buf = odp_packet_buf_addr(pkt); > @@ -195,11 +195,11 @@ int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev, > /* Store eth buffer offset for pkt buffers from this pool */ > pkt_sock->frame_offset = (uintptr_t)l2_hdr - (uintptr_t)pkt_buf; > /* pkt buffer size */ > - pkt_sock->buf_size = odp_packet_buf_size(pkt); > + pkt_sock->buf_size = odph_packet_buf_size(pkt); > /* max frame len taking into account the l2-offset */ > pkt_sock->max_frame_len = pkt_sock->buf_size - pkt_sock->frame_offset; > > - odp_packet_free(pkt); > + odph_packet_free(pkt); > > odp_spinlock_lock(&raw_sockets_lock); > > @@ -297,7 +297,7 @@ int recv_pkt_sock_basic(pkt_sock_t *const pkt_sock, > > for (i = 0; i < len; i++) { > if (odp_likely(pkt == ODP_PACKET_INVALID)) { > - pkt = odp_packet_alloc(pkt_sock->pool); > + pkt = odph_packet_alloc(pkt_sock->pool); > if (odp_unlikely(pkt == ODP_PACKET_INVALID)) > break; > } > @@ -324,7 +324,7 @@ int recv_pkt_sock_basic(pkt_sock_t *const pkt_sock, > } /* end for() */ > > if (odp_unlikely(pkt != ODP_PACKET_INVALID)) > - odp_packet_free(pkt); > + odph_packet_free(pkt); > > return nb_rx; > } > @@ -368,7 +368,7 @@ int send_pkt_sock_basic(pkt_sock_t *const pkt_sock, > nb_tx = i; > > for (i = 0; i < len; i++) > - odp_packet_free(pkt_table[i]); > + odph_packet_free(pkt_table[i]); > > return nb_tx; > } > @@ -395,7 +395,7 @@ int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, > memset(msgvec, 0, sizeof(msgvec)); > > for (i = 0; i < (int)len; i++) { > - pkt_table[i] = odp_packet_alloc(pkt_sock->pool); > + pkt_table[i] = odph_packet_alloc(pkt_sock->pool); > if (odp_unlikely(pkt_table[i] == ODP_PACKET_INVALID)) > break; > > @@ -417,7 +417,7 @@ int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, > /* Don't receive packets sent by ourselves */ > if (odp_unlikely(ethaddrs_equal(pkt_sock->if_mac, > eth_hdr->h_source))) { > - odp_packet_free(pkt_table[i]); > + odph_packet_free(pkt_table[i]); > continue; > } > > @@ -431,7 +431,7 @@ int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, > > /* Free unused pkt buffers */ > for (; i < msgvec_len; i++) > - odp_packet_free(pkt_table[i]); > + odph_packet_free(pkt_table[i]); > > return nb_rx; > } > @@ -473,7 +473,7 @@ int send_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, > } > > for (i = 0; i < len; i++) > - odp_packet_free(pkt_table[i]); > + odph_packet_free(pkt_table[i]); > > return len; > } > @@ -569,7 +569,7 @@ static inline unsigned pkt_mmap_v2_rx(int sock, struct ring *ring, > continue; > } > > - pkt_table[i] = odp_packet_alloc(pool); > + pkt_table[i] = odph_packet_alloc(pool); > if (odp_unlikely(pkt_table[i] == ODP_PACKET_INVALID)) > break; > > @@ -623,7 +623,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring, > > mmap_tx_user_ready(ppd.raw); > > - odp_packet_free(pkt_table[i]); > + odph_packet_free(pkt_table[i]); > frame_num = next_frame_num; > i++; > } else { > @@ -815,8 +815,8 @@ int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev, > if (pool == ODP_BUFFER_POOL_INVALID) > return -1; > > - pkt = odp_packet_alloc(pool); > - if (!odp_packet_is_valid(pkt)) > + pkt = odph_packet_alloc(pool); > + if (!odph_packet_is_valid(pkt)) > return -1; > > pkt_buf = odp_packet_buf_addr(pkt); > @@ -824,7 +824,7 @@ int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev, > /* Store eth buffer offset for pkt buffers from this pool */ > pkt_sock->frame_offset = (uintptr_t)l2_hdr - (uintptr_t)pkt_buf; > > - odp_packet_free(pkt); > + odph_packet_free(pkt); > > pkt_sock->pool = pool; > pkt_sock->sockfd = mmap_pkt_socket(); > diff --git a/platform/linux-generic/odp_ring.c b/platform/linux-generic/odp_ring.c > index 25ff66a..720d8db 100644 > --- a/platform/linux-generic/odp_ring.c > +++ b/platform/linux-generic/odp_ring.c > @@ -80,9 +80,9 @@ > #include <string.h> > #include <odp_debug.h> > #include <odp_rwlock.h> > -#include <helper/odp_ring.h> > +#include <odph_ring.h> > > -static TAILQ_HEAD(, odp_ring) odp_ring_list; > +static TAILQ_HEAD(, odph_ring) odp_ring_list; > > /* > * the enqueue of pointers on the ring. > @@ -145,29 +145,29 @@ static TAILQ_HEAD(, odp_ring) odp_ring_list; > static odp_rwlock_t qlock; /* rings tailq lock */ > > /* init tailq_ring */ > -void odp_ring_tailq_init(void) > +void odph_ring_tailq_init(void) > { > TAILQ_INIT(&odp_ring_list); > odp_rwlock_init(&qlock); > } > > /* create the ring */ > -odp_ring_t * > -odp_ring_create(const char *name, unsigned count, unsigned flags) > +odph_ring_t * > +odph_ring_create(const char *name, unsigned count, unsigned flags) > { > - char ring_name[ODP_RING_NAMESIZE]; > - odp_ring_t *r; > + char ring_name[ODPH_RING_NAMESIZE]; > + odph_ring_t *r; > size_t ring_size; > > /* count must be a power of 2 */ > - if (!ODP_VAL_IS_POWER_2(count) || (count > ODP_RING_SZ_MASK)) { > + if (!ODP_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) { > ODP_ERR("Requested size is invalid, must be power of 2, and do not exceed the size limit %u\n", > - ODP_RING_SZ_MASK); > + ODPH_RING_SZ_MASK); > return NULL; > } > > snprintf(ring_name, sizeof(ring_name), "%s", name); > - ring_size = count*sizeof(void *)+sizeof(odp_ring_t); > + ring_size = count*sizeof(void *)+sizeof(odph_ring_t); > > odp_rwlock_write_lock(&qlock); > /* reserve a memory zone for this ring.*/ > @@ -178,8 +178,8 @@ odp_ring_create(const char *name, unsigned count, unsigned flags) > snprintf(r->name, sizeof(r->name), "%s", name); > r->flags = flags; > r->prod.watermark = count; > - r->prod.sp_enqueue = !!(flags & ODP_RING_F_SP_ENQ); > - r->cons.sc_dequeue = !!(flags & ODP_RING_F_SC_DEQ); > + r->prod.sp_enqueue = !!(flags & ODPH_RING_F_SP_ENQ); > + r->cons.sc_dequeue = !!(flags & ODPH_RING_F_SC_DEQ); > r->prod.size = count; > r->cons.size = count; > r->prod.mask = count-1; > @@ -202,7 +202,7 @@ odp_ring_create(const char *name, unsigned count, unsigned flags) > * change the high water mark. If *count* is 0, water marking is > * disabled > */ > -int odp_ring_set_water_mark(odp_ring_t *r, unsigned count) > +int odph_ring_set_water_mark(odph_ring_t *r, unsigned count) > { > if (count >= r->prod.size) > return -EINVAL; > @@ -218,8 +218,8 @@ int odp_ring_set_water_mark(odp_ring_t *r, unsigned count) > /** > * Enqueue several objects on the ring (multi-producers safe). > */ > -int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior) > +int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table, > + unsigned n, enum odph_ring_queue_behavior behavior) > { > uint32_t prod_head, prod_next; > uint32_t cons_tail, free_entries; > @@ -244,7 +244,7 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, > > /* check that we have enough room in ring */ > if (odp_unlikely(n > free_entries)) { > - if (behavior == ODP_RING_QUEUE_FIXED) { > + if (behavior == ODPH_RING_QUEUE_FIXED) { > return -ENOBUFS; > } else { > /* No free entry available */ > @@ -266,10 +266,10 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, > > /* if we exceed the watermark */ > if (odp_unlikely(((mask + 1) - free_entries + n) > r->prod.watermark)) { > - ret = (behavior == ODP_RING_QUEUE_FIXED) ? -EDQUOT : > - (int)(n | ODP_RING_QUOT_EXCEED); > + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? -EDQUOT : > + (int)(n | ODPH_RING_QUOT_EXCEED); > } else { > - ret = (behavior == ODP_RING_QUEUE_FIXED) ? 0 : n; > + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? 0 : n; > } > > /* > @@ -286,8 +286,8 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, > /** > * Enqueue several objects on a ring (NOT multi-producers safe). > */ > -int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior) > +int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table, > + unsigned n, enum odph_ring_queue_behavior behavior) > { > uint32_t prod_head, cons_tail; > uint32_t prod_next, free_entries; > @@ -305,7 +305,7 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, > > /* check that we have enough room in ring */ > if (odp_unlikely(n > free_entries)) { > - if (behavior == ODP_RING_QUEUE_FIXED) { > + if (behavior == ODPH_RING_QUEUE_FIXED) { > return -ENOBUFS; > } else { > /* No free entry available */ > @@ -325,10 +325,10 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, > > /* if we exceed the watermark */ > if (odp_unlikely(((mask + 1) - free_entries + n) > r->prod.watermark)) { > - ret = (behavior == ODP_RING_QUEUE_FIXED) ? -EDQUOT : > - (int)(n | ODP_RING_QUOT_EXCEED); > + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? -EDQUOT : > + (int)(n | ODPH_RING_QUOT_EXCEED); > } else { > - ret = (behavior == ODP_RING_QUEUE_FIXED) ? 0 : n; > + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? 0 : n; > } > > r->prod.tail = prod_next; > @@ -339,8 +339,8 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, > * Dequeue several objects from a ring (multi-consumers safe). > */ > > -int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior) > +int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table, > + unsigned n, enum odph_ring_queue_behavior behavior) > { > uint32_t cons_head, prod_tail; > uint32_t cons_next, entries; > @@ -364,7 +364,7 @@ int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, > > /* Set the actual entries for dequeue */ > if (n > entries) { > - if (behavior == ODP_RING_QUEUE_FIXED) { > + if (behavior == ODPH_RING_QUEUE_FIXED) { > return -ENOENT; > } else { > if (odp_unlikely(entries == 0)) > @@ -392,14 +392,14 @@ int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, > > r->cons.tail = cons_next; > > - return behavior == ODP_RING_QUEUE_FIXED ? 0 : n; > + return behavior == ODPH_RING_QUEUE_FIXED ? 0 : n; > } > > /** > * Dequeue several objects from a ring (NOT multi-consumers safe). > */ > -int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, > - unsigned n, enum odp_ring_queue_behavior behavior) > +int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table, > + unsigned n, enum odph_ring_queue_behavior behavior) > { > uint32_t cons_head, prod_tail; > uint32_t cons_next, entries; > @@ -415,7 +415,7 @@ int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, > entries = prod_tail - cons_head; > > if (n > entries) { > - if (behavior == ODP_RING_QUEUE_FIXED) { > + if (behavior == ODPH_RING_QUEUE_FIXED) { > return -ENOENT; > } else { > if (odp_unlikely(entries == 0)) > @@ -433,47 +433,51 @@ int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, > odp_mem_barrier(); > > r->cons.tail = cons_next; > - return behavior == ODP_RING_QUEUE_FIXED ? 0 : n; > + return behavior == ODPH_RING_QUEUE_FIXED ? 0 : n; > } > > /** > * Enqueue several objects on the ring (multi-producers safe). > */ > -int odp_ring_mp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, > +int odph_ring_mp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, > unsigned n) > { > - return __odp_ring_mp_do_enqueue(r, obj_table, n, ODP_RING_QUEUE_FIXED); > + return __odph_ring_mp_do_enqueue(r, obj_table, n, > + ODPH_RING_QUEUE_FIXED); > } > > /** > * Enqueue several objects on a ring (NOT multi-producers safe). > */ > -int odp_ring_sp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, > +int odph_ring_sp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, > unsigned n) > { > - return __odp_ring_sp_do_enqueue(r, obj_table, n, ODP_RING_QUEUE_FIXED); > + return __odph_ring_sp_do_enqueue(r, obj_table, n, > + ODPH_RING_QUEUE_FIXED); > } > > /** > * Dequeue several objects from a ring (multi-consumers safe). > */ > -int odp_ring_mc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n) > +int odph_ring_mc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n) > { > - return __odp_ring_mc_do_dequeue(r, obj_table, n, ODP_RING_QUEUE_FIXED); > + return __odph_ring_mc_do_dequeue(r, obj_table, n, > + ODPH_RING_QUEUE_FIXED); > } > > /** > * Dequeue several objects from a ring (NOT multi-consumers safe). > */ > -int odp_ring_sc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n) > +int odph_ring_sc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n) > { > - return __odp_ring_sc_do_dequeue(r, obj_table, n, ODP_RING_QUEUE_FIXED); > + return __odph_ring_sc_do_dequeue(r, obj_table, n, > + ODPH_RING_QUEUE_FIXED); > } > > /** > * Test if a ring is full. > */ > -int odp_ring_full(const odp_ring_t *r) > +int odph_ring_full(const odph_ring_t *r) > { > uint32_t prod_tail = r->prod.tail; > uint32_t cons_tail = r->cons.tail; > @@ -483,7 +487,7 @@ int odp_ring_full(const odp_ring_t *r) > /** > * Test if a ring is empty. > */ > -int odp_ring_empty(const odp_ring_t *r) > +int odph_ring_empty(const odph_ring_t *r) > { > uint32_t prod_tail = r->prod.tail; > uint32_t cons_tail = r->cons.tail; > @@ -493,7 +497,7 @@ int odp_ring_empty(const odp_ring_t *r) > /** > * Return the number of entries in a ring. > */ > -unsigned odp_ring_count(const odp_ring_t *r) > +unsigned odph_ring_count(const odph_ring_t *r) > { > uint32_t prod_tail = r->prod.tail; > uint32_t cons_tail = r->cons.tail; > @@ -503,7 +507,7 @@ unsigned odp_ring_count(const odp_ring_t *r) > /** > * Return the number of free entries in a ring. > */ > -unsigned odp_ring_free_count(const odp_ring_t *r) > +unsigned odph_ring_free_count(const odph_ring_t *r) > { > uint32_t prod_tail = r->prod.tail; > uint32_t cons_tail = r->cons.tail; > @@ -511,7 +515,7 @@ unsigned odp_ring_free_count(const odp_ring_t *r) > } > > /* dump the status of the ring on the console */ > -void odp_ring_dump(const odp_ring_t *r) > +void odph_ring_dump(const odph_ring_t *r) > { > ODP_DBG("ring <%s>@%p\n", r->name, r); > ODP_DBG(" flags=%x\n", r->flags); > @@ -520,8 +524,8 @@ void odp_ring_dump(const odp_ring_t *r) > ODP_DBG(" ch=%"PRIu32"\n", r->cons.head); > ODP_DBG(" pt=%"PRIu32"\n", r->prod.tail); > ODP_DBG(" ph=%"PRIu32"\n", r->prod.head); > - ODP_DBG(" used=%u\n", odp_ring_count(r)); > - ODP_DBG(" avail=%u\n", odp_ring_free_count(r)); > + ODP_DBG(" used=%u\n", odph_ring_count(r)); > + ODP_DBG(" avail=%u\n", odph_ring_free_count(r)); > if (r->prod.watermark == r->prod.size) > ODP_DBG(" watermark=0\n"); > else > @@ -529,27 +533,27 @@ void odp_ring_dump(const odp_ring_t *r) > } > > /* dump the status of all rings on the console */ > -void odp_ring_list_dump(void) > +void odph_ring_list_dump(void) > { > - const odp_ring_t *mp = NULL; > + const odph_ring_t *mp = NULL; > > odp_rwlock_read_lock(&qlock); > > TAILQ_FOREACH(mp, &odp_ring_list, next) { > - odp_ring_dump(mp); > + odph_ring_dump(mp); > } > > odp_rwlock_read_unlock(&qlock); > } > > /* search a ring from its name */ > -odp_ring_t *odp_ring_lookup(const char *name) > +odph_ring_t *odph_ring_lookup(const char *name) > { > - odp_ring_t *r = odp_shm_lookup(name); > + odph_ring_t *r = odp_shm_lookup(name); > > odp_rwlock_read_lock(&qlock); > TAILQ_FOREACH(r, &odp_ring_list, next) { > - if (strncmp(name, r->name, ODP_RING_NAMESIZE) == 0) > + if (strncmp(name, r->name, ODPH_RING_NAMESIZE) == 0) > break; > } > odp_rwlock_read_unlock(&qlock); > @@ -560,60 +564,60 @@ odp_ring_t *odp_ring_lookup(const char *name) > /** > * Enqueue several objects on the ring (multi-producers safe). > */ > -int odp_ring_mp_enqueue_burst(odp_ring_t *r, void * const *obj_table, > +int odph_ring_mp_enqueue_burst(odph_ring_t *r, void * const *obj_table, > unsigned n) > { > - return __odp_ring_mp_do_enqueue(r, obj_table, n, > - ODP_RING_QUEUE_VARIABLE); > + return __odph_ring_mp_do_enqueue(r, obj_table, n, > + ODPH_RING_QUEUE_VARIABLE); > } > > /** > * Enqueue several objects on a ring (NOT multi-producers safe). > */ > -int odp_ring_sp_enqueue_burst(odp_ring_t *r, void * const *obj_table, > +int odph_ring_sp_enqueue_burst(odph_ring_t *r, void * const *obj_table, > unsigned n) > { > - return __odp_ring_sp_do_enqueue(r, obj_table, n, > - ODP_RING_QUEUE_VARIABLE); > + return __odph_ring_sp_do_enqueue(r, obj_table, n, > + ODPH_RING_QUEUE_VARIABLE); > } > > /** > * Enqueue several objects on a ring. > */ > -int odp_ring_enqueue_burst(odp_ring_t *r, void * const *obj_table, > +int odph_ring_enqueue_burst(odph_ring_t *r, void * const *obj_table, > unsigned n) > { > if (r->prod.sp_enqueue) > - return odp_ring_sp_enqueue_burst(r, obj_table, n); > + return odph_ring_sp_enqueue_burst(r, obj_table, n); > else > - return odp_ring_mp_enqueue_burst(r, obj_table, n); > + return odph_ring_mp_enqueue_burst(r, obj_table, n); > } > > /** > * Dequeue several objects from a ring (multi-consumers safe). > */ > -int odp_ring_mc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n) > +int odph_ring_mc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n) > { > - return __odp_ring_mc_do_dequeue(r, obj_table, n, > - ODP_RING_QUEUE_VARIABLE); > + return __odph_ring_mc_do_dequeue(r, obj_table, n, > + ODPH_RING_QUEUE_VARIABLE); > } > > /** > * Dequeue several objects from a ring (NOT multi-consumers safe). > */ > -int odp_ring_sc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n) > +int odph_ring_sc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n) > { > - return __odp_ring_sc_do_dequeue(r, obj_table, n, > - ODP_RING_QUEUE_VARIABLE); > + return __odph_ring_sc_do_dequeue(r, obj_table, n, > + ODPH_RING_QUEUE_VARIABLE); > } > > /** > * Dequeue multiple objects from a ring up to a maximum number. > */ > -int odp_ring_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n) > +int odph_ring_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n) > { > if (r->cons.sc_dequeue) > - return odp_ring_sc_dequeue_burst(r, obj_table, n); > + return odph_ring_sc_dequeue_burst(r, obj_table, n); > else > - return odp_ring_mc_dequeue_burst(r, obj_table, n); > + return odph_ring_mc_dequeue_burst(r, obj_table, n); > } > diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-keystone2/Makefile.am > index 8e5fbb3..027c035 100644 > --- a/platform/linux-keystone2/Makefile.am > +++ b/platform/linux-keystone2/Makefile.am > @@ -20,7 +20,7 @@ AM_CFLAGS += -I$(srcdir)/include > AM_CFLAGS += -I$(srcdir)/include/api > AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include > AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include/api > -AM_CFLAGS += -I$(top_srcdir)/include > +AM_CFLAGS += -I$(top_srcdir)/helper/include > KS2_LIBS="-lopenem_rh -lopenem_osal" > LIBS += $(KS2_LIBS) > > @@ -57,13 +57,13 @@ include_HEADERS = \ > > subdirheadersdir = $(includedir)/helper > subdirheaders_HEADERS = \ > - $(top_srcdir)/include/helper/odp_chksum.h \ > - $(top_srcdir)/include/helper/odp_eth.h \ > - $(top_srcdir)/include/helper/odp_ip.h \ > - $(top_srcdir)/include/helper/odp_linux.h \ > - $(top_srcdir)/include/helper/odp_packet_helper.h \ > - $(top_srcdir)/include/helper/odp_ring.h \ > - $(top_srcdir)/include/helper/odp_udp.h > + $(top_srcdir)/helper/include/odph_chksum.h \ > + $(top_srcdir)/helper/include/odph_eth.h \ > + $(top_srcdir)/helper/include/odph_ip.h \ > + $(top_srcdir)/helper/include/odph_linux.h \ > + $(top_srcdir)/helper/include/odph_packet.h \ > + $(top_srcdir)/helper/include/odph_ring.h \ > + $(top_srcdir)/helper/include/odph_udp.h > > __LIB__libodp_la_SOURCES = \ > ../linux-generic/odp_barrier.c \ > diff --git a/platform/linux-keystone2/odp_packet.c b/platform/linux-keystone2/odp_packet.c > index 271d66b..fac0d22 100644 > --- a/platform/linux-keystone2/odp_packet.c > +++ b/platform/linux-keystone2/odp_packet.c > @@ -10,16 +10,16 @@ > #include <odp_byteorder.h> > #include <ti_em_rh.h> > > -#include <helper/odp_eth.h> > -#include <helper/odp_ip.h> > +#include <odph_eth.h> > +#include <odph_ip.h> > > #include <string.h> > #include <stdio.h> > > -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > - size_t *offset_out); > -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, > - size_t *offset_out); > +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, > + odph_ipv4hdr_t *ipv4, size_t *offset_out); > +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, > + odph_ipv6hdr_t *ipv6, size_t *offset_out); > > void odp_packet_init(odp_packet_t pkt) > { > @@ -135,10 +135,10 @@ void odp_packet_set_l4_offset(odp_packet_t pkt, size_t offset) > void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > { > odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); > - odp_ethhdr_t *eth; > - odp_vlanhdr_t *vlan; > - odp_ipv4hdr_t *ipv4; > - odp_ipv6hdr_t *ipv6; > + odph_ethhdr_t *eth; > + odph_vlanhdr_t *vlan; > + odph_ipv4hdr_t *ipv4; > + odph_ipv6hdr_t *ipv6; > uint16_t ethtype; > size_t offset = 0; > uint8_t ip_proto = 0; > @@ -146,10 +146,10 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > pkt_hdr->input_flags.eth = 1; > pkt_hdr->frame_offset = frame_offset; > > - if (odp_unlikely(len < ODP_ETH_LEN_MIN)) { > + if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) { > pkt_hdr->error_flags.frame_len = 1; > return; > - } else if (len > ODP_ETH_LEN_MAX) { > + } else if (len > ODPH_ETH_LEN_MAX) { > pkt_hdr->input_flags.jumbo = 1; > } > > @@ -160,40 +160,40 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > pkt_hdr->input_flags.l2 = 1; > pkt_hdr->l2_offset = frame_offset; > > - eth = (odp_ethhdr_t *)odp_packet_start(pkt); > + eth = (odph_ethhdr_t *)odp_packet_start(pkt); > ethtype = odp_be_to_cpu_16(eth->type); > - vlan = (odp_vlanhdr_t *)ð->type; > + vlan = (odph_vlanhdr_t *)ð->type; > > - if (ethtype == ODP_ETHTYPE_VLAN_OUTER) { > + if (ethtype == ODPH_ETHTYPE_VLAN_OUTER) { > pkt_hdr->input_flags.vlan_qinq = 1; > ethtype = odp_be_to_cpu_16(vlan->tpid); > - offset += sizeof(odp_vlanhdr_t); > + offset += sizeof(odph_vlanhdr_t); > vlan = &vlan[1]; > } > > - if (ethtype == ODP_ETHTYPE_VLAN) { > + if (ethtype == ODPH_ETHTYPE_VLAN) { > pkt_hdr->input_flags.vlan = 1; > ethtype = odp_be_to_cpu_16(vlan->tpid); > - offset += sizeof(odp_vlanhdr_t); > + offset += sizeof(odph_vlanhdr_t); > } > > /* Set l3_offset+flag only for known ethtypes */ > switch (ethtype) { > - case ODP_ETHTYPE_IPV4: > + case ODPH_ETHTYPE_IPV4: > pkt_hdr->input_flags.ipv4 = 1; > pkt_hdr->input_flags.l3 = 1; > - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; > - ipv4 = (odp_ipv4hdr_t *)odp_packet_l3(pkt); > + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; > + ipv4 = (odph_ipv4hdr_t *)odp_packet_l3(pkt); > ip_proto = parse_ipv4(pkt_hdr, ipv4, &offset); > break; > - case ODP_ETHTYPE_IPV6: > + case ODPH_ETHTYPE_IPV6: > pkt_hdr->input_flags.ipv6 = 1; > pkt_hdr->input_flags.l3 = 1; > - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; > - ipv6 = (odp_ipv6hdr_t *)odp_packet_l3(pkt); > + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; > + ipv6 = (odph_ipv6hdr_t *)odp_packet_l3(pkt); > ip_proto = parse_ipv6(pkt_hdr, ipv6, &offset); > break; > - case ODP_ETHTYPE_ARP: > + case ODPH_ETHTYPE_ARP: > pkt_hdr->input_flags.arp = 1; > /* fall through */ > default: > @@ -202,22 +202,22 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > } > > switch (ip_proto) { > - case ODP_IPPROTO_UDP: > + case ODPH_IPPROTO_UDP: > pkt_hdr->input_flags.udp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_TCP: > + case ODPH_IPPROTO_TCP: > pkt_hdr->input_flags.tcp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_SCTP: > + case ODPH_IPPROTO_SCTP: > pkt_hdr->input_flags.sctp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > break; > - case ODP_IPPROTO_ICMP: > + case ODPH_IPPROTO_ICMP: > pkt_hdr->input_flags.icmp = 1; > pkt_hdr->input_flags.l4 = 1; > pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; > @@ -232,19 +232,19 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) > } > } > > -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > - size_t *offset_out) > +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, > + odph_ipv4hdr_t *ipv4, size_t *offset_out) > { > uint8_t ihl; > uint16_t frag_offset; > > - ihl = ODP_IPV4HDR_IHL(ipv4->ver_ihl); > - if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) { > + ihl = ODPH_IPV4HDR_IHL(ipv4->ver_ihl); > + if (odp_unlikely(ihl < ODPH_IPV4HDR_IHL_MIN)) { > pkt_hdr->error_flags.ip_err = 1; > return 0; > } > > - if (odp_unlikely(ihl > ODP_IPV4HDR_IHL_MIN)) { > + if (odp_unlikely(ihl > ODPH_IPV4HDR_IHL_MIN)) { > pkt_hdr->input_flags.ipopt = 1; > return 0; > } > @@ -255,13 +255,13 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > * "fragment offset" field is nonzero (all fragments except the first) > */ > frag_offset = odp_be_to_cpu_16(ipv4->frag_offset); > - if (odp_unlikely(ODP_IPV4HDR_IS_FRAGMENT(frag_offset))) { > + if (odp_unlikely(ODPH_IPV4HDR_IS_FRAGMENT(frag_offset))) { > pkt_hdr->input_flags.ipfrag = 1; > return 0; > } > > - if (ipv4->proto == ODP_IPPROTO_ESP || > - ipv4->proto == ODP_IPPROTO_AH) { > + if (ipv4->proto == ODPH_IPPROTO_ESP || > + ipv4->proto == ODPH_IPPROTO_AH) { > pkt_hdr->input_flags.ipsec = 1; > return 0; > } > @@ -272,24 +272,24 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, > return ipv4->proto; > } > > -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, > - size_t *offset_out) > +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, > + odph_ipv6hdr_t *ipv6, size_t *offset_out) > { > - if (ipv6->next_hdr == ODP_IPPROTO_ESP || > - ipv6->next_hdr == ODP_IPPROTO_AH) { > + if (ipv6->next_hdr == ODPH_IPPROTO_ESP || > + ipv6->next_hdr == ODPH_IPPROTO_AH) { > pkt_hdr->input_flags.ipopt = 1; > pkt_hdr->input_flags.ipsec = 1; > return 0; > } > > - if (odp_unlikely(ipv6->next_hdr == ODP_IPPROTO_FRAG)) { > + if (odp_unlikely(ipv6->next_hdr == ODPH_IPPROTO_FRAG)) { > pkt_hdr->input_flags.ipopt = 1; > pkt_hdr->input_flags.ipfrag = 1; > return 0; > } > > /* Don't step through more extensions */ > - *offset_out = ODP_IPV6HDR_LEN; > + *offset_out = ODPH_IPV6HDR_LEN; > return ipv6->next_hdr; > } > > diff --git a/test/Makefile.inc b/test/Makefile.inc > index b549001..4de2feb 100644 > --- a/test/Makefile.inc > +++ b/test/Makefile.inc > @@ -5,6 +5,6 @@ AM_CFLAGS += \ > -I$(srcdir) \ > -I$(top_srcdir)/platform/@with_platform@/include/api \ > -I$(top_srcdir)/platform/linux-generic/include/api \ > - -I$(top_srcdir)/include > + -I$(top_srcdir)/helper/include > > AM_LDFLAGS += -L$(LIB) > diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h > index d6eec04..7814da5 100644 > --- a/test/api_test/odp_atomic_test.h > +++ b/test/api_test/odp_atomic_test.h > @@ -8,7 +8,7 @@ > #define ODP_ATOMIC_TEST_H_ > > #include <odp.h> > -#include <helper/odp_linux.h> > +#include <odph_linux.h> > > /** > * add_sub_cnt could be any valid value > diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c > index 89ebd2d..b0a6fbc 100644 > --- a/test/api_test/odp_common.c > +++ b/test/api_test/odp_common.c > @@ -12,14 +12,14 @@ > > #include <string.h> > #include <odp.h> > -#include <helper/odp_linux.h> > +#include <odph_linux.h> > #include <odp_common.h> > #include <odp_atomic_test.h> > #include <odp_shm_test.h> > > > /* Globals */ > -static odp_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads table */ > +static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads table*/ > static int num_workers; /**< number of workers */ > __thread test_shared_data_t *test_shared_data; /**< pointer to shared data */ > > @@ -73,8 +73,8 @@ int odp_test_global_init(void) > int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) > { > /* Create and init additional threads */ > - odp_linux_pthread_create(thread_tbl, arg->numthrds, 0, func_ptr, > - (void *)arg); > + odph_linux_pthread_create(thread_tbl, arg->numthrds, 0, func_ptr, > + (void *)arg); > > return 0; > } > @@ -83,7 +83,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) > int odp_test_thread_exit(pthrd_arg *arg) > { > /* Wait for other threads to exit */ > - odp_linux_pthread_join(thread_tbl, arg->numthrds); > + odph_linux_pthread_join(thread_tbl, arg->numthrds); > > return 0; > } > diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c > index 93bd869..d75c30b 100644 > --- a/test/api_test/odp_ring_test.c > +++ b/test/api_test/odp_ring_test.c > @@ -50,14 +50,14 @@ > #include <odp.h> > #include <odp_debug.h> > #include <odp_common.h> > -#include <helper/odp_ring.h> > +#include <odph_ring.h> > > #define RING_SIZE 4096 > #define MAX_BULK 32 > > #define RING_TEST_BASIC > > -static int test_ring_basic(odp_ring_t *r) > +static int test_ring_basic(odph_ring_t *r) > { > void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; > int ret; > @@ -86,48 +86,48 @@ static int test_ring_basic(odp_ring_t *r) > > printf("Test SP & SC basic functions\n"); > printf("enqueue 1 obj\n"); > - ret = odp_ring_sp_enqueue_burst(r, cur_src, 1); > + ret = odph_ring_sp_enqueue_burst(r, cur_src, 1); > cur_src += 1; > - if ((ret & ODP_RING_SZ_MASK) != 1) { > + if ((ret & ODPH_RING_SZ_MASK) != 1) { > ODP_ERR("sp_enq for 1 obj failed\n"); > goto fail; > } > > printf("enqueue 2 objs\n"); > - ret = odp_ring_sp_enqueue_burst(r, cur_src, 2); > + ret = odph_ring_sp_enqueue_burst(r, cur_src, 2); > cur_src += 2; > - if ((ret & ODP_RING_SZ_MASK) != 2) { > + if ((ret & ODPH_RING_SZ_MASK) != 2) { > ODP_ERR("sp_enq for 2 obj failed\n"); > goto fail; > } > > printf("enqueue MAX_BULK objs\n"); > - ret = odp_ring_sp_enqueue_burst(r, cur_src, MAX_BULK); > - if ((ret & ODP_RING_SZ_MASK) != MAX_BULK) { > + ret = odph_ring_sp_enqueue_burst(r, cur_src, MAX_BULK); > + if ((ret & ODPH_RING_SZ_MASK) != MAX_BULK) { > ODP_ERR("sp_enq for %d obj failed\n", MAX_BULK); > goto fail; > } > > printf("dequeue 1 obj\n"); > - ret = odp_ring_sc_dequeue_burst(r, cur_dst, 1); > + ret = odph_ring_sc_dequeue_burst(r, cur_dst, 1); > cur_dst += 1; > - if ((ret & ODP_RING_SZ_MASK) != 1) { > + if ((ret & ODPH_RING_SZ_MASK) != 1) { > ODP_ERR("sc_deq for 1 obj failed\n"); > goto fail; > } > > printf("dequeue 2 objs\n"); > - ret = odp_ring_sc_dequeue_burst(r, cur_dst, 2); > + ret = odph_ring_sc_dequeue_burst(r, cur_dst, 2); > cur_dst += 2; > - if ((ret & ODP_RING_SZ_MASK) != 2) { > + if ((ret & ODPH_RING_SZ_MASK) != 2) { > ODP_ERR("sc_deq for 2 obj failed\n"); > goto fail; > } > > printf("dequeue MAX_BULK objs\n"); > - ret = odp_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK); > + ret = odph_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK); > cur_dst += MAX_BULK; > - if ((ret & ODP_RING_SZ_MASK) != MAX_BULK) { > + if ((ret & ODPH_RING_SZ_MASK) != MAX_BULK) { > ODP_ERR("sc_deq for %d obj failed\n", MAX_BULK); > goto fail; > } > @@ -144,41 +144,41 @@ static int test_ring_basic(odp_ring_t *r) > printf("Test MP & MC basic functions\n"); > > printf("enqueue 1 obj\n"); > - ret = odp_ring_mp_enqueue_bulk(r, cur_src, 1); > + ret = odph_ring_mp_enqueue_bulk(r, cur_src, 1); > cur_src += 1; > if (ret != 0) { > ODP_ERR("mp_enq for 1 obj failed\n"); > goto fail; > } > printf("enqueue 2 objs\n"); > - ret = odp_ring_mp_enqueue_bulk(r, cur_src, 2); > + ret = odph_ring_mp_enqueue_bulk(r, cur_src, 2); > cur_src += 2; > if (ret != 0) { > ODP_ERR("mp_enq for 2 obj failed\n"); > goto fail; > } > printf("enqueue MAX_BULK objs\n"); > - ret = odp_ring_mp_enqueue_bulk(r, cur_src, MAX_BULK); > + ret = odph_ring_mp_enqueue_bulk(r, cur_src, MAX_BULK); > if (ret != 0) { > ODP_ERR("mp_enq for %d obj failed\n", MAX_BULK); > goto fail; > } > printf("dequeue 1 obj\n"); > - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, 1); > + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, 1); > cur_dst += 1; > if (ret != 0) { > ODP_ERR("mc_deq for 1 obj failed\n"); > goto fail; > } > printf("dequeue 2 objs\n"); > - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, 2); > + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, 2); > cur_dst += 2; > if (ret != 0) { > ODP_ERR("mc_deq for 2 obj failed\n"); > goto fail; > } > printf("dequeue MAX_BULK objs\n"); > - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, MAX_BULK); > + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, MAX_BULK); > cur_dst += MAX_BULK; > if (ret != 0) { > ODP_ERR("mc_deq for %d obj failed\n", MAX_BULK); > @@ -191,30 +191,30 @@ static int test_ring_basic(odp_ring_t *r) > } > > printf("test watermark and default bulk enqueue / dequeue\n"); > - odp_ring_set_water_mark(r, 20); > + odph_ring_set_water_mark(r, 20); > num_elems = 16; > > cur_src = src; > cur_dst = dst; > > - ret = odp_ring_mp_enqueue_bulk(r, cur_src, num_elems); > + ret = odph_ring_mp_enqueue_bulk(r, cur_src, num_elems); > cur_src += num_elems; > if (ret != 0) { > ODP_ERR("Cannot enqueue\n"); > goto fail; > } > - ret = odp_ring_mp_enqueue_bulk(r, cur_src, num_elems); > + ret = odph_ring_mp_enqueue_bulk(r, cur_src, num_elems); > if (ret != -EDQUOT) { > ODP_ERR("Watermark not exceeded\n"); > goto fail; > } > - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, num_elems); > + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, num_elems); > cur_dst += num_elems; > if (ret != 0) { > ODP_ERR("Cannot dequeue\n"); > goto fail; > } > - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, num_elems); > + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, num_elems); > cur_dst += num_elems; > if (ret != 0) { > ODP_ERR("Cannot dequeue2\n"); > @@ -241,7 +241,7 @@ fail: > } > > /* global shared ring used for stress testing */ > -static odp_ring_t *r_stress; > +static odph_ring_t *r_stress; > > /* Stress func for Multi producer only */ > static int producer_fn(void) > @@ -260,7 +260,7 @@ static int producer_fn(void) > src[i] = (void *)(unsigned long)i; > > do { > - i = odp_ring_mp_enqueue_bulk(r_stress, src, MAX_BULK); > + i = odph_ring_mp_enqueue_bulk(r_stress, src, MAX_BULK); > if (i == 0) > return 0; > } while (1); > @@ -280,7 +280,7 @@ static int consumer_fn(void) > } > > do { > - i = odp_ring_mc_dequeue_bulk(r_stress, src, MAX_BULK); > + i = odph_ring_mc_dequeue_bulk(r_stress, src, MAX_BULK); > if (i == 0) { > for (i = 0; i < MAX_BULK; i++) { > if (src[i] != (void *)(unsigned long)i) { > @@ -351,8 +351,8 @@ static void *test_ring(void *arg) > { > ring_arg_t *parg = (ring_arg_t *)arg; > int thr; > - char ring_name[ODP_RING_NAMESIZE]; > - odp_ring_t *r; > + char ring_name[ODPH_RING_NAMESIZE]; > + odph_ring_t *r; > int result = 0; > > thr = odp_thread_id(); > @@ -363,7 +363,7 @@ static void *test_ring(void *arg) > case ODP_RING_TEST_BASIC: > snprintf(ring_name, sizeof(ring_name), "test_ring_%i", thr); > > - r = odp_ring_create(ring_name, RING_SIZE, > + r = odph_ring_create(ring_name, RING_SIZE, > 0 /* not used, alignement > taken care inside func : todo */); > if (r == NULL) { > @@ -372,7 +372,7 @@ static void *test_ring(void *arg) > break; > } > /* lookup ring from its name */ > - if (odp_ring_lookup(ring_name) != r) { > + if (odph_ring_lookup(ring_name) != r) { > ODP_ERR("ring lookup failed\n"); > result = -1; > break; > @@ -385,7 +385,7 @@ static void *test_ring(void *arg) > } > > /* dump ring stats */ > - odp_ring_list_dump(); > + odph_ring_list_dump(); > > break; > > @@ -393,7 +393,7 @@ static void *test_ring(void *arg) > test_ring_stress(parg->stress_type); > > /* dump ring stats */ > - odp_ring_list_dump(); > + odph_ring_list_dump(); > break; > > default: > @@ -423,7 +423,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) > > odp_print_system_info(); > > - odp_ring_tailq_init(); > + odph_ring_tailq_init(); > > rarg.thrdarg.numthrds = odp_sys_core_count(); > > @@ -433,13 +433,13 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) > rarg.thrdarg.testcase = ODP_RING_TEST_STRESS; > rarg.stress_type = one_enq_one_deq; > /* rarg.stress_type = multi_enq_multi_deq;*/ > - char ring_name[ODP_RING_NAMESIZE]; > + char ring_name[ODPH_RING_NAMESIZE]; > > printf("starting stess test type : %d..\n", rarg.stress_type); > /* create a ring */ > snprintf(ring_name, sizeof(ring_name), "test_ring_stress"); > > - r_stress = odp_ring_create(ring_name, RING_SIZE, > + r_stress = odph_ring_create(ring_name, RING_SIZE, > 0 /* not used, alignement > taken care inside func : todo */); > if (r_stress == NULL) { > @@ -447,7 +447,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) > goto fail; > } > /* lookup ring from its name */ > - if (odp_ring_lookup(ring_name) != r_stress) { > + if (odph_ring_lookup(ring_name) != r_stress) { > ODP_ERR("ring lookup failed\n"); > goto fail; > } > diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c > index c1cc255..6ba30d3 100644 > --- a/test/api_test/odp_timer_ping.c > +++ b/test/api_test/odp_timer_ping.c > @@ -35,8 +35,8 @@ > #include <odp.h> > #include <odp_common.h> > #include <odp_timer.h> > -#include <helper/odp_linux.h> > -#include <helper/odp_chksum.h> > +#include <odph_linux.h> > +#include <odph_chksum.h> > > #define MSG_POOL_SIZE (4*1024*1024) > #define BUF_SIZE 8 > @@ -309,7 +309,7 @@ static int ping_init(int count, char *name[]) > > int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) > { > - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; > + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; > ping_arg_t pingarg; > odp_queue_t queue; > odp_buffer_pool_t pool; > @@ -371,12 +371,12 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) > run_thread = rx_ping; > > /* Create and launch worker threads */ > - odp_linux_pthread_create(&thread_tbl[i], 1, i, > - run_thread, (pthrd_arg *)&pingarg); > + odph_linux_pthread_create(&thread_tbl[i], 1, i, > + run_thread, (pthrd_arg *)&pingarg); > } > > /* Wait for worker threads to exit */ > - odp_linux_pthread_join(thread_tbl, PING_THRD); > + odph_linux_pthread_join(thread_tbl, PING_THRD); > > ODP_DBG("ping timer test %s\n", (pingarg.result == 0) ? "passed" : "failed"); >
diff --git a/.gitignore b/.gitignore index 39c8d77..6a97f17 100644 --- a/.gitignore +++ b/.gitignore @@ -14,15 +14,15 @@ config.guess config.sub configure depcomp -include/config.h.in install-sh ltmain.sh m4/*.m4 missing config.log config.status -include/config.h -include/stamp-h1 +helper/config.h.in +helper/config.h +helper/stamp-h1 libtool pkgconfig/libodp.pc .deps/ diff --git a/configure.ac b/configure.ac index e33e1a5..76cf638 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ AC_PREREQ([2.5]) AC_INIT([OpenDataPlane], [0.2], [lng-odp@lists.linaro.org]) AM_INIT_AUTOMAKE([subdir-objects]) -AC_CONFIG_SRCDIR([include/config.h.in]) -AM_CONFIG_HEADER([include/config.h]) +AC_CONFIG_SRCDIR([helper/config.h.in]) +AM_CONFIG_HEADER([helper/config.h]) AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg index 939b237..5d1e191 100644 --- a/doc/doxygen.cfg +++ b/doc/doxygen.cfg @@ -9,7 +9,7 @@ TYPEDEF_HIDES_STRUCT = YES EXTRACT_STATIC = YES SORT_MEMBER_DOCS = NO WARN_NO_PARAMDOC = YES -INPUT = $(SRCDIR)/doc $(SRCDIR)/doc/users-guide $(SRCDIR)/doc/api $(SRCDIR)/platform/linux-generic/include/api $(SRCDIR)/include/helper $(SRCDIR)/example +INPUT = $(SRCDIR)/doc $(SRCDIR)/doc/users-guide $(SRCDIR)/doc/api $(SRCDIR)/platform/linux-generic/include/api $(SRCDIR)/helper/include $(SRCDIR)/example FILE_PATTERNS = odp*.h odp*.c *.dox RECURSIVE = YES SOURCE_BROWSER = YES diff --git a/example/Makefile.inc b/example/Makefile.inc index b549001..4de2feb 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -5,6 +5,6 @@ AM_CFLAGS += \ -I$(srcdir) \ -I$(top_srcdir)/platform/@with_platform@/include/api \ -I$(top_srcdir)/platform/linux-generic/include/api \ - -I$(top_srcdir)/include + -I$(top_srcdir)/helper/include AM_LDFLAGS += -L$(LIB) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 9fa9b37..65c2034 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -18,12 +18,12 @@ #include <odp.h> #include <odp_packet_io.h> -#include <helper/odp_linux.h> -#include <helper/odp_packet_helper.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> -#include <helper/odp_udp.h> -#include <helper/odp_icmp.h> +#include <odph_linux.h> +#include <odph_packet.h> +#include <odph_eth.h> +#include <odph_ip.h> +#include <odph_udp.h> +#include <odph_icmp.h> #define MAX_WORKERS 32 /**< max number of works */ #define SHM_PKT_POOL_SIZE (512*2048) /**< pkt pool size */ @@ -47,8 +47,8 @@ typedef struct { int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ odp_buffer_pool_t pool; /**< Buffer pool for packet IO */ - odp_ethaddr_t srcmac; /**< src mac addr */ - odp_ethaddr_t dstmac; /**< dest mac addr */ + odph_ethaddr_t srcmac; /**< src mac addr */ + odph_ethaddr_t dstmac; /**< dest mac addr */ unsigned int srcip; /**< src ip addr */ unsigned int dstip; /**< dest ip addr */ int mode; /**< work mode */ @@ -94,7 +94,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args); static void print_info(char *progname, appl_args_t *appl_args); static void usage(char *progname); static int scan_ip(char *buf, unsigned int *paddr); -static int scan_mac(char *in, odp_ethaddr_t *des); +static int scan_mac(char *in, odph_ethaddr_t *des); static void tv_sub(struct timeval *recvtime, struct timeval *sendtime); /** @@ -146,7 +146,7 @@ static int scan_ip(char *buf, unsigned int *paddr) * @param des mac for odp_packet * @return 1 success, 0 failed */ -static int scan_mac(char *in, odp_ethaddr_t *des) +static int scan_mac(char *in, odph_ethaddr_t *des) { int field; int i; @@ -173,9 +173,9 @@ static void pack_udp_pkt(odp_buffer_t obuf) char *buf; int max; odp_packet_t pkt; - odp_ethhdr_t *eth; - odp_ipv4hdr_t *ip; - odp_udphdr_t *udp; + odph_ethhdr_t *eth; + odph_ipv4hdr_t *ip; + odph_udphdr_t *udp; unsigned short seq; buf = odp_buffer_addr(obuf); @@ -188,33 +188,33 @@ static void pack_udp_pkt(odp_buffer_t obuf) pkt = odp_packet_from_buffer(obuf); /* ether */ odp_packet_set_l2_offset(pkt, 0); - eth = (odp_ethhdr_t *)buf; - memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODP_ETHADDR_LEN); - memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODP_ETHADDR_LEN); - eth->type = odp_cpu_to_be_16(ODP_ETHTYPE_IPV4); + eth = (odph_ethhdr_t *)buf; + memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODPH_ETHADDR_LEN); + memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODPH_ETHADDR_LEN); + eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); /* ip */ - odp_packet_set_l3_offset(pkt, ODP_ETHHDR_LEN); - ip = (odp_ipv4hdr_t *)(buf + ODP_ETHHDR_LEN); + odp_packet_set_l3_offset(pkt, ODPH_ETHHDR_LEN); + ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); ip->dst_addr = odp_cpu_to_be_32(args->appl.dstip); ip->src_addr = odp_cpu_to_be_32(args->appl.srcip); - ip->ver_ihl = ODP_IPV4 << 4 | ODP_IPV4HDR_IHL_MIN; - ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODP_UDPHDR_LEN + - ODP_IPV4HDR_LEN); - ip->proto = ODP_IPPROTO_UDP; + ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN; + ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODPH_UDPHDR_LEN + + ODPH_IPV4HDR_LEN); + ip->proto = ODPH_IPPROTO_UDP; seq = odp_atomic_fetch_add_u64(&counters.seq, 1) % 0xFFFF; ip->id = odp_cpu_to_be_16(seq); ip->chksum = 0; - odp_ipv4_csum_update(pkt); + odph_ipv4_csum_update(pkt); /* udp */ - odp_packet_set_l4_offset(pkt, ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN); - udp = (odp_udphdr_t *)(buf + ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN); + odp_packet_set_l4_offset(pkt, ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); + udp = (odph_udphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); udp->src_port = 0; udp->dst_port = 0; - udp->length = odp_cpu_to_be_16(args->appl.payload + ODP_UDPHDR_LEN); + udp->length = odp_cpu_to_be_16(args->appl.payload + ODPH_UDPHDR_LEN); udp->chksum = 0; - udp->chksum = odp_cpu_to_be_16(odp_ipv4_udp_chksum(pkt)); - odp_packet_set_len(pkt, args->appl.payload + ODP_UDPHDR_LEN + - ODP_IPV4HDR_LEN + ODP_ETHHDR_LEN); + udp->chksum = odp_cpu_to_be_16(odph_ipv4_udp_chksum(pkt)); + odp_packet_set_len(pkt, args->appl.payload + ODPH_UDPHDR_LEN + + ODPH_IPV4HDR_LEN + ODPH_ETHHDR_LEN); } /** @@ -227,9 +227,9 @@ static void pack_icmp_pkt(odp_buffer_t obuf) char *buf; int max; odp_packet_t pkt; - odp_ethhdr_t *eth; - odp_ipv4hdr_t *ip; - odp_icmphdr_t *icmp; + odph_ethhdr_t *eth; + odph_ipv4hdr_t *ip; + odph_icmphdr_t *icmp; struct timeval tval; uint8_t *tval_d; unsigned short seq; @@ -245,41 +245,41 @@ static void pack_icmp_pkt(odp_buffer_t obuf) pkt = odp_packet_from_buffer(obuf); /* ether */ odp_packet_set_l2_offset(pkt, 0); - eth = (odp_ethhdr_t *)buf; - memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODP_ETHADDR_LEN); - memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODP_ETHADDR_LEN); - eth->type = odp_cpu_to_be_16(ODP_ETHTYPE_IPV4); + eth = (odph_ethhdr_t *)buf; + memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODPH_ETHADDR_LEN); + memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODPH_ETHADDR_LEN); + eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); /* ip */ - odp_packet_set_l3_offset(pkt, ODP_ETHHDR_LEN); - ip = (odp_ipv4hdr_t *)(buf + ODP_ETHHDR_LEN); + odp_packet_set_l3_offset(pkt, ODPH_ETHHDR_LEN); + ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); ip->dst_addr = odp_cpu_to_be_32(args->appl.dstip); ip->src_addr = odp_cpu_to_be_32(args->appl.srcip); - ip->ver_ihl = ODP_IPV4 << 4 | ODP_IPV4HDR_IHL_MIN; - ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODP_ICMPHDR_LEN + - ODP_IPV4HDR_LEN); - ip->proto = ODP_IPPROTO_ICMP; + ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN; + ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODPH_ICMPHDR_LEN + + ODPH_IPV4HDR_LEN); + ip->proto = ODPH_IPPROTO_ICMP; seq = odp_atomic_fetch_add_u64(&counters.seq, 1) % 0xffff; ip->id = odp_cpu_to_be_16(seq); ip->chksum = 0; - odp_ipv4_csum_update(pkt); + odph_ipv4_csum_update(pkt); /* icmp */ - icmp = (odp_icmphdr_t *)(buf + ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN); + icmp = (odph_icmphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); icmp->type = ICMP_ECHO; icmp->code = 0; icmp->un.echo.id = 0; icmp->un.echo.sequence = ip->id; - tval_d = (uint8_t *)(buf + ODP_ETHHDR_LEN + ODP_IPV4HDR_LEN + - ODP_ICMPHDR_LEN); + tval_d = (uint8_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN + + ODPH_ICMPHDR_LEN); /* TODO This should be changed to use an * ODP timer API once one exists. */ gettimeofday(&tval, NULL); memcpy(tval_d, &tval, sizeof(struct timeval)); icmp->chksum = 0; icmp->chksum = odp_chksum(icmp, args->appl.payload + - ODP_ICMPHDR_LEN); + ODPH_ICMPHDR_LEN); - odp_packet_set_len(pkt, args->appl.payload + ODP_ICMPHDR_LEN + - ODP_IPV4HDR_LEN + ODP_ETHHDR_LEN); + odp_packet_set_len(pkt, args->appl.payload + ODPH_ICMPHDR_LEN + + ODPH_IPV4HDR_LEN + ODPH_ETHHDR_LEN); } /** @@ -380,9 +380,9 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) { odp_packet_t pkt; char *buf; - odp_ipv4hdr_t *ip; - odp_udphdr_t *udp; - odp_icmphdr_t *icmp; + odph_ipv4hdr_t *ip; + odph_udphdr_t *udp; + odph_icmphdr_t *icmp; struct timeval tvrecv; struct timeval tvsend; double rtt; @@ -401,27 +401,27 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) odp_atomic_inc_u64(&counters.ip); rlen += sprintf(msg, "receive Packet proto:IP "); buf = odp_buffer_addr(odp_buffer_from_packet(pkt)); - ip = (odp_ipv4hdr_t *)(buf + odp_packet_l3_offset(pkt)); + ip = (odph_ipv4hdr_t *)(buf + odp_packet_l3_offset(pkt)); rlen += sprintf(msg + rlen, "id %d ", odp_be_to_cpu_16(ip->id)); offset = odp_packet_l4_offset(pkt); /* udp */ - if (ip->proto == ODP_IPPROTO_UDP) { + if (ip->proto == ODPH_IPPROTO_UDP) { odp_atomic_inc_u64(&counters.udp); - udp = (odp_udphdr_t *)(buf + offset); + udp = (odph_udphdr_t *)(buf + offset); rlen += sprintf(msg + rlen, "UDP payload %d ", odp_be_to_cpu_16(udp->length) - - ODP_UDPHDR_LEN); + ODPH_UDPHDR_LEN); } /* icmp */ - if (ip->proto == ODP_IPPROTO_ICMP) { - icmp = (odp_icmphdr_t *)(buf + offset); + if (ip->proto == ODPH_IPPROTO_ICMP) { + icmp = (odph_icmphdr_t *)(buf + offset); /* echo reply */ if (icmp->type == ICMP_ECHOREPLY) { odp_atomic_inc_u64(&counters.icmp); - memcpy(&tvsend, buf + offset + ODP_ICMPHDR_LEN, + memcpy(&tvsend, buf + offset + ODPH_ICMPHDR_LEN, sizeof(struct timeval)); /* TODO This should be changed to use an * ODP timer API once one exists. */ @@ -499,13 +499,13 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_buffer(buf); /* Drop packets with errors */ if (odp_unlikely(odp_packet_error(pkt))) { - odp_packet_free(pkt); + odph_packet_free(pkt); continue; } print_pkts(thr, &pkt, 1); - odp_packet_free(pkt); + odph_packet_free(pkt); } return arg; @@ -515,7 +515,7 @@ static void *gen_recv_thread(void *arg) */ int main(int argc, char *argv[]) { - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; odp_buffer_pool_t pool; int thr_id; int num_workers; @@ -606,14 +606,14 @@ int main(int argc, char *argv[]) args->thread[1].pktio_dev = args->appl.if_names[0]; args->thread[1].pool = pool; args->thread[1].mode = args->appl.mode; - odp_linux_pthread_create(&thread_tbl[1], 1, 0, - gen_recv_thread, &args->thread[1]); + odph_linux_pthread_create(&thread_tbl[1], 1, 0, + gen_recv_thread, &args->thread[1]); args->thread[0].pktio_dev = args->appl.if_names[0]; args->thread[0].pool = pool; args->thread[0].mode = args->appl.mode; - odp_linux_pthread_create(&thread_tbl[0], 1, 0, - gen_send_thread, &args->thread[0]); + odph_linux_pthread_create(&thread_tbl[0], 1, 0, + gen_send_thread, &args->thread[0]); /* only wait send thread to join */ num_workers = 1; @@ -644,14 +644,14 @@ int main(int argc, char *argv[]) * because each thread might get different arguments. * Calls odp_thread_create(cpu) for each thread */ - odp_linux_pthread_create(&thread_tbl[i], 1, - core, thr_run_func, - &args->thread[i]); + odph_linux_pthread_create(&thread_tbl[i], 1, + core, thr_run_func, + &args->thread[i]); } } /* Master thread waits for other threads to exit */ - odp_linux_pthread_join(thread_tbl, num_workers); + odph_linux_pthread_join(thread_tbl, num_workers); printf("Exit\n\n"); return 0; diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index d74449a..6a38c1b 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -16,10 +16,10 @@ #include <unistd.h> #include <odp.h> -#include <helper/odp_linux.h> -#include <helper/odp_packet_helper.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> +#include <odph_linux.h> +#include <odph_packet.h> +#include <odph_eth.h> +#include <odph_ip.h> /** @def MAX_WORKERS * @brief Maximum number of worker threads @@ -313,7 +313,7 @@ static void *pktio_ifburst_thread(void *arg) */ int main(int argc, char *argv[]) { - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; odp_buffer_pool_t pool; int thr_id; void *pool_base; @@ -446,12 +446,12 @@ int main(int argc, char *argv[]) thr_run_func = pktio_ifburst_thread; else /* APPL_MODE_PKT_QUEUE */ thr_run_func = pktio_queue_thread; - odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, - &gbl_args->thread[i]); + odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, + &gbl_args->thread[i]); } /* Master thread waits for other threads to exit */ - odp_linux_pthread_join(thread_tbl, num_workers); + odph_linux_pthread_join(thread_tbl, num_workers); printf("Exit\n\n"); @@ -479,7 +479,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) pkt = pkt_tbl[i]; if (odp_unlikely(odp_packet_error(pkt))) { - odp_packet_free(pkt); /* Drop */ + odph_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { pkt_tbl[j-1] = pkt; diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c index f0bdf29..40d237b 100644 --- a/example/odp_example/odp_example.c +++ b/example/odp_example/odp_example.c @@ -17,7 +17,7 @@ #include <odp.h> /* ODP helper for Linux apps */ -#include <helper/odp_linux.h> +#include <odph_linux.h> /* Needs librt*/ #include <time.h> @@ -933,7 +933,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) */ int main(int argc, char *argv[]) { - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; test_args_t args; int thr_id; int num_workers; @@ -1067,11 +1067,11 @@ int main(int argc, char *argv[]) odp_barrier_init_count(&test_barrier, num_workers); /* Create and launch worker threads */ - odp_linux_pthread_create(thread_tbl, num_workers, first_core, - run_thread, NULL); + odph_linux_pthread_create(thread_tbl, num_workers, first_core, + run_thread, NULL); /* Wait for worker threads to exit */ - odp_linux_pthread_join(thread_tbl, num_workers); + odph_linux_pthread_join(thread_tbl, num_workers); printf("ODP example complete\n\n"); diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index f247bd0..88ce575 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -16,10 +16,10 @@ #include <unistd.h> #include <odp.h> -#include <helper/odp_linux.h> -#include <helper/odp_packet_helper.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> +#include <odph_linux.h> +#include <odph_packet.h> +#include <odph_eth.h> +#include <odph_ip.h> /** @def MAX_WORKERS * @brief Maximum number of worker threads @@ -301,7 +301,7 @@ static void *pktio_ifburst_thread(void *arg) */ int main(int argc, char *argv[]) { - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; odp_buffer_pool_t pool; int thr_id; int num_workers; @@ -401,12 +401,12 @@ int main(int argc, char *argv[]) * because each thread might get different arguments. * Calls odp_thread_create(cpu) for each thread */ - odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, - &args->thread[i]); + odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, + &args->thread[i]); } /* Master thread waits for other threads to exit */ - odp_linux_pthread_join(thread_tbl, num_workers); + odph_linux_pthread_join(thread_tbl, num_workers); printf("Exit\n\n"); @@ -434,7 +434,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) pkt = pkt_tbl[i]; if (odp_unlikely(odp_packet_error(pkt))) { - odp_packet_free(pkt); /* Drop */ + odph_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { pkt_tbl[j-1] = pkt; @@ -454,16 +454,16 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) { odp_packet_t pkt; - odp_ethhdr_t *eth; - odp_ethaddr_t tmp_addr; - odp_ipv4hdr_t *ip; + odph_ethhdr_t *eth; + odph_ethaddr_t tmp_addr; + odph_ipv4hdr_t *ip; uint32be_t ip_tmp_addr; /* tmp ip addr */ unsigned i; for (i = 0; i < len; ++i) { pkt = pkt_tbl[i]; if (odp_packet_inflag_eth(pkt)) { - eth = (odp_ethhdr_t *)odp_packet_l2(pkt); + eth = (odph_ethhdr_t *)odp_packet_l2(pkt); tmp_addr = eth->dst; eth->dst = eth->src; @@ -471,7 +471,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) if (odp_packet_inflag_ipv4(pkt)) { /* IPv4 */ - ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt); + ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); ip_tmp_addr = ip->src_addr; ip->src_addr = ip->dst_addr; diff --git a/example/packet_netmap/odp_pktio_netmap.c b/example/packet_netmap/odp_pktio_netmap.c index c0eb202..cc2607b 100644 --- a/example/packet_netmap/odp_pktio_netmap.c +++ b/example/packet_netmap/odp_pktio_netmap.c @@ -21,11 +21,11 @@ #include <arpa/inet.h> #include <odp.h> -#include <helper/odp_linux.h> -#include <helper/odp_packet_helper.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> -#include <helper/odp_packet_helper.h> +#include <odph_linux.h> +#include <odph_packet.h> +#include <odph_eth.h> +#include <odph_ip.h> +#include <odph_packet.h> #include <odp_pktio_netmap.h> @@ -194,7 +194,7 @@ static void *pktio_queue_thread(void *arg) if (odp_packet_copy(pkt_copy, pkt) != 0) { ODP_ERR("Packet copy failed!\n"); - odp_packet_free(pkt_copy); + odph_packet_free(pkt_copy); } else { swap_pkt_addrs(&pkt_copy, 1); odp_queue_enq(outq_def, @@ -219,7 +219,7 @@ static void *pktio_queue_thread(void *arg) */ int main(int argc, char *argv[]) { - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; odp_buffer_pool_t pool; int thr_id; int num_workers; @@ -360,12 +360,12 @@ int main(int argc, char *argv[]) * Create threads one-by-one instead of all-at-once, * because each thread might get different arguments */ - odp_linux_pthread_create(&thread_tbl[i], 1, i, - pktio_queue_thread, NULL); + odph_linux_pthread_create(&thread_tbl[i], 1, i, + pktio_queue_thread, NULL); } /* Master thread waits for other threads to exit */ - odp_linux_pthread_join(thread_tbl, num_workers); + odph_linux_pthread_join(thread_tbl, num_workers); printf("Exit\n\n"); @@ -393,7 +393,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) pkt = pkt_tbl[i]; if (odp_unlikely(odp_packet_error(pkt))) { - odp_packet_free(pkt); /* Drop */ + odph_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { pkt_tbl[j-1] = pkt; @@ -412,16 +412,16 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) { odp_packet_t pkt; - odp_ethhdr_t *eth; - odp_ethaddr_t tmp_addr; - odp_ipv4hdr_t *ip; + odph_ethhdr_t *eth; + odph_ethaddr_t tmp_addr; + odph_ipv4hdr_t *ip; uint32be_t ip_tmp_addr; /* tmp ip addr */ unsigned i; for (i = 0; i < len; ++i) { pkt = pkt_tbl[i]; if (odp_packet_inflag_eth(pkt)) { - eth = (odp_ethhdr_t *)odp_packet_l2(pkt); + eth = (odph_ethhdr_t *)odp_packet_l2(pkt); tmp_addr = eth->dst; eth->dst = eth->src; @@ -429,7 +429,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) if (odp_packet_inflag_ipv4(pkt)) { /* IPv4 */ - ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt); + ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); ip_tmp_addr = ip->src_addr; ip->src_addr = ip->dst_addr; diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index bf1d7df..4168856 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -17,7 +17,7 @@ #include <odp.h> /* ODP helper for Linux apps */ -#include <helper/odp_linux.h> +#include <odph_linux.h> /* GNU lib C */ #include <getopt.h> @@ -242,7 +242,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) */ int main(int argc, char *argv[]) { - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; test_args_t args; int thr_id; int num_workers; @@ -373,11 +373,11 @@ int main(int argc, char *argv[]) odp_barrier_init_count(&test_barrier, num_workers); /* Create and launch worker threads */ - odp_linux_pthread_create(thread_tbl, num_workers, first_core, - run_thread, &args); + odph_linux_pthread_create(thread_tbl, num_workers, first_core, + run_thread, &args); /* Wait for worker threads to exit */ - odp_linux_pthread_join(thread_tbl, num_workers); + odph_linux_pthread_join(thread_tbl, num_workers); printf("ODP timer test complete\n\n"); diff --git a/include/helper/odp_chksum.h b/helper/include/odph_chksum.h similarity index 100% rename from include/helper/odp_chksum.h rename to helper/include/odph_chksum.h diff --git a/helper/include/odph_eth.h b/helper/include/odph_eth.h new file mode 100644 index 0000000..55a2b1e --- /dev/null +++ b/helper/include/odph_eth.h @@ -0,0 +1,87 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP ethernet header + */ + +#ifndef ODPH_ETH_H_ +#define ODPH_ETH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp_std_types.h> +#include <odp_byteorder.h> +#include <odp_align.h> +#include <odp_debug.h> + +#define ODPH_ETHADDR_LEN 6 /**< Ethernet address length */ +#define ODPH_ETHHDR_LEN 14 /**< Ethernet header length */ +#define ODPH_VLANHDR_LEN 4 /**< VLAN header length */ +#define ODPH_ETH_LEN_MIN 60 /**< Min frame length (excl. CRC 4 bytes) */ +#define ODPH_ETH_LEN_MIN_CRC 64 /**< Min frame length (incl. CRC 4 bytes) */ +#define ODPH_ETH_LEN_MAX 1514 /**< Max frame length (excl. CRC 4 bytes) */ +#define ODPH_ETH_LEN_MAX_CRC 1518 /**< Max frame length (incl. CRC 4 bytes) */ + +/** + * Ethernet MAC address + */ +typedef struct ODPH_PACKED { + uint8_t addr[ODPH_ETHADDR_LEN]; /**< @private Address */ +} odph_ethaddr_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == ODPH_ETHADDR_LEN, "ODPH_ETHADDR_T__SIZE_ERROR"); + +/** + * Ethernet header + */ +typedef struct ODPH_PACKED { + odph_ethaddr_t dst; /**< Destination address */ + odph_ethaddr_t src; /**< Source address */ + uint16be_t type; /**< Type */ +} odph_ethhdr_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(odph_ethhdr_t) == ODPH_ETHHDR_LEN, "ODPH_ETHHDR_T__SIZE_ERROR"); + +/** + * VLAN header + * + * @todo Check usage of tpid vs ethertype. Check outer VLAN TPID. + */ +typedef struct ODPH_PACKED { + uint16be_t tpid; /**< Tag protocol ID (located after ethhdr.src) */ + uint16be_t tci; /**< Priority / CFI / VLAN ID */ +} odph_vlanhdr_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN, "ODPH_VLANHDR_T__SIZE_ERROR"); + + +/* Ethernet header Ether Type ('type') values, a selected few */ +#define ODPH_ETHTYPE_IPV4 0x0800 /**< Internet Protocol version 4 */ +#define ODPH_ETHTYPE_ARP 0x0806 /**< Address Resolution Protocol */ +#define ODPH_ETHTYPE_RARP 0x8035 /**< Reverse Address Resolution Protocol*/ +#define ODPH_ETHTYPE_VLAN 0x8100 /**< VLAN-tagged frame IEEE 802.1Q */ +#define ODPH_ETHTYPE_VLAN_OUTER 0x88A8 /**< Stacked VLANs/QinQ, outer-tag/S-TAG*/ +#define ODPH_ETHTYPE_IPV6 0x86dd /**< Internet Protocol version 6 */ +#define ODPH_ETHTYPE_FLOW_CTRL 0x8808 /**< Ethernet flow control */ +#define ODPH_ETHTYPE_MPLS 0x8847 /**< MPLS unicast */ +#define ODPH_ETHTYPE_MPLS_MCAST 0x8848 /**< MPLS multicast */ +#define ODPH_ETHTYPE_MACSEC 0x88E5 /**< MAC security IEEE 802.1AE */ +#define ODPH_ETHTYPE_1588 0x88F7 /**< Precision Time Protocol IEEE 1588 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/helper/odp_icmp.h b/helper/include/odph_icmp.h similarity index 93% rename from include/helper/odp_icmp.h rename to helper/include/odph_icmp.h index 5ac88b9..8414d7e 100644 --- a/include/helper/odp_icmp.h +++ b/helper/include/odph_icmp.h @@ -11,8 +11,8 @@ * ODP ICMP header */ -#ifndef ODP_ICMP_H_ -#define ODP_ICMP_H_ +#ifndef ODPH_ICMP_H_ +#define ODPH_ICMP_H_ #ifdef __cplusplus extern "C" { @@ -23,10 +23,10 @@ extern "C" { #include <odp_byteorder.h> /** ICMP header length */ -#define ODP_ICMPHDR_LEN 8 +#define ODPH_ICMPHDR_LEN 8 /** ICMP header */ -typedef struct ODP_PACKED { +typedef struct ODPH_PACKED { uint8_t type; /**< message type */ uint8_t code; /**< type sub-code */ uint16sum_t chksum; /**< checksum of icmp header */ @@ -41,7 +41,7 @@ typedef struct ODP_PACKED { uint16be_t mtu; } frag; /**< path mtu discovery */ } un; /**< icmp sub header */ -} odp_icmphdr_t; +} odph_icmphdr_t; #define ICMP_ECHOREPLY 0 /**< Echo Reply */ #define ICMP_DEST_UNREACH 3 /**< Destination Unreachable */ @@ -90,7 +90,7 @@ typedef struct ODP_PACKED { exceeded*/ /** @internal Compile time assert */ -ODP_STATIC_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN, "ODP_ICMPHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN, "ODPH_ICMPHDR_T__SIZE_ERROR"); #ifdef __cplusplus } diff --git a/include/helper/odp_ip.h b/helper/include/odph_ip.h similarity index 57% rename from include/helper/odp_ip.h rename to helper/include/odph_ip.h index fb04e4d..ca71c44 100644 --- a/include/helper/odp_ip.h +++ b/helper/include/odph_ip.h @@ -11,8 +11,8 @@ * ODP IP header */ -#ifndef ODP_IP_H_ -#define ODP_IP_H_ +#ifndef ODPH_IP_H_ +#define ODPH_IP_H_ #ifdef __cplusplus extern "C" { @@ -21,34 +21,34 @@ extern "C" { #include <odp_align.h> #include <odp_debug.h> #include <odp_byteorder.h> -#include <helper/odp_chksum.h> +#include <odph_chksum.h> #include <string.h> -#define ODP_IPV4 4 /**< IP version 4 */ -#define ODP_IPV4HDR_LEN 20 /**< Min length of IP header (no options) */ -#define ODP_IPV4HDR_IHL_MIN 5 /**< Minimum IHL value*/ +#define ODPH_IPV4 4 /**< IP version 4 */ +#define ODPH_IPV4HDR_LEN 20 /**< Min length of IP header (no options) */ +#define ODPH_IPV4HDR_IHL_MIN 5 /**< Minimum IHL value*/ /** @internal Returns IPv4 version */ -#define ODP_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4) +#define ODPH_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4) /** @internal Returns IPv4 header length */ -#define ODP_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f) +#define ODPH_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f) /** @internal Returns IPv4 Don't fragment */ -#define ODP_IPV4HDR_FLAGS_DONT_FRAG(frag_offset) ((frag_offset) & 0x4000) +#define ODPH_IPV4HDR_FLAGS_DONT_FRAG(frag_offset) ((frag_offset) & 0x4000) /** @internal Returns IPv4 more fragments */ -#define ODP_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset) ((frag_offset) & 0x2000) +#define ODPH_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset) ((frag_offset) & 0x2000) /** @internal Returns IPv4 fragment offset */ -#define ODP_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff) +#define ODPH_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff) /** @internal Returns true if IPv4 packet is a fragment */ -#define ODP_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff) +#define ODPH_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff) /** IPv4 header */ -typedef struct ODP_PACKED { +typedef struct ODPH_PACKED { uint8_t ver_ihl; /**< Version / Header length */ uint8_t tos; /**< Type of service */ uint16be_t tot_len; /**< Total length */ @@ -59,10 +59,10 @@ typedef struct ODP_PACKED { uint16sum_t chksum; /**< Checksum */ uint32be_t src_addr; /**< Source address */ uint32be_t dst_addr; /**< Destination address */ -} odp_ipv4hdr_t; +} odph_ipv4hdr_t; /** @internal Compile time assert */ -ODP_STATIC_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, "ODP_IPV4HDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == ODPH_IPV4HDR_LEN, "ODPH_IPV4HDR_T__SIZE_ERROR"); /** * Check if IPv4 checksum is valid @@ -71,18 +71,18 @@ ODP_STATIC_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, "ODP_IPV4HDR_T__SIZE * * @return 1 if checksum is valid, otherwise 0 */ -static inline int odp_ipv4_csum_valid(odp_packet_t pkt) +static inline int odph_ipv4_csum_valid(odp_packet_t pkt) { uint16be_t res = 0; uint16_t *w; - int nleft = sizeof(odp_ipv4hdr_t); - odp_ipv4hdr_t ip; + int nleft = sizeof(odph_ipv4hdr_t); + odph_ipv4hdr_t ip; uint16be_t chksum; if (!odp_packet_l3_offset(pkt)) return 0; - memcpy(&ip, odp_packet_l3(pkt), sizeof(odp_ipv4hdr_t)); + memcpy(&ip, odp_packet_l3(pkt), sizeof(odph_ipv4hdr_t)); w = (uint16_t *)(void *)&ip; chksum = ip.chksum; ip.chksum = 0x0; @@ -101,52 +101,52 @@ static inline int odp_ipv4_csum_valid(odp_packet_t pkt) * * @return IPv4 checksum in host cpu order, or 0 on failure */ -static inline uint16sum_t odp_ipv4_csum_update(odp_packet_t pkt) +static inline uint16sum_t odph_ipv4_csum_update(odp_packet_t pkt) { uint16_t *w; - odp_ipv4hdr_t *ip; - int nleft = sizeof(odp_ipv4hdr_t); + odph_ipv4hdr_t *ip; + int nleft = sizeof(odph_ipv4hdr_t); if (!odp_packet_l3_offset(pkt)) return 0; - ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt); + ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); w = (uint16_t *)(void *)ip; ip->chksum = odp_chksum(w, nleft); return ip->chksum; } /** IPv6 version */ -#define ODP_IPV6 6 +#define ODPH_IPV6 6 /** IPv6 header length */ -#define ODP_IPV6HDR_LEN 40 +#define ODPH_IPV6HDR_LEN 40 /** * IPv6 header */ -typedef struct ODP_PACKED { +typedef struct ODPH_PACKED { uint32be_t ver_tc_flow; /**< Version / Traffic class / Flow label */ uint16be_t payload_len; /**< Payload length */ uint8_t next_hdr; /**< Next header */ uint8_t hop_limit; /**< Hop limit */ uint8_t src_addr[16]; /**< Source address */ uint8_t dst_addr[16]; /**< Destination address */ -} odp_ipv6hdr_t; +} odph_ipv6hdr_t; /** @internal Compile time assert */ -ODP_STATIC_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN, "ODP_IPV6HDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_ipv6hdr_t) == ODPH_IPV6HDR_LEN, "ODPH_IPV6HDR_T__SIZE_ERROR"); /** @name * IP protocol values (IPv4:'proto' or IPv6:'next_hdr') * @{*/ -#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol (1) */ -#define ODP_IPPROTO_TCP 0x06 /**< Transmission Control Protocol (6) */ -#define ODP_IPPROTO_UDP 0x11 /**< User Datagram Protocol (17) */ -#define ODP_IPPROTO_SCTP 0x84 /**< Stream Control Transmission Protocol (132) */ -#define ODP_IPPROTO_FRAG 0x2C /**< Fragment (44) */ -#define ODP_IPPROTO_AH 0x33 /**< Authentication Header (51) */ -#define ODP_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */ +#define ODPH_IPPROTO_ICMP 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_SCTP 0x84 /**< Stream Control Transmission Protocol (132) */ +#define ODPH_IPPROTO_FRAG 0x2C /**< Fragment (44) */ +#define ODPH_IPPROTO_AH 0x33 /**< Authentication Header (51) */ +#define ODPH_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */ /**@}*/ #ifdef __cplusplus diff --git a/include/helper/odp_linux.h b/helper/include/odph_linux.h similarity index 88% rename from include/helper/odp_linux.h rename to helper/include/odph_linux.h index 3076c22..1ea349a 100644 --- a/include/helper/odp_linux.h +++ b/helper/include/odph_linux.h @@ -29,7 +29,7 @@ typedef struct { pthread_t thread; /**< @private Pthread */ pthread_attr_t attr; /**< @private Pthread attributes */ -} odp_linux_pthread_t; +} odph_linux_pthread_t; /** @@ -44,7 +44,7 @@ typedef struct { * @param start_routine Thread start function * @param arg Thread argument */ -void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, +void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, int num, int first_core, void *(*start_routine) (void *), void *arg); @@ -58,7 +58,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, * @param num Number of threads to create * */ -void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num); +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); #ifdef __cplusplus diff --git a/include/helper/odp_packet_helper.h b/helper/include/odph_packet.h similarity index 83% rename from include/helper/odp_packet_helper.h rename to helper/include/odph_packet.h index db12028..c18f48d 100644 --- a/include/helper/odp_packet_helper.h +++ b/helper/include/odph_packet.h @@ -11,8 +11,8 @@ * Optional ODP packet helper functions */ -#ifndef ODP_PACKET_HELPER_H_ -#define ODP_PACKET_HELPER_H_ +#ifndef ODPH_PACKET_HELPER_H_ +#define ODPH_PACKET_HELPER_H_ #ifdef __cplusplus extern "C" { @@ -29,7 +29,7 @@ extern "C" { * * @return 1 if valid, otherwise 0 */ -static inline int odp_packet_is_valid(odp_packet_t pkt) +static inline int odph_packet_is_valid(odp_packet_t pkt) { odp_buffer_t buf = odp_buffer_from_packet(pkt); @@ -45,7 +45,7 @@ static inline int odp_packet_is_valid(odp_packet_t pkt) * * @return Packet handle or ODP_PACKET_INVALID */ -static inline odp_packet_t odp_packet_alloc(odp_buffer_pool_t pool_id) +static inline odp_packet_t odph_packet_alloc(odp_buffer_pool_t pool_id) { odp_packet_t pkt; odp_buffer_t buf; @@ -65,7 +65,7 @@ static inline odp_packet_t odp_packet_alloc(odp_buffer_pool_t pool_id) * * @param pkt Packet handle */ -static inline void odp_packet_free(odp_packet_t pkt) +static inline void odph_packet_free(odp_packet_t pkt) { odp_buffer_t buf = odp_buffer_from_packet(pkt); @@ -82,7 +82,7 @@ static inline void odp_packet_free(odp_packet_t pkt) * * @return Packet buffer maximum data size */ -static inline size_t odp_packet_buf_size(odp_packet_t pkt) +static inline size_t odph_packet_buf_size(odp_packet_t pkt) { odp_buffer_t buf = odp_buffer_from_packet(pkt); diff --git a/include/helper/odp_ring.h b/helper/include/odph_ring.h similarity index 87% rename from include/helper/odp_ring.h rename to helper/include/odph_ring.h index 0911531..76c1db8 100644 --- a/include/helper/odp_ring.h +++ b/helper/include/odph_ring.h @@ -89,8 +89,8 @@ * */ -#ifndef ODP_RING_H_ -#define ODP_RING_H_ +#ifndef ODPH_RING_H_ +#define ODPH_RING_H_ #ifdef __cplusplus extern "C" { @@ -103,15 +103,15 @@ extern "C" { #include <errno.h> #include <sys/queue.h> -enum odp_ring_queue_behavior { - ODP_RING_QUEUE_FIXED = 0, /**< Enq/Deq a fixed number +enum odph_ring_queue_behavior { + ODPH_RING_QUEUE_FIXED = 0, /**< Enq/Deq a fixed number of items from a ring */ - ODP_RING_QUEUE_VARIABLE /**< Enq/Deq as many items + ODPH_RING_QUEUE_VARIABLE /**< Enq/Deq as many items a possible from ring */ }; -#define ODP_RING_NAMESIZE 32 /**< The maximum length of a ring name. */ +#define ODPH_RING_NAMESIZE 32 /**< The maximum length of a ring name. */ /** * An ODP ring structure. @@ -123,12 +123,12 @@ enum odp_ring_queue_behavior { * values in a modulo-32bit base: that's why the overflow of the indexes is not * a problem. */ -typedef struct odp_ring { +typedef struct odph_ring { /** @private Next in list. */ - TAILQ_ENTRY(odp_ring) next; + TAILQ_ENTRY(odph_ring) next; /** @private Name of the ring. */ - char name[ODP_RING_NAMESIZE]; + char name[ODPH_RING_NAMESIZE]; /** @private Flags supplied at creation. */ int flags; @@ -153,13 +153,13 @@ typedef struct odp_ring { /** @private Memory space of ring starts here. */ void *ring[0] ODP_ALIGNED_CACHE; -} odp_ring_t; +} odph_ring_t; -#define ODP_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer". */ -#define ODP_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer". */ -#define ODP_RING_QUOT_EXCEED (1 << 31) /* Quota exceed for burst ops */ -#define ODP_RING_SZ_MASK (unsigned)(0x0fffffff) /* Ring size mask */ +#define ODPH_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer".*/ +#define ODPH_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer".*/ +#define ODPH_RING_QUOT_EXCEED (1 << 31) /* Quota exceed for burst ops */ +#define ODPH_RING_SZ_MASK (unsigned)(0x0fffffff) /* Ring size mask */ /** @@ -191,7 +191,7 @@ typedef struct odp_ring { * - EEXIST - a memzone with the same name already exists * - ENOMEM - no appropriate memory area found in which to create memzone */ -odp_ring_t *odp_ring_create(const char *name, unsigned count, +odph_ring_t *odph_ring_create(const char *name, unsigned count, unsigned flags); @@ -210,14 +210,14 @@ odp_ring_t *odp_ring_create(const char *name, unsigned count, * @return 0: Success; water mark changed. * -EINVAL: Invalid water mark value. */ -int odp_ring_set_water_mark(odp_ring_t *r, unsigned count); +int odph_ring_set_water_mark(odph_ring_t *r, unsigned count); /** * Dump the status of the ring to the console. * * @param r A pointer to the ring structure. */ -void odp_ring_dump(const odp_ring_t *r); +void odph_ring_dump(const odph_ring_t *r); /** * Enqueue several objects on the ring (multi-producers safe). @@ -244,8 +244,9 @@ void odp_ring_dump(const odp_ring_t *r); * if behavior = ODP_RING_QUEUE_VARIABLE * - n: Actual number of objects enqueued. */ -int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, - unsigned n, enum odp_ring_queue_behavior behavior); +int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table, + unsigned n, + enum odph_ring_queue_behavior behavior); /** * Enqueue several objects on a ring (NOT multi-producers safe). @@ -269,8 +270,9 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, * if behavior = ODP_RING_QUEUE_VARIABLE * - n: Actual number of objects enqueued. */ -int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, - unsigned n, enum odp_ring_queue_behavior behavior); +int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table, + unsigned n, + enum odph_ring_queue_behavior behavior); /** * Dequeue several objects from a ring (multi-consumers safe). When @@ -299,8 +301,9 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, * - n: Actual number of objects dequeued. */ -int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, - unsigned n, enum odp_ring_queue_behavior behavior); +int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table, + unsigned n, + enum odph_ring_queue_behavior behavior); /** * Dequeue several objects from a ring (NOT multi-consumers safe). @@ -325,8 +328,9 @@ int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, * if behavior = ODP_RING_QUEUE_VARIABLE * - n: Actual number of objects dequeued. */ -int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, - unsigned n, enum odp_ring_queue_behavior behavior); +int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table, + unsigned n, + enum odph_ring_queue_behavior behavior); /** * Enqueue several objects on the ring (multi-producers safe). @@ -346,8 +350,8 @@ int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, * high water mark is exceeded. * - -ENOBUFS: Not enough room in the ring to enqueue, no object is enqueued. */ -int odp_ring_mp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, - unsigned n); +int odph_ring_mp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, + unsigned n); /** * Enqueue several objects on a ring (NOT multi-producers safe). @@ -364,8 +368,8 @@ int odp_ring_mp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, * high water mark is exceeded. * - -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued. */ -int odp_ring_sp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, - unsigned n); +int odph_ring_sp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, + unsigned n); /** * Dequeue several objects from a ring (multi-consumers safe). @@ -384,7 +388,7 @@ int odp_ring_sp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, * - -ENOENT: Not enough entries in the ring to dequeue; no object is * dequeued. */ -int odp_ring_mc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); +int odph_ring_mc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n); /** * Dequeue several objects from a ring (NOT multi-consumers safe). @@ -401,7 +405,7 @@ int odp_ring_mc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); * - -ENOENT: Not enough entries in the ring to dequeue; no object is * dequeued. */ -int odp_ring_sc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); +int odph_ring_sc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n); /** * Test if a ring is full. @@ -412,7 +416,7 @@ int odp_ring_sc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n); * - 1: The ring is full. * - 0: The ring is not full. */ -int odp_ring_full(const odp_ring_t *r); +int odph_ring_full(const odph_ring_t *r); /** * Test if a ring is empty. @@ -423,7 +427,7 @@ int odp_ring_full(const odp_ring_t *r); * - 1: The ring is empty. * - 0: The ring is not empty. */ -int odp_ring_empty(const odp_ring_t *r); +int odph_ring_empty(const odph_ring_t *r); /** * Return the number of entries in a ring. @@ -433,7 +437,7 @@ int odp_ring_empty(const odp_ring_t *r); * @return * The number of entries in the ring. */ -unsigned odp_ring_count(const odp_ring_t *r); +unsigned odph_ring_count(const odph_ring_t *r); /** * Return the number of free entries in a ring. @@ -443,14 +447,14 @@ unsigned odp_ring_count(const odp_ring_t *r); * @return * The number of free entries in the ring. */ -unsigned odp_ring_free_count(const odp_ring_t *r); +unsigned odph_ring_free_count(const odph_ring_t *r); /** * search ring by name * @param name ring name to search * @return pointer to ring otherwise NULL */ -odp_ring_t *odp_ring_lookup(const char *name); +odph_ring_t *odph_ring_lookup(const char *name); /** * Enqueue several objects on the ring (multi-producers safe). @@ -467,8 +471,8 @@ odp_ring_t *odp_ring_lookup(const char *name); * @return * - n: Actual number of objects enqueued. */ -int odp_ring_mp_enqueue_burst(odp_ring_t *r, void * const *obj_table, - unsigned n); +int odph_ring_mp_enqueue_burst(odph_ring_t *r, void * const *obj_table, + unsigned n); /** * Enqueue several objects on a ring (NOT multi-producers safe). @@ -482,8 +486,8 @@ int odp_ring_mp_enqueue_burst(odp_ring_t *r, void * const *obj_table, * @return * - n: Actual number of objects enqueued. */ -int odp_ring_sp_enqueue_burst(odp_ring_t *r, void * const *obj_table, - unsigned n); +int odph_ring_sp_enqueue_burst(odph_ring_t *r, void * const *obj_table, + unsigned n); /** * Enqueue several objects on a ring. * @@ -500,8 +504,8 @@ int odp_ring_sp_enqueue_burst(odp_ring_t *r, void * const *obj_table, * @return * - n: Actual number of objects enqueued. */ -int odp_ring_enqueue_burst(odp_ring_t *r, void * const *obj_table, - unsigned n); +int odph_ring_enqueue_burst(odph_ring_t *r, void * const *obj_table, + unsigned n); /** * Dequeue several objects from a ring (multi-consumers safe). When the request @@ -520,7 +524,7 @@ int odp_ring_enqueue_burst(odp_ring_t *r, void * const *obj_table, * @return * - n: Actual number of objects dequeued, 0 if ring is empty */ -int odp_ring_mc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); +int odph_ring_mc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n); /** * Dequeue several objects from a ring (NOT multi-consumers safe).When the @@ -536,7 +540,7 @@ int odp_ring_mc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); * @return * - n: Actual number of objects dequeued, 0 if ring is empty */ -int odp_ring_sc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); +int odph_ring_sc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n); /** * Dequeue multiple objects from a ring up to a maximum number. @@ -554,17 +558,17 @@ int odp_ring_sc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); * @return * - Number of objects dequeued, or a negative error code on error */ -int odp_ring_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n); +int odph_ring_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n); /** * dump the status of all rings on the console */ -void odp_ring_list_dump(void); +void odph_ring_list_dump(void); /** * initialise ring tailq */ -void odp_ring_tailq_init(void); +void odph_ring_tailq_init(void); #ifdef __cplusplus } diff --git a/include/helper/odp_udp.h b/helper/include/odph_udp.h similarity index 74% rename from include/helper/odp_udp.h rename to helper/include/odph_udp.h index 966d7f3..3970f00 100644 --- a/include/helper/odp_udp.h +++ b/helper/include/odph_udp.h @@ -11,8 +11,8 @@ * ODP UDP header */ -#ifndef ODP_UDP_H_ -#define ODP_UDP_H_ +#ifndef ODPH_UDP_H_ +#define ODPH_UDP_H_ #ifdef __cplusplus extern "C" { @@ -23,24 +23,24 @@ extern "C" { #include <odp_byteorder.h> /** UDP header length */ -#define ODP_UDPHDR_LEN 8 +#define ODPH_UDPHDR_LEN 8 /** UDP header */ -typedef struct ODP_PACKED { +typedef struct ODPH_PACKED { uint16be_t src_port; /**< Source port */ uint16be_t dst_port; /**< Destination port */ uint16be_t length; /**< UDP datagram length in bytes (header+data) */ uint16be_t chksum; /**< UDP header and data checksum (0 if not used)*/ -} odp_udphdr_t; +} odph_udphdr_t; /** UDP pseudo header */ -typedef struct ODP_PACKET { +typedef struct ODPH_PACKET { uint32be_t src_addr; /**< Source addr */ uint32be_t dst_addr; /**< Destination addr */ uint8_t pad; /**< pad byte */ uint8_t proto; /**< UDP protocol */ uint16be_t length; /**< data length */ -} odp_udpphdr_t; +} odph_udpphdr_t; /** * UDP checksum @@ -50,12 +50,12 @@ typedef struct ODP_PACKET { * @param pkt calculate chksum for pkt * @return checksum value */ -static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) +static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt) { uint32_t sum = 0; - odp_udpphdr_t phdr; - odp_udphdr_t *udph; - odp_ipv4hdr_t *iph; + odph_udpphdr_t phdr; + odph_udphdr_t *udph; + odph_ipv4hdr_t *iph; uint16_t udplen; if (!odp_packet_l3_offset(pkt)) @@ -64,8 +64,8 @@ static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) if (!odp_packet_l4_offset(pkt)) return 0; - iph = (odp_ipv4hdr_t *)odp_packet_l3(pkt); - udph = (odp_udphdr_t *)odp_packet_l4(pkt); + iph = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + udph = (odph_udphdr_t *)odp_packet_l4(pkt); udplen = odp_be_to_cpu_16(udph->length); /* the source ip */ @@ -74,12 +74,12 @@ static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) phdr.dst_addr = iph->dst_addr; /* proto */ phdr.pad = 0; - phdr.proto = ODP_IPPROTO_UDP; + phdr.proto = ODPH_IPPROTO_UDP; /* the length */ phdr.length = udph->length; /* calc UDP pseudo header chksum */ - sum = (__odp_force uint32_t) odp_chksum(&phdr, sizeof(odp_udpphdr_t)); + sum = (__odp_force uint32_t) odp_chksum(&phdr, sizeof(odph_udpphdr_t)); /* calc udp header and data chksum */ sum += (__odp_force uint32_t) odp_chksum(udph, udplen); @@ -93,7 +93,7 @@ static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) } /** @internal Compile time assert */ -ODP_STATIC_ASSERT(sizeof(odp_udphdr_t) == ODP_UDPHDR_LEN, "ODP_UDPHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_udphdr_t) == ODPH_UDPHDR_LEN, "ODPH_UDPHDR_T__SIZE_ERROR"); #ifdef __cplusplus } diff --git a/include/helper/odp_eth.h b/include/helper/odp_eth.h deleted file mode 100644 index 542594b..0000000 --- a/include/helper/odp_eth.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP ethernet header - */ - -#ifndef ODP_ETH_H_ -#define ODP_ETH_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_std_types.h> -#include <odp_byteorder.h> -#include <odp_align.h> -#include <odp_debug.h> - -#define ODP_ETHADDR_LEN 6 /**< Ethernet address length */ -#define ODP_ETHHDR_LEN 14 /**< Ethernet header length */ -#define ODP_VLANHDR_LEN 4 /**< VLAN header length */ -#define ODP_ETH_LEN_MIN 60 /**< Min frame length (excl. CRC 4 bytes) */ -#define ODP_ETH_LEN_MIN_CRC 64 /**< Min frame length (incl. CRC 4 bytes) */ -#define ODP_ETH_LEN_MAX 1514 /**< Max frame length (excl. CRC 4 bytes) */ -#define ODP_ETH_LEN_MAX_CRC 1518 /**< Max frame length (incl. CRC 4 bytes) */ - -/** - * Ethernet MAC address - */ -typedef struct ODP_PACKED { - uint8_t addr[ODP_ETHADDR_LEN]; /**< @private Address */ -} odp_ethaddr_t; - -/** @internal Compile time assert */ -ODP_STATIC_ASSERT(sizeof(odp_ethaddr_t) == ODP_ETHADDR_LEN, "ODP_ETHADDR_T__SIZE_ERROR"); - -/** - * Ethernet header - */ -typedef struct ODP_PACKED { - odp_ethaddr_t dst; /**< Destination address */ - odp_ethaddr_t src; /**< Source address */ - uint16be_t type; /**< Type */ -} odp_ethhdr_t; - -/** @internal Compile time assert */ -ODP_STATIC_ASSERT(sizeof(odp_ethhdr_t) == ODP_ETHHDR_LEN, "ODP_ETHHDR_T__SIZE_ERROR"); - -/** - * VLAN header - * - * @todo Check usage of tpid vs ethertype. Check outer VLAN TPID. - */ -typedef struct ODP_PACKED { - uint16be_t tpid; /**< Tag protocol ID (located after ethhdr.src) */ - uint16be_t tci; /**< Priority / CFI / VLAN ID */ -} odp_vlanhdr_t; - -/** @internal Compile time assert */ -ODP_STATIC_ASSERT(sizeof(odp_vlanhdr_t) == ODP_VLANHDR_LEN, "ODP_VLANHDR_T__SIZE_ERROR"); - - -/* Ethernet header Ether Type ('type') values, a selected few */ -#define ODP_ETHTYPE_IPV4 0x0800 /**< Internet Protocol version 4 */ -#define ODP_ETHTYPE_ARP 0x0806 /**< Address Resolution Protocol */ -#define ODP_ETHTYPE_RARP 0x8035 /**< Reverse Address Resolution Protocol*/ -#define ODP_ETHTYPE_VLAN 0x8100 /**< VLAN-tagged frame IEEE 802.1Q */ -#define ODP_ETHTYPE_VLAN_OUTER 0x88A8 /**< Stacked VLANs/QinQ, outer-tag/S-TAG*/ -#define ODP_ETHTYPE_IPV6 0x86dd /**< Internet Protocol version 6 */ -#define ODP_ETHTYPE_FLOW_CTRL 0x8808 /**< Ethernet flow control */ -#define ODP_ETHTYPE_MPLS 0x8847 /**< MPLS unicast */ -#define ODP_ETHTYPE_MPLS_MCAST 0x8848 /**< MPLS multicast */ -#define ODP_ETHTYPE_MACSEC 0x88E5 /**< MAC security IEEE 802.1AE */ -#define ODP_ETHTYPE_1588 0x88F7 /**< Precision Time Protocol IEEE 1588 */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index ff49b7d..a59435f 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -16,7 +16,7 @@ AM_CFLAGS += -I$(srcdir)/include AM_CFLAGS += -I$(srcdir)/include/api AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include/api -AM_CFLAGS += -I$(top_srcdir)/include +AM_CFLAGS += -I$(top_srcdir)/helper/include DPDK_LIBS="-lintel_dpdk -ldl" LIBS += $(DPDK_LIBS) @@ -54,13 +54,13 @@ include_HEADERS = \ subdirheadersdir = $(includedir)/helper subdirheaders_HEADERS = \ - $(top_srcdir)/include/helper/odp_chksum.h \ - $(top_srcdir)/include/helper/odp_eth.h \ - $(top_srcdir)/include/helper/odp_ip.h \ - $(top_srcdir)/include/helper/odp_linux.h \ - $(top_srcdir)/include/helper/odp_packet_helper.h \ - $(top_srcdir)/include/helper/odp_ring.h \ - $(top_srcdir)/include/helper/odp_udp.h + $(top_srcdir)/helper/include/odph_chksum.h \ + $(top_srcdir)/helper/include/odph_eth.h \ + $(top_srcdir)/helper/include/odph_ip.h \ + $(top_srcdir)/helper/include/odph_linux.h \ + $(top_srcdir)/helper/include/odph_packet.h \ + $(top_srcdir)/helper/include/odph_ring.h \ + $(top_srcdir)/helper/include/odph_udp.h __LIB__libodp_la_SOURCES = \ ../linux-generic/odp_barrier.c \ diff --git a/platform/linux-dpdk/include/odp_packet_dpdk.h b/platform/linux-dpdk/include/odp_packet_dpdk.h index bcf9aa5..c3a2b70 100644 --- a/platform/linux-dpdk/include/odp_packet_dpdk.h +++ b/platform/linux-dpdk/include/odp_packet_dpdk.h @@ -10,8 +10,8 @@ #include <stdint.h> #include <net/if.h> -#include <helper/odp_eth.h> -#include <helper/odp_packet_helper.h> +#include <odph_eth.h> +#include <odph_packet.h> #include <odp_align.h> #include <odp_debug.h> #include <odp_packet.h> diff --git a/platform/linux-dpdk/odp_linux.c b/platform/linux-dpdk/odp_linux.c index 067bd99..96c91a5 100644 --- a/platform/linux-dpdk/odp_linux.c +++ b/platform/linux-dpdk/odp_linux.c @@ -14,7 +14,7 @@ #include <stdio.h> #include <assert.h> -#include <helper/odp_linux.h> +#include <odph_linux.h> #include <odp_internal.h> #include <odp_thread.h> #include <odp_init.h> @@ -41,7 +41,7 @@ static void *odp_run_start_routine(void *arg) } -void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, +void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, int num, int first_core, void *(*start_routine) (void *), void *arg) { int i; @@ -82,7 +82,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, } -void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num) +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) { uint32_t lcore_id; diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c index c34e626..edfd06d 100644 --- a/platform/linux-dpdk/odp_packet.c +++ b/platform/linux-dpdk/odp_packet.c @@ -9,16 +9,16 @@ #include <odp_hints.h> #include <odp_byteorder.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> +#include <odph_eth.h> +#include <odph_ip.h> #include <string.h> #include <stdio.h> -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, - size_t *offset_out); -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, - size_t *offset_out); +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, + odph_ipv4hdr_t *ipv4, size_t *offset_out); +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, + odph_ipv6hdr_t *ipv6, size_t *offset_out); void odp_packet_init(odp_packet_t pkt) { @@ -144,10 +144,10 @@ void odp_packet_set_l4_offset(odp_packet_t pkt, size_t offset) void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) { odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); - odp_ethhdr_t *eth; - odp_vlanhdr_t *vlan; - odp_ipv4hdr_t *ipv4; - odp_ipv6hdr_t *ipv6; + odph_ethhdr_t *eth; + odph_vlanhdr_t *vlan; + odph_ipv4hdr_t *ipv4; + odph_ipv6hdr_t *ipv6; uint16_t ethtype; size_t offset = 0; uint8_t ip_proto = 0; @@ -156,10 +156,10 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->frame_offset = frame_offset; pkt_hdr->frame_len = len; - if (odp_unlikely(len < ODP_ETH_LEN_MIN)) { + if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) { pkt_hdr->error_flags.frame_len = 1; return; - } else if (len > ODP_ETH_LEN_MAX) { + } else if (len > ODPH_ETH_LEN_MAX) { pkt_hdr->input_flags.jumbo = 1; } @@ -167,40 +167,40 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->input_flags.l2 = 1; pkt_hdr->l2_offset = frame_offset; - eth = (odp_ethhdr_t *)odp_packet_start(pkt); + eth = (odph_ethhdr_t *)odp_packet_start(pkt); ethtype = odp_be_to_cpu_16(eth->type); - vlan = (odp_vlanhdr_t *)ð->type; + vlan = (odph_vlanhdr_t *)ð->type; - if (ethtype == ODP_ETHTYPE_VLAN_OUTER) { + if (ethtype == ODPH_ETHTYPE_VLAN_OUTER) { pkt_hdr->input_flags.vlan_qinq = 1; ethtype = odp_be_to_cpu_16(vlan->tpid); - offset += sizeof(odp_vlanhdr_t); + offset += sizeof(odph_vlanhdr_t); vlan = &vlan[1]; } - if (ethtype == ODP_ETHTYPE_VLAN) { + if (ethtype == ODPH_ETHTYPE_VLAN) { pkt_hdr->input_flags.vlan = 1; ethtype = odp_be_to_cpu_16(vlan->tpid); - offset += sizeof(odp_vlanhdr_t); + offset += sizeof(odph_vlanhdr_t); } /* Set l3_offset+flag only for known ethtypes */ switch (ethtype) { - case ODP_ETHTYPE_IPV4: + case ODPH_ETHTYPE_IPV4: pkt_hdr->input_flags.ipv4 = 1; pkt_hdr->input_flags.l3 = 1; - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; - ipv4 = (odp_ipv4hdr_t *)odp_packet_l3(pkt); + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; + ipv4 = (odph_ipv4hdr_t *)odp_packet_l3(pkt); ip_proto = parse_ipv4(pkt_hdr, ipv4, &offset); break; - case ODP_ETHTYPE_IPV6: + case ODPH_ETHTYPE_IPV6: pkt_hdr->input_flags.ipv6 = 1; pkt_hdr->input_flags.l3 = 1; - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; - ipv6 = (odp_ipv6hdr_t *)odp_packet_l3(pkt); + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; + ipv6 = (odph_ipv6hdr_t *)odp_packet_l3(pkt); ip_proto = parse_ipv6(pkt_hdr, ipv6, &offset); break; - case ODP_ETHTYPE_ARP: + case ODPH_ETHTYPE_ARP: pkt_hdr->input_flags.arp = 1; /* fall through */ default: @@ -209,22 +209,22 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) } switch (ip_proto) { - case ODP_IPPROTO_UDP: + case ODPH_IPPROTO_UDP: pkt_hdr->input_flags.udp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_TCP: + case ODPH_IPPROTO_TCP: pkt_hdr->input_flags.tcp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_SCTP: + case ODPH_IPPROTO_SCTP: pkt_hdr->input_flags.sctp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_ICMP: + case ODPH_IPPROTO_ICMP: pkt_hdr->input_flags.icmp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; @@ -239,19 +239,19 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) } } -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, - size_t *offset_out) +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, + odph_ipv4hdr_t *ipv4, size_t *offset_out) { uint8_t ihl; uint16_t frag_offset; - ihl = ODP_IPV4HDR_IHL(ipv4->ver_ihl); - if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) { + ihl = ODPH_IPV4HDR_IHL(ipv4->ver_ihl); + if (odp_unlikely(ihl < ODPH_IPV4HDR_IHL_MIN)) { pkt_hdr->error_flags.ip_err = 1; return 0; } - if (odp_unlikely(ihl > ODP_IPV4HDR_IHL_MIN)) { + if (odp_unlikely(ihl > ODPH_IPV4HDR_IHL_MIN)) { pkt_hdr->input_flags.ipopt = 1; return 0; } @@ -262,13 +262,13 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, * "fragment offset" field is nonzero (all fragments except the first) */ frag_offset = odp_be_to_cpu_16(ipv4->frag_offset); - if (odp_unlikely(ODP_IPV4HDR_IS_FRAGMENT(frag_offset))) { + if (odp_unlikely(ODPH_IPV4HDR_IS_FRAGMENT(frag_offset))) { pkt_hdr->input_flags.ipfrag = 1; return 0; } - if (ipv4->proto == ODP_IPPROTO_ESP || - ipv4->proto == ODP_IPPROTO_AH) { + if (ipv4->proto == ODPH_IPPROTO_ESP || + ipv4->proto == ODPH_IPPROTO_AH) { pkt_hdr->input_flags.ipsec = 1; return 0; } @@ -279,24 +279,24 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, return ipv4->proto; } -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, - size_t *offset_out) +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, + odph_ipv6hdr_t *ipv6, size_t *offset_out) { - if (ipv6->next_hdr == ODP_IPPROTO_ESP || - ipv6->next_hdr == ODP_IPPROTO_AH) { + if (ipv6->next_hdr == ODPH_IPPROTO_ESP || + ipv6->next_hdr == ODPH_IPPROTO_AH) { pkt_hdr->input_flags.ipopt = 1; pkt_hdr->input_flags.ipsec = 1; return 0; } - if (odp_unlikely(ipv6->next_hdr == ODP_IPPROTO_FRAG)) { + if (odp_unlikely(ipv6->next_hdr == ODPH_IPPROTO_FRAG)) { pkt_hdr->input_flags.ipopt = 1; pkt_hdr->input_flags.ipfrag = 1; return 0; } /* Don't step through more extensions */ - *offset_out = ODP_IPV6HDR_LEN; + *offset_out = ODPH_IPV6HDR_LEN; return ipv6->next_hdr; } diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index f4dfdc1..949b8d1 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/platform/Makefile.inc AM_CFLAGS += -I$(srcdir)/include AM_CFLAGS += -I$(srcdir)/include/api -AM_CFLAGS += -I$(top_srcdir)/include +AM_CFLAGS += -I$(top_srcdir)/helper/include include_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/api/odp.h \ @@ -42,13 +42,13 @@ include_HEADERS = \ subdirheadersdir = $(includedir)/helper subdirheaders_HEADERS = \ - $(top_srcdir)/include/helper/odp_chksum.h \ - $(top_srcdir)/include/helper/odp_eth.h \ - $(top_srcdir)/include/helper/odp_ip.h \ - $(top_srcdir)/include/helper/odp_linux.h \ - $(top_srcdir)/include/helper/odp_packet_helper.h \ - $(top_srcdir)/include/helper/odp_ring.h \ - $(top_srcdir)/include/helper/odp_udp.h + $(top_srcdir)/helper/include/odph_chksum.h \ + $(top_srcdir)/helper/include/odph_eth.h \ + $(top_srcdir)/helper/include/odph_ip.h \ + $(top_srcdir)/helper/include/odph_linux.h \ + $(top_srcdir)/helper/include/odph_packet.h \ + $(top_srcdir)/helper/include/odph_ring.h \ + $(top_srcdir)/helper/include/odph_udp.h __LIB__libodp_la_SOURCES = \ odp_barrier.c \ diff --git a/platform/linux-generic/include/api/odp_align.h b/platform/linux-generic/include/api/odp_align.h index 5ee61be..a93dd24 100644 --- a/platform/linux-generic/include/api/odp_align.h +++ b/platform/linux-generic/include/api/odp_align.h @@ -31,7 +31,7 @@ extern "C" { /** * Defines type/struct to be packed */ -#define ODP_PACKED __attribute__((__packed__)) +#define ODPH_PACKED __attribute__((__packed__)) /** * Returns offset of member in type diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index bdd4694..fae546c 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -14,7 +14,7 @@ #include <odp_shared_memory.h> #include <odp_crypto_internal.h> #include <odp_hints.h> -#include <helper/odp_packet_helper.h> +#include <odph_packet.h> #include <string.h> @@ -370,7 +370,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params, if (completion_event == odp_buffer_from_packet(params->pkt)) completion_event = odp_buffer_from_packet(params->out_pkt); - odp_packet_free(params->pkt); + odph_packet_free(params->pkt); params->pkt = ODP_PACKET_INVALID; } diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c index 6e2b448..e21e467 100644 --- a/platform/linux-generic/odp_linux.c +++ b/platform/linux-generic/odp_linux.c @@ -14,7 +14,7 @@ #include <stdio.h> #include <assert.h> -#include <helper/odp_linux.h> +#include <odph_linux.h> #include <odp_internal.h> #include <odp_thread.h> #include <odp_init.h> @@ -45,7 +45,7 @@ static void *odp_run_start_routine(void *arg) } -void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, +void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, int num, int first_core, void *(*start_routine) (void *), void *arg) { int i; @@ -59,7 +59,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, assert((first_core >= 0) && (first_core < core_count)); assert((num >= 0) && (num <= core_count)); - memset(thread_tbl, 0, num * sizeof(odp_linux_pthread_t)); + memset(thread_tbl, 0, num * sizeof(odph_linux_pthread_t)); for (i = 0; i < num; i++) { pthread_attr_init(&thread_tbl[i].attr); @@ -85,7 +85,7 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, } -void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num) +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) { int i; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 13e2471..20137d0 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -9,16 +9,16 @@ #include <odp_hints.h> #include <odp_byteorder.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> +#include <odph_eth.h> +#include <odph_ip.h> #include <string.h> #include <stdio.h> -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, - size_t *offset_out); -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, - size_t *offset_out); +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, + odph_ipv4hdr_t *ipv4, size_t *offset_out); +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, + odph_ipv6hdr_t *ipv6, size_t *offset_out); void odp_packet_init(odp_packet_t pkt) { @@ -160,10 +160,10 @@ int odp_packet_seg_count(odp_packet_t pkt) void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) { odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); - odp_ethhdr_t *eth; - odp_vlanhdr_t *vlan; - odp_ipv4hdr_t *ipv4; - odp_ipv6hdr_t *ipv6; + odph_ethhdr_t *eth; + odph_vlanhdr_t *vlan; + odph_ipv4hdr_t *ipv4; + odph_ipv6hdr_t *ipv6; uint16_t ethtype; size_t offset = 0; uint8_t ip_proto = 0; @@ -172,10 +172,10 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->frame_offset = frame_offset; pkt_hdr->frame_len = len; - if (odp_unlikely(len < ODP_ETH_LEN_MIN)) { + if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) { pkt_hdr->error_flags.frame_len = 1; return; - } else if (len > ODP_ETH_LEN_MAX) { + } else if (len > ODPH_ETH_LEN_MAX) { pkt_hdr->input_flags.jumbo = 1; } @@ -183,40 +183,40 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->input_flags.l2 = 1; pkt_hdr->l2_offset = frame_offset; - eth = (odp_ethhdr_t *)odp_packet_start(pkt); + eth = (odph_ethhdr_t *)odp_packet_start(pkt); ethtype = odp_be_to_cpu_16(eth->type); - vlan = (odp_vlanhdr_t *)ð->type; + vlan = (odph_vlanhdr_t *)ð->type; - if (ethtype == ODP_ETHTYPE_VLAN_OUTER) { + if (ethtype == ODPH_ETHTYPE_VLAN_OUTER) { pkt_hdr->input_flags.vlan_qinq = 1; ethtype = odp_be_to_cpu_16(vlan->tpid); - offset += sizeof(odp_vlanhdr_t); + offset += sizeof(odph_vlanhdr_t); vlan = &vlan[1]; } - if (ethtype == ODP_ETHTYPE_VLAN) { + if (ethtype == ODPH_ETHTYPE_VLAN) { pkt_hdr->input_flags.vlan = 1; ethtype = odp_be_to_cpu_16(vlan->tpid); - offset += sizeof(odp_vlanhdr_t); + offset += sizeof(odph_vlanhdr_t); } /* Set l3_offset+flag only for known ethtypes */ switch (ethtype) { - case ODP_ETHTYPE_IPV4: + case ODPH_ETHTYPE_IPV4: pkt_hdr->input_flags.ipv4 = 1; pkt_hdr->input_flags.l3 = 1; - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; - ipv4 = (odp_ipv4hdr_t *)odp_packet_l3(pkt); + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; + ipv4 = (odph_ipv4hdr_t *)odp_packet_l3(pkt); ip_proto = parse_ipv4(pkt_hdr, ipv4, &offset); break; - case ODP_ETHTYPE_IPV6: + case ODPH_ETHTYPE_IPV6: pkt_hdr->input_flags.ipv6 = 1; pkt_hdr->input_flags.l3 = 1; - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; - ipv6 = (odp_ipv6hdr_t *)odp_packet_l3(pkt); + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; + ipv6 = (odph_ipv6hdr_t *)odp_packet_l3(pkt); ip_proto = parse_ipv6(pkt_hdr, ipv6, &offset); break; - case ODP_ETHTYPE_ARP: + case ODPH_ETHTYPE_ARP: pkt_hdr->input_flags.arp = 1; /* fall through */ default: @@ -225,22 +225,22 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) } switch (ip_proto) { - case ODP_IPPROTO_UDP: + case ODPH_IPPROTO_UDP: pkt_hdr->input_flags.udp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_TCP: + case ODPH_IPPROTO_TCP: pkt_hdr->input_flags.tcp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_SCTP: + case ODPH_IPPROTO_SCTP: pkt_hdr->input_flags.sctp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_ICMP: + case ODPH_IPPROTO_ICMP: pkt_hdr->input_flags.icmp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; @@ -255,19 +255,19 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) } } -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, - size_t *offset_out) +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, + odph_ipv4hdr_t *ipv4, size_t *offset_out) { uint8_t ihl; uint16_t frag_offset; - ihl = ODP_IPV4HDR_IHL(ipv4->ver_ihl); - if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) { + ihl = ODPH_IPV4HDR_IHL(ipv4->ver_ihl); + if (odp_unlikely(ihl < ODPH_IPV4HDR_IHL_MIN)) { pkt_hdr->error_flags.ip_err = 1; return 0; } - if (odp_unlikely(ihl > ODP_IPV4HDR_IHL_MIN)) { + if (odp_unlikely(ihl > ODPH_IPV4HDR_IHL_MIN)) { pkt_hdr->input_flags.ipopt = 1; return 0; } @@ -278,13 +278,13 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, * "fragment offset" field is nonzero (all fragments except the first) */ frag_offset = odp_be_to_cpu_16(ipv4->frag_offset); - if (odp_unlikely(ODP_IPV4HDR_IS_FRAGMENT(frag_offset))) { + if (odp_unlikely(ODPH_IPV4HDR_IS_FRAGMENT(frag_offset))) { pkt_hdr->input_flags.ipfrag = 1; return 0; } - if (ipv4->proto == ODP_IPPROTO_ESP || - ipv4->proto == ODP_IPPROTO_AH) { + if (ipv4->proto == ODPH_IPPROTO_ESP || + ipv4->proto == ODPH_IPPROTO_AH) { pkt_hdr->input_flags.ipsec = 1; return 0; } @@ -295,24 +295,24 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, return ipv4->proto; } -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, - size_t *offset_out) +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, + odph_ipv6hdr_t *ipv6, size_t *offset_out) { - if (ipv6->next_hdr == ODP_IPPROTO_ESP || - ipv6->next_hdr == ODP_IPPROTO_AH) { + if (ipv6->next_hdr == ODPH_IPPROTO_ESP || + ipv6->next_hdr == ODPH_IPPROTO_AH) { pkt_hdr->input_flags.ipopt = 1; pkt_hdr->input_flags.ipsec = 1; return 0; } - if (odp_unlikely(ipv6->next_hdr == ODP_IPPROTO_FRAG)) { + if (odp_unlikely(ipv6->next_hdr == ODPH_IPPROTO_FRAG)) { pkt_hdr->input_flags.ipopt = 1; pkt_hdr->input_flags.ipfrag = 1; return 0; } /* Don't step through more extensions */ - *offset_out = ODP_IPV6HDR_LEN; + *offset_out = ODPH_IPV6HDR_LEN; return ipv6->next_hdr; } diff --git a/platform/linux-generic/odp_packet_netmap.c b/platform/linux-generic/odp_packet_netmap.c index e2215ab..5942789 100644 --- a/platform/linux-generic/odp_packet_netmap.c +++ b/platform/linux-generic/odp_packet_netmap.c @@ -31,9 +31,9 @@ #include <odp_hints.h> #include <odp_thread.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> -#include <helper/odp_packet_helper.h> +#include <odph_eth.h> +#include <odph_ip.h> +#include <odph_packet.h> #define NETMAP_WITH_LIBS #include <odp_packet_netmap.h> @@ -41,8 +41,8 @@ /** Eth buffer start offset from u32-aligned address to make sure the following * header (e.g. IP) starts at a 32-bit aligned address. */ -#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODP_ETHHDR_LEN, sizeof(uint32_t)) \ - - ODP_ETHHDR_LEN) +#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODPH_ETHHDR_LEN, sizeof(uint32_t)) \ + - ODPH_ETHHDR_LEN) /** Round up buffer address to get a properly aliged eth buffer, i.e. aligned * so that the next header always starts at a 32bit aligned address. @@ -135,7 +135,7 @@ int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, /* save netmap_mode for later use */ pkt_nm->netmap_mode = nm_params->netmap_mode; - odp_packet_free(pkt); + odph_packet_free(pkt); if (nm_params->netmap_mode == ODP_NETMAP_MODE_SW) ringid = NETMAP_SW_RING; @@ -322,7 +322,7 @@ int recv_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], /* drop the frame, reuse pkt next interation */ continue; } - if (odp_unlikely(frame_len < ODP_ETH_LEN_MIN)) { + if (odp_unlikely(frame_len < ODPH_ETH_LEN_MIN)) { if (odp_unlikely(pkt_nm->netmap_mode != ODP_NETMAP_MODE_SW)) { ODP_ERR("RX: Frame truncated: %u\n", @@ -330,8 +330,8 @@ int recv_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], continue; } memset(l2_hdr + frame_len, 0, - ODP_ETH_LEN_MIN - frame_len); - frame_len = ODP_ETH_LEN_MIN; + ODPH_ETH_LEN_MIN - frame_len); + frame_len = ODPH_ETH_LEN_MIN; } /* For now copy the data in the mbuf, @@ -447,7 +447,7 @@ int send_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], ODP_DBG("===> sent %03u frames to netmap adapter\n", nb_tx); for (tx = 0; tx < len; tx++) - odp_packet_free(pkt_table[tx]); + odph_packet_free(pkt_table[tx]); return nb_tx; } diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index 352d517..d1ea087 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -38,9 +38,9 @@ #include <odp_packet_internal.h> #include <odp_hints.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> -#include <helper/odp_packet_helper.h> +#include <odph_eth.h> +#include <odph_ip.h> +#include <odph_packet.h> /** Provide a sendmmsg wrapper for systems with no libc or kernel support. * As it is implemented as a weak symbol, it has zero effect on systems @@ -93,8 +93,8 @@ static odp_spinlock_t raw_sockets_lock; /** Eth buffer start offset from u32-aligned address to make sure the following * header (e.g. IP) starts at a 32-bit aligned address. */ -#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODP_ETHHDR_LEN, sizeof(uint32_t)) \ - - ODP_ETHHDR_LEN) +#define ETHBUF_OFFSET (ODP_ALIGN_ROUNDUP(ODPH_ETHHDR_LEN, sizeof(uint32_t)) \ + - ODPH_ETHHDR_LEN) /** Round up buffer address to get a properly aliged eth buffer, i.e. aligned * so that the next header always starts at a 32bit aligned address. @@ -186,8 +186,8 @@ int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev, return -1; pkt_sock->pool = pool; - pkt = odp_packet_alloc(pool); - if (!odp_packet_is_valid(pkt)) + pkt = odph_packet_alloc(pool); + if (!odph_packet_is_valid(pkt)) return -1; pkt_buf = odp_packet_buf_addr(pkt); @@ -195,11 +195,11 @@ int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev, /* Store eth buffer offset for pkt buffers from this pool */ pkt_sock->frame_offset = (uintptr_t)l2_hdr - (uintptr_t)pkt_buf; /* pkt buffer size */ - pkt_sock->buf_size = odp_packet_buf_size(pkt); + pkt_sock->buf_size = odph_packet_buf_size(pkt); /* max frame len taking into account the l2-offset */ pkt_sock->max_frame_len = pkt_sock->buf_size - pkt_sock->frame_offset; - odp_packet_free(pkt); + odph_packet_free(pkt); odp_spinlock_lock(&raw_sockets_lock); @@ -297,7 +297,7 @@ int recv_pkt_sock_basic(pkt_sock_t *const pkt_sock, for (i = 0; i < len; i++) { if (odp_likely(pkt == ODP_PACKET_INVALID)) { - pkt = odp_packet_alloc(pkt_sock->pool); + pkt = odph_packet_alloc(pkt_sock->pool); if (odp_unlikely(pkt == ODP_PACKET_INVALID)) break; } @@ -324,7 +324,7 @@ int recv_pkt_sock_basic(pkt_sock_t *const pkt_sock, } /* end for() */ if (odp_unlikely(pkt != ODP_PACKET_INVALID)) - odp_packet_free(pkt); + odph_packet_free(pkt); return nb_rx; } @@ -368,7 +368,7 @@ int send_pkt_sock_basic(pkt_sock_t *const pkt_sock, nb_tx = i; for (i = 0; i < len; i++) - odp_packet_free(pkt_table[i]); + odph_packet_free(pkt_table[i]); return nb_tx; } @@ -395,7 +395,7 @@ int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, memset(msgvec, 0, sizeof(msgvec)); for (i = 0; i < (int)len; i++) { - pkt_table[i] = odp_packet_alloc(pkt_sock->pool); + pkt_table[i] = odph_packet_alloc(pkt_sock->pool); if (odp_unlikely(pkt_table[i] == ODP_PACKET_INVALID)) break; @@ -417,7 +417,7 @@ int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, /* Don't receive packets sent by ourselves */ if (odp_unlikely(ethaddrs_equal(pkt_sock->if_mac, eth_hdr->h_source))) { - odp_packet_free(pkt_table[i]); + odph_packet_free(pkt_table[i]); continue; } @@ -431,7 +431,7 @@ int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, /* Free unused pkt buffers */ for (; i < msgvec_len; i++) - odp_packet_free(pkt_table[i]); + odph_packet_free(pkt_table[i]); return nb_rx; } @@ -473,7 +473,7 @@ int send_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, } for (i = 0; i < len; i++) - odp_packet_free(pkt_table[i]); + odph_packet_free(pkt_table[i]); return len; } @@ -569,7 +569,7 @@ static inline unsigned pkt_mmap_v2_rx(int sock, struct ring *ring, continue; } - pkt_table[i] = odp_packet_alloc(pool); + pkt_table[i] = odph_packet_alloc(pool); if (odp_unlikely(pkt_table[i] == ODP_PACKET_INVALID)) break; @@ -623,7 +623,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring, mmap_tx_user_ready(ppd.raw); - odp_packet_free(pkt_table[i]); + odph_packet_free(pkt_table[i]); frame_num = next_frame_num; i++; } else { @@ -815,8 +815,8 @@ int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev, if (pool == ODP_BUFFER_POOL_INVALID) return -1; - pkt = odp_packet_alloc(pool); - if (!odp_packet_is_valid(pkt)) + pkt = odph_packet_alloc(pool); + if (!odph_packet_is_valid(pkt)) return -1; pkt_buf = odp_packet_buf_addr(pkt); @@ -824,7 +824,7 @@ int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev, /* Store eth buffer offset for pkt buffers from this pool */ pkt_sock->frame_offset = (uintptr_t)l2_hdr - (uintptr_t)pkt_buf; - odp_packet_free(pkt); + odph_packet_free(pkt); pkt_sock->pool = pool; pkt_sock->sockfd = mmap_pkt_socket(); diff --git a/platform/linux-generic/odp_ring.c b/platform/linux-generic/odp_ring.c index 25ff66a..720d8db 100644 --- a/platform/linux-generic/odp_ring.c +++ b/platform/linux-generic/odp_ring.c @@ -80,9 +80,9 @@ #include <string.h> #include <odp_debug.h> #include <odp_rwlock.h> -#include <helper/odp_ring.h> +#include <odph_ring.h> -static TAILQ_HEAD(, odp_ring) odp_ring_list; +static TAILQ_HEAD(, odph_ring) odp_ring_list; /* * the enqueue of pointers on the ring. @@ -145,29 +145,29 @@ static TAILQ_HEAD(, odp_ring) odp_ring_list; static odp_rwlock_t qlock; /* rings tailq lock */ /* init tailq_ring */ -void odp_ring_tailq_init(void) +void odph_ring_tailq_init(void) { TAILQ_INIT(&odp_ring_list); odp_rwlock_init(&qlock); } /* create the ring */ -odp_ring_t * -odp_ring_create(const char *name, unsigned count, unsigned flags) +odph_ring_t * +odph_ring_create(const char *name, unsigned count, unsigned flags) { - char ring_name[ODP_RING_NAMESIZE]; - odp_ring_t *r; + char ring_name[ODPH_RING_NAMESIZE]; + odph_ring_t *r; size_t ring_size; /* count must be a power of 2 */ - if (!ODP_VAL_IS_POWER_2(count) || (count > ODP_RING_SZ_MASK)) { + if (!ODP_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) { ODP_ERR("Requested size is invalid, must be power of 2, and do not exceed the size limit %u\n", - ODP_RING_SZ_MASK); + ODPH_RING_SZ_MASK); return NULL; } snprintf(ring_name, sizeof(ring_name), "%s", name); - ring_size = count*sizeof(void *)+sizeof(odp_ring_t); + ring_size = count*sizeof(void *)+sizeof(odph_ring_t); odp_rwlock_write_lock(&qlock); /* reserve a memory zone for this ring.*/ @@ -178,8 +178,8 @@ odp_ring_create(const char *name, unsigned count, unsigned flags) snprintf(r->name, sizeof(r->name), "%s", name); r->flags = flags; r->prod.watermark = count; - r->prod.sp_enqueue = !!(flags & ODP_RING_F_SP_ENQ); - r->cons.sc_dequeue = !!(flags & ODP_RING_F_SC_DEQ); + r->prod.sp_enqueue = !!(flags & ODPH_RING_F_SP_ENQ); + r->cons.sc_dequeue = !!(flags & ODPH_RING_F_SC_DEQ); r->prod.size = count; r->cons.size = count; r->prod.mask = count-1; @@ -202,7 +202,7 @@ odp_ring_create(const char *name, unsigned count, unsigned flags) * change the high water mark. If *count* is 0, water marking is * disabled */ -int odp_ring_set_water_mark(odp_ring_t *r, unsigned count) +int odph_ring_set_water_mark(odph_ring_t *r, unsigned count) { if (count >= r->prod.size) return -EINVAL; @@ -218,8 +218,8 @@ int odp_ring_set_water_mark(odp_ring_t *r, unsigned count) /** * Enqueue several objects on the ring (multi-producers safe). */ -int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, - unsigned n, enum odp_ring_queue_behavior behavior) +int __odph_ring_mp_do_enqueue(odph_ring_t *r, void * const *obj_table, + unsigned n, enum odph_ring_queue_behavior behavior) { uint32_t prod_head, prod_next; uint32_t cons_tail, free_entries; @@ -244,7 +244,7 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, /* check that we have enough room in ring */ if (odp_unlikely(n > free_entries)) { - if (behavior == ODP_RING_QUEUE_FIXED) { + if (behavior == ODPH_RING_QUEUE_FIXED) { return -ENOBUFS; } else { /* No free entry available */ @@ -266,10 +266,10 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, /* if we exceed the watermark */ if (odp_unlikely(((mask + 1) - free_entries + n) > r->prod.watermark)) { - ret = (behavior == ODP_RING_QUEUE_FIXED) ? -EDQUOT : - (int)(n | ODP_RING_QUOT_EXCEED); + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? -EDQUOT : + (int)(n | ODPH_RING_QUOT_EXCEED); } else { - ret = (behavior == ODP_RING_QUEUE_FIXED) ? 0 : n; + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? 0 : n; } /* @@ -286,8 +286,8 @@ int __odp_ring_mp_do_enqueue(odp_ring_t *r, void * const *obj_table, /** * Enqueue several objects on a ring (NOT multi-producers safe). */ -int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, - unsigned n, enum odp_ring_queue_behavior behavior) +int __odph_ring_sp_do_enqueue(odph_ring_t *r, void * const *obj_table, + unsigned n, enum odph_ring_queue_behavior behavior) { uint32_t prod_head, cons_tail; uint32_t prod_next, free_entries; @@ -305,7 +305,7 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, /* check that we have enough room in ring */ if (odp_unlikely(n > free_entries)) { - if (behavior == ODP_RING_QUEUE_FIXED) { + if (behavior == ODPH_RING_QUEUE_FIXED) { return -ENOBUFS; } else { /* No free entry available */ @@ -325,10 +325,10 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, /* if we exceed the watermark */ if (odp_unlikely(((mask + 1) - free_entries + n) > r->prod.watermark)) { - ret = (behavior == ODP_RING_QUEUE_FIXED) ? -EDQUOT : - (int)(n | ODP_RING_QUOT_EXCEED); + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? -EDQUOT : + (int)(n | ODPH_RING_QUOT_EXCEED); } else { - ret = (behavior == ODP_RING_QUEUE_FIXED) ? 0 : n; + ret = (behavior == ODPH_RING_QUEUE_FIXED) ? 0 : n; } r->prod.tail = prod_next; @@ -339,8 +339,8 @@ int __odp_ring_sp_do_enqueue(odp_ring_t *r, void * const *obj_table, * Dequeue several objects from a ring (multi-consumers safe). */ -int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, - unsigned n, enum odp_ring_queue_behavior behavior) +int __odph_ring_mc_do_dequeue(odph_ring_t *r, void **obj_table, + unsigned n, enum odph_ring_queue_behavior behavior) { uint32_t cons_head, prod_tail; uint32_t cons_next, entries; @@ -364,7 +364,7 @@ int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, /* Set the actual entries for dequeue */ if (n > entries) { - if (behavior == ODP_RING_QUEUE_FIXED) { + if (behavior == ODPH_RING_QUEUE_FIXED) { return -ENOENT; } else { if (odp_unlikely(entries == 0)) @@ -392,14 +392,14 @@ int __odp_ring_mc_do_dequeue(odp_ring_t *r, void **obj_table, r->cons.tail = cons_next; - return behavior == ODP_RING_QUEUE_FIXED ? 0 : n; + return behavior == ODPH_RING_QUEUE_FIXED ? 0 : n; } /** * Dequeue several objects from a ring (NOT multi-consumers safe). */ -int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, - unsigned n, enum odp_ring_queue_behavior behavior) +int __odph_ring_sc_do_dequeue(odph_ring_t *r, void **obj_table, + unsigned n, enum odph_ring_queue_behavior behavior) { uint32_t cons_head, prod_tail; uint32_t cons_next, entries; @@ -415,7 +415,7 @@ int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, entries = prod_tail - cons_head; if (n > entries) { - if (behavior == ODP_RING_QUEUE_FIXED) { + if (behavior == ODPH_RING_QUEUE_FIXED) { return -ENOENT; } else { if (odp_unlikely(entries == 0)) @@ -433,47 +433,51 @@ int __odp_ring_sc_do_dequeue(odp_ring_t *r, void **obj_table, odp_mem_barrier(); r->cons.tail = cons_next; - return behavior == ODP_RING_QUEUE_FIXED ? 0 : n; + return behavior == ODPH_RING_QUEUE_FIXED ? 0 : n; } /** * Enqueue several objects on the ring (multi-producers safe). */ -int odp_ring_mp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, +int odph_ring_mp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, unsigned n) { - return __odp_ring_mp_do_enqueue(r, obj_table, n, ODP_RING_QUEUE_FIXED); + return __odph_ring_mp_do_enqueue(r, obj_table, n, + ODPH_RING_QUEUE_FIXED); } /** * Enqueue several objects on a ring (NOT multi-producers safe). */ -int odp_ring_sp_enqueue_bulk(odp_ring_t *r, void * const *obj_table, +int odph_ring_sp_enqueue_bulk(odph_ring_t *r, void * const *obj_table, unsigned n) { - return __odp_ring_sp_do_enqueue(r, obj_table, n, ODP_RING_QUEUE_FIXED); + return __odph_ring_sp_do_enqueue(r, obj_table, n, + ODPH_RING_QUEUE_FIXED); } /** * Dequeue several objects from a ring (multi-consumers safe). */ -int odp_ring_mc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n) +int odph_ring_mc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n) { - return __odp_ring_mc_do_dequeue(r, obj_table, n, ODP_RING_QUEUE_FIXED); + return __odph_ring_mc_do_dequeue(r, obj_table, n, + ODPH_RING_QUEUE_FIXED); } /** * Dequeue several objects from a ring (NOT multi-consumers safe). */ -int odp_ring_sc_dequeue_bulk(odp_ring_t *r, void **obj_table, unsigned n) +int odph_ring_sc_dequeue_bulk(odph_ring_t *r, void **obj_table, unsigned n) { - return __odp_ring_sc_do_dequeue(r, obj_table, n, ODP_RING_QUEUE_FIXED); + return __odph_ring_sc_do_dequeue(r, obj_table, n, + ODPH_RING_QUEUE_FIXED); } /** * Test if a ring is full. */ -int odp_ring_full(const odp_ring_t *r) +int odph_ring_full(const odph_ring_t *r) { uint32_t prod_tail = r->prod.tail; uint32_t cons_tail = r->cons.tail; @@ -483,7 +487,7 @@ int odp_ring_full(const odp_ring_t *r) /** * Test if a ring is empty. */ -int odp_ring_empty(const odp_ring_t *r) +int odph_ring_empty(const odph_ring_t *r) { uint32_t prod_tail = r->prod.tail; uint32_t cons_tail = r->cons.tail; @@ -493,7 +497,7 @@ int odp_ring_empty(const odp_ring_t *r) /** * Return the number of entries in a ring. */ -unsigned odp_ring_count(const odp_ring_t *r) +unsigned odph_ring_count(const odph_ring_t *r) { uint32_t prod_tail = r->prod.tail; uint32_t cons_tail = r->cons.tail; @@ -503,7 +507,7 @@ unsigned odp_ring_count(const odp_ring_t *r) /** * Return the number of free entries in a ring. */ -unsigned odp_ring_free_count(const odp_ring_t *r) +unsigned odph_ring_free_count(const odph_ring_t *r) { uint32_t prod_tail = r->prod.tail; uint32_t cons_tail = r->cons.tail; @@ -511,7 +515,7 @@ unsigned odp_ring_free_count(const odp_ring_t *r) } /* dump the status of the ring on the console */ -void odp_ring_dump(const odp_ring_t *r) +void odph_ring_dump(const odph_ring_t *r) { ODP_DBG("ring <%s>@%p\n", r->name, r); ODP_DBG(" flags=%x\n", r->flags); @@ -520,8 +524,8 @@ void odp_ring_dump(const odp_ring_t *r) ODP_DBG(" ch=%"PRIu32"\n", r->cons.head); ODP_DBG(" pt=%"PRIu32"\n", r->prod.tail); ODP_DBG(" ph=%"PRIu32"\n", r->prod.head); - ODP_DBG(" used=%u\n", odp_ring_count(r)); - ODP_DBG(" avail=%u\n", odp_ring_free_count(r)); + ODP_DBG(" used=%u\n", odph_ring_count(r)); + ODP_DBG(" avail=%u\n", odph_ring_free_count(r)); if (r->prod.watermark == r->prod.size) ODP_DBG(" watermark=0\n"); else @@ -529,27 +533,27 @@ void odp_ring_dump(const odp_ring_t *r) } /* dump the status of all rings on the console */ -void odp_ring_list_dump(void) +void odph_ring_list_dump(void) { - const odp_ring_t *mp = NULL; + const odph_ring_t *mp = NULL; odp_rwlock_read_lock(&qlock); TAILQ_FOREACH(mp, &odp_ring_list, next) { - odp_ring_dump(mp); + odph_ring_dump(mp); } odp_rwlock_read_unlock(&qlock); } /* search a ring from its name */ -odp_ring_t *odp_ring_lookup(const char *name) +odph_ring_t *odph_ring_lookup(const char *name) { - odp_ring_t *r = odp_shm_lookup(name); + odph_ring_t *r = odp_shm_lookup(name); odp_rwlock_read_lock(&qlock); TAILQ_FOREACH(r, &odp_ring_list, next) { - if (strncmp(name, r->name, ODP_RING_NAMESIZE) == 0) + if (strncmp(name, r->name, ODPH_RING_NAMESIZE) == 0) break; } odp_rwlock_read_unlock(&qlock); @@ -560,60 +564,60 @@ odp_ring_t *odp_ring_lookup(const char *name) /** * Enqueue several objects on the ring (multi-producers safe). */ -int odp_ring_mp_enqueue_burst(odp_ring_t *r, void * const *obj_table, +int odph_ring_mp_enqueue_burst(odph_ring_t *r, void * const *obj_table, unsigned n) { - return __odp_ring_mp_do_enqueue(r, obj_table, n, - ODP_RING_QUEUE_VARIABLE); + return __odph_ring_mp_do_enqueue(r, obj_table, n, + ODPH_RING_QUEUE_VARIABLE); } /** * Enqueue several objects on a ring (NOT multi-producers safe). */ -int odp_ring_sp_enqueue_burst(odp_ring_t *r, void * const *obj_table, +int odph_ring_sp_enqueue_burst(odph_ring_t *r, void * const *obj_table, unsigned n) { - return __odp_ring_sp_do_enqueue(r, obj_table, n, - ODP_RING_QUEUE_VARIABLE); + return __odph_ring_sp_do_enqueue(r, obj_table, n, + ODPH_RING_QUEUE_VARIABLE); } /** * Enqueue several objects on a ring. */ -int odp_ring_enqueue_burst(odp_ring_t *r, void * const *obj_table, +int odph_ring_enqueue_burst(odph_ring_t *r, void * const *obj_table, unsigned n) { if (r->prod.sp_enqueue) - return odp_ring_sp_enqueue_burst(r, obj_table, n); + return odph_ring_sp_enqueue_burst(r, obj_table, n); else - return odp_ring_mp_enqueue_burst(r, obj_table, n); + return odph_ring_mp_enqueue_burst(r, obj_table, n); } /** * Dequeue several objects from a ring (multi-consumers safe). */ -int odp_ring_mc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n) +int odph_ring_mc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n) { - return __odp_ring_mc_do_dequeue(r, obj_table, n, - ODP_RING_QUEUE_VARIABLE); + return __odph_ring_mc_do_dequeue(r, obj_table, n, + ODPH_RING_QUEUE_VARIABLE); } /** * Dequeue several objects from a ring (NOT multi-consumers safe). */ -int odp_ring_sc_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n) +int odph_ring_sc_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n) { - return __odp_ring_sc_do_dequeue(r, obj_table, n, - ODP_RING_QUEUE_VARIABLE); + return __odph_ring_sc_do_dequeue(r, obj_table, n, + ODPH_RING_QUEUE_VARIABLE); } /** * Dequeue multiple objects from a ring up to a maximum number. */ -int odp_ring_dequeue_burst(odp_ring_t *r, void **obj_table, unsigned n) +int odph_ring_dequeue_burst(odph_ring_t *r, void **obj_table, unsigned n) { if (r->cons.sc_dequeue) - return odp_ring_sc_dequeue_burst(r, obj_table, n); + return odph_ring_sc_dequeue_burst(r, obj_table, n); else - return odp_ring_mc_dequeue_burst(r, obj_table, n); + return odph_ring_mc_dequeue_burst(r, obj_table, n); } diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-keystone2/Makefile.am index 8e5fbb3..027c035 100644 --- a/platform/linux-keystone2/Makefile.am +++ b/platform/linux-keystone2/Makefile.am @@ -20,7 +20,7 @@ AM_CFLAGS += -I$(srcdir)/include AM_CFLAGS += -I$(srcdir)/include/api AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include/api -AM_CFLAGS += -I$(top_srcdir)/include +AM_CFLAGS += -I$(top_srcdir)/helper/include KS2_LIBS="-lopenem_rh -lopenem_osal" LIBS += $(KS2_LIBS) @@ -57,13 +57,13 @@ include_HEADERS = \ subdirheadersdir = $(includedir)/helper subdirheaders_HEADERS = \ - $(top_srcdir)/include/helper/odp_chksum.h \ - $(top_srcdir)/include/helper/odp_eth.h \ - $(top_srcdir)/include/helper/odp_ip.h \ - $(top_srcdir)/include/helper/odp_linux.h \ - $(top_srcdir)/include/helper/odp_packet_helper.h \ - $(top_srcdir)/include/helper/odp_ring.h \ - $(top_srcdir)/include/helper/odp_udp.h + $(top_srcdir)/helper/include/odph_chksum.h \ + $(top_srcdir)/helper/include/odph_eth.h \ + $(top_srcdir)/helper/include/odph_ip.h \ + $(top_srcdir)/helper/include/odph_linux.h \ + $(top_srcdir)/helper/include/odph_packet.h \ + $(top_srcdir)/helper/include/odph_ring.h \ + $(top_srcdir)/helper/include/odph_udp.h __LIB__libodp_la_SOURCES = \ ../linux-generic/odp_barrier.c \ diff --git a/platform/linux-keystone2/odp_packet.c b/platform/linux-keystone2/odp_packet.c index 271d66b..fac0d22 100644 --- a/platform/linux-keystone2/odp_packet.c +++ b/platform/linux-keystone2/odp_packet.c @@ -10,16 +10,16 @@ #include <odp_byteorder.h> #include <ti_em_rh.h> -#include <helper/odp_eth.h> -#include <helper/odp_ip.h> +#include <odph_eth.h> +#include <odph_ip.h> #include <string.h> #include <stdio.h> -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, - size_t *offset_out); -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, - size_t *offset_out); +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, + odph_ipv4hdr_t *ipv4, size_t *offset_out); +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, + odph_ipv6hdr_t *ipv6, size_t *offset_out); void odp_packet_init(odp_packet_t pkt) { @@ -135,10 +135,10 @@ void odp_packet_set_l4_offset(odp_packet_t pkt, size_t offset) void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) { odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); - odp_ethhdr_t *eth; - odp_vlanhdr_t *vlan; - odp_ipv4hdr_t *ipv4; - odp_ipv6hdr_t *ipv6; + odph_ethhdr_t *eth; + odph_vlanhdr_t *vlan; + odph_ipv4hdr_t *ipv4; + odph_ipv6hdr_t *ipv6; uint16_t ethtype; size_t offset = 0; uint8_t ip_proto = 0; @@ -146,10 +146,10 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->input_flags.eth = 1; pkt_hdr->frame_offset = frame_offset; - if (odp_unlikely(len < ODP_ETH_LEN_MIN)) { + if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) { pkt_hdr->error_flags.frame_len = 1; return; - } else if (len > ODP_ETH_LEN_MAX) { + } else if (len > ODPH_ETH_LEN_MAX) { pkt_hdr->input_flags.jumbo = 1; } @@ -160,40 +160,40 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->input_flags.l2 = 1; pkt_hdr->l2_offset = frame_offset; - eth = (odp_ethhdr_t *)odp_packet_start(pkt); + eth = (odph_ethhdr_t *)odp_packet_start(pkt); ethtype = odp_be_to_cpu_16(eth->type); - vlan = (odp_vlanhdr_t *)ð->type; + vlan = (odph_vlanhdr_t *)ð->type; - if (ethtype == ODP_ETHTYPE_VLAN_OUTER) { + if (ethtype == ODPH_ETHTYPE_VLAN_OUTER) { pkt_hdr->input_flags.vlan_qinq = 1; ethtype = odp_be_to_cpu_16(vlan->tpid); - offset += sizeof(odp_vlanhdr_t); + offset += sizeof(odph_vlanhdr_t); vlan = &vlan[1]; } - if (ethtype == ODP_ETHTYPE_VLAN) { + if (ethtype == ODPH_ETHTYPE_VLAN) { pkt_hdr->input_flags.vlan = 1; ethtype = odp_be_to_cpu_16(vlan->tpid); - offset += sizeof(odp_vlanhdr_t); + offset += sizeof(odph_vlanhdr_t); } /* Set l3_offset+flag only for known ethtypes */ switch (ethtype) { - case ODP_ETHTYPE_IPV4: + case ODPH_ETHTYPE_IPV4: pkt_hdr->input_flags.ipv4 = 1; pkt_hdr->input_flags.l3 = 1; - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; - ipv4 = (odp_ipv4hdr_t *)odp_packet_l3(pkt); + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; + ipv4 = (odph_ipv4hdr_t *)odp_packet_l3(pkt); ip_proto = parse_ipv4(pkt_hdr, ipv4, &offset); break; - case ODP_ETHTYPE_IPV6: + case ODPH_ETHTYPE_IPV6: pkt_hdr->input_flags.ipv6 = 1; pkt_hdr->input_flags.l3 = 1; - pkt_hdr->l3_offset = frame_offset + ODP_ETHHDR_LEN + offset; - ipv6 = (odp_ipv6hdr_t *)odp_packet_l3(pkt); + pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; + ipv6 = (odph_ipv6hdr_t *)odp_packet_l3(pkt); ip_proto = parse_ipv6(pkt_hdr, ipv6, &offset); break; - case ODP_ETHTYPE_ARP: + case ODPH_ETHTYPE_ARP: pkt_hdr->input_flags.arp = 1; /* fall through */ default: @@ -202,22 +202,22 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) } switch (ip_proto) { - case ODP_IPPROTO_UDP: + case ODPH_IPPROTO_UDP: pkt_hdr->input_flags.udp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_TCP: + case ODPH_IPPROTO_TCP: pkt_hdr->input_flags.tcp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_SCTP: + case ODPH_IPPROTO_SCTP: pkt_hdr->input_flags.sctp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; break; - case ODP_IPPROTO_ICMP: + case ODPH_IPPROTO_ICMP: pkt_hdr->input_flags.icmp = 1; pkt_hdr->input_flags.l4 = 1; pkt_hdr->l4_offset = pkt_hdr->l3_offset + offset; @@ -232,19 +232,19 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) } } -static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, - size_t *offset_out) +static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, + odph_ipv4hdr_t *ipv4, size_t *offset_out) { uint8_t ihl; uint16_t frag_offset; - ihl = ODP_IPV4HDR_IHL(ipv4->ver_ihl); - if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) { + ihl = ODPH_IPV4HDR_IHL(ipv4->ver_ihl); + if (odp_unlikely(ihl < ODPH_IPV4HDR_IHL_MIN)) { pkt_hdr->error_flags.ip_err = 1; return 0; } - if (odp_unlikely(ihl > ODP_IPV4HDR_IHL_MIN)) { + if (odp_unlikely(ihl > ODPH_IPV4HDR_IHL_MIN)) { pkt_hdr->input_flags.ipopt = 1; return 0; } @@ -255,13 +255,13 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, * "fragment offset" field is nonzero (all fragments except the first) */ frag_offset = odp_be_to_cpu_16(ipv4->frag_offset); - if (odp_unlikely(ODP_IPV4HDR_IS_FRAGMENT(frag_offset))) { + if (odp_unlikely(ODPH_IPV4HDR_IS_FRAGMENT(frag_offset))) { pkt_hdr->input_flags.ipfrag = 1; return 0; } - if (ipv4->proto == ODP_IPPROTO_ESP || - ipv4->proto == ODP_IPPROTO_AH) { + if (ipv4->proto == ODPH_IPPROTO_ESP || + ipv4->proto == ODPH_IPPROTO_AH) { pkt_hdr->input_flags.ipsec = 1; return 0; } @@ -272,24 +272,24 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr, odp_ipv4hdr_t *ipv4, return ipv4->proto; } -static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, odp_ipv6hdr_t *ipv6, - size_t *offset_out) +static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr, + odph_ipv6hdr_t *ipv6, size_t *offset_out) { - if (ipv6->next_hdr == ODP_IPPROTO_ESP || - ipv6->next_hdr == ODP_IPPROTO_AH) { + if (ipv6->next_hdr == ODPH_IPPROTO_ESP || + ipv6->next_hdr == ODPH_IPPROTO_AH) { pkt_hdr->input_flags.ipopt = 1; pkt_hdr->input_flags.ipsec = 1; return 0; } - if (odp_unlikely(ipv6->next_hdr == ODP_IPPROTO_FRAG)) { + if (odp_unlikely(ipv6->next_hdr == ODPH_IPPROTO_FRAG)) { pkt_hdr->input_flags.ipopt = 1; pkt_hdr->input_flags.ipfrag = 1; return 0; } /* Don't step through more extensions */ - *offset_out = ODP_IPV6HDR_LEN; + *offset_out = ODPH_IPV6HDR_LEN; return ipv6->next_hdr; } diff --git a/test/Makefile.inc b/test/Makefile.inc index b549001..4de2feb 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -5,6 +5,6 @@ AM_CFLAGS += \ -I$(srcdir) \ -I$(top_srcdir)/platform/@with_platform@/include/api \ -I$(top_srcdir)/platform/linux-generic/include/api \ - -I$(top_srcdir)/include + -I$(top_srcdir)/helper/include AM_LDFLAGS += -L$(LIB) diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h index d6eec04..7814da5 100644 --- a/test/api_test/odp_atomic_test.h +++ b/test/api_test/odp_atomic_test.h @@ -8,7 +8,7 @@ #define ODP_ATOMIC_TEST_H_ #include <odp.h> -#include <helper/odp_linux.h> +#include <odph_linux.h> /** * add_sub_cnt could be any valid value diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 89ebd2d..b0a6fbc 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -12,14 +12,14 @@ #include <string.h> #include <odp.h> -#include <helper/odp_linux.h> +#include <odph_linux.h> #include <odp_common.h> #include <odp_atomic_test.h> #include <odp_shm_test.h> /* Globals */ -static odp_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads table */ +static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads table*/ static int num_workers; /**< number of workers */ __thread test_shared_data_t *test_shared_data; /**< pointer to shared data */ @@ -73,8 +73,8 @@ int odp_test_global_init(void) int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) { /* Create and init additional threads */ - odp_linux_pthread_create(thread_tbl, arg->numthrds, 0, func_ptr, - (void *)arg); + odph_linux_pthread_create(thread_tbl, arg->numthrds, 0, func_ptr, + (void *)arg); return 0; } @@ -83,7 +83,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) int odp_test_thread_exit(pthrd_arg *arg) { /* Wait for other threads to exit */ - odp_linux_pthread_join(thread_tbl, arg->numthrds); + odph_linux_pthread_join(thread_tbl, arg->numthrds); return 0; } diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c index 93bd869..d75c30b 100644 --- a/test/api_test/odp_ring_test.c +++ b/test/api_test/odp_ring_test.c @@ -50,14 +50,14 @@ #include <odp.h> #include <odp_debug.h> #include <odp_common.h> -#include <helper/odp_ring.h> +#include <odph_ring.h> #define RING_SIZE 4096 #define MAX_BULK 32 #define RING_TEST_BASIC -static int test_ring_basic(odp_ring_t *r) +static int test_ring_basic(odph_ring_t *r) { void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL; int ret; @@ -86,48 +86,48 @@ static int test_ring_basic(odp_ring_t *r) printf("Test SP & SC basic functions\n"); printf("enqueue 1 obj\n"); - ret = odp_ring_sp_enqueue_burst(r, cur_src, 1); + ret = odph_ring_sp_enqueue_burst(r, cur_src, 1); cur_src += 1; - if ((ret & ODP_RING_SZ_MASK) != 1) { + if ((ret & ODPH_RING_SZ_MASK) != 1) { ODP_ERR("sp_enq for 1 obj failed\n"); goto fail; } printf("enqueue 2 objs\n"); - ret = odp_ring_sp_enqueue_burst(r, cur_src, 2); + ret = odph_ring_sp_enqueue_burst(r, cur_src, 2); cur_src += 2; - if ((ret & ODP_RING_SZ_MASK) != 2) { + if ((ret & ODPH_RING_SZ_MASK) != 2) { ODP_ERR("sp_enq for 2 obj failed\n"); goto fail; } printf("enqueue MAX_BULK objs\n"); - ret = odp_ring_sp_enqueue_burst(r, cur_src, MAX_BULK); - if ((ret & ODP_RING_SZ_MASK) != MAX_BULK) { + ret = odph_ring_sp_enqueue_burst(r, cur_src, MAX_BULK); + if ((ret & ODPH_RING_SZ_MASK) != MAX_BULK) { ODP_ERR("sp_enq for %d obj failed\n", MAX_BULK); goto fail; } printf("dequeue 1 obj\n"); - ret = odp_ring_sc_dequeue_burst(r, cur_dst, 1); + ret = odph_ring_sc_dequeue_burst(r, cur_dst, 1); cur_dst += 1; - if ((ret & ODP_RING_SZ_MASK) != 1) { + if ((ret & ODPH_RING_SZ_MASK) != 1) { ODP_ERR("sc_deq for 1 obj failed\n"); goto fail; } printf("dequeue 2 objs\n"); - ret = odp_ring_sc_dequeue_burst(r, cur_dst, 2); + ret = odph_ring_sc_dequeue_burst(r, cur_dst, 2); cur_dst += 2; - if ((ret & ODP_RING_SZ_MASK) != 2) { + if ((ret & ODPH_RING_SZ_MASK) != 2) { ODP_ERR("sc_deq for 2 obj failed\n"); goto fail; } printf("dequeue MAX_BULK objs\n"); - ret = odp_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK); + ret = odph_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK); cur_dst += MAX_BULK; - if ((ret & ODP_RING_SZ_MASK) != MAX_BULK) { + if ((ret & ODPH_RING_SZ_MASK) != MAX_BULK) { ODP_ERR("sc_deq for %d obj failed\n", MAX_BULK); goto fail; } @@ -144,41 +144,41 @@ static int test_ring_basic(odp_ring_t *r) printf("Test MP & MC basic functions\n"); printf("enqueue 1 obj\n"); - ret = odp_ring_mp_enqueue_bulk(r, cur_src, 1); + ret = odph_ring_mp_enqueue_bulk(r, cur_src, 1); cur_src += 1; if (ret != 0) { ODP_ERR("mp_enq for 1 obj failed\n"); goto fail; } printf("enqueue 2 objs\n"); - ret = odp_ring_mp_enqueue_bulk(r, cur_src, 2); + ret = odph_ring_mp_enqueue_bulk(r, cur_src, 2); cur_src += 2; if (ret != 0) { ODP_ERR("mp_enq for 2 obj failed\n"); goto fail; } printf("enqueue MAX_BULK objs\n"); - ret = odp_ring_mp_enqueue_bulk(r, cur_src, MAX_BULK); + ret = odph_ring_mp_enqueue_bulk(r, cur_src, MAX_BULK); if (ret != 0) { ODP_ERR("mp_enq for %d obj failed\n", MAX_BULK); goto fail; } printf("dequeue 1 obj\n"); - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, 1); + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, 1); cur_dst += 1; if (ret != 0) { ODP_ERR("mc_deq for 1 obj failed\n"); goto fail; } printf("dequeue 2 objs\n"); - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, 2); + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, 2); cur_dst += 2; if (ret != 0) { ODP_ERR("mc_deq for 2 obj failed\n"); goto fail; } printf("dequeue MAX_BULK objs\n"); - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, MAX_BULK); + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, MAX_BULK); cur_dst += MAX_BULK; if (ret != 0) { ODP_ERR("mc_deq for %d obj failed\n", MAX_BULK); @@ -191,30 +191,30 @@ static int test_ring_basic(odp_ring_t *r) } printf("test watermark and default bulk enqueue / dequeue\n"); - odp_ring_set_water_mark(r, 20); + odph_ring_set_water_mark(r, 20); num_elems = 16; cur_src = src; cur_dst = dst; - ret = odp_ring_mp_enqueue_bulk(r, cur_src, num_elems); + ret = odph_ring_mp_enqueue_bulk(r, cur_src, num_elems); cur_src += num_elems; if (ret != 0) { ODP_ERR("Cannot enqueue\n"); goto fail; } - ret = odp_ring_mp_enqueue_bulk(r, cur_src, num_elems); + ret = odph_ring_mp_enqueue_bulk(r, cur_src, num_elems); if (ret != -EDQUOT) { ODP_ERR("Watermark not exceeded\n"); goto fail; } - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, num_elems); + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, num_elems); cur_dst += num_elems; if (ret != 0) { ODP_ERR("Cannot dequeue\n"); goto fail; } - ret = odp_ring_mc_dequeue_bulk(r, cur_dst, num_elems); + ret = odph_ring_mc_dequeue_bulk(r, cur_dst, num_elems); cur_dst += num_elems; if (ret != 0) { ODP_ERR("Cannot dequeue2\n"); @@ -241,7 +241,7 @@ fail: } /* global shared ring used for stress testing */ -static odp_ring_t *r_stress; +static odph_ring_t *r_stress; /* Stress func for Multi producer only */ static int producer_fn(void) @@ -260,7 +260,7 @@ static int producer_fn(void) src[i] = (void *)(unsigned long)i; do { - i = odp_ring_mp_enqueue_bulk(r_stress, src, MAX_BULK); + i = odph_ring_mp_enqueue_bulk(r_stress, src, MAX_BULK); if (i == 0) return 0; } while (1); @@ -280,7 +280,7 @@ static int consumer_fn(void) } do { - i = odp_ring_mc_dequeue_bulk(r_stress, src, MAX_BULK); + i = odph_ring_mc_dequeue_bulk(r_stress, src, MAX_BULK); if (i == 0) { for (i = 0; i < MAX_BULK; i++) { if (src[i] != (void *)(unsigned long)i) { @@ -351,8 +351,8 @@ static void *test_ring(void *arg) { ring_arg_t *parg = (ring_arg_t *)arg; int thr; - char ring_name[ODP_RING_NAMESIZE]; - odp_ring_t *r; + char ring_name[ODPH_RING_NAMESIZE]; + odph_ring_t *r; int result = 0; thr = odp_thread_id(); @@ -363,7 +363,7 @@ static void *test_ring(void *arg) case ODP_RING_TEST_BASIC: snprintf(ring_name, sizeof(ring_name), "test_ring_%i", thr); - r = odp_ring_create(ring_name, RING_SIZE, + r = odph_ring_create(ring_name, RING_SIZE, 0 /* not used, alignement taken care inside func : todo */); if (r == NULL) { @@ -372,7 +372,7 @@ static void *test_ring(void *arg) break; } /* lookup ring from its name */ - if (odp_ring_lookup(ring_name) != r) { + if (odph_ring_lookup(ring_name) != r) { ODP_ERR("ring lookup failed\n"); result = -1; break; @@ -385,7 +385,7 @@ static void *test_ring(void *arg) } /* dump ring stats */ - odp_ring_list_dump(); + odph_ring_list_dump(); break; @@ -393,7 +393,7 @@ static void *test_ring(void *arg) test_ring_stress(parg->stress_type); /* dump ring stats */ - odp_ring_list_dump(); + odph_ring_list_dump(); break; default: @@ -423,7 +423,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) odp_print_system_info(); - odp_ring_tailq_init(); + odph_ring_tailq_init(); rarg.thrdarg.numthrds = odp_sys_core_count(); @@ -433,13 +433,13 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) rarg.thrdarg.testcase = ODP_RING_TEST_STRESS; rarg.stress_type = one_enq_one_deq; /* rarg.stress_type = multi_enq_multi_deq;*/ - char ring_name[ODP_RING_NAMESIZE]; + char ring_name[ODPH_RING_NAMESIZE]; printf("starting stess test type : %d..\n", rarg.stress_type); /* create a ring */ snprintf(ring_name, sizeof(ring_name), "test_ring_stress"); - r_stress = odp_ring_create(ring_name, RING_SIZE, + r_stress = odph_ring_create(ring_name, RING_SIZE, 0 /* not used, alignement taken care inside func : todo */); if (r_stress == NULL) { @@ -447,7 +447,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) goto fail; } /* lookup ring from its name */ - if (odp_ring_lookup(ring_name) != r_stress) { + if (odph_ring_lookup(ring_name) != r_stress) { ODP_ERR("ring lookup failed\n"); goto fail; } diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c index c1cc255..6ba30d3 100644 --- a/test/api_test/odp_timer_ping.c +++ b/test/api_test/odp_timer_ping.c @@ -35,8 +35,8 @@ #include <odp.h> #include <odp_common.h> #include <odp_timer.h> -#include <helper/odp_linux.h> -#include <helper/odp_chksum.h> +#include <odph_linux.h> +#include <odph_chksum.h> #define MSG_POOL_SIZE (4*1024*1024) #define BUF_SIZE 8 @@ -309,7 +309,7 @@ static int ping_init(int count, char *name[]) int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { - odp_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_linux_pthread_t thread_tbl[MAX_WORKERS]; ping_arg_t pingarg; odp_queue_t queue; odp_buffer_pool_t pool; @@ -371,12 +371,12 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) run_thread = rx_ping; /* Create and launch worker threads */ - odp_linux_pthread_create(&thread_tbl[i], 1, i, - run_thread, (pthrd_arg *)&pingarg); + odph_linux_pthread_create(&thread_tbl[i], 1, i, + run_thread, (pthrd_arg *)&pingarg); } /* Wait for worker threads to exit */ - odp_linux_pthread_join(thread_tbl, PING_THRD); + odph_linux_pthread_join(thread_tbl, PING_THRD); ODP_DBG("ping timer test %s\n", (pingarg.result == 0) ? "passed" : "failed");