qtnfmac: switch to 32bit values for RTS/FRAG thresholds
authorSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Mon, 14 Jan 2019 09:39:40 +0000 (09:39 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 1 Feb 2019 12:11:57 +0000 (14:11 +0200)
Host wireless stack uses u32 type for RTS/FRAG threshold values.
Switch to u32 in driver: pass u32 values to firmware and let
firmware properly adapt these values according to its
internal representation.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/commands.c
drivers/net/wireless/quantenna/qtnfmac/qlink.h
drivers/net/wireless/quantenna/qtnfmac/qlink_util.h

index d03b3d03f4cc744df5955578d10ef171959c6d07..74dcbcfcd69489df9cfc8738c84abf3eee77c668 100644 (file)
@@ -1563,11 +1563,11 @@ static int qtnf_cmd_resp_proc_phy_params(struct qtnf_wmac *mac,
                switch (tlv_type) {
                case QTN_TLV_ID_FRAG_THRESH:
                        phy_thr = (void *)tlv;
-                       mac_info->frag_thr = (u32)le16_to_cpu(phy_thr->thr);
+                       mac_info->frag_thr = le32_to_cpu(phy_thr->thr);
                        break;
                case QTN_TLV_ID_RTS_THRESH:
                        phy_thr = (void *)tlv;
-                       mac_info->rts_thr = (u32)le16_to_cpu(phy_thr->thr);
+                       mac_info->rts_thr = le32_to_cpu(phy_thr->thr);
                        break;
                case QTN_TLV_ID_SRETRY_LIMIT:
                        limit = (void *)tlv;
@@ -1815,10 +1815,10 @@ int qtnf_cmd_send_update_phy_params(struct qtnf_wmac *mac, u32 changed)
        qtnf_bus_lock(mac->bus);
 
        if (changed & WIPHY_PARAM_FRAG_THRESHOLD)
-               qtnf_cmd_skb_put_tlv_u16(cmd_skb, QTN_TLV_ID_FRAG_THRESH,
+               qtnf_cmd_skb_put_tlv_u32(cmd_skb, QTN_TLV_ID_FRAG_THRESH,
                                         wiphy->frag_threshold);
        if (changed & WIPHY_PARAM_RTS_THRESHOLD)
-               qtnf_cmd_skb_put_tlv_u16(cmd_skb, QTN_TLV_ID_RTS_THRESH,
+               qtnf_cmd_skb_put_tlv_u32(cmd_skb, QTN_TLV_ID_RTS_THRESH,
                                         wiphy->rts_threshold);
        if (changed & WIPHY_PARAM_COVERAGE_CLASS)
                qtnf_cmd_skb_put_tlv_u8(cmd_skb, QTN_TLV_ID_COVERAGE_CLASS,
index a78cb9e05068a73288b191566615f8850af8f307..ace52e9d421dd76c791bf9b41b37d3ef441e312f 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <linux/ieee80211.h>
 
-#define QLINK_PROTO_VER                11
+#define QLINK_PROTO_VER                12
 
 #define QLINK_MACID_RSVD               0xFF
 #define QLINK_VIFID_RSVD               0xFF
@@ -1184,7 +1184,7 @@ struct qlink_iface_limit_record {
 
 struct qlink_tlv_frag_rts_thr {
        struct qlink_tlv_hdr hdr;
-       __le16 thr;
+       __le32 thr;
 } __packed;
 
 struct qlink_tlv_rlimit {
index 960d5d97492f9e67b2849bb296d2d7c4af3b825b..fc87827cb49c12bc373fca67bc7ffd2fc11a6a5f 100644 (file)
@@ -69,6 +69,17 @@ static inline void qtnf_cmd_skb_put_tlv_u16(struct sk_buff *skb,
        memcpy(hdr->val, &tmp, sizeof(tmp));
 }
 
+static inline void qtnf_cmd_skb_put_tlv_u32(struct sk_buff *skb,
+                                           u16 tlv_id, u32 value)
+{
+       struct qlink_tlv_hdr *hdr = skb_put(skb, sizeof(*hdr) + sizeof(value));
+       __le32 tmp = cpu_to_le32(value);
+
+       hdr->type = cpu_to_le16(tlv_id);
+       hdr->len = cpu_to_le16(sizeof(value));
+       memcpy(hdr->val, &tmp, sizeof(tmp));
+}
+
 u16 qlink_iface_type_to_nl_mask(u16 qlink_type);
 u8 qlink_chan_width_mask_to_nl(u16 qlink_mask);
 void qlink_chandef_q2cfg(struct wiphy *wiphy,