From ca59c41c6526dc718a897a27c7b9255a55aec3b2 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Mon, 14 Aug 2023 20:27:46 +0530 Subject: [PATCH] engines:nvme: pull required 48 bit accessors from linux kernel Pull the 48 bit helpers, required for supporting 48 bit reference tags. Add GPL 2.0 license to nvme.c and nvme.h files. Signed-off-by: Ankit Kumar Link: https://lore.kernel.org/r/20230814145747.114725-10-ankit.kumar@samsung.com Signed-off-by: Vincent Fu --- engines/nvme.c | 1 + engines/nvme.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/engines/nvme.c b/engines/nvme.c index 6896dfc0..41e7d07b 100644 --- a/engines/nvme.c +++ b/engines/nvme.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * nvme structure declarations and helper functions for the * io_uring_cmd engine. diff --git a/engines/nvme.h b/engines/nvme.h index a1102dfe..fb1f7760 100644 --- a/engines/nvme.h +++ b/engines/nvme.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * nvme structure declarations and helper functions for the * io_uring_cmd engine. @@ -440,4 +441,20 @@ int fio_nvme_reset_wp(struct thread_data *td, struct fio_file *f, int fio_nvme_get_max_open_zones(struct thread_data *td, struct fio_file *f, unsigned int *max_open_zones); +static inline void put_unaligned_be48(__u64 val, __u8 *p) +{ + *p++ = val >> 40; + *p++ = val >> 32; + *p++ = val >> 24; + *p++ = val >> 16; + *p++ = val >> 8; + *p++ = val; +} + +static inline __u64 get_unaligned_be48(__u8 *p) +{ + return (__u64)p[0] << 40 | (__u64)p[1] << 32 | (__u64)p[2] << 24 | + p[3] << 16 | p[4] << 8 | p[5]; +} + #endif -- 2.25.1