From: Kalle Valo <kvalo@codeaurora.org>
To: Luca Coelho <luca@coelho.fi>
Cc: linux-wireless@vger.kernel.org,
Sara Sharon <sara.sharon@intel.com>,
Luca Coelho <luciano.coelho@intel.com>
Subject: Re: [PATCH 10/25] iwlwifi: mvm: support packet injection
Date: Sat, 24 Sep 2016 14:19:38 +0300 [thread overview]
Message-ID: <87oa3d1r5h.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20160919073028.22065-10-luca@coelho.fi> (Luca Coelho's message of "Mon, 19 Sep 2016 10:30:13 +0300")
Luca Coelho <luca@coelho.fi> writes:
> From: Sara Sharon <sara.sharon@intel.com>
>
> For automatic testing packet injection can be useful.
> Support injection through debugfs.
>
> Signed-off-by: Sara Sharon <sara.sharon@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
The commit log doesn't tell a lot. I started to wonder why use debugfs
and not the proper interface through mac80211?
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> @@ -917,6 +917,59 @@ static ssize_t iwl_dbgfs_indirection_tbl_write(struct iwl_mvm *mvm,
> return ret ?: count;
> }
>
> +static ssize_t iwl_dbgfs_inject_packet_write(struct iwl_mvm *mvm,
> + char *buf, size_t count,
> + loff_t *ppos)
> +{
> + struct iwl_rx_cmd_buffer rxb = {
> + ._rx_page_order = 0,
> + .truesize = 0, /* not used */
> + ._offset = 0,
> + };
> + struct iwl_rx_packet *pkt;
> + struct iwl_rx_mpdu_desc *desc;
> + int bin_len = count / 2;
> + int ret = -EINVAL;
> +
> + /* supporting only 9000 descriptor */
> + if (!mvm->trans->cfg->mq_rx_supported)
> + return -ENOTSUPP;
> +
> + rxb._page = alloc_pages(GFP_ATOMIC, 0);
> + if (!rxb._page)
> + return -ENOMEM;
> + pkt = rxb_addr(&rxb);
> +
> + ret = hex2bin(page_address(rxb._page), buf, bin_len);
> + if (ret)
> + goto out;
> +
> + /* avoid invalid memory access */
> + if (bin_len < sizeof(*pkt) + sizeof(*desc))
> + goto out;
> +
> + /* check this is RX packet */
> + if (WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd) !=
> + WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))
> + goto out;
> +
> + /* check the length in metadata matches actual received length */
> + desc = (void *)pkt->data;
> + if (le16_to_cpu(desc->mpdu_len) !=
> + (bin_len - sizeof(*desc) - sizeof(*pkt)))
> + goto out;
> +
> + local_bh_disable();
> + iwl_mvm_rx_mpdu_mq(mvm, NULL, &rxb, 0);
> + local_bh_enable();
> + ret = 0;
But reading from the code makes me suspect that this isn't really normal
packet injection, more like passing full descriptors to the hw. Did I
understand correctly?
--
Kalle Valo
next prev parent reply other threads:[~2016-09-24 11:19 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 7:27 pull-request: iwlwifi-next 2016-09-19 Luca Coelho
2016-09-19 7:30 ` [PATCH 01/25] iwlwifi: mvm: remove variable shadowing Luca Coelho
2016-09-19 7:30 ` [PATCH 02/25] iwlwifi: pcie: fix typo in struct name for a000 devices Luca Coelho
2016-09-19 7:30 ` [PATCH 03/25] iwlwifi: mvm: cleanup skb queue functions use Luca Coelho
2016-09-19 7:30 ` [PATCH 04/25] iwlwifi: mvm: compare full command ID Luca Coelho
2016-09-19 7:30 ` [PATCH 05/25] iwlwifi: mvm: add support for MU-MIMO air sniffer Luca Coelho
2016-09-19 7:30 ` [PATCH 06/25] iwlwifi: check for valid ethernet address provided by OEM Luca Coelho
2016-09-19 7:30 ` [PATCH 07/25] iwlwifi: mvm: fix DQA AP mode station assumption Luca Coelho
2016-09-19 7:30 ` [PATCH 08/25] iwlwifi: mvm: support BAR in reorder buffer Luca Coelho
2016-09-19 7:30 ` [PATCH 09/25] iwlwifi: mvm: Add support for RRM by scan Luca Coelho
2016-09-19 7:30 ` [PATCH 10/25] iwlwifi: mvm: support packet injection Luca Coelho
2016-09-24 11:19 ` Kalle Valo [this message]
2016-09-26 8:10 ` Sharon, Sara
2016-09-26 8:52 ` Kalle Valo
2016-09-19 7:30 ` [PATCH 11/25] iwlwifi: move BIOS MCC retrieval to common code Luca Coelho
2016-09-19 7:30 ` [PATCH 12/25] iwlwifi: pcie: log full command sequence Luca Coelho
2016-09-19 7:30 ` [PATCH 13/25] iwlwifi: mvm: make iwl_mvm_update_sta() an inline Luca Coelho
2016-09-19 7:30 ` [PATCH 14/25] iwlwifi: move to wide ID for all commands Luca Coelho
2016-09-19 7:30 ` [PATCH 15/25] iwlwifi: mvm: document passing unexpected Block Ack Request frames Luca Coelho
2016-09-19 7:30 ` [PATCH 16/25] iwlwifi: don't export trace points that are used in iwlwifi only Luca Coelho
2016-09-19 7:30 ` [PATCH 17/25] iwlwifi: mvm: disable P2P queue on mac context release Luca Coelho
2016-09-19 7:30 ` [PATCH 18/25] iwlwifi: migrate to devm_* API Luca Coelho
2016-09-19 7:30 ` [PATCH 19/25] iwlwifi: mvm: Add debugfs function for clocks diff Luca Coelho
2016-09-19 7:30 ` [PATCH 20/25] iwlwifi: add new 8265 series PCI ID Luca Coelho
2016-09-19 7:30 ` [PATCH 21/25] iwlwifi: mvm: move AP-specific code to right function Luca Coelho
2016-09-19 7:30 ` [PATCH 22/25] iwlwifi: mvm: Add mem debugfs entry Luca Coelho
2016-09-19 7:30 ` [PATCH 23/25] iwlwifi: mvm: set HCMD_NAME for PHY_DB as well Luca Coelho
2016-09-19 7:30 ` [PATCH 24/25] iwlwifi: mvm: use LIST_HEAD() macro Luca Coelho
2016-09-19 7:30 ` [PATCH 25/25] iwlwifi: pcie: " Luca Coelho
2016-09-19 8:50 ` pull-request: iwlwifi-next 2016-09-19-2 Luca Coelho
2016-09-26 11:12 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oa3d1r5h.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luca@coelho.fi \
--cc=luciano.coelho@intel.com \
--cc=sara.sharon@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).