mirror of
https://github.com/torvalds/linux.git
synced 2026-05-02 13:32:40 -04:00
Based on the normalized pattern:
this software file (the file ) is distributed by nxp under the terms
of the gnu general public license version 2 june 1991 (the license )
you may use redistribute and/or modify this file in accordance with
the terms and conditions of the license a copy of which is available
by writing to the free software foundation inc 51 franklin street
fifth floor boston ma 02110-1301 usa or on the worldwide web at
http://www gnu org/licenses/old-licenses/gpl-2 0 txt the file is
distributed as-is without warranty of any kind and the implied
warranties of merchantability or fitness for a particular purpose are
expressly disclaimed the license provides additional details about
this warranty disclaimer
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference.
Reviewed-by: Allison Randal <allison@lohutok.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
59 lines
1.6 KiB
C
59 lines
1.6 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* NXP Wireless LAN device driver: ethtool
|
|
*
|
|
* Copyright 2011-2020 NXP
|
|
*/
|
|
|
|
#include "main.h"
|
|
|
|
static void mwifiex_ethtool_get_wol(struct net_device *dev,
|
|
struct ethtool_wolinfo *wol)
|
|
{
|
|
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
|
u32 conditions = le32_to_cpu(priv->adapter->hs_cfg.conditions);
|
|
|
|
wol->supported = WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY;
|
|
|
|
if (conditions == HS_CFG_COND_DEF)
|
|
return;
|
|
|
|
if (conditions & HS_CFG_COND_UNICAST_DATA)
|
|
wol->wolopts |= WAKE_UCAST;
|
|
if (conditions & HS_CFG_COND_MULTICAST_DATA)
|
|
wol->wolopts |= WAKE_MCAST;
|
|
if (conditions & HS_CFG_COND_BROADCAST_DATA)
|
|
wol->wolopts |= WAKE_BCAST;
|
|
if (conditions & HS_CFG_COND_MAC_EVENT)
|
|
wol->wolopts |= WAKE_PHY;
|
|
}
|
|
|
|
static int mwifiex_ethtool_set_wol(struct net_device *dev,
|
|
struct ethtool_wolinfo *wol)
|
|
{
|
|
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
|
u32 conditions = 0;
|
|
|
|
if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY))
|
|
return -EOPNOTSUPP;
|
|
|
|
if (wol->wolopts & WAKE_UCAST)
|
|
conditions |= HS_CFG_COND_UNICAST_DATA;
|
|
if (wol->wolopts & WAKE_MCAST)
|
|
conditions |= HS_CFG_COND_MULTICAST_DATA;
|
|
if (wol->wolopts & WAKE_BCAST)
|
|
conditions |= HS_CFG_COND_BROADCAST_DATA;
|
|
if (wol->wolopts & WAKE_PHY)
|
|
conditions |= HS_CFG_COND_MAC_EVENT;
|
|
if (wol->wolopts == 0)
|
|
conditions |= HS_CFG_COND_DEF;
|
|
priv->adapter->hs_cfg.conditions = cpu_to_le32(conditions);
|
|
|
|
return 0;
|
|
}
|
|
|
|
const struct ethtool_ops mwifiex_ethtool_ops = {
|
|
.get_wol = mwifiex_ethtool_get_wol,
|
|
.set_wol = mwifiex_ethtool_set_wol,
|
|
};
|