From cbaa177d2b2f9364c7b9250d8ced75fae326c052 Mon Sep 17 00:00:00 2001 From: Arend van Spriel Date: Thu, 30 Aug 2012 19:43:02 +0200 Subject: [PATCH] brcmfmac: add callback for nl80211 testmode command This change adds callback for nl80211 testmode, which can be used for testing and debugging purposes with driver and firmware. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky (Zhenhui) Lin Signed-off-by: Arend van Spriel Signed-off-by: John W. Linville --- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 1 + .../wireless/brcm80211/brcmfmac/dhd_linux.c | 8 ++++++ .../wireless/brcm80211/brcmfmac/wl_cfg80211.c | 25 ++++++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h index a11fe54f5950..37f57088c363 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h @@ -638,6 +638,7 @@ extern uint brcmf_c_mkiovar(char *name, char *data, uint datalen, extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); extern s32 brcmf_exec_dcmd(struct net_device *dev, u32 cmd, void *arg, u32 len); +extern int brcmf_netlink_dcmd(struct net_device *ndev, struct brcmf_dcmd *dcmd); /* Return pointer to interface name */ extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 57bf1d7ee80f..dcfeb1a4ef8b 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c @@ -775,6 +775,14 @@ done: return err; } +int brcmf_netlink_dcmd(struct net_device *ndev, struct brcmf_dcmd *dcmd) +{ + brcmf_dbg(TRACE, "enter: cmd %x buf %p len %d\n", + dcmd->cmd, dcmd->buf, dcmd->len); + + return brcmf_exec_dcmd(ndev, dcmd->cmd, dcmd->buf, dcmd->len); +} + static int brcmf_netdev_stop(struct net_device *ndev) { struct brcmf_if *ifp = netdev_priv(ndev); diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 28c5fbb4af26..c7230f531e49 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -2723,6 +2724,25 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev) } +#ifdef CONFIG_NL80211_TESTMODE +static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) +{ + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); + struct net_device *ndev = cfg_priv->wdev->netdev; + struct brcmf_dcmd *dcmd = data; + struct sk_buff *reply; + int ret; + + ret = brcmf_netlink_dcmd(ndev, dcmd); + if (ret == 0) { + reply = cfg80211_testmode_alloc_reply_skb(wiphy, sizeof(*dcmd)); + nla_put(reply, NL80211_ATTR_TESTDATA, sizeof(*dcmd), dcmd); + ret = cfg80211_testmode_reply(reply); + } + return ret; +} +#endif + static struct cfg80211_ops wl_cfg80211_ops = { .change_virtual_intf = brcmf_cfg80211_change_iface, .scan = brcmf_cfg80211_scan, @@ -2745,7 +2765,10 @@ static struct cfg80211_ops wl_cfg80211_ops = { .resume = brcmf_cfg80211_resume, .set_pmksa = brcmf_cfg80211_set_pmksa, .del_pmksa = brcmf_cfg80211_del_pmksa, - .flush_pmksa = brcmf_cfg80211_flush_pmksa + .flush_pmksa = brcmf_cfg80211_flush_pmksa, +#ifdef CONFIG_NL80211_TESTMODE + .testmode_cmd = brcmf_cfg80211_testmode +#endif }; static s32 brcmf_mode_to_nl80211_iftype(s32 mode) -- 2.20.1