summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/ibm
diff options
context:
space:
mode:
authorLijun Pan <lijunp213@gmail.com>2021-04-13 11:31:44 +0300
committerDavid S. Miller <davem@davemloft.net>2021-04-14 00:48:44 +0300
commit334c4241472916851d97aae209aedf1927ec84e3 (patch)
treef036b5d61b6a426cbefb18f7c56d3c995d476fbc /drivers/net/ethernet/ibm
parent314332023b1f095fb24e230e60b50aff981943c3 (diff)
downloadlinux-334c4241472916851d97aae209aedf1927ec84e3.tar.xz
ibmvnic: improve failover sysfs entry
The current implementation relies on H_IOCTL call to issue a H_SESSION_ERR_DETECTED command to let the hypervisor to send a failover signal. However, it may not work if there is no backup device or if the vnic is already in error state, e.g., "ibmvnic 30000003 env3: rx buffer returned with rc 6". Add a last resort, that is to schedule a failover reset via CRQ command. Signed-off-by: Lijun Pan <lijunp213@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ibm')
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index ee9bf18c597f..0961d36833d5 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5503,7 +5503,7 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr,
if (rc) {
netdev_err(netdev, "Couldn't retrieve session token, rc %ld\n",
rc);
- return -EINVAL;
+ goto last_resort;
}
session_token = (__be64)retbuf[0];
@@ -5511,15 +5511,17 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr,
be64_to_cpu(session_token));
rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
H_SESSION_ERR_DETECTED, session_token, 0, 0);
- if (rc) {
- netdev_err(netdev, "Client initiated failover failed, rc %ld\n",
+ if (rc)
+ netdev_err(netdev,
+ "H_VIOCTL initiated failover failed, rc %ld\n",
rc);
- return -EINVAL;
- }
+
+last_resort:
+ netdev_dbg(netdev, "Trying to send CRQ_CMD, the last resort\n");
+ ibmvnic_reset(adapter, VNIC_RESET_FAILOVER);
return count;
}
-
static DEVICE_ATTR_WO(failover);
static unsigned long ibmvnic_get_desired_dma(struct vio_dev *vdev)