union message_body body;
struct wilc_vif *vif;
struct work_struct work;
+ void (*fn)(struct work_struct *ws);
};
struct join_bss_param {
static void *host_int_parse_join_bss_param(struct network_info *info);
static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt);
-static void host_if_work(struct work_struct *work);
/*!
* @author syounan
if (!new_msg)
return -ENOMEM;
- INIT_WORK(&new_msg->work, host_if_work);
+ INIT_WORK(&new_msg->work, msg->fn);
queue_work(hif_workqueue, &new_msg->work);
return 0;
}
return wilc->vif[index];
}
-static void handle_set_channel(struct wilc_vif *vif,
- struct channel_attr *hif_set_ch)
+static void handle_set_channel(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct channel_attr *hif_set_ch = &msg->body.channel_info;
int ret = 0;
struct wid wid;
if (ret)
netdev_err(vif->ndev, "Failed to set channel\n");
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static int handle_set_wfi_drv_handler(struct wilc_vif *vif,
- struct drv_handler *hif_drv_handler)
+static void handle_set_wfi_drv_handler(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct drv_handler *hif_drv_handler = &msg->body.drv;
int ret = 0;
struct wid wid;
u8 *currbyte, *buffer;
struct host_if_drv *hif_drv = NULL;
- if (!vif->hif_drv)
- return -EINVAL;
-
- if (!hif_drv_handler)
- return -EINVAL;
+ if (!vif->hif_drv || !hif_drv_handler)
+ goto free_msg;
hif_drv = vif->hif_drv;
buffer = kzalloc(DRV_HANDLER_SIZE, GFP_KERNEL);
if (!buffer)
- return -ENOMEM;
+ goto free_msg;
currbyte = buffer;
*currbyte = hif_drv->driver_handler_id & DRV_HANDLER_MASK;
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
hif_drv->driver_handler_id);
- if (ret) {
+ if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
- complete(&hif_driver_comp);
- kfree(buffer);
- return ret;
- }
+
complete(&hif_driver_comp);
kfree(buffer);
- return 0;
+
+free_msg:
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_set_operation_mode(struct wilc_vif *vif,
- struct op_mode *hif_op_mode)
+static void handle_set_operation_mode(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct op_mode *hif_op_mode = &msg->body.mode;
int ret = 0;
struct wid wid;
if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
+static void handle_set_ip_address(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ u8 *ip_addr = msg->body.ip_info.ip_addr;
+ u8 idx = msg->body.ip_info.idx;
int ret = 0;
struct wid wid;
char firmware_ip_addr[4] = {0};
if (ret)
netdev_err(vif->ndev, "Failed to set IP address\n");
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_get_ip_address(struct wilc_vif *vif, u8 idx)
+static void handle_get_ip_address(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ u8 idx = msg->body.ip_info.idx;
int ret = 0;
struct wid wid;
if (ret)
netdev_err(vif->ndev, "Failed to get IP address\n");
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_get_mac_address(struct wilc_vif *vif,
- struct get_mac_addr *get_mac_addr)
+static void handle_get_mac_address(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct get_mac_addr *get_mac_addr = &msg->body.get_mac_info;
int ret = 0;
struct wid wid;
if (ret)
netdev_err(vif->ndev, "Failed to get mac address\n");
complete(&hif_wait_response);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_cfg_param(struct wilc_vif *vif, struct cfg_param_attr *param)
+static void handle_cfg_param(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct cfg_param_attr *param = &msg->body.cfg_info;
int ret = 0;
struct wid wid_list[32];
struct host_if_drv *hif_drv = vif->hif_drv;
unlock:
mutex_unlock(&hif_drv->cfg_values_lock);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static s32 handle_scan(struct wilc_vif *vif, struct scan_attr *scan_info)
+static void handle_scan(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct scan_attr *scan_info = &msg->body.scan_info;
s32 result = 0;
struct wid wid_list[5];
u32 index = 0;
kfree(hdn_ntwk_wid_val);
- return result;
+ kfree(msg);
+ complete(&hif_thread_comp);
}
static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
}
u8 wilc_connected_ssid[6] = {0};
-static s32 handle_connect(struct wilc_vif *vif,
- struct connect_attr *conn_attr)
+static void handle_connect(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct connect_attr *conn_attr = &msg->body.con_info;
s32 result = 0;
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
struct join_bss_param *bss_param;
struct host_if_drv *hif_drv = vif->hif_drv;
+ if (msg->vif->hif_drv->usr_scan_req.scan_result) {
+ result = wilc_enqueue_cmd(msg);
+ if (result)
+ goto error;
+ usleep_range(2 * 1000, 2 * 1000);
+ kfree(msg);
+ return;
+ }
+
if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
- result = 0;
netdev_err(vif->ndev, "Discard connect request\n");
- return result;
+ goto error;
}
bss_param = conn_attr->params;
conn_attr->ies = NULL;
kfree(cur_byte);
- return result;
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static s32 handle_connect_timeout(struct wilc_vif *vif)
+static void handle_connect_timeout(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
s32 result = 0;
struct connect_info info;
struct wid wid;
if (!hif_drv) {
netdev_err(vif->ndev, "Driver handler is NULL\n");
- return result;
+ goto out;
}
hif_drv->hif_state = HOST_IF_IDLE;
hif_drv->usr_conn_req.ies_len,
GFP_KERNEL);
if (!info.req_ies)
- return -ENOMEM;
+ goto out;
}
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
eth_zero_addr(wilc_connected_ssid);
- return result;
+out:
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static s32 handle_rcvd_ntwrk_info(struct wilc_vif *vif,
- struct rcvd_net_info *rcvd_info)
+static void handle_rcvd_ntwrk_info(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct rcvd_net_info *rcvd_info = &msg->body.net_info;
u32 i;
bool found;
- s32 result = 0;
struct network_info *info = NULL;
void *params = NULL;
struct host_if_drv *hif_drv = vif->hif_drv;
wilc_parse_network_info(rcvd_info->buffer, &info);
if (!info || !scan_req->scan_result) {
netdev_err(vif->ndev, "driver is null\n");
- result = -EINVAL;
goto done;
}
kfree(info);
}
- return result;
+ kfree(msg);
+ complete(&hif_thread_comp);
}
static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
hif_drv->hif_state = HOST_IF_IDLE;
}
-static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
- struct rcvd_async_info *rcvd_info)
+static void handle_rcvd_gnrl_async_info(struct work_struct *work)
{
- s32 result = 0;
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct rcvd_async_info *rcvd_info = &msg->body.async_info;
u8 msg_type = 0;
u8 mac_status;
struct host_if_drv *hif_drv = vif->hif_drv;
if (!rcvd_info->buffer) {
netdev_err(vif->ndev, "Received buffer is NULL\n");
- return -EINVAL;
+ goto free_msg;
}
if (!hif_drv) {
netdev_err(vif->ndev, "Driver handler is NULL\n");
- kfree(rcvd_info->buffer);
- rcvd_info->buffer = NULL;
- return -ENODEV;
+ goto free_rcvd_info;
}
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
hif_drv->usr_scan_req.scan_result) {
if (!hif_drv->usr_conn_req.conn_result) {
netdev_err(vif->ndev, "driver is null\n");
- kfree(rcvd_info->buffer);
- rcvd_info->buffer = NULL;
- return -EINVAL;
+ goto free_rcvd_info;
}
msg_type = rcvd_info->buffer[0];
if ('I' != msg_type) {
netdev_err(vif->ndev, "Received Message incorrect.\n");
- kfree(rcvd_info->buffer);
- rcvd_info->buffer = NULL;
- return -EFAULT;
+ goto free_rcvd_info;
}
mac_status = rcvd_info->buffer[7];
}
}
+free_rcvd_info:
kfree(rcvd_info->buffer);
rcvd_info->buffer = NULL;
- return result;
+free_msg:
+ kfree(msg);
+ complete(&hif_thread_comp);
}
static int wilc_pmksa_key_copy(struct wilc_vif *vif, struct key_attr *hif_key)
return ret;
}
-static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
+static void handle_key(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct key_attr *hif_key = &msg->body.key_info;
int result = 0;
struct wid wid;
struct wid wid_list[5];
if (result)
netdev_err(vif->ndev, "Failed to send key config packet\n");
- return result;
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_disconnect(struct wilc_vif *vif)
+static void handle_disconnect(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
struct disconnect_info disconn_info;
out:
complete(&hif_drv->comp_test_disconn_block);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
wilc_disconnect(vif, 1);
}
-static void handle_get_rssi(struct wilc_vif *vif)
+static void handle_get_rssi(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
s32 result = 0;
struct wid wid;
result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
- if (result) {
+ if (result)
netdev_err(vif->ndev, "Failed to get RSSI value\n");
- result = -EFAULT;
- }
complete(&vif->hif_drv->comp_get_rssi);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static s32 handle_get_statistics(struct wilc_vif *vif,
- struct rf_info *stats)
+static void handle_get_statistics(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
struct wid wid_list[5];
u32 wid_cnt = 0, result = 0;
+ struct rf_info *stats = (struct rf_info *)msg->body.data;
wid_list[wid_cnt].id = WID_LINKSPEED;
wid_list[wid_cnt].type = WID_CHAR;
if (stats != &vif->wilc->dummy_statistics)
complete(&hif_wait_response);
- return 0;
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static s32 handle_get_inactive_time(struct wilc_vif *vif,
- struct sta_inactive_t *hif_sta_inactive)
+static void handle_get_inactive_time(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct sta_inactive_t *hif_sta_inactive = &msg->body.mac_info;
s32 result = 0;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
wid.size = ETH_ALEN;
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
- return -ENOMEM;
+ goto out;
ether_addr_copy(wid.val, hif_sta_inactive->mac);
if (result) {
netdev_err(vif->ndev, "Failed to SET inactive time\n");
- return -EFAULT;
+ goto out;
}
wid.id = (u16)WID_GET_INACTIVE_TIME;
result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
- if (result) {
+ if (result)
netdev_err(vif->ndev, "Failed to get inactive time\n");
- return -EFAULT;
- }
+out:
complete(&hif_drv->comp_inactive_time);
- return result;
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_add_beacon(struct wilc_vif *vif, struct beacon_attr *param)
+static void handle_add_beacon(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct beacon_attr *param = &msg->body.beacon_info;
s32 result = 0;
struct wid wid;
u8 *cur_byte;
kfree(wid.val);
kfree(param->head);
kfree(param->tail);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_del_beacon(struct wilc_vif *vif)
+static void handle_del_beacon(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
s32 result = 0;
struct wid wid;
u8 del_beacon = 0;
wilc_get_vif_idx(vif));
if (result)
netdev_err(vif->ndev, "Failed to send delete beacon\n");
+ kfree(msg);
+ complete(&hif_thread_comp);
}
static u32 wilc_hif_pack_sta_param(u8 *buff, struct add_sta_param *param)
return cur_byte - buff;
}
-static void handle_add_station(struct wilc_vif *vif,
- struct add_sta_param *param)
+static void handle_add_station(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct add_sta_param *param = &msg->body.add_sta_info;
s32 result = 0;
struct wid wid;
u8 *cur_byte;
error:
kfree(param->rates);
kfree(wid.val);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_del_all_sta(struct wilc_vif *vif,
- struct del_all_sta *param)
+static void handle_del_all_sta(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct del_all_sta *param = &msg->body.del_all_sta_info;
s32 result = 0;
struct wid wid;
u8 *curr_byte;
kfree(wid.val);
complete(&hif_wait_response);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_del_station(struct wilc_vif *vif, struct del_sta *param)
+static void handle_del_station(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct del_sta *param = &msg->body.del_sta_info;
s32 result = 0;
struct wid wid;
error:
kfree(wid.val);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_edit_station(struct wilc_vif *vif,
- struct add_sta_param *param)
+static void handle_edit_station(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct add_sta_param *param = &msg->body.edit_sta_info;
s32 result = 0;
struct wid wid;
u8 *cur_byte;
error:
kfree(param->rates);
kfree(wid.val);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
static int handle_remain_on_chan(struct wilc_vif *vif,
return result;
}
-static int handle_register_frame(struct wilc_vif *vif,
- struct reg_frame *hif_reg_frame)
+static void handle_register_frame(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct reg_frame *hif_reg_frame = &msg->body.reg_frame;
s32 result = 0;
struct wid wid;
u8 *cur_byte;
wid.type = WID_STR;
wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL);
if (!wid.val)
- return -ENOMEM;
+ goto out;
cur_byte = wid.val;
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
kfree(wid.val);
- if (result) {
+ if (result)
netdev_err(vif->ndev, "Failed to frame register\n");
- result = -EINVAL;
- }
- return result;
+out:
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static u32 handle_listen_state_expired(struct wilc_vif *vif,
- struct remain_ch *hif_remain_ch)
+static void handle_listen_state_expired(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct remain_ch *hif_remain_ch = &msg->body.remain_on_ch;
u8 remain_on_chan_flag;
struct wid wid;
s32 result = 0;
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
- return -ENOMEM;
+ goto free_msg;
wid.val[0] = remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;
kfree(wid.val);
if (result != 0) {
netdev_err(vif->ndev, "Failed to set remain channel\n");
- return result;
+ goto free_msg;
}
if (hif_drv->remain_on_ch.expired) {
p2p_listen_state = 0;
} else {
netdev_dbg(vif->ndev, "Not in listen state\n");
- result = -EFAULT;
}
- return result;
+free_msg:
+ kfree(msg);
+ complete(&hif_thread_comp);
}
static void listen_timer_cb(struct timer_list *t)
del_timer(&vif->hif_drv->remain_on_ch_timer);
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
+ msg.fn = handle_listen_state_expired;
msg.vif = vif;
msg.body.remain_on_ch.id = vif->hif_drv->remain_on_ch.id;
netdev_err(vif->ndev, "wilc_mq_send fail\n");
}
-static void handle_power_management(struct wilc_vif *vif,
- struct power_mgmt_param *pm_param)
+static void handle_power_management(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct power_mgmt_param *pm_param = &msg->body.pwr_mgmt_info;
s32 result = 0;
struct wid wid;
s8 power_mode;
wilc_get_vif_idx(vif));
if (result)
netdev_err(vif->ndev, "Failed to send power management\n");
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_set_mcast_filter(struct wilc_vif *vif,
- struct set_multicast *hif_set_mc)
+static void handle_set_mcast_filter(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ struct set_multicast *hif_set_mc = &msg->body.multicast_info;
s32 result = 0;
struct wid wid;
u8 *cur_byte;
error:
kfree(wid.val);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_set_tx_pwr(struct wilc_vif *vif, u8 tx_pwr)
+static void handle_set_tx_pwr(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ u8 tx_pwr = msg->body.tx_power.tx_pwr;
int ret;
struct wid wid;
wilc_get_vif_idx(vif));
if (ret)
netdev_err(vif->ndev, "Failed to set TX PWR\n");
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void handle_get_tx_pwr(struct wilc_vif *vif, u8 *tx_pwr)
+static void handle_get_tx_pwr(struct work_struct *work)
{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc_vif *vif = msg->vif;
+ u8 *tx_pwr = &msg->body.tx_power.tx_pwr;
int ret = 0;
struct wid wid;
netdev_err(vif->ndev, "Failed to get TX PWR\n");
complete(&hif_wait_response);
+ kfree(msg);
+ complete(&hif_thread_comp);
}
-static void host_if_work(struct work_struct *work)
+static void handle_scan_timer(struct work_struct *work)
{
- struct host_if_msg *msg;
- struct wilc *wilc;
- int ret = 0;
-
- msg = container_of(work, struct host_if_msg, work);
- wilc = msg->vif->wilc;
-
- if (msg->id == HOST_IF_MSG_CONNECT &&
- msg->vif->hif_drv->usr_scan_req.scan_result) {
- wilc_enqueue_cmd(msg);
- usleep_range(2 * 1000, 2 * 1000);
- goto free_msg;
- }
- switch (msg->id) {
- case HOST_IF_MSG_SCAN:
- handle_scan(msg->vif, &msg->body.scan_info);
- break;
-
- case HOST_IF_MSG_CONNECT:
- handle_connect(msg->vif, &msg->body.con_info);
- break;
-
- case HOST_IF_MSG_RCVD_NTWRK_INFO:
- handle_rcvd_ntwrk_info(msg->vif, &msg->body.net_info);
- break;
-
- case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO:
- handle_rcvd_gnrl_async_info(msg->vif,
- &msg->body.async_info);
- break;
-
- case HOST_IF_MSG_KEY:
- handle_key(msg->vif, &msg->body.key_info);
- break;
-
- case HOST_IF_MSG_CFG_PARAMS:
- handle_cfg_param(msg->vif, &msg->body.cfg_info);
- break;
-
- case HOST_IF_MSG_SET_CHANNEL:
- handle_set_channel(msg->vif, &msg->body.channel_info);
- break;
-
- case HOST_IF_MSG_DISCONNECT:
- handle_disconnect(msg->vif);
- break;
-
- case HOST_IF_MSG_RCVD_SCAN_COMPLETE:
- del_timer(&msg->vif->hif_drv->scan_timer);
-
- if (!wilc_wlan_get_num_conn_ifcs(wilc))
- wilc_chip_sleep_manually(wilc);
-
- handle_scan_done(msg->vif, SCAN_EVENT_DONE);
-
- if (msg->vif->hif_drv->remain_on_ch_pending)
- handle_remain_on_chan(msg->vif,
- &msg->body.remain_on_ch);
-
- break;
-
- case HOST_IF_MSG_GET_RSSI:
- handle_get_rssi(msg->vif);
- break;
-
- case HOST_IF_MSG_GET_STATISTICS:
- handle_get_statistics(msg->vif,
- (struct rf_info *)msg->body.data);
- break;
-
- case HOST_IF_MSG_ADD_BEACON:
- handle_add_beacon(msg->vif, &msg->body.beacon_info);
- break;
-
- case HOST_IF_MSG_DEL_BEACON:
- handle_del_beacon(msg->vif);
- break;
-
- case HOST_IF_MSG_ADD_STATION:
- handle_add_station(msg->vif, &msg->body.add_sta_info);
- break;
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- case HOST_IF_MSG_DEL_STATION:
- handle_del_station(msg->vif, &msg->body.del_sta_info);
- break;
-
- case HOST_IF_MSG_EDIT_STATION:
- handle_edit_station(msg->vif, &msg->body.edit_sta_info);
- break;
-
- case HOST_IF_MSG_GET_INACTIVETIME:
- handle_get_inactive_time(msg->vif, &msg->body.mac_info);
- break;
+ handle_scan_done(msg->vif, SCAN_EVENT_ABORTED);
+ kfree(msg);
+ complete(&hif_thread_comp);
+}
- case HOST_IF_MSG_SCAN_TIMER_FIRED:
- handle_scan_done(msg->vif, SCAN_EVENT_ABORTED);
- break;
+static void handle_remain_on_chan_work(struct work_struct *work)
+{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- case HOST_IF_MSG_CONNECT_TIMER_FIRED:
- handle_connect_timeout(msg->vif);
- break;
+ handle_remain_on_chan(msg->vif, &msg->body.remain_on_ch);
+ kfree(msg);
+ complete(&hif_thread_comp);
+}
- case HOST_IF_MSG_POWER_MGMT:
- handle_power_management(msg->vif,
- &msg->body.pwr_mgmt_info);
- break;
+static void handle_hif_exit_work(struct work_struct *work)
+{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- case HOST_IF_MSG_SET_WFIDRV_HANDLER:
- ret = handle_set_wfi_drv_handler(msg->vif, &msg->body.drv);
- break;
+ kfree(msg);
+ complete(&hif_thread_comp);
+}
- case HOST_IF_MSG_SET_OPERATION_MODE:
- handle_set_operation_mode(msg->vif, &msg->body.mode);
- break;
+static void handle_scan_complete(struct work_struct *work)
+{
+ struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
+ struct wilc *wilc = msg->vif->wilc;
- case HOST_IF_MSG_SET_IPADDRESS:
- handle_set_ip_address(msg->vif,
- msg->body.ip_info.ip_addr,
- msg->body.ip_info.idx);
- break;
+ del_timer(&msg->vif->hif_drv->scan_timer);
- case HOST_IF_MSG_GET_IPADDRESS:
- handle_get_ip_address(msg->vif, msg->body.ip_info.idx);
- break;
+ if (!wilc_wlan_get_num_conn_ifcs(wilc))
+ wilc_chip_sleep_manually(wilc);
- case HOST_IF_MSG_GET_MAC_ADDRESS:
- handle_get_mac_address(msg->vif,
- &msg->body.get_mac_info);
- break;
+ handle_scan_done(msg->vif, SCAN_EVENT_DONE);
- case HOST_IF_MSG_REMAIN_ON_CHAN:
+ if (msg->vif->hif_drv->remain_on_ch_pending)
handle_remain_on_chan(msg->vif, &msg->body.remain_on_ch);
- break;
-
- case HOST_IF_MSG_REGISTER_FRAME:
- handle_register_frame(msg->vif, &msg->body.reg_frame);
- break;
-
- case HOST_IF_MSG_LISTEN_TIMER_FIRED:
- handle_listen_state_expired(msg->vif, &msg->body.remain_on_ch);
- break;
-
- case HOST_IF_MSG_SET_MULTICAST_FILTER:
- handle_set_mcast_filter(msg->vif, &msg->body.multicast_info);
- break;
-
- case HOST_IF_MSG_DEL_ALL_STA:
- handle_del_all_sta(msg->vif, &msg->body.del_all_sta_info);
- break;
-
- case HOST_IF_MSG_SET_TX_POWER:
- handle_set_tx_pwr(msg->vif, msg->body.tx_power.tx_pwr);
- break;
-
- case HOST_IF_MSG_GET_TX_POWER:
- handle_get_tx_pwr(msg->vif, &msg->body.tx_power.tx_pwr);
- break;
- default:
- netdev_err(msg->vif->ndev, "[Host Interface] undefined\n");
- break;
- }
-free_msg:
- if (ret)
- netdev_err(msg->vif->ndev, "Host cmd %d failed\n", msg->id);
kfree(msg);
complete(&hif_thread_comp);
}
memset(&msg, 0, sizeof(struct host_if_msg));
msg.vif = vif;
- msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED;
+ msg.fn = handle_scan_timer;
wilc_enqueue_cmd(&msg);
}
memset(&msg, 0, sizeof(struct host_if_msg));
msg.vif = vif;
- msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED;
+ msg.fn = handle_connect_timeout;
wilc_enqueue_cmd(&msg);
}
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_KEY;
+ msg.fn = handle_key;
msg.body.key_info.type = WEP;
msg.body.key_info.action = REMOVEKEY;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_KEY;
+ msg.fn = handle_key;
msg.body.key_info.type = WEP;
msg.body.key_info.action = DEFAULTKEY;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_KEY;
+ msg.fn = handle_key;
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_KEY;
+ msg.fn = handle_key;
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY_AP;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_KEY;
+ msg.fn = handle_key;
msg.body.key_info.type = WPA_PTK;
if (mode == AP_MODE) {
msg.body.key_info.action = ADDKEY_AP;
return -ENOMEM;
}
- msg.id = HOST_IF_MSG_KEY;
+ msg.fn = handle_key;
msg.body.key_info.type = WPA_RX_GTK;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_KEY;
+ msg.fn = handle_key;
msg.body.key_info.type = PMKSA;
msg.body.key_info.action = ADDKEY;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_GET_MAC_ADDRESS;
+ msg.fn = handle_get_mac_address;
msg.body.get_mac_info.mac_addr = mac_addr;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_CONNECT;
-
+ msg.fn = handle_connect;
msg.body.con_info.security = security;
msg.body.con_info.auth_type = auth_type;
msg.body.con_info.ch = channel;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_DISCONNECT;
+ msg.fn = handle_disconnect;
msg.vif = vif;
result = wilc_enqueue_cmd(&msg);
struct host_if_msg msg;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_SET_CHANNEL;
+ msg.fn = handle_set_channel;
msg.body.channel_info.set_ch = channel;
msg.vif = vif;
struct host_if_msg msg;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
+ msg.fn = handle_set_wfi_drv_handler;
msg.body.drv.handler = index;
msg.body.drv.mode = mode;
msg.body.drv.name = ifc_id;
struct host_if_msg msg;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_SET_OPERATION_MODE;
+ msg.fn = handle_set_operation_mode;
msg.body.mode.mode = mode;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
memcpy(msg.body.mac_info.mac, mac, ETH_ALEN);
- msg.id = HOST_IF_MSG_GET_INACTIVETIME;
+ msg.fn = handle_get_inactive_time;
msg.vif = vif;
result = wilc_enqueue_cmd(&msg);
struct host_if_drv *hif_drv = vif->hif_drv;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_GET_RSSI;
+ msg.fn = handle_get_rssi;
msg.vif = vif;
result = wilc_enqueue_cmd(&msg);
struct host_if_msg msg;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_GET_STATISTICS;
+ msg.fn = handle_get_statistics;
msg.body.data = (char *)stats;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_SCAN;
+ msg.fn = handle_scan;
if (hidden_network) {
scan_info->hidden_network.net_info = hidden_network->net_info;
}
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_CFG_PARAMS;
+ msg.fn = handle_cfg_param;
msg.body.cfg_info = *cfg_param;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
if (clients_count == 1) {
- msg.id = HOST_IF_MSG_EXIT;
+ msg.fn = handle_hif_exit_work;
msg.vif = vif;
result = wilc_enqueue_cmd(&msg);
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO;
+ msg.fn = handle_rcvd_ntwrk_info;
msg.vif = vif;
msg.body.net_info.len = length;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO;
+ msg.fn = handle_rcvd_gnrl_async_info;
msg.vif = vif;
msg.body.async_info.len = length;
if (hif_drv->usr_scan_req.scan_result) {
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE;
+ msg.fn = handle_scan_complete;
msg.vif = vif;
result = wilc_enqueue_cmd(&msg);
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_REMAIN_ON_CHAN;
+ msg.fn = handle_remain_on_chan_work;
msg.body.remain_on_ch.ch = chan;
msg.body.remain_on_ch.expired = expired;
msg.body.remain_on_ch.ready = ready;
del_timer(&hif_drv->remain_on_ch_timer);
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
+ msg.fn = handle_listen_state_expired;
msg.vif = vif;
msg.body.remain_on_ch.id = session_id;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_REGISTER_FRAME;
+ msg.fn = handle_register_frame;
switch (frame_type) {
case ACTION:
msg.body.reg_frame.reg_id = ACTION_FRM_IDX;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_ADD_BEACON;
+ msg.fn = handle_add_beacon;
msg.vif = vif;
beacon_info->interval = interval;
beacon_info->dtim_period = dtim_period;
int result = 0;
struct host_if_msg msg;
- msg.id = HOST_IF_MSG_DEL_BEACON;
+ msg.fn = handle_del_beacon;
msg.vif = vif;
result = wilc_enqueue_cmd(&msg);
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_ADD_STATION;
+ msg.fn = handle_add_station;
msg.vif = vif;
memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_DEL_STATION;
+ msg.fn = handle_del_station;
msg.vif = vif;
if (!mac_addr)
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_DEL_ALL_STA;
+ msg.fn = handle_del_all_sta;
msg.vif = vif;
for (i = 0; i < MAX_NUM_STA; i++) {
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_EDIT_STATION;
+ msg.fn = handle_edit_station;
msg.vif = vif;
memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_POWER_MGMT;
+ msg.fn = handle_power_management;
msg.vif = vif;
pwr_mgmt_info->enabled = enabled;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER;
+ msg.fn = handle_set_mcast_filter;
msg.vif = vif;
multicast_filter_param->enabled = enabled;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_SET_IPADDRESS;
+ msg.fn = handle_set_ip_address;
msg.body.ip_info.ip_addr = ip_addr;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_GET_IPADDRESS;
+ msg.fn = handle_get_ip_address;
msg.body.ip_info.ip_addr = ip_addr;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_SET_TX_POWER;
+ msg.fn = handle_set_tx_pwr;
msg.body.tx_power.tx_pwr = tx_power;
msg.vif = vif;
memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_GET_TX_POWER;
+ msg.fn = handle_get_tx_pwr;
msg.vif = vif;
ret = wilc_enqueue_cmd(&msg);