git: bef7d49101cd - main - ixgbe: define IXGBE_LE32_TO_CPUS

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Mon, 14 Aug 2023 01:55:51 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=bef7d49101cdf28830a648f63ff00998fbe54715

commit bef7d49101cdf28830a648f63ff00998fbe54715
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2023-08-14 01:47:09 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2023-08-14 01:55:39 +0000

    ixgbe: define IXGBE_LE32_TO_CPUS
    
    Richard Lowe notes in PR 170267 IXGBE_LE32_TO_CPUS was previously
    directly defined as le32dec() which is a pure function but the shared
    code is expecting an in place conversion.
    
    In SVN r282289 its assignment was removed altogether.
    
    There was some deliberation in the PR on what to define this as, we
    just need to do the update in place which is easy enough.
    
    The uintptr_t casts in the shared code were from a DPDK sync and are
    unwanted with our new ixgbe_osdep.h implementation.
    
    PR:             170267
    Reported by:    Richard Lowe <richlowe@richlowe.net>
    MFC after:      1 week
---
 sys/dev/ixgbe/ixgbe_common.c | 4 ++--
 sys/dev/ixgbe/ixgbe_osdep.h  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c
index 9c13b1b2663d..923879acae4b 100644
--- a/sys/dev/ixgbe/ixgbe_common.c
+++ b/sys/dev/ixgbe/ixgbe_common.c
@@ -4641,7 +4641,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* first pull in the header so we know the buffer length */
 	for (bi = 0; bi < dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 	/*
@@ -4677,7 +4677,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* Pull in the rest of the buffer (bi is where we left off) */
 	for (; bi <= dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 rel_out:
diff --git a/sys/dev/ixgbe/ixgbe_osdep.h b/sys/dev/ixgbe/ixgbe_osdep.h
index 5e211e6283e3..48210e448c68 100644
--- a/sys/dev/ixgbe/ixgbe_osdep.h
+++ b/sys/dev/ixgbe/ixgbe_osdep.h
@@ -135,7 +135,7 @@ enum {
 #define IXGBE_CPU_TO_LE16 htole16
 #define IXGBE_CPU_TO_LE32 htole32
 #define IXGBE_LE32_TO_CPU le32toh
-#define IXGBE_LE32_TO_CPUS(x)
+#define IXGBE_LE32_TO_CPUS(x) *(x) = le32dec(x)
 #define IXGBE_CPU_TO_BE16 htobe16
 #define IXGBE_CPU_TO_BE32 htobe32
 #define IXGBE_BE32_TO_CPU be32toh