@@ -369,4 +369,45 @@ struct hif_cnf_prevent_rollback {
__le32 status;
} __packed;
+struct hif_req_pta_settings {
+ u8 PtaMode;
+ u8 RequestSignalActiveLevel;
+ u8 PrioritySignalActiveLevel;
+ u8 FreqSignalActiveLevel;
+ u8 GrantSignalActiveLevel;
+ u8 CoexType;
+ u8 DefaultGrantState;
+ u8 SimultaneousRxAccesses;
+ u8 PrioritySamplingTime;
+ u8 TxRxSamplingTime;
+ u8 FreqSamplingTime;
+ u8 GrantValidTime;
+ u8 FemControlTime;
+ u8 FirstSlotTime;
+ __le16 PeriodicTxRxSamplingTime;
+ __le16 CoexQuota;
+ __le16 WlanQuota;
+} __packed;
+
+struct hif_cnf_pta_settings {
+ __le32 status;
+} __packed;
+
+struct hif_req_pta_priority {
+ __le32 priority;
+} __packed;
+
+struct hif_cnf_pta_priority {
+ __le32 status;
+} __packed;
+
+struct hif_req_pta_enable {
+ u8 enable;
+ u8 reserved[3];
+} __packed;
+
+struct hif_cnf_pta_enable {
+ __le32 status;
+} __packed;
+
#endif
@@ -535,6 +535,52 @@ int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len)
return ret;
}
+int hif_pta_settings(struct wfx_dev *wdev,
+ const struct hif_req_pta_settings *parms)
+{
+ int ret;
+ struct hif_msg *hif;
+ struct hif_req_pta_settings *body = wfx_alloc_hif(sizeof(*body), &hif);
+
+ if (!hif)
+ return -ENOMEM;
+ memcpy(body, parms, sizeof(*body));
+ wfx_fill_header(hif, -1, HIF_REQ_ID_PTA_SETTINGS, sizeof(*body));
+ ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
+ kfree(hif);
+ return ret;
+}
+
+int hif_pta_priority(struct wfx_dev *wdev, u32 priority)
+{
+ int ret;
+ struct hif_msg *hif;
+ struct hif_req_pta_priority *body = wfx_alloc_hif(sizeof(*body), &hif);
+
+ if (!hif)
+ return -ENOMEM;
+ body->priority = cpu_to_le32(priority);
+ wfx_fill_header(hif, -1, HIF_REQ_ID_PTA_PRIORITY, sizeof(*body));
+ ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
+ kfree(hif);
+ return ret;
+}
+
+int hif_pta_enable(struct wfx_dev *wdev, bool enable)
+{
+ int ret;
+ struct hif_msg *hif;
+ struct hif_req_pta_enable *body = wfx_alloc_hif(sizeof(*body), &hif);
+
+ if (!hif)
+ return -ENOMEM;
+ body->enable = enable;
+ wfx_fill_header(hif, -1, HIF_REQ_ID_PTA_STATE, sizeof(*body));
+ ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
+ kfree(hif);
+ return ret;
+}
+
int hif_burn_prevent_rollback(struct wfx_dev *wdev, u32 magic_word)
{
int ret;
@@ -15,6 +15,7 @@ struct ieee80211_bss_conf;
struct ieee80211_tx_queue_params;
struct cfg80211_scan_request;
struct hif_req_add_key;
+struct hif_req_pta_settings;
struct wfx_dev;
struct wfx_vif;
@@ -57,6 +58,10 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
int hif_beacon_transmit(struct wfx_vif *wvif, bool enable);
int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id);
int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len);
+int hif_pta_settings(struct wfx_dev *wdev,
+ const struct hif_req_pta_settings *parms);
+int hif_pta_priority(struct wfx_dev *wdev, u32 priority);
+int hif_pta_enable(struct wfx_dev *wdev, bool enable);
int hif_burn_prevent_rollback(struct wfx_dev *wdev, u32 magic_word);
int hif_sl_set_mac_key(struct wfx_dev *wdev,
const u8 *slk_key, int destination);
@@ -70,3 +70,74 @@ int wfx_nl_burn_antirollback(struct wiphy *wiphy, struct wireless_dev *widev,
return 0;
}
+int wfx_nl_pta_params(struct wiphy *wiphy, struct wireless_dev *widev,
+ const void *data, int data_len)
+{
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+ struct wfx_dev *wdev = (struct wfx_dev *)hw->priv;
+ int reply_size = nla_total_size(sizeof(wdev->pta_settings)) +
+ nla_total_size(sizeof(u8)) +
+ nla_total_size(sizeof(u32));
+ struct nlattr *tb[WFX_NL80211_ATTR_MAX];
+ bool do_enable = false;
+ struct sk_buff *msg;
+ struct nlattr *nla;
+ int rc;
+
+ rc = nla_parse(tb, WFX_NL80211_ATTR_MAX - 1, data, data_len,
+ wfx_nl_policy, NULL);
+ if (rc)
+ return rc;
+ nla = tb[WFX_NL80211_ATTR_PTA_ENABLE];
+ if (nla) {
+ do_enable = true;
+ wdev->pta_enable = nla_get_u8(tb[WFX_NL80211_ATTR_PTA_ENABLE]);
+ }
+ if (do_enable && !wdev->pta_enable)
+ rc = hif_pta_enable(wdev, wdev->pta_enable);
+ if (rc)
+ return rc;
+ nla = tb[WFX_NL80211_ATTR_PTA_SETTINGS];
+ if (nla) {
+ // User has to care about endianness of data it send.
+ memcpy(&wdev->pta_settings, nla_data(nla),
+ sizeof(wdev->pta_settings));
+ rc = hif_pta_settings(wdev, &wdev->pta_settings);
+ }
+ if (rc)
+ return rc;
+ nla = tb[WFX_NL80211_ATTR_PTA_PRIORITY];
+ if (nla) {
+ wdev->pta_priority =
+ nla_get_u32(tb[WFX_NL80211_ATTR_PTA_PRIORITY]);
+ rc = hif_pta_priority(wdev, wdev->pta_priority);
+ }
+ if (rc)
+ return rc;
+ if (do_enable && wdev->pta_enable)
+ rc = hif_pta_enable(wdev, wdev->pta_enable);
+ if (rc)
+ return rc;
+
+ msg = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, reply_size);
+ if (!msg)
+ return -ENOMEM;
+ rc = nla_put(msg, WFX_NL80211_ATTR_PTA_SETTINGS,
+ sizeof(wdev->pta_settings), &wdev->pta_settings);
+ if (rc)
+ goto error;
+ rc = nla_put_u32(msg, WFX_NL80211_ATTR_PTA_PRIORITY,
+ wdev->pta_priority);
+ if (rc)
+ goto error;
+ rc = nla_put_u8(msg, WFX_NL80211_ATTR_PTA_ENABLE,
+ wdev->pta_enable ? 1 : 0);
+ if (rc)
+ goto error;
+ return cfg80211_vendor_cmd_reply(msg);
+
+error:
+ kfree_skb(msg);
+ return rc;
+}
+
@@ -18,21 +18,31 @@ int wfx_nl_ps_timeout(struct wiphy *wiphy, struct wireless_dev *widev,
const void *data, int data_len);
int wfx_nl_burn_antirollback(struct wiphy *wiphy, struct wireless_dev *widev,
const void *data, int data_len);
+int wfx_nl_pta_params(struct wiphy *wiphy, struct wireless_dev *widev,
+ const void *data, int data_len);
enum {
WFX_NL80211_SUBCMD_PS_TIMEOUT = 0x10,
WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK = 0x20,
+ WFX_NL80211_SUBCMD_PTA_PARMS = 0x30,
};
enum {
WFX_NL80211_ATTR_PS_TIMEOUT = 1,
WFX_NL80211_ATTR_ROLLBACK_MAGIC = 2,
+ WFX_NL80211_ATTR_PTA_ENABLE = 3,
+ WFX_NL80211_ATTR_PTA_PRIORITY = 4,
+ WFX_NL80211_ATTR_PTA_SETTINGS = 5,
WFX_NL80211_ATTR_MAX
};
static const struct nla_policy wfx_nl_policy[WFX_NL80211_ATTR_MAX] = {
[WFX_NL80211_ATTR_PS_TIMEOUT] = NLA_POLICY_RANGE(NLA_S32, -1, 127),
[WFX_NL80211_ATTR_ROLLBACK_MAGIC] = { .type = NLA_U32 },
+ [WFX_NL80211_ATTR_PTA_ENABLE] = NLA_POLICY_MAX(NLA_U8, 1),
+ [WFX_NL80211_ATTR_PTA_PRIORITY] = { .type = NLA_U32 },
+ [WFX_NL80211_ATTR_PTA_SETTINGS] =
+ NLA_POLICY_EXACT_LEN(sizeof(struct hif_req_pta_settings)),
};
static const struct wiphy_vendor_command wfx_nl80211_vendor_commands[] = {
@@ -49,6 +59,12 @@ static const struct wiphy_vendor_command wfx_nl80211_vendor_commands[] = {
.policy = wfx_nl_policy,
.doit = wfx_nl_burn_antirollback,
.maxattr = WFX_NL80211_ATTR_MAX - 1,
+ }, {
+ .info.vendor_id = WFX_NL80211_ID,
+ .info.subcmd = WFX_NL80211_SUBCMD_PTA_PARMS,
+ .policy = wfx_nl_policy,
+ .doit = wfx_nl_pta_params,
+ .maxattr = WFX_NL80211_ATTR_MAX - 1,
},
};
@@ -60,6 +60,10 @@ struct wfx_dev {
struct mutex rx_stats_lock;
struct hif_tx_power_loop_info tx_power_loop_info;
struct mutex tx_power_loop_info_lock;
+
+ bool pta_enable;
+ u32 pta_priority;
+ struct hif_req_pta_settings pta_settings;
};
struct wfx_vif {