mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
lan: Add processing of get/set specific CCs
Both 'Set/Get LAN Configuration Parameter' commands may return command-specific codes that weren't properly parsed and were reported as 'Unknown' before. This is fixed now. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
parent
fb47ae8d7c
commit
351dad24a2
@ -100,6 +100,19 @@ static struct lan_param {
|
|||||||
{ -1, -1, "", NULL, -1 }
|
{ -1, -1, "", NULL, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct valstr set_lan_cc_vals[] = {
|
||||||
|
{ 0x80, "Unsupported parameter" },
|
||||||
|
{ 0x81, "Attempt to set 'in progress' while not in 'complete' state" },
|
||||||
|
{ 0x82, "Parameter is read-only" },
|
||||||
|
{ 0x83, "Parameter is wrote-only" },
|
||||||
|
{ 0x00, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct valstr get_lan_cc_vals[] = {
|
||||||
|
{ 0x80, "Unsupported parameter" },
|
||||||
|
{ 0x00, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
static void print_lan_alert_print_usage(void);
|
static void print_lan_alert_print_usage(void);
|
||||||
static void print_lan_alert_set_usage(void);
|
static void print_lan_alert_set_usage(void);
|
||||||
static void print_lan_set_usage(void);
|
static void print_lan_set_usage(void);
|
||||||
@ -177,6 +190,7 @@ static struct lan_param *
|
|||||||
get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select)
|
get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select)
|
||||||
{
|
{
|
||||||
struct lan_param *p = NULL;
|
struct lan_param *p = NULL;
|
||||||
|
struct lan_param *rc = NULL;
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -191,7 +205,7 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
|
|||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter.");
|
lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter.");
|
||||||
return NULL;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_data[0] = chan;
|
msg_data[0] = chan;
|
||||||
@ -208,7 +222,7 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
|
|||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (!rsp) {
|
if (!rsp) {
|
||||||
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed", p->desc);
|
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed", p->desc);
|
||||||
return NULL;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (rsp->ccode)
|
switch (rsp->ccode)
|
||||||
@ -219,19 +233,18 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, int param, int select
|
|||||||
case 0x80: /* parameter not supported */
|
case 0x80: /* parameter not supported */
|
||||||
case 0xc9: /* parameter out of range */
|
case 0xc9: /* parameter out of range */
|
||||||
case 0xcc: /* invalid data field in request */
|
case 0xcc: /* invalid data field in request */
|
||||||
|
/* We treat them as valid but empty response */
|
||||||
/* these completion codes usually mean parameter not supported */
|
|
||||||
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed: %s",
|
|
||||||
p->desc, val2str(rsp->ccode, completion_code_vals));
|
|
||||||
p->data = NULL;
|
p->data = NULL;
|
||||||
p->data_len = 0;
|
p->data_len = 0;
|
||||||
return p;
|
rc = p;
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* other completion codes are treated as error */
|
/* other completion codes are treated as error */
|
||||||
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed: %s",
|
lprintf(LOG_INFO, "Get LAN Parameter '%s' command failed: %s",
|
||||||
p->desc, val2str(rsp->ccode, completion_code_vals));
|
p->desc,
|
||||||
|
specific_val2str(rsp->ccode,
|
||||||
|
get_lan_cc_vals,
|
||||||
|
completion_code_vals));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +374,9 @@ __set_lan_param(struct ipmi_intf *intf, uint8_t chan,
|
|||||||
}
|
}
|
||||||
if (rsp->ccode && wait) {
|
if (rsp->ccode && wait) {
|
||||||
lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s",
|
lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
specific_val2str(rsp->ccode,
|
||||||
|
set_lan_cc_vals,
|
||||||
|
completion_code_vals));
|
||||||
if (rsp->ccode == 0xcc) {
|
if (rsp->ccode == 0xcc) {
|
||||||
/* retry hack for invalid data field ccode */
|
/* retry hack for invalid data field ccode */
|
||||||
int retry = 10; /* 10 retries */
|
int retry = 10; /* 10 retries */
|
||||||
@ -2137,7 +2152,9 @@ ipmi_lan_stats_get(struct ipmi_intf *intf, uint8_t chan)
|
|||||||
|
|
||||||
if (rsp->ccode) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get LAN Stats command failed: %s",
|
lprintf(LOG_ERR, "Get LAN Stats command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
specific_val2str(rsp->ccode,
|
||||||
|
get_lan_cc_vals,
|
||||||
|
completion_code_vals));
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2213,7 +2230,9 @@ ipmi_lan_stats_clear(struct ipmi_intf *intf, uint8_t chan)
|
|||||||
|
|
||||||
if (rsp->ccode) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
|
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
specific_val2str(rsp->ccode,
|
||||||
|
get_lan_cc_vals,
|
||||||
|
completion_code_vals));
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user