DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Suanming Mou <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>
Subject: [PATCH v2 4/5] net/mlx5: drop unnecessary STRICT_ALIGN
Date: Sun,  6 Sep 2026 10:09:57 -0700	[thread overview]
Message-ID: <20260906171142.3503868-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20260906171142.3503868-1-stephen@networkplumber.org>

The transmit inline copy splits the 8 byte case into two 32 bit
moves when RTE_ARCH_STRICT_ALIGN is set. Only armv8 aarch32 ever
set that flag, and ARMv8 does unaligned access in hardware, so the
split gains nothing. Use a single 64 bit move.

The destination is inline_data, at offset 4 of a 16 byte aligned
dseg, so the 8 byte store is always misaligned. Write it through
the unaligned type; a plain uint64_t store there is undefined
behaviour and is reported by UBSAN.

The debug assertion on the inline data offset goes away with the
strict alignment path since the wider move has no such requirement.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/mlx5/mlx5_tx.h | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h
index 682dc07718..69a18f8a49 100644
--- a/drivers/net/mlx5/mlx5_tx.h
+++ b/drivers/net/mlx5/mlx5_tx.h
@@ -1437,19 +1437,9 @@ mlx5_tx_dseg_iptr(struct mlx5_txq_data *__rte_restrict txq,
 	dst = (uintptr_t)&dseg->inline_data[0];
 	src = (uintptr_t)buf;
 	if (len & 0x08) {
-#ifdef RTE_ARCH_STRICT_ALIGN
-		MLX5_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
-		*(uint64_t *)dst = *(unaligned_uint64_t *)src;
+		*(unaligned_uint64_t *)dst = *(unaligned_uint64_t *)src;
 		dst += sizeof(uint64_t);
 		src += sizeof(uint64_t);
-#endif
 	}
 	if (len & 0x04) {
 		*(uint32_t *)dst = *(unaligned_uint32_t *)src;
-- 
2.53.0


  parent reply	other threads:[~2026-09-06 17:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 22:09 [RFC 0/3] eal: make unaligned types really unaligned Stephen Hemminger
2026-09-04 22:09 ` [RFC 1/3] eal: make unaligned " Stephen Hemminger
2026-09-04 22:09 ` [RFC 2/3] net/mlx5: drop unnecessary STRICT_ALIGN Stephen Hemminger
2026-09-05 10:00   ` Morten Brørup
2026-09-04 22:09 ` [RFC 3/3] arm: remove no longer used RTE_ARCH_STRICT_ALIGN Stephen Hemminger
2026-09-06 17:09 ` [PATCH v2 0/5] eal: RTE_PTR_ADD qualifiers and real unaligned types Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 1/5] test: fix jhash 32 bit key type Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 2/5] eal: RTE_PTR_ADD/SUB API improvements Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 3/5] eal: make unaligned really unaligned Stephen Hemminger
2026-09-06 17:09   ` Stephen Hemminger [this message]
2026-09-06 17:09   ` [PATCH v2 5/5] arm: remove no longer used RTE_ARCH_STRICT_ALIGN Stephen Hemminger
2026-09-06 20:14   ` [PATCH v2 0/5] eal: RTE_PTR_ADD qualifiers and real unaligned types Morten Brørup
2026-09-07 18:31 ` [PATCH v3 0/5] eal: RTE_PTR_ADD and fix " Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 1/5] test: fix jhash 32 bit key type Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 2/5] eal: RTE_PTR_ADD/SUB API improvements Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 3/5] eal: make unaligned really unaligned Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 4/5] net/mlx5: drop unnecessary STRICT_ALIGN Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 5/5] arm: remove no longer used RTE_ARCH_STRICT_ALIGN Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260906171142.3503868-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox