wil6210: Helpers to deal with 'cidxtid' fields
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Mon, 17 Mar 2014 13:34:05 +0000 (15:34 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 17 Mar 2014 17:44:16 +0000 (13:44 -0400)
Encode/decode helpers

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wil6210/txrx.c
drivers/net/wireless/ath/wil6210/wil6210.h

index 092081e209dab5f863bf34e24f4721bf9e014d27..7afaa5e5c42e438f7bb1fcd07469e4ca67cd37e0 100644 (file)
@@ -588,7 +588,7 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
                                .ring_size = cpu_to_le16(size),
                        },
                        .ringid = id,
-                       .cidxtid = (cid & 0xf) | ((tid & 0xf) << 4),
+                       .cidxtid = mk_cidxtid(cid, tid),
                        .encap_trans_type = WMI_VRING_ENC_TYPE_802_3,
                        .mac_ctrl = 0,
                        .to_resolution = 0,
index 980dccc82b32c3dffc2b2d4a7bdc4c8847fa19a2..273d00f86130ac22fc51ea4d7268dbb66ea80b56 100644 (file)
@@ -125,6 +125,31 @@ struct RGF_ICR {
 
 /* Hardware definitions end */
 
+/**
+ * mk_cidxtid - construct @cidxtid field
+ * @cid: CID value
+ * @tid: TID value
+ *
+ * @cidxtid field encoded as bits 0..3 - CID; 4..7 - TID
+ */
+static inline u8 mk_cidxtid(u8 cid, u8 tid)
+{
+       return ((tid & 0xf) << 4) | (cid & 0xf);
+}
+
+/**
+ * parse_cidxtid - parse @cidxtid field
+ * @cid: store CID value here
+ * @tid: store TID value here
+ *
+ * @cidxtid field encoded as bits 0..3 - CID; 4..7 - TID
+ */
+static inline void parse_cidxtid(u8 cidxtid, u8 *cid, u8 *tid)
+{
+       *cid = cidxtid & 0xf;
+       *tid = (cidxtid >> 4) & 0xf;
+}
+
 struct wil6210_mbox_ring {
        u32 base;
        u16 entry_size; /* max. size of mbox entry, incl. all headers */