linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Pedersen <thomas@cozybit.com>
To: linux-wireless@vger.kernel.org
Cc: mwl8k-devel@cozybit.com, buytenh@wantstofly.org,
	Nishant Sarmukadam <nishants@marvell.com>,
	Pradeep Nemavat <pnemavat@marvell.com>,
	Thomas Pedersen <thomas@cozybit.com>
Subject: [PATCH 1/4] mwl8k: Modify add_dma_header to include pad parameters
Date: Tue, 28 Dec 2010 15:01:34 -0800	[thread overview]
Message-ID: <1293577297-25755-2-git-send-email-thomas@cozybit.com> (raw)
In-Reply-To: <1293577297-25755-1-git-send-email-thomas@cozybit.com>

From: Nishant Sarmukadam <nishants@marvell.com>

Add capability to add_dma_header to support padding at head
and tail of the data packet to be transmitted when crypto is
enabled. Padding is required for adding crypto information
in data packets for supporting 802.11 security modes.

Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: Pradeep Nemavat <pnemavat@marvell.com>
Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
---
 drivers/net/wireless/mwl8k.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 9ecf840..771283b 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -715,10 +715,12 @@ static inline void mwl8k_remove_dma_header(struct sk_buff *skb, __le16 qos)
 		skb_pull(skb, sizeof(*tr) - hdrlen);
 }
 
-static inline void mwl8k_add_dma_header(struct sk_buff *skb)
+static void
+mwl8k_add_dma_header(struct sk_buff *skb, int hdr_pad, int tail_pad)
 {
 	struct ieee80211_hdr *wh;
 	int hdrlen;
+	int reqd_hdrlen;
 	struct mwl8k_dma_data *tr;
 
 	/*
@@ -730,8 +732,10 @@ static inline void mwl8k_add_dma_header(struct sk_buff *skb)
 	wh = (struct ieee80211_hdr *)skb->data;
 
 	hdrlen = ieee80211_hdrlen(wh->frame_control);
-	if (hdrlen != sizeof(*tr))
-		skb_push(skb, sizeof(*tr) - hdrlen);
+	reqd_hdrlen = sizeof(*tr) + hdr_pad;
+
+	if (hdrlen != reqd_hdrlen)
+		skb_push(skb, reqd_hdrlen - hdrlen);
 
 	if (ieee80211_is_data_qos(wh->frame_control))
 		hdrlen -= 2;
@@ -739,8 +743,12 @@ static inline void mwl8k_add_dma_header(struct sk_buff *skb)
 	tr = (struct mwl8k_dma_data *)skb->data;
 	if (wh != &tr->wh)
 		memmove(&tr->wh, wh, hdrlen);
-	if (hdrlen != sizeof(tr->wh))
-		memset(((void *)&tr->wh) + hdrlen, 0, sizeof(tr->wh) - hdrlen);
+	if (hdrlen != sizeof(tr->wh) + hdr_pad)
+		memset(((void *)&tr->wh) + hdrlen, 0,
+					sizeof(tr->wh) + hdr_pad - hdrlen);
+
+	if (tail_pad)
+		skb_put(skb, tail_pad);
 
 	/*
 	 * Firmware length is the length of the fully formed "802.11
@@ -1443,7 +1451,7 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb)
 	else
 		qos = 0;
 
-	mwl8k_add_dma_header(skb);
+	mwl8k_add_dma_header(skb, 0, 0);
 	wh = &((struct mwl8k_dma_data *)skb->data)->wh;
 
 	tx_info = IEEE80211_SKB_CB(skb);
-- 
1.7.0.4


  reply	other threads:[~2010-12-28 23:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 23:01 [PATCH 0/4] mwl8k: Add HW crypto support for AP mode Thomas Pedersen
2010-12-28 23:01 ` Thomas Pedersen [this message]
2010-12-28 23:01 ` [PATCH 2/4] mwl8k: Add encapsulation of data packet for crypto Thomas Pedersen
2010-12-29  9:14   ` Johannes Berg
2010-12-28 23:01 ` [PATCH 3/4] mwl8k: Set mac80211 rx status flags appropriately when hw crypto is enabled Thomas Pedersen
2010-12-29  9:15   ` Johannes Berg
2010-12-28 23:01 ` [PATCH 4/4] mwl8k: Enable HW encryption for AP mode Thomas Pedersen
2010-12-29  9:17   ` Johannes Berg
2010-12-29  9:18     ` 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=1293577297-25755-2-git-send-email-thomas@cozybit.com \
    --to=thomas@cozybit.com \
    --cc=buytenh@wantstofly.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mwl8k-devel@cozybit.com \
    --cc=nishants@marvell.com \
    --cc=pnemavat@marvell.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).