linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org, pkshih <pkshih@realtek.com>,
	shaofu <shaofu@realtek.com>,
	Larry Finger <Larry.Finger@lwfinger.net>
Subject: [PATCH NEXT 2/7] rtlwifi: Fix programming of CAM content
Date: Mon,  3 Aug 2015 13:53:47 -0500	[thread overview]
Message-ID: <1438628032-5865-3-git-send-email-Larry.Finger@lwfinger.net> (raw)
In-Reply-To: <1438628032-5865-1-git-send-email-Larry.Finger@lwfinger.net>

From: pkshih <pkshih@realtek.com>

There is a potential race condition when the control byte of a CAM entry
is written first.

Signed-off-by: pkshih <pkshih@realtek.com>
Signed-off-by: shaofu <shaofu@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtlwifi/cam.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c
index 8fe8b4c..cc7acbf 100644
--- a/drivers/net/wireless/rtlwifi/cam.c
+++ b/drivers/net/wireless/rtlwifi/cam.c
@@ -45,12 +45,13 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
 
 	u32 target_command;
 	u32 target_content = 0;
-	u8 entry_i;
+	s8 entry_i;
 
 	RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_DMESG, "Key content :",
 		      key_cont_128, 16);
 
-	for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
+	/* 2-5 fill 128key,6-7 are reserved */
+	for (entry_i = CAM_CONTENT_COUNT - 3; entry_i >= 0; entry_i--) {
 		target_command = entry_i + CAM_CONTENT_COUNT * entry_no;
 		target_command = target_command | BIT(31) | BIT(16);
 
@@ -62,6 +63,7 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
 					target_content);
 			rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
 					target_command);
+			udelay(100);
 
 			RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
 				 "WRITE %x: %x\n",
-- 
2.1.4


  parent reply	other threads:[~2015-08-03 18:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 18:53 [PATCH NEXT 0/7] Make changes in rtlwifi and dependent drivers Larry Finger
2015-08-03 18:53 ` [PATCH NEXT 1/7] rtlwifi: rtl8821ae: Remove unsupported 5G channels Larry Finger
2015-08-03 18:53 ` Larry Finger [this message]
2015-08-03 18:53 ` [PATCH NEXT 3/7] rtlwifi: Make retry limits depend on vif type Larry Finger
2015-08-03 18:53 ` [PATCH NEXT 4/7] rtlwifi: Force disable key to wait until TX acked Larry Finger
2015-08-03 18:53 ` [PATCH NEXT 5/7] rtlwifi: rtl8192ee: Implement new rekey logic Larry Finger
2015-08-03 18:53 ` [PATCH NEXT 6/7] rtlwifi: rtl8723be: " Larry Finger
2015-08-03 18:53 ` [PATCH NEXT 7/7] rtlwifi: rtl8821ae: " Larry Finger

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=1438628032-5865-3-git-send-email-Larry.Finger@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=shaofu@realtek.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).