new file mode 100644
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#ifndef CL_UTILS_H
+#define CL_UTILS_H
+
+#include "hw.h"
+#include "vendor_cmd.h"
+#include "vif.h"
+#include "ipc_shared.h"
+#include "ieee80211_i.h"
+
+static const u8 tid_to_ac[] = {
+ AC_BE, AC_BK, AC_BK, AC_BE, AC_VI, AC_VI, AC_VO, AC_VO
+};
+
+static inline struct cl_vif *NETDEV_TO_CL_VIF(struct net_device *dev)
+{
+ struct ieee80211_sub_if_data *sdata = netdev_priv(dev);
+
+ return (struct cl_vif *)(sdata->vif.drv_priv);
+}
+
+static inline struct cl_hw *NETDEV_TO_CL_HW(struct net_device *dev)
+{
+ struct ieee80211_sub_if_data *sdata = netdev_priv(dev);
+
+ return sdata->local->hw.priv;
+}
+
+static inline struct cl_hw *WIPHY_TO_CL_HW(struct wiphy *wiphy)
+{
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+
+ return (struct cl_hw *)hw->priv;
+}
+
+void cl_hex_dump(char *caption, u8 *buffer, u32 length, u32 offset, bool is_byte);
+
+bool cl_is_valid_auth_mode(bool wpa_ie, u8 auth_mode);
+bool cl_is_open_auth_mode(u8 auth_mode);
+u8 convert_gi_format_wrs_to_fw(u8 wrs_mode, u8 gi);
+u8 convert_gi_format_fw_to_wrs(u8 format_mode, u8 gi);
+u8 cl_map_gi_to_ltf(u8 mode, u8 gi);
+
+s8 cl_calc_noise_floor(struct cl_hw *cl_hw, const s8 *reg_noise_floor);
+
+u8 cl_convert_signed_to_reg_value(s8 val);
+
+u8 width_to_bw(enum nl80211_chan_width width);
+enum nl80211_chan_width bw_to_width(u8 bw);
+u64 cl_get_tsf_u64(struct cl_hw *cl_hw);
+
+u8 cl_center_freq_offset(u8 bw);
+
+u8 max_bw_idx(u8 wrs_mode, bool is_24g);
+
+bool cl_hw_mode_is_b_or_bg(struct cl_hw *cl_hw);
+
+void cl_snprintf(char **buf, int *offset, size_t *size, const char *fmt, ...);
+
+bool cl_is_eapol(struct sk_buff *skb);
+
+static inline bool cl_are_host_bytes_le(void)
+{
+#ifdef __LITTLE_ENDIAN
+ return true;
+#else
+ return false;
+#endif /* __LITTLE_ENDIAN */
+}
+
+/* Most likely, bit endianess is the same as the byte endianess, but turn on
+ * paranoid mode and check separately */
+static inline bool cl_are_host_bits_le(void)
+{
+#ifdef __LITTLE_ENDIAN_BITFIELD
+ return true;
+#else
+ return false;
+#endif /* __LITTLE_ENDIAN_BITFIELD */
+}
+
+/* We could inverse *_le checks here, but the motivation is the, as per bits
+ * endianess - anyway, it is better to check */
+static inline bool cl_are_host_bytes_be(void)
+{
+#ifdef __BIG_ENDIAN
+ return true;
+#else
+ return false;
+#endif /* __BIG_ENDIAN */
+}
+
+static inline bool cl_are_host_bits_be(void)
+{
+#ifdef __BIG_ENDIAN_BITFIELD
+ return true;
+#else
+ return false;
+#endif /* __BIG_ENDIAN_BITFIELD */
+}
+
+#endif /* CL_UTILS_H */