Show
Ignore:
Timestamp:
01/12/04 23:03:40 (5 years ago)
Author:
samleffler
Message:

o add support to set the mac address (submitted both by

Tom Marshall and Tong Chia)

o minor cleanups to ath_set_mtu

Files:

Legend:

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

    r394 r396  
    112112                        HAL_BOOL outdoor, HAL_BOOL xchanmode); 
    113113 
     114static int      ath_set_mac_address(struct net_device *, void *); 
    114115static int      ath_change_mtu(struct net_device *, int); 
    115116static int      ath_ioctl(struct net_device *, struct ifreq *, int); 
     
    269270        dev->do_ioctl = ath_ioctl; 
    270271        dev->get_stats = ath_getstats; 
     272        dev->set_mac_address = ath_set_mac_address; 
    271273        dev->change_mtu = &ath_change_mtu; 
    272274        dev->tx_queue_len = ATH_TXBUF-1;                /* 1 for mgmt frame */ 
     
    361363} 
    362364 
     365static int 
     366ath_set_mac_address(struct net_device *dev, void *addr) 
     367{ 
     368        struct ath_softc *sc = dev->priv; 
     369        struct ath_hal *ah = sc->sc_ah; 
     370        struct sockaddr *mac = addr; 
     371 
     372        if (netif_running(dev)) { 
     373                DPRINTF(("%s: cannot set address; device running\n", __func__)); 
     374                return -EBUSY; 
     375        } 
     376        DPRINTF(("%s: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", __func__, 
     377                mac->sa_data[0], mac->sa_data[1], mac->sa_data[2], 
     378                mac->sa_data[3], mac->sa_data[4], mac->sa_data[5])); 
     379        IEEE80211_ADDR_COPY(dev->dev_addr, mac->sa_data); 
     380        ath_hal_setmac(ah, dev->dev_addr); 
     381        ath_reset(dev); 
     382        return 0; 
     383} 
     384 
    363385static int       
    364 ath_change_mtu(struct net_device *dev, int new_mtu)  
    365 
    366         if (new_mtu > ATH_MAX_MTU || new_mtu <= ATH_MIN_MTU) 
     386ath_change_mtu(struct net_device *dev, int mtu)  
     387
     388        if (!(ATH_MIN_MTU < mtu && mtu <= ATH_MAX_MTU)) { 
     389                DPRINTF(("%s: invalid %d, min %u, max %u\n", 
     390                        __func__, mtu, ATH_MIN_MTU, ATH_MAX_MTU)); 
    367391                return -EINVAL; 
    368         DPRINTF(("ath_change_mtu: %d\n", new_mtu)); 
    369        dev->mtu = new_mtu
    370        ath_reset(dev)
    371  
    372       return 0; 
     392        } 
     393       DPRINTF(("%s: %d\n", __func__, mtu))
     394       dev->mtu = mtu
     395        ath_reset(dev); 
     396      return 0; 
    373397} 
    374398