1. 29 12月, 2016 2 次提交
  2. 15 12月, 2016 10 次提交
    • M
      ath10k: Avoid potential page alloc BUG_ON in tx free path · 02a9e08d
      Mohammed Shafi Shajakhan 提交于
      'ath10k_htt_tx_free_cont_txbuf' and 'ath10k_htt_tx_free_cont_frag_desc'
      have NULL pointer checks to avoid crash if they are called twice
      but this is as of now not sufficient as these pointers are not assigned
      to NULL once the contiguous DMA memory allocation is freed, fix this.
      Though this may not be hit with the explicity check of state variable
      'tx_mem_allocated' check, good to have this addressed as well.
      
      Below BUG_ON is hit when the above scenario is simulated
      with kernel debugging enabled
      
       page:f6d09a00 count:0 mapcount:-127 mapping:  (null)
      index:0x0
       flags: 0x40000000()
       page dumped because: VM_BUG_ON_PAGE(page_ref_count(page)
      == 0)
       ------------[ cut here ]------------
       kernel BUG at ./include/linux/mm.h:445!
       invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC
       EIP is at put_page_testzero.part.88+0xd/0xf
       Call Trace:
        [<c118a2cc>] __free_pages+0x3c/0x40
        [<c118a30e>] free_pages+0x3e/0x50
        [<c10222b4>] dma_generic_free_coherent+0x24/0x30
        [<f8c1d9a8>] ath10k_htt_tx_free_cont_txbuf+0xf8/0x140
      
        [<f8c1e2a9>] ath10k_htt_tx_destroy+0x29/0xa0
      
        [<f8c143e0>] ath10k_core_destroy+0x60/0x80 [ath10k_core]
        [<f8acd7e9>] ath10k_pci_remove+0x79/0xa0 [ath10k_pci]
        [<c13ed7a8>] pci_device_remove+0x38/0xb0
        [<c14d3492>] __device_release_driver+0x72/0x100
        [<c14d36b7>] driver_detach+0x97/0xa0
        [<c14d29c0>] bus_remove_driver+0x40/0x80
        [<c14d427a>] driver_unregister+0x2a/0x60
        [<c13ec768>] pci_unregister_driver+0x18/0x70
        [<f8aced4f>] ath10k_pci_exit+0xd/0x2be [ath10k_pci]
        [<c1101e78>] SyS_delete_module+0x158/0x210
        [<c11b34f1>] ? __might_fault+0x41/0xa0
        [<c11b353b>] ? __might_fault+0x8b/0xa0
        [<c1001a4b>] do_fast_syscall_32+0x9b/0x1c0
        [<c178da34>] sysenter_past_esp+0x45/0x74
      Signed-off-by: NMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      02a9e08d
    • T
      ath9k: Turn ath_txq_lock/unlock() into static inlines. · 5c4607eb
      Toke Høiland-Jørgensen 提交于
      These are one-line functions that just call spin_lock/unlock_bh(); turn
      them into static inlines to avoid the function call overhead.
      Signed-off-by: NToke Høiland-Jørgensen <toke@toke.dk>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      5c4607eb
    • T
      ath9k: Introduce airtime fairness scheduling between stations · 63fefa05
      Toke Høiland-Jørgensen 提交于
      This reworks the ath9k driver to schedule transmissions to connected
      stations in a way that enforces airtime fairness between them. It
      accomplishes this by measuring the time spent transmitting to or
      receiving from a station at TX and RX completion, and accounting this to
      a per-station, per-QoS level airtime deficit. Then, an FQ-CoDel based
      deficit scheduler is employed at packet dequeue time, to control which
      station gets the next transmission opportunity.
      
      Airtime fairness can significantly improve the efficiency of the network
      when station rates vary. The following throughput values are from a
      simple three-station test scenario, where two stations operate at the
      highest HT20 rate, and one station at the lowest, and the scheduler is
      employed at the access point:
      
                        Before   /   After
      Fast station 1:    19.17   /   25.09 Mbps
      Fast station 2:    19.83   /   25.21 Mbps
      Slow station:       2.58   /    1.77 Mbps
      Total:             41.58   /   52.07 Mbps
      
      The benefit of airtime fairness goes up the more stations are present.
      In a 30-station test with one station artificially limited to 1 Mbps,
      we have seen aggregate throughput go from 2.14 to 17.76 Mbps.
      Signed-off-by: NToke Høiland-Jørgensen <toke@toke.dk>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      63fefa05
    • M
      ath9k: define all EEPROM fields in Little Endian format · 4bca5303
      Martin Blumenstingl 提交于
      The ar9300_eeprom logic is already using only 8-bit (endian neutral),
      __le16 and __le32 fields to state explicitly how the values should be
      interpreted.
      All other EEPROM implementations (4k, 9287 and def) were using u16 and
      u32 fields with additional logic to swap the values (read from the
      original EEPROM) so they match the current CPUs endianness.
      
      The EEPROM format defaults to "all values are Little Endian", indicated
      by the absence of the AR5416_EEPMISC_BIG_ENDIAN in the u8 EEPMISC
      register. If we detect that the EEPROM indicates Big Endian mode
      (AR5416_EEPMISC_BIG_ENDIAN is set in the EEPMISC register) then we'll
      swap the values to convert them into Little Endian. This is done by
      activating the EEPMISC based logic in ath9k_hw_nvram_swap_data even if
      AH_NO_EEP_SWAP is set (this makes ath9k behave like the FreeBSD driver,
      which also does not have a flag to enable swapping based on the
      AR5416_EEPMISC_BIG_ENDIAN bit). Before this logic was only used to
      enable swapping when "current CPU endianness != EEPROM endianness".
      
      After changing all relevant fields to __le16 and __le32 sparse was used
      to check that all code which reads any of these fields uses
      le{16,32}_to_cpu.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      4bca5303
    • M
      ath9k: Make the EEPROM swapping check use the eepmisc register · 68fbe792
      Martin Blumenstingl 提交于
      There are two ways of swapping the EEPROM data in the ath9k driver:
      1) swab16 based on the first two EEPROM "magic" bytes (same for all
         EEPROM formats)
      2) field and EEPROM format specific swab16/swab32 (different for
         eeprom_def, eeprom_4k and eeprom_9287)
      
      The result of the first check was used to also enable the second swap.
      This behavior seems incorrect, since the data may only be byte-swapped
      (afterwards the data could be in the correct endianness).
      Thus we introduce a separate check based on the "eepmisc" register
      (which is part of the EEPROM data). When bit 0 is set, then the EEPROM
      format specific values are in "big endian". This is also done by the
      FreeBSD kernel, see [0] for example.
      
      This allows us to parse EEPROMs with the "correct" magic bytes but
      swapped EEPROM format specific values. These EEPROMs (mostly found in
      lantiq and broadcom based big endian MIPS based devices) only worked
      due to platform specific "hacks" which swapped the EEPROM so the
      magic was inverted, which also enabled the format specific swapping.
      With this patch the old behavior is still supported, but neither
      recommended nor needed anymore.
      
      [0]
      https://github.com/freebsd/freebsd/blob/50719b56d9ce8d7d4beb53b16e9edb2e9a4a7a18/sys/dev/ath/ath_hal/ah_eeprom_9287.c#L351Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      68fbe792
    • M
      ath9k: consistently use get_eeprom_rev(ah) · 9bff7428
      Martin Blumenstingl 提交于
      The AR5416_VER_MASK macro does the same as get_eeprom_rev, except that
      one has to know the actual EEPROM type (and providing a reference to
      that in a variable named "eep"). Additionally the eeprom_*.c
      implementations used the same shifting logic multiple times to get the
      eeprom revision which was also unnecessary duplication of
      get_eeprom_rev.
      
      Also use the AR5416_EEP_VER_MINOR_MASK macro where needed and introduce
      a similar macro (AR5416_EEP_VER_MAJOR_MASK) for the major version.
      Finally drop AR9287_EEP_VER_MINOR_MASK since it simply duplicates the
      already defined AR5416_EEP_VER_MINOR_MASK.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      9bff7428
    • M
      ath9k: replace eeprom_param EEP_MINOR_REV with get_eeprom_rev · 7d7dc538
      Martin Blumenstingl 提交于
      get_eeprom(ah, EEP_MINOR_REV) and get_eeprom_rev(ah) are both doing the
      same thing: returning the EEPROM revision (12 lowest bits). Make the
      code consistent by using get_eeprom_rev(ah) everywhere.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      7d7dc538
    • M
      ath9k: Add an eeprom_ops callback for retrieving the eepmisc value · d8ec2e2a
      Martin Blumenstingl 提交于
      This allows deciding if we have to swap the EEPROM data (so it matches
      the system's native endianness) even if no byte-swapping (swab16, based on
      the first two bytes in the EEPROM) is needed.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      d8ec2e2a
    • M
      ath9k: indicate that the AR9003 EEPROM template values are little endian · 291478b7
      Martin Blumenstingl 提交于
      The eepMisc field was not set explicitly. The default value of 0 means
      that the values in the EEPROM (template) should be interpreted as little
      endian. However, this is not clear until comparing the AR9003 code with
      the other EEPROM formats.
      To make the code easier to understand we explicitly state that the values
      are little endian - there are no functional changes with this patch.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      291478b7
    • M
      ath9k: Add a #define for the EEPROM "eepmisc" endianness bit · 81a834e3
      Martin Blumenstingl 提交于
      This replaces a magic number with a named #define. Additionally it
      removes two "eeprom format" specific #defines for the "big endianness"
      bit which are the same on all eeprom formats.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      81a834e3
  3. 05 12月, 2016 2 次提交
  4. 04 12月, 2016 26 次提交