rtlwifi: pass struct rtl_stats by reference as it is more efficient
authorColin Ian King <colin.king@canonical.com>
Mon, 22 Feb 2016 11:35:46 +0000 (11:35 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 7 Mar 2016 12:25:00 +0000 (14:25 +0200)
passing rtl_stats by value is inefficient; the structure is over 300
bytes in size and generally just one field (packet_report_type)
is being accessed, so the pass by value is a relatively large overhead.
This change just affects just the rx_command_packet calls.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
12 files changed:
drivers/net/wireless/realtek/rtlwifi/pci.c
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h
drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c
drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h
drivers/net/wireless/realtek/rtlwifi/wifi.h

index 140d254..283d608 100644 (file)
@@ -855,7 +855,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
                }
                /* handle command packet here */
                if (rtlpriv->cfg->ops->rx_command_packet &&
-                   rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) {
+                   rtlpriv->cfg->ops->rx_command_packet(hw, &stats, skb)) {
                                dev_kfree_skb_any(skb);
                                goto new_trx_end;
                }
index 791efbe..1170106 100644 (file)
@@ -851,7 +851,7 @@ void rtl88ee_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
 }
 
 u32 rtl88ee_rx_command_packet(struct ieee80211_hw *hw,
-                             struct rtl_stats status,
+                             const struct rtl_stats *status,
                              struct sk_buff *skb)
 {
        return 0;
index eab5ae0..5a24d19 100644 (file)
@@ -790,7 +790,7 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
                             bool firstseg, bool lastseg,
                             struct sk_buff *skb);
 u32 rtl88ee_rx_command_packet(struct ieee80211_hw *hw,
-                             struct rtl_stats status,
+                             const struct rtl_stats *status,
                              struct sk_buff *skb);
 
 #endif
index d39ee67..24eff8e 100644 (file)
@@ -1105,13 +1105,13 @@ void rtl92ee_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
 }
 
 u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
-                             struct rtl_stats status,
+                             const struct rtl_stats *status,
                              struct sk_buff *skb)
 {
        u32 result = 0;
        struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-       switch (status.packet_report_type) {
+       switch (status->packet_report_type) {
        case NORMAL_RX:
                result = 0;
                break;
@@ -1121,7 +1121,7 @@ u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
                break;
        default:
                RT_TRACE(rtlpriv, COMP_RECV, DBG_TRACE,
-                        "Unknown packet type %d\n", status.packet_report_type);
+                        "Unknown packet type %d\n", status->packet_report_type);
                break;
        }
 
index 8f78ac9..a4c3834 100644 (file)
@@ -857,6 +857,6 @@ void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
                             bool firstseg, bool lastseg,
                             struct sk_buff *skb);
 u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
-                             struct rtl_stats status,
+                             const struct rtl_stats *status,
                              struct sk_buff *skb);
 #endif
index 2f7c144..7b4a9b6 100644 (file)
@@ -710,7 +710,7 @@ void rtl8723e_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
 }
 
 u32 rtl8723e_rx_command_packet(struct ieee80211_hw *hw,
-                              struct rtl_stats status,
+                              const struct rtl_stats *status,
                               struct sk_buff *skb)
 {
        return 0;
index 017da7e..32970bf 100644 (file)
@@ -716,6 +716,6 @@ void rtl8723e_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
                              bool firstseg, bool lastseg,
                              struct sk_buff *skb);
 u32 rtl8723e_rx_command_packet(struct ieee80211_hw *hw,
-                              struct rtl_stats status,
+                              const struct rtl_stats *status,
                               struct sk_buff *skb);
 #endif
index 338ec9a..6034597 100644 (file)
@@ -758,13 +758,13 @@ void rtl8723be_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
 }
 
 u32 rtl8723be_rx_command_packet(struct ieee80211_hw *hw,
-                               struct rtl_stats status,
+                               const struct rtl_stats *status,
                                struct sk_buff *skb)
 {
        u32 result = 0;
        struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-       switch (status.packet_report_type) {
+       switch (status->packet_report_type) {
        case NORMAL_RX:
                        result = 0;
                        break;
index 45949ac..40c3660 100644 (file)
@@ -620,6 +620,6 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
                               bool firstseg, bool lastseg,
                               struct sk_buff *skb);
 u32 rtl8723be_rx_command_packet(struct ieee80211_hw *hw,
-                               struct rtl_stats status,
+                               const struct rtl_stats *status,
                                struct sk_buff *skb);
 #endif
index 174743a..41efaa1 100644 (file)
@@ -998,13 +998,13 @@ void rtl8821ae_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
 }
 
 u32 rtl8821ae_rx_command_packet(struct ieee80211_hw *hw,
-                               struct rtl_stats status,
+                               const struct rtl_stats *status,
                                struct sk_buff *skb)
 {
        u32 result = 0;
        struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-       switch (status.packet_report_type) {
+       switch (status->packet_report_type) {
        case NORMAL_RX:
                result = 0;
                break;
index 3140904..ad565be 100644 (file)
@@ -615,6 +615,6 @@ void rtl8821ae_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
                               bool firstseg, bool lastseg,
                               struct sk_buff *skb);
 u32 rtl8821ae_rx_command_packet(struct ieee80211_hw *hw,
-                               struct rtl_stats status,
+                               const struct rtl_stats *status,
                                struct sk_buff *skb);
 #endif
index 9e3cdd7..b07b364 100644 (file)
@@ -2189,7 +2189,7 @@ struct rtl_hal_ops {
        bool (*get_btc_status) (void);
        bool (*is_fw_header)(struct rtlwifi_firmware_header *hdr);
        u32 (*rx_command_packet)(struct ieee80211_hw *hw,
-                                struct rtl_stats status, struct sk_buff *skb);
+                                const struct rtl_stats *status, struct sk_buff *skb);
        void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
                                   struct rtl_wow_pattern *rtl_pattern,
                                   u8 index);