Changeset 39

Show
Ignore:
Timestamp:
03/15/03 19:31:46 (6 years ago)
Author:
sam
Message:

Replicated Change 71 by sam@borg_greg on 2003/03/03 09:36:53<<<

o proc fs support for r/w of ath_debug and r of ath_stats
o fix buffer length set in rx descriptors
o HAL_ additions to power management enums
o change DPRINTF of interrupt processing to netif_msg_intr
o add !sc_attached guard on interrupt handling

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cvs-import/trunk/driver/if_ath.c

    r36 r39  
    8282static void     ath_rate_ctl(struct ath_softc *, struct ieee80211_node *); 
    8383 
     84#ifdef CONFIG_PROC_FS 
     85static void     ath_proc_init(struct ath_softc *sc); 
     86static void     ath_proc_remove(struct ath_softc *sc); 
     87#endif /* CONFIG_PROC_FS */ 
     88 
    8489#ifdef AR_DEBUG 
    85 int     ath_debug = 2;         /*XXX*/ 
     90int     ath_debug = 0; 
    8691#define IFF_DUMPPKTS(_ic)       (ath_debug || netif_msg_dumppkts(_ic)) 
    8792static  void ath_printrxbuf(struct ath_buf *bf); 
     
    229234                dev->name, ether_sprintf(dev->dev_addr)); 
    230235 
     236        ath_proc_init(sc); 
     237 
    231238        sc->sc_attached = 1; 
    232239 
     
    250257                ath_desc_free(sc); 
    251258                ath_hal_detach(sc->sc_ah); 
     259                ath_proc_remove(sc); 
    252260                ieee80211_ifdetach(dev); 
    253261        } 
     
    296304        HAL_INT status; 
    297305 
     306        if (!sc->sc_attached) 
     307                return; 
    298308        spin_lock_irq(&sc->sc_lock); 
    299309        while (ath_hal_intrpend(ah)) { 
    300310                ath_hal_getisr(ah, &status); 
    301                 if (netif_msg_intr(&sc->sc_ic)) 
    302                         printk(KERN_DEBUG "%s: interrupt, status 0x%x\n", 
    303                                 dev->name, status); 
     311                DPRINTF(("%s: interrupt, status 0x%x\n", 
     312                        dev->name, status)); 
    304313                if (status & HAL_INT_FATAL) { 
    305                         printk("%s: hardware error (0x%x); resetting\n", 
     314                        printk("%s: hardware error 0x%x; resetting\n", 
    306315                                dev->name, status); 
    307316                        ath_hal_dumpstate(ah);  /*XXX*/ 
     
    310319                } 
    311320                if (status & HAL_INT_RXORN) { 
    312                         printk("%s: rx FIFO overrun (0x%x); resetting\n", 
     321                        printk("%s: rx FIFO overrun 0x%x; resetting\n", 
    313322                                dev->name, status); 
    314323                        ath_hal_dumpstate(ah);  /*XXX*/ 
     
    318327                if (status & HAL_INT_RXEOL) { 
    319328                        /* 
    320                          * XXX The hardware should re-read the link when 
    321                          * RXE bit is written, but it doesn't work at least 
    322                          * on older revision of the hardware. 
     329                         * XXX The hardware should re-read the link 
     330                         * when the RXE bit is written, but it doesn't 
     331                         * work at least on older revision of the 
     332                         * hardware. 
    323333                         */ 
    324334                        sc->sc_rxlink = NULL; 
     
    412422        else 
    413423                val |= HAL_INT_SWBA;                    /* beacon prepare */ 
     424val |= HAL_INT_TXDESC|HAL_INT_RXDESC; 
    414425        ath_hal_intrset(ah, val | HAL_INT_GLOBAL); 
    415426 
     
    470481                ath_draintxq(sc);               /* clear pending tx frames */ 
    471482                ath_stoprecv(sc);               /* turn off frame recv */ 
    472                 ath_hal_setpower(ah, PM_FULL_SLEEP, 0); 
     483                ath_hal_setpower(ah, HAL_PM_FULL_SLEEP, 0); 
    473484        } 
    474485        ath_beacon_free(sc); 
     
    985996        ds->ds_data = bf->bf_skbaddr; 
    986997        ds->ds_ctl0 = 0; 
    987         ds->ds_ctl1 = skb->len
     998        ds->ds_ctl1 = skb_tailroom(skb)
    988999        ds->ds_status0 = ds->ds_status1 = 0; 
    9891000 
     
    16861697} 
    16871698#endif /* AR_DEBUG */ 
     1699 
     1700#ifdef CONFIG_PROC_FS 
     1701#include <linux/proc_fs.h> 
     1702 
     1703static int 
     1704ath_proc_debug_read(char *page, char **start, off_t off, 
     1705        int count, int *eof, void *data) 
     1706{ 
     1707        if (off != 0) { 
     1708                *eof = 1; 
     1709                return 0; 
     1710        } 
     1711        return sprintf(page, "%d\n", ath_debug); 
     1712} 
     1713 
     1714static int 
     1715ath_proc_debug_write(struct file *file, const char *buf, 
     1716        unsigned long count, void *data) 
     1717{ 
     1718        int v; 
     1719         
     1720        if (sscanf(buf, "%d", &v) == 1) { 
     1721                ath_debug = v; 
     1722                return count; 
     1723        } else 
     1724                return -EINVAL; 
     1725} 
     1726 
     1727static int 
     1728ath_proc_stats(char *page, char **start, off_t off, int count, int *eof, void *data) 
     1729{ 
     1730        struct ath_softc *sc = (struct ath_softc *) data; 
     1731        char *cp = page; 
     1732 
     1733        if (off != 0) { 
     1734                *eof = 1; 
     1735                return 0; 
     1736        } 
     1737#define STAT(x)         cp += sprintf(cp, #x "=%u\n", sc->sc_stats.ast_##x) 
     1738        STAT(watchdog); STAT(tx_encap); STAT(tx_nonode); 
     1739        STAT(tx_nombuf); STAT(tx_nomcl); STAT(tx_linear); 
     1740        STAT(tx_nodata); STAT(tx_busdma); STAT(tx_descerr); 
     1741        STAT(rx_crcerr); STAT(rx_fifoerr); STAT(rx_badcrypt); 
     1742        STAT(rx_phyerr); STAT(rx_phy_tim); STAT(rx_phy_par); 
     1743        STAT(rx_phy_rate); STAT(rx_phy_len); STAT(rx_phy_qam); 
     1744        STAT(rx_phy_srv); STAT(rx_phy_tor); 
     1745        return cp - page; 
     1746#undef STAT 
     1747} 
     1748 
     1749static void 
     1750ath_proc_init(struct ath_softc *sc) 
     1751{ 
     1752        struct proc_dir_entry *dp; 
     1753 
     1754        /* XXX this uses /proc/net, but we want /proc/net/drivers */ 
     1755        sc->sc_proc = proc_mkdir(sc->sc_ic.ic_dev.name, proc_net); 
     1756        if (sc->sc_proc == NULL) { 
     1757                printk(KERN_INFO "/proc/net/drivers/%s: failed to create\n", 
     1758                        sc->sc_ic.ic_dev.name); 
     1759                return; 
     1760        } 
     1761        dp = create_proc_entry("debug", 0644, sc->sc_proc); 
     1762        if (dp) { 
     1763                dp->read_proc = ath_proc_debug_read; 
     1764                dp->write_proc = ath_proc_debug_write; 
     1765                dp->data = sc; 
     1766        } 
     1767        create_proc_read_entry("stats", 0644, sc->sc_proc, ath_proc_stats, sc); 
     1768} 
     1769 
     1770static void 
     1771ath_proc_remove(struct ath_softc *sc) 
     1772{ 
     1773        if (sc->sc_proc != NULL) { 
     1774                remove_proc_entry("stats", sc->sc_proc); 
     1775                remove_proc_entry("debug", sc->sc_proc); 
     1776                remove_proc_entry(sc->sc_ic.ic_dev.name, proc_net); 
     1777                sc->sc_proc = NULL; 
     1778        } 
     1779} 
     1780#endif /* CONFIG_PROC_FS */ 
  • cvs-import/trunk/driver/if_athvar.h

    r36 r39  
    8585struct ath_hal; 
    8686struct ath_desc; 
     87struct proc_dir_entry; 
    8788 
    8889struct ath_softc { 
     
    116117        struct ath_nodestat     sc_bss_stat;    /* statistics for infra mode */ 
    117118        struct ath_stats        sc_stats;       /* interface statistics */ 
     119        struct proc_dir_entry   *sc_proc;       /* /proc/net/drivers/ath%d */ 
    118120}; 
    119121