hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/net/wireless/quantenna/qtnfmac/bus.h
....@@ -1,18 +1,5 @@
1
-/*
2
- * Copyright (c) 2015 Quantenna Communications
3
- *
4
- * Permission to use, copy, modify, and/or distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
- */
1
+/* SPDX-License-Identifier: GPL-2.0+ */
2
+/* Copyright (c) 2015 Quantenna Communications. All rights reserved. */
163
174 #ifndef QTNFMAC_BUS_H
185 #define QTNFMAC_BUS_H
....@@ -20,15 +7,27 @@
207 #include <linux/netdevice.h>
218 #include <linux/workqueue.h>
229
10
+#include "trans.h"
11
+#include "core.h"
12
+
2313 #define QTNF_MAX_MAC 3
2414
15
+#define HBM_FRAME_META_MAGIC_PATTERN_S 0xAB
16
+#define HBM_FRAME_META_MAGIC_PATTERN_E 0xBA
17
+
18
+struct qtnf_frame_meta_info {
19
+ u8 magic_s;
20
+ u8 ifidx;
21
+ u8 macid;
22
+ u8 magic_e;
23
+} __packed;
24
+
2525 enum qtnf_fw_state {
26
- QTNF_FW_STATE_RESET,
27
- QTNF_FW_STATE_FW_DNLD_DONE,
26
+ QTNF_FW_STATE_DETACHED,
2827 QTNF_FW_STATE_BOOT_DONE,
2928 QTNF_FW_STATE_ACTIVE,
30
- QTNF_FW_STATE_DETACHED,
31
- QTNF_FW_STATE_EP_DEAD,
29
+ QTNF_FW_STATE_RUNNING,
30
+ QTNF_FW_STATE_DEAD,
3231 };
3332
3433 struct qtnf_bus;
....@@ -42,8 +41,10 @@
4241 int (*control_tx)(struct qtnf_bus *, struct sk_buff *);
4342
4443 /* data xfer methods */
45
- int (*data_tx)(struct qtnf_bus *, struct sk_buff *);
44
+ int (*data_tx)(struct qtnf_bus *bus, struct sk_buff *skb,
45
+ unsigned int macid, unsigned int vifid);
4646 void (*data_tx_timeout)(struct qtnf_bus *, struct net_device *);
47
+ void (*data_tx_use_meta_set)(struct qtnf_bus *bus, bool use_meta);
4748 void (*data_rx_start)(struct qtnf_bus *);
4849 void (*data_rx_stop)(struct qtnf_bus *);
4950 };
....@@ -53,22 +54,40 @@
5354 enum qtnf_fw_state fw_state;
5455 u32 chip;
5556 u32 chiprev;
56
- const struct qtnf_bus_ops *bus_ops;
57
+ struct qtnf_bus_ops *bus_ops;
5758 struct qtnf_wmac *mac[QTNF_MAX_MAC];
5859 struct qtnf_qlink_transport trans;
5960 struct qtnf_hw_info hw_info;
60
- char fwname[32];
6161 struct napi_struct mux_napi;
6262 struct net_device mux_dev;
63
- struct completion firmware_init_complete;
6463 struct workqueue_struct *workqueue;
64
+ struct workqueue_struct *hprio_workqueue;
6565 struct work_struct fw_work;
6666 struct work_struct event_work;
6767 struct mutex bus_lock; /* lock during command/event processing */
6868 struct dentry *dbg_dir;
69
+ struct notifier_block netdev_nb;
70
+ u8 hw_id[ETH_ALEN];
6971 /* bus private data */
70
- char bus_priv[0] __aligned(sizeof(void *));
72
+ char bus_priv[] __aligned(sizeof(void *));
7173 };
74
+
75
+static inline bool qtnf_fw_is_up(struct qtnf_bus *bus)
76
+{
77
+ enum qtnf_fw_state state = bus->fw_state;
78
+
79
+ return ((state == QTNF_FW_STATE_ACTIVE) ||
80
+ (state == QTNF_FW_STATE_RUNNING));
81
+}
82
+
83
+static inline bool qtnf_fw_is_attached(struct qtnf_bus *bus)
84
+{
85
+ enum qtnf_fw_state state = bus->fw_state;
86
+
87
+ return ((state == QTNF_FW_STATE_ACTIVE) ||
88
+ (state == QTNF_FW_STATE_RUNNING) ||
89
+ (state == QTNF_FW_STATE_DEAD));
90
+}
7291
7392 static inline void *get_bus_priv(struct qtnf_bus *bus)
7493 {
....@@ -94,9 +113,10 @@
94113 bus->bus_ops->stop(bus);
95114 }
96115
97
-static inline int qtnf_bus_data_tx(struct qtnf_bus *bus, struct sk_buff *skb)
116
+static inline int qtnf_bus_data_tx(struct qtnf_bus *bus, struct sk_buff *skb,
117
+ unsigned int macid, unsigned int vifid)
98118 {
99
- return bus->bus_ops->data_tx(bus, skb);
119
+ return bus->bus_ops->data_tx(bus, skb, macid, vifid);
100120 }
101121
102122 static inline void
....@@ -134,7 +154,5 @@
134154
135155 int qtnf_core_attach(struct qtnf_bus *bus);
136156 void qtnf_core_detach(struct qtnf_bus *bus);
137
-void qtnf_txflowblock(struct device *dev, bool state);
138
-void qtnf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
139157
140158 #endif /* QTNFMAC_BUS_H */