|
@@ -28,44 +28,44 @@
|
|
|
|
|
|
/*
|
|
|
* define short names for the global vendor params
|
|
|
- * used by __wlan_hdd_cfg80211_bpf_offload()
|
|
|
+ * used by __wlan_hdd_cfg80211_apf_offload()
|
|
|
*/
|
|
|
-#define BPF_INVALID \
|
|
|
+#define APF_INVALID \
|
|
|
QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_INVALID
|
|
|
-#define BPF_SET_RESET \
|
|
|
+#define APF_SET_RESET \
|
|
|
QCA_WLAN_VENDOR_ATTR_SET_RESET_PACKET_FILTER
|
|
|
-#define BPF_VERSION \
|
|
|
+#define APF_VERSION \
|
|
|
QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_VERSION
|
|
|
-#define BPF_FILTER_ID \
|
|
|
+#define APF_FILTER_ID \
|
|
|
QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_ID
|
|
|
-#define BPF_PACKET_SIZE \
|
|
|
+#define APF_PACKET_SIZE \
|
|
|
QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_SIZE
|
|
|
-#define BPF_CURRENT_OFFSET \
|
|
|
+#define APF_CURRENT_OFFSET \
|
|
|
QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_CURRENT_OFFSET
|
|
|
-#define BPF_PROGRAM \
|
|
|
+#define APF_PROGRAM \
|
|
|
QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_PROGRAM
|
|
|
-#define BPF_MAX \
|
|
|
+#define APF_MAX \
|
|
|
QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_MAX
|
|
|
|
|
|
static const struct nla_policy
|
|
|
-wlan_hdd_bpf_offload_policy[BPF_MAX + 1] = {
|
|
|
- [BPF_SET_RESET] = {.type = NLA_U32},
|
|
|
- [BPF_VERSION] = {.type = NLA_U32},
|
|
|
- [BPF_FILTER_ID] = {.type = NLA_U32},
|
|
|
- [BPF_PACKET_SIZE] = {.type = NLA_U32},
|
|
|
- [BPF_CURRENT_OFFSET] = {.type = NLA_U32},
|
|
|
- [BPF_PROGRAM] = {.type = NLA_U8},
|
|
|
+wlan_hdd_apf_offload_policy[APF_MAX + 1] = {
|
|
|
+ [APF_SET_RESET] = {.type = NLA_U32},
|
|
|
+ [APF_VERSION] = {.type = NLA_U32},
|
|
|
+ [APF_FILTER_ID] = {.type = NLA_U32},
|
|
|
+ [APF_PACKET_SIZE] = {.type = NLA_U32},
|
|
|
+ [APF_CURRENT_OFFSET] = {.type = NLA_U32},
|
|
|
+ [APF_PROGRAM] = {.type = NLA_U8},
|
|
|
};
|
|
|
|
|
|
-struct bpf_offload_priv {
|
|
|
- struct sir_bpf_get_offload bpf_get_offload;
|
|
|
+struct apf_offload_priv {
|
|
|
+ struct sir_apf_get_offload apf_get_offload;
|
|
|
};
|
|
|
|
|
|
-static void hdd_get_bpf_offload_cb(void *context,
|
|
|
- struct sir_bpf_get_offload *data)
|
|
|
+static void hdd_get_apf_offload_cb(void *context,
|
|
|
+ struct sir_apf_get_offload *data)
|
|
|
{
|
|
|
struct hdd_request *request;
|
|
|
- struct bpf_offload_priv *priv;
|
|
|
+ struct apf_offload_priv *priv;
|
|
|
|
|
|
hdd_enter();
|
|
|
|
|
@@ -76,20 +76,21 @@ static void hdd_get_bpf_offload_cb(void *context,
|
|
|
}
|
|
|
|
|
|
priv = hdd_request_priv(request);
|
|
|
- priv->bpf_get_offload = *data;
|
|
|
+ priv->apf_get_offload = *data;
|
|
|
hdd_request_complete(request);
|
|
|
hdd_request_put(request);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * hdd_post_get_bpf_capabilities_rsp() - Callback function to BPF Offload
|
|
|
+ * hdd_post_get_apf_capabilities_rsp() - Callback function to APF Offload
|
|
|
* @hdd_context: hdd_context
|
|
|
- * @bpf_get_offload: struct for get offload
|
|
|
+ * @apf_get_offload: struct for get offload
|
|
|
*
|
|
|
* Return: 0 on success, error number otherwise.
|
|
|
*/
|
|
|
-static int hdd_post_get_bpf_capabilities_rsp(struct hdd_context *hdd_ctx,
|
|
|
- struct sir_bpf_get_offload *bpf_get_offload)
|
|
|
+static int
|
|
|
+hdd_post_get_apf_capabilities_rsp(struct hdd_context *hdd_ctx,
|
|
|
+ struct sir_apf_get_offload *apf_get_offload)
|
|
|
{
|
|
|
struct sk_buff *skb;
|
|
|
uint32_t nl_buf_len;
|
|
@@ -98,8 +99,8 @@ static int hdd_post_get_bpf_capabilities_rsp(struct hdd_context *hdd_ctx,
|
|
|
|
|
|
nl_buf_len = NLMSG_HDRLEN;
|
|
|
nl_buf_len +=
|
|
|
- (sizeof(bpf_get_offload->max_bytes_for_bpf_inst) + NLA_HDRLEN) +
|
|
|
- (sizeof(bpf_get_offload->bpf_version) + NLA_HDRLEN);
|
|
|
+ (sizeof(apf_get_offload->max_bytes_for_apf_inst) + NLA_HDRLEN) +
|
|
|
+ (sizeof(apf_get_offload->apf_version) + NLA_HDRLEN);
|
|
|
|
|
|
skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
|
|
|
if (!skb) {
|
|
@@ -107,13 +108,13 @@ static int hdd_post_get_bpf_capabilities_rsp(struct hdd_context *hdd_ctx,
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
|
- hdd_debug("BPF Version: %u BPF max bytes: %u",
|
|
|
- bpf_get_offload->bpf_version,
|
|
|
- bpf_get_offload->max_bytes_for_bpf_inst);
|
|
|
+ hdd_debug("APF Version: %u APF max bytes: %u",
|
|
|
+ apf_get_offload->apf_version,
|
|
|
+ apf_get_offload->max_bytes_for_apf_inst);
|
|
|
|
|
|
- if (nla_put_u32(skb, BPF_PACKET_SIZE,
|
|
|
- bpf_get_offload->max_bytes_for_bpf_inst) ||
|
|
|
- nla_put_u32(skb, BPF_VERSION, bpf_get_offload->bpf_version)) {
|
|
|
+ if (nla_put_u32(skb, APF_PACKET_SIZE,
|
|
|
+ apf_get_offload->max_bytes_for_apf_inst) ||
|
|
|
+ nla_put_u32(skb, APF_VERSION, apf_get_offload->apf_version)) {
|
|
|
hdd_err("nla put failure");
|
|
|
goto nla_put_failure;
|
|
|
}
|
|
@@ -128,21 +129,21 @@ nla_put_failure:
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * hdd_get_bpf_offload - Get BPF offload Capabilities
|
|
|
+ * hdd_get_apf_offload - Get APF offload Capabilities
|
|
|
* @hdd_ctx: Hdd context
|
|
|
*
|
|
|
* Return: 0 on success, errno on failure
|
|
|
*/
|
|
|
-static int hdd_get_bpf_offload(struct hdd_context *hdd_ctx)
|
|
|
+static int hdd_get_apf_offload(struct hdd_context *hdd_ctx)
|
|
|
{
|
|
|
QDF_STATUS status;
|
|
|
int ret;
|
|
|
void *cookie;
|
|
|
struct hdd_request *request;
|
|
|
- struct bpf_offload_priv *priv;
|
|
|
+ struct apf_offload_priv *priv;
|
|
|
static const struct hdd_request_params params = {
|
|
|
.priv_size = sizeof(*priv),
|
|
|
- .timeout_ms = WLAN_WAIT_TIME_BPF,
|
|
|
+ .timeout_ms = WLAN_WAIT_TIME_APF,
|
|
|
};
|
|
|
|
|
|
hdd_enter();
|
|
@@ -154,11 +155,11 @@ static int hdd_get_bpf_offload(struct hdd_context *hdd_ctx)
|
|
|
}
|
|
|
cookie = hdd_request_cookie(request);
|
|
|
|
|
|
- status = sme_get_bpf_offload_capabilities(hdd_ctx->hHal,
|
|
|
- hdd_get_bpf_offload_cb,
|
|
|
+ status = sme_get_apf_offload_capabilities(hdd_ctx->hHal,
|
|
|
+ hdd_get_apf_offload_cb,
|
|
|
cookie);
|
|
|
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
|
|
- hdd_err("Unable to retrieve BPF caps");
|
|
|
+ hdd_err("Unable to retrieve APF caps");
|
|
|
ret = qdf_status_to_os_return(status);
|
|
|
goto cleanup;
|
|
|
}
|
|
@@ -168,10 +169,10 @@ static int hdd_get_bpf_offload(struct hdd_context *hdd_ctx)
|
|
|
goto cleanup;
|
|
|
}
|
|
|
priv = hdd_request_priv(request);
|
|
|
- ret = hdd_post_get_bpf_capabilities_rsp(hdd_ctx,
|
|
|
- &priv->bpf_get_offload);
|
|
|
+ ret = hdd_post_get_apf_capabilities_rsp(hdd_ctx,
|
|
|
+ &priv->apf_get_offload);
|
|
|
if (ret)
|
|
|
- hdd_err("Failed to post get bpf capabilities");
|
|
|
+ hdd_err("Failed to post get apf capabilities");
|
|
|
|
|
|
cleanup:
|
|
|
/*
|
|
@@ -187,18 +188,18 @@ cleanup:
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * hdd_set_reset_bpf_offload - Post set/reset bpf to SME
|
|
|
+ * hdd_set_reset_apf_offload - Post set/reset apf to SME
|
|
|
* @hdd_ctx: Hdd context
|
|
|
* @tb: Length of @data
|
|
|
* @adapter: pointer to adapter struct
|
|
|
*
|
|
|
* Return: 0 on success; errno on failure
|
|
|
*/
|
|
|
-static int hdd_set_reset_bpf_offload(struct hdd_context *hdd_ctx,
|
|
|
+static int hdd_set_reset_apf_offload(struct hdd_context *hdd_ctx,
|
|
|
struct nlattr **tb,
|
|
|
struct hdd_adapter *adapter)
|
|
|
{
|
|
|
- struct sir_bpf_set_offload *bpf_set_offload;
|
|
|
+ struct sir_apf_set_offload *apf_set_offload;
|
|
|
QDF_STATUS status;
|
|
|
int prog_len;
|
|
|
int ret = 0;
|
|
@@ -214,91 +215,89 @@ static int hdd_set_reset_bpf_offload(struct hdd_context *hdd_ctx,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- bpf_set_offload = qdf_mem_malloc(sizeof(*bpf_set_offload));
|
|
|
- if (bpf_set_offload == NULL) {
|
|
|
- hdd_err("qdf_mem_malloc failed for bpf_set_offload");
|
|
|
+ apf_set_offload = qdf_mem_malloc(sizeof(*apf_set_offload));
|
|
|
+ if (!apf_set_offload) {
|
|
|
+ hdd_err("qdf_mem_malloc failed for apf_set_offload");
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
|
- /* Parse and fetch bpf packet size */
|
|
|
- if (!tb[BPF_PACKET_SIZE]) {
|
|
|
- hdd_err("attr bpf packet size failed");
|
|
|
+ /* Parse and fetch apf packet size */
|
|
|
+ if (!tb[APF_PACKET_SIZE]) {
|
|
|
+ hdd_err("attr apf packet size failed");
|
|
|
ret = -EINVAL;
|
|
|
goto fail;
|
|
|
}
|
|
|
- bpf_set_offload->total_length = nla_get_u32(tb[BPF_PACKET_SIZE]);
|
|
|
+ apf_set_offload->total_length = nla_get_u32(tb[APF_PACKET_SIZE]);
|
|
|
|
|
|
- if (!bpf_set_offload->total_length) {
|
|
|
- hdd_debug("BPF reset packet filter received");
|
|
|
+ if (!apf_set_offload->total_length) {
|
|
|
+ hdd_debug("APF reset packet filter received");
|
|
|
goto post_sme;
|
|
|
}
|
|
|
|
|
|
- /* Parse and fetch bpf program */
|
|
|
- if (!tb[BPF_PROGRAM]) {
|
|
|
- hdd_err("attr bpf program failed");
|
|
|
+ /* Parse and fetch apf program */
|
|
|
+ if (!tb[APF_PROGRAM]) {
|
|
|
+ hdd_err("attr apf program failed");
|
|
|
ret = -EINVAL;
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
|
- prog_len = nla_len(tb[BPF_PROGRAM]);
|
|
|
- bpf_set_offload->program = qdf_mem_malloc(sizeof(uint8_t) * prog_len);
|
|
|
+ prog_len = nla_len(tb[APF_PROGRAM]);
|
|
|
+ apf_set_offload->program = qdf_mem_malloc(sizeof(uint8_t) * prog_len);
|
|
|
|
|
|
- if (bpf_set_offload->program == NULL) {
|
|
|
- hdd_err("qdf_mem_malloc failed for bpf offload program");
|
|
|
+ if (!apf_set_offload->program) {
|
|
|
+ hdd_err("qdf_mem_malloc failed for apf offload program");
|
|
|
ret = -ENOMEM;
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
|
- bpf_set_offload->current_length = prog_len;
|
|
|
- nla_memcpy(bpf_set_offload->program, tb[BPF_PROGRAM], prog_len);
|
|
|
- bpf_set_offload->session_id = adapter->session_id;
|
|
|
+ apf_set_offload->current_length = prog_len;
|
|
|
+ nla_memcpy(apf_set_offload->program, tb[APF_PROGRAM], prog_len);
|
|
|
+ apf_set_offload->session_id = adapter->session_id;
|
|
|
|
|
|
- hdd_debug("BPF set instructions");
|
|
|
+ hdd_debug("APF set instructions");
|
|
|
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG,
|
|
|
- bpf_set_offload->program, prog_len);
|
|
|
+ apf_set_offload->program, prog_len);
|
|
|
|
|
|
/* Parse and fetch filter Id */
|
|
|
- if (!tb[BPF_FILTER_ID]) {
|
|
|
+ if (!tb[APF_FILTER_ID]) {
|
|
|
hdd_err("attr filter id failed");
|
|
|
ret = -EINVAL;
|
|
|
goto fail;
|
|
|
}
|
|
|
- bpf_set_offload->filter_id = nla_get_u32(tb[BPF_FILTER_ID]);
|
|
|
+ apf_set_offload->filter_id = nla_get_u32(tb[APF_FILTER_ID]);
|
|
|
|
|
|
/* Parse and fetch current offset */
|
|
|
- if (!tb[BPF_CURRENT_OFFSET]) {
|
|
|
+ if (!tb[APF_CURRENT_OFFSET]) {
|
|
|
hdd_err("attr current offset failed");
|
|
|
ret = -EINVAL;
|
|
|
goto fail;
|
|
|
}
|
|
|
- bpf_set_offload->current_offset = nla_get_u32(tb[BPF_CURRENT_OFFSET]);
|
|
|
+ apf_set_offload->current_offset = nla_get_u32(tb[APF_CURRENT_OFFSET]);
|
|
|
|
|
|
post_sme:
|
|
|
- hdd_debug("Posting BPF SET/RESET to SME, session_id: %d Bpf Version: %d filter ID: %d total_length: %d current_length: %d current offset: %d",
|
|
|
- bpf_set_offload->session_id,
|
|
|
- bpf_set_offload->version,
|
|
|
- bpf_set_offload->filter_id,
|
|
|
- bpf_set_offload->total_length,
|
|
|
- bpf_set_offload->current_length,
|
|
|
- bpf_set_offload->current_offset);
|
|
|
-
|
|
|
- status = sme_set_bpf_instructions(hdd_ctx->hHal, bpf_set_offload);
|
|
|
+ hdd_debug("Posting APF SET/RESET to SME, session_id: %d APF Version: %d filter ID: %d total_length: %d current_length: %d current offset: %d",
|
|
|
+ apf_set_offload->session_id, apf_set_offload->version,
|
|
|
+ apf_set_offload->filter_id, apf_set_offload->total_length,
|
|
|
+ apf_set_offload->current_length,
|
|
|
+ apf_set_offload->current_offset);
|
|
|
+
|
|
|
+ status = sme_set_apf_instructions(hdd_ctx->hHal, apf_set_offload);
|
|
|
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
|
|
- hdd_err("sme_set_bpf_instructions failed(err=%d)", status);
|
|
|
+ hdd_err("sme_set_apf_instructions failed(err=%d)", status);
|
|
|
ret = -EINVAL;
|
|
|
goto fail;
|
|
|
}
|
|
|
hdd_exit();
|
|
|
|
|
|
fail:
|
|
|
- if (bpf_set_offload->current_length)
|
|
|
- qdf_mem_free(bpf_set_offload->program);
|
|
|
- qdf_mem_free(bpf_set_offload);
|
|
|
+ if (apf_set_offload->current_length)
|
|
|
+ qdf_mem_free(apf_set_offload->program);
|
|
|
+ qdf_mem_free(apf_set_offload);
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * wlan_hdd_cfg80211_bpf_offload() - Set/Reset to BPF Offload
|
|
|
+ * wlan_hdd_cfg80211_apf_offload() - Set/Reset to APF Offload
|
|
|
* @wiphy: wiphy structure pointer
|
|
|
* @wdev: Wireless device structure pointer
|
|
|
* @data: Pointer to the data received
|
|
@@ -307,14 +306,14 @@ fail:
|
|
|
* Return: 0 on success; errno on failure
|
|
|
*/
|
|
|
static int
|
|
|
-__wlan_hdd_cfg80211_bpf_offload(struct wiphy *wiphy,
|
|
|
+__wlan_hdd_cfg80211_apf_offload(struct wiphy *wiphy,
|
|
|
struct wireless_dev *wdev,
|
|
|
const void *data, int data_len)
|
|
|
{
|
|
|
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
|
|
|
struct net_device *dev = wdev->netdev;
|
|
|
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
|
|
- struct nlattr *tb[BPF_MAX + 1];
|
|
|
+ struct nlattr *tb[APF_MAX + 1];
|
|
|
int ret_val, packet_filter_subcmd;
|
|
|
|
|
|
hdd_enter();
|
|
@@ -328,39 +327,39 @@ __wlan_hdd_cfg80211_bpf_offload(struct wiphy *wiphy,
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- if (!hdd_ctx->bpf_enabled) {
|
|
|
- hdd_err("BPF offload is not supported/enabled");
|
|
|
+ if (!hdd_ctx->apf_enabled) {
|
|
|
+ hdd_err("APF offload is not supported/enabled");
|
|
|
return -ENOTSUPP;
|
|
|
}
|
|
|
|
|
|
- if (wlan_cfg80211_nla_parse(tb, BPF_MAX, data, data_len,
|
|
|
- wlan_hdd_bpf_offload_policy)) {
|
|
|
+ if (wlan_cfg80211_nla_parse(tb, APF_MAX, data, data_len,
|
|
|
+ wlan_hdd_apf_offload_policy)) {
|
|
|
hdd_err("Invalid ATTR");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- if (!tb[BPF_SET_RESET]) {
|
|
|
- hdd_err("attr bpf set reset failed");
|
|
|
+ if (!tb[APF_SET_RESET]) {
|
|
|
+ hdd_err("attr apf set reset failed");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- packet_filter_subcmd = nla_get_u32(tb[BPF_SET_RESET]);
|
|
|
+ packet_filter_subcmd = nla_get_u32(tb[APF_SET_RESET]);
|
|
|
|
|
|
if (packet_filter_subcmd == QCA_WLAN_GET_PACKET_FILTER)
|
|
|
- return hdd_get_bpf_offload(hdd_ctx);
|
|
|
+ return hdd_get_apf_offload(hdd_ctx);
|
|
|
else
|
|
|
- return hdd_set_reset_bpf_offload(hdd_ctx, tb,
|
|
|
+ return hdd_set_reset_apf_offload(hdd_ctx, tb,
|
|
|
adapter);
|
|
|
}
|
|
|
|
|
|
-int wlan_hdd_cfg80211_bpf_offload(struct wiphy *wiphy,
|
|
|
- struct wireless_dev *wdev,
|
|
|
- const void *data, int data_len)
|
|
|
+int
|
|
|
+wlan_hdd_cfg80211_apf_offload(struct wiphy *wiphy, struct wireless_dev *wdev,
|
|
|
+ const void *data, int data_len)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
cds_ssr_protect(__func__);
|
|
|
- ret = __wlan_hdd_cfg80211_bpf_offload(wiphy, wdev, data, data_len);
|
|
|
+ ret = __wlan_hdd_cfg80211_apf_offload(wiphy, wdev, data, data_len);
|
|
|
cds_ssr_unprotect(__func__);
|
|
|
|
|
|
return ret;
|