From patchwork Fri Jun 24 08:13:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9196905 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 73E1360871 for ; Fri, 24 Jun 2016 08:15:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FF7828485 for ; Fri, 24 Jun 2016 08:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 528D728499; Fri, 24 Jun 2016 08:15:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01C5D28485 for ; Fri, 24 Jun 2016 08:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751197AbcFXIO4 (ORCPT ); Fri, 24 Jun 2016 04:14:56 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35777 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750979AbcFXIOv (ORCPT ); Fri, 24 Jun 2016 04:14:51 -0400 Received: by mail-wm0-f66.google.com with SMTP id a66so2994427wme.2; Fri, 24 Jun 2016 01:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=30qooEGOTb4MKt4rqWwn890GFCoGwyTmMZjORwkz8B0=; b=CgdMigkvZ+Dwz7Q3HpELlxM6a92r3IoUVGGrP8qrmETgh21ExfGHtG6/a8a0QMF+Au yxVd0nHCwIbbgq6R6O/HLlM4IPzdeefyrgD4tqhU5VYY1kXmp87wG9p6dw1f9K8B5vJq CWhWcVn5kl+7TomNWoF9gwj9gMYlRzQXi2W7KyT0cef2gaQXc+O57lLd6PbijcEo4Vxq 4pjCczqAJeEKtXqS+Dfrunkix4jHmGoxXBwBfB/HKZRX1f7KV1VfRUet+ANdgf6oS7V7 MqgtDvi/eAmYWDK9MGDk7Z6TEgMMyftS/P+HGmcne19WXyJ7Au4HDJp0oq7WNYvfLxag 9b9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=30qooEGOTb4MKt4rqWwn890GFCoGwyTmMZjORwkz8B0=; b=aeCB9QZqcvmwKE0pbF5QXjABc4MRuW9raU0s3I0KOM59L+09o6+70yJXISKkrUHhQk G9CSpkfsrWl7h0XE+fvjkGQmW6KG1Wmqky0YTDAEbS26fCO1ZsbhI8m3q9qLzuZLit8b 4nZXxOnTQ3TZy50Qbkn7JeayQC3Oxt4SdHViGS/iImJ4wvL8XWaSdbdSdf651+ksG5Dl S0Q4mVjPJ06nWUY/J9cQfkIOBDVl/hkjIlPfgYCR19u6lYywRYbrj+WY3CudiYFNfbKI m34Bv5jBcMDAD1P07UO8i58Y93HpLLHpK3CKUm/ooLjR2VmuO37IcDU0m/w87LFK/QPa sBlg== X-Gm-Message-State: ALyK8tIkUGBToP2TsUs+6kKgAu1+pVCenjsaDyH8/NdkJrDpkl3Frc4in46gX5NRQh2Alg== X-Received: by 10.28.32.14 with SMTP id g14mr4455821wmg.72.1466756089632; Fri, 24 Jun 2016 01:14:49 -0700 (PDT) Received: from erik-desktop.lan (81-233-218-97-no25.tbcn.telia.com. [81.233.218.97]) by smtp.gmail.com with ESMTPSA id bf5sm3938698wjc.12.2016.06.24.01.14.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2016 01:14:48 -0700 (PDT) From: Erik Stromdahl To: johannes@sipsolutions.net, johannes.berg@intel.com, kvalo@codeaurora.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Cc: Erik Stromdahl Subject: [PATCH] mac80211_hwsim: Added vendor echo command Date: Fri, 24 Jun 2016 10:13:54 +0200 Message-Id: <1466756034-5485-1-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The purpose of the echo command is to provide a test facility for user space programs. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/mac80211_hwsim.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 4dd5adc..2e17bf1 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -332,14 +332,16 @@ static const struct ieee80211_rate hwsim_rates[] = { #define OUI_QCA 0x001374 #define QCA_NL80211_SUBCMD_TEST 1 +#define QCA_NL80211_SUBCMD_ECHO 2 enum qca_nl80211_vendor_subcmds { QCA_WLAN_VENDOR_ATTR_TEST = 8, - QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_TEST + QCA_WLAN_VENDOR_ATTR_ECHO, + QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_ECHO }; static const struct nla_policy hwsim_vendor_test_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] = { - [QCA_WLAN_VENDOR_ATTR_MAX] = { .type = NLA_U32 }, + [QCA_WLAN_VENDOR_ATTR_TEST] = { .type = NLA_U32 }, }; static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy, @@ -393,12 +395,33 @@ static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy, return cfg80211_vendor_cmd_reply(skb); } +static int mac80211_hwsim_vendor_cmd_echo(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + struct sk_buff *skb; + + skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, data_len); + if (!skb) + return -ENOMEM; + + nla_put(skb, QCA_WLAN_VENDOR_ATTR_ECHO, data_len, data); + + return cfg80211_vendor_cmd_reply(skb); +} + static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = { { .info = { .vendor_id = OUI_QCA, .subcmd = QCA_NL80211_SUBCMD_TEST }, .flags = WIPHY_VENDOR_CMD_NEED_NETDEV, .doit = mac80211_hwsim_vendor_cmd_test, + }, + { + .info = { .vendor_id = OUI_QCA, + .subcmd = QCA_NL80211_SUBCMD_ECHO }, + .flags = WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = mac80211_hwsim_vendor_cmd_echo, } };