Skip to content

Commit e53e30b

Browse files
lwfingerKalle Valo
authored andcommitted
rtlwifi: rtl8188ee: 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: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 36eda75 commit e53e30b

3 files changed

Lines changed: 243 additions & 237 deletions

File tree

‎drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,12 +1411,13 @@ void rtl88e_dm_set_tx_ant_by_tx_info(struct ieee80211_hw *hw,
14111411
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
14121412
struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw));
14131413
struct fast_ant_training *pfat_table = &rtldm->fat_table;
1414+
__le32 *pdesc32 = (__le32 *)pdesc;
14141415

14151416
if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) ||
14161417
(rtlefuse->antenna_div_type == CG_TRX_SMART_ANTDIV)) {
1417-
set_tx_desc_antsel_a(pdesc, pfat_table->antsel_a[mac_id]);
1418-
set_tx_desc_antsel_b(pdesc, pfat_table->antsel_b[mac_id]);
1419-
set_tx_desc_antsel_c(pdesc, pfat_table->antsel_c[mac_id]);
1418+
set_tx_desc_antsel_a(pdesc32, pfat_table->antsel_a[mac_id]);
1419+
set_tx_desc_antsel_b(pdesc32, pfat_table->antsel_b[mac_id]);
1420+
set_tx_desc_antsel_c(pdesc32, pfat_table->antsel_c[mac_id]);
14201421
}
14211422
}
14221423

‎drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c‎

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static u8 _rtl88ee_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
2525
}
2626

2727
static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw,
28-
struct rtl_stats *pstatus, u8 *pdesc,
28+
struct rtl_stats *pstatus, __le32 *pdesc,
2929
struct rx_fwinfo_88e *p_drvinfo,
3030
bool bpacket_match_bssid,
3131
bool bpacket_toself, bool packet_beacon)
@@ -271,7 +271,7 @@ static void _rtl88ee_smart_antenna(struct ieee80211_hw *hw,
271271
static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw,
272272
struct sk_buff *skb,
273273
struct rtl_stats *pstatus,
274-
u8 *pdesc,
274+
__le32 *pdesc,
275275
struct rx_fwinfo_88e *p_drvinfo)
276276
{
277277
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -313,8 +313,8 @@ static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw,
313313
rtl_process_phyinfo(hw, tmp_buf, pstatus);
314314
}
315315

316-
static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
317-
u8 *virtualaddress)
316+
static void rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
317+
__le32 *virtualaddress)
318318
{
319319
u32 dwtmp = 0;
320320
memset(virtualaddress, 0, 8);
@@ -367,12 +367,13 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
367367
bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
368368
struct rtl_stats *status,
369369
struct ieee80211_rx_status *rx_status,
370-
u8 *pdesc, struct sk_buff *skb)
370+
u8 *pdesc8, struct sk_buff *skb)
371371
{
372372
struct rtl_priv *rtlpriv = rtl_priv(hw);
373373
struct rx_fwinfo_88e *p_drvinfo;
374374
struct ieee80211_hdr *hdr;
375375
u8 wake_match;
376+
__le32 *pdesc = (__le32 *)pdesc8;
376377
u32 phystatus = get_rx_desc_physt(pdesc);
377378

378379
status->packet_report_type = (u8)get_rx_status_desc_rpt_sel(pdesc);
@@ -473,7 +474,7 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
473474
}
474475

475476
void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
476-
struct ieee80211_hdr *hdr, u8 *pdesc_tx,
477+
struct ieee80211_hdr *hdr, u8 *pdesc8,
477478
u8 *txbd, struct ieee80211_tx_info *info,
478479
struct ieee80211_sta *sta,
479480
struct sk_buff *skb,
@@ -484,7 +485,6 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
484485
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
485486
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
486487
struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
487-
u8 *pdesc = (u8 *)pdesc_tx;
488488
u16 seq_number;
489489
__le16 fc = hdr->frame_control;
490490
unsigned int buf_len = 0;
@@ -497,6 +497,7 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
497497
dma_addr_t mapping;
498498
u8 bw_40 = 0;
499499
u8 short_gi = 0;
500+
__le32 *pdesc = (u32 *)pdesc8;
500501

501502
if (mac->opmode == NL80211_IFTYPE_STATION) {
502503
bw_40 = mac->bw_40;
@@ -521,7 +522,7 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
521522
"DMA mapping error\n");
522523
return;
523524
}
524-
CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_88e));
525+
clear_pci_tx_desc_content(pdesc, sizeof(struct tx_desc_88e));
525526
if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) {
526527
firstseg = true;
527528
lastseg = true;
@@ -535,8 +536,8 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
535536
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
536537
"Insert 8 byte.pTcb->EMPktNum:%d\n",
537538
ptcb_desc->empkt_num);
538-
_rtl88ee_insert_emcontent(ptcb_desc,
539-
(u8 *)(skb->data));
539+
rtl88ee_insert_emcontent(ptcb_desc,
540+
(__le32 *)(skb->data));
540541
}
541542
} else {
542543
set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
@@ -660,17 +661,18 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
660661
set_tx_desc_bmc(pdesc, 1);
661662
}
662663

663-
rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc, ptcb_desc->mac_id);
664+
rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc8, ptcb_desc->mac_id);
664665
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n");
665666
}
666667

667668
void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
668-
u8 *pdesc, bool firstseg,
669+
u8 *pdesc8, bool firstseg,
669670
bool lastseg, struct sk_buff *skb)
670671
{
671672
struct rtl_priv *rtlpriv = rtl_priv(hw);
672673
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
673674
u8 fw_queue = QSLT_BEACON;
675+
__le32 *pdesc = (__le32 *)pdesc8;
674676

675677
dma_addr_t mapping = pci_map_single(rtlpci->pdev,
676678
skb->data, skb->len,
@@ -684,7 +686,7 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
684686
"DMA mapping error\n");
685687
return;
686688
}
687-
CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE);
689+
clear_pci_tx_desc_content(pdesc, TX_DESC_SIZE);
688690

689691
if (firstseg)
690692
set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
@@ -726,9 +728,11 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
726728
pdesc, TX_DESC_SIZE);
727729
}
728730

729-
void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc,
731+
void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc8,
730732
bool istx, u8 desc_name, u8 *val)
731733
{
734+
__le32 *pdesc = (__le32 *)pdesc8;
735+
732736
if (istx == true) {
733737
switch (desc_name) {
734738
case HW_DESC_OWN:
@@ -765,9 +769,10 @@ void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc,
765769
}
766770

767771
u64 rtl88ee_get_desc(struct ieee80211_hw *hw,
768-
u8 *pdesc, bool istx, u8 desc_name)
772+
u8 *pdesc8, bool istx, u8 desc_name)
769773
{
770774
u32 ret = 0;
775+
__le32 *pdesc = (__le32 *)pdesc8;
771776

772777
if (istx == true) {
773778
switch (desc_name) {

0 commit comments

Comments
 (0)