Skip to content

Commit

Permalink
ibmvnic: improve failover sysfs entry
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lijun Pan authored and davem330 committed Apr 13, 2021
1 parent 3143320 commit 334c424
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/net/ethernet/ibm/ibmvnic.c
Expand Up @@ -5503,23 +5503,25 @@ 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];
netdev_dbg(netdev, "Initiating client failover, session id %llx\n",
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)
Expand Down

0 comments on commit 334c424

Please sign in to comment.