From: Malcolm Priestley <tvboxspy@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 1/6] staging: vt6656: rxtx.c s_vFillRTSHead Parse out struct vnt_rts_g to new functions.
Date: Mon, 26 Aug 2013 11:04:50 +0100 [thread overview]
Message-ID: <1377511490.3685.32.camel@canaries32-MCP7A> (raw)
Parse out vnt_rts_g code to new function vnt_rxtx_rts_g_head.
Also create a new common calling function vnt_fill_ieee80211_rts
to fill the ieee80211_rts structure.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/staging/vt6656/rxtx.c | 75 +++++++++++++++++++++++++++----------------
1 file changed, 47 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index dd2bfc9..57af55b 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -595,6 +595,50 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
return 0;
}
+static int vnt_fill_ieee80211_rts(struct vnt_private *priv,
+ struct ieee80211_rts *rts, struct ethhdr *eth_hdr,
+ u16 duration)
+{
+ rts->duration = duration;
+ rts->frame_control = TYPE_CTL_RTS;
+
+ if (priv->eOPMode == OP_MODE_ADHOC || priv->eOPMode == OP_MODE_AP)
+ memcpy(rts->ra, eth_hdr->h_dest, ETH_ALEN);
+ else
+ memcpy(rts->ra, priv->abyBSSID, ETH_ALEN);
+
+ if (priv->eOPMode == OP_MODE_AP)
+ memcpy(rts->ta, priv->abyBSSID, ETH_ALEN);
+ else
+ memcpy(rts->ta, eth_hdr->h_source, ETH_ALEN);
+
+ return 0;
+}
+
+static int vnt_rxtx_rts_g_head(struct vnt_private *priv,
+ struct vnt_rts_g *buf, struct ethhdr *eth_hdr,
+ u8 pkt_type, u32 frame_len, int need_ack,
+ u16 current_rate, u8 fb_option)
+{
+ u16 rts_frame_len = 20;
+
+ BBvCalculateParameter(priv, rts_frame_len, priv->byTopCCKBasicRate,
+ PK_TYPE_11B, &buf->b);
+ BBvCalculateParameter(priv, rts_frame_len,
+ priv->byTopOFDMBasicRate, pkt_type, &buf->a);
+
+ buf->wDuration_bb = s_uGetRTSCTSDuration(priv, RTSDUR_BB, frame_len,
+ PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option);
+ buf->wDuration_aa = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
+ buf->wDuration_ba = s_uGetRTSCTSDuration(priv, RTSDUR_BA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
+
+ vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration_aa);
+
+ return 0;
+}
+
static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
void *pvRTS, u32 cbFrameLength, int bNeedAck,
struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption)
@@ -609,35 +653,10 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (byFBOption == AUTO_FB_NONE) {
struct vnt_rts_g *pBuf = (struct vnt_rts_g *)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen,
- pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
- BBvCalculateParameter(pDevice, uRTSFrameLen,
- pDevice->byTopOFDMBasicRate, byPktType, &pBuf->a);
- //Get Duration
- pBuf->wDuration_bb = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
- cbFrameLength, PK_TYPE_11B,
- pDevice->byTopCCKBasicRate, bNeedAck, byFBOption);
- pBuf->wDuration_aa = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
- cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, byFBOption);
- pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice, RTSDUR_BA,
- cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, byFBOption);
- pBuf->data.duration = pBuf->wDuration_aa;
- /*Get RTS Frame body */
- pBuf->data.frame_control = TYPE_CTL_RTS;
- if (pDevice->eOPMode == OP_MODE_ADHOC ||
- pDevice->eOPMode == OP_MODE_AP)
- memcpy(pBuf->data.ra, psEthHeader->h_dest, ETH_ALEN);
- else
- memcpy(pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
-
- if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
- else
- memcpy(pBuf->data.ta, psEthHeader->h_source, ETH_ALEN);
+ vnt_rxtx_rts_g_head(pDevice, pBuf,
+ psEthHeader, byPktType, cbFrameLength,
+ bNeedAck, wCurrentRate, byFBOption);
}
else {
struct vnt_rts_g_fb *pBuf = (struct vnt_rts_g_fb *)pvRTS;
--
1.8.1.2
reply other threads:[~2013-08-26 10:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1377511490.3685.32.camel@canaries32-MCP7A \
--to=tvboxspy@gmail.com \
--cc=gregkh@linuxfoundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox