Commit fca13fd0 authored by Larry Finger's avatar Larry Finger Committed by Kalle Valo

rtlwifi: rtl8723be: Convert inline routines to little-endian words

In this step, the read/write routines for the descriptors are converted
to use __le32 quantities, thus a lot of casts can be removed. Callback
routines still use the 8-bit arrays, but these are changed within the
specified routine.

The macro that cleared a descriptor has now been converted into an inline
routine.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent d7b259fe
...@@ -26,7 +26,8 @@ static u8 _rtl8723be_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) ...@@ -26,7 +26,8 @@ static u8 _rtl8723be_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
} }
static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw, static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw,
struct rtl_stats *pstatus, u8 *pdesc, struct rtl_stats *pstatus,
__le32 *pdesc,
struct rx_fwinfo_8723be *p_drvinfo, struct rx_fwinfo_8723be *p_drvinfo,
bool bpacket_match_bssid, bool bpacket_match_bssid,
bool bpacket_toself, bool bpacket_toself,
...@@ -189,7 +190,7 @@ static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw, ...@@ -189,7 +190,7 @@ static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw,
static void _rtl8723be_translate_rx_signal_stuff(struct ieee80211_hw *hw, static void _rtl8723be_translate_rx_signal_stuff(struct ieee80211_hw *hw,
struct sk_buff *skb, struct sk_buff *skb,
struct rtl_stats *pstatus, struct rtl_stats *pstatus,
u8 *pdesc, __le32 *pdesc,
struct rx_fwinfo_8723be *p_drvinfo) struct rx_fwinfo_8723be *p_drvinfo)
{ {
struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
...@@ -242,7 +243,7 @@ static void _rtl8723be_translate_rx_signal_stuff(struct ieee80211_hw *hw, ...@@ -242,7 +243,7 @@ static void _rtl8723be_translate_rx_signal_stuff(struct ieee80211_hw *hw,
} }
static void _rtl8723be_insert_emcontent(struct rtl_tcb_desc *ptcb_desc, static void _rtl8723be_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
u8 *virtualaddress) __le32 *virtualaddress)
{ {
u32 dwtmp = 0; u32 dwtmp = 0;
memset(virtualaddress, 0, 8); memset(virtualaddress, 0, 8);
...@@ -295,12 +296,13 @@ static void _rtl8723be_insert_emcontent(struct rtl_tcb_desc *ptcb_desc, ...@@ -295,12 +296,13 @@ static void _rtl8723be_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw, bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw,
struct rtl_stats *status, struct rtl_stats *status,
struct ieee80211_rx_status *rx_status, struct ieee80211_rx_status *rx_status,
u8 *pdesc, struct sk_buff *skb) u8 *pdesc8, struct sk_buff *skb)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rx_fwinfo_8723be *p_drvinfo; struct rx_fwinfo_8723be *p_drvinfo;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
u8 wake_match; u8 wake_match;
__le32 *pdesc = (__le32 *)pdesc8;
u32 phystatus = get_rx_desc_physt(pdesc); u32 phystatus = get_rx_desc_physt(pdesc);
status->length = (u16)get_rx_desc_pkt_len(pdesc); status->length = (u16)get_rx_desc_pkt_len(pdesc);
...@@ -400,7 +402,7 @@ bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw, ...@@ -400,7 +402,7 @@ bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw,
} }
void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw, void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw,
struct ieee80211_hdr *hdr, u8 *pdesc_tx, struct ieee80211_hdr *hdr, u8 *pdesc8,
u8 *txbd, struct ieee80211_tx_info *info, u8 *txbd, struct ieee80211_tx_info *info,
struct ieee80211_sta *sta, struct sk_buff *skb, struct ieee80211_sta *sta, struct sk_buff *skb,
u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) u8 hw_queue, struct rtl_tcb_desc *ptcb_desc)
...@@ -410,7 +412,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -410,7 +412,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw,
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtlpriv); struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
struct rtlwifi_tx_info *tx_info = rtl_tx_skb_cb_info(skb); struct rtlwifi_tx_info *tx_info = rtl_tx_skb_cb_info(skb);
u8 *pdesc = (u8 *)pdesc_tx; __le32 *pdesc = (__le32 *)pdesc8;
u16 seq_number; u16 seq_number;
__le16 fc = hdr->frame_control; __le16 fc = hdr->frame_control;
unsigned int buf_len = 0; unsigned int buf_len = 0;
...@@ -446,7 +448,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -446,7 +448,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw,
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "DMA mapping error\n"); RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "DMA mapping error\n");
return; return;
} }
CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_8723be)); clear_pci_tx_desc_content(pdesc, sizeof(struct tx_desc_8723be));
if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) {
firstseg = true; firstseg = true;
lastseg = true; lastseg = true;
...@@ -461,7 +463,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -461,7 +463,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw,
"Insert 8 byte.pTcb->EMPktNum:%d\n", "Insert 8 byte.pTcb->EMPktNum:%d\n",
ptcb_desc->empkt_num); ptcb_desc->empkt_num);
_rtl8723be_insert_emcontent(ptcb_desc, _rtl8723be_insert_emcontent(ptcb_desc,
(u8 *)(skb->data)); (__le32 *)(skb->data));
} }
} else { } else {
set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN); set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
...@@ -556,7 +558,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -556,7 +558,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw,
} }
} }
/* tx report */ /* tx report */
rtl_set_tx_report(ptcb_desc, pdesc, hw, tx_info); rtl_set_tx_report(ptcb_desc, pdesc8, hw, tx_info);
} }
set_tx_desc_first_seg(pdesc, (firstseg ? 1 : 0)); set_tx_desc_first_seg(pdesc, (firstseg ? 1 : 0));
...@@ -584,13 +586,14 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -584,13 +586,14 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw,
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n");
} }
void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc8,
bool firstseg, bool lastseg, bool firstseg, bool lastseg,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
u8 fw_queue = QSLT_BEACON; u8 fw_queue = QSLT_BEACON;
__le32 *pdesc = (__le32 *)pdesc8;
dma_addr_t mapping = pci_map_single(rtlpci->pdev, dma_addr_t mapping = pci_map_single(rtlpci->pdev,
skb->data, skb->len, skb->data, skb->len,
...@@ -601,7 +604,7 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, ...@@ -601,7 +604,7 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
"DMA mapping error\n"); "DMA mapping error\n");
return; return;
} }
CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); clear_pci_tx_desc_content(pdesc, TX_DESC_SIZE);
set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN); set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
...@@ -625,7 +628,7 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, ...@@ -625,7 +628,7 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
set_tx_desc_own(pdesc, 1); set_tx_desc_own(pdesc, 1);
set_tx_desc_pkt_size((u8 *)pdesc, (u16)(skb->len)); set_tx_desc_pkt_size(pdesc, (u16)(skb->len));
set_tx_desc_first_seg(pdesc, 1); set_tx_desc_first_seg(pdesc, 1);
set_tx_desc_last_seg(pdesc, 1); set_tx_desc_last_seg(pdesc, 1);
...@@ -636,9 +639,11 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, ...@@ -636,9 +639,11 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
"H2C Tx Cmd Content\n", pdesc, TX_DESC_SIZE); "H2C Tx Cmd Content\n", pdesc, TX_DESC_SIZE);
} }
void rtl8723be_set_desc(struct ieee80211_hw *hw, u8 *pdesc, void rtl8723be_set_desc(struct ieee80211_hw *hw, u8 *pdesc8,
bool istx, u8 desc_name, u8 *val) bool istx, u8 desc_name, u8 *val)
{ {
__le32 *pdesc = (__le32 *)pdesc8;
if (istx) { if (istx) {
switch (desc_name) { switch (desc_name) {
case HW_DESC_OWN: case HW_DESC_OWN:
...@@ -675,9 +680,10 @@ void rtl8723be_set_desc(struct ieee80211_hw *hw, u8 *pdesc, ...@@ -675,9 +680,10 @@ void rtl8723be_set_desc(struct ieee80211_hw *hw, u8 *pdesc,
} }
u64 rtl8723be_get_desc(struct ieee80211_hw *hw, u64 rtl8723be_get_desc(struct ieee80211_hw *hw,
u8 *pdesc, bool istx, u8 desc_name) u8 *pdesc8, bool istx, u8 desc_name)
{ {
u32 ret = 0; u32 ret = 0;
__le32 *pdesc = (__le32 *)pdesc8;
if (istx) { if (istx) {
switch (desc_name) { switch (desc_name) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment