Skip to content

Commit 3be8502

Browse files
jhk16igaw
authored andcommitted
plugins/mangoboost: Add plugin to support MangoBoost
Mango StorageBoost-NTI[1] is supported on MangoBoost-DPU(MB-DPU) and seamlessly integrates with existing systems. With this technology, we accelerate NVMe-oF by offloading full-stack of TCP to DPU hardware. This patch adds initial vendor specific extension of MangoBoost, which is id-ctrl command of MangoBoost NVMe virtual device. [1] https://www.mangoboost.io/products/hardware/mango-storageboost-tm-nti Signed-off-by: Jonghyeon Kim <[email protected]>
1 parent 2b2cbf7 commit 3be8502

File tree

5 files changed

+154
-1
lines changed

5 files changed

+154
-1
lines changed

completions/_nvme

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ _nvme () {
123123
'solidigm:Solidigm plug-in extensions'
124124
'fdp:FDP plug-in extensions'
125125
'micron:Micron plug-in extensions'
126+
'mangoboost:MangoBoost plug-in extensions'
126127
'dapustor:DapuStor plug-in extensions'
127128
'help:print brief descriptions of all nvme commands'
128129
'json:dump output in json format'
@@ -659,6 +660,30 @@ _nvme () {
659660
;;
660661
esac
661662
;;
663+
(mangoboost)
664+
case ${words[2]} in
665+
(id-ctrl)
666+
local _id_ctrl
667+
_id_ctrl=(
668+
--verbose':Increase output verbosity'
669+
-v':alias for --verbose'
670+
--output-format':Output format: normal|json|binary'
671+
-o':alias for --output-format'
672+
--vendor-specific':dump binary vendor field'
673+
-V':alias for --vendor-specific'
674+
--raw-binary':show identify in binary format'
675+
-b':alias for --raw-binary'
676+
--human-readable':show identify in readable format'
677+
-H':alias for --human-readable'
678+
)
679+
_arguments '*:: :->subcmds'
680+
_describe -t commands "nvme mangoboost id-ctrl options" _id_ctrl
681+
;;
682+
(*)
683+
_files
684+
;;
685+
esac
686+
;;
662687
(*)
663688
_files
664689
;;
@@ -2895,6 +2920,16 @@ _nvme () {
28952920
_arguments '*:: :->subcmds'
28962921
_describe -t commands "nvme dapustor options" _dapustor
28972922
;;
2923+
(mangoboost)
2924+
local _mangoboost
2925+
_mangoboost=(
2926+
id-ctrl':Send NVMe Identify Controller'
2927+
version':Shows the program version'
2928+
help':Display this help'
2929+
)
2930+
_arguments '*:: :->subcmds'
2931+
_describe -t commands "nvme mangoboost options" _mangoboost
2932+
;;
28982933
(help)
28992934
local _h
29002935
_h=( id-ctrl id-ns list-ns id-iocs create-ns delete-ns attach-ns detach-ns
@@ -2913,7 +2948,7 @@ _nvme () {
29132948
subsystem-reset ns-rescan get-lba-status dsm discover connect-all connect
29142949
dim disconnect disconnect-all gen-hostnqn show-hostnqn tls-key dir-receive
29152950
dir-send virt-mgmt rpmb version ocp solidigm dapustor mgmt-addr-list-log
2916-
rotational-media-info-log changed-alloc-ns-list-log fdp
2951+
rotational-media-info-log changed-alloc-ns-list-log fdp mangoboost
29172952
)
29182953
_arguments '*:: :->subcmds'
29192954
_describe -t commands "help: infos on a specific nvme command, or provide no option to see a synopsis of all nvme commands" _h

completions/bash-nvme-completion.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,38 @@ plugin_inspur_opts () {
15311531
return 0
15321532
}
15331533

1534+
plugin_mangoboost_opts () {
1535+
local opts=""
1536+
local compargs=""
1537+
1538+
local nonopt_args=0
1539+
for (( i=0; i < ${#words[@]}-1; i++ )); do
1540+
if [[ ${words[i]} != -* ]]; then
1541+
let nonopt_args+=1
1542+
fi
1543+
done
1544+
1545+
if [ $nonopt_args -eq 3 ]; then
1546+
opts="/dev/nvme* "
1547+
fi
1548+
1549+
opts+=" "
1550+
1551+
case "$1" in
1552+
"id-ctrl")
1553+
opts+=" --raw-binary -b --human-readable -H \
1554+
--vendor-specific -v --output-format= -o"
1555+
;;
1556+
"help")
1557+
opts+=$NO_OPTS
1558+
;;
1559+
esac
1560+
1561+
COMPREPLY+=( $( compgen $compargs -W "$opts" -- $cur ) )
1562+
1563+
return 0
1564+
}
1565+
15341566
plugin_ocp_opts () {
15351567
local opts=""
15361568
local compargs=""
@@ -1698,6 +1730,7 @@ _nvme_subcmds () {
16981730
set-dssd-async-event-config get-dssd-async-event-config \
16991731
get-error-injection set-error-injection \
17001732
hardware-component-log"
1733+
[mangoboost]="id-ctrl"
17011734
)
17021735

17031736
# Associative array mapping plugins to corresponding option completions
@@ -1723,6 +1756,7 @@ _nvme_subcmds () {
17231756
[ymtc]="plugin_ymtc_opts"
17241757
[inspur]="plugin_inspur_opts"
17251758
[ocp]="plugin_ocp_opts"
1759+
[mangoboost]="plugin_mangoboost_opts"
17261760
)
17271761

17281762
# Top level commands
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Copyright (c) 2025 MangoBoost Inc.
4+
*
5+
* Author: Jonghyeon Kim <[email protected]>
6+
*/
7+
8+
#include <fcntl.h>
9+
#include <errno.h>
10+
#include <stdio.h>
11+
#include <stdlib.h>
12+
#include <unistd.h>
13+
#include <inttypes.h>
14+
15+
#include "common.h"
16+
#include "nvme.h"
17+
#include "libnvme.h"
18+
#include "plugin.h"
19+
20+
#define CREATE_CMD
21+
#include "mangoboost-nvme.h"
22+
23+
struct nvme_vu_id_ctrl_field {
24+
__u16 json_rpc_2_0_mjr;
25+
__u16 json_rpc_2_0_mnr;
26+
__u16 json_rpc_2_0_ter;
27+
__u8 reserved0[1018];
28+
};
29+
30+
static void json_mangoboost_id_ctrl(struct nvme_vu_id_ctrl_field *id,
31+
char *json_rpc_2_0_ver, struct json_object *root)
32+
{
33+
json_object_add_value_string(root, "json_rpc_2_0_ver",
34+
json_rpc_2_0_ver);
35+
}
36+
37+
static void mangoboost_id_ctrl(__u8 *vs, struct json_object *root)
38+
{
39+
struct nvme_vu_id_ctrl_field *id = (struct nvme_vu_id_ctrl_field *)vs;
40+
char json_rpc_2_0_ver[16] = { 0 };
41+
42+
snprintf(json_rpc_2_0_ver, sizeof(json_rpc_2_0_ver), "0x%04x%04x%04x",
43+
le16_to_cpu(id->json_rpc_2_0_mjr),
44+
le16_to_cpu(id->json_rpc_2_0_mnr),
45+
le16_to_cpu(id->json_rpc_2_0_ter));
46+
47+
if (root) {
48+
json_mangoboost_id_ctrl(id, json_rpc_2_0_ver, root);
49+
return;
50+
}
51+
52+
printf("json_rpc_2_0_ver : %s\n", json_rpc_2_0_ver);
53+
}
54+
55+
static int id_ctrl(int argc, char **argv, struct command *cmd,
56+
struct plugin *plugin)
57+
{
58+
return __id_ctrl(argc, argv, cmd, plugin, mangoboost_id_ctrl);
59+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Copyright (c) 2025 MangoBoost Inc.
4+
*
5+
* Author: Jonghyeon Kim <[email protected]>
6+
*/
7+
8+
#undef CMD_INC_FILE
9+
#define CMD_INC_FILE plugins/mangoboost/mangoboost-nvme
10+
11+
#if !defined(MANGOBOOST_NVME) || defined(CMD_HEADER_MULTI_READ)
12+
#define MANGOBOOST_NVME
13+
14+
#include "cmd.h"
15+
16+
PLUGIN(NAME("mangoboost", "MangoBoost vendor specific extensions", NVME_VERSION),
17+
COMMAND_LIST(
18+
ENTRY("id-ctrl", "Send NVMe Identify Controller", id_ctrl)
19+
)
20+
);
21+
22+
#endif
23+
24+
#include "define_cmd.h"

plugins/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ sources += [
1010
'plugins/innogrit/innogrit-nvme.c',
1111
'plugins/inspur/inspur-nvme.c',
1212
'plugins/intel/intel-nvme.c',
13+
'plugins/mangoboost/mangoboost-nvme.c',
1314
'plugins/memblaze/memblaze-nvme.c',
1415
'plugins/micron/micron-nvme.c',
1516
'plugins/nbft/nbft-plugin.c',

0 commit comments

Comments
 (0)