summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alnubani <alialnu@mellanox.com>2019-10-17 10:19:31 +0300
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-20 15:43:28 +0100
commit1cad7ac68bd922bfc94262cc617394ce49f8bcb5 (patch)
tree15e72bb330ab59fa4e104c2f7bba32813c0884e2
parenteabfc776b329797b1a5516c3ffb101a181255a52 (diff)
downloaddpdk-next-net-intel-1cad7ac68bd922bfc94262cc617394ce49f8bcb5.zip
dpdk-next-net-intel-1cad7ac68bd922bfc94262cc617394ce49f8bcb5.tar.gz
dpdk-next-net-intel-1cad7ac68bd922bfc94262cc617394ce49f8bcb5.tar.xz
net/mlx5: fix build with strict alignment enabled
This patch converts some of the casts to unaligned integer types. The memcpy call is replaced with explicit copying because it may require type qualifiers in some environments. Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template") Cc: stable@dpdk.org Reported-by: Jeremy Plsek <jplsek@iol.unh.edu> Signed-off-by: Ali Alnubani <alialnu@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
-rw-r--r--drivers/net/mlx5/mlx5_rxtx.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 20c1946..5ec2b48 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -2747,27 +2747,33 @@ mlx5_tx_dseg_iptr(struct mlx5_txq_data *restrict txq,
/* Unrolled implementation of generic rte_memcpy. */
dst = (uintptr_t)&dseg->inline_data[0];
src = (uintptr_t)buf;
+ if (len & 0x08) {
#ifdef RTE_ARCH_STRICT_ALIGN
- memcpy(dst, src, len);
+ assert(dst == RTE_PTR_ALIGN(dst, sizeof(uint32_t)));
+ *(uint32_t *)dst = *(unaligned_uint32_t *)src;
+ dst += sizeof(uint32_t);
+ src += sizeof(uint32_t);
+ *(uint32_t *)dst = *(unaligned_uint32_t *)src;
+ dst += sizeof(uint32_t);
+ src += sizeof(uint32_t);
#else
- if (len & 0x08) {
- *(uint64_t *)dst = *(uint64_t *)src;
+ *(uint64_t *)dst = *(unaligned_uint64_t *)src;
dst += sizeof(uint64_t);
src += sizeof(uint64_t);
+#endif
}
if (len & 0x04) {
- *(uint32_t *)dst = *(uint32_t *)src;
+ *(uint32_t *)dst = *(unaligned_uint32_t *)src;
dst += sizeof(uint32_t);
src += sizeof(uint32_t);
}
if (len & 0x02) {
- *(uint16_t *)dst = *(uint16_t *)src;
+ *(uint16_t *)dst = *(unaligned_uint16_t *)src;
dst += sizeof(uint16_t);
src += sizeof(uint16_t);
}
if (len & 0x01)
*(uint8_t *)dst = *(uint8_t *)src;
-#endif
}
/**