struct {
DECLARE_BITMAP(flags, RTL_FLAG_MAX);
- struct mutex mutex;
struct work_struct work;
} wk;
return &tp->pci_dev->dev;
}
-static void rtl_lock_work(struct rtl8169_private *tp)
-{
- mutex_lock(&tp->wk.mutex);
-}
-
-static void rtl_unlock_work(struct rtl8169_private *tp)
-{
- mutex_unlock(&tp->wk.mutex);
-}
-
static void rtl_lock_config_regs(struct rtl8169_private *tp)
{
RTL_W8(tp, Cfg9346, Cfg9346_Lock);
{
struct rtl8169_private *tp = netdev_priv(dev);
- rtl_lock_work(tp);
wol->supported = WAKE_ANY;
wol->wolopts = tp->saved_wolopts;
- rtl_unlock_work(tp);
}
static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
if (wol->wolopts & ~WAKE_ANY)
return -EINVAL;
- rtl_lock_work(tp);
-
tp->saved_wolopts = wol->wolopts;
__rtl8169_set_wol(tp, tp->saved_wolopts);
- rtl_unlock_work(tp);
-
return 0;
}
{
struct rtl8169_private *tp = netdev_priv(dev);
- rtl_lock_work(tp);
-
rtl_set_rx_config_features(tp, features);
if (features & NETIF_F_RXCSUM)
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
rtl_pci_commit(tp);
- rtl_unlock_work(tp);
-
return 0;
}
u32 *dw = p;
int i;
- rtl_lock_work(tp);
for (i = 0; i < R8169_REGS_SIZE; i += 4)
memcpy_fromio(dw++, data++, 4);
- rtl_unlock_work(tp);
}
static const char rtl8169_gstrings[][ETH_GSTRING_LEN] = {
units = DIV_ROUND_UP(ec->rx_coalesce_usecs * 1000U, scale);
w |= FIELD_PREP(RTL_COALESCE_RX_USECS, units);
- rtl_lock_work(tp);
-
RTL_W16(tp, IntrMitigate, w);
/* Meaning of PktCntrDisable bit changed from RTL8168e-vl */
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
rtl_pci_commit(tp);
- rtl_unlock_work(tp);
-
return 0;
}
static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
{
- rtl_lock_work(tp);
-
rtl_unlock_config_regs(tp);
RTL_W32(tp, MAC4, addr[4] | addr[5] << 8);
rtl_rar_exgmac_set(tp, addr);
rtl_lock_config_regs(tp);
-
- rtl_unlock_work(tp);
}
static int rtl_set_mac_address(struct net_device *dev, void *p)
container_of(work, struct rtl8169_private, wk.work);
rtnl_lock();
- rtl_lock_work(tp);
if (!netif_running(tp->dev) ||
!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
netif_wake_queue(tp->dev);
}
out_unlock:
- rtl_unlock_work(tp);
rtnl_unlock();
}
static void rtl8169_down(struct rtl8169_private *tp)
{
- rtl_lock_work(tp);
-
/* Clear all task flags */
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
rtl8169_cleanup(tp, true);
rtl_pll_power_down(tp);
-
- rtl_unlock_work(tp);
}
static void rtl8169_up(struct rtl8169_private *tp)
{
- rtl_lock_work(tp);
rtl_pll_power_up(tp);
rtl8169_init_phy(tp);
napi_enable(&tp->napi);
rtl_reset_work(tp);
phy_start(tp->phydev);
- rtl_unlock_work(tp);
}
static int rtl8169_close(struct net_device *dev)
}
rtnl_lock();
- rtl_lock_work(tp);
__rtl8169_set_wol(tp, WAKE_PHY);
- rtl_unlock_work(tp);
-
rtl8169_net_suspend(tp);
rtnl_unlock();
rtl_rar_set(tp, tp->dev->dev_addr);
- rtl_lock_work(tp);
__rtl8169_set_wol(tp, tp->saved_wolopts);
- rtl_unlock_work(tp);
if (tp->TxDescArray)
rtl8169_up(tp);
return rc;
}
- mutex_init(&tp->wk.mutex);
INIT_WORK(&tp->wk.work, rtl_task);
u64_stats_init(&tp->rx_stats.syncp);
u64_stats_init(&tp->tx_stats.syncp);