Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
On Wed, Oct 04, 2017 at 04:27:04PM -0700, Kees Cook wrote: > Drop the arguments from the macro and adjust all callers with the > following script: > > perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \ > $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h) > > Signed-off-by: Kees Cook> Acked-by: Geert Uytterhoeven # for m68k parts > --- > arch/arm/mach-ixp4xx/dsmg600-setup.c | 2 +- > arch/arm/mach-ixp4xx/nas100d-setup.c | 2 +- > arch/m68k/amiga/amisound.c| 2 +- > arch/m68k/mac/macboing.c | 2 +- > arch/mips/mti-malta/malta-display.c | 2 +- > arch/parisc/kernel/pdc_cons.c | 2 +- > arch/s390/mm/cmm.c| 2 +- > drivers/atm/idt77105.c| 4 ++-- > drivers/atm/iphase.c | 2 +- > drivers/block/ataflop.c | 8 > drivers/char/dtlk.c | 2 +- > drivers/char/hangcheck-timer.c| 2 +- > drivers/char/nwbutton.c | 2 +- > drivers/char/rtc.c| 2 +- > drivers/input/touchscreen/s3c2410_ts.c| 2 +- > drivers/net/cris/eth_v10.c| 6 +++--- > drivers/net/hamradio/yam.c| 2 +- > drivers/net/wireless/atmel/at76c50x-usb.c | 2 +- > drivers/staging/speakup/main.c| 2 +- > drivers/staging/speakup/synth.c | 2 +- > drivers/tty/cyclades.c| 2 +- > drivers/tty/isicom.c | 2 +- > drivers/tty/moxa.c| 2 +- > drivers/tty/rocket.c | 2 +- > drivers/tty/vt/keyboard.c | 2 +- > drivers/tty/vt/vt.c | 2 +- > drivers/watchdog/alim7101_wdt.c | 2 +- > drivers/watchdog/machzwd.c| 2 +- > drivers/watchdog/mixcomwd.c | 2 +- > drivers/watchdog/sbc60xxwdt.c | 2 +- > drivers/watchdog/sc520_wdt.c | 2 +- > drivers/watchdog/via_wdt.c| 2 +- > drivers/watchdog/w83877f_wdt.c| 2 +- > drivers/xen/grant-table.c | 2 +- > fs/pstore/platform.c | 2 +- > include/linux/timer.h | 4 ++-- > kernel/irq/spurious.c | 2 +- > lib/random32.c| 2 +- > net/atm/mpc.c | 2 +- > net/decnet/dn_route.c | 2 +- > net/ipv6/ip6_flowlabel.c | 2 +- > net/netrom/nr_loopback.c | 2 +- > security/keys/gc.c| 2 +- > sound/oss/midibuf.c | 2 +- > sound/oss/soundcard.c | 2 +- > sound/oss/sys_timer.c | 2 +- > sound/oss/uart6850.c | 2 +- > 47 files changed, 54 insertions(+), 54 deletions(-) Acked-by: Greg Kroah-Hartman
Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned
From: Herbert XuDate: Thu, 5 Oct 2017 11:40:54 +0800 > On Tue, Oct 03, 2017 at 07:45:06PM -0300, Marcelo Ricardo Leitner wrote: >> >> > Usually if you're invoking setkey from a non-sleeping code-path >> > you're probably doing something wrong. >> >> Usually but not always. There are 3 calls to that function on SCTP >> code: >> - pack a cookie, which is sent on an INIT_ACK packet to the client >> - unpack the cookie above, after it is sent back by the client on a >> COOKIE_ECHO packet >> - send a chunk authenticated by a hash > > I'm not talking about the code-path in question. I'm talking > about the function which generates the secret key in the first > place. AFAICS that's only called in GFP_KERNEL context. What > am I missing? The setkey happens in functions like sctp_pack_cookie() and sctp_unpack_cookie(), which seems to run from software interrupts.
Re: [PATCH] PCI MSI: allow alignment restrictions on vector allocation
On Mon, Oct 2, 2017 at 10:38 PM, Thomas Gleixnerwrote: >> After checking out the new code and thinking this through a bit, I think >> perhaps the only generic approach that would work is to make the >> ath9k driver require a vector allocation that enables the entire block >> of 4 MSI IRQs that the hardware supports (which is what Windows is doing). > > I wonder how Windows deals with the affinity problem for multi-MSI. Or does > it just not allow to set it at all? https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/interrupt-affinity-and-priority Looks like IRQ affinity can only be set by registry or inf files. I assume that means it is not dynamic and hence avoids the challenges related to moving interrupts around at runtime. > What's wrong with just using the legacy INTx emulation if you cannot > allocate 4 MSI vectors? The Legacy interrupt simply doesn't work for the wifi on at least 8 new Acer laptop products based on Intel Apollo Lake. Plus 4 Dell systems included in the patches in this thread: https://lkml.org/lkml/2017/9/26/55 (the 2 which I can find specs for are also Apollo Lake) We have tried taking the mini-PCIe wifi module out of one of the affected Acer products and moved it to another computer, where it is working fine with legacy interrupts. So this suggests that the wifi module itself is OK, but we are facing a hardware limitation or BIOS limitation on the affected products. In the Dell thread it says "Some platform(BIOS) blocks legacy interrupts (INTx)". If you have any suggestions for how we might solve this without getting into the MSI mess then that would be much appreciated. If the BIOS blocks the interrupts, can Linux unblock them? Just for reference I'm attaching my latest attempt at enabling MULTI_PCI_MSI. It would definitely need further work if we proceed here - so far I've ignored the affinity considerations that you explained, and it's not particularly clean. I'll now have a look at polling for interrupts in the ath9k driver. --- arch/x86/kernel/apic/msi.c| 3 +- arch/x86/kernel/apic/vector.c | 75 --- include/linux/irq.h | 3 +- kernel/irq/matrix.c | 23 +++-- 4 files changed, 74 insertions(+), 30 deletions(-) diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index 5b6dd1a85ec4..c57b6a7b9317 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -129,7 +129,8 @@ static struct msi_domain_ops pci_msi_domain_ops = { static struct msi_domain_info pci_msi_domain_info = { .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | - MSI_FLAG_PCI_MSIX | MSI_FLAG_MUST_REACTIVATE, + MSI_FLAG_PCI_MSIX | MSI_FLAG_MUST_REACTIVATE | + MSI_FLAG_MULTI_PCI_MSI, .ops= _msi_domain_ops, .chip = _msi_controller, .handler= handle_edge_irq, diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 6789e286def9..2926fd92ea1c 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -35,7 +35,8 @@ struct apic_chip_data { unsigned intmove_in_progress: 1, is_managed : 1, can_reserve : 1, - has_reserved: 1; + has_reserved: 1, + contig_allocation : 1; }; struct irq_domain *x86_vector_domain; @@ -198,7 +199,8 @@ static int reserve_irq_vector(struct irq_data *irqd) return 0; } -static int allocate_vector(struct irq_data *irqd, const struct cpumask *dest) +static int allocate_vector(struct irq_data *irqd, const struct cpumask *dest, + unsigned int num, unsigned int align_mask) { struct apic_chip_data *apicd = apic_chip_data(irqd); bool resvd = apicd->has_reserved; @@ -215,18 +217,21 @@ static int allocate_vector(struct irq_data *irqd, const struct cpumask *dest) if (vector && cpu_online(cpu) && cpumask_test_cpu(cpu, dest)) return 0; - vector = irq_matrix_alloc(vector_matrix, dest, resvd, ); + vector = irq_matrix_alloc(vector_matrix, dest, resvd, , + num, align_mask); if (vector > 0) apic_update_vector(irqd, vector, cpu); + trace_vector_alloc(irqd->irq, vector, resvd, vector); return vector; } static int assign_vector_locked(struct irq_data *irqd, - const struct cpumask *dest) + const struct cpumask *dest, + unsigned int num, unsigned int align_mask) { struct apic_chip_data *apicd = apic_chip_data(irqd); - int vector = allocate_vector(irqd, dest); +
Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned
On Tue, Oct 03, 2017 at 07:45:06PM -0300, Marcelo Ricardo Leitner wrote: > > > Usually if you're invoking setkey from a non-sleeping code-path > > you're probably doing something wrong. > > Usually but not always. There are 3 calls to that function on SCTP > code: > - pack a cookie, which is sent on an INIT_ACK packet to the client > - unpack the cookie above, after it is sent back by the client on a > COOKIE_ECHO packet > - send a chunk authenticated by a hash I'm not talking about the code-path in question. I'm talking about the function which generates the secret key in the first place. AFAICS that's only called in GFP_KERNEL context. What am I missing? Cheers, -- Email: Herbert XuHome Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[PATCH V2 5/8] qtnfmac: get rid of QTNF_STATE_AP_START flag
From: Igor MitsyankoQTNF_STATE_AP_START usage is redundant and imposes additional state synchronization maintenance. We may as well leave state checking to network card and upper layers (cfg80211, nl80211 and userspace). Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 29 +-- drivers/net/wireless/quantenna/qtnfmac/commands.c | 3 --- drivers/net/wireless/quantenna/qtnfmac/core.h | 3 +-- drivers/net/wireless/quantenna/qtnfmac/event.c| 12 -- 4 files changed, 2 insertions(+), 45 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index c660846..08f1f54 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -254,11 +254,6 @@ static int qtnf_change_beacon(struct wiphy *wiphy, struct net_device *dev, { struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); - if (!(vif->bss_status & QTNF_STATE_AP_START)) { - pr_err("VIF%u.%u: not started\n", vif->mac->macid, vif->vifid); - return -EFAULT; - } - return qtnf_mgmt_set_appie(vif, info); } @@ -283,17 +278,9 @@ static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev, } ret = qtnf_cmd_send_start_ap(vif); - if (ret) { + if (ret) pr_err("VIF%u.%u: failed to start AP\n", vif->mac->macid, vif->vifid); - goto out; - } - - if (!(vif->bss_status & QTNF_STATE_AP_START)) { - pr_err("VIF%u.%u: FW failed to start AP operation\n", - vif->mac->macid, vif->vifid); - ret = -EFAULT; - } out: return ret; @@ -308,7 +295,6 @@ static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev) if (ret) { pr_err("VIF%u.%u: failed to stop AP operation in FW\n", vif->mac->macid, vif->vifid); - vif->bss_status &= ~QTNF_STATE_AP_START; netif_carrier_off(vif->netdev); } @@ -784,19 +770,6 @@ static int qtnf_channel_switch(struct wiphy *wiphy, struct net_device *dev, params->chandef.chan->hw_value, params->count, params->radar_required, params->block_tx); - switch (vif->wdev.iftype) { - case NL80211_IFTYPE_AP: - if (!(vif->bss_status & QTNF_STATE_AP_START)) { - pr_warn("AP not started on %s\n", dev->name); - return -ENOTCONN; - } - break; - default: - pr_err("unsupported vif type (%d) on %s\n", - vif->wdev.iftype, dev->name); - return -EOPNOTSUPP; - } - if (!cfg80211_chandef_valid(>chandef)) { pr_err("%s: invalid channel\n", dev->name); return -EINVAL; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 59ca6ca..60d65df 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -173,7 +173,6 @@ int qtnf_cmd_send_start_ap(struct qtnf_vif *vif) goto out; } - vif->bss_status |= QTNF_STATE_AP_START; netif_carrier_on(vif->netdev); out: @@ -287,8 +286,6 @@ int qtnf_cmd_send_stop_ap(struct qtnf_vif *vif) goto out; } - vif->bss_status &= ~QTNF_STATE_AP_START; - netif_carrier_off(vif->netdev); out: diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index f8165a7..b35200d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -52,9 +52,8 @@ #define QTNF_DEF_WDOG_TIMEOUT 5 #define QTNF_TX_TIMEOUT_TRSHLD 100 -#define QTNF_STATE_AP_STARTBIT(1) - extern const struct net_device_ops qtnf_netdev_ops; + struct qtnf_bus; struct qtnf_vif; diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 7481d5b..d7fb076 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -53,12 +53,6 @@ qtnf_event_handle_sta_assoc(struct qtnf_wmac *mac, struct qtnf_vif *vif, return -EPROTO; } - if (!(vif->bss_status & QTNF_STATE_AP_START)) { - pr_err("VIF%u.%u: STA_ASSOC event when AP is not started\n", - mac->macid, vif->vifid); - return -EPROTO; - } - sta_addr = sta_assoc->sta_addr; frame_control = le16_to_cpu(sta_assoc->frame_control); @@ -127,12 +121,6 @@ qtnf_event_handle_sta_deauth(struct qtnf_wmac *mac,
[PATCH V2 8/8] qtnfmac: do not cache current channel info in driver's state
From: Igor MitsyankoLinux Wireless device structure already has current channel information that can be used when needed. Start using it. Since driver's channel info is not used anymore, remove it. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 7 ++- drivers/net/wireless/quantenna/qtnfmac/core.h | 1 - drivers/net/wireless/quantenna/qtnfmac/event.c| 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index cf0f19ef..028bed1 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -630,15 +630,15 @@ qtnf_dump_survey(struct wiphy *wiphy, struct net_device *dev, int idx, struct survey_info *survey) { struct qtnf_wmac *mac = wiphy_priv(wiphy); + struct wireless_dev *wdev = dev->ieee80211_ptr; struct ieee80211_supported_band *sband; - struct cfg80211_chan_def *chandef; + const struct cfg80211_chan_def *chandef = >chandef; struct ieee80211_channel *chan; struct qtnf_chan_stats stats; struct qtnf_vif *vif; int ret; vif = qtnf_netdev_get_priv(dev); - chandef = >chandef; sband = wiphy->bands[NL80211_BAND_2GHZ]; if (sband && idx >= sband->n_channels) { @@ -705,7 +705,6 @@ static int qtnf_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_chan_def *chandef) { - struct qtnf_wmac *mac = wiphy_priv(wiphy); struct net_device *ndev = wdev->netdev; struct qtnf_vif *vif; int ret; @@ -728,8 +727,6 @@ qtnf_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, ret = -ENODATA; } - memcpy(>chandef, chandef, sizeof(mac->chandef)); - out: return ret; } diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index 5234a9e..44a2cbb 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -126,7 +126,6 @@ struct qtnf_wmac { struct qtnf_mac_info macinfo; struct qtnf_vif iflist[QTNF_MAX_INTF]; struct cfg80211_scan_request *scan_req; - struct cfg80211_chan_def chandef; struct mutex mac_lock; /* lock during wmac speicific ops */ struct timer_list scan_timeout; }; diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index d7fb076..f639ea3 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -372,8 +372,6 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac, mac->macid, chandef.chan->hw_value, chandef.center_freq1, chandef.center_freq2, chandef.width); - memcpy(>chandef, , sizeof(mac->chandef)); - for (i = 0; i < QTNF_MAX_INTF; i++) { vif = >iflist[i]; if (vif->wdev.iftype == NL80211_IFTYPE_UNSPECIFIED) -- 2.9.5
[PATCH V2 7/8] qtnfmac: make encryption info a part of CONNECT command.
From: Igor MitsyankoEncryption info is a constant part of STA settings, no point to pass it as an optional TLV. Remove QTN_TLV_ID_CRYPTO type as it's not used anymore. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/commands.c | 42 ++- drivers/net/wireless/quantenna/qtnfmac/qlink.h| 5 +-- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index b65d705..babdc60 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2037,7 +2037,7 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif, { struct sk_buff *cmd_skb; struct qlink_cmd_connect *cmd; - struct qlink_auth_encr aen; + struct qlink_auth_encr *aen; u16 res_code = QLINK_CMD_RESULT_OK; int ret; int i; @@ -2049,8 +2049,6 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif, if (unlikely(!cmd_skb)) return -ENOMEM; - qtnf_bus_lock(vif->mac->bus); - cmd = (struct qlink_cmd_connect *)cmd_skb->data; ether_addr_copy(cmd->bssid, vif->bssid); @@ -2077,41 +2075,39 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif, cmd->flags = cpu_to_le32(connect_flags); - memset(, 0, sizeof(aen)); - aen.auth_type = sme->auth_type; - aen.privacy = !!sme->privacy; - aen.mfp = sme->mfp; - aen.wpa_versions = cpu_to_le32(sme->crypto.wpa_versions); - aen.cipher_group = cpu_to_le32(sme->crypto.cipher_group); - aen.n_ciphers_pairwise = cpu_to_le32( - sme->crypto.n_ciphers_pairwise); + aen = >aen; + aen->auth_type = sme->auth_type; + aen->privacy = !!sme->privacy; + aen->mfp = sme->mfp; + aen->wpa_versions = cpu_to_le32(sme->crypto.wpa_versions); + aen->cipher_group = cpu_to_le32(sme->crypto.cipher_group); + aen->n_ciphers_pairwise = cpu_to_le32(sme->crypto.n_ciphers_pairwise); for (i = 0; i < QLINK_MAX_NR_CIPHER_SUITES; i++) - aen.ciphers_pairwise[i] = cpu_to_le32( - sme->crypto.ciphers_pairwise[i]); + aen->ciphers_pairwise[i] = + cpu_to_le32(sme->crypto.ciphers_pairwise[i]); - aen.n_akm_suites = cpu_to_le32(sme->crypto.n_akm_suites); + aen->n_akm_suites = cpu_to_le32(sme->crypto.n_akm_suites); for (i = 0; i < QLINK_MAX_NR_AKM_SUITES; i++) - aen.akm_suites[i] = cpu_to_le32( - sme->crypto.akm_suites[i]); + aen->akm_suites[i] = cpu_to_le32(sme->crypto.akm_suites[i]); - aen.control_port = sme->crypto.control_port; - aen.control_port_no_encrypt = + aen->control_port = sme->crypto.control_port; + aen->control_port_no_encrypt = sme->crypto.control_port_no_encrypt; - aen.control_port_ethertype = cpu_to_le16(be16_to_cpu( - sme->crypto.control_port_ethertype)); + aen->control_port_ethertype = + cpu_to_le16(be16_to_cpu(sme->crypto.control_port_ethertype)); qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, sme->ssid, - sme->ssid_len); - qtnf_cmd_skb_put_tlv_arr(cmd_skb, QTN_TLV_ID_CRYPTO, (u8 *), -sizeof(aen)); +sme->ssid_len); if (sme->ie_len != 0) qtnf_cmd_skb_put_tlv_arr(cmd_skb, QTN_TLV_ID_IE_SET, sme->ie, sme->ie_len); + qtnf_bus_lock(vif->mac->bus); + ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, _code); if (unlikely(ret)) diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 641d252..7b313d3 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -417,8 +417,9 @@ enum qlink_sta_connect_flags { * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command * * @flags: for future use. - * @freq: center frequence of a channel which should be used to connect. + * @channel: channel which should be used to connect. * @bg_scan_period: period of background scan. + * @aen: authentication information. * @bssid: BSSID of the BSS to connect to. * @payload: variable portion of connection request. */ @@ -427,6 +428,7 @@ struct qlink_cmd_connect { __le32 flags; __le16 channel; __le16 bg_scan_period; + struct qlink_auth_encr aen; u8 bssid[ETH_ALEN]; u8 payload[0]; } __packed; @@ -950,7 +952,6 @@ enum qlink_tlv_id { QTN_TLV_ID_STA_GENERIC_INFO = 0x0301, QTN_TLV_ID_KEY = 0x0302, QTN_TLV_ID_SEQ = 0x0303, -
[PATCH V2 2/8] qtnfmac: pass all AP settings to wireless card for processing
From: Igor MitsyankoModify QLINK START_AP command payload to pass all AP settings contained within struct cfg80211_ap_settings. Make most of settings a constant part of "config AP" command instead of passing it as an optional TLVs. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/commands.c | 52 --- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 78 -- .../net/wireless/quantenna/qtnfmac/qlink_util.c| 13 .../net/wireless/quantenna/qtnfmac/qlink_util.h| 1 + 4 files changed, 101 insertions(+), 43 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 88fdf7d..493c3f8 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -187,27 +187,34 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, struct sk_buff *cmd_skb; struct cfg80211_chan_def *chandef = >mac->chandef; struct qlink_tlv_channel *qchan; - struct qlink_auth_encr aen; + struct qlink_cmd_config_ap *cmd; + struct qlink_auth_encr *aen; u16 res_code = QLINK_CMD_RESULT_OK; int ret; int i; cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, QLINK_CMD_CONFIG_AP, - sizeof(struct qlink_cmd)); + sizeof(*cmd)); if (unlikely(!cmd_skb)) return -ENOMEM; - qtnf_bus_lock(vif->mac->bus); + cmd = (struct qlink_cmd_config_ap *)cmd_skb->data; + cmd->dtim_period = s->dtim_period; + cmd->beacon_interval = cpu_to_le16(s->beacon_interval); + cmd->hidden_ssid = qlink_hidden_ssid_nl2q(s->hidden_ssid); + cmd->inactivity_timeout = cpu_to_le16(s->inactivity_timeout); + cmd->smps_mode = s->smps_mode; + cmd->p2p_ctwindow = s->p2p_ctwindow; + cmd->p2p_opp_ps = s->p2p_opp_ps; + cmd->pbss = s->pbss; + cmd->ht_required = s->ht_required; + cmd->vht_required = s->vht_required; if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, s->ssid_len); - qtnf_cmd_skb_put_tlv_u16(cmd_skb, QTN_TLV_ID_BCN_PERIOD, -s->beacon_interval); - qtnf_cmd_skb_put_tlv_u8(cmd_skb, QTN_TLV_ID_DTIM, s->dtim_period); - qchan = skb_put_zero(cmd_skb, sizeof(*qchan)); qchan->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); qchan->hdr.len = cpu_to_le16(sizeof(*qchan) - @@ -215,26 +222,25 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, qchan->hw_value = cpu_to_le16( ieee80211_frequency_to_channel(chandef->chan->center_freq)); - memset(, 0, sizeof(aen)); - aen.auth_type = s->auth_type; - aen.privacy = !!s->privacy; - aen.mfp = 0; - aen.wpa_versions = cpu_to_le32(s->crypto.wpa_versions); - aen.cipher_group = cpu_to_le32(s->crypto.cipher_group); - aen.n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise); + aen = >aen; + aen->auth_type = s->auth_type; + aen->privacy = !!s->privacy; + aen->mfp = 0; + aen->wpa_versions = cpu_to_le32(s->crypto.wpa_versions); + aen->cipher_group = cpu_to_le32(s->crypto.cipher_group); + aen->n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise); for (i = 0; i < QLINK_MAX_NR_CIPHER_SUITES; i++) - aen.ciphers_pairwise[i] = - cpu_to_le32(s->crypto.ciphers_pairwise[i]); - aen.n_akm_suites = cpu_to_le32(s->crypto.n_akm_suites); + aen->ciphers_pairwise[i] = + cpu_to_le32(s->crypto.ciphers_pairwise[i]); + aen->n_akm_suites = cpu_to_le32(s->crypto.n_akm_suites); for (i = 0; i < QLINK_MAX_NR_AKM_SUITES; i++) - aen.akm_suites[i] = cpu_to_le32(s->crypto.akm_suites[i]); - aen.control_port = s->crypto.control_port; - aen.control_port_no_encrypt =s->crypto.control_port_no_encrypt; - aen.control_port_ethertype = + aen->akm_suites[i] = cpu_to_le32(s->crypto.akm_suites[i]); + aen->control_port = s->crypto.control_port; + aen->control_port_no_encrypt = s->crypto.control_port_no_encrypt; + aen->control_port_ethertype = cpu_to_le16(be16_to_cpu(s->crypto.control_port_ethertype)); - qtnf_cmd_skb_put_tlv_arr(cmd_skb, QTN_TLV_ID_CRYPTO, (u8 *), -sizeof(aen)); + qtnf_bus_lock(vif->mac->bus); ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, _code); diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h
[PATCH V2 1/8] qtnfmac: do not cache AP settings in driver structures
From: Igor MitsyankoCached AP setings are passed to WiFi card right after they are initialized and are never used for anything else. There is no point in keeping them in driver state. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 17 + drivers/net/wireless/quantenna/qtnfmac/commands.c | 46 +++ drivers/net/wireless/quantenna/qtnfmac/commands.h | 3 +- 3 files changed, 25 insertions(+), 41 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 262e8cf..fe157f5 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -267,7 +267,6 @@ static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev, { struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); struct qtnf_wmac *mac = wiphy_priv(wiphy); - struct qtnf_bss_config *bss_cfg; int ret; if (!cfg80211_chandef_identical(>chandef, >chandef)) { @@ -278,21 +277,7 @@ static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev, settings->chandef.chan->center_freq); } - bss_cfg = >bss_cfg; - memset(bss_cfg, 0, sizeof(*bss_cfg)); - - bss_cfg->bcn_period = settings->beacon_interval; - bss_cfg->dtim = settings->dtim_period; - bss_cfg->auth_type = settings->auth_type; - bss_cfg->privacy = settings->privacy; - - bss_cfg->ssid_len = settings->ssid_len; - memcpy(_cfg->ssid, settings->ssid, bss_cfg->ssid_len); - - memcpy(_cfg->crypto, >crypto, - sizeof(struct cfg80211_crypto_settings)); - - ret = qtnf_cmd_send_config_ap(vif); + ret = qtnf_cmd_send_config_ap(vif, settings); if (ret) { pr_err("VIF%u.%u: failed to push config to FW\n", vif->mac->macid, vif->vifid); diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 8f95f98..88fdf7d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -181,10 +181,10 @@ int qtnf_cmd_send_start_ap(struct qtnf_vif *vif) return ret; } -int qtnf_cmd_send_config_ap(struct qtnf_vif *vif) +int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, + const struct cfg80211_ap_settings *s) { struct sk_buff *cmd_skb; - struct qtnf_bss_config *bss_cfg = >bss_cfg; struct cfg80211_chan_def *chandef = >mac->chandef; struct qlink_tlv_channel *qchan; struct qlink_auth_encr aen; @@ -200,11 +200,13 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif) qtnf_bus_lock(vif->mac->bus); - qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, bss_cfg->ssid, -bss_cfg->ssid_len); + if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) + qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, +s->ssid_len); + qtnf_cmd_skb_put_tlv_u16(cmd_skb, QTN_TLV_ID_BCN_PERIOD, -bss_cfg->bcn_period); - qtnf_cmd_skb_put_tlv_u8(cmd_skb, QTN_TLV_ID_DTIM, bss_cfg->dtim); +s->beacon_interval); + qtnf_cmd_skb_put_tlv_u8(cmd_skb, QTN_TLV_ID_DTIM, s->dtim_period); qchan = skb_put_zero(cmd_skb, sizeof(*qchan)); qchan->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); @@ -214,26 +216,22 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif) ieee80211_frequency_to_channel(chandef->chan->center_freq)); memset(, 0, sizeof(aen)); - aen.auth_type = bss_cfg->auth_type; - aen.privacy = !!bss_cfg->privacy; - aen.mfp = bss_cfg->mfp; - aen.wpa_versions = cpu_to_le32(bss_cfg->crypto.wpa_versions); - aen.cipher_group = cpu_to_le32(bss_cfg->crypto.cipher_group); - aen.n_ciphers_pairwise = cpu_to_le32( - bss_cfg->crypto.n_ciphers_pairwise); + aen.auth_type = s->auth_type; + aen.privacy = !!s->privacy; + aen.mfp = 0; + aen.wpa_versions = cpu_to_le32(s->crypto.wpa_versions); + aen.cipher_group = cpu_to_le32(s->crypto.cipher_group); + aen.n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise); for (i = 0; i < QLINK_MAX_NR_CIPHER_SUITES; i++) - aen.ciphers_pairwise[i] = cpu_to_le32( - bss_cfg->crypto.ciphers_pairwise[i]); - aen.n_akm_suites = cpu_to_le32( - bss_cfg->crypto.n_akm_suites); + aen.ciphers_pairwise[i] = + cpu_to_le32(s->crypto.ciphers_pairwise[i]); + aen.n_akm_suites =
[PATCH V2 0/8] qtnfmac: get rid of redundant state caching in driver
From: Igor MitsyankoIn many cases qtnfmac driver stores state info (like current channel, interface state) in driver's internal state that is either unused or duplicates information that is available elsewhere. Cleanup driver to get rid of not needed cached data. It was part of bigger changeset when it was V1. Changelist V1->V2: PATCH 3: - add missing cpu_to_le16() to CMD len field initialization. Igor Mitsyanko (8): qtnfmac: do not cache AP settings in driver structures qtnfmac: pass all AP settings to wireless card for processing qtnfmac: pass channel definition to WiFi card on START_AP command qtnfmac: get rid of QTNF_STATE_AP_CONFIG qtnfmac: get rid of QTNF_STATE_AP_START flag qtnfmac: do not cache BSS state in per-VIF structure qtnfmac: make encryption info a part of CONNECT command. qtnfmac: do not cache current channel info in driver's state drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 110 ++ drivers/net/wireless/quantenna/qtnfmac/commands.c | 163 +++-- drivers/net/wireless/quantenna/qtnfmac/commands.h | 3 +- drivers/net/wireless/quantenna/qtnfmac/core.h | 24 +-- drivers/net/wireless/quantenna/qtnfmac/event.c | 14 -- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 92 +--- .../net/wireless/quantenna/qtnfmac/qlink_util.c| 45 ++ .../net/wireless/quantenna/qtnfmac/qlink_util.h| 3 + 8 files changed, 224 insertions(+), 230 deletions(-) -- 2.9.5
[PATCH V2 4/8] qtnfmac: get rid of QTNF_STATE_AP_CONFIG
From: Igor MitsyankoQTNF_STATE_AP_CONFIG is redundant and its usage can be safely removed. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 8 drivers/net/wireless/quantenna/qtnfmac/commands.c | 3 --- drivers/net/wireless/quantenna/qtnfmac/core.h | 1 - 3 files changed, 12 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 056018e..c660846 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -275,13 +275,6 @@ static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev, goto out; } - if (!(vif->bss_status & QTNF_STATE_AP_CONFIG)) { - pr_err("VIF%u.%u: AP config failed in FW\n", vif->mac->macid, - vif->vifid); - ret = -EFAULT; - goto out; - } - ret = qtnf_mgmt_set_appie(vif, >beacon); if (ret) { pr_err("VIF%u.%u: failed to add IEs to beacon\n", @@ -316,7 +309,6 @@ static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev) pr_err("VIF%u.%u: failed to stop AP operation in FW\n", vif->mac->macid, vif->vifid); vif->bss_status &= ~QTNF_STATE_AP_START; - vif->bss_status &= ~QTNF_STATE_AP_CONFIG; netif_carrier_off(vif->netdev); } diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index f5bc43b..59ca6ca 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -256,8 +256,6 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, goto out; } - vif->bss_status |= QTNF_STATE_AP_CONFIG; - out: qtnf_bus_unlock(vif->mac->bus); return ret; @@ -290,7 +288,6 @@ int qtnf_cmd_send_stop_ap(struct qtnf_vif *vif) } vif->bss_status &= ~QTNF_STATE_AP_START; - vif->bss_status &= ~QTNF_STATE_AP_CONFIG; netif_carrier_off(vif->netdev); diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index 2cd0150..f8165a7 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -52,7 +52,6 @@ #define QTNF_DEF_WDOG_TIMEOUT 5 #define QTNF_TX_TIMEOUT_TRSHLD 100 -#define QTNF_STATE_AP_CONFIG BIT(2) #define QTNF_STATE_AP_STARTBIT(1) extern const struct net_device_ops qtnf_netdev_ops; -- 2.9.5
[PATCH V2 3/8] qtnfmac: pass channel definition to WiFi card on START_AP command
From: Igor MitsyankoIntroduce "channel definition" TLV containing full channel description (center frequence for both segments + BW) and pass it to wireless card in a payload to START_AP command. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 9 -- drivers/net/wireless/quantenna/qtnfmac/commands.c | 28 ++- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 13 + .../net/wireless/quantenna/qtnfmac/qlink_util.c| 32 ++ .../net/wireless/quantenna/qtnfmac/qlink_util.h| 2 ++ 5 files changed, 62 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index fe157f5..056018e 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -266,17 +266,8 @@ static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *settings) { struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); - struct qtnf_wmac *mac = wiphy_priv(wiphy); int ret; - if (!cfg80211_chandef_identical(>chandef, >chandef)) { - memcpy(>chandef, >chandef, sizeof(mac->chandef)); - if (vif->vifid != 0) - pr_warn("%s: unexpected chan %u (%u MHz)\n", dev->name, - settings->chandef.chan->hw_value, - settings->chandef.chan->center_freq); - } - ret = qtnf_cmd_send_config_ap(vif, settings); if (ret) { pr_err("VIF%u.%u: failed to push config to FW\n", diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 493c3f8..f5bc43b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -185,8 +185,6 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, const struct cfg80211_ap_settings *s) { struct sk_buff *cmd_skb; - struct cfg80211_chan_def *chandef = >mac->chandef; - struct qlink_tlv_channel *qchan; struct qlink_cmd_config_ap *cmd; struct qlink_auth_encr *aen; u16 res_code = QLINK_CMD_RESULT_OK; @@ -211,17 +209,6 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, cmd->ht_required = s->ht_required; cmd->vht_required = s->vht_required; - if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) - qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, -s->ssid_len); - - qchan = skb_put_zero(cmd_skb, sizeof(*qchan)); - qchan->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); - qchan->hdr.len = cpu_to_le16(sizeof(*qchan) - - sizeof(struct qlink_tlv_hdr)); - qchan->hw_value = cpu_to_le16( - ieee80211_frequency_to_channel(chandef->chan->center_freq)); - aen = >aen; aen->auth_type = s->auth_type; aen->privacy = !!s->privacy; @@ -240,6 +227,21 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, aen->control_port_ethertype = cpu_to_le16(be16_to_cpu(s->crypto.control_port_ethertype)); + if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) + qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, +s->ssid_len); + + if (cfg80211_chandef_valid(>chandef)) { + struct qlink_tlv_chandef *chtlv = + (struct qlink_tlv_chandef *)skb_put(cmd_skb, + sizeof(*chtlv)); + + chtlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANDEF); + chtlv->hdr.len = cpu_to_le16(sizeof(*chtlv) - +sizeof(chtlv->hdr)); + qlink_chandef_cfg2q(>chandef, >chan); + } + qtnf_bus_lock(vif->mac->bus); ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, _code); diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 6814254..641d252 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -941,6 +941,7 @@ enum qlink_tlv_id { QTN_TLV_ID_LRETRY_LIMIT = 0x0204, QTN_TLV_ID_REG_RULE = 0x0207, QTN_TLV_ID_CHANNEL = 0x020F, + QTN_TLV_ID_CHANDEF = 0x0210, QTN_TLV_ID_COVERAGE_CLASS = 0x0213, QTN_TLV_ID_IFACE_LIMIT = 0x0214, QTN_TLV_ID_NUM_IFACE_COMB = 0x0215, @@ -1128,6 +1129,18 @@ struct qlink_tlv_channel { u8 rsvd[2]; } __packed; +/** + * struct
[PATCH V2 6/8] qtnfmac: do not cache BSS state in per-VIF structure
From: Igor MitsyankoThis cached state is used only once immediately after it is initilized, except for BSSID value that is used for events processing. There is no reason in keeping unused data in driver's state. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 40 -- drivers/net/wireless/quantenna/qtnfmac/commands.c | 49 +++ drivers/net/wireless/quantenna/qtnfmac/core.h | 19 ++--- 3 files changed, 42 insertions(+), 66 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 08f1f54..cf0f19ef 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -131,6 +131,7 @@ int qtnf_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) vif->netdev = NULL; vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; eth_zero_addr(vif->mac_addr); + eth_zero_addr(vif->bssid); return 0; } @@ -199,6 +200,8 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy, qtnf_cmd_send_del_intf(vif); err_cmd: vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; + eth_zero_addr(vif->mac_addr); + eth_zero_addr(vif->bssid); return ERR_PTR(-EFAULT); } @@ -567,7 +570,6 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_connect_params *sme) { struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); - struct qtnf_bss_config *bss_cfg; int ret; if (vif->wdev.iftype != NL80211_IFTYPE_STATION) @@ -576,38 +578,10 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev, if (vif->sta_state != QTNF_STA_DISCONNECTED) return -EBUSY; - bss_cfg = >bss_cfg; - memset(bss_cfg, 0, sizeof(*bss_cfg)); - - bss_cfg->ssid_len = sme->ssid_len; - memcpy(_cfg->ssid, sme->ssid, bss_cfg->ssid_len); - bss_cfg->auth_type = sme->auth_type; - bss_cfg->privacy = sme->privacy; - bss_cfg->mfp = sme->mfp; - - if ((sme->bg_scan_period > 0) && - (sme->bg_scan_period <= QTNF_MAX_BG_SCAN_PERIOD)) - bss_cfg->bg_scan_period = sme->bg_scan_period; - else if (sme->bg_scan_period == -1) - bss_cfg->bg_scan_period = QTNF_DEFAULT_BG_SCAN_PERIOD; - else - bss_cfg->bg_scan_period = 0; /* disabled */ - - bss_cfg->connect_flags = 0; - - if (sme->flags & ASSOC_REQ_DISABLE_HT) - bss_cfg->connect_flags |= QLINK_STA_CONNECT_DISABLE_HT; - if (sme->flags & ASSOC_REQ_DISABLE_VHT) - bss_cfg->connect_flags |= QLINK_STA_CONNECT_DISABLE_VHT; - if (sme->flags & ASSOC_REQ_USE_RRM) - bss_cfg->connect_flags |= QLINK_STA_CONNECT_USE_RRM; - - memcpy(_cfg->crypto, >crypto, sizeof(bss_cfg->crypto)); - if (sme->bssid) - ether_addr_copy(bss_cfg->bssid, sme->bssid); + ether_addr_copy(vif->bssid, sme->bssid); else - eth_zero_addr(bss_cfg->bssid); + eth_zero_addr(vif->bssid); ret = qtnf_cmd_send_connect(vif, sme); if (ret) { @@ -1021,7 +995,7 @@ void qtnf_virtual_intf_cleanup(struct net_device *ndev) break; case QTNF_STA_CONNECTING: cfg80211_connect_result(vif->netdev, - vif->bss_cfg.bssid, NULL, 0, + vif->bssid, NULL, 0, NULL, 0, WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_KERNEL); @@ -1048,7 +1022,7 @@ void qtnf_cfg80211_vif_reset(struct qtnf_vif *vif) switch (vif->sta_state) { case QTNF_STA_CONNECTING: cfg80211_connect_result(vif->netdev, - vif->bss_cfg.bssid, NULL, 0, + vif->bssid, NULL, 0, NULL, 0, WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_KERNEL); diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 60d65df..b65d705 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2037,11 +2037,11 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif, { struct sk_buff *cmd_skb; struct qlink_cmd_connect *cmd; - struct qtnf_bss_config *bss_cfg = >bss_cfg; struct qlink_auth_encr aen; u16 res_code = QLINK_CMD_RESULT_OK; int ret;
[PATCH] net/mac80211/mesh_plink: Convert timers to use
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. This requires adding a pointer back to the sta_info since container_of() can't resolve the sta_info. Cc: Johannes BergCc: "David S. Miller" Cc: linux-wireless@vger.kernel.org Cc: net...@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- net/mac80211/mesh_plink.c | 9 + net/mac80211/sta_info.c | 2 +- net/mac80211/sta_info.h | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index f69c6c38ca43..fcc02beaee6d 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -604,8 +604,9 @@ void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata, ieee80211_mbss_info_change_notify(sdata, changed); } -static void mesh_plink_timer(unsigned long data) +static void mesh_plink_timer(struct timer_list *t) { + struct mesh_sta *mesh = from_timer(mesh, t, plink_timer); struct sta_info *sta; u16 reason = 0; struct ieee80211_sub_if_data *sdata; @@ -617,7 +618,7 @@ static void mesh_plink_timer(unsigned long data) * del_timer_sync() this timer after having made sure * it cannot be readded (by deleting the plink.) */ - sta = (struct sta_info *) data; + sta = mesh->plink_sta; if (sta->sdata->local->quiescing) return; @@ -698,8 +699,8 @@ static void mesh_plink_timer(unsigned long data) static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) { sta->mesh->plink_timer.expires = jiffies + msecs_to_jiffies(timeout); - sta->mesh->plink_timer.data = (unsigned long) sta; - sta->mesh->plink_timer.function = mesh_plink_timer; + sta->mesh->plink_sta = sta; + sta->mesh->plink_timer.function = (TIMER_FUNC_TYPE)mesh_plink_timer; sta->mesh->plink_timeout = timeout; add_timer(>mesh->plink_timer); } diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 69615016d5bf..5e5de9455e4e 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -332,7 +332,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, spin_lock_init(>mesh->plink_lock); if (ieee80211_vif_is_mesh(>vif) && !sdata->u.mesh.user_mpm) - init_timer(>mesh->plink_timer); + timer_setup(>mesh->plink_timer, NULL, 0); sta->mesh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE; } #endif diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 3acbdfa9f649..21d9760ce5c3 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -344,6 +344,7 @@ DECLARE_EWMA(mesh_fail_avg, 20, 8) * @plink_state: peer link state * @plink_timeout: timeout of peer link * @plink_timer: peer link watch timer + * @plink_sta: peer link watch timer's sta_info * @t_offset: timing offset relative to this host * @t_offset_setpoint: reference timing offset of this sta to be used when * calculating clockdrift @@ -356,6 +357,7 @@ DECLARE_EWMA(mesh_fail_avg, 20, 8) */ struct mesh_sta { struct timer_list plink_timer; + struct sta_info *plink_sta; s64 t_offset; s64 t_offset_setpoint; -- 2.7.4 -- Kees Cook Pixel Security
[PATCH] net/wireless/ray_cs: Convert timers to use
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Kalle ValoCc: linux-wireless@vger.kernel.org Cc: net...@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/net/wireless/ray_cs.c | 53 --- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 170cd504e8ff..d8afcdfca1ed 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -92,7 +92,7 @@ static const struct iw_handler_def ray_handler_def; /* Prototypes for raylink functions **/ static void authenticate(ray_dev_t *local); static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type); -static void authenticate_timeout(u_long); +static void authenticate_timeout(struct timer_list *t); static int get_free_ccs(ray_dev_t *local); static int get_free_tx_ccs(ray_dev_t *local); static void init_startup_params(ray_dev_t *local); @@ -102,7 +102,7 @@ static int ray_init(struct net_device *dev); static int interrupt_ecf(ray_dev_t *local, int ccs); static void ray_reset(struct net_device *dev); static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len); -static void verify_dl_startup(u_long); +static void verify_dl_startup(struct timer_list *t); /* Prototypes for interrpt time functions **/ static irqreturn_t ray_interrupt(int reg, void *dev_id); @@ -120,9 +120,8 @@ static void associate(ray_dev_t *local); /* Card command functions */ static int dl_startup_params(struct net_device *dev); -static void join_net(u_long local); -static void start_net(u_long local); -/* void start_net(ray_dev_t *local); */ +static void join_net(struct timer_list *t); +static void start_net(struct timer_list *t); /*===*/ /* Parameters that can be set with 'insmod' */ @@ -323,7 +322,7 @@ static int ray_probe(struct pcmcia_device *p_dev) dev_dbg(_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); netif_stop_queue(dev); - init_timer(>timer); + timer_setup(>timer, NULL, 0); this_device = p_dev; return ray_config(p_dev); @@ -570,8 +569,7 @@ static int dl_startup_params(struct net_device *dev) local->card_status = CARD_DL_PARAM; /* Start kernel timer to wait for dl startup to complete. */ local->timer.expires = jiffies + HZ / 2; - local->timer.data = (long)local; - local->timer.function = verify_dl_startup; + local->timer.function = (TIMER_FUNC_TYPE)verify_dl_startup; add_timer(>timer); dev_dbg(>dev, "ray_cs dl_startup_params started timer for verify_dl_startup\n"); @@ -641,9 +639,9 @@ static void init_startup_params(ray_dev_t *local) } /* init_startup_params */ /*===*/ -static void verify_dl_startup(u_long data) +static void verify_dl_startup(struct timer_list *t) { - ray_dev_t *local = (ray_dev_t *) data; + ray_dev_t *local = from_timer(local, t, timer); struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs; UCHAR status; struct pcmcia_device *link = local->finder; @@ -676,16 +674,16 @@ static void verify_dl_startup(u_long data) return; } if (local->sparm.b4.a_network_type == ADHOC) - start_net((u_long) local); + start_net(>timer); else - join_net((u_long) local); + join_net(>timer); } /* end verify_dl_startup */ /*===*/ /* Command card to start a network */ -static void start_net(u_long data) +static void start_net(struct timer_list *t) { - ray_dev_t *local = (ray_dev_t *) data; + ray_dev_t *local = from_timer(local, t, timer); struct ccs __iomem *pccs; int ccsindex; struct pcmcia_device *link = local->finder; @@ -710,9 +708,9 @@ static void start_net(u_long data) /*===*/ /* Command card to join a network */ -static void join_net(u_long data) +static void join_net(struct timer_list *t) { - ray_dev_t *local = (ray_dev_t *) data; + ray_dev_t *local = from_timer(local, t, timer); struct ccs __iomem *pccs; int ccsindex; @@ -1639,13 +1637,13 @@ static int get_free_ccs(ray_dev_t *local) } /* get_free_ccs */
[PATCH] net/cw1200: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Solomon PeachyCc: Kalle Valo Cc: linux-wireless@vger.kernel.org Cc: net...@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/net/wireless/st/cw1200/pm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/st/cw1200/pm.c b/drivers/net/wireless/st/cw1200/pm.c index d2202ae92bdd..ded23df1ac1d 100644 --- a/drivers/net/wireless/st/cw1200/pm.c +++ b/drivers/net/wireless/st/cw1200/pm.c @@ -91,7 +91,7 @@ struct cw1200_suspend_state { u8 prev_ps_mode; }; -static void cw1200_pm_stay_awake_tmo(unsigned long arg) +static void cw1200_pm_stay_awake_tmo(struct timer_list *unused) { /* XXX what's the point of this ? */ } @@ -101,8 +101,7 @@ int cw1200_pm_init(struct cw1200_pm_state *pm, { spin_lock_init(>lock); - setup_timer(>stay_awake, cw1200_pm_stay_awake_tmo, - (unsigned long)pm); + timer_setup(>stay_awake, cw1200_pm_stay_awake_tmo, 0); return 0; } -- 2.7.4 -- Kees Cook Pixel Security
Re: [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
Hi, On Wed, Oct 04, 2017 at 04:26:59PM -0700, Kees Cook wrote: > This refactors the only users of init_timer_deferrable() to use > the new timer_setup() and from_timer(). Removes definition of > init_timer_deferrable(). [...] > drivers/hsi/clients/ssi_protocol.c | 32 > Acked-by: Sebastian Reichel-- Sebastian signature.asc Description: PGP signature
[PATCH] staging/wilc1000: Convert timers to use timer_setup()
As part of removing the timer_list.data field, this converts the wilc1000 driver to using from_timer and an explicit per-timer data field, since there doesn't appear to be a way to sanely resolve vif from hif_drv. Cc: Aditya ShankarCc: Ganesh Krishna Cc: Greg Kroah-Hartman Cc: linux-wireless@vger.kernel.org Cc: de...@driverdev.osuosl.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/staging/wilc1000/host_interface.c | 39 +-- drivers/staging/wilc1000/host_interface.h | 5 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7b620658ec38..c16f96308a97 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -238,6 +238,7 @@ static struct completion hif_driver_comp; static struct completion hif_wait_response; static struct mutex hif_deinit_lock; static struct timer_list periodic_rssi; +static struct wilc_vif *periodic_rssi_vif; u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; @@ -2272,7 +2273,7 @@ static int Handle_RemainOnChan(struct wilc_vif *vif, ERRORHANDLER: { P2P_LISTEN_STATE = 1; - hif_drv->remain_on_ch_timer.data = (unsigned long)vif; + hif_drv->remain_on_ch_timer_vif = vif; mod_timer(_drv->remain_on_ch_timer, jiffies + msecs_to_jiffies(pstrHostIfRemainOnChan->duration)); @@ -2360,11 +2361,13 @@ static u32 Handle_ListenStateExpired(struct wilc_vif *vif, return result; } -static void ListenTimerCB(unsigned long arg) +static void ListenTimerCB(struct timer_list *t) { + struct host_if_drv *hif_drv = from_timer(hif_drv, t, + remain_on_ch_timer); + struct wilc_vif *vif = hif_drv->remain_on_ch_timer_vif; s32 result = 0; struct host_if_msg msg; - struct wilc_vif *vif = (struct wilc_vif *)arg; del_timer(>hif_drv->remain_on_ch_timer); @@ -2643,9 +2646,10 @@ static void host_if_work(struct work_struct *work) complete(_thread_comp); } -static void TimerCB_Scan(unsigned long arg) +static void TimerCB_Scan(struct timer_list *t) { - struct wilc_vif *vif = (struct wilc_vif *)arg; + struct host_if_drv *hif_drv = from_timer(hif_drv, t, scan_timer); + struct wilc_vif *vif = hif_drv->scan_timer_vif; struct host_if_msg msg; memset(, 0, sizeof(struct host_if_msg)); @@ -2655,9 +2659,11 @@ static void TimerCB_Scan(unsigned long arg) wilc_enqueue_cmd(); } -static void TimerCB_Connect(unsigned long arg) +static void TimerCB_Connect(struct timer_list *t) { - struct wilc_vif *vif = (struct wilc_vif *)arg; + struct host_if_drv *hif_drv = from_timer(hif_drv, t, + connect_timer); + struct wilc_vif *vif = hif_drv->connect_timer_vif; struct host_if_msg msg; memset(, 0, sizeof(struct host_if_msg)); @@ -3040,7 +3046,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, return -EFAULT; } - hif_drv->connect_timer.data = (unsigned long)vif; + hif_drv->connect_timer_vif = vif; mod_timer(_drv->connect_timer, jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); @@ -3283,7 +3289,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, return -EINVAL; } - hif_drv->scan_timer.data = (unsigned long)vif; + hif_drv->scan_timer_vif = vif; mod_timer(_drv->scan_timer, jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); @@ -3309,9 +3315,9 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, return wilc_enqueue_cmd(); } -static void GetPeriodicRSSI(unsigned long arg) +static void GetPeriodicRSSI(struct timer_list *unused) { - struct wilc_vif *vif = (struct wilc_vif *)arg; + struct wilc_vif *vif = periodic_rssi_vif; if (!vif->hif_drv) { netdev_err(vif->ndev, "Driver handler is NULL\n"); @@ -3321,7 +3327,6 @@ static void GetPeriodicRSSI(unsigned long arg) if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) wilc_get_statistics(vif, >wilc->dummy_statistics); - periodic_rssi.data = (unsigned long)vif; mod_timer(_rssi, jiffies + msecs_to_jiffies(5000)); } @@ -3374,14 +3379,14 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) goto _fail_; } -
Re: [PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup()
From: Kees CookDate: Wed, 4 Oct 2017 16:26:58 -0700 > This refactors the only users of init_timer_pinned() to use > the new timer_setup() and from_timer(). Drops the definition of > init_timer_pinned(). > > Cc: Chris Metcalf > Cc: Thomas Gleixner > Cc: net...@vger.kernel.org > Signed-off-by: Kees Cook For networking: Acked-by: David S. Miller
Re: [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
From: Kees CookDate: Wed, 4 Oct 2017 16:26:59 -0700 > This refactors the only users of init_timer_deferrable() to use > the new timer_setup() and from_timer(). Removes definition of > init_timer_deferrable(). > > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Cc: Sebastian Reichel > Cc: Harish Patil > Cc: Manish Chopra > Cc: Kalle Valo > Cc: linuxppc-...@lists.ozlabs.org > Cc: net...@vger.kernel.org > Cc: linux-wireless@vger.kernel.org > Signed-off-by: Kees Cook For networking: Acked-by: David S. Miller
Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
From: Kees CookDate: Wed, 4 Oct 2017 16:27:04 -0700 > Drop the arguments from the macro and adjust all callers with the > following script: > > perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \ > $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h) > > Signed-off-by: Kees Cook > Acked-by: Geert Uytterhoeven # for m68k parts For networking: Acked-by: David S. Miller
Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
On 10/04/2017 04:27 PM, Kees Cook wrote: Drop the arguments from the macro and adjust all callers with the following script: perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \ $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h) Signed-off-by: Kees CookAcked-by: Geert Uytterhoeven # for m68k parts For watchdog: Acked-by: Guenter Roeck --- arch/arm/mach-ixp4xx/dsmg600-setup.c | 2 +- arch/arm/mach-ixp4xx/nas100d-setup.c | 2 +- arch/m68k/amiga/amisound.c| 2 +- arch/m68k/mac/macboing.c | 2 +- arch/mips/mti-malta/malta-display.c | 2 +- arch/parisc/kernel/pdc_cons.c | 2 +- arch/s390/mm/cmm.c| 2 +- drivers/atm/idt77105.c| 4 ++-- drivers/atm/iphase.c | 2 +- drivers/block/ataflop.c | 8 drivers/char/dtlk.c | 2 +- drivers/char/hangcheck-timer.c| 2 +- drivers/char/nwbutton.c | 2 +- drivers/char/rtc.c| 2 +- drivers/input/touchscreen/s3c2410_ts.c| 2 +- drivers/net/cris/eth_v10.c| 6 +++--- drivers/net/hamradio/yam.c| 2 +- drivers/net/wireless/atmel/at76c50x-usb.c | 2 +- drivers/staging/speakup/main.c| 2 +- drivers/staging/speakup/synth.c | 2 +- drivers/tty/cyclades.c| 2 +- drivers/tty/isicom.c | 2 +- drivers/tty/moxa.c| 2 +- drivers/tty/rocket.c | 2 +- drivers/tty/vt/keyboard.c | 2 +- drivers/tty/vt/vt.c | 2 +- drivers/watchdog/alim7101_wdt.c | 2 +- drivers/watchdog/machzwd.c| 2 +- drivers/watchdog/mixcomwd.c | 2 +- drivers/watchdog/sbc60xxwdt.c | 2 +- drivers/watchdog/sc520_wdt.c | 2 +- drivers/watchdog/via_wdt.c| 2 +- drivers/watchdog/w83877f_wdt.c| 2 +- drivers/xen/grant-table.c | 2 +- fs/pstore/platform.c | 2 +- include/linux/timer.h | 4 ++-- kernel/irq/spurious.c | 2 +- lib/random32.c| 2 +- net/atm/mpc.c | 2 +- net/decnet/dn_route.c | 2 +- net/ipv6/ip6_flowlabel.c | 2 +- net/netrom/nr_loopback.c | 2 +- security/keys/gc.c| 2 +- sound/oss/midibuf.c | 2 +- sound/oss/soundcard.c | 2 +- sound/oss/sys_timer.c | 2 +- sound/oss/uart6850.c | 2 +- 47 files changed, 54 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index b3bd0e137f6d..b3689a141ec6 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c @@ -174,7 +174,7 @@ static int power_button_countdown; #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ static void dsmg600_power_handler(unsigned long data); -static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0); +static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler); static void dsmg600_power_handler(unsigned long data) { diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 4e0f762bc651..562d05f9888e 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -197,7 +197,7 @@ static int power_button_countdown; #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ static void nas100d_power_handler(unsigned long data); -static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); +static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler); static void nas100d_power_handler(unsigned long data) { diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c index 90a60d758f8b..a23f48181fd6 100644 --- a/arch/m68k/amiga/amisound.c +++ b/arch/m68k/amiga/amisound.c @@ -66,7 +66,7 @@ void __init amiga_init_sound(void) } static void nosound( unsigned long ignored ); -static DEFINE_TIMER(sound_timer, nosound, 0, 0); +static DEFINE_TIMER(sound_timer, nosound); void amiga_mksound( unsigned int hz, unsigned int ticks ) { diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c index ffaa1f6439ae..9a52aff183d0 100644 --- a/arch/m68k/mac/macboing.c +++ b/arch/m68k/mac/macboing.c @@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int ); /* * our timer to start/continue/stop the bell */ -static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0); +static DEFINE_TIMER(mac_sound_timer, mac_nosound); /* * Sort of initialize
Re: [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
On 10/04/2017 04:27 PM, Kees Cook wrote: The expire and data arguments of DEFINE_TIMER are only used in two places and are ignored by the code (malta-display.c only uses mod_timer(), never add_timer(), so the preset expires value is ignored). Set both sets of arguments to zero. Cc: Ralf BaechleCc: Wim Van Sebroeck Cc: Guenter Roeck Cc: Geert Uytterhoeven Cc: linux-m...@linux-mips.org Cc: linux-watch...@vger.kernel.org Signed-off-by: Kees Cook For watchdog: Acked-by: Guenter Roeck --- arch/mips/mti-malta/malta-display.c | 6 +++--- drivers/watchdog/alim7101_wdt.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c index d4f807191ecd..ac813158b9b8 100644 --- a/arch/mips/mti-malta/malta-display.c +++ b/arch/mips/mti-malta/malta-display.c @@ -36,10 +36,10 @@ void mips_display_message(const char *str) } } -static void scroll_display_message(unsigned long data); -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0); +static void scroll_display_message(unsigned long unused); +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0); -static void scroll_display_message(unsigned long data) +static void scroll_display_message(unsigned long unused) { mips_display_message(_string[display_count++]); if (display_count == max_display_count) diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index 665e0e7dfe1e..3c1f6ac68ea9 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio, "Use the gpio watchdog (required by old cobalt boards)."); static void wdt_timer_ping(unsigned long); -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1); +static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0); static unsigned long next_heartbeat; static unsigned long wdt_is_open; static char wdt_expect_close; @@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout, *Whack the dog */ -static void wdt_timer_ping(unsigned long data) +static void wdt_timer_ping(unsigned long unused) { /* If we got a heartbeat pulse within the WDT_US_INTERVAL * we agree to ping the WDT
[PATCH 00/13] timer: Start conversion to timer_setup()
Hi, This is the first of many timer infrastructure cleanups to simplify the timer API[1]. All of these patches are expected to land via the timer tree, so Acks (or corrections) appreciated. These patches refactor various users of timer API that are NOT just using init_timer() or setup_timer() (which is the vast majority of users, and are being converted separately). These changes are focused on the lesser-used init_timer_*(), TIMER_*INITIALIZER(), and DEFINE_TIMER() methods of preparing a timer. Thanks! -Kees [1] https://git.kernel.org/linus/686fef928bba6be13cabe639f154af7d72b63120
[PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup()
This refactors the only users of init_timer_pinned() to use the new timer_setup() and from_timer(). Drops the definition of init_timer_pinned(). Cc: Chris MetcalfCc: Thomas Gleixner Cc: net...@vger.kernel.org Signed-off-by: Kees Cook --- drivers/net/ethernet/tile/tilepro.c | 9 - include/linux/timer.h | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c index 49ccee4b9aec..56d06282fbde 100644 --- a/drivers/net/ethernet/tile/tilepro.c +++ b/drivers/net/ethernet/tile/tilepro.c @@ -608,9 +608,9 @@ static void tile_net_schedule_egress_timer(struct tile_net_cpu *info) * ISSUE: Maybe instead track number of expected completions, and free * only that many, resetting to zero if "pending" is ever false. */ -static void tile_net_handle_egress_timer(unsigned long arg) +static void tile_net_handle_egress_timer(struct timer_list *t) { - struct tile_net_cpu *info = (struct tile_net_cpu *)arg; + struct tile_net_cpu *info = from_timer(info, t, egress_timer); struct net_device *dev = info->napi.dev; /* The timer is no longer scheduled. */ @@ -1004,9 +1004,8 @@ static void tile_net_register(void *dev_ptr) BUG(); /* Initialize the egress timer. */ - init_timer_pinned(>egress_timer); - info->egress_timer.data = (long)info; - info->egress_timer.function = tile_net_handle_egress_timer; + timer_setup(>egress_timer, tile_net_handle_egress_timer, + TIMER_PINNED); u64_stats_init(>stats.syncp); diff --git a/include/linux/timer.h b/include/linux/timer.h index b10c4bdc6fbd..9da903562ed4 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer, #define init_timer(timer) \ __init_timer((timer), 0) -#define init_timer_pinned(timer) \ - __init_timer((timer), TIMER_PINNED) #define init_timer_deferrable(timer) \ __init_timer((timer), TIMER_DEFERRABLE) -- 2.7.4
[PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
Remove uses of init_timer_on_stack() with open-coded function and data assignments that could be expressed using timer_setup_on_stack(). Several were removed from the stack entirely since there was a one-to-one mapping of parent structure to timer, those are switched to using timer_setup() instead. All related callbacks were adjusted to use from_timer(). Cc: "Rafael J. Wysocki"Cc: Pavel Machek Cc: Len Brown Cc: Greg Kroah-Hartman Cc: Stefan Richter Cc: Sudip Mukherjee Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Julian Wiedmann Cc: Ursula Braun Cc: Michael Reed Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Thomas Gleixner Cc: linux...@vger.kernel.org Cc: linux1394-de...@lists.sourceforge.net Cc: linux-s...@vger.kernel.org Cc: linux-s...@vger.kernel.org Signed-off-by: Kees Cook --- drivers/base/power/main.c | 8 +++- drivers/firewire/core-transaction.c | 10 +- drivers/parport/ieee1284.c | 21 +++-- drivers/s390/char/tape.h| 1 + drivers/s390/char/tape_std.c| 18 ++ drivers/s390/net/lcs.c | 16 ++-- drivers/s390/net/lcs.h | 1 + drivers/scsi/qla1280.c | 14 +- drivers/scsi/qla1280.h | 1 + include/linux/parport.h | 1 + include/linux/timer.h | 2 -- 11 files changed, 36 insertions(+), 57 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 770b1539a083..ae47b2ec84b4 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -478,9 +478,9 @@ struct dpm_watchdog { * There's not much we can do here to recover so panic() to * capture a crash-dump in pstore. */ -static void dpm_watchdog_handler(unsigned long data) +static void dpm_watchdog_handler(struct timer_list *t) { - struct dpm_watchdog *wd = (void *)data; + struct dpm_watchdog *wd = from_timer(wd, t, timer); dev_emerg(wd->dev, " DPM device timeout \n"); show_stack(wd->tsk, NULL); @@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev) wd->dev = dev; wd->tsk = current; - init_timer_on_stack(timer); + timer_setup_on_stack(timer, dpm_watchdog_handler, 0); /* use same timeout value for both suspend and resume */ timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT; - timer->function = dpm_watchdog_handler; - timer->data = (unsigned long)wd; add_timer(timer); } diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index d6a09b9cd8cc..4372f9e4b0da 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c @@ -137,9 +137,9 @@ int fw_cancel_transaction(struct fw_card *card, } EXPORT_SYMBOL(fw_cancel_transaction); -static void split_transaction_timeout_callback(unsigned long data) +static void split_transaction_timeout_callback(struct timer_list *timer) { - struct fw_transaction *t = (struct fw_transaction *)data; + struct fw_transaction *t = from_timer(t, timer, split_timeout_timer); struct fw_card *card = t->card; unsigned long flags; @@ -373,8 +373,8 @@ void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode, t->tlabel = tlabel; t->card = card; t->is_split_transaction = false; - setup_timer(>split_timeout_timer, - split_transaction_timeout_callback, (unsigned long)t); + timer_setup(>split_timeout_timer, + split_transaction_timeout_callback, 0); t->callback = callback; t->callback_data = callback_data; @@ -423,7 +423,7 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, struct transaction_callback_data d; struct fw_transaction t; - init_timer_on_stack(_timeout_timer); + timer_setup_on_stack(_timeout_timer, NULL, 0); init_completion(); d.payload = payload; fw_send_request(card, , tcode, destination_id, generation, speed, diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c index 74cc6dd982d2..2d1a5c737c6e 100644 --- a/drivers/parport/ieee1284.c +++ b/drivers/parport/ieee1284.c @@ -44,10 +44,11 @@ static void parport_ieee1284_wakeup (struct parport *port) up (>physport->ieee1284.irq); } -static struct parport *port_from_cookie[PARPORT_MAX]; -static void timeout_waiting_on_port (unsigned long cookie) +static void timeout_waiting_on_port (struct timer_list *t) { -
[PATCH 01/13] timer: Convert schedule_timeout() to use from_timer()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new from_timer() helper and passing the timer pointer explicitly. Since this special timer is on the stack, it needs to have a wrapper structure to carry state once .data is eliminated. Cc: John StultzCc: Thomas Gleixner Cc: Stephen Boyd Signed-off-by: Kees Cook --- include/linux/timer.h | 8 kernel/time/timer.c | 26 +++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/linux/timer.h b/include/linux/timer.h index 6383c528b148..5ef5c9e41a09 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -179,6 +179,14 @@ static inline void timer_setup(struct timer_list *timer, (TIMER_DATA_TYPE)timer, flags); } +static inline void timer_setup_on_stack(struct timer_list *timer, + void (*callback)(struct timer_list *), + unsigned int flags) +{ + __setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback, + (TIMER_DATA_TYPE)timer, flags); +} + #define from_timer(var, callback_timer, timer_fieldname) \ container_of(callback_timer, typeof(*var), timer_fieldname) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index f2674a056c26..38613ced2324 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1668,9 +1668,20 @@ void run_local_timers(void) raise_softirq(TIMER_SOFTIRQ); } -static void process_timeout(unsigned long __data) +/* + * Since schedule_timeout()'s timer is defined on the stack, it must store + * the target task on the stack as well. + */ +struct process_timer { + struct timer_list timer; + struct task_struct *task; +}; + +static void process_timeout(struct timer_list *t) { - wake_up_process((struct task_struct *)__data); + struct process_timer *timeout = from_timer(timeout, t, timer); + + wake_up_process(timeout->task); } /** @@ -1704,7 +1715,7 @@ static void process_timeout(unsigned long __data) */ signed long __sched schedule_timeout(signed long timeout) { - struct timer_list timer; + struct process_timer timer; unsigned long expire; switch (timeout) @@ -1738,13 +1749,14 @@ signed long __sched schedule_timeout(signed long timeout) expire = timeout + jiffies; - setup_timer_on_stack(, process_timeout, (unsigned long)current); - __mod_timer(, expire, false); + timer.task = current; + timer_setup_on_stack(, process_timeout, 0); + __mod_timer(, expire, false); schedule(); - del_singleshot_timer_sync(); + del_singleshot_timer_sync(); /* Remove the timer from the object tracker */ - destroy_timer_on_stack(); + destroy_timer_on_stack(); timeout = expire - jiffies; -- 2.7.4
[PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
This refactors the only users of init_timer_deferrable() to use the new timer_setup() and from_timer(). Removes definition of init_timer_deferrable(). Cc: Benjamin HerrenschmidtCc: Michael Ellerman Cc: Sebastian Reichel Cc: Harish Patil Cc: Manish Chopra Cc: Kalle Valo Cc: linuxppc-...@lists.ozlabs.org Cc: net...@vger.kernel.org Cc: linux-wireless@vger.kernel.org Signed-off-by: Kees Cook --- arch/powerpc/mm/numa.c | 12 +-- drivers/hsi/clients/ssi_protocol.c | 32 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 11 -- drivers/net/vxlan.c | 8 +++ drivers/net/wireless/ath/ath6kl/recovery.c | 9 include/linux/timer.h| 2 -- 6 files changed, 34 insertions(+), 40 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index b95c584ce19d..f9b6107d6854 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -1453,7 +1453,7 @@ static void topology_schedule_update(void) schedule_work(_work); } -static void topology_timer_fn(unsigned long ignored) +static void topology_timer_fn(struct timer_list *unused) { if (prrn_enabled && cpumask_weight(_associativity_changes_mask)) topology_schedule_update(); @@ -1463,14 +1463,11 @@ static void topology_timer_fn(unsigned long ignored) reset_topology_timer(); } } -static struct timer_list topology_timer = - TIMER_INITIALIZER(topology_timer_fn, 0, 0); +static struct timer_list topology_timer; static void reset_topology_timer(void) { - topology_timer.data = 0; - topology_timer.expires = jiffies + 60 * HZ; - mod_timer(_timer, topology_timer.expires); + mod_timer(_timer, jiffies + 60 * HZ); } #ifdef CONFIG_SMP @@ -1530,7 +1527,8 @@ int start_topology_update(void) prrn_enabled = 0; vphn_enabled = 1; setup_cpu_associativity_change_counters(); - init_timer_deferrable(_timer); + timer_setup(_timer, topology_timer_fn, + TIMER_DEFERRABLE); reset_topology_timer(); } } diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c index 93d28c0ec8bf..67af03d3aeb3 100644 --- a/drivers/hsi/clients/ssi_protocol.c +++ b/drivers/hsi/clients/ssi_protocol.c @@ -464,10 +464,10 @@ static void ssip_error(struct hsi_client *cl) hsi_async_read(cl, msg); } -static void ssip_keep_alive(unsigned long data) +static void ssip_keep_alive(struct timer_list *t) { - struct hsi_client *cl = (struct hsi_client *)data; - struct ssi_protocol *ssi = hsi_client_drvdata(cl); + struct ssi_protocol *ssi = from_timer(ssi, t, keep_alive); + struct hsi_client *cl = ssi->cl; dev_dbg(>device, "Keep alive kick in: m(%d) r(%d) s(%d)\n", ssi->main_state, ssi->recv_state, ssi->send_state); @@ -490,9 +490,19 @@ static void ssip_keep_alive(unsigned long data) spin_unlock(>lock); } -static void ssip_wd(unsigned long data) +static void ssip_rx_wd(struct timer_list *t) +{ + struct ssi_protocol *ssi = from_timer(ssi, t, rx_wd); + struct hsi_client *cl = ssi->cl; + + dev_err(>device, "Watchdog trigerred\n"); + ssip_error(cl); +} + +static void ssip_tx_wd(unsigned long data) { - struct hsi_client *cl = (struct hsi_client *)data; + struct ssi_protocol *ssi = from_timer(ssi, t, tx_wd); + struct hsi_client *cl = ssi->cl; dev_err(>device, "Watchdog trigerred\n"); ssip_error(cl); @@ -1084,15 +1094,9 @@ static int ssi_protocol_probe(struct device *dev) } spin_lock_init(>lock); - init_timer_deferrable(>rx_wd); - init_timer_deferrable(>tx_wd); - init_timer(>keep_alive); - ssi->rx_wd.data = (unsigned long)cl; - ssi->rx_wd.function = ssip_wd; - ssi->tx_wd.data = (unsigned long)cl; - ssi->tx_wd.function = ssip_wd; - ssi->keep_alive.data = (unsigned long)cl; - ssi->keep_alive.function = ssip_keep_alive; + timer_setup(>rx_wd, ssip_rx_wd, TIMER_DEFERRABLE); + timer_setup(>tx_wd, ssip_tx_wd, TIMER_DEFERRABLE); + timer_setup(>keep_alive, ssip_keep_alive, 0); INIT_LIST_HEAD(>txqueue); INIT_LIST_HEAD(>cmdqueue); atomic_set(>tx_usecnt, 0); diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 9feec7009443..29fea74bff2e 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c @@ -4725,9 +4725,9 @@ static const struct net_device_ops qlge_netdev_ops =
[PATCH 08/13] timer: Remove unused static initializer macros
This removes the now unused TIMER_*INITIALIZER macros: TIMER_INITIALIZER TIMER_PINNED_INITIALIZER TIMER_DEFERRED_INITIALIZER TIMER_PINNED_DEFERRED_INITIALIZER Signed-off-by: Kees Cook--- include/linux/timer.h | 12 1 file changed, 12 deletions(-) diff --git a/include/linux/timer.h b/include/linux/timer.h index 4f7476e4a727..a33220311361 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -73,18 +73,6 @@ struct timer_list { __FILE__ ":" __stringify(__LINE__)) \ } -#define TIMER_INITIALIZER(_function, _expires, _data) \ - __TIMER_INITIALIZER((_function), (_expires), (_data), 0) - -#define TIMER_PINNED_INITIALIZER(_function, _expires, _data) \ - __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED) - -#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data) \ - __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE) - -#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data) \ - __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED) - #define DEFINE_TIMER(_name, _function, _expires, _data)\ struct timer_list _name = \ __TIMER_INITIALIZER(_function, _expires, _data, 0) -- 2.7.4
[PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
Drop the arguments from the macro and adjust all callers with the following script: perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \ $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h) Signed-off-by: Kees CookAcked-by: Geert Uytterhoeven # for m68k parts --- arch/arm/mach-ixp4xx/dsmg600-setup.c | 2 +- arch/arm/mach-ixp4xx/nas100d-setup.c | 2 +- arch/m68k/amiga/amisound.c| 2 +- arch/m68k/mac/macboing.c | 2 +- arch/mips/mti-malta/malta-display.c | 2 +- arch/parisc/kernel/pdc_cons.c | 2 +- arch/s390/mm/cmm.c| 2 +- drivers/atm/idt77105.c| 4 ++-- drivers/atm/iphase.c | 2 +- drivers/block/ataflop.c | 8 drivers/char/dtlk.c | 2 +- drivers/char/hangcheck-timer.c| 2 +- drivers/char/nwbutton.c | 2 +- drivers/char/rtc.c| 2 +- drivers/input/touchscreen/s3c2410_ts.c| 2 +- drivers/net/cris/eth_v10.c| 6 +++--- drivers/net/hamradio/yam.c| 2 +- drivers/net/wireless/atmel/at76c50x-usb.c | 2 +- drivers/staging/speakup/main.c| 2 +- drivers/staging/speakup/synth.c | 2 +- drivers/tty/cyclades.c| 2 +- drivers/tty/isicom.c | 2 +- drivers/tty/moxa.c| 2 +- drivers/tty/rocket.c | 2 +- drivers/tty/vt/keyboard.c | 2 +- drivers/tty/vt/vt.c | 2 +- drivers/watchdog/alim7101_wdt.c | 2 +- drivers/watchdog/machzwd.c| 2 +- drivers/watchdog/mixcomwd.c | 2 +- drivers/watchdog/sbc60xxwdt.c | 2 +- drivers/watchdog/sc520_wdt.c | 2 +- drivers/watchdog/via_wdt.c| 2 +- drivers/watchdog/w83877f_wdt.c| 2 +- drivers/xen/grant-table.c | 2 +- fs/pstore/platform.c | 2 +- include/linux/timer.h | 4 ++-- kernel/irq/spurious.c | 2 +- lib/random32.c| 2 +- net/atm/mpc.c | 2 +- net/decnet/dn_route.c | 2 +- net/ipv6/ip6_flowlabel.c | 2 +- net/netrom/nr_loopback.c | 2 +- security/keys/gc.c| 2 +- sound/oss/midibuf.c | 2 +- sound/oss/soundcard.c | 2 +- sound/oss/sys_timer.c | 2 +- sound/oss/uart6850.c | 2 +- 47 files changed, 54 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index b3bd0e137f6d..b3689a141ec6 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c @@ -174,7 +174,7 @@ static int power_button_countdown; #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ static void dsmg600_power_handler(unsigned long data); -static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0); +static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler); static void dsmg600_power_handler(unsigned long data) { diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 4e0f762bc651..562d05f9888e 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -197,7 +197,7 @@ static int power_button_countdown; #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ static void nas100d_power_handler(unsigned long data); -static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); +static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler); static void nas100d_power_handler(unsigned long data) { diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c index 90a60d758f8b..a23f48181fd6 100644 --- a/arch/m68k/amiga/amisound.c +++ b/arch/m68k/amiga/amisound.c @@ -66,7 +66,7 @@ void __init amiga_init_sound(void) } static void nosound( unsigned long ignored ); -static DEFINE_TIMER(sound_timer, nosound, 0, 0); +static DEFINE_TIMER(sound_timer, nosound); void amiga_mksound( unsigned int hz, unsigned int ticks ) { diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c index ffaa1f6439ae..9a52aff183d0 100644 --- a/arch/m68k/mac/macboing.c +++ b/arch/m68k/mac/macboing.c @@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int ); /* * our timer to start/continue/stop the bell */ -static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0); +static DEFINE_TIMER(mac_sound_timer, mac_nosound); /* * Sort of initialize the sound chip (called from mac_mksound on the first diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c index ac813158b9b8..063de44675ce 100644 ---
[PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER()
The expires field is normally initialized during the first mod_timer() call. It was unused by all callers, so remove it from the macro. Signed-off-by: Kees Cook--- include/linux/kthread.h | 2 +- include/linux/timer.h | 5 ++--- include/linux/workqueue.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 82e197eeac91..0d622b350d3f 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -117,7 +117,7 @@ struct kthread_delayed_work { #define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \ .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \ .timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn, \ -0, (unsigned long)&(dwork),\ +(unsigned long)&(dwork), \ TIMER_IRQSAFE),\ } diff --git a/include/linux/timer.h b/include/linux/timer.h index 91e5a2cc81b5..10685c33e679 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -63,10 +63,9 @@ struct timer_list { #define TIMER_TRACE_FLAGMASK (TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE) -#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \ +#define __TIMER_INITIALIZER(_function, _data, _flags) {\ .entry = { .next = TIMER_ENTRY_STATIC },\ .function = (_function),\ - .expires = (_expires), \ .data = (_data),\ .flags = (_flags), \ __TIMER_LOCKDEP_MAP_INITIALIZER(\ @@ -75,7 +74,7 @@ struct timer_list { #define DEFINE_TIMER(_name, _function) \ struct timer_list _name = \ - __TIMER_INITIALIZER(_function, 0, 0, 0) + __TIMER_INITIALIZER(_function, 0, 0) void init_timer_key(struct timer_list *timer, unsigned int flags, const char *name, struct lock_class_key *key); diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 1c49431f3121..f4960260feaf 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -176,7 +176,7 @@ struct execute_work { #define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \ .work = __WORK_INITIALIZER((n).work, (f)), \ .timer = __TIMER_INITIALIZER(delayed_work_timer_fn, \ -0, (unsigned long)&(n),\ +(unsigned long)&(n), \ (tflags) | TIMER_IRQSAFE), \ } -- 2.7.4
[PATCH 13/13] workqueue: Convert callback to use from_timer()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch workqueue to use from_timer() and pass the timer pointer explicitly. Cc: Tejun HeoCc: Lai Jiangshan Signed-off-by: Kees Cook --- include/linux/workqueue.h | 15 --- kernel/workqueue.c| 7 +++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index f4960260feaf..f3c47a05fd06 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -17,7 +17,7 @@ struct workqueue_struct; struct work_struct; typedef void (*work_func_t)(struct work_struct *work); -void delayed_work_timer_fn(unsigned long __data); +void delayed_work_timer_fn(struct timer_list *t); /* * The first word is the work queue pointer and the flags rolled into @@ -175,8 +175,8 @@ struct execute_work { #define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \ .work = __WORK_INITIALIZER((n).work, (f)), \ - .timer = __TIMER_INITIALIZER(delayed_work_timer_fn, \ -(unsigned long)&(n), \ + .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\ +(TIMER_DATA_TYPE)&(n.timer), \ (tflags) | TIMER_IRQSAFE), \ } @@ -241,8 +241,9 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; } #define __INIT_DELAYED_WORK(_work, _func, _tflags) \ do {\ INIT_WORK(&(_work)->work, (_func)); \ - __setup_timer(&(_work)->timer, delayed_work_timer_fn, \ - (unsigned long)(_work), \ + __setup_timer(&(_work)->timer, \ + (TIMER_FUNC_TYPE)delayed_work_timer_fn, \ + (TIMER_DATA_TYPE)&(_work)->timer, \ (_tflags) | TIMER_IRQSAFE); \ } while (0) @@ -250,8 +251,8 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; } do {\ INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ __setup_timer_on_stack(&(_work)->timer, \ - delayed_work_timer_fn, \ - (unsigned long)(_work), \ + (TIMER_FUNC_TYPE)delayed_work_timer_fn,\ + (TIMER_DATA_TYPE)&(_work)->timer,\ (_tflags) | TIMER_IRQSAFE); \ } while (0) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index a5361fc6215d..c77fdf6bf24f 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq, } EXPORT_SYMBOL(queue_work_on); -void delayed_work_timer_fn(unsigned long __data) +void delayed_work_timer_fn(struct timer_list *t) { - struct delayed_work *dwork = (struct delayed_work *)__data; + struct delayed_work *dwork = from_timer(dwork, t, timer); /* should have been called from irqsafe timer with irq already off */ __queue_work(dwork->cpu, dwork->wq, >work); @@ -1508,8 +1508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, struct work_struct *work = >work; WARN_ON_ONCE(!wq); - WARN_ON_ONCE(timer->function != delayed_work_timer_fn || -timer->data != (unsigned long)dwork); + WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn); WARN_ON_ONCE(timer_pending(timer)); WARN_ON_ONCE(!list_empty(>entry)); -- 2.7.4
[PATCH 12/13] kthread: Convert callback to use from_timer()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch kthread to use from_timer() and pass the timer pointer explicitly. Cc: Andrew MortonCc: Petr Mladek Cc: Tejun Heo Cc: Thomas Gleixner Cc: Oleg Nesterov Signed-off-by: Kees Cook --- include/linux/kthread.h | 10 +- kernel/kthread.c| 10 -- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 0d622b350d3f..35cbe3b0ce5b 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -75,7 +75,7 @@ extern int tsk_fork_get_node(struct task_struct *tsk); */ struct kthread_work; typedef void (*kthread_work_func_t)(struct kthread_work *work); -void kthread_delayed_work_timer_fn(unsigned long __data); +void kthread_delayed_work_timer_fn(struct timer_list *t); enum { KTW_FREEZABLE = 1 << 0, /* freeze during suspend */ @@ -116,8 +116,8 @@ struct kthread_delayed_work { #define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \ .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \ - .timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn, \ -(unsigned long)&(dwork), \ + .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ +(TIMER_DATA_TYPE)&(dwork.timer), \ TIMER_IRQSAFE),\ } @@ -164,8 +164,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, do {\ kthread_init_work(&(dwork)->work, (fn));\ __setup_timer(&(dwork)->timer, \ - kthread_delayed_work_timer_fn,\ - (unsigned long)(dwork), \ + (TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ + (TIMER_DATA_TYPE)&(dwork)->timer, \ TIMER_IRQSAFE); \ } while (0) diff --git a/kernel/kthread.c b/kernel/kthread.c index 1c19edf82427..ba3992c8c375 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -798,15 +798,14 @@ EXPORT_SYMBOL_GPL(kthread_queue_work); /** * kthread_delayed_work_timer_fn - callback that queues the associated kthread * delayed work when the timer expires. - * @__data: pointer to the data associated with the timer + * @t: pointer to the expired timer * * The format of the function is defined by struct timer_list. * It should have been called from irqsafe timer with irq already off. */ -void kthread_delayed_work_timer_fn(unsigned long __data) +void kthread_delayed_work_timer_fn(struct timer_list *t) { - struct kthread_delayed_work *dwork = - (struct kthread_delayed_work *)__data; + struct kthread_delayed_work *dwork = from_timer(dwork, t, timer); struct kthread_work *work = >work; struct kthread_worker *worker = work->worker; @@ -837,8 +836,7 @@ void __kthread_queue_delayed_work(struct kthread_worker *worker, struct timer_list *timer = >timer; struct kthread_work *work = >work; - WARN_ON_ONCE(timer->function != kthread_delayed_work_timer_fn || -timer->data != (unsigned long)dwork); + WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn); /* * If @delay is 0, queue @dwork->work immediately. This is for -- 2.7.4
[PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
The expire and data arguments of DEFINE_TIMER are only used in two places and are ignored by the code (malta-display.c only uses mod_timer(), never add_timer(), so the preset expires value is ignored). Set both sets of arguments to zero. Cc: Ralf BaechleCc: Wim Van Sebroeck Cc: Guenter Roeck Cc: Geert Uytterhoeven Cc: linux-m...@linux-mips.org Cc: linux-watch...@vger.kernel.org Signed-off-by: Kees Cook --- arch/mips/mti-malta/malta-display.c | 6 +++--- drivers/watchdog/alim7101_wdt.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c index d4f807191ecd..ac813158b9b8 100644 --- a/arch/mips/mti-malta/malta-display.c +++ b/arch/mips/mti-malta/malta-display.c @@ -36,10 +36,10 @@ void mips_display_message(const char *str) } } -static void scroll_display_message(unsigned long data); -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0); +static void scroll_display_message(unsigned long unused); +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0); -static void scroll_display_message(unsigned long data) +static void scroll_display_message(unsigned long unused) { mips_display_message(_string[display_count++]); if (display_count == max_display_count) diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index 665e0e7dfe1e..3c1f6ac68ea9 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio, "Use the gpio watchdog (required by old cobalt boards)."); static void wdt_timer_ping(unsigned long); -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1); +static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0); static unsigned long next_heartbeat; static unsigned long wdt_is_open; static char wdt_expect_close; @@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout, * Whack the dog */ -static void wdt_timer_ping(unsigned long data) +static void wdt_timer_ping(unsigned long unused) { /* If we got a heartbeat pulse within the WDT_US_INTERVAL * we agree to ping the WDT -- 2.7.4
[PATCH 06/13] timer: Remove users of TIMER_DEFERRED_INITIALIZER
This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location to call timer_setup() from before add_timer() or mod_timer() is called. Adjusts callbacks to use from_timer() as needed. Cc: Martin SchwidefskyCc: Heiko Carstens Cc: Tejun Heo Cc: Lai Jiangshan Cc: linux-s...@vger.kernel.org Signed-off-by: Kees Cook --- arch/s390/kernel/lgr.c | 6 +++--- arch/s390/kernel/topology.c | 6 +++--- kernel/workqueue.c | 8 +++- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c index ae7dff110054..bf9622f0e6b1 100644 --- a/arch/s390/kernel/lgr.c +++ b/arch/s390/kernel/lgr.c @@ -153,14 +153,13 @@ static void lgr_timer_set(void); /* * LGR timer callback */ -static void lgr_timer_fn(unsigned long ignored) +static void lgr_timer_fn(struct timer_list *unused) { lgr_info_log(); lgr_timer_set(); } -static struct timer_list lgr_timer = - TIMER_DEFERRED_INITIALIZER(lgr_timer_fn, 0, 0); +static struct timer_list lgr_timer; /* * Setup next LGR timer @@ -181,6 +180,7 @@ static int __init lgr_init(void) debug_register_view(lgr_dbf, _hex_ascii_view); lgr_info_get(_info_last); debug_event(lgr_dbf, 1, _info_last, sizeof(lgr_info_last)); + timer_setup(_timer, lgr_timer_fn, TIMER_DEFERRABLE); lgr_timer_set(); return 0; } diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index ed0bdd220e1a..d7ece9888c29 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c @@ -320,15 +320,14 @@ static void topology_flush_work(void) flush_work(_work); } -static void topology_timer_fn(unsigned long ignored) +static void topology_timer_fn(struct timer_list *unused) { if (ptf(PTF_CHECK)) topology_schedule_update(); set_topology_timer(); } -static struct timer_list topology_timer = - TIMER_DEFERRED_INITIALIZER(topology_timer_fn, 0, 0); +static struct timer_list topology_timer; static atomic_t topology_poll = ATOMIC_INIT(0); @@ -597,6 +596,7 @@ static struct ctl_table topology_dir_table[] = { static int __init topology_init(void) { + timer_setup(_timer, topology_timer_fn, TIMER_DEFERRABLE); if (MACHINE_HAS_TOPOLOGY) set_topology_timer(); else diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 64d0edf428f8..a5361fc6215d 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5390,11 +5390,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq) { } */ #ifdef CONFIG_WQ_WATCHDOG -static void wq_watchdog_timer_fn(unsigned long data); - static unsigned long wq_watchdog_thresh = 30; -static struct timer_list wq_watchdog_timer = - TIMER_DEFERRED_INITIALIZER(wq_watchdog_timer_fn, 0, 0); +static struct timer_list wq_watchdog_timer; static unsigned long wq_watchdog_touched = INITIAL_JIFFIES; static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES; @@ -5408,7 +5405,7 @@ static void wq_watchdog_reset_touched(void) per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies; } -static void wq_watchdog_timer_fn(unsigned long data) +static void wq_watchdog_timer_fn(struct timer_list *unused) { unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; bool lockup_detected = false; @@ -5510,6 +5507,7 @@ module_param_cb(watchdog_thresh, _watchdog_thresh_ops, _watchdog_thresh, static void wq_watchdog_init(void) { + timer_setup(_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE); wq_watchdog_set_thresh(wq_watchdog_thresh); } -- 2.7.4
[PATCH 02/13] timer: Remove init_timer_pinned_deferrable() in favor of timer_setup()
This refactors the only user of init_timer_pinned_deferrable() to use the new timer_setup() and from_timer(). Adds a pointer back to the policy, and drops the definition of init_timer_pinned_deferrable(). Cc: "Rafael J. Wysocki"Cc: Viresh Kumar Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Thomas Gleixner Cc: linux...@vger.kernel.org Cc: linuxppc-...@lists.ozlabs.org Signed-off-by: Kees Cook --- drivers/cpufreq/powernv-cpufreq.c | 13 +++-- include/linux/timer.h | 2 -- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 3ff5160451b4..b6d7c4c98d0a 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -90,6 +90,7 @@ struct global_pstate_info { int last_gpstate_idx; spinlock_t gpstate_lock; struct timer_list timer; + struct cpufreq_policy *policy; }; static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1]; @@ -625,10 +626,10 @@ static inline void queue_gpstate_timer(struct global_pstate_info *gpstates) * according quadratic equation. Queues a new timer if it is still not equal * to local pstate */ -void gpstate_timer_handler(unsigned long data) +void gpstate_timer_handler(struct timer_list *t) { - struct cpufreq_policy *policy = (struct cpufreq_policy *)data; - struct global_pstate_info *gpstates = policy->driver_data; + struct global_pstate_info *gpstates = from_timer(gpstates, t, timer); + struct cpufreq_policy *policy = gpstates->policy; int gpstate_idx, lpstate_idx; unsigned long val; unsigned int time_diff = jiffies_to_msecs(jiffies) @@ -800,9 +801,9 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->driver_data = gpstates; /* initialize timer */ - init_timer_pinned_deferrable(>timer); - gpstates->timer.data = (unsigned long)policy; - gpstates->timer.function = gpstate_timer_handler; + gpstates->policy = policy; + timer_setup(>timer, gpstate_timer_handler, + TIMER_PINNED | TIMER_DEFERRABLE); gpstates->timer.expires = jiffies + msecs_to_jiffies(GPSTATE_TIMER_INTERVAL); spin_lock_init(>gpstate_lock); diff --git a/include/linux/timer.h b/include/linux/timer.h index 5ef5c9e41a09..d11e819a86e2 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -132,8 +132,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer, __init_timer((timer), TIMER_PINNED) #define init_timer_deferrable(timer) \ __init_timer((timer), TIMER_DEFERRABLE) -#define init_timer_pinned_deferrable(timer)\ - __init_timer((timer), TIMER_DEFERRABLE | TIMER_PINNED) #define init_timer_on_stack(timer) \ __init_timer_on_stack((timer), 0) -- 2.7.4
[PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the internal version. Cc: Arnd BergmannCc: Greg Kroah-Hartman Cc: Mark Gross Cc: Thomas Gleixner Signed-off-by: Kees Cook --- drivers/char/tlclk.c | 12 +--- include/linux/timer.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 6210bff46341..8eeb4190207d 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c @@ -184,9 +184,8 @@ static unsigned int telclk_interrupt; static int int_events; /* Event that generate a interrupt */ static int got_event; /* if events processing have been done */ -static void switchover_timeout(unsigned long data); -static struct timer_list switchover_timer = - TIMER_INITIALIZER(switchover_timeout , 0, 0); +static void switchover_timeout(struct timer_list *t); +static struct timer_list switchover_timer; static unsigned long tlclk_timer_data; static struct tlclk_alarms *alarm_events; @@ -805,7 +804,7 @@ static int __init tlclk_init(void) goto out3; } - init_timer(_timer); + timer_setup(_timer, switchover_timeout, 0); ret = misc_register(_miscdev); if (ret < 0) { @@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void) } -static void switchover_timeout(unsigned long data) +static void switchover_timeout(struct timer_list *unused) { - unsigned long flags = *(unsigned long *) data; + unsigned long flags = tlclk_timer_data; if ((flags & 1)) { if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) @@ -922,7 +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id) /* TIMEOUT in ~10ms */ switchover_timer.expires = jiffies + msecs_to_jiffies(10); tlclk_timer_data = inb(TLCLK_REG1); - switchover_timer.data = (unsigned long) _timer_data; mod_timer(_timer, switchover_timer.expires); } else { got_event = 1; diff --git a/include/linux/timer.h b/include/linux/timer.h index 10cc45ca5803..4f7476e4a727 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -87,7 +87,7 @@ struct timer_list { #define DEFINE_TIMER(_name, _function, _expires, _data)\ struct timer_list _name = \ - TIMER_INITIALIZER(_function, _expires, _data) + __TIMER_INITIALIZER(_function, _expires, _data, 0) void init_timer_key(struct timer_list *timer, unsigned int flags, const char *name, struct lock_class_key *key); -- 2.7.4
Re: [PATCH 09/11] ath10k_sdio: virtual scatter gather for receive
On 2017-09-30 19:37, silexcom...@gmail.com wrote: From: Alagu SankarThe existing implementation of initiating multiple sdio transfers for receive bundling is slowing down the receive speed. Combining the transfers using a scatter gather method would be ideal. This results in significant performance improvement. Since the sg implementation for sdio transfers are not reliable due to buffer start and size alignment, a virtual scatter gather implementation is used. Signed-off-by: Alagu Sankar --- drivers/net/wireless/ath/ath10k/htc.h | 1 + drivers/net/wireless/ath/ath10k/sdio.c | 122 - drivers/net/wireless/ath/ath10k/sdio.h | 5 +- 3 files changed, 93 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h index 24663b0..5d87908 100644 --- a/drivers/net/wireless/ath/ath10k/htc.h +++ b/drivers/net/wireless/ath/ath10k/htc.h @@ -58,6 +58,7 @@ enum ath10k_htc_tx_flags { }; enum ath10k_htc_rx_flags { + ATH10K_HTC_FLAGS_RECV_1MORE_BLOCK = 0x01, ATH10K_HTC_FLAG_TRAILER_PRESENT = 0x02, ATH10K_HTC_FLAG_BUNDLE_MASK = 0xF0 }; diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index bb6fa67..45df9db 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -35,6 +35,7 @@ #include "sdio.h" #define ATH10K_SDIO_DMA_BUF_SIZE (32 * 1024) +#define ATH10K_SDIO_VSG_BUF_SIZE (32 * 1024) static int ath10k_sdio_read(struct ath10k *ar, u32 addr, void *buf, u32 len, bool incr); @@ -430,6 +431,7 @@ static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar, int ret; payload_len = le16_to_cpu(htc_hdr->len); + skb->len = payload_len + sizeof(struct ath10k_htc_hdr); if (trailer_present) { trailer = skb->data + sizeof(*htc_hdr) + @@ -468,12 +470,13 @@ static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar, enum ath10k_htc_ep_id id; int ret, i, *n_lookahead_local; u32 *lookaheads_local; + int lookahd_idx = 0; I think the variable should be named *lookahead_idx* instead of *lookahd_idx*, since all other variables are using the string lookahead without abbreviations. for (i = 0; i < ar_sdio->n_rx_pkts; i++) { lookaheads_local = lookaheads; n_lookahead_local = n_lookahead; - id = ((struct ath10k_htc_hdr *)[i])->eid; + id = ((struct ath10k_htc_hdr *)[lookahd_idx++])->eid; if (id >= ATH10K_HTC_EP_COUNT) { ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n", @@ -496,6 +499,7 @@ static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar, /* Only read lookahead's from RX trailers * for the last packet in a bundle. */ + lookahd_idx--; lookaheads_local = NULL; n_lookahead_local = NULL; } @@ -529,11 +533,11 @@ static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar, return ret; } -static int ath10k_sdio_mbox_alloc_pkt_bundle(struct ath10k *ar, -struct ath10k_sdio_rx_data *rx_pkts, -struct ath10k_htc_hdr *htc_hdr, -size_t full_len, size_t act_len, -size_t *bndl_cnt) +static int ath10k_sdio_mbox_alloc_bundle(struct ath10k *ar, +struct ath10k_sdio_rx_data *rx_pkts, +struct ath10k_htc_hdr *htc_hdr, +size_t full_len, size_t act_len, +size_t *bndl_cnt) { int ret, i; @@ -574,6 +578,7 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar, size_t full_len, act_len; bool last_in_bundle; int ret, i; + int pkt_cnt = 0; if (n_lookaheads > ATH10K_SDIO_MAX_RX_MSGS) { ath10k_warn(ar, @@ -616,16 +621,22 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar, * optimally fetched as a full bundle. */ size_t bndl_cnt; - - ret = ath10k_sdio_mbox_alloc_pkt_bundle(ar, - _sdio->rx_pkts[i], - htc_hdr, - full_len, - act_len, - _cnt); - -
Re: [PATCH 1/3] wireless: iwlwifi: use bool instead of int
On Wed, 2017-10-04 at 10:55 -0700, Joe Perches wrote: > On Wed, 2017-10-04 at 19:39 +0300, Luciano Coelho wrote: > > On Wed, 2017-10-04 at 09:26 -0700, Joe Perches wrote: > > [] > > > This might be more intelligble as separate tests > > > > > > static bool is_valid_channel(u16 ch_id) > > > { > > > if (ch_id <= 14) > > > return true; > > > > > > if ((ch_id % 4 == 0) && > > > ((ch_id >= 36 && ch_id <= 64) || > > >(ch_id >= 100 && ch_id <= 140))) > > > return true; > > > > > > if ((ch_id % 4 == 1) && > > > (chid >= 145 && ch_id <= 165)) > > > return true; > > > > > > return false; > > > } > > > > > > The compiler should produce the same object code. > > > > Yeah, it may be a bit easier to read, but I don't want to start > > getting > > "fixes" to working and reasonable code. There's nothing wrong with > > the > > existing function (except maybe for the int vs. boolean) so let's > > not > > change it. > > > > A good time to change this would be the next time someone adds yet > > another range of valid channels here. ;) > > Your choice. > > I like code I can read and understand at a glance. I do too, but I don't think the original is that hard to read, really. Each "if" you add is already corresponding to one separate line in the original code... > At case somebody needs to add channels, likely nobody > would do the change suggested but would just add > another test to the already odd looking block. Yeah, that would most likely be the case, but if I saw that and thought there was a better way to write it, believe me, I would definitely nitpick the patch and ask the author to reorg the code so it would look nicer. > And constants should be on the right side of the tests. Sure, in a new patch, we would definitely pay attention to that. But now, is it worth having one more patch go through the entire machinery to change a relatively clear, extremely simple function just because you could write it in a different way? My answer is a resounding no, sorry. -- Luca.
[PATCH] mwifiex: Use put_unaligned_le32
Use put_unaligned_le32 rather than using byte ordering function and memcpy which makes code clear. Also, add the header file where it is declared. Done using Coccinelle and semantic patch used is : @ rule1 @ identifier tmp; expression ptr,x; type T; @@ - tmp = cpu_to_le32(x); <+... when != tmp - memcpy(ptr, (T), ...); + put_unaligned_le32(x,ptr); ...+> @ depends on rule1 @ type j; identifier tmp; @@ - j tmp; ...when != tmp Signed-off-by: Himanshu Jha--- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 0edc5d6..e28e119 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -17,6 +17,7 @@ * this warranty disclaimer. */ +#include #include "decl.h" #include "ioctl.h" #include "util.h" @@ -183,7 +184,6 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, uint16_t cmd_code; uint16_t cmd_size; unsigned long flags; - __le32 tmp; if (!adapter || !cmd_node) return -1; @@ -249,9 +249,9 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, mwifiex_dbg_dump(adapter, CMD_D, "cmd buffer:", host_cmd, cmd_size); if (adapter->iface_type == MWIFIEX_USB) { - tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD); skb_push(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN); - memcpy(cmd_node->cmd_skb->data, , MWIFIEX_TYPE_LEN); + put_unaligned_le32(MWIFIEX_USB_TYPE_CMD, + cmd_node->cmd_skb->data); adapter->cmd_sent = true; ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_CMD_EVENT, @@ -317,7 +317,6 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) (struct mwifiex_opt_sleep_confirm *) adapter->sleep_cfm->data; struct sk_buff *sleep_cfm_tmp; - __le32 tmp; priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); @@ -342,8 +341,7 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) + MWIFIEX_TYPE_LEN); skb_put(sleep_cfm_tmp, sizeof(struct mwifiex_opt_sleep_confirm) + MWIFIEX_TYPE_LEN); - tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD); - memcpy(sleep_cfm_tmp->data, , MWIFIEX_TYPE_LEN); + put_unaligned_le32(MWIFIEX_USB_TYPE_CMD, sleep_cfm_tmp->data); memcpy(sleep_cfm_tmp->data + MWIFIEX_TYPE_LEN, adapter->sleep_cfm->data, sizeof(struct mwifiex_opt_sleep_confirm)); -- 2.7.4
Re: [PATCH 1/3] wireless: iwlwifi: use bool instead of int
On Wed, 2017-10-04 at 19:39 +0300, Luciano Coelho wrote: > On Wed, 2017-10-04 at 09:26 -0700, Joe Perches wrote: [] > > This might be more intelligble as separate tests > > > > static bool is_valid_channel(u16 ch_id) > > { > > if (ch_id <= 14) > > return true; > > > > if ((ch_id % 4 == 0) && > > ((ch_id >= 36 && ch_id <= 64) || > > (ch_id >= 100 && ch_id <= 140))) > > return true; > > > > if ((ch_id % 4 == 1) && > > (chid >= 145 && ch_id <= 165)) > > return true; > > > > return false; > > } > > > > The compiler should produce the same object code. > > Yeah, it may be a bit easier to read, but I don't want to start getting > "fixes" to working and reasonable code. There's nothing wrong with the > existing function (except maybe for the int vs. boolean) so let's not > change it. > > A good time to change this would be the next time someone adds yet > another range of valid channels here. ;) Your choice. I like code I can read and understand at a glance. At case somebody needs to add channels, likely nobody would do the change suggested but would just add another test to the already odd looking block. And constants should be on the right side of the tests.
Re: [PATCH 1/3] wireless: iwlwifi: use bool instead of int
On Wed, 2017-10-04 at 09:26 -0700, Joe Perches wrote: > On Wed, 2017-10-04 at 17:56 +0200, Christoph Böhmwalder wrote: > > Change a usage of int in a boolean context to use the bool type > > instead, as it > > makes the intent of the function clearer and helps clarify its > > semantics. > > > > Also eliminate the if/else and just return the boolean result > > directly, > > making the code more readable. > > > > Signed-off-by: Christoph Böhmwalder> > --- > > drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 12 +--- > > 1 file changed, 5 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > > b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > > index b7cd813ba70f..0eb815ae97e8 100644 > > --- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > > +++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > > @@ -267,14 +267,12 @@ int iwl_phy_db_set_section(struct iwl_phy_db > > *phy_db, > > } > > IWL_EXPORT_SYMBOL(iwl_phy_db_set_section); > > > > -static int is_valid_channel(u16 ch_id) > > +static bool is_valid_channel(u16 ch_id) > > { > > - if (ch_id <= 14 || > > - (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || > > - (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || > > - (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)) > > - return 1; > > - return 0; > > + return (ch_id <= 14 || > > + (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || > > + (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || > > + (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)); > > } > > This might be more intelligble as separate tests > > static bool is_valid_channel(u16 ch_id) > { > if (ch_id <= 14) > return true; > > if ((ch_id % 4 == 0) && > ((ch_id >= 36 && ch_id <= 64) || >(ch_id >= 100 && ch_id <= 140))) > return true; > > if ((ch_id % 4 == 1) && > (chid >= 145 && ch_id <= 165)) > return true; > > return false; > } > > The compiler should produce the same object code. Yeah, it may be a bit easier to read, but I don't want to start getting "fixes" to working and reasonable code. There's nothing wrong with the existing function (except maybe for the int vs. boolean) so let's not change it. A good time to change this would be the next time someone adds yet another range of valid channels here. ;) -- Luca.
Re: QCA988x and kernel 4.13
Am 04.10.2017 um 17:13 schrieb Ben Greear: On 10/04/2017 01:50 AM, Kalle Valo wrote: Ben Greearwrites: On 10/01/2017 07:06 AM, Sebastian Gottschall wrote: you have to update to the latest mac80211 code. there is a well known bug in mac80211 which causes a deadlock with ath10k Do you have a pointer to the patch that fixes this? I'd like to check if it has made it into 4.13 stable yet... I think it's this one: mac80211: fix deadlock in driver-managed RX BA session start https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bde59c475e0883e4c4294bcd9b9c7e08ae18c828 Adding linux-wireless so that someone can correct me in case I'm wrong. That did seem to fix my problems... Thanks, ben consider that this bug does at least exist since may. so older kernels might be affected too -- Mit freundlichen Grüssen / Regards Sebastian Gottschall / CTO NewMedia-NET GmbH - DD-WRT Firmensitz: Stubenwaldallee 21a, 64625 Bensheim Registergericht: Amtsgericht Darmstadt, HRB 25473 Geschäftsführer: Peter Steinhäuser, Christian Scheele http://www.dd-wrt.com email: s.gottsch...@dd-wrt.com Tel.: +496251-582650 / Fax: +496251-5826565
Re: [PATCH 1/3] wireless: iwlwifi: use bool instead of int
On Wed, 2017-10-04 at 17:56 +0200, Christoph Böhmwalder wrote: > Change a usage of int in a boolean context to use the bool type instead, as it > makes the intent of the function clearer and helps clarify its semantics. > > Also eliminate the if/else and just return the boolean result directly, > making the code more readable. > > Signed-off-by: Christoph Böhmwalder> --- > drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 12 +--- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > index b7cd813ba70f..0eb815ae97e8 100644 > --- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > +++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > @@ -267,14 +267,12 @@ int iwl_phy_db_set_section(struct iwl_phy_db *phy_db, > } > IWL_EXPORT_SYMBOL(iwl_phy_db_set_section); > > -static int is_valid_channel(u16 ch_id) > +static bool is_valid_channel(u16 ch_id) > { > - if (ch_id <= 14 || > - (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || > - (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || > - (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)) > - return 1; > - return 0; > + return (ch_id <= 14 || > +(36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || > +(100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || > +(145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)); > } This might be more intelligble as separate tests static bool is_valid_channel(u16 ch_id) { if (ch_id <= 14) return true; if ((ch_id % 4 == 0) && ((ch_id >= 36 && ch_id <= 64) || (ch_id >= 100 && ch_id <= 140))) return true; if ((ch_id % 4 == 1) && (chid >= 145 && ch_id <= 165)) return true; return false; } The compiler should produce the same object code.
Re: [PATCH 0/3] iwlwifi: cosmetic fixes
On Wed, 2017-10-04 at 17:56 +0200, Christoph Böhmwalder wrote: > Fix several code style issues, some of which were reported by > checkpatch.pl. > > The changes are: > * One instance of an `int` variable being used in a boolean context, > chaned to > use the more appropriate `bool` type. > * One very minor fix, removing a newline between a function > definition and its > associated `static` keyword > * One fix wrapping a macro in curly braces > > > Christoph Böhmwalder (3): > wireless: iwlwifi: use bool instead of int > wireless: iwlwifi: function definition cosmetic fix > wireless: iwlwifi: wrap macro into braces > > drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- > drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 16 +++-- > --- > 2 files changed, 8 insertions(+), 10 deletions(-) Sorry, but this kind of series just generates churn. Especially when 2 out of 3 patches are broken. I applied your previous patch because it was really trivial, but I really don't want to encourage this kind of drive-by "fixes" that only cause additional work. I generally only accept this kind of changes when people are changing code close or related to it. -- Luca.
Re: [PATCH 1/3] wireless: iwlwifi: use bool instead of int
On Wed, 2017-10-04 at 17:56 +0200, Christoph Böhmwalder wrote: > Change a usage of int in a boolean context to use the bool type > instead, as it > makes the intent of the function clearer and helps clarify its > semantics. > > Also eliminate the if/else and just return the boolean result > directly, > making the code more readable. > > Signed-off-by: Christoph Böhmwalder> --- > drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 12 +--- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > index b7cd813ba70f..0eb815ae97e8 100644 > --- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > +++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > @@ -267,14 +267,12 @@ int iwl_phy_db_set_section(struct iwl_phy_db > *phy_db, > } > IWL_EXPORT_SYMBOL(iwl_phy_db_set_section); > > -static int is_valid_channel(u16 ch_id) > +static bool is_valid_channel(u16 ch_id) > { > - if (ch_id <= 14 || > - (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || > - (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || > - (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)) > - return 1; > - return 0; > + return (ch_id <= 14 || > +(36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || > +(100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || > +(145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)); > } > > static u8 ch_id_to_ch_index(u16 ch_id) This actually makes some sense, and I would probably apply it if it were part of a patchset that actually does something useful. -- Luca.
Re: [PATCH 3/3] wireless: iwlwifi: wrap macro into braces
On Wed, 2017-10-04 at 17:57 +0200, Christoph Böhmwalder wrote: > Macros should always be wrapped in braces, so fix this instance. > > Signed-off-by: Christoph Böhmwalder> --- > drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.c > b/drivers/net/wireless/intel/iwlwifi/iwl-io.c > index efb1998dcabd..0211963b3e71 100644 > --- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c > +++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c > @@ -252,7 +252,7 @@ IWL_EXPORT_SYMBOL(iwl_force_nmi); > > static const char *get_rfh_string(int cmd) > { > -#define IWL_CMD(x) case x: return #x > +#define IWL_CMD(x) { case x: return #x; } I think this unnecessary. Maybe: http://lists.infradead.org/pipermail/ath10k/2017-February/009335.html > #define IWL_CMD_MQ(arg, reg, q) { if (arg == reg(q)) return #reg; } But this should use do { ... } while (0)
Re: [PATCH 2/3] wireless: iwlwifi: function definition cosmetic fix
On Wed, 2017-10-04 at 17:56 +0200, Christoph Böhmwalder wrote: > Separate the function from the previous definition with a newline and > put the `static` keyword on the same line, as it just looks nicer. > > Signed-off-by: Christoph Böhmwalder> --- > drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > index 0eb815ae97e8..249ee1c7b02f 100644 > --- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > +++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c > @@ -325,8 +325,8 @@ static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, > u16 ch_id) > } > return 0xff; > } > -static > -int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db, > + > +static int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db, > u32 type, u8 **data, u16 *size, u16 ch_id) > { > struct iwl_phy_db_entry *entry; Sorry, but this now looks much uglier because the second line is not even aligned to the parenthesis. NACK. -- Luca.
Re: [PATCH 3/3] wireless: iwlwifi: wrap macro into braces
Please don't send obviously broken patches. johannes
[PATCH 0/3] iwlwifi: cosmetic fixes
Fix several code style issues, some of which were reported by checkpatch.pl. The changes are: * One instance of an `int` variable being used in a boolean context, chaned to use the more appropriate `bool` type. * One very minor fix, removing a newline between a function definition and its associated `static` keyword * One fix wrapping a macro in curly braces Christoph Böhmwalder (3): wireless: iwlwifi: use bool instead of int wireless: iwlwifi: function definition cosmetic fix wireless: iwlwifi: wrap macro into braces drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 16 +++- 2 files changed, 8 insertions(+), 10 deletions(-) -- 2.13.5
[PATCH 2/3] wireless: iwlwifi: function definition cosmetic fix
Separate the function from the previous definition with a newline and put the `static` keyword on the same line, as it just looks nicer. Signed-off-by: Christoph Böhmwalder--- drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c index 0eb815ae97e8..249ee1c7b02f 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c @@ -325,8 +325,8 @@ static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, u16 ch_id) } return 0xff; } -static -int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db, + +static int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db, u32 type, u8 **data, u16 *size, u16 ch_id) { struct iwl_phy_db_entry *entry; -- 2.13.5
[PATCH 1/3] wireless: iwlwifi: use bool instead of int
Change a usage of int in a boolean context to use the bool type instead, as it makes the intent of the function clearer and helps clarify its semantics. Also eliminate the if/else and just return the boolean result directly, making the code more readable. Signed-off-by: Christoph Böhmwalder--- drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c index b7cd813ba70f..0eb815ae97e8 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c @@ -267,14 +267,12 @@ int iwl_phy_db_set_section(struct iwl_phy_db *phy_db, } IWL_EXPORT_SYMBOL(iwl_phy_db_set_section); -static int is_valid_channel(u16 ch_id) +static bool is_valid_channel(u16 ch_id) { - if (ch_id <= 14 || - (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || - (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || - (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)) - return 1; - return 0; + return (ch_id <= 14 || + (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || + (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || + (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)); } static u8 ch_id_to_ch_index(u16 ch_id) -- 2.13.5
[PATCH 3/3] wireless: iwlwifi: wrap macro into braces
Macros should always be wrapped in braces, so fix this instance. Signed-off-by: Christoph Böhmwalder--- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.c b/drivers/net/wireless/intel/iwlwifi/iwl-io.c index efb1998dcabd..0211963b3e71 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c @@ -252,7 +252,7 @@ IWL_EXPORT_SYMBOL(iwl_force_nmi); static const char *get_rfh_string(int cmd) { -#define IWL_CMD(x) case x: return #x +#define IWL_CMD(x) { case x: return #x; } #define IWL_CMD_MQ(arg, reg, q) { if (arg == reg(q)) return #reg; } int i; -- 2.13.5
Re: [PATCH 00/11] SDIO support for ath10k
On 2017-10-04 08:22, Alagu Sankar wrote: Hi Erik, We will work to have this support mainlined as soon as possible. Would appreciate your support in making sure that the patches do not affect the USB high latency path. I have added the patches in my own ath-repo and I have tested with the WUSB6100M without any problems. On 02-10-2017 14:32, Erik Stromdahl wrote: Hi Alagu, It is great to see that we are finally about have fully working mainline support for QCA9377 SDIO chipsets! Great job! On 2017-09-30 19:37, silexcom...@gmail.com wrote: From: Alagu SankarThis patchset, generated against master-pending branch, enables a fully functional SDIO interface driver for ath10k. Patches have been verified on QCA9377-3 WB396 and Silex's SX-SDCAC reference cards with Station, Access Point and P2P modes. The driver is verified with the firmware WLAN.TF.1.1.1-00061-QCATFSWPZ-1 with the board data from respective SDIO card vendors. Receive performance matches the QCA reference driver when used with SDIO3.0 enabled platforms. iperf tests indicate a downlink UDP of 275Mbit/s and TCP of 150Mbit/s Can you share any scripts etc. (wrapping hostapd and wpa_supplicant stuff) or provide some more info about you test setup? I am not using any specific scripts for this. The standard ones from the ath10k configuration page https://wireless.wiki.kernel.org/en/users/drivers/ath10k/configuration works just fine with the NL80211 path. I made a quick socat based test on an old laptop (I don't think it has SDIO 3.0 support) and I did unfortunately not get the same figures as you did :( If it is SDIO v1.x, then the max bus speed is only 100Mbit/s. With v2.x it is 200Mbit/s and 3.x it is 832 Mbit/s. Throughput primarily depends on it. We used i.MX6 SoloX Sabre SDB platform which supports SDIO3.x and could see the maximum performance. This patchset differs from the previous high latency patches, specific to SDIO. HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET is enabled for HI_ACS. This instructs the firmware to use HTT_T2H_MSG_TYPE_TX_COMPL_IND for outgoing packets. Without this flag, the management frames are not sent out by the firmware. Possibility of management frames being sent via WMI and data frames through the reduced Tx completion needs to be probed further. Ah, so that explains why I couldn't see any messages in the air. Further improvements can be done on the transmit path by implementing packet bundle. Scatter Gather is another area of improvement for both Transmit and Receive, but may not work on all platforms Known issues: Surprise removal of the card, when the device is in connected state, delays sdio function remove due to delayed WMI command failures. Existing ath10k framework can not differentiate between a kernel module removal and the surprise removal of teh card. Alagu Sankar (11): ath10k_sdio: sdio htt data transfer fixes ath10k_sdio: wb396 reference card fix ath10k_sdio: DMA bounce buffers for read write ath10k_sdio: reduce transmit msdu count ath10k_sdio: use clean packet headers ath10k_sdio: high latency fixes for beacon buffer ath10k_sdio: fix rssi indication ath10k_sdio: common read write ath10k_sdio: virtual scatter gather for receive ath10k_sdio: enable firmware crash dump ath10k_sdio: hif start once addition drivers/net/wireless/ath/ath10k/core.c | 35 ++- drivers/net/wireless/ath/ath10k/debug.c | 3 + drivers/net/wireless/ath/ath10k/htc.c | 4 +- drivers/net/wireless/ath/ath10k/htc.h | 1 + drivers/net/wireless/ath/ath10k/htt_rx.c | 19 +- drivers/net/wireless/ath/ath10k/htt_tx.c | 24 +- drivers/net/wireless/ath/ath10k/hw.c | 2 + drivers/net/wireless/ath/ath10k/hw.h | 1 + drivers/net/wireless/ath/ath10k/mac.c | 31 ++- drivers/net/wireless/ath/ath10k/sdio.c | 398 ++ drivers/net/wireless/ath/ath10k/sdio.h | 10 +- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 +- 12 files changed, 403 insertions(+), 127 deletions(-)
Re: QCA988x and kernel 4.13
On 10/04/2017 01:50 AM, Kalle Valo wrote: Ben Greearwrites: On 10/01/2017 07:06 AM, Sebastian Gottschall wrote: you have to update to the latest mac80211 code. there is a well known bug in mac80211 which causes a deadlock with ath10k Do you have a pointer to the patch that fixes this? I'd like to check if it has made it into 4.13 stable yet... I think it's this one: mac80211: fix deadlock in driver-managed RX BA session start https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bde59c475e0883e4c4294bcd9b9c7e08ae18c828 Adding linux-wireless so that someone can correct me in case I'm wrong. That did seem to fix my problems... Thanks, ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com
[PATCH] mwifiex: double the size of chan_stats array in adapter
From: Rohit FuleWhen a user requests scan, driver sends multiple scan requests to firmware, which might be active or passive. Firmware will send channel statistics for each channel in the request. This will be stored in chan_stats array. Few channels might report hidden SSIDs in passive scan results. So, once the original scan request is finished, driver issues an active scan request for all channels which reported hidden SSIDs. This will cause duplicates in the chan_stats array. At worst, every channel will have a hidden SSID, in which case the driver can issue active scan requests for each channel. So the complete scan statistics size will be twice of existing limit. At present maximum number of channels returned in scan statistics is 31(BG) + 14(A) = 45. Clearly there will be an overflow of the chan_stats array in the above mentioned scenario. To fix this double the size of chan_stats array. Signed-off-by: Rohit Fule Signed-off-by: Mangesh Malusare Signed-off-by: Ganapathi Bhat --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index ac01af4..f33ed79 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4201,7 +4201,10 @@ int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter) if (adapter->config_bands & BAND_A) n_channels_a = mwifiex_band_5ghz.n_channels; - adapter->num_in_chan_stats = n_channels_bg + n_channels_a; + /* allocate twice the number total channels, since the driver issues an +* additional active scan request for hidden SSIDs on passive channels. +*/ + adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a); adapter->chan_stats = vmalloc(sizeof(*adapter->chan_stats) * adapter->num_in_chan_stats); -- 1.9.1
Re: QCA988x and kernel 4.13
Am 04.10.2017 um 10:50 schrieb Kalle Valo: Ben Greearwrites: On 10/01/2017 07:06 AM, Sebastian Gottschall wrote: you have to update to the latest mac80211 code. there is a well known bug in mac80211 which causes a deadlock with ath10k Do you have a pointer to the patch that fixes this? I'd like to check if it has made it into 4.13 stable yet... I think it's this one: mac80211: fix deadlock in driver-managed RX BA session start https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bde59c475e0883e4c4294bcd9b9c7e08ae18c828 Adding linux-wireless so that someone can correct me in case I'm wrong. i believe thats the correct one -- Mit freundlichen Grüssen / Regards Sebastian Gottschall / CTO NewMedia-NET GmbH - DD-WRT Firmensitz: Stubenwaldallee 21a, 64625 Bensheim Registergericht: Amtsgericht Darmstadt, HRB 25473 Geschäftsführer: Peter Steinhäuser, Christian Scheele http://www.dd-wrt.com email: s.gottsch...@dd-wrt.com Tel.: +496251-582650 / Fax: +496251-5826565
Re: [PATCH v3 1/2] dt-bindings: add device tree binding for Allwinner XR819 SDIO Wi-Fi
于 2017年10月4日 GMT+08:00 下午6:11:45, Maxime Ripard写到: >On Wed, Oct 04, 2017 at 10:02:48AM +, Arend van Spriel wrote: >> On 10/4/2017 11:03 AM, Icenowy Zheng wrote: >> > >> > >> > 于 2017年10月4日 GMT+08:00 下午5:02:17, Kalle Valo >写到: >> > > Icenowy Zheng writes: >> > > >> > > > Allwinner XR819 is a SDIO Wi-Fi chip, which has the >functionality to >> > > use >> > > > an out-of-band interrupt pin instead of SDIO in-band interrupt. >> > > > >> > > > Add the device tree binding of this chip, in order to make it >> > > possible >> > > > to add this interrupt pin to device trees. >> > > > >> > > > Signed-off-by: Icenowy Zheng >> > > > Acked-by: Rob Herring >> > > > --- >> > > > Changes in v3: >> > > > - Renames the node name. >> > > > - Adds ACK from Rob. >> > > > Changes in v2: >> > > > - Removed status property in example. >> > > > - Added required property reg. >> > > > >> > > > .../bindings/net/wireless/allwinner,xr819.txt | 38 >> > > ++ >> > > > 1 file changed, 38 insertions(+) >> > > > create mode 100644 >> > > >Documentation/devicetree/bindings/net/wireless/allwinner,xr819.txt >> > > >> > > Like I asked already last time, AFAICS there is no upstream xr819 >> > > wireless driver in drivers/net/wireless directory. Do we still >accept >> > > bindings like this for out-of-tree drivers? >> > >> > See esp8089. >> > >> > There's also no in-tree driver for it. >> >> The question is whether we should. The above might be a precedent, >but it >> may not necessarily be the way to go. The commit message for esp8089 >seems >> to hint that there is intent to have an in-tree driver: >> >> """ >> Note that at this point there only is an out of tree driver for >this >> hardware, there is no clear timeline / path for merging this. >Still >> I believe it would be good to specify the binding for this in >tree >> now, so that any future migration to an in tree driver will not >cause >> compatiblity issues. >> >> Cc: Icenowy Zheng >> Signed-off-by: Hans de Goede >> Signed-off-by: Rob Herring >> """ >> >> Regardless the bindings are in principle independent of the kernel >and just >> describing hardware. I think there have been discussions to move the >> bindings to their own repository, but apparently it was decided >otherwise. > >Yeah, I guess especially how it could be merged with the cw1200 driver >would be very relevant to that commit log. The cw1200 driver seems to still have some legacy platform data. Maybe they should also be convert to DT. (Or maybe compatible = "allwinner,xr819" is enough, as xr819 is a specified variant of cw1200 family) > >Maxime
Re: [PATCH v3 1/2] dt-bindings: add device tree binding for Allwinner XR819 SDIO Wi-Fi
On Wed, Oct 04, 2017 at 10:02:48AM +, Arend van Spriel wrote: > On 10/4/2017 11:03 AM, Icenowy Zheng wrote: > > > > > > 于 2017年10月4日 GMT+08:00 下午5:02:17, Kalle Valo写到: > > > Icenowy Zheng writes: > > > > > > > Allwinner XR819 is a SDIO Wi-Fi chip, which has the functionality to > > > use > > > > an out-of-band interrupt pin instead of SDIO in-band interrupt. > > > > > > > > Add the device tree binding of this chip, in order to make it > > > possible > > > > to add this interrupt pin to device trees. > > > > > > > > Signed-off-by: Icenowy Zheng > > > > Acked-by: Rob Herring > > > > --- > > > > Changes in v3: > > > > - Renames the node name. > > > > - Adds ACK from Rob. > > > > Changes in v2: > > > > - Removed status property in example. > > > > - Added required property reg. > > > > > > > > .../bindings/net/wireless/allwinner,xr819.txt | 38 > > > ++ > > > > 1 file changed, 38 insertions(+) > > > > create mode 100644 > > > Documentation/devicetree/bindings/net/wireless/allwinner,xr819.txt > > > > > > Like I asked already last time, AFAICS there is no upstream xr819 > > > wireless driver in drivers/net/wireless directory. Do we still accept > > > bindings like this for out-of-tree drivers? > > > > See esp8089. > > > > There's also no in-tree driver for it. > > The question is whether we should. The above might be a precedent, but it > may not necessarily be the way to go. The commit message for esp8089 seems > to hint that there is intent to have an in-tree driver: > > """ > Note that at this point there only is an out of tree driver for this > hardware, there is no clear timeline / path for merging this. Still > I believe it would be good to specify the binding for this in tree > now, so that any future migration to an in tree driver will not cause > compatiblity issues. > > Cc: Icenowy Zheng > Signed-off-by: Hans de Goede > Signed-off-by: Rob Herring > """ > > Regardless the bindings are in principle independent of the kernel and just > describing hardware. I think there have been discussions to move the > bindings to their own repository, but apparently it was decided otherwise. Yeah, I guess especially how it could be merged with the cw1200 driver would be very relevant to that commit log. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature
Re: [PATCH v3 1/2] dt-bindings: add device tree binding for Allwinner XR819 SDIO Wi-Fi
On 10/4/2017 11:03 AM, Icenowy Zheng wrote: 于 2017年10月4日 GMT+08:00 下午5:02:17, Kalle Valo写到: Icenowy Zheng writes: Allwinner XR819 is a SDIO Wi-Fi chip, which has the functionality to use an out-of-band interrupt pin instead of SDIO in-band interrupt. Add the device tree binding of this chip, in order to make it possible to add this interrupt pin to device trees. Signed-off-by: Icenowy Zheng Acked-by: Rob Herring --- Changes in v3: - Renames the node name. - Adds ACK from Rob. Changes in v2: - Removed status property in example. - Added required property reg. .../bindings/net/wireless/allwinner,xr819.txt | 38 ++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/allwinner,xr819.txt Like I asked already last time, AFAICS there is no upstream xr819 wireless driver in drivers/net/wireless directory. Do we still accept bindings like this for out-of-tree drivers? See esp8089. There's also no in-tree driver for it. The question is whether we should. The above might be a precedent, but it may not necessarily be the way to go. The commit message for esp8089 seems to hint that there is intent to have an in-tree driver: """ Note that at this point there only is an out of tree driver for this hardware, there is no clear timeline / path for merging this. Still I believe it would be good to specify the binding for this in tree now, so that any future migration to an in tree driver will not cause compatiblity issues. Cc: Icenowy Zheng Signed-off-by: Hans de Goede Signed-off-by: Rob Herring """ Regardless the bindings are in principle independent of the kernel and just describing hardware. I think there have been discussions to move the bindings to their own repository, but apparently it was decided otherwise. Regards, Arend
Re: [PATCH 08/11] ath10k_sdio: common read write
silexcom...@gmail.com writes: > From: Alagu Sankar> > convert different read write functions in sdio hif to bring it under a > single read-write path. This helps in having a common dma bounce buffer > implementation. Also helps in address modification that is required > specific to change in certain mbox addresses of sdio_write. > > Signed-off-by: Alagu Sankar This didn't compile for me: drivers/net/wireless/ath/ath10k/sdio.c:320:12: error: conflicting types for 'ath10k_sdio_read' drivers/net/wireless/ath/ath10k/sdio.c:39:12: note: previous declaration of 'ath10k_sdio_read' was here drivers/net/wireless/ath/ath10k/sdio.c:365:12: error: conflicting types for 'ath10k_sdio_write' drivers/net/wireless/ath/ath10k/sdio.c:41:12: note: previous declaration of 'ath10k_sdio_write' was here drivers/net/wireless/ath/ath10k/sdio.c:39:12: warning: 'ath10k_sdio_read' used but never defined drivers/net/wireless/ath/ath10k/sdio.c:41:12: warning: 'ath10k_sdio_write' used but never defined gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 I fixed it like below in the pending branch. But I'll review more carefully later, I have quite a lot of patches pending right now. --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -37,9 +37,9 @@ #define ATH10K_SDIO_DMA_BUF_SIZE (32 * 1024) static int ath10k_sdio_read(struct ath10k *ar, u32 addr, void *buf, - u32 len, bool incr); + size_t len, bool incr); static int ath10k_sdio_write(struct ath10k *ar, u32 addr, const void *buf, -u32 len, bool incr); +size_t len, bool incr); /* inlined helper functions */ -- Kalle Valo
Re: ath9k: make const array reg_hole_list static, reduces object code size
Colin Ian Kingwrote: > Don't populate the read-only array reg_hole_list on the stack, instead make > it static. Makes the object code smaller by over 200 bytes: > > Before: >text data bss dec hex filename > 57518 15248 0 72766 11c3e debug.o > > After: >text data bss dec hex filename > 57218 15344 0 72562 11b72 debug.o > > Signed-off-by: Colin Ian King > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. eba0f28473b2 ath9k: make const array reg_hole_list static, reduces object code size -- https://patchwork.kernel.org/patch/9960183/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH v3 1/2] dt-bindings: add device tree binding for Allwinner XR819 SDIO Wi-Fi
于 2017年10月4日 GMT+08:00 下午5:02:17, Kalle Valo写到: >Icenowy Zheng writes: > >> Allwinner XR819 is a SDIO Wi-Fi chip, which has the functionality to >use >> an out-of-band interrupt pin instead of SDIO in-band interrupt. >> >> Add the device tree binding of this chip, in order to make it >possible >> to add this interrupt pin to device trees. >> >> Signed-off-by: Icenowy Zheng >> Acked-by: Rob Herring >> --- >> Changes in v3: >> - Renames the node name. >> - Adds ACK from Rob. >> Changes in v2: >> - Removed status property in example. >> - Added required property reg. >> >> .../bindings/net/wireless/allwinner,xr819.txt | 38 >++ >> 1 file changed, 38 insertions(+) >> create mode 100644 >Documentation/devicetree/bindings/net/wireless/allwinner,xr819.txt > >Like I asked already last time, AFAICS there is no upstream xr819 >wireless driver in drivers/net/wireless directory. Do we still accept >bindings like this for out-of-tree drivers? See esp8089. There's also no in-tree driver for it.
Re: [PATCH v3 1/2] dt-bindings: add device tree binding for Allwinner XR819 SDIO Wi-Fi
Icenowy Zhengwrites: > Allwinner XR819 is a SDIO Wi-Fi chip, which has the functionality to use > an out-of-band interrupt pin instead of SDIO in-band interrupt. > > Add the device tree binding of this chip, in order to make it possible > to add this interrupt pin to device trees. > > Signed-off-by: Icenowy Zheng > Acked-by: Rob Herring > --- > Changes in v3: > - Renames the node name. > - Adds ACK from Rob. > Changes in v2: > - Removed status property in example. > - Added required property reg. > > .../bindings/net/wireless/allwinner,xr819.txt | 38 > ++ > 1 file changed, 38 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/net/wireless/allwinner,xr819.txt Like I asked already last time, AFAICS there is no upstream xr819 wireless driver in drivers/net/wireless directory. Do we still accept bindings like this for out-of-tree drivers? -- Kalle Valo
Re: [PATCH 01/11] ath10k_sdio: sdio htt data transfer fixes
Arend van Sprielwrites: > On 9/30/2017 7:37 PM, silexcom...@gmail.com wrote: >> From: Alagu Sankar >> > > [...] > >> >> Signed-off-by: Alagu Sankar > > Not really have a specific remark for this patch, but for the entire > series. These patches are sent using an anonymous email address, apart > from 'silex' being in there, which does not show up in the certificate > of origin. Just wondering if this is acceptable? As long as there's the "correct" From header as the first line in the commit log, which git then uses as the author instead of the From line from email header. And I see Alagu doing that here so there shouldn't be any problems. -- Kalle Valo
Re: QCA988x and kernel 4.13
Ben Greearwrites: > On 10/01/2017 07:06 AM, Sebastian Gottschall wrote: >> you have to update to the latest mac80211 code. there is a well >> known bug in mac80211 which causes a deadlock with ath10k > > Do you have a pointer to the patch that fixes this? I'd like to check if it > has > made it into 4.13 stable yet... I think it's this one: mac80211: fix deadlock in driver-managed RX BA session start https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bde59c475e0883e4c4294bcd9b9c7e08ae18c828 Adding linux-wireless so that someone can correct me in case I'm wrong. -- Kalle Valo
Re: [PATCH 0/3] linux-firmware: ath10k update 20170918
Kalle Valowrites: > Few firmware fixes to user reported issues for ath10k, but the other "fix" > being a revert back to older firmware. Also a small board-2.bin update. > > Kalle Valo (3): > ath10k: QCA6174 hw3.0: update firmware-6.bin to > WLAN.RM.4.4.1-00051-QCARMSWP-1 > ath10k: QCA6174 hw3.0: update board-2.bin > Revert "ath10k: QCA988X hw2.0: update firmware to 10.2.4.70.63-2" > > WHENCE| 4 +- > ath10k/QCA6174/hw3.0/board-2.bin | Bin 477060 -> 501748 > bytes > ath10k/QCA6174/hw3.0/firmware-6.bin | Bin 711408 -> 727776 > bytes > ath10k/QCA6174/hw3.0/notice_ath10k_firmware-6.txt | 97 > +- > ath10k/QCA988X/hw2.0/firmware-5.bin | Bin 249384 -> 248188 > bytes > 5 files changed, 25 insertions(+), 76 deletions(-) Ping? These fix serious regressions reported by many so it would be really good to get these to linux-firmware soon. -- Kalle Valo
Re: [PATCH 00/11] SDIO support for ath10k
Hi Erik, We will work to have this support mainlined as soon as possible. Would appreciate your support in making sure that the patches do not affect the USB high latency path. On 02-10-2017 14:32, Erik Stromdahl wrote: Hi Alagu, It is great to see that we are finally about have fully working mainline support for QCA9377 SDIO chipsets! Great job! On 2017-09-30 19:37, silexcom...@gmail.com wrote: From: Alagu SankarThis patchset, generated against master-pending branch, enables a fully functional SDIO interface driver for ath10k. Patches have been verified on QCA9377-3 WB396 and Silex's SX-SDCAC reference cards with Station, Access Point and P2P modes. The driver is verified with the firmware WLAN.TF.1.1.1-00061-QCATFSWPZ-1 with the board data from respective SDIO card vendors. Receive performance matches the QCA reference driver when used with SDIO3.0 enabled platforms. iperf tests indicate a downlink UDP of 275Mbit/s and TCP of 150Mbit/s Can you share any scripts etc. (wrapping hostapd and wpa_supplicant stuff) or provide some more info about you test setup? I am not using any specific scripts for this. The standard ones from the ath10k configuration page https://wireless.wiki.kernel.org/en/users/drivers/ath10k/configuration works just fine with the NL80211 path. I made a quick socat based test on an old laptop (I don't think it has SDIO 3.0 support) and I did unfortunately not get the same figures as you did :( If it is SDIO v1.x, then the max bus speed is only 100Mbit/s. With v2.x it is 200Mbit/s and 3.x it is 832 Mbit/s. Throughput primarily depends on it. We used i.MX6 SoloX Sabre SDB platform which supports SDIO3.x and could see the maximum performance. This patchset differs from the previous high latency patches, specific to SDIO. HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET is enabled for HI_ACS. This instructs the firmware to use HTT_T2H_MSG_TYPE_TX_COMPL_IND for outgoing packets. Without this flag, the management frames are not sent out by the firmware. Possibility of management frames being sent via WMI and data frames through the reduced Tx completion needs to be probed further. Ah, so that explains why I couldn't see any messages in the air. Further improvements can be done on the transmit path by implementing packet bundle. Scatter Gather is another area of improvement for both Transmit and Receive, but may not work on all platforms Known issues: Surprise removal of the card, when the device is in connected state, delays sdio function remove due to delayed WMI command failures. Existing ath10k framework can not differentiate between a kernel module removal and the surprise removal of teh card. Alagu Sankar (11): ath10k_sdio: sdio htt data transfer fixes ath10k_sdio: wb396 reference card fix ath10k_sdio: DMA bounce buffers for read write ath10k_sdio: reduce transmit msdu count ath10k_sdio: use clean packet headers ath10k_sdio: high latency fixes for beacon buffer ath10k_sdio: fix rssi indication ath10k_sdio: common read write ath10k_sdio: virtual scatter gather for receive ath10k_sdio: enable firmware crash dump ath10k_sdio: hif start once addition drivers/net/wireless/ath/ath10k/core.c| 35 ++- drivers/net/wireless/ath/ath10k/debug.c | 3 + drivers/net/wireless/ath/ath10k/htc.c | 4 +- drivers/net/wireless/ath/ath10k/htc.h | 1 + drivers/net/wireless/ath/ath10k/htt_rx.c | 19 +- drivers/net/wireless/ath/ath10k/htt_tx.c | 24 +- drivers/net/wireless/ath/ath10k/hw.c | 2 + drivers/net/wireless/ath/ath10k/hw.h | 1 + drivers/net/wireless/ath/ath10k/mac.c | 31 ++- drivers/net/wireless/ath/ath10k/sdio.c| 398 ++ drivers/net/wireless/ath/ath10k/sdio.h| 10 +- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 +- 12 files changed, 403 insertions(+), 127 deletions(-)