Commit 1e7da09a authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Use macro to represent fragmentation threshold

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: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c008fa83
......@@ -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 {
......
......@@ -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 {
......
......@@ -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
......@@ -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
......
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