]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: rtl8192e: Use macro to represent fragmentation threshold
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Mon, 19 Oct 2015 20:00:20 +0000 (22:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:23:13 +0000 (19:23 -0700)
Add CMDPACKET_FRAG_SIZE macro and use it as fragmentation threshold
in send_cmd_pkt functions.
This makes rt_firmware::cmdpacket_frag_thresold and
 rtl92e_init_fw_param() obsolete.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h
drivers/staging/rtl8192e/rtl8192e/rtl_core.h

index 5ff7f2d44afd89098b71922abebc531cb63ac7c0..3de1b25b0155d2982cfb745fe4de335a631f7846 100644 (file)
@@ -23,9 +23,7 @@ bool rtl92e_send_cmd_pkt(struct net_device *dev, u32 type, const void *data,
 
        bool                            rt_status = true;
        struct r8192_priv *priv = rtllib_priv(dev);
-       u16                             frag_threshold;
        u16                             frag_length = 0, frag_offset = 0;
-       struct rt_firmware *pfirmware = priv->pFirmware;
        struct sk_buff          *skb;
        unsigned char           *seg_ptr;
        struct cb_desc *tcb_desc;
@@ -34,12 +32,10 @@ bool rtl92e_send_cmd_pkt(struct net_device *dev, u32 type, const void *data,
        struct tx_fwinfo_8190pci *pTxFwInfo = NULL;
 
        RT_TRACE(COMP_CMDPKT, "%s(),buffer_len is %d\n", __func__, len);
-       rtl92e_init_fw_param(dev);
-       frag_threshold = pfirmware->cmdpacket_frag_thresold;
 
        do {
-               if ((len - frag_offset) > frag_threshold) {
-                       frag_length = frag_threshold;
+               if ((len - frag_offset) > CMDPACKET_FRAG_SIZE) {
+                       frag_length = CMDPACKET_FRAG_SIZE;
                        bLastIniPkt = 0;
 
                } else {
index dab67c12ccc2807802efe17669c63549e7b2bba6..f88e112847a13b72ba8b8bbb12401912fe11870b 100644 (file)
 #include "r8192E_firmware.h"
 #include <linux/firmware.h>
 
-void rtl92e_init_fw_param(struct net_device *dev)
-{
-       struct r8192_priv *priv = rtllib_priv(dev);
-       struct rt_firmware *pfirmware = priv->pFirmware;
-
-       pfirmware->cmdpacket_frag_thresold = GET_COMMAND_PACKET_FRAG_THRESHOLD(
-                                            MAX_TRANSMIT_BUFFER_SIZE);
-}
-
 static bool _rtl92e_fw_download_code(struct net_device *dev,
                                     u8 *code_virtual_address, u32 buffer_len)
 {
        struct r8192_priv *priv = rtllib_priv(dev);
-       u16                 frag_threshold;
        u16                 frag_length, frag_offset = 0;
        int                 i;
-
-       struct rt_firmware *pfirmware = priv->pFirmware;
        struct sk_buff      *skb;
        unsigned char       *seg_ptr;
        struct cb_desc *tcb_desc;
        u8                  bLastIniPkt;
 
-       rtl92e_init_fw_param(dev);
-       frag_threshold = pfirmware->cmdpacket_frag_thresold;
        do {
-               if ((buffer_len - frag_offset) > frag_threshold) {
-                       frag_length = frag_threshold;
+               if ((buffer_len - frag_offset) > CMDPACKET_FRAG_SIZE) {
+                       frag_length = CMDPACKET_FRAG_SIZE;
                        bLastIniPkt = 0;
 
                } else {
index 10aac8c17f5be997588a91fc7b145a2fc27170e6..186c65d6f6d32a11e2efb1fa4aaede1a7c3e0287 100644 (file)
@@ -15,8 +15,6 @@
 #ifndef __INC_FIRMWARE_H
 #define __INC_FIRMWARE_H
 
-#define GET_COMMAND_PACKET_FRAG_THRESHOLD(v)   (4*(v/4) - 8)
-
 #define RTL8192E_BOOT_IMG_FW   "RTL8192E/boot.img"
 #define RTL8192E_MAIN_IMG_FW   "RTL8192E/main.img"
 #define RTL8192E_DATA_IMG_FW   "RTL8192E/data.img"
@@ -48,7 +46,6 @@ enum firmware_status {
 
 struct rt_firmware {
        enum firmware_status firmware_status;
-       u16               cmdpacket_frag_thresold;
 #define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000
 #define MAX_FW_INIT_STEP               3
        u8 firmware_buf[MAX_FW_INIT_STEP][RTL8190_MAX_FIRMWARE_CODE_SIZE];
@@ -56,6 +53,4 @@ struct rt_firmware {
 };
 
 bool rtl92e_init_fw(struct net_device *dev);
-void rtl92e_init_fw_param(struct net_device *dev);
-
 #endif
index 1ddf42a83fb40e2495fb9d5d9dd40916368434e0..a7777a319c024510590b8097fc07b3e2ce251fd9 100644 (file)
@@ -91,6 +91,8 @@
        (1600 + (MAX_802_11_HEADER_LENGTH + ENCRYPTION_MAX_OVERHEAD) *  \
         MAX_FRAGMENT_COUNT)
 
+#define CMDPACKET_FRAG_SIZE (4 * (MAX_TRANSMIT_BUFFER_SIZE / 4) - 8)
+
 #define DEFAULT_FRAG_THRESHOLD 2342U
 #define MIN_FRAG_THRESHOLD     256U
 #define DEFAULT_BEACONINTERVAL 0x64U