Commit 83da53f7 authored by Sukadev Bhattiprolu's avatar Sukadev Bhattiprolu Committed by David S. Miller

ibmvnic: define flush_reset_queue helper

Define and use a helper to flush the reset queue.

Fixes: 2770a798 ("ibmvnic: Introduce hard reset recovery")
Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 765559b1
...@@ -2735,12 +2735,23 @@ static void __ibmvnic_delayed_reset(struct work_struct *work) ...@@ -2735,12 +2735,23 @@ static void __ibmvnic_delayed_reset(struct work_struct *work)
__ibmvnic_reset(&adapter->ibmvnic_reset); __ibmvnic_reset(&adapter->ibmvnic_reset);
} }
static void flush_reset_queue(struct ibmvnic_adapter *adapter)
{
struct list_head *entry, *tmp_entry;
if (!list_empty(&adapter->rwi_list)) {
list_for_each_safe(entry, tmp_entry, &adapter->rwi_list) {
list_del(entry);
kfree(list_entry(entry, struct ibmvnic_rwi, list));
}
}
}
static int ibmvnic_reset(struct ibmvnic_adapter *adapter, static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
enum ibmvnic_reset_reason reason) enum ibmvnic_reset_reason reason)
{ {
struct list_head *entry, *tmp_entry;
struct ibmvnic_rwi *rwi, *tmp;
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct ibmvnic_rwi *rwi, *tmp;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -2783,12 +2794,9 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, ...@@ -2783,12 +2794,9 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
/* if we just received a transport event, /* if we just received a transport event,
* flush reset queue and process this reset * flush reset queue and process this reset
*/ */
if (adapter->force_reset_recovery && !list_empty(&adapter->rwi_list)) { if (adapter->force_reset_recovery)
list_for_each_safe(entry, tmp_entry, &adapter->rwi_list) { flush_reset_queue(adapter);
list_del(entry);
kfree(list_entry(entry, struct ibmvnic_rwi, list));
}
}
rwi->reset_reason = reason; rwi->reset_reason = reason;
list_add_tail(&rwi->list, &adapter->rwi_list); list_add_tail(&rwi->list, &adapter->rwi_list);
netdev_dbg(adapter->netdev, "Scheduling reset (reason %s)\n", netdev_dbg(adapter->netdev, "Scheduling reset (reason %s)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment