From: Larry Finger <Larry.Finger@lwfinger.net>
To: Karsten Wiese <fzuuzf@googlemail.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/3] rtl8192cu: Prevent Ooops under rtl92c_set_fw_rsvdpagepkt
Date: Wed, 22 Oct 2014 11:35:07 -0500 [thread overview]
Message-ID: <5447DCBB.9020009@lwfinger.net> (raw)
In-Reply-To: <1413985654-25070-4-git-send-email-fzuuzf@googlemail.com>
On 10/22/2014 08:47 AM, Karsten Wiese wrote:
> rtl92c_set_fw_rsvdpagepkt is used by rtl8192cu and its pci sibling rtl8192ce.
> rtl_cmd_send_packet crashes when called inside rtl8192cu because it works on
> memory allocated only by rtl8192ce.
> Fix the crash by calling a dummy function when used in rtl8192cu.
> Comparision with the realtek vendor driver makes me think, something is missing in
> the dummy function.
> Short test as WPA2 station show good results connected to an 802.11g basestation.
> Traffic stops after few MBytes as WPA2 station connected to an 802.11n basestation.
>
> Signed-off-by: Karsten Wiese <fzuuzf@googlemail.com>
This one needs to be applied; however, I will be taking another look at it after
I finish my traveling.
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Larry
> ---
> drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c | 8 ++++++--
> drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h | 4 +++-
> drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 2 +-
> drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 17 ++++++++++++++++-
> drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | 1 -
> 5 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
> index a00861b..29983bc 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
> @@ -656,7 +656,8 @@ static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = {
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> };
>
> -void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
> +void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
> + bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *))
> {
> struct rtl_priv *rtlpriv = rtl_priv(hw);
> struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
> @@ -722,7 +723,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
> memcpy((u8 *)skb_put(skb, totalpacketlen),
> &reserved_page_packet, totalpacketlen);
>
> - rtstatus = rtl_cmd_send_packet(hw, skb);
> + if (cmd_send_packet)
> + rtstatus = cmd_send_packet(hw, skb);
> + else
> + rtstatus = rtl_cmd_send_packet(hw, skb);
>
> if (rtstatus)
> b_dlok = true;
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
> index a815bd6..b64ae45 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
> +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
> @@ -109,7 +109,9 @@ void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
> u32 cmd_len, u8 *p_cmdbuffer);
> void rtl92c_firmware_selfreset(struct ieee80211_hw *hw);
> void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
> -void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished);
> +void rtl92c_set_fw_rsvdpagepkt
> + (struct ieee80211_hw *hw,
> + bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *));
> void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
> void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len);
> void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state);
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
> index 8ec0f03..55357d6 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
> @@ -459,7 +459,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
> rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2,
> tmp_reg422 & (~BIT(6)));
>
> - rtl92c_set_fw_rsvdpagepkt(hw, 0);
> + rtl92c_set_fw_rsvdpagepkt(hw, NULL);
>
> _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0);
> _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(4));
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
> index 04aa0b5..873363a 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
> @@ -1592,6 +1592,20 @@ void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
> }
> }
>
> +bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
> +{
> + /* Currently nothing happens here.
> + * Traffic stops after some seconds in WPA2 802.11n mode.
> + * Maybe because rtl8192cu chip should be set from here?
> + * If I understand correctly, the realtek vendor driver sends some urbs
> + * if its "here".
> + *
> + * This is maybe necessary:
> + * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb);
> + */
> + return true;
> +}
> +
> void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
> {
> struct rtl_priv *rtlpriv = rtl_priv(hw);
> @@ -1939,7 +1953,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
> recover = true;
> rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2,
> tmp_reg422 & (~BIT(6)));
> - rtl92c_set_fw_rsvdpagepkt(hw, 0);
> + rtl92c_set_fw_rsvdpagepkt(hw,
> + &usb_cmd_send_packet);
> _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0);
> _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4));
> if (recover)
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
> index 0f7812e..c1e33b0 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
> @@ -104,7 +104,6 @@ bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid);
> void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid);
> int rtl92c_download_fw(struct ieee80211_hw *hw);
> void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
> -void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished);
> void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
> void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw,
> u8 element_id, u32 cmd_len, u8 *p_cmdbuffer);
>
prev parent reply other threads:[~2014-10-22 16:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 13:47 [PATCH 0/3] Fix rtl8192cu in 3.18-rc1 Karsten Wiese
2014-10-22 13:47 ` [PATCH 1/3] rtl8192cu: Fix for rtlwifi's bluetooth coexist functionality Karsten Wiese
2014-10-22 16:30 ` Larry Finger
2014-10-22 13:47 ` [PATCH 2/3] rtl8192cu: Call ieee80211_register_hw from rtl_usb_probe Karsten Wiese
2014-10-22 16:31 ` Larry Finger
2014-10-22 13:47 ` [PATCH 3/3] rtl8192cu: Prevent Ooops under rtl92c_set_fw_rsvdpagepkt Karsten Wiese
2014-10-22 16:35 ` Larry Finger [this message]
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=5447DCBB.9020009@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=fzuuzf@googlemail.com \
--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;
as well as URLs for NNTP newsgroup(s).