From 297b60346df8beafee954a0fd7c2d64f33f3b9bc Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 11 May 2024 01:44:05 +0000
Subject: [PATCH] rtl8211F_led_control
---
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/wlfc_proto.h | 172 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 118 insertions(+), 54 deletions(-)
diff --git a/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/wlfc_proto.h b/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/wlfc_proto.h
index e604d53..c1fc5ea 100644
--- a/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/wlfc_proto.h
+++ b/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/wlfc_proto.h
@@ -1,13 +1,14 @@
-/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (C) 1999-2019, Broadcom Corporation
- *
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
+ *
+ * Copyright (C) 1999-2017, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -15,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -23,12 +24,11 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
- * $Id: wlfc_proto.h 542895 2015-03-22 14:13:12Z $
+ * $Id: wlfc_proto.h 692466 2017-03-28 07:48:19Z $
*
*/
/** WL flow control for PROP_TXSTATUS. Related to host AMPDU reordering. */
-
#ifndef __wlfc_proto_definitions_h__
#define __wlfc_proto_definitions_h__
@@ -82,37 +82,47 @@
---------------------------------------------------------------------------
*/
-#define WLFC_CTL_TYPE_MAC_OPEN 1
-#define WLFC_CTL_TYPE_MAC_CLOSE 2
-#define WLFC_CTL_TYPE_MAC_REQUEST_CREDIT 3
-#define WLFC_CTL_TYPE_TXSTATUS 4
-#define WLFC_CTL_TYPE_PKTTAG 5 /** host<->dongle */
+typedef enum {
+ WLFC_CTL_TYPE_MAC_OPEN = 1,
+ WLFC_CTL_TYPE_MAC_CLOSE = 2,
+ WLFC_CTL_TYPE_MAC_REQUEST_CREDIT = 3,
+ WLFC_CTL_TYPE_TXSTATUS = 4,
+ WLFC_CTL_TYPE_PKTTAG = 5, /** host<->dongle */
-#define WLFC_CTL_TYPE_MACDESC_ADD 6
-#define WLFC_CTL_TYPE_MACDESC_DEL 7
-#define WLFC_CTL_TYPE_RSSI 8
+ WLFC_CTL_TYPE_MACDESC_ADD = 6,
+ WLFC_CTL_TYPE_MACDESC_DEL = 7,
+ WLFC_CTL_TYPE_RSSI = 8,
-#define WLFC_CTL_TYPE_INTERFACE_OPEN 9
-#define WLFC_CTL_TYPE_INTERFACE_CLOSE 10
+ WLFC_CTL_TYPE_INTERFACE_OPEN = 9,
+ WLFC_CTL_TYPE_INTERFACE_CLOSE = 10,
-#define WLFC_CTL_TYPE_FIFO_CREDITBACK 11
+ WLFC_CTL_TYPE_FIFO_CREDITBACK = 11,
-#define WLFC_CTL_TYPE_PENDING_TRAFFIC_BMP 12 /** host->dongle */
-#define WLFC_CTL_TYPE_MAC_REQUEST_PACKET 13
-#define WLFC_CTL_TYPE_HOST_REORDER_RXPKTS 14
+ WLFC_CTL_TYPE_PENDING_TRAFFIC_BMP = 12, /** host->dongle */
+ WLFC_CTL_TYPE_MAC_REQUEST_PACKET = 13,
+ WLFC_CTL_TYPE_HOST_REORDER_RXPKTS = 14,
-#define WLFC_CTL_TYPE_TX_ENTRY_STAMP 15
-#define WLFC_CTL_TYPE_RX_STAMP 16
-#define WLFC_CTL_TYPE_TX_STATUS_STAMP 17 /** obsolete */
+ WLFC_CTL_TYPE_TX_ENTRY_STAMP = 15,
+ WLFC_CTL_TYPE_RX_STAMP = 16,
+ WLFC_CTL_TYPE_TX_STATUS_STAMP = 17, /** obsolete */
-#define WLFC_CTL_TYPE_TRANS_ID 18
-#define WLFC_CTL_TYPE_COMP_TXSTATUS 19
+ WLFC_CTL_TYPE_TRANS_ID = 18,
+ WLFC_CTL_TYPE_COMP_TXSTATUS = 19,
-#define WLFC_CTL_TYPE_TID_OPEN 20
-#define WLFC_CTL_TYPE_TID_CLOSE 21
+ WLFC_CTL_TYPE_TID_OPEN = 20,
+ WLFC_CTL_TYPE_TID_CLOSE = 21,
+ WLFC_CTL_TYPE_UPD_FLR_WEIGHT = 22,
+ WLFC_CTL_TYPE_ENAB_FFSCH = 23,
+ WLFC_CTL_TYPE_UPDATE_FLAGS = 24, /* clear the flags set in flowring */
+ WLFC_CTL_TYPE_CLEAR_SUPPR = 25, /* free the supression info in the flowring */
+ WLFC_CTL_TYPE_FLOWID_OPEN = 26,
+ WLFC_CTL_TYPE_FLOWID_CLOSE = 27,
-#define WLFC_CTL_TYPE_FILLER 255
+ WLFC_CTL_TYPE_FILLER = 255
+} wlfc_ctl_type_t;
+
+#define WLFC_CTL_VALUE_LEN_FLOWID 2
#define WLFC_CTL_VALUE_LEN_MACDESC 8 /** handle, interface, MAC */
@@ -128,6 +138,14 @@
#define WLFC_CTL_VALUE_LEN_SEQ 2
+/* Reset the flags set for the corresponding flowring of the SCB which is de-inited */
+/* FLOW_RING_FLAG_LAST_TIM | FLOW_RING_FLAG_INFORM_PKTPEND | FLOW_RING_FLAG_PKT_REQ */
+#define WLFC_RESET_ALL_FLAGS 0
+#define WLFC_CTL_VALUE_LEN_FLAGS 7 /** flags, MAC */
+
+/* free the data stored to be used for suppressed packets in future */
+#define WLFC_CTL_VALUE_LEN_SUPR 7 /** tid, MAC */
+
/* The high bits of ratespec report in timestamp are used for various status */
#define WLFC_TSFLAGS_RX_RETRY (1 << 31)
#define WLFC_TSFLAGS_PM_ENABLED (1 << 30)
@@ -139,9 +157,9 @@
#define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */
#define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */
-
#define WLFC_PKTFLAG_PKTFROMHOST 0x01
#define WLFC_PKTFLAG_PKT_REQUESTED 0x02
+#define WLFC_PKTFLAG_PKT_SENDTOHOST 0x04
#define WL_TXSTATUS_STATUS_MASK 0xff /* allow 8 bits */
#define WL_TXSTATUS_STATUS_SHIFT 24
@@ -206,44 +224,68 @@
((ctr) & WL_TXSTATUS_FREERUNCTR_MASK))
#define WL_TXSTATUS_GET_FREERUNCTR(x) ((x)& WL_TXSTATUS_FREERUNCTR_MASK)
-/* Seq number part of AMSDU */
+/* AMSDU part of d11 seq number */
#define WL_SEQ_AMSDU_MASK 0x1 /* allow 1 bit */
#define WL_SEQ_AMSDU_SHIFT 14
#define WL_SEQ_SET_AMSDU(x, val) ((x) = \
((x) & ~(WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT)) | \
- (((val) & WL_SEQ_AMSDU_MASK) << WL_SEQ_AMSDU_SHIFT))
-#define WL_SEQ_GET_AMSDU(x) (((x) >> WL_SEQ_AMSDU_SHIFT) & \
- WL_SEQ_AMSDU_MASK)
+ (((val) & WL_SEQ_AMSDU_MASK) << WL_SEQ_AMSDU_SHIFT)) /**< sets a single AMSDU bit */
+/** returns TRUE if ring item is AMSDU (seq = d11 seq nr) */
+#define WL_SEQ_IS_AMSDU(x) (((x) >> WL_SEQ_AMSDU_SHIFT) & \
+ WL_SEQ_AMSDU_MASK)
-/* Seq number is valid coming from FW */
+/* indicates last_suppr_seq is valid */
+#define WL_SEQ_VALIDSUPPR_MASK 0x1 /* allow 1 bit */
+#define WL_SEQ_VALIDSUPPR_SHIFT 12
+#define WL_SEQ_SET_VALIDSUPPR(x, val) ((x) = \
+ ((x) & ~(WL_SEQ_VALIDSUPPR_MASK << WL_SEQ_VALIDSUPPR_SHIFT)) | \
+ (((val) & WL_SEQ_VALIDSUPPR_MASK) << WL_SEQ_VALIDSUPPR_SHIFT))
+#define WL_SEQ_GET_VALIDSUPPR(x) (((x) >> WL_SEQ_VALIDSUPPR_SHIFT) & \
+ WL_SEQ_VALIDSUPPR_MASK)
+
#define WL_SEQ_FROMFW_MASK 0x1 /* allow 1 bit */
#define WL_SEQ_FROMFW_SHIFT 13
#define WL_SEQ_SET_FROMFW(x, val) ((x) = \
((x) & ~(WL_SEQ_FROMFW_MASK << WL_SEQ_FROMFW_SHIFT)) | \
(((val) & WL_SEQ_FROMFW_MASK) << WL_SEQ_FROMFW_SHIFT))
-#define WL_SEQ_GET_FROMFW(x) (((x) >> WL_SEQ_FROMFW_SHIFT) & \
- WL_SEQ_FROMFW_MASK)
+/** Set when firmware assigns D11 sequence number to packet */
+#define SET_WL_HAS_ASSIGNED_SEQ(x) WL_SEQ_SET_FROMFW((x), 1)
+
+/** returns TRUE if packet has been assigned a d11 seq number by the WL firmware layer */
+#define GET_WL_HAS_ASSIGNED_SEQ(x) (((x) >> WL_SEQ_FROMFW_SHIFT) & WL_SEQ_FROMFW_MASK)
/**
* Proptxstatus related.
*
- * Pkt from bus layer (DHD for SDIO and pciedev for PCIE)
- * is re-using seq number previously suppressed
- * so FW should not assign new one
+ * When a packet is suppressed by WL or the D11 core, the packet has to be retried. Assigning
+ * a new d11 sequence number for the packet when retrying would cause the peer to be unable to
+ * reorder the packets within an AMPDU. So, suppressed packet from bus layer (DHD for SDIO and
+ * pciedev for PCIE) is re-using d11 seq number, so FW should not assign a new one.
*/
#define WL_SEQ_FROMDRV_MASK 0x1 /* allow 1 bit */
#define WL_SEQ_FROMDRV_SHIFT 12
-#define WL_SEQ_SET_FROMDRV(x, val) ((x) = \
+
+/**
+ * Proptxstatus, host or fw PCIe layer requests WL layer to reuse d11 seq no. Bit is reset by WL
+ * subsystem when it reuses the seq number.
+ */
+#define WL_SEQ_SET_REUSE(x, val) ((x) = \
((x) & ~(WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT)) | \
(((val) & WL_SEQ_FROMDRV_MASK) << WL_SEQ_FROMDRV_SHIFT))
-#define WL_SEQ_GET_FROMDRV(x) (((x) >> WL_SEQ_FROMDRV_SHIFT) & \
+#define SET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 1)
+#define RESET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 0)
+
+/** Proptxstatus, related to reuse of d11 seq numbers when retransmitting */
+#define IS_WL_TO_REUSE_SEQ(x) (((x) >> WL_SEQ_FROMDRV_SHIFT) & \
WL_SEQ_FROMDRV_MASK)
#define WL_SEQ_NUM_MASK 0xfff /* allow 12 bit */
#define WL_SEQ_NUM_SHIFT 0
+/** Proptxstatus, sets d11seq no in pkt tag, related to reuse of d11seq no when retransmitting */
#define WL_SEQ_SET_NUM(x, val) ((x) = \
((x) & ~(WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) | \
(((val) & WL_SEQ_NUM_MASK) << WL_SEQ_NUM_SHIFT))
+/** Proptxstatus, gets d11seq no from pkt tag, related to reuse of d11seq no when retransmitting */
#define WL_SEQ_GET_NUM(x) (((x) >> WL_SEQ_NUM_SHIFT) & \
WL_SEQ_NUM_MASK)
@@ -265,7 +307,6 @@
#define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \
~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT)
-
#define WLFC_MAX_PENDING_DATALEN 120
/* host is free to discard the packet */
@@ -282,28 +323,26 @@
#define WLFC_CTL_PKTFLAG_DISCARD_NOACK 4
/* Firmware wrongly reported suppressed previously,now fixing to acked */
#define WLFC_CTL_PKTFLAG_SUPPRESS_ACKED 5
-
-#define WLFC_D11_STATUS_INTERPRET(txs) \
- ((txs)->status.was_acked ? WLFC_CTL_PKTFLAG_DISCARD : \
- (TXS_SUPR_MAGG_DONE((txs)->status.suppr_ind) ? \
- WLFC_CTL_PKTFLAG_DISCARD_NOACK : WLFC_CTL_PKTFLAG_D11SUPPRESS))
-
+/* Firmware send this packet expired, lifetime expiration */
+#define WLFC_CTL_PKTFLAG_EXPIRED 6
+/* Firmware drop this packet for any other reason */
+#define WLFC_CTL_PKTFLAG_DROPPED 7
+/* Firmware free this packet */
+#define WLFC_CTL_PKTFLAG_MKTFREE 8
+#define WLFC_CTL_PKTFLAG_MASK (0x0f) /* For 4-bit mask with one extra bit */
#ifdef PROP_TXSTATUS_DEBUG
#define WLFC_DBGMESG(x) printf x
/* wlfc-breadcrumb */
#define WLFC_BREADCRUMB(x) do {if ((x) == NULL) \
{printf("WLFC: %s():%d:caller:%p\n", \
- __FUNCTION__, __LINE__, __builtin_return_address(0));}} while (0)
-#define WLFC_PRINTMAC(banner, ea) do {printf("%s MAC: [%02x:%02x:%02x:%02x:%02x:%02x]\n", \
- banner, ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); } while (0)
+ __FUNCTION__, __LINE__, CALL_SITE);}} while (0)
#define WLFC_WHEREIS(s) printf("WLFC: at %s():%d, %s\n", __FUNCTION__, __LINE__, (s))
#else
#define WLFC_DBGMESG(x)
#define WLFC_BREADCRUMB(x)
-#define WLFC_PRINTMAC(banner, ea)
#define WLFC_WHEREIS(s)
-#endif
+#endif /* PROP_TXSTATUS_DEBUG */
/* AMPDU host reorder packet flags */
#define WLHOST_REORDERDATA_MAXFLOWS 256
@@ -334,18 +373,43 @@
#define WLFC_SET_AFQ(x, val) ((x) = \
((x) & ~(1 << WLFC_MODE_AFQ_SHIFT)) | \
(((val) & 1) << WLFC_MODE_AFQ_SHIFT))
+/** returns TRUE if firmware supports 'at firmware queue' feature */
#define WLFC_GET_AFQ(x) (((x) >> WLFC_MODE_AFQ_SHIFT) & 1)
#define WLFC_MODE_REUSESEQ_SHIFT 3 /* seq reuse bit */
#define WLFC_SET_REUSESEQ(x, val) ((x) = \
((x) & ~(1 << WLFC_MODE_REUSESEQ_SHIFT)) | \
(((val) & 1) << WLFC_MODE_REUSESEQ_SHIFT))
+
+/** returns TRUE if 'd11 sequence reuse' has been agreed upon between host and dongle */
+#if defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK)
+/* GET_REUSESEQ is always TRUE in pciedev */
+#define WLFC_GET_REUSESEQ(x) (TRUE)
+#else
#define WLFC_GET_REUSESEQ(x) (((x) >> WLFC_MODE_REUSESEQ_SHIFT) & 1)
+#endif /* defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) */
#define WLFC_MODE_REORDERSUPP_SHIFT 4 /* host reorder suppress pkt bit */
#define WLFC_SET_REORDERSUPP(x, val) ((x) = \
((x) & ~(1 << WLFC_MODE_REORDERSUPP_SHIFT)) | \
(((val) & 1) << WLFC_MODE_REORDERSUPP_SHIFT))
+/** returns TRUE if 'reorder suppress' has been agreed upon between host and dongle */
#define WLFC_GET_REORDERSUPP(x) (((x) >> WLFC_MODE_REORDERSUPP_SHIFT) & 1)
+#define FLOW_RING_CREATE 1
+#define FLOW_RING_DELETE 2
+#define FLOW_RING_FLUSH 3
+#define FLOW_RING_OPEN 4
+#define FLOW_RING_CLOSED 5
+#define FLOW_RING_FLUSHED 6
+#define FLOW_RING_TIM_SET 7
+#define FLOW_RING_TIM_RESET 8
+#define FLOW_RING_FLUSH_TXFIFO 9
+#define FLOW_RING_GET_PKT_MAX 10
+#define FLOW_RING_RESET_WEIGHT 11
+#define FLOW_RING_UPD_PRIOMAP 12
+
+/* bit 7, indicating if is TID(1) or AC(0) mapped info in tid field) */
+#define PCIEDEV_IS_AC_TID_MAP_MASK 0x80
+
#endif /* __wlfc_proto_definitions_h__ */
--
Gitblit v1.6.2