Commit 8ffcedd6 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: use 'struct' to pack cfg header frame in wilc_wlan_cfg_commit()

Make use of 'struct' to pack cfg header in wilc_wlan_cfg_commit()
instead of byte by byte filling.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4e90d5f3
......@@ -251,7 +251,7 @@ struct wilc {
struct mutex cfg_cmd_lock;
struct wilc_cfg_frame cfg_frame;
u32 cfg_frame_offset;
int cfg_seq_no;
u8 cfg_seq_no;
u8 *rx_buffer;
u32 rx_buffer_offset;
......
......@@ -1092,24 +1092,19 @@ static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
{
struct wilc *wilc = vif->wilc;
struct wilc_cfg_frame *cfg = &wilc->cfg_frame;
int total_len = wilc->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
int seq_no = wilc->cfg_seq_no % 256;
int driver_handler = (u32)drv_handler;
int t_len = wilc->cfg_frame_offset + sizeof(struct wilc_cfg_cmd_hdr);
if (type == WILC_CFG_SET)
cfg->wid_header[0] = 'W';
cfg->hdr.cmd_type = 'W';
else
cfg->wid_header[0] = 'Q';
cfg->wid_header[1] = seq_no;
cfg->wid_header[2] = (u8)total_len;
cfg->wid_header[3] = (u8)(total_len >> 8);
cfg->wid_header[4] = (u8)driver_handler;
cfg->wid_header[5] = (u8)(driver_handler >> 8);
cfg->wid_header[6] = (u8)(driver_handler >> 16);
cfg->wid_header[7] = (u8)(driver_handler >> 24);
wilc->cfg_seq_no = seq_no;
if (!wilc_wlan_txq_add_cfg_pkt(vif, &cfg->wid_header[0], total_len))
cfg->hdr.cmd_type = 'Q';
cfg->hdr.seq_no = wilc->cfg_seq_no % 256;
cfg->hdr.total_len = cpu_to_le16(t_len);
cfg->hdr.driver_handler = cpu_to_le32(drv_handler);
wilc->cfg_seq_no = cfg->hdr.seq_no;
if (!wilc_wlan_txq_add_cfg_pkt(vif, (u8 *)&cfg->hdr, t_len))
return -1;
return 0;
......
......@@ -14,7 +14,6 @@
* Mac eth header length
*
********************************************/
#define DRIVER_HANDLER_SIZE 4
#define MAX_MAC_HDR_LEN 26 /* QOS_MAC_HDR_LEN */
#define SUB_MSDU_HEADER_LENGTH 14
#define SNAP_HDR_LEN 8
......@@ -251,14 +250,21 @@ struct wilc_hif_func {
#define MAX_CFG_FRAME_SIZE 1468
struct wilc_cfg_cmd_hdr {
u8 cmd_type;
u8 seq_no;
__le16 total_len;
__le32 driver_handler;
};
struct wilc_cfg_frame {
u8 wid_header[8];
struct wilc_cfg_cmd_hdr hdr;
u8 frame[MAX_CFG_FRAME_SIZE];
};
struct wilc_cfg_rsp {
int type;
u32 seq_no;
u8 type;
u8 seq_no;
};
struct wilc;
......
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