@@ -19,6 +19,8 @@ extern "C" {
#endif
#include <odp/api/debug.h>
+#include <odp/api/byteorder.h>
+#include <odp/api/plat/byteorder_inlines.h>
#include <protocols/eth.h>
#include <protocols/ip.h>
#include <protocols/ipsec.h>
@@ -68,7 +70,7 @@ static inline int verify_pmr_ipv4_saddr(const uint8_t *pkt_addr,
if (!pkt_hdr->p.input_flags.ipv4)
return 0;
ip = (const _odp_ipv4hdr_t *)(pkt_addr + pkt_hdr->p.l3_offset);
- ipaddr = odp_be_to_cpu_32(ip->src_addr);
+ ipaddr = _odp_be_to_cpu_32(ip->src_addr);
if (term_value->match.value == (ipaddr & term_value->match.mask))
return 1;
@@ -84,7 +86,7 @@ static inline int verify_pmr_ipv4_daddr(const uint8_t *pkt_addr,
if (!pkt_hdr->p.input_flags.ipv4)
return 0;
ip = (const _odp_ipv4hdr_t *)(pkt_addr + pkt_hdr->p.l3_offset);
- ipaddr = odp_be_to_cpu_32(ip->dst_addr);
+ ipaddr = _odp_be_to_cpu_32(ip->dst_addr);
if (term_value->match.value == (ipaddr & term_value->match.mask))
return 1;
@@ -100,7 +102,7 @@ static inline int verify_pmr_tcp_sport(const uint8_t *pkt_addr,
if (!pkt_hdr->p.input_flags.tcp)
return 0;
tcp = (const _odp_tcphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset);
- sport = odp_be_to_cpu_16(tcp->src_port);
+ sport = _odp_be_to_cpu_16(tcp->src_port);
if (term_value->match.value == (sport & term_value->match.mask))
return 1;
@@ -116,7 +118,7 @@ static inline int verify_pmr_tcp_dport(const uint8_t *pkt_addr,
if (!pkt_hdr->p.input_flags.tcp)
return 0;
tcp = (const _odp_tcphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset);
- dport = odp_be_to_cpu_16(tcp->dst_port);
+ dport = _odp_be_to_cpu_16(tcp->dst_port);
if (term_value->match.value == (dport & term_value->match.mask))
return 1;
@@ -132,7 +134,7 @@ static inline int verify_pmr_udp_dport(const uint8_t *pkt_addr,
if (!pkt_hdr->p.input_flags.udp)
return 0;
udp = (const _odp_udphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset);
- dport = odp_be_to_cpu_16(udp->dst_port);
+ dport = _odp_be_to_cpu_16(udp->dst_port);
if (term_value->match.value == (dport & term_value->match.mask))
return 1;
@@ -149,7 +151,7 @@ static inline int verify_pmr_udp_sport(const uint8_t *pkt_addr,
if (!pkt_hdr->p.input_flags.udp)
return 0;
udp = (const _odp_udphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset);
- sport = odp_be_to_cpu_16(udp->src_port);
+ sport = _odp_be_to_cpu_16(udp->src_port);
if (term_value->match.value == (sport & term_value->match.mask))
return 1;
@@ -169,9 +171,9 @@ static inline int verify_pmr_dmac(const uint8_t *pkt_addr,
eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset);
memcpy(&dmac_be, eth->dst.addr, _ODP_ETHADDR_LEN);
- dmac = odp_be_to_cpu_64(dmac_be);
+ dmac = _odp_be_to_cpu_64(dmac_be);
/* since we are converting a 48 bit ethernet address from BE to cpu
- format using odp_be_to_cpu_64() the last 16 bits needs to be right
+ format using _odp_be_to_cpu_64() the last 16 bits needs to be right
shifted */
if (dmac_be != dmac)
dmac = dmac >> (64 - (_ODP_ETHADDR_LEN * 8));
@@ -245,7 +247,7 @@ static inline int verify_pmr_vlan_id_0(const uint8_t *pkt_addr,
eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset);
vlan = (const _odp_vlanhdr_t *)(eth + 1);
- tci = odp_be_to_cpu_16(vlan->tci);
+ tci = _odp_be_to_cpu_16(vlan->tci);
vlan_id = tci & 0x0fff;
if (term_value->match.value == (vlan_id & term_value->match.mask))
@@ -269,7 +271,7 @@ static inline int verify_pmr_vlan_id_x(const uint8_t *pkt_addr ODP_UNUSED,
eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset);
vlan = (const _odp_vlanhdr_t *)(eth + 1);
vlan++;
- tci = odp_be_to_cpu_16(vlan->tci);
+ tci = _odp_be_to_cpu_16(vlan->tci);
vlan_id = tci & 0x0fff;
if (term_value->match.value == (vlan_id & term_value->match.mask))
@@ -289,11 +291,11 @@ static inline int verify_pmr_ipsec_spi(const uint8_t *pkt_addr,
if (pkt_hdr->p.input_flags.ipsec_ah) {
const _odp_ahhdr_t *ahhdr = (const _odp_ahhdr_t *)pkt_addr;
- spi = odp_be_to_cpu_32(ahhdr->spi);
+ spi = _odp_be_to_cpu_32(ahhdr->spi);
} else if (pkt_hdr->p.input_flags.ipsec_esp) {
const _odp_esphdr_t *esphdr = (const _odp_esphdr_t *)pkt_addr;
- spi = odp_be_to_cpu_32(esphdr->spi);
+ spi = _odp_be_to_cpu_32(esphdr->spi);
} else {
return 0;
}
@@ -343,7 +345,7 @@ static inline int verify_pmr_eth_type_0(const uint8_t *pkt_addr,
return 0;
eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset);
- ethtype = odp_be_to_cpu_16(eth->type);
+ ethtype = _odp_be_to_cpu_16(eth->type);
if (term_value->match.value == (ethtype & term_value->match.mask))
return 1;
@@ -364,7 +366,7 @@ static inline int verify_pmr_eth_type_x(const uint8_t *pkt_addr,
eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset);
vlan = (const _odp_vlanhdr_t *)(eth + 1);
- ethtype = odp_be_to_cpu_16(vlan->type);
+ ethtype = _odp_be_to_cpu_16(vlan->type);
if (term_value->match.value == (ethtype & term_value->match.mask))
return 1;
@@ -67,10 +67,10 @@ void thash_load_ipv6_addr(const _odp_ipv6hdr_t *ipv6,
for (i = 0; i < 4; i++) {
*(tuple->v6.src_addr.u32 + i) =
- odp_be_to_cpu_32(*(ipv6->src_addr.u32 + i));
+ _odp_be_to_cpu_32(*(ipv6->src_addr.u32 + i));
*(tuple->v6.dst_addr.u32 + i) =
- odp_be_to_cpu_32(*(ipv6->dst_addr.u32 + i));
+ _odp_be_to_cpu_32(*(ipv6->dst_addr.u32 + i));
}
}
@@ -83,9 +83,9 @@ uint32_t thash_softrss(uint32_t *tuple, uint8_t len,
for (j = 0; j < len; j++) {
for (i = 0; i < 32; i++) {
if (tuple[j] & (1 << (31 - i))) {
- ret ^= odp_cpu_to_be_32(((const uint32_t *)
+ ret ^= _odp_cpu_to_be_32(((const uint32_t *)
key.u32)[j]) << i | (uint32_t)((uint64_t)
- (odp_cpu_to_be_32(((const uint32_t *)key.u32)
+ (_odp_cpu_to_be_32(((const uint32_t *)key.u32)
[j + 1])) >> (32 - i));
}
}
@@ -1103,7 +1103,7 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const uint8_t *pkt_addr,
packet_hdr_has_eth(hdr)) {
eth = (const _odp_ethhdr_t *)(pkt_addr + hdr->p.l2_offset);
vlan = (const _odp_vlanhdr_t *)(eth + 1);
- qos = odp_be_to_cpu_16(vlan->tci);
+ qos = _odp_be_to_cpu_16(vlan->tci);
qos = ((qos >> 13) & 0x07);
cos = l2_cos->cos[qos];
}
@@ -10,6 +10,8 @@
#include <odp/api/chksum.h>
#include <odp/api/plat/packet_inlines.h>
+#include <odp/api/byteorder.h>
+#include <odp/api/plat/byteorder_inlines.h>
#include <odp_debug_internal.h>
#include <odp_packet_internal.h>
@@ -304,11 +306,11 @@ static int ipsec_parse_ipv4(ipsec_state_t *state, odp_packet_t pkt)
odp_packet_copy_to_mem(pkt, state->ip_offset,
_ODP_IPV4HDR_LEN, &ipv4hdr);
- if (_ODP_IPV4HDR_IS_FRAGMENT(odp_be_to_cpu_16(ipv4hdr.frag_offset)))
+ if (_ODP_IPV4HDR_IS_FRAGMENT(_odp_be_to_cpu_16(ipv4hdr.frag_offset)))
return -1;
state->ip_hdr_len = ipv4_hdr_len(&ipv4hdr);
- state->ip_tot_len = odp_be_to_cpu_16(ipv4hdr.tot_len);
+ state->ip_tot_len = _odp_be_to_cpu_16(ipv4hdr.tot_len);
state->ip_next_hdr = ipv4hdr.proto;
state->ip_next_hdr_offset = state->ip_offset +
_ODP_IPV4HDR_PROTO_OFFSET;
@@ -329,7 +331,7 @@ static int ipsec_parse_ipv6(ipsec_state_t *state, odp_packet_t pkt)
state->ip_next_hdr = ipv6hdr.next_hdr;
state->ip_next_hdr_offset = state->ip_offset + _ODP_IPV6HDR_NHDR_OFFSET;
/* FIXME: Jumbo frames */
- state->ip_tot_len = odp_be_to_cpu_16(ipv6hdr.payload_len) +
+ state->ip_tot_len = _odp_be_to_cpu_16(ipv6hdr.payload_len) +
_ODP_IPV6HDR_LEN;
memcpy(state->ipv6_addr, &ipv6hdr.dst_addr, _ODP_IPV6ADDR_LEN);
@@ -432,8 +434,8 @@ static int ipsec_in_esp(odp_packet_t *pkt,
odp_packet_copy_to_mem(*pkt, ipsec_offset,
_ODP_UDPHDR_LEN, &udp);
- if (udp.dst_port != odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) ||
- udp.length != odp_cpu_to_be_16(ip_data_len)) {
+ if (udp.dst_port != _odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) ||
+ udp.length != _odp_cpu_to_be_16(ip_data_len)) {
status->error.proto = 1;
return -1;
}
@@ -450,7 +452,7 @@ static int ipsec_in_esp(odp_packet_t *pkt,
}
ipsec_sa = ipsec_get_sa(sa, ODP_IPSEC_ESP,
- odp_be_to_cpu_32(esp.spi),
+ _odp_be_to_cpu_32(esp.spi),
state->is_ipv4 ? ODP_IPSEC_IPV4 :
ODP_IPSEC_IPV6,
&state->ipv4_addr, status);
@@ -481,7 +483,7 @@ static int ipsec_in_esp(odp_packet_t *pkt,
state->esp.aad.spi = esp.spi;
state->esp.aad.seq_no = esp.seq_no;
- state->in.seq_no = odp_be_to_cpu_32(esp.seq_no);
+ state->in.seq_no = _odp_be_to_cpu_32(esp.seq_no);
param->aad_ptr = (uint8_t *)&state->esp.aad;
@@ -546,7 +548,7 @@ static int ipsec_in_ah(odp_packet_t *pkt,
}
ipsec_sa = ipsec_get_sa(sa, ODP_IPSEC_AH,
- odp_be_to_cpu_32(ah.spi),
+ _odp_be_to_cpu_32(ah.spi),
state->is_ipv4 ? ODP_IPSEC_IPV4 :
ODP_IPSEC_IPV6,
&state->ipv4_addr, status);
@@ -587,11 +589,11 @@ static int ipsec_in_ah(odp_packet_t *pkt,
state->ah_ipv6.ver_tc_flow = ipv6hdr->ver_tc_flow;
state->ah_ipv6.hop_limit = ipv6hdr->hop_limit;
ipv6hdr->ver_tc_flow =
- odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT);
+ _odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT);
ipv6hdr->hop_limit = 0;
}
- state->in.seq_no = odp_be_to_cpu_32(ah.seq_no);
+ state->in.seq_no = _odp_be_to_cpu_32(ah.seq_no);
param->auth_range.offset = state->ip_offset;
param->auth_range.length = state->ip_tot_len;
@@ -794,7 +796,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
_odp_ipv4hdr_t *ipv4hdr = odp_packet_l3_ptr(pkt, NULL);
if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode)
- ipv4hdr->tot_len = odp_cpu_to_be_16(state.ip_tot_len);
+ ipv4hdr->tot_len = _odp_cpu_to_be_16(state.ip_tot_len);
else
ipv4hdr->ttl -= ipsec_sa->dec_ttl;
_odp_ipv4_csum_update(pkt);
@@ -803,8 +805,8 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode)
ipv6hdr->payload_len =
- odp_cpu_to_be_16(state.ip_tot_len -
- _ODP_IPV6HDR_LEN);
+ _odp_cpu_to_be_16(state.ip_tot_len -
+ _ODP_IPV6HDR_LEN);
else
ipv6hdr->hop_limit -= ipsec_sa->dec_ttl;
} else {
@@ -849,7 +851,7 @@ static int ipsec_out_tunnel_parse_ipv4(ipsec_state_t *state,
ipsec_sa_t *ipsec_sa)
{
_odp_ipv4hdr_t *ipv4hdr = state->ip;
- uint16_t flags = odp_be_to_cpu_16(ipv4hdr->frag_offset);
+ uint16_t flags = _odp_be_to_cpu_16(ipv4hdr->frag_offset);
ipv4hdr->ttl -= ipsec_sa->dec_ttl;
state->out_tunnel.ip_tos = ipv4hdr->tos;
@@ -894,7 +896,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt,
state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset;
state->ip_tot_len += _ODP_IPV4HDR_LEN;
- out_ip.tot_len = odp_cpu_to_be_16(state->ip_tot_len);
+ out_ip.tot_len = _odp_cpu_to_be_16(state->ip_tot_len);
/* No need to convert to BE: ID just should not be duplicated */
out_ip.id = odp_atomic_fetch_add_u32(&ipsec_sa->out.tun_ipv4.hdr_id,
1);
@@ -902,7 +904,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt,
flags = state->out_tunnel.ip_df;
else
flags = ((uint16_t)ipsec_sa->out.tun_ipv4.df) << 14;
- out_ip.frag_offset = odp_cpu_to_be_16(flags);
+ out_ip.frag_offset = _odp_cpu_to_be_16(flags);
out_ip.ttl = ipsec_sa->out.tun_ipv4.ttl;
/* Will be filled later by packet checksum update */
out_ip.chksum = 0;
@@ -957,7 +959,7 @@ static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt,
out_ip.ver_tc_flow = odp_cpu_to_be_32(ver);
state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset;
- out_ip.payload_len = odp_cpu_to_be_16(state->ip_tot_len);
+ out_ip.payload_len = _odp_cpu_to_be_16(state->ip_tot_len);
state->ip_tot_len += _ODP_IPV6HDR_LEN;
out_ip.hop_limit = ipsec_sa->out.tun_ipv6.hlimit;
@@ -1062,10 +1064,10 @@ static int ipsec_out_esp(odp_packet_t *pkt,
if (ipsec_sa->udp_encap) {
hdr_len += _ODP_UDPHDR_LEN;
proto = _ODP_IPPROTO_UDP;
- udphdr.src_port = odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT);
- udphdr.dst_port = odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT);
- udphdr.length = odp_cpu_to_be_16(ip_data_len +
- hdr_len + trl_len);
+ udphdr.src_port = _odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT);
+ udphdr.dst_port = _odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT);
+ udphdr.length = _odp_cpu_to_be_16(ip_data_len +
+ hdr_len + trl_len);
udphdr.chksum = 0; /* should be 0 by RFC */
}
@@ -1082,8 +1084,8 @@ static int ipsec_out_esp(odp_packet_t *pkt,
param->override_iv_ptr = state->iv;
memset(&esp, 0, sizeof(esp));
- esp.spi = odp_cpu_to_be_32(ipsec_sa->spi);
- esp.seq_no = odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa));
+ esp.spi = _odp_cpu_to_be_32(ipsec_sa->spi);
+ esp.seq_no = _odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa));
state->esp.aad.spi = esp.spi;
state->esp.aad.seq_no = esp.seq_no;
@@ -1099,12 +1101,12 @@ static int ipsec_out_esp(odp_packet_t *pkt,
if (state->is_ipv4) {
_odp_ipv4hdr_t *ipv4hdr = state->ip;
- ipv4hdr->tot_len = odp_cpu_to_be_16(state->ip_tot_len);
+ ipv4hdr->tot_len = _odp_cpu_to_be_16(state->ip_tot_len);
} else {
_odp_ipv6hdr_t *ipv6hdr = state->ip;
- ipv6hdr->payload_len = odp_cpu_to_be_16(state->ip_tot_len -
- _ODP_IPV6HDR_LEN);
+ ipv6hdr->payload_len = _odp_cpu_to_be_16(state->ip_tot_len -
+ _ODP_IPV6HDR_LEN);
}
if (odp_packet_extend_tail(pkt, trl_len, NULL, NULL) < 0 ||
@@ -1187,8 +1189,8 @@ static int ipsec_out_ah(odp_packet_t *pkt,
}
memset(&ah, 0, sizeof(ah));
- ah.spi = odp_cpu_to_be_32(ipsec_sa->spi);
- ah.seq_no = odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa));
+ ah.spi = _odp_cpu_to_be_32(ipsec_sa->spi);
+ ah.seq_no = _odp_cpu_to_be_32(ipsec_seq_no(ipsec_sa));
ah.next_header = state->ip_next_hdr;
odp_packet_copy_from_mem(*pkt, state->ip_next_hdr_offset, 1, &proto);
@@ -1205,20 +1207,20 @@ static int ipsec_out_ah(odp_packet_t *pkt,
ipv4hdr->ttl = 0;
hdr_len = IPSEC_PAD_LEN(hdr_len, 4);
state->ip_tot_len += hdr_len;
- ipv4hdr->tot_len = odp_cpu_to_be_16(state->ip_tot_len);
+ ipv4hdr->tot_len = _odp_cpu_to_be_16(state->ip_tot_len);
} else {
_odp_ipv6hdr_t *ipv6hdr = state->ip;
state->ah_ipv6.ver_tc_flow = ipv6hdr->ver_tc_flow;
state->ah_ipv6.hop_limit = ipv6hdr->hop_limit;
ipv6hdr->ver_tc_flow =
- odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT);
+ _odp_cpu_to_be_32(6 << _ODP_IPV6HDR_VERSION_SHIFT);
ipv6hdr->hop_limit = 0;
hdr_len = IPSEC_PAD_LEN(hdr_len, 8);
state->ip_tot_len += hdr_len;
- ipv6hdr->payload_len = odp_cpu_to_be_16(state->ip_tot_len -
- _ODP_IPV6HDR_LEN);
+ ipv6hdr->payload_len = _odp_cpu_to_be_16(state->ip_tot_len -
+ _ODP_IPV6HDR_LEN);
}
ah.ah_len = hdr_len / 4 - 2;
@@ -12,6 +12,7 @@
#include <odp_debug_internal.h>
#include <odp/api/hints.h>
#include <odp/api/byteorder.h>
+#include <odp/api/plat/byteorder_inlines.h>
#include <protocols/eth.h>
#include <protocols/ip.h>
@@ -1964,16 +1965,16 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr,
eth = (const _odp_ethhdr_t *)*parseptr;
/* Handle Ethernet broadcast/multicast addresses */
- macaddr0 = odp_be_to_cpu_16(*((const uint16_t *)(const void *)eth));
+ macaddr0 = _odp_be_to_cpu_16(*((const uint16_t *)(const void *)eth));
prs->input_flags.eth_mcast = (macaddr0 & 0x0100) == 0x0100;
if (macaddr0 == 0xffff) {
macaddr2 =
- odp_be_to_cpu_16(*((const uint16_t *)
- (const void *)eth + 1));
+ _odp_be_to_cpu_16(*((const uint16_t *)
+ (const void *)eth + 1));
macaddr4 =
- odp_be_to_cpu_16(*((const uint16_t *)
- (const void *)eth + 2));
+ _odp_be_to_cpu_16(*((const uint16_t *)
+ (const void *)eth + 2));
prs->input_flags.eth_bcast =
(macaddr2 == 0xffff) && (macaddr4 == 0xffff);
} else {
@@ -1981,7 +1982,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr,
}
/* Get Ethertype */
- ethtype = odp_be_to_cpu_16(eth->type);
+ ethtype = _odp_be_to_cpu_16(eth->type);
*offset += sizeof(*eth);
*parseptr += sizeof(*eth);
@@ -1992,8 +1993,8 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr,
prs->error_flags.snap_len = 1;
return 0;
}
- ethtype = odp_be_to_cpu_16(*((const uint16_t *)(uintptr_t)
- (parseptr + 6)));
+ ethtype = _odp_be_to_cpu_16(*((const uint16_t *)(uintptr_t)
+ (parseptr + 6)));
*offset += 8;
*parseptr += 8;
}
@@ -2004,7 +2005,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr,
prs->input_flags.vlan = 1;
vlan = (const _odp_vlanhdr_t *)*parseptr;
- ethtype = odp_be_to_cpu_16(vlan->type);
+ ethtype = _odp_be_to_cpu_16(vlan->type);
*offset += sizeof(_odp_vlanhdr_t);
*parseptr += sizeof(_odp_vlanhdr_t);
}
@@ -2012,7 +2013,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr,
if (ethtype == _ODP_ETHTYPE_VLAN) {
prs->input_flags.vlan = 1;
vlan = (const _odp_vlanhdr_t *)*parseptr;
- ethtype = odp_be_to_cpu_16(vlan->type);
+ ethtype = _odp_be_to_cpu_16(vlan->type);
*offset += sizeof(_odp_vlanhdr_t);
*parseptr += sizeof(_odp_vlanhdr_t);
}
@@ -2030,8 +2031,8 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr,
uint8_t ver = _ODP_IPV4HDR_VER(ipv4->ver_ihl);
uint8_t ihl = _ODP_IPV4HDR_IHL(ipv4->ver_ihl);
uint16_t frag_offset;
- uint32_t dstaddr = odp_be_to_cpu_32(ipv4->dst_addr);
- uint32_t l3_len = odp_be_to_cpu_16(ipv4->tot_len);
+ uint32_t dstaddr = _odp_be_to_cpu_32(ipv4->dst_addr);
+ uint32_t l3_len = _odp_be_to_cpu_16(ipv4->tot_len);
if (odp_unlikely(ihl < _ODP_IPV4HDR_IHL_MIN) ||
odp_unlikely(ver != 4) ||
@@ -2051,7 +2052,7 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr,
* OR
* "fragment offset" field is nonzero (all fragments except the first)
*/
- frag_offset = odp_be_to_cpu_16(ipv4->frag_offset);
+ frag_offset = _odp_be_to_cpu_16(ipv4->frag_offset);
if (odp_unlikely(_ODP_IPV4HDR_IS_FRAGMENT(frag_offset)))
prs->input_flags.ipfrag = 1;
@@ -2071,12 +2072,12 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr,
{
const _odp_ipv6hdr_t *ipv6 = (const _odp_ipv6hdr_t *)*parseptr;
const _odp_ipv6hdr_ext_t *ipv6ext;
- uint32_t dstaddr0 = odp_be_to_cpu_32(ipv6->dst_addr.u8[0]);
- uint32_t l3_len = odp_be_to_cpu_16(ipv6->payload_len) +
- _ODP_IPV6HDR_LEN;
+ uint32_t dstaddr0 = _odp_be_to_cpu_32(ipv6->dst_addr.u8[0]);
+ uint32_t l3_len = _odp_be_to_cpu_16(ipv6->payload_len) +
+ _ODP_IPV6HDR_LEN;
/* Basic sanity checks on IPv6 header */
- if ((odp_be_to_cpu_32(ipv6->ver_tc_flow) >> 28) != 6 ||
+ if ((_odp_be_to_cpu_32(ipv6->ver_tc_flow) >> 28) != 6 ||
l3_len > frame_len - *offset) {
prs->error_flags.ip_err = 1;
return 0;
@@ -2106,7 +2107,7 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr,
*offset < seg_len);
if (*offset >= prs->l3_offset +
- odp_be_to_cpu_16(ipv6->payload_len)) {
+ _odp_be_to_cpu_16(ipv6->payload_len)) {
prs->error_flags.ip_err = 1;
return 0;
}
@@ -2150,12 +2151,12 @@ static inline void parse_udp(packet_parser_t *prs,
const uint8_t **parseptr, uint32_t *offset)
{
const _odp_udphdr_t *udp = (const _odp_udphdr_t *)*parseptr;
- uint32_t udplen = odp_be_to_cpu_16(udp->length);
+ uint32_t udplen = _odp_be_to_cpu_16(udp->length);
if (odp_unlikely(udplen < sizeof(_odp_udphdr_t)))
prs->error_flags.udp_err = 1;
- if (odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port &&
+ if (_odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port &&
udplen > 4) {
uint32_t val;
@@ -27,6 +27,7 @@
#include <protocols/ip.h>
#include <odp_traffic_mngr_internal.h>
#include <odp/api/plat/packet_inlines.h>
+#include <odp/api/plat/byteorder_inlines.h>
/* Local vars */
static const
@@ -1945,7 +1946,7 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking,
vlan_hdr_ptr = &vlan_hdr;
}
- old_tci = odp_be_to_cpu_16(vlan_hdr_ptr->tci);
+ old_tci = _odp_be_to_cpu_16(vlan_hdr_ptr->tci);
new_tci = old_tci;
if (vlan_marking->drop_eligible_enabled)
new_tci |= _ODP_VLANHDR_DEI_MASK;
@@ -1953,7 +1954,7 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking,
if (new_tci == old_tci)
return;
- vlan_hdr_ptr->tci = odp_cpu_to_be_16(new_tci);
+ vlan_hdr_ptr->tci = _odp_cpu_to_be_16(new_tci);
if (split_hdr)
odp_packet_copy_from_mem(odp_pkt, _ODP_ETHHDR_LEN,
_ODP_VLANHDR_LEN, &vlan_hdr);
@@ -2010,7 +2011,7 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking,
* in this specific case the carry out check does NOT need to be
* repeated since it can be proven that the carry in sum cannot
* cause another carry out. */
- old_chksum = (uint32_t)odp_be_to_cpu_16(ipv4_hdr_ptr->chksum);
+ old_chksum = (uint32_t)_odp_be_to_cpu_16(ipv4_hdr_ptr->chksum);
ones_compl_sum = (~old_chksum) & 0xFFFF;
tos_diff = ((uint32_t)new_tos) + ((~(uint32_t)old_tos) & 0xFFFF);
ones_compl_sum += tos_diff;
@@ -2019,7 +2020,7 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking,
(ones_compl_sum & 0xFFFF);
ipv4_hdr_ptr->tos = new_tos;
- ipv4_hdr_ptr->chksum = odp_cpu_to_be_16((~ones_compl_sum) & 0xFFFF);
+ ipv4_hdr_ptr->chksum = _odp_cpu_to_be_16((~ones_compl_sum) & 0xFFFF);
if (split_hdr)
odp_packet_copy_from_mem(odp_pkt, l3_offset,
_ODP_IPV4HDR_LEN, &ipv4_hdr);
@@ -2050,7 +2051,7 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking,
ipv6_hdr_ptr = &ipv6_hdr;
}
- old_ver_tc_flow = odp_be_to_cpu_32(ipv6_hdr_ptr->ver_tc_flow);
+ old_ver_tc_flow = _odp_be_to_cpu_32(ipv6_hdr_ptr->ver_tc_flow);
old_tc = (old_ver_tc_flow & _ODP_IPV6HDR_TC_MASK)
>> _ODP_IPV6HDR_TC_SHIFT;
new_tc = old_tc;
@@ -2071,7 +2072,7 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking,
new_ver_tc_flow = (old_ver_tc_flow & ~_ODP_IPV6HDR_TC_MASK) |
(new_tc << _ODP_IPV6HDR_TC_SHIFT);
- ipv6_hdr_ptr->ver_tc_flow = odp_cpu_to_be_32(new_ver_tc_flow);
+ ipv6_hdr_ptr->ver_tc_flow = _odp_cpu_to_be_32(new_ver_tc_flow);
if (split_hdr)
odp_packet_copy_from_mem(odp_pkt, l3_offset,