7 Commits

Author SHA1 Message Date
Alexander Amelkin
0c8ceb78a4
nm: Refactor to reduce complexity of nm_suspend()
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-30 13:42:42 +03:00
Alexander Amelkin
161bb88c6e
nm: Refactor to get rid of magic numbers in cmd
Replace all magic numbers for nm commands with enum values.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-30 13:33:19 +03:00
Alexander Amelkin
67928205e7
nm: Refactor error checking
Make chk_nm_rsp() search for the codes really defined in the
NM dictionary and not just check some arbitrary completion codes
range. For all codes not defined in NM dictionary, print strings
from the generic IPMI completion codes dictionary.

Rename chk_nm_rsp() to is_nm_err() to better reflect the purpose
of the function. Make it 'bool'. Use centralized exiting for the
function.

Also fix wording for invalid NM ID.

End-user-impact: On invalid responses from the NM, instead of
                 "A valid NM command was not returned!" accompanied
                 by a single byte of data, the following message
                 with full 3 bytes of data will now be printed:
                 "No valid NM ID in response!"
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-30 13:33:19 +03:00
Alexander Amelkin
7469522fbb
nm: Refactor to get rid of magic completion codes
Replace all magic numbers implied to mean NM completions codes
with descriptive macro names.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-30 13:33:19 +03:00
Alexander Amelkin
be9f1660fb
nm: Refactor to reduce code duplication
Add nm_set_id() and nm_check_id() functions, use them and
the existing htoipmi24() to reduce code duplication.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-30 13:31:15 +03:00
Alexander Amelkin
e0811437a2
nm: Fix coding style
Fix whitespaces, line lengths, etc.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-29 16:24:39 +03:00
Alexander Amelkin
75eada4859
nm: Separate code from dcmi
Move Node Manager related code to separate ipmi_nm.* files.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-29 16:24:39 +03:00