Commit 96287ac4 authored by Brajesh Dave's avatar Brajesh Dave Committed by David S. Miller

libertas: configurable beacon interval

Requires firmware version 5.110.19.p0 or newer, available here:
http://dev.laptop.org/pub/firmware/libertas/Signed-off-by: default avatarAshish Shukla <ashishs@marvell.com>
Signed-off-by: default avatarJavier Cardona <javier@cozybit.com>
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 01d77d8d
......@@ -901,6 +901,28 @@ static int lbs_cmd_mesh_access(lbs_private * priv,
return 0;
}
static int lbs_cmd_bcn_ctrl(struct lbs_private * priv,
struct cmd_ds_command *cmd,
u16 cmd_action)
{
struct cmd_ds_802_11_beacon_control
*bcn_ctrl = &cmd->params.bcn_ctrl;
struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_CMD);
cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_beacon_control)
+ S_DS_GEN);
cmd->command = cpu_to_le16(CMD_802_11_BEACON_CTRL);
bcn_ctrl->action = cpu_to_le16(cmd_action);
bcn_ctrl->beacon_enable = cpu_to_le16(adapter->beacon_enable);
bcn_ctrl->beacon_period = cpu_to_le16(adapter->beacon_period);
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
static int lbs_cmd_set_boot2_ver(lbs_private * priv,
struct cmd_ds_command *cmd,
u16 cmd_action, void *pdata_buf)
......@@ -1400,6 +1422,9 @@ int lbs_prepare_and_send_command(lbs_private * priv,
S_DS_GEN);
ret = 0;
break;
case CMD_802_11_BEACON_CTRL:
ret = lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action);
break;
default:
lbs_deb_host("PREP_CMD: unknown command 0x%04x\n", cmd_no);
ret = -1;
......
......@@ -536,6 +536,24 @@ static int lbs_ret_802_11_enable_rsn(lbs_private * priv,
return 0;
}
static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
struct cmd_ds_command *resp)
{
struct cmd_ds_802_11_beacon_control *bcn_ctrl =
&resp->params.bcn_ctrl;
struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_CMD);
if (bcn_ctrl->action == CMD_ACT_GET) {
adapter->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable);
adapter->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period);
}
lbs_deb_enter(LBS_DEB_CMD);
return 0;
}
static inline int handle_cmd_response(u16 respcmd,
struct cmd_ds_command *resp,
lbs_private *priv)
......@@ -704,6 +722,10 @@ static inline int handle_cmd_response(u16 respcmd,
memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh,
sizeof(resp->params.mesh));
break;
case CMD_RET(CMD_802_11_BEACON_CTRL):
ret = lbs_ret_802_11_bcn_ctrl(priv, resp);
break;
default:
lbs_deb_host("CMD_RESP: unknown cmd response 0x%04x\n",
resp->command);
......
......@@ -263,6 +263,8 @@ struct _lbs_adapter {
struct list_head network_free_list;
struct bss_descriptor *networks;
u16 beacon_period;
u8 beacon_enable;
u8 adhoccreate;
/** capability Info used in Association, start, join */
......
......@@ -116,6 +116,8 @@
#define CMD_SET_BOOT2_VER 0x00a5
#define CMD_802_11_BEACON_CTRL 0x00b0
/* For the IEEE Power Save */
#define CMD_SUBCMD_ENTER_PS 0x0030
#define CMD_SUBCMD_EXIT_PS 0x0031
......
......@@ -332,6 +332,12 @@ struct cmd_ds_802_11_radio_control {
__le16 control;
};
struct cmd_ds_802_11_beacon_control {
__le16 action;
__le16 beacon_enable;
__le16 beacon_period;
};
struct cmd_ds_802_11_sleep_params {
/* ACT_GET/ACT_SET */
__le16 action;
......@@ -668,6 +674,7 @@ struct cmd_ds_command {
struct cmd_ds_set_boot2_ver boot2_ver;
struct cmd_ds_get_tsf gettsf;
struct cmd_ds_802_11_subscribe_event subscribe_event;
struct cmd_ds_802_11_beacon_control bcn_ctrl;
} params;
} __attribute__ ((packed));
......
......@@ -510,7 +510,9 @@ int lbs_cmd_80211_ad_hoc_start(lbs_private *priv,
/* set the BSS type */
adhs->bsstype = CMD_BSS_TYPE_IBSS;
adapter->mode = IW_MODE_ADHOC;
adhs->beaconperiod = cpu_to_le16(MRVDRV_BEACON_INTERVAL);
if (adapter->beacon_period == 0)
adapter->beacon_period = MRVDRV_BEACON_INTERVAL;
adhs->beaconperiod = cpu_to_le16(adapter->beacon_period);
/* set Physical param set */
#define DS_PARA_IE_ID 3
......
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