mirror of https://gitee.com/openkylin/linux.git
fm10k: future-proof state bitmaps using DECLARE_BITMAP
This ensures that future programmers do not have to remember to re-size the bitmaps due to adding new values. Although this is unlikely for this driver, it may happen and it's best to prevent it from ever being an issue. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Krishneil Singh <krishneil.k.singh@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
3ee7b3a3b9
commit
4692955787
|
@ -65,14 +65,16 @@ enum fm10k_ring_state_t {
|
||||||
__FM10K_TX_DETECT_HANG,
|
__FM10K_TX_DETECT_HANG,
|
||||||
__FM10K_HANG_CHECK_ARMED,
|
__FM10K_HANG_CHECK_ARMED,
|
||||||
__FM10K_TX_XPS_INIT_DONE,
|
__FM10K_TX_XPS_INIT_DONE,
|
||||||
|
/* This must be last and is used to calculate BITMAP size */
|
||||||
|
__FM10K_TX_STATE_SIZE__,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define check_for_tx_hang(ring) \
|
#define check_for_tx_hang(ring) \
|
||||||
test_bit(__FM10K_TX_DETECT_HANG, &(ring)->state)
|
test_bit(__FM10K_TX_DETECT_HANG, (ring)->state)
|
||||||
#define set_check_for_tx_hang(ring) \
|
#define set_check_for_tx_hang(ring) \
|
||||||
set_bit(__FM10K_TX_DETECT_HANG, &(ring)->state)
|
set_bit(__FM10K_TX_DETECT_HANG, (ring)->state)
|
||||||
#define clear_check_for_tx_hang(ring) \
|
#define clear_check_for_tx_hang(ring) \
|
||||||
clear_bit(__FM10K_TX_DETECT_HANG, &(ring)->state)
|
clear_bit(__FM10K_TX_DETECT_HANG, (ring)->state)
|
||||||
|
|
||||||
struct fm10k_tx_buffer {
|
struct fm10k_tx_buffer {
|
||||||
struct fm10k_tx_desc *next_to_watch;
|
struct fm10k_tx_desc *next_to_watch;
|
||||||
|
@ -126,7 +128,7 @@ struct fm10k_ring {
|
||||||
struct fm10k_rx_buffer *rx_buffer;
|
struct fm10k_rx_buffer *rx_buffer;
|
||||||
};
|
};
|
||||||
u32 __iomem *tail;
|
u32 __iomem *tail;
|
||||||
unsigned long state;
|
DECLARE_BITMAP(state, __FM10K_TX_STATE_SIZE__);
|
||||||
dma_addr_t dma; /* phys. address of descriptor ring */
|
dma_addr_t dma; /* phys. address of descriptor ring */
|
||||||
unsigned int size; /* length in bytes */
|
unsigned int size; /* length in bytes */
|
||||||
|
|
||||||
|
@ -266,12 +268,24 @@ enum fm10k_flags_t {
|
||||||
__FM10K_FLAGS_SIZE__
|
__FM10K_FLAGS_SIZE__
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum fm10k_state_t {
|
||||||
|
__FM10K_RESETTING,
|
||||||
|
__FM10K_DOWN,
|
||||||
|
__FM10K_SERVICE_SCHED,
|
||||||
|
__FM10K_SERVICE_DISABLE,
|
||||||
|
__FM10K_MBX_LOCK,
|
||||||
|
__FM10K_LINK_DOWN,
|
||||||
|
__FM10K_UPDATING_STATS,
|
||||||
|
/* This value must be last and determines the BITMAP size */
|
||||||
|
__FM10K_STATE_SIZE__,
|
||||||
|
};
|
||||||
|
|
||||||
struct fm10k_intfc {
|
struct fm10k_intfc {
|
||||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||||
struct net_device *netdev;
|
struct net_device *netdev;
|
||||||
struct fm10k_l2_accel *l2_accel; /* pointer to L2 acceleration list */
|
struct fm10k_l2_accel *l2_accel; /* pointer to L2 acceleration list */
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
unsigned long state;
|
DECLARE_BITMAP(state, __FM10K_STATE_SIZE__);
|
||||||
|
|
||||||
/* Access flag values using atomic *_bit() operations */
|
/* Access flag values using atomic *_bit() operations */
|
||||||
DECLARE_BITMAP(flags, __FM10K_FLAGS_SIZE__);
|
DECLARE_BITMAP(flags, __FM10K_FLAGS_SIZE__);
|
||||||
|
@ -367,22 +381,12 @@ struct fm10k_intfc {
|
||||||
u16 vid;
|
u16 vid;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum fm10k_state_t {
|
|
||||||
__FM10K_RESETTING,
|
|
||||||
__FM10K_DOWN,
|
|
||||||
__FM10K_SERVICE_SCHED,
|
|
||||||
__FM10K_SERVICE_DISABLE,
|
|
||||||
__FM10K_MBX_LOCK,
|
|
||||||
__FM10K_LINK_DOWN,
|
|
||||||
__FM10K_UPDATING_STATS,
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline void fm10k_mbx_lock(struct fm10k_intfc *interface)
|
static inline void fm10k_mbx_lock(struct fm10k_intfc *interface)
|
||||||
{
|
{
|
||||||
/* busy loop if we cannot obtain the lock as some calls
|
/* busy loop if we cannot obtain the lock as some calls
|
||||||
* such as ndo_set_rx_mode may be made in atomic context
|
* such as ndo_set_rx_mode may be made in atomic context
|
||||||
*/
|
*/
|
||||||
while (test_and_set_bit(__FM10K_MBX_LOCK, &interface->state))
|
while (test_and_set_bit(__FM10K_MBX_LOCK, interface->state))
|
||||||
udelay(20);
|
udelay(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,12 +394,12 @@ static inline void fm10k_mbx_unlock(struct fm10k_intfc *interface)
|
||||||
{
|
{
|
||||||
/* flush memory to make sure state is correct */
|
/* flush memory to make sure state is correct */
|
||||||
smp_mb__before_atomic();
|
smp_mb__before_atomic();
|
||||||
clear_bit(__FM10K_MBX_LOCK, &interface->state);
|
clear_bit(__FM10K_MBX_LOCK, interface->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int fm10k_mbx_trylock(struct fm10k_intfc *interface)
|
static inline int fm10k_mbx_trylock(struct fm10k_intfc *interface)
|
||||||
{
|
{
|
||||||
return !test_and_set_bit(__FM10K_MBX_LOCK, &interface->state);
|
return !test_and_set_bit(__FM10K_MBX_LOCK, interface->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fm10k_test_staterr - test bits in Rx descriptor status and error fields */
|
/* fm10k_test_staterr - test bits in Rx descriptor status and error fields */
|
||||||
|
|
|
@ -562,7 +562,7 @@ static int fm10k_set_ringparam(struct net_device *netdev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (test_and_set_bit(__FM10K_RESETTING, &interface->state))
|
while (test_and_set_bit(__FM10K_RESETTING, interface->state))
|
||||||
usleep_range(1000, 2000);
|
usleep_range(1000, 2000);
|
||||||
|
|
||||||
if (!netif_running(interface->netdev)) {
|
if (!netif_running(interface->netdev)) {
|
||||||
|
@ -648,7 +648,7 @@ static int fm10k_set_ringparam(struct net_device *netdev,
|
||||||
fm10k_up(interface);
|
fm10k_up(interface);
|
||||||
vfree(temp_ring);
|
vfree(temp_ring);
|
||||||
clear_reset:
|
clear_reset:
|
||||||
clear_bit(__FM10K_RESETTING, &interface->state);
|
clear_bit(__FM10K_RESETTING, interface->state);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1175,13 +1175,13 @@ bool fm10k_check_tx_hang(struct fm10k_ring *tx_ring)
|
||||||
/* update completed stats and continue */
|
/* update completed stats and continue */
|
||||||
tx_ring->tx_stats.tx_done_old = tx_done;
|
tx_ring->tx_stats.tx_done_old = tx_done;
|
||||||
/* reset the countdown */
|
/* reset the countdown */
|
||||||
clear_bit(__FM10K_HANG_CHECK_ARMED, &tx_ring->state);
|
clear_bit(__FM10K_HANG_CHECK_ARMED, tx_ring->state);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure it is true for two checks in a row */
|
/* make sure it is true for two checks in a row */
|
||||||
return test_and_set_bit(__FM10K_HANG_CHECK_ARMED, &tx_ring->state);
|
return test_and_set_bit(__FM10K_HANG_CHECK_ARMED, tx_ring->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1191,7 +1191,7 @@ bool fm10k_check_tx_hang(struct fm10k_ring *tx_ring)
|
||||||
void fm10k_tx_timeout_reset(struct fm10k_intfc *interface)
|
void fm10k_tx_timeout_reset(struct fm10k_intfc *interface)
|
||||||
{
|
{
|
||||||
/* Do the reset outside of interrupt context */
|
/* Do the reset outside of interrupt context */
|
||||||
if (!test_bit(__FM10K_DOWN, &interface->state)) {
|
if (!test_bit(__FM10K_DOWN, interface->state)) {
|
||||||
interface->tx_timeout_count++;
|
interface->tx_timeout_count++;
|
||||||
set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags);
|
set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags);
|
||||||
fm10k_service_event_schedule(interface);
|
fm10k_service_event_schedule(interface);
|
||||||
|
@ -1214,7 +1214,7 @@ static bool fm10k_clean_tx_irq(struct fm10k_q_vector *q_vector,
|
||||||
unsigned int budget = q_vector->tx.work_limit;
|
unsigned int budget = q_vector->tx.work_limit;
|
||||||
unsigned int i = tx_ring->next_to_clean;
|
unsigned int i = tx_ring->next_to_clean;
|
||||||
|
|
||||||
if (test_bit(__FM10K_DOWN, &interface->state))
|
if (test_bit(__FM10K_DOWN, interface->state))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
tx_buffer = &tx_ring->tx_buffer[i];
|
tx_buffer = &tx_ring->tx_buffer[i];
|
||||||
|
@ -1344,7 +1344,7 @@ static bool fm10k_clean_tx_irq(struct fm10k_q_vector *q_vector,
|
||||||
smp_mb();
|
smp_mb();
|
||||||
if (__netif_subqueue_stopped(tx_ring->netdev,
|
if (__netif_subqueue_stopped(tx_ring->netdev,
|
||||||
tx_ring->queue_index) &&
|
tx_ring->queue_index) &&
|
||||||
!test_bit(__FM10K_DOWN, &interface->state)) {
|
!test_bit(__FM10K_DOWN, interface->state)) {
|
||||||
netif_wake_subqueue(tx_ring->netdev,
|
netif_wake_subqueue(tx_ring->netdev,
|
||||||
tx_ring->queue_index);
|
tx_ring->queue_index);
|
||||||
++tx_ring->tx_stats.restart_queue;
|
++tx_ring->tx_stats.restart_queue;
|
||||||
|
|
|
@ -822,7 +822,7 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
|
||||||
/* Do not throw an error if the interface is down. We will sync once
|
/* Do not throw an error if the interface is down. We will sync once
|
||||||
* we come up
|
* we come up
|
||||||
*/
|
*/
|
||||||
if (test_bit(__FM10K_DOWN, &interface->state))
|
if (test_bit(__FM10K_DOWN, interface->state))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fm10k_mbx_lock(interface);
|
fm10k_mbx_lock(interface);
|
||||||
|
|
|
@ -93,18 +93,18 @@ static int fm10k_hw_ready(struct fm10k_intfc *interface)
|
||||||
|
|
||||||
void fm10k_service_event_schedule(struct fm10k_intfc *interface)
|
void fm10k_service_event_schedule(struct fm10k_intfc *interface)
|
||||||
{
|
{
|
||||||
if (!test_bit(__FM10K_SERVICE_DISABLE, &interface->state) &&
|
if (!test_bit(__FM10K_SERVICE_DISABLE, interface->state) &&
|
||||||
!test_and_set_bit(__FM10K_SERVICE_SCHED, &interface->state))
|
!test_and_set_bit(__FM10K_SERVICE_SCHED, interface->state))
|
||||||
queue_work(fm10k_workqueue, &interface->service_task);
|
queue_work(fm10k_workqueue, &interface->service_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fm10k_service_event_complete(struct fm10k_intfc *interface)
|
static void fm10k_service_event_complete(struct fm10k_intfc *interface)
|
||||||
{
|
{
|
||||||
WARN_ON(!test_bit(__FM10K_SERVICE_SCHED, &interface->state));
|
WARN_ON(!test_bit(__FM10K_SERVICE_SCHED, interface->state));
|
||||||
|
|
||||||
/* flush memory to make sure state is correct before next watchog */
|
/* flush memory to make sure state is correct before next watchog */
|
||||||
smp_mb__before_atomic();
|
smp_mb__before_atomic();
|
||||||
clear_bit(__FM10K_SERVICE_SCHED, &interface->state);
|
clear_bit(__FM10K_SERVICE_SCHED, interface->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +159,7 @@ static void fm10k_prepare_for_reset(struct fm10k_intfc *interface)
|
||||||
/* put off any impending NetWatchDogTimeout */
|
/* put off any impending NetWatchDogTimeout */
|
||||||
netif_trans_update(netdev);
|
netif_trans_update(netdev);
|
||||||
|
|
||||||
while (test_and_set_bit(__FM10K_RESETTING, &interface->state))
|
while (test_and_set_bit(__FM10K_RESETTING, interface->state))
|
||||||
usleep_range(1000, 2000);
|
usleep_range(1000, 2000);
|
||||||
|
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
|
@ -242,7 +242,7 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface)
|
||||||
|
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
|
||||||
clear_bit(__FM10K_RESETTING, &interface->state);
|
clear_bit(__FM10K_RESETTING, interface->state);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
err_open:
|
err_open:
|
||||||
|
@ -254,7 +254,7 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface)
|
||||||
|
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
|
||||||
clear_bit(__FM10K_RESETTING, &interface->state);
|
clear_bit(__FM10K_RESETTING, interface->state);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -316,11 +316,11 @@ static void fm10k_watchdog_update_host_state(struct fm10k_intfc *interface)
|
||||||
struct fm10k_hw *hw = &interface->hw;
|
struct fm10k_hw *hw = &interface->hw;
|
||||||
s32 err;
|
s32 err;
|
||||||
|
|
||||||
if (test_bit(__FM10K_LINK_DOWN, &interface->state)) {
|
if (test_bit(__FM10K_LINK_DOWN, interface->state)) {
|
||||||
interface->host_ready = false;
|
interface->host_ready = false;
|
||||||
if (time_is_after_jiffies(interface->link_down_event))
|
if (time_is_after_jiffies(interface->link_down_event))
|
||||||
return;
|
return;
|
||||||
clear_bit(__FM10K_LINK_DOWN, &interface->state);
|
clear_bit(__FM10K_LINK_DOWN, interface->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(FM10K_FLAG_SWPRI_CONFIG, interface->flags)) {
|
if (test_bit(FM10K_FLAG_SWPRI_CONFIG, interface->flags)) {
|
||||||
|
@ -411,7 +411,7 @@ void fm10k_update_stats(struct fm10k_intfc *interface)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* ensure only one thread updates stats at a time */
|
/* ensure only one thread updates stats at a time */
|
||||||
if (test_and_set_bit(__FM10K_UPDATING_STATS, &interface->state))
|
if (test_and_set_bit(__FM10K_UPDATING_STATS, interface->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* do not allow stats update via service task for next second */
|
/* do not allow stats update via service task for next second */
|
||||||
|
@ -492,7 +492,7 @@ void fm10k_update_stats(struct fm10k_intfc *interface)
|
||||||
net_stats->rx_errors = rx_errors;
|
net_stats->rx_errors = rx_errors;
|
||||||
net_stats->rx_dropped = interface->stats.nodesc_drop.count;
|
net_stats->rx_dropped = interface->stats.nodesc_drop.count;
|
||||||
|
|
||||||
clear_bit(__FM10K_UPDATING_STATS, &interface->state);
|
clear_bit(__FM10K_UPDATING_STATS, interface->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -532,8 +532,8 @@ static void fm10k_watchdog_flush_tx(struct fm10k_intfc *interface)
|
||||||
static void fm10k_watchdog_subtask(struct fm10k_intfc *interface)
|
static void fm10k_watchdog_subtask(struct fm10k_intfc *interface)
|
||||||
{
|
{
|
||||||
/* if interface is down do nothing */
|
/* if interface is down do nothing */
|
||||||
if (test_bit(__FM10K_DOWN, &interface->state) ||
|
if (test_bit(__FM10K_DOWN, interface->state) ||
|
||||||
test_bit(__FM10K_RESETTING, &interface->state))
|
test_bit(__FM10K_RESETTING, interface->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (interface->host_ready)
|
if (interface->host_ready)
|
||||||
|
@ -563,8 +563,8 @@ static void fm10k_check_hang_subtask(struct fm10k_intfc *interface)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* If we're down or resetting, just bail */
|
/* If we're down or resetting, just bail */
|
||||||
if (test_bit(__FM10K_DOWN, &interface->state) ||
|
if (test_bit(__FM10K_DOWN, interface->state) ||
|
||||||
test_bit(__FM10K_RESETTING, &interface->state))
|
test_bit(__FM10K_RESETTING, interface->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* rate limit tx hang checks to only once every 2 seconds */
|
/* rate limit tx hang checks to only once every 2 seconds */
|
||||||
|
@ -663,7 +663,7 @@ static void fm10k_configure_tx_ring(struct fm10k_intfc *interface,
|
||||||
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
|
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
|
||||||
|
|
||||||
/* Initialize XPS */
|
/* Initialize XPS */
|
||||||
if (!test_and_set_bit(__FM10K_TX_XPS_INIT_DONE, &ring->state) &&
|
if (!test_and_set_bit(__FM10K_TX_XPS_INIT_DONE, ring->state) &&
|
||||||
ring->q_vector)
|
ring->q_vector)
|
||||||
netif_set_xps_queue(ring->netdev,
|
netif_set_xps_queue(ring->netdev,
|
||||||
&ring->q_vector->affinity_mask,
|
&ring->q_vector->affinity_mask,
|
||||||
|
@ -980,7 +980,7 @@ void fm10k_netpoll(struct net_device *netdev)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* if interface is down do nothing */
|
/* if interface is down do nothing */
|
||||||
if (test_bit(__FM10K_DOWN, &interface->state))
|
if (test_bit(__FM10K_DOWN, interface->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < interface->num_q_vectors; i++)
|
for (i = 0; i < interface->num_q_vectors; i++)
|
||||||
|
@ -1173,7 +1173,7 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
|
||||||
if (eicr & FM10K_EICR_SWITCHNOTREADY) {
|
if (eicr & FM10K_EICR_SWITCHNOTREADY) {
|
||||||
/* force link down for at least 4 seconds */
|
/* force link down for at least 4 seconds */
|
||||||
interface->link_down_event = jiffies + (4 * HZ);
|
interface->link_down_event = jiffies + (4 * HZ);
|
||||||
set_bit(__FM10K_LINK_DOWN, &interface->state);
|
set_bit(__FM10K_LINK_DOWN, interface->state);
|
||||||
|
|
||||||
/* reset dglort_map back to no config */
|
/* reset dglort_map back to no config */
|
||||||
hw->mac.dglort_map = FM10K_DGLORTMAP_NONE;
|
hw->mac.dglort_map = FM10K_DGLORTMAP_NONE;
|
||||||
|
@ -1325,7 +1325,7 @@ static s32 fm10k_lport_map(struct fm10k_hw *hw, u32 **results,
|
||||||
if (!err && hw->swapi.status) {
|
if (!err && hw->swapi.status) {
|
||||||
/* force link down for a reasonable delay */
|
/* force link down for a reasonable delay */
|
||||||
interface->link_down_event = jiffies + (2 * HZ);
|
interface->link_down_event = jiffies + (2 * HZ);
|
||||||
set_bit(__FM10K_LINK_DOWN, &interface->state);
|
set_bit(__FM10K_LINK_DOWN, interface->state);
|
||||||
|
|
||||||
/* reset dglort_map back to no config */
|
/* reset dglort_map back to no config */
|
||||||
hw->mac.dglort_map = FM10K_DGLORTMAP_NONE;
|
hw->mac.dglort_map = FM10K_DGLORTMAP_NONE;
|
||||||
|
@ -1623,10 +1623,10 @@ void fm10k_up(struct fm10k_intfc *interface)
|
||||||
hw->mac.ops.update_int_moderator(hw);
|
hw->mac.ops.update_int_moderator(hw);
|
||||||
|
|
||||||
/* enable statistics capture again */
|
/* enable statistics capture again */
|
||||||
clear_bit(__FM10K_UPDATING_STATS, &interface->state);
|
clear_bit(__FM10K_UPDATING_STATS, interface->state);
|
||||||
|
|
||||||
/* clear down bit to indicate we are ready to go */
|
/* clear down bit to indicate we are ready to go */
|
||||||
clear_bit(__FM10K_DOWN, &interface->state);
|
clear_bit(__FM10K_DOWN, interface->state);
|
||||||
|
|
||||||
/* enable polling cleanups */
|
/* enable polling cleanups */
|
||||||
fm10k_napi_enable_all(interface);
|
fm10k_napi_enable_all(interface);
|
||||||
|
@ -1660,7 +1660,7 @@ void fm10k_down(struct fm10k_intfc *interface)
|
||||||
int err, i = 0, count = 0;
|
int err, i = 0, count = 0;
|
||||||
|
|
||||||
/* signal that we are down to the interrupt handler and service task */
|
/* signal that we are down to the interrupt handler and service task */
|
||||||
if (test_and_set_bit(__FM10K_DOWN, &interface->state))
|
if (test_and_set_bit(__FM10K_DOWN, interface->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* call carrier off first to avoid false dev_watchdog timeouts */
|
/* call carrier off first to avoid false dev_watchdog timeouts */
|
||||||
|
@ -1680,7 +1680,7 @@ void fm10k_down(struct fm10k_intfc *interface)
|
||||||
fm10k_update_stats(interface);
|
fm10k_update_stats(interface);
|
||||||
|
|
||||||
/* prevent updating statistics while we're down */
|
/* prevent updating statistics while we're down */
|
||||||
while (test_and_set_bit(__FM10K_UPDATING_STATS, &interface->state))
|
while (test_and_set_bit(__FM10K_UPDATING_STATS, interface->state))
|
||||||
usleep_range(1000, 2000);
|
usleep_range(1000, 2000);
|
||||||
|
|
||||||
/* skip waiting for TX DMA if we lost PCIe link */
|
/* skip waiting for TX DMA if we lost PCIe link */
|
||||||
|
@ -1849,8 +1849,8 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
|
||||||
memcpy(interface->rssrk, rss_key, sizeof(rss_key));
|
memcpy(interface->rssrk, rss_key, sizeof(rss_key));
|
||||||
|
|
||||||
/* Start off interface as being down */
|
/* Start off interface as being down */
|
||||||
set_bit(__FM10K_DOWN, &interface->state);
|
set_bit(__FM10K_DOWN, interface->state);
|
||||||
set_bit(__FM10K_UPDATING_STATS, &interface->state);
|
set_bit(__FM10K_UPDATING_STATS, interface->state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2027,7 +2027,7 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
* must ensure it is disabled since we haven't yet requested the timer
|
* must ensure it is disabled since we haven't yet requested the timer
|
||||||
* or work item.
|
* or work item.
|
||||||
*/
|
*/
|
||||||
set_bit(__FM10K_SERVICE_DISABLE, &interface->state);
|
set_bit(__FM10K_SERVICE_DISABLE, interface->state);
|
||||||
|
|
||||||
err = fm10k_mbx_request_irq(interface);
|
err = fm10k_mbx_request_irq(interface);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -2068,7 +2068,7 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
fm10k_iov_configure(pdev, 0);
|
fm10k_iov_configure(pdev, 0);
|
||||||
|
|
||||||
/* clear the service task disable bit to allow service task to start */
|
/* clear the service task disable bit to allow service task to start */
|
||||||
clear_bit(__FM10K_SERVICE_DISABLE, &interface->state);
|
clear_bit(__FM10K_SERVICE_DISABLE, interface->state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -2106,7 +2106,7 @@ static void fm10k_remove(struct pci_dev *pdev)
|
||||||
|
|
||||||
del_timer_sync(&interface->service_timer);
|
del_timer_sync(&interface->service_timer);
|
||||||
|
|
||||||
set_bit(__FM10K_SERVICE_DISABLE, &interface->state);
|
set_bit(__FM10K_SERVICE_DISABLE, interface->state);
|
||||||
cancel_work_sync(&interface->service_task);
|
cancel_work_sync(&interface->service_task);
|
||||||
|
|
||||||
/* free netdev, this may bounce the interrupts due to setup_tc */
|
/* free netdev, this may bounce the interrupts due to setup_tc */
|
||||||
|
@ -2145,7 +2145,7 @@ static void fm10k_prepare_suspend(struct fm10k_intfc *interface)
|
||||||
* stopped. We stop the watchdog task until after we resume software
|
* stopped. We stop the watchdog task until after we resume software
|
||||||
* activity.
|
* activity.
|
||||||
*/
|
*/
|
||||||
set_bit(__FM10K_SERVICE_DISABLE, &interface->state);
|
set_bit(__FM10K_SERVICE_DISABLE, interface->state);
|
||||||
cancel_work_sync(&interface->service_task);
|
cancel_work_sync(&interface->service_task);
|
||||||
|
|
||||||
fm10k_prepare_for_reset(interface);
|
fm10k_prepare_for_reset(interface);
|
||||||
|
@ -2171,10 +2171,10 @@ static int fm10k_handle_resume(struct fm10k_intfc *interface)
|
||||||
|
|
||||||
/* force link to stay down for a second to prevent link flutter */
|
/* force link to stay down for a second to prevent link flutter */
|
||||||
interface->link_down_event = jiffies + (HZ);
|
interface->link_down_event = jiffies + (HZ);
|
||||||
set_bit(__FM10K_LINK_DOWN, &interface->state);
|
set_bit(__FM10K_LINK_DOWN, interface->state);
|
||||||
|
|
||||||
/* clear the service task disable bit to allow service task to start */
|
/* clear the service task disable bit to allow service task to start */
|
||||||
clear_bit(__FM10K_SERVICE_DISABLE, &interface->state);
|
clear_bit(__FM10K_SERVICE_DISABLE, interface->state);
|
||||||
fm10k_service_event_schedule(interface);
|
fm10k_service_event_schedule(interface);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in New Issue