#
0963c4b7 |
| 06-Mar-2025 |
Jeremy Kerr <jk@codeconstruct.com.au> |
ncsi-netlink: ncsi-cmd fallback: move -c argument before operation
If a channel argument was used for ncsi-netlink, and we're falling-back to the ncsi-cmd wrapper, we will place the "-c" argument af
ncsi-netlink: ncsi-cmd fallback: move -c argument before operation
If a channel argument was used for ncsi-netlink, and we're falling-back to the ncsi-cmd wrapper, we will place the "-c" argument after the "raw" command:
``` root@p10bmc:~# strace -e trace=execve ncsi-netlink -x 2 -p 0 -c 0 -o 5000000157200001 execve("/usr/bin/ncsi-netlink", ["ncsi-netlink", "-x", "2", "-p", "0", "-c", "0", "-o", "5000000157200001"], 0x7e98acc8 /* 20 vars */) = 0 <7> ncsi-netlink [..] -o is deprecated by ncsi-cmd execve("/usr/local/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "raw", "-c", "0", "50", "00000157200001"], 0x7e945ccc /* 20 vars */) = -1 ENOENT (No such file or directory) execve("/usr/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "raw", "-c", "0", "50", "00000157200001"], 0x7e945ccc /* 20 vars */) = 0 Invalid command type value +++ exited with 1 +++ ```
Instead, move the "raw" argument out of the initial list, and add it once we have processed the channel.
Tested: we can now call the ncsi-netlink wrapper with -c:
``` root@p10bmc:~# strace -e trace=execve ncsi-netlink -x 2 -p 0 -c 0 -o 5000000157200001 execve("/usr/bin/ncsi-netlink", ["ncsi-netlink", "-x", "2", "-p", "0", "-c", "0", "-o", "5000000157200001"], 0x7e80fcd8 /* 19 vars */) = 0 <7> ncsi-netlink [..] -o is deprecated by ncsi-cmd execve("/usr/local/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "-c", "0", "raw", "50", "00000157200001"], 0x7ef61cec /* 19 vars */) = -1 ENOENT (No such file or directory) execve("/usr/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "-c", "0", "raw", "50", "00000157200001"], 0x7ef61cec /* 19 vars */) = 0 ```
Which results in the OEM NCSI command being transmitted:
``` 07:04:12 [TRACE] rx: NcsiPacket { mc: 0, iid: 29, type: Unknown (50), chan: p0c00, flags: 00, payload: 7: [00, 00, 01, 57, 20, 00, 01] } ```
Reported-by: George Keishing <gkeishin@gmail.com> Fixes: bad17c0 ("ncsi-cmd: Add a new executable for issuing NCSI commands") Change-Id: I196ec1b52d34e6b260e9696e4bd1e7c7482a6402 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
show more ...
|
#
bad17c0b |
| 21-Nov-2024 |
Jeremy Kerr <jk@codeconstruct.com.au> |
ncsi-cmd: Add a new executable for issuing NCSI commands
At the moment, the ncsi-netlink utility does two things:
- allows management of the kernel NCSI state, such as the channel and package m
ncsi-cmd: Add a new executable for issuing NCSI commands
At the moment, the ncsi-netlink utility does two things:
- allows management of the kernel NCSI state, such as the channel and package masks
- allows issuing NCSI messages to the NCSI-capable NIC, through the NCSI_CMD_SEND_CMD interface
While these two things do share the same kernel API, they have somewhat different objectives: one is controlling local state, the other is controlling remote (ie, the NIC) state.
In future, we want to allow non-netlink-based NCSI transports for issuing commands to the NIC, which makes the ncsi-netlink name somewhat inaccurate for those.
So, introduce a new tool, 'ncsi-cmd', for issuing NCSI commands over the netlink interface.
This has similar command-line semantics to the existing 'ncsi-netlink [...] -o <PAYLOAD>' usage, but has a few changes for a more ergonomic UI:
Firstly, the type (or "opcode") byte is no longer packed into the payload data, because it's not really payload.
Secondly, we use --interface/-i rather than --index/-x, with a note that interfaces are specified by index. This allows for future changes that allow specifying interfaces by name.
Finally, to make it clear that we can issue more than just OEM commands, we have separate subcommands: "oem" and "raw". These are similar, just that "oem" implies the standard OEM type value of 0x50. So, the following are equivalent:
ncsi-cmd -i2 -p0 oem 010203
ncsi-cmd -i2 -p0 raw 0x50 010203
But now we have a cleaner interface for not-OEM commands:
ncsi-cmd -i12 -p0 raw 0x15
For issuing command type 0x15, "Get Version ID".
We remove the send logic from ncsi-netlink, but leave a compatibility shim that will exec() ncsi-cmd with the appropriate arguments instead.
Change-Id: Ied240db0d545d5770df0927da354c65b82ee9508 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
show more ...
|