summaryrefslogtreecommitdiff
path: root/examples/l3fwd
diff options
context:
space:
mode:
authorOlivier Matz <olivier.matz@6wind.com>2019-05-21 18:13:10 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2019-05-24 13:34:46 +0200
commita7c528e5d71ff3f569898d268f9de129fdfc152b (patch)
treeead7c352fb1a817707a3ffbe471e6484850607d4 /examples/l3fwd
parentecaeed4f1d042b4317f756ad49ab4d918d0e4f76 (diff)
downloaddpdk-a7c528e5d71ff3f569898d268f9de129fdfc152b.zip
dpdk-a7c528e5d71ff3f569898d268f9de129fdfc152b.tar.gz
dpdk-a7c528e5d71ff3f569898d268f9de129fdfc152b.tar.xz
net: add rte prefix to IP structure
Add 'rte_' prefix to structures: - rename struct ipv4_hdr as struct rte_ipv4_hdr. - rename struct ipv6_hdr as struct rte_ipv6_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'examples/l3fwd')
-rw-r--r--examples/l3fwd/l3fwd.h6
-rw-r--r--examples/l3fwd/l3fwd_altivec.h22
-rw-r--r--examples/l3fwd/l3fwd_common.h4
-rw-r--r--examples/l3fwd/l3fwd_em.c16
-rw-r--r--examples/l3fwd/l3fwd_em.h8
-rw-r--r--examples/l3fwd/l3fwd_em_hlm.h8
-rw-r--r--examples/l3fwd/l3fwd_em_hlm_neon.h16
-rw-r--r--examples/l3fwd/l3fwd_em_hlm_sse.h8
-rw-r--r--examples/l3fwd/l3fwd_em_sequential.h8
-rw-r--r--examples/l3fwd/l3fwd_lpm.c16
-rw-r--r--examples/l3fwd/l3fwd_lpm.h8
-rw-r--r--examples/l3fwd/l3fwd_lpm_altivec.h10
-rw-r--r--examples/l3fwd/l3fwd_lpm_neon.h10
-rw-r--r--examples/l3fwd/l3fwd_lpm_sse.h10
-rw-r--r--examples/l3fwd/l3fwd_neon.h22
-rw-r--r--examples/l3fwd/l3fwd_sse.h22
16 files changed, 104 insertions, 90 deletions
diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
index 1893f8c..293fb1f 100644
--- a/examples/l3fwd/l3fwd.h
+++ b/examples/l3fwd/l3fwd.h
@@ -130,14 +130,14 @@ send_single_packet(struct lcore_conf *qconf,
#ifdef DO_RFC_1812_CHECKS
static inline int
-is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len)
+is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len)
{
/* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */
/*
* 1. The packet length reported by the Link Layer must be large
* enough to hold the minimum length legal IP datagram (20 bytes).
*/
- if (link_len < sizeof(struct ipv4_hdr))
+ if (link_len < sizeof(struct rte_ipv4_hdr))
return -1;
/* 2. The IP checksum must be correct. */
@@ -162,7 +162,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len)
* datagram header, whose length is specified in the IP header length
* field.
*/
- if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr))
+ if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr))
return -5;
return 0;
diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h
index 0c68aa0..ed9b0b8 100644
--- a/examples/l3fwd/l3fwd_altivec.h
+++ b/examples/l3fwd/l3fwd_altivec.h
@@ -68,14 +68,18 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
*p[2] = te[2];
*p[3] = te[3];
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1),
- &dst_port[0], pkt[0]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1),
- &dst_port[1], pkt[1]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1),
- &dst_port[2], pkt[2]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1),
- &dst_port[3], pkt[3]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[0] + 1),
+ &dst_port[0], pkt[0]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[1] + 1),
+ &dst_port[1], pkt[1]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[2] + 1),
+ &dst_port[2], pkt[2]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[3] + 1),
+ &dst_port[3], pkt[3]->packet_type);
}
/*
@@ -129,7 +133,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port)
te = *(vector unsigned int *)eth_hdr;
ve = (vector unsigned int)val_eth[dst_port[0]];
- rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port,
+ rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port,
pkt->packet_type);
/* dynamically vec_sel te and ve for MASK_ETH (0x3f) */
diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h
index 0f4fcb4..7d83ff6 100644
--- a/examples/l3fwd/l3fwd_common.h
+++ b/examples/l3fwd/l3fwd_common.h
@@ -14,7 +14,7 @@
#define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL)
/* Minimum value of IPV4 total length (20B) in network byte order. */
-#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8)
+#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8)
/*
* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2:
@@ -28,7 +28,7 @@
* to BAD_PORT value.
*/
static __rte_always_inline void
-rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype)
+rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype)
{
uint8_t ihl;
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index b56b086..5cf5f67 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -252,7 +252,8 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct)
struct rte_hash *ipv4_l3fwd_lookup_struct =
(struct rte_hash *)lookup_struct;
- ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live);
+ ipv4_hdr = (uint8_t *)ipv4_hdr +
+ offsetof(struct rte_ipv4_hdr, time_to_live);
/*
* Get 5 tuple: dst port, src port, dst IP address,
@@ -273,7 +274,8 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct)
struct rte_hash *ipv6_l3fwd_lookup_struct =
(struct rte_hash *)lookup_struct;
- ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len);
+ ipv6_hdr = (uint8_t *)ipv6_hdr +
+ offsetof(struct rte_ipv6_hdr, payload_len);
void *data0 = ipv6_hdr;
void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t);
void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t);
@@ -566,17 +568,17 @@ em_parse_ptype(struct rte_mbuf *m)
uint16_t ether_type;
void *l3;
int hdr_len;
- struct ipv4_hdr *ipv4_hdr;
- struct ipv6_hdr *ipv6_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
ether_type = eth_hdr->ether_type;
l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr);
if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) {
- ipv4_hdr = (struct ipv4_hdr *)l3;
+ ipv4_hdr = (struct rte_ipv4_hdr *)l3;
hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) *
IPV4_IHL_MULTIPLIER;
- if (hdr_len == sizeof(struct ipv4_hdr)) {
+ if (hdr_len == sizeof(struct rte_ipv4_hdr)) {
packet_type |= RTE_PTYPE_L3_IPV4;
if (ipv4_hdr->next_proto_id == IPPROTO_TCP)
packet_type |= RTE_PTYPE_L4_TCP;
@@ -585,7 +587,7 @@ em_parse_ptype(struct rte_mbuf *m)
} else
packet_type |= RTE_PTYPE_L3_IPV4_EXT;
} else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) {
- ipv6_hdr = (struct ipv6_hdr *)l3;
+ ipv6_hdr = (struct rte_ipv6_hdr *)l3;
if (ipv6_hdr->proto == IPPROTO_TCP)
packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP;
else if (ipv6_hdr->proto == IPPROTO_UDP)
diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h
index e787691..090c1b4 100644
--- a/examples/l3fwd/l3fwd_em.h
+++ b/examples/l3fwd/l3fwd_em.h
@@ -10,7 +10,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid,
struct lcore_conf *qconf)
{
struct rte_ether_hdr *eth_hdr;
- struct ipv4_hdr *ipv4_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
uint16_t dst_port;
uint32_t tcp_or_udp;
uint32_t l3_ptypes;
@@ -21,7 +21,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid,
if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) {
/* Handle IPv4 headers.*/
- ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *,
+ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
#ifdef DO_RFC_1812_CHECKS
@@ -53,9 +53,9 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid,
send_single_packet(qconf, m, dst_port);
} else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) {
/* Handle IPv6 headers.*/
- struct ipv6_hdr *ipv6_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
- ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *,
+ ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *,
sizeof(struct rte_ether_hdr));
dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid,
diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h
index ec52a01..ad8b9ce 100644
--- a/examples/l3fwd/l3fwd_em_hlm.h
+++ b/examples/l3fwd/l3fwd_em_hlm.h
@@ -80,8 +80,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
uint16_t portid)
{
uint16_t next_hop;
- struct ipv4_hdr *ipv4_hdr;
- struct ipv6_hdr *ipv6_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
uint32_t tcp_or_udp;
uint32_t l3_ptypes;
@@ -91,7 +91,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) {
/* Handle IPv4 headers.*/
- ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *,
+ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid,
@@ -106,7 +106,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
} else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) {
/* Handle IPv6 headers.*/
- ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *,
+ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *,
sizeof(struct rte_ether_hdr));
next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid,
diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h
index 3ee2304..8aa1c32 100644
--- a/examples/l3fwd/l3fwd_em_hlm_neon.h
+++ b/examples/l3fwd/l3fwd_em_hlm_neon.h
@@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0,
{
int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *,
sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv4_hdr, time_to_live)));
+ offsetof(struct rte_ipv4_hdr, time_to_live)));
key->xmm = vandq_s32(tmpdata0, mask0);
}
@@ -26,17 +26,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0,
int32x4_t tmpdata0 = vld1q_s32(
rte_pktmbuf_mtod_offset(m0, int *,
sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv6_hdr, payload_len)));
+ offsetof(struct rte_ipv6_hdr, payload_len)));
int32x4_t tmpdata1 = vld1q_s32(
- rte_pktmbuf_mtod_offset(m0, int *,
- sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv6_hdr, payload_len) + 8));
+ rte_pktmbuf_mtod_offset(m0, int *,
+ sizeof(struct rte_ether_hdr) +
+ offsetof(struct rte_ipv6_hdr, payload_len) + 8));
int32x4_t tmpdata2 = vld1q_s32(
- rte_pktmbuf_mtod_offset(m0, int *,
- sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv6_hdr, payload_len) + 16));
+ rte_pktmbuf_mtod_offset(m0, int *,
+ sizeof(struct rte_ether_hdr) +
+ offsetof(struct rte_ipv6_hdr, payload_len) + 16));
key->xmm[0] = vandq_s32(tmpdata0, mask0);
key->xmm[1] = tmpdata1;
diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h
index 8156bbb..7964a92 100644
--- a/examples/l3fwd/l3fwd_em_hlm_sse.h
+++ b/examples/l3fwd/l3fwd_em_hlm_sse.h
@@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0,
__m128i tmpdata0 = _mm_loadu_si128(
rte_pktmbuf_mtod_offset(m0, __m128i *,
sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv4_hdr, time_to_live)));
+ offsetof(struct rte_ipv4_hdr, time_to_live)));
key->xmm = _mm_and_si128(tmpdata0, mask0);
}
@@ -26,18 +26,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0,
__m128i tmpdata0 = _mm_loadu_si128(
rte_pktmbuf_mtod_offset(m0, __m128i *,
sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv6_hdr, payload_len)));
+ offsetof(struct rte_ipv6_hdr, payload_len)));
__m128i tmpdata1 = _mm_loadu_si128(
rte_pktmbuf_mtod_offset(m0, __m128i *,
sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv6_hdr, payload_len) +
+ offsetof(struct rte_ipv6_hdr, payload_len) +
sizeof(__m128i)));
__m128i tmpdata2 = _mm_loadu_si128(
rte_pktmbuf_mtod_offset(m0, __m128i *,
sizeof(struct rte_ether_hdr) +
- offsetof(struct ipv6_hdr, payload_len) +
+ offsetof(struct rte_ipv6_hdr, payload_len) +
sizeof(__m128i) + sizeof(__m128i)));
key->xmm[0] = _mm_and_si128(tmpdata0, mask0);
diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h
index 770660e..23fe9de 100644
--- a/examples/l3fwd/l3fwd_em_sequential.h
+++ b/examples/l3fwd/l3fwd_em_sequential.h
@@ -25,8 +25,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
uint16_t portid)
{
uint8_t next_hop;
- struct ipv4_hdr *ipv4_hdr;
- struct ipv6_hdr *ipv6_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
uint32_t tcp_or_udp;
uint32_t l3_ptypes;
@@ -36,7 +36,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) {
/* Handle IPv4 headers.*/
- ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *,
+ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid,
@@ -51,7 +51,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
} else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) {
/* Handle IPv6 headers.*/
- ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *,
+ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *,
sizeof(struct rte_ether_hdr));
next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid,
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index eaa47aa..5fa8c53 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -86,7 +86,7 @@ lpm_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct)
(struct rte_lpm *)lookup_struct;
return (uint16_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct,
- rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr),
+ rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr),
&next_hop) == 0) ? next_hop : portid);
}
@@ -98,7 +98,7 @@ lpm_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct)
(struct rte_lpm6 *)lookup_struct;
return (uint16_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct,
- ((struct ipv6_hdr *)ipv6_hdr)->dst_addr,
+ ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr,
&next_hop) == 0) ? next_hop : portid);
}
@@ -106,21 +106,21 @@ static __rte_always_inline uint16_t
lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
uint16_t portid)
{
- struct ipv6_hdr *ipv6_hdr;
- struct ipv4_hdr *ipv4_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
struct rte_ether_hdr *eth_hdr;
if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) {
eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
return lpm_get_ipv4_dst_port(ipv4_hdr, portid,
qconf->ipv4_lookup_struct);
} else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) {
eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
- ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1);
+ ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1);
return lpm_get_ipv6_dst_port(ipv6_hdr, portid,
qconf->ipv6_lookup_struct);
@@ -139,7 +139,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
uint32_t dst_ipv4, uint16_t portid)
{
uint32_t next_hop;
- struct ipv6_hdr *ipv6_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
struct rte_ether_hdr *eth_hdr;
if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) {
@@ -150,7 +150,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
} else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) {
eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
- ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1);
+ ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1);
return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct,
ipv6_hdr->dst_addr, &next_hop) == 0)
diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h
index 950cde3..d730d72 100644
--- a/examples/l3fwd/l3fwd_lpm.h
+++ b/examples/l3fwd/l3fwd_lpm.h
@@ -10,14 +10,14 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid,
struct lcore_conf *qconf)
{
struct rte_ether_hdr *eth_hdr;
- struct ipv4_hdr *ipv4_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
uint16_t dst_port;
eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) {
/* Handle IPv4 headers.*/
- ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *,
+ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
#ifdef DO_RFC_1812_CHECKS
@@ -49,9 +49,9 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid,
send_single_packet(qconf, m, dst_port);
} else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) {
/* Handle IPv6 headers.*/
- struct ipv6_hdr *ipv6_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
- ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *,
+ ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *,
sizeof(struct rte_ether_hdr));
dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid,
diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h
index b36e991..7c68142 100644
--- a/examples/l3fwd/l3fwd_lpm_altivec.h
+++ b/examples/l3fwd/l3fwd_lpm_altivec.h
@@ -17,30 +17,30 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP],
vector unsigned int *dip,
uint32_t *ipv4_flag)
{
- struct ipv4_hdr *ipv4_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
struct rte_ether_hdr *eth_hdr;
uint32_t x0, x1, x2, x3;
eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x0 = ipv4_hdr->dst_addr;
ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4;
rte_compiler_barrier();
eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x1 = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[1]->packet_type;
rte_compiler_barrier();
eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x2 = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[2]->packet_type;
rte_compiler_barrier();
eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x3 = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[3]->packet_type;
diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h
index a3e42cf..d6c0ba6 100644
--- a/examples/l3fwd/l3fwd_lpm_neon.h
+++ b/examples/l3fwd/l3fwd_lpm_neon.h
@@ -18,27 +18,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP],
int32x4_t *dip,
uint32_t *ipv4_flag)
{
- struct ipv4_hdr *ipv4_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
struct rte_ether_hdr *eth_hdr;
int32_t dst[FWDSTEP];
eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
dst[0] = ipv4_hdr->dst_addr;
ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4;
eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
dst[1] = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[1]->packet_type;
eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
dst[2] = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[2]->packet_type;
eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
dst[3] = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[3]->packet_type;
diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h
index 4603e07..3f637a2 100644
--- a/examples/l3fwd/l3fwd_lpm_sse.h
+++ b/examples/l3fwd/l3fwd_lpm_sse.h
@@ -15,27 +15,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP],
__m128i *dip,
uint32_t *ipv4_flag)
{
- struct ipv4_hdr *ipv4_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
struct rte_ether_hdr *eth_hdr;
uint32_t x0, x1, x2, x3;
eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x0 = ipv4_hdr->dst_addr;
ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4;
eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x1 = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[1]->packet_type;
eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x2 = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[2]->packet_type;
eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+ ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
x3 = ipv4_hdr->dst_addr;
ipv4_flag[0] &= pkt[3]->packet_type;
diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h
index af2dc47..86ac597 100644
--- a/examples/l3fwd/l3fwd_neon.h
+++ b/examples/l3fwd/l3fwd_neon.h
@@ -48,14 +48,18 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
vst1q_u32(p[2], ve[2]);
vst1q_u32(p[3], ve[3]);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1),
- &dst_port[0], pkt[0]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1),
- &dst_port[1], pkt[1]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1),
- &dst_port[2], pkt[2]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1),
- &dst_port[3], pkt[3]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[0] + 1),
+ &dst_port[0], pkt[0]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[1] + 1),
+ &dst_port[1], pkt[1]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[2] + 1),
+ &dst_port[2], pkt[2]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[3] + 1),
+ &dst_port[3], pkt[3]->packet_type);
}
/*
@@ -113,7 +117,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port)
ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]);
- rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port,
+ rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port,
pkt->packet_type);
ve = vcopyq_laneq_u32(ve, 3, te, 3);
diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h
index 3349f27..bb565ed 100644
--- a/examples/l3fwd/l3fwd_sse.h
+++ b/examples/l3fwd/l3fwd_sse.h
@@ -48,14 +48,18 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
_mm_storeu_si128(p[2], te[2]);
_mm_storeu_si128(p[3], te[3]);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1),
- &dst_port[0], pkt[0]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1),
- &dst_port[1], pkt[1]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1),
- &dst_port[2], pkt[2]->packet_type);
- rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1),
- &dst_port[3], pkt[3]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[0] + 1),
+ &dst_port[0], pkt[0]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[1] + 1),
+ &dst_port[1], pkt[1]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[2] + 1),
+ &dst_port[2], pkt[2]->packet_type);
+ rfc1812_process((struct rte_ipv4_hdr *)
+ ((struct rte_ether_hdr *)p[3] + 1),
+ &dst_port[3], pkt[3]->packet_type);
}
/*
@@ -109,7 +113,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port)
te = _mm_loadu_si128((__m128i *)eth_hdr);
ve = val_eth[dst_port[0]];
- rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port,
+ rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port,
pkt->packet_type);
te = _mm_blend_epi16(te, ve, MASK_ETH);