Skip to content

Commit

Permalink
engines:nvme: pull required 48 bit accessors from linux kernel
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vincent Fu <[email protected]>
  • Loading branch information
ankit-sam authored and vincentkfu committed Aug 14, 2023
1 parent 377f62d commit ca59c41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions engines/nvme.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* nvme structure declarations and helper functions for the
* io_uring_cmd engine.
Expand Down
17 changes: 17 additions & 0 deletions engines/nvme.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* nvme structure declarations and helper functions for the
* io_uring_cmd engine.
Expand Down Expand Up @@ -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

0 comments on commit ca59c41

Please sign in to comment.