int wl1251_acx_low_rssi(struct wl1251 *wl, s8 threshold, u8 weight, u8 depth, enum wl1251_acx_low_rssi_type type) { struct acx_low_rssi *rssi; int ret; wl1251_debug(DEBUG_ACX, "acx low rssi"); rssi = kzalloc(sizeof(*rssi), GFP_KERNEL); if (!rssi) return -ENOMEM; rssi->threshold = threshold; rssi->weight = weight; rssi->depth = depth; rssi->type = type; ret = wl1251_cmd_configure(wl, ACX_LOW_RSSI, rssi, sizeof(*rssi)); if (ret < 0) wl1251_warning("failed to set low rssi threshold: %d", ret); kfree(rssi); return ret; }
int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time) { struct acx_slot *slot; int ret; wl1251_debug(DEBUG_ACX, "acx slot"); slot = kzalloc(sizeof(*slot), GFP_KERNEL); if (!slot) return -ENOMEM; slot->wone_index = STATION_WONE_INDEX; slot->slot_time = slot_time; ret = wl1251_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot)); if (ret < 0) { wl1251_warning("failed to set slot time: %d", ret); goto out; } out: kfree(slot); return ret; }
int wl1251_acx_cts_protect(struct wl1251 *wl, enum acx_ctsprotect_type ctsprotect) { struct acx_ctsprotect *acx; int ret; wl1251_debug(DEBUG_ACX, "acx_set_ctsprotect"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) return -ENOMEM; acx->ctsprotect = ctsprotect; ret = wl1251_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx)); if (ret < 0) { wl1251_warning("Setting of ctsprotect failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1251_acx_station_id(struct wl1251 *wl) { struct acx_dot11_station_id *mac; int ret, i; wl1251_debug(DEBUG_ACX, "acx dot11_station_id"); mac = kzalloc(sizeof(*mac), GFP_KERNEL); if (!mac) { ret = -ENOMEM; goto out; } for (i = 0; i < ETH_ALEN; i++) mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i]; ret = wl1251_cmd_configure(wl, DOT11_STATION_ID, mac, sizeof(*mac)); if (ret < 0) goto out; out: kfree(mac); return ret; }
static int wl1251_nl_configure(struct sk_buff *skb, struct genl_info *info) { int ret = 0, cmd_ie_len, acx_len; struct acx_header *acx = NULL; struct sk_buff *msg; struct wl1251 *wl; void *cmd_ie; u16 *id; if (!info->attrs[WL1251_NL_ATTR_CMD_IE_BUFFER]) return -EINVAL; if (!info->attrs[WL1251_NL_ATTR_CMD_IE_LEN]) return -EINVAL; msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); if (!msg) return -ENOMEM; wl = ifname_to_wl1251(&init_net, info); if (wl == NULL) { wl1251_error("wl1251 not found"); ret = -EINVAL; goto nla_put_failure; } /* contains the acx header but not the cmd header */ cmd_ie = nla_data(info->attrs[WL1251_NL_ATTR_CMD_IE_BUFFER]); cmd_ie_len = nla_get_u32(info->attrs[WL1251_NL_ATTR_CMD_IE_LEN]); /* acx id is in the first two bytes */ id = cmd_ie; /* need to add acx_header before cmd_ie, so create a new command */ acx_len = sizeof(struct acx_header) + cmd_ie_len; acx = kzalloc(acx_len, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto nla_put_failure; } /* copy the acx header and the payload */ memcpy(&acx->id, cmd_ie, cmd_ie_len); mutex_lock(&wl->mutex); ret = wl1251_cmd_configure(wl, *id, acx, acx_len); mutex_unlock(&wl->mutex); if (ret < 0) { wl1251_error("%s() failed", __func__); goto nla_put_failure; } wl1251_debug(DEBUG_NETLINK, "CONFIGURE cmd sent"); nla_put_failure: kfree(acx); nlmsg_free(msg); return ret; }