diff mbox series

[RFC,v1,232/256] cl8k: add vendor_cmd.h

Message ID 20210617160223.160998-233-viktor.barna@celeno.com (mailing list archive)
State RFC
Delegated to: Kalle Valo
Headers show
Series wireless: cl8k driver for Celeno IEEE 802.11ax devices | expand

Commit Message

Viktor Barna June 17, 2021, 4:01 p.m. UTC
From: Viktor Barna <viktor.barna@celeno.com>

(Part of the split. Please, take a look at the cover letter for more
details).

Signed-off-by: Viktor Barna <viktor.barna@celeno.com>
---
 drivers/net/wireless/celeno/cl8k/vendor_cmd.h | 116 ++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 drivers/net/wireless/celeno/cl8k/vendor_cmd.h

--
2.30.0
diff mbox series

Patch

diff --git a/drivers/net/wireless/celeno/cl8k/vendor_cmd.h b/drivers/net/wireless/celeno/cl8k/vendor_cmd.h
new file mode 100644
index 000000000000..9c7c3fe571be
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/vendor_cmd.h
@@ -0,0 +1,116 @@ 
+/* SPDX-License-Identifier: MIT */
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#ifndef CL_VENDOR_CMD_H
+#define CL_VENDOR_CMD_H
+
+/*
+ * DOC: Vendor commands
+ *
+ * A driver supporting vendor commands must register them as an array
+ * in struct wiphy, with handlers for each one, each command has an
+ * OUI and sub command ID to identify it.
+ *
+ * Note that this feature should not be (ab)used to implement protocol
+ * features that could openly be shared across drivers. In particular,
+ * it must never be required to use vendor commands to implement any
+ * "normal" functionality that higher-level userspace like connection
+ * managers etc. need.
+ */
+
+#include "def.h"
+#include "e2p.h"
+
+#define VENDOR_CMD_TIMER_PERIOD_MS 5000
+
+/* Celeno OUI - see http://www.my-ip.club/oui-info/00-1C-51 */
+#define CELENO_OUI 0x001c51
+
+struct cl_hw;
+
+enum cl_vndr_cmds {
+       CL_VNDR_CMDS_UNSPEC,
+       CL_VNDR_CMDS_CECLI,
+       CL_VNDR_CMDS_E2P,
+       CL_VNDR_CMDS_ATE,
+       CL_VNDR_CMDS_HELP,
+       CL_VNDR_CMDS_LAST
+};
+
+enum cl_vndr_events {
+       CL_VENDOR_EVENT_ASYNC,
+
+       CL_VENDOR_EVENT_LAST
+};
+
+/* Enum cl_vndr_nlattrs - nl80211 message attributes */
+enum cl_vndr_nlattrs {
+       CL_VENDOR_ATTR_UNSPEC,
+       CL_VENDOR_ATTR_REPLY,
+       CL_VENDOR_ATTR_DATA,
+       CL_VENDOR_ATTR_LEN,
+
+       NUM_CL_VENDOR_ATTR,
+       MAX_CL_VENDOR_ATTR = NUM_CL_VENDOR_ATTR - 1
+};
+
+struct point {
+       u8 chan;
+       u8 phy;
+       u8 idx;
+       u16 addr;
+       struct eeprom_phy_calib calib;
+} __packed;
+
+#define CLI_MAX_PARAMS 32
+
+enum {
+       E2P_MODE_BIN,
+       E2P_MODE_EEPROM,
+
+       E2P_MODE_MAX
+};
+
+struct wiphy;
+void cl_vendor_cmds_init(struct wiphy *wiphy);
+
+/* Note: data structures used by kernel and by userspace */
+struct ate_stats {
+       u32 tx_bw20;
+       u32 tx_bw40;
+       u32 tx_bw80;
+       u32 tx_bw160;
+       u32 rx_bw20;
+       u32 rx_bw40;
+       u32 rx_bw80;
+       u32 rx_bw160;
+       u32 fcs_err;
+       u32 phy_err;
+       u32 delimiter_err;
+       u32 rx_success;
+       s8 rssi0;
+       s8 rssi1;
+       s8 rssi2;
+       s8 rssi3;
+       s8 rssi4;
+       s8 rssi5;
+};
+
+struct cli_params {
+       u32 num_params;
+       char option;
+       s32 params[CLI_MAX_PARAMS];
+};
+
+#define MSG_SIZE 4095
+
+struct cl_msg_data {
+       char more_data;
+       char data[MSG_SIZE];
+} __attribute__((__packed__));
+
+int cl_vendor_reply(struct cl_hw *cl_hw, void *data, u16 len);
+void cl_vendor_timer_init(struct cl_hw *cl_hw);
+void cl_vendor_timer_close(struct cl_hw *cl_hw);
+
+#endif /* CL_VENDOR_CMD_H */