summaryrefslogtreecommitdiff
path: root/lib/librte_port
diff options
context:
space:
mode:
authorPiotr Azarewicz <piotrx.t.azarewicz@intel.com>2015-09-10 09:09:17 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-10-08 13:15:17 +0200
commit4f8e575f8912c41506826946a8ac396be757060e (patch)
treede8af124dda3f0d28e7f4c256b3ae9313d6b4e12 /lib/librte_port
parent97661df7d2d29f63280d436d7202a3fa8131895b (diff)
downloaddpdk-next-eventdev-4f8e575f8912c41506826946a8ac396be757060e.zip
dpdk-next-eventdev-4f8e575f8912c41506826946a8ac396be757060e.tar.gz
dpdk-next-eventdev-4f8e575f8912c41506826946a8ac396be757060e.tar.xz
ip_frag: fix bit-fields in ipv6 fragment extension
Previous implementation won't work on every environment. The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined. Solution: used bytes instead of bit fields. Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Diffstat (limited to 'lib/librte_port')
-rw-r--r--lib/librte_port/rte_port_ras.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c
index 6bd0f8c..8a2e554 100644
--- a/lib/librte_port/rte_port_ras.c
+++ b/lib/librte_port/rte_port_ras.c
@@ -212,12 +212,13 @@ process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt)
struct ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv6_hdr *);
struct ipv6_extension_fragment *frag_hdr;
+ uint16_t frag_data = 0;
frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(pkt_hdr);
- uint16_t frag_offset = frag_hdr->frag_offset;
- uint16_t frag_flag = frag_hdr->more_frags;
+ if (frag_hdr != NULL)
+ frag_data = rte_be_to_cpu_16(frag_hdr->frag_data);
/* If it is a fragmented packet, then try to reassemble */
- if ((frag_flag == 0) && (frag_offset == 0))
+ if ((frag_data & RTE_IPV6_FRAG_USED_MASK) == 0)
p->tx_buf[p->tx_buf_count++] = pkt;
else {
struct rte_mbuf *mo;