[PATCH 06/16] staging: rtl8192e: Use macro to represent fragmentation threshold

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c   |  8 ++------
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 18 ++----------------
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h |  5 -----
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h        |  2 ++
 4 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
index 5ff7f2d..3de1b25 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
@@ -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 {
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index dab67c1..f88e112 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -19,34 +19,20 @@
 #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 {
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h
index 10aac8c..186c65d 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h
@@ -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
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index 1ddf42a..a7777a3 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -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
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux