Ticket #7552: 979-b43_addsysfs.patch

File 979-b43_addsysfs.patch, 4.1 KB (added by thommyj@…, 5 years ago)

hack for displaying debug info in sysfs for above patch

  • drivers/net/wireless/b43/dma.h

    old new  
    303303void b43_dma_direct_fifo_rx(struct b43_wldev *dev, 
    304304                            unsigned int engine_index, bool enable); 
    305305 
     306ssize_t b43_attr_slotusage_show(struct device *dev,struct device_attribute *attr, char *buf); 
     307ssize_t b43_attr_discards_show(struct device *dev,struct device_attribute *attr, char *buf); 
     308 
    306309#endif /* B43_DMA_H_ */ 
  • drivers/net/wireless/b43/main.c

    old new  
    4444#include <linux/dma-mapping.h> 
    4545#include <linux/slab.h> 
    4646#include <asm/unaligned.h> 
     47#include <linux/kernel.h> 
     48#include <linux/sysfs.h> 
    4749 
    4850#include "b43.h" 
    4951#include "main.h" 
     
    54705472#endif 
    54715473 
    54725474#ifdef CONFIG_B43_SSB 
     5475static DEVICE_ATTR(slot_usage, 0444,b43_attr_slotusage_show , NULL); 
     5476static DEVICE_ATTR(discards,0444,b43_attr_discards_show, NULL); 
     5477 
    54735478static 
    54745479int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) 
    54755480{ 
     
    55035508        INIT_WORK(&wl->firmware_load, b43_request_firmware); 
    55045509        schedule_work(&wl->firmware_load); 
    55055510 
     5511        if(first){ 
     5512           if( 0 > (err= device_create_file(dev->dev, &dev_attr_slot_usage))){ 
     5513              printk("b43: error creating slot_usage sysfs entry"); 
     5514           } 
     5515           if( 0 > (err= device_create_file(dev->dev, &dev_attr_discards))){ 
     5516              printk("b43: error creating discards sysfs entry"); 
     5517           } 
     5518        } 
     5519 
    55065520      out: 
    55075521        return err; 
    55085522 
     
    55375551                 */ 
    55385552                b43_wireless_exit(dev, wl); 
    55395553        } 
     5554 
     5555        device_remove_file(dev->dev, &dev_attr_slot_usage); 
     5556        device_remove_file(dev->dev, &dev_attr_discards); 
    55405557} 
    55415558 
    55425559static struct ssb_driver b43_ssb_driver = { 
  • drivers/net/wireless/b43/dma.c

    old new  
    4747 * into separate slots. */ 
    4848#define TX_SLOTS_PER_FRAME      2 
    4949 
     50static int dmarx_max_slots = -1; 
     51static int dmarx_last_slots = -1; 
     52static int dmarx_nullruns = 0; 
     53 
     54 
     55ssize_t b43_attr_slotusage_show(struct device *dev,struct device_attribute *attr, char *buf){ 
     56        return( snprintf(buf,PAGE_SIZE, 
     57                         "max: %d\nlast: %d\nnullruns: %d\n",dmarx_max_slots,dmarx_last_slots,dmarx_nullruns)); 
     58} 
     59 
     60 
     61ssize_t b43_attr_discards_show(struct device *dev,struct device_attribute *attr, char *buf){ 
     62        struct b43_wldev *wldev = dev_to_b43_wldev(dev); 
     63        return( snprintf(buf,PAGE_SIZE, 
     64                         "%d\n",wldev->stats.rxdesc_underruns)); 
     65 
     66} 
     67 
    5068static u32 b43_dma_address(struct b43_dma *dma, dma_addr_t dmaaddr, 
    5169                           enum b43_addrtype addrtype) 
    5270{ 
     
    17081726{ 
    17091727        const struct b43_dma_ops *ops = ring->ops; 
    17101728        int slot, current_slot; 
    1711         int used_slots = 0; 
    17121729 
    17131730        B43_WARN_ON(ring->tx); 
    17141731        current_slot = ops->get_current_rxslot(ring); 
    17151732        B43_WARN_ON(!(current_slot >= 0 && current_slot < ring->nr_slots)); 
    17161733 
    1717         slot = ring->current_slot; 
     1734        slot = ring->current_slot; 
     1735 
     1736        if(slot>current_slot){ 
     1737          dmarx_last_slots = B43_RXRING_SLOTS-slot+current_slot; 
     1738        }else{ 
     1739          dmarx_last_slots = current_slot-slot; 
     1740        } 
     1741        if(dmarx_last_slots>dmarx_max_slots) 
     1742           dmarx_max_slots = dmarx_last_slots; 
     1743 
     1744        if(slot == current_slot){ 
     1745           dmarx_nullruns++; 
     1746         } 
     1747 
    17181748        for (; slot != current_slot; slot = next_slot(ring, slot)) { 
    17191749                dma_rx(ring, &slot); 
    1720                 update_max_used_slots(ring, ++used_slots); 
    17211750        } 
    17221751        wmb(); 
    17231752        ops->set_current_rxslot(ring, slot);