ibmvnic: print reset reason as a string
The reset reason can be added or deleted over different versions of the source code. Print a string instead of a number. Signed-off-by: Lijun Pan <lijunp213@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c82eaa4064
commit
caee7bf5b0
|
@ -1911,6 +1911,26 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static const char *reset_reason_to_string(enum ibmvnic_reset_reason reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case VNIC_RESET_FAILOVER:
|
||||
return "FAILOVER";
|
||||
case VNIC_RESET_MOBILITY:
|
||||
return "MOBILITY";
|
||||
case VNIC_RESET_FATAL:
|
||||
return "FATAL";
|
||||
case VNIC_RESET_NON_FATAL:
|
||||
return "NON_FATAL";
|
||||
case VNIC_RESET_TIMEOUT:
|
||||
return "TIMEOUT";
|
||||
case VNIC_RESET_CHANGE_PARAM:
|
||||
return "CHANGE_PARAM";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* do_reset returns zero if we are able to keep processing reset events, or
|
||||
* non-zero if we hit a fatal error and must halt.
|
||||
|
@ -1924,9 +1944,9 @@ static int do_reset(struct ibmvnic_adapter *adapter,
|
|||
int i, rc;
|
||||
|
||||
netdev_dbg(adapter->netdev,
|
||||
"[S:%d FOP:%d] Reset reason %d, reset_state %d\n",
|
||||
"[S:%d FOP:%d] Reset reason: %s, reset_state %d\n",
|
||||
adapter->state, adapter->failover_pending,
|
||||
rwi->reset_reason, reset_state);
|
||||
reset_reason_to_string(rwi->reset_reason), reset_state);
|
||||
|
||||
adapter->reset_reason = rwi->reset_reason;
|
||||
/* requestor of VNIC_RESET_CHANGE_PARAM already has the rtnl lock */
|
||||
|
@ -2139,8 +2159,8 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
|
|||
struct net_device *netdev = adapter->netdev;
|
||||
int rc;
|
||||
|
||||
netdev_dbg(adapter->netdev, "Hard resetting driver (%d)\n",
|
||||
rwi->reset_reason);
|
||||
netdev_dbg(adapter->netdev, "Hard resetting driver (%s)\n",
|
||||
reset_reason_to_string(rwi->reset_reason));
|
||||
|
||||
/* read the state and check (again) after getting rtnl */
|
||||
reset_state = adapter->state;
|
||||
|
@ -2363,8 +2383,8 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
|
|||
list_for_each(entry, &adapter->rwi_list) {
|
||||
tmp = list_entry(entry, struct ibmvnic_rwi, list);
|
||||
if (tmp->reset_reason == reason) {
|
||||
netdev_dbg(netdev, "Skipping matching reset, reason=%d\n",
|
||||
reason);
|
||||
netdev_dbg(netdev, "Skipping matching reset, reason=%s\n",
|
||||
reset_reason_to_string(reason));
|
||||
ret = EBUSY;
|
||||
goto err;
|
||||
}
|
||||
|
@ -2384,7 +2404,8 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
|
|||
}
|
||||
rwi->reset_reason = reason;
|
||||
list_add_tail(&rwi->list, &adapter->rwi_list);
|
||||
netdev_dbg(adapter->netdev, "Scheduling reset (reason %d)\n", reason);
|
||||
netdev_dbg(adapter->netdev, "Scheduling reset (reason %s)\n",
|
||||
reset_reason_to_string(reason));
|
||||
schedule_work(&adapter->ibmvnic_reset);
|
||||
|
||||
ret = 0;
|
||||
|
|
Loading…
Reference in New Issue