Skip to content

Commit

Permalink
mt76: update to version 2020-03-10
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Mar 13, 2020
1 parent 8b4a939 commit 372f598
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package/kernel/mac80211/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
# Copyright (C) 2007-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From: Hauke Mehrtens <[email protected]>
Date: Fri, 27 Sep 2019 23:12:08 +0200
Subject: [PATCH] backports: pci: Include linux/pci-aspm.h

In upstream commit 7ce2e76a0420 linux/pci-aspm.h was removed and the
content included into pci.h. Add an include to have the functions
defined in linux/pci-aspm.h available when linux/pci.h is included.

Signed-off-by: Hauke Mehrtens <[email protected]>
---

--- a/backport-include/linux/pci.h
+++ b/backport-include/linux/pci.h
@@ -3,6 +3,10 @@
#include_next <linux/pci.h>
#include <linux/version.h>

+#if LINUX_VERSION_IS_LESS(5,4,0)
+#include <linux/pci-aspm.h>
+#endif
+
#ifndef module_pci_driver
/**
* module_pci_driver() - Helper macro for registering a PCI driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From: Felix Fietkau <[email protected]>
Date: Mon, 28 Oct 2019 15:20:40 +0100
Subject: [PATCH] backport: add pci_disable_link_state wrapper with return code

The signature of pci_disable_link_state was changed to indicate if the state
was successfully disabled. Since the old version did not have this, add a
wrapper which checks the pcie register to determine the return code

Signed-off-by: Felix Fietkau <[email protected]>
---

--- a/backport-include/linux/pci.h
+++ b/backport-include/linux/pci.h
@@ -236,4 +236,29 @@ static inline struct pci_dev *pcie_find_
(PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX)
#endif

+#if defined(CONFIG_PCI) && LINUX_VERSION_IS_LESS(5,3,0)
+
+static inline int
+LINUX_BACKPORT(pci_disable_link_state)(struct pci_dev *pdev, int state)
+{
+ u16 aspmc;
+
+ pci_disable_link_state(pdev, state);
+
+ pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspmc);
+ if ((state & PCIE_LINK_STATE_L0S) &&
+ (aspmc & PCI_EXP_LNKCTL_ASPM_L0S))
+ return -EPERM;
+
+ if ((state & PCIE_LINK_STATE_L1) &&
+ (aspmc & PCI_EXP_LNKCTL_ASPM_L1))
+ return -EPERM;
+
+ return 0;
+}
+
+#define pci_disable_link_state LINUX_BACKPORT(pci_disable_link_state)
+
+#endif
+
#endif /* _BACKPORT_LINUX_PCI_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From: David Bauer <[email protected]>
Date: Mon, 16 Dec 2019 20:47:06 +0100
Subject: [PATCH] rt2x00: add throughput LED trigger

This adds a (currently missing) throughput LED trigger for the rt2x00
driver. Previously, LED triggers had to be assigned to the netdev, which
was limited to a single VAP.

Signed-off-by: David Bauer <[email protected]>
Tested-by: Christoph Krapp <[email protected]>

--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
@@ -1140,6 +1140,19 @@ static void rt2x00lib_remove_hw(struct r
kfree(rt2x00dev->spec.channels_info);
}

+static const struct ieee80211_tpt_blink rt2x00_tpt_blink[] = {
+ { .throughput = 0 * 1024, .blink_time = 334 },
+ { .throughput = 1 * 1024, .blink_time = 260 },
+ { .throughput = 2 * 1024, .blink_time = 220 },
+ { .throughput = 5 * 1024, .blink_time = 190 },
+ { .throughput = 10 * 1024, .blink_time = 170 },
+ { .throughput = 25 * 1024, .blink_time = 150 },
+ { .throughput = 54 * 1024, .blink_time = 130 },
+ { .throughput = 120 * 1024, .blink_time = 110 },
+ { .throughput = 265 * 1024, .blink_time = 80 },
+ { .throughput = 586 * 1024, .blink_time = 50 },
+};
+
static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
{
struct hw_mode_spec *spec = &rt2x00dev->spec;
@@ -1222,6 +1235,10 @@ static int rt2x00lib_probe_hw(struct rt2

#undef RT2X00_TASKLET_INIT

+ ieee80211_create_tpt_led_trigger(rt2x00dev->hw,
+ IEEE80211_TPT_LEDTRIG_FL_RADIO, rt2x00_tpt_blink,
+ ARRAY_SIZE(rt2x00_tpt_blink));
+
/*
* Register HW.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
From: Felix Fietkau <[email protected]>
Date: Wed, 28 Aug 2019 12:13:55 +0200
Subject: [PATCH] cfg80211: add local BSS receive time to survey information

This is useful for checking how much airtime is being used up by other
transmissions on the channel, e.g. by calculating (time_rx - time_bss_rx)
or (time_busy - time_bss_rx - time_tx)

Signed-off-by: Felix Fietkau <[email protected]>
---

--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -668,6 +668,7 @@ ieee80211_chandef_max_power(struct cfg80
* @SURVEY_INFO_TIME_RX: receive time was filled in
* @SURVEY_INFO_TIME_TX: transmit time was filled in
* @SURVEY_INFO_TIME_SCAN: scan time was filled in
+ * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
*
* Used by the driver to indicate which info in &struct survey_info
* it has filled in during the get_survey().
@@ -681,6 +682,7 @@ enum survey_info_flags {
SURVEY_INFO_TIME_RX = BIT(5),
SURVEY_INFO_TIME_TX = BIT(6),
SURVEY_INFO_TIME_SCAN = BIT(7),
+ SURVEY_INFO_TIME_BSS_RX = BIT(8),
};

/**
@@ -697,6 +699,7 @@ enum survey_info_flags {
* @time_rx: amount of time the radio spent receiving data
* @time_tx: amount of time the radio spent transmitting data
* @time_scan: amount of time the radio spent for scanning
+ * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
*
* Used by dump_survey() to report back per-channel survey information.
*
@@ -711,6 +714,7 @@ struct survey_info {
u64 time_rx;
u64 time_tx;
u64 time_scan;
+ u64 time_bss_rx;
u32 filled;
s8 noise;
};
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3693,6 +3693,8 @@ enum nl80211_user_reg_hint_type {
* @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
* (on this channel or globally)
* @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_SURVEY_INFO_TIME_BSS_RX: amount of time the radio spent
+ * receiving local BSS data
* @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
* currently defined
* @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
@@ -3709,6 +3711,7 @@ enum nl80211_survey_info {
NL80211_SURVEY_INFO_TIME_TX,
NL80211_SURVEY_INFO_TIME_SCAN,
NL80211_SURVEY_INFO_PAD,
+ NL80211_SURVEY_INFO_TIME_BSS_RX,

/* keep last */
__NL80211_SURVEY_INFO_AFTER_LAST,
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8367,6 +8367,10 @@ static int nl80211_send_survey(struct sk
nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_SCAN,
survey->time_scan, NL80211_SURVEY_INFO_PAD))
goto nla_put_failure;
+ if ((survey->filled & SURVEY_INFO_TIME_BSS_RX) &&
+ nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_BSS_RX,
+ survey->time_bss_rx, NL80211_SURVEY_INFO_PAD))
+ goto nla_put_failure;

nla_nest_end(msg, infoattr);

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2968,6 +2968,7 @@ struct cfg80211_external_auth_params {
@@ -2972,6 +2972,7 @@ struct cfg80211_external_auth_params {
* (as advertised by the nl80211 feature flag.)
* @get_tx_power: store the current TX power into the dbm variable;
* return 0 if successful
+ * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary
*
* @set_wds_peer: set the WDS peer for a WDS interface
*
@@ -3268,6 +3269,7 @@ struct cfg80211_ops {
@@ -3272,6 +3273,7 @@ struct cfg80211_ops {
enum nl80211_tx_power_setting type, int mbm);
int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
int *dbm);
Expand Down
12 changes: 6 additions & 6 deletions package/kernel/mt76/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=

PKG_SOURCE_URL:=https://github.com/openwrt/mt76
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2019-08-22
PKG_SOURCE_VERSION:=2a0edbb4473b71dfaa4756f7189abf6cb7f7be8b
PKG_MIRROR_HASH:=a37975c179b929716c40d19fdcd5b131386d7f497eb8cd5d848be74e76d50d21
PKG_SOURCE_DATE:=2020-03-10
PKG_SOURCE_VERSION:=08054d5ab1350fcb8563feb90e6ab7f8f4a0a1b7
PKG_MIRROR_HASH:=b41a3cab1485c68befb1dcb4c1e426d41705db1b2a57851dafd6e8f75eeea3d7

PKG_MAINTAINER:=Felix Fietkau <[email protected]>
PKG_BUILD_PARALLEL:=1
Expand Down Expand Up @@ -246,12 +246,12 @@ define KernelPackage/mt7603/install
endef

define KernelPackage/mt7615e/install
$(INSTALL_DIR) $(1)/lib/firmware
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
cp \
$(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \
$(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \
$(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \
$(1)/lib/firmware
$(1)/lib/firmware/mediatek
endef

$(eval $(call KernelPackage,mt76-core))
Expand All @@ -266,4 +266,4 @@ $(eval $(call KernelPackage,mt76x2u))
$(eval $(call KernelPackage,mt76x2))
$(eval $(call KernelPackage,mt7603))
$(eval $(call KernelPackage,mt7615e))
$(eval $(call KernelPackage,mt76))
$(eval $(call KernelPackage,mt76))

0 comments on commit 372f598

Please sign in to comment.