All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arik Nemtsov <arik@wizery.com>
To: <linux-wireless@vger.kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	Johannes Berg <johannes.berg@intel.com>,
	Arik Nemtsov <arik@wizery.com>
Subject: [PATCH 05/16] mac80211: add function to create data frame template including key
Date: Sun,  9 Nov 2014 18:50:11 +0200	[thread overview]
Message-ID: <1415551822-20121-5-git-send-email-arik@wizery.com> (raw)
In-Reply-To: <1415551822-20121-1-git-send-email-arik@wizery.com>

From: Johannes Berg <johannes.berg@intel.com>

For some TDLS channel switch implementations data frames need to be
sent by the firmware based on a template. This template should be
created by mac80211, and thus needs to properly be built from an
802.3 frame into an 802.11 frame. In addition, the device will need
the key information so the select_key handler needs to be run.
However, the driver/device will be responsible for all of the crypto
encapsulation, as the sequence numbers etc. cannot be built by the
host anyway in this case since it's a template to be used multiple
times.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/tx.c          | 31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 00cda1e..53eb41f 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1634,6 +1634,9 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
 				  u32 info_flags);
 void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
 			      struct sk_buff_head *skbs);
+struct sk_buff *
+ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
+			      struct sk_buff *skb, u32 info_flags);
 
 /* HT */
 void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index f67131a..54007ce 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2277,6 +2277,37 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 	return NETDEV_TX_OK;
 }
 
+struct sk_buff *
+ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
+			      struct sk_buff *skb, u32 info_flags)
+{
+	struct ieee80211_hdr *hdr;
+	struct ieee80211_tx_data tx = {
+		.local = sdata->local,
+		.sdata = sdata,
+	};
+
+	rcu_read_lock();
+
+	skb = ieee80211_build_hdr(sdata, skb, info_flags);
+	if (IS_ERR(skb))
+		goto out;
+
+	hdr = (void *)skb->data;
+	tx.sta = sta_info_get(sdata, hdr->addr1);
+	tx.skb = skb;
+
+	if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) {
+		rcu_read_unlock();
+		kfree_skb(skb);
+		return ERR_PTR(-EINVAL);
+	}
+
+out:
+	rcu_read_unlock();
+	return skb;
+}
+
 /*
  * ieee80211_clear_tx_pending may not be called in a context where
  * it is possible that it packets could come in again.
-- 
1.9.1


  parent reply	other threads:[~2014-11-09 16:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-09 16:50 [PATCH 01/16] mac80211: add option for setting skb flags before xmit Arik Nemtsov
2014-11-09 16:50 ` [PATCH 02/16] mac80211: retransmit TDLS teardown packet through AP if not ACKed Arik Nemtsov
2014-11-09 16:50 ` [PATCH 03/16] mac80211: move skb info band assignment out Arik Nemtsov
2014-11-09 16:50 ` [PATCH 04/16] mac80211: factor out 802.11 header building code Arik Nemtsov
2014-11-09 16:50 ` Arik Nemtsov [this message]
2014-11-09 16:50 ` [PATCH 06/16] mac80211: add supported channels IE during TDLS setup Arik Nemtsov
2014-11-09 16:50 ` [PATCH 07/16] mac80211: add BSS coex IE to TDLS setup frames Arik Nemtsov
2014-11-09 16:50 ` [PATCH 08/16] cfg/mac80211: define TDLS channel switch feature bit Arik Nemtsov
2014-11-09 16:50 ` [PATCH 09/16] mac80211: track AP and peer STA TDLS chan-switch support Arik Nemtsov
2014-11-09 16:50 ` [PATCH 10/16] mac80211: prepare TDLS mgmt code for channel-switch templates Arik Nemtsov
2014-11-09 16:50 ` [PATCH 11/16] cfg80211: introduce TDLS channel switch commands Arik Nemtsov
2014-11-09 19:50   ` Arend van Spriel
2014-11-10  9:03     ` Arik Nemtsov
2014-11-19 10:54   ` [PATCH v2 " Arik Nemtsov
2014-11-09 16:50 ` [PATCH 12/16] mac80211: add parsing of TDLS specific IEs Arik Nemtsov
2014-11-09 16:50 ` [PATCH 13/16] mac80211: introduce TDLS channel switch ops Arik Nemtsov
2014-11-09 16:50 ` [PATCH 14/16] mac80211: add TDLS channel-switch Rx flow Arik Nemtsov
2014-11-09 16:50 ` [PATCH 15/16] mac80211: add specific-queue flushing support Arik Nemtsov
2014-11-09 16:50 ` [PATCH 16/16] mac80211: synchronously reserve TID per station Arik Nemtsov
2014-11-19 11:22   ` Johannes Berg
2014-11-19 11:40     ` Arik Nemtsov
2014-11-19 11:41       ` Johannes Berg
2014-11-19 11:43         ` Arik Nemtsov
2014-11-19 11:47   ` [PATCH v2 " Arik Nemtsov
2014-11-19 17:25 ` [PATCH 01/16] mac80211: add option for setting skb flags before xmit Johannes Berg

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=1415551822-20121-5-git-send-email-arik@wizery.com \
    --to=arik@wizery.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.