HowTo/madwifi-retry: patch-03-retry-fix.diff

File patch-03-retry-fix.diff, 7.2 KB (added by mcgrof, 17 years ago)

retry fix for madiwif-0.9.3.3

  • madwifi-0.9.3.3

    Retry fix
    
    This enables modifying retry limits on madwifi via Wext. While the
    implementation on the ioctl adds support (ieee80211_wireless.c) for
    short retry, long retry and even retry lifetime the HAL only allows us
    currently to modify one simple retry limit.
    
    Signed-Off by: Luis Rodriguez <mcgrof@winlab.rutgers.edu>
    
    diff -Naurp madwifi-0.9.3.3.old.2/ath/if_ath.c madwifi-0.9.3.3/ath/if_ath.c
    old new ath_tx_start(struct net_device *dev, str  
    68876887            sc->sc_rc->ops->findrate(sc, an, shortPreamble, skb->len,
    68886888                &rix, &try0, &txrate);
    68896889
     6890            /* Note: HAL does not support distinguishing between short
     6891             * and long retry. These both are set via try0 here then.
     6892             * In the openhal we'll fix this ;) */
     6893            if (vap->iv_flags & IEEE80211_F_SWRETRY && vap->iv_txmax != try0)
     6894                try0 = vap->iv_txmax;
     6895
    68906896            /* Ratecontrol sometimes returns invalid rate index */
    68916897            if (rix != 0xff)
    68926898                an->an_prevdatarix = rix;
  • ath/if_ath.c.orig

    diff -Naurp madwifi-0.9.3.3.old.2/ath/if_ath.c.orig madwifi-0.9.3.3/ath/if_ath.c.orig
    old new ath_tx_start(struct net_device *dev, str  
    68876887            sc->sc_rc->ops->findrate(sc, an, shortPreamble, skb->len,
    68886888                &rix, &try0, &txrate);
    68896889
    6890             /* Note: HAL does not support distinguishing between short
    6891              * and long retry. These both are set via try0 here then.
    6892              * In the openhal we'll fix this ;) */
    6893             if (vap->iv_flags & IEEE80211_F_SWRETRY && vap->iv_txmax != try0)
    6894                 try0 = vap->iv_txmax;
    6895 
    68966890            /* Ratecontrol sometimes returns invalid rate index */
    68976891            if (rix != 0xff)
    68986892                an->an_prevdatarix = rix;
  • net80211/ieee80211.c

    diff -Naurp madwifi-0.9.3.3.old.2/net80211/ieee80211.c madwifi-0.9.3.3/net80211/ieee80211.c
    old new ieee80211_vap_setup(struct ieee80211com  
    452452    vap->iv_mcast_rate = 1000;
    453453#endif
    454454    vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
     455    /* Means its unset yet via WE SIOCSIWRETRY ioctl */
     456    vap->iv_flags &= ~IEEE80211_F_SWRETRY;
    455457    switch (opmode) {
    456458    case IEEE80211_M_STA:
    457459        /* WDS/Repeater */
    458460        if (flags & IEEE80211_NO_STABEACONS)
    459461            vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
     462        vap->iv_caps |= IEEE80211_C_SWRETRY;
    460463        break;
    461464    case IEEE80211_M_IBSS:
    462         vap->iv_caps |= IEEE80211_C_IBSS;
     465        vap->iv_caps |= IEEE80211_C_IBSS | IEEE80211_C_SWRETRY;
    463466        vap->iv_ath_cap &= ~IEEE80211_ATHC_XR;
    464467        break;
    465468    case IEEE80211_M_AHDEMO:
  • net80211/ieee80211_wireless.c

    diff -Naurp madwifi-0.9.3.3.old.2/net80211/ieee80211_wireless.c madwifi-0.9.3.3/net80211/ieee80211_wireless.c
    old new ieee80211_ioctl_giwpower(struct net_devi  
    12881288    return 0;
    12891289}
    12901290
     1291/* WE-21 added support for IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
     1292 * Note: IW_RETRY_SHORT/IW_RETRY_LONG was just a userspace improvement so
     1293 * we can just add the defines required for its support here and a user
     1294 * with an older kernel but new WE will still be able to benefit from this */
     1295#if WIRELESS_EXT < 21
     1296/* Retry limits and lifetime flags available */
     1297#ifndef IW_RETRY_LIFETIME /* Can't pinpoint when this guy was introduced */
     1298#define IW_RETRY_LIFETIME       0x2000  /* Maximum duration of retries in us */
     1299#endif /* IW_RETRY_LIFETIME */
     1300#define IW_RETRY_SHORT          0x0010  /* Value is for short packets  */
     1301#define IW_RETRY_LONG           0x0020  /* Value is for long packets */
     1302#endif /* WIRELESS_EXT < 21 */
     1303
    12911304static int
    12921305ieee80211_ioctl_siwretry(struct net_device *dev, struct iw_request_info *info,
    12931306    struct iw_param *rrq, char *extra)
    ieee80211_ioctl_siwretry(struct net_devi  
    13001313            vap->iv_flags &= ~IEEE80211_F_SWRETRY;
    13011314            goto done;
    13021315        }
     1316        /* Already disabled in iv_flags, nothing to do */
    13031317        return 0;
    13041318    }
    1305 
    13061319    if ((vap->iv_caps & IEEE80211_C_SWRETRY) == 0)
    13071320        return -EOPNOTSUPP;
     1321    if (rrq->value < 0)
     1322        return -EINVAL;
    13081323    if (rrq->flags == IW_RETRY_LIMIT) {
    13091324        if (rrq->value >= 0) {
    1310             vap->iv_txmin = rrq->value;
    1311             vap->iv_txmax = rrq->value; /* XXX */
    1312             vap->iv_txlifetime = 0;     /* XXX */
     1325            if (rrq->flags & IW_RETRY_SHORT)
     1326                vap->iv_txmin = rrq->value;
     1327            else if (rrq->flags & IW_RETRY_LONG)
     1328                vap->iv_txmax = rrq->value;
     1329            else {
     1330                vap->iv_txmin = rrq->value;
     1331                vap->iv_txmax = rrq->value;
     1332            }
    13131333            vap->iv_flags |= IEEE80211_F_SWRETRY;
    13141334        } else {
    13151335            vap->iv_flags &= ~IEEE80211_F_SWRETRY;
    13161336        }
    1317         return 0;
    13181337    }
     1338    if (rrq->flags & IW_RETRY_LIFETIME)
     1339        vap->iv_txlifetime = 0;
    13191340done:
    1320     return IS_UP(vap->iv_dev) ? ic->ic_reset(vap->iv_dev) : 0;
     1341    return IS_UP(ic->ic_dev) ? ic->ic_reset(ic->ic_dev) : 0;
    13211342}
    13221343
    13231344static int
  • net80211/ieee80211_wireless.c.orig

    diff -Naurp madwifi-0.9.3.3.old.2/net80211/ieee80211_wireless.c.orig madwifi-0.9.3.3/net80211/ieee80211_wireless.c.orig
    old new ieee80211_ioctl_giwpower(struct net_devi  
    12881288    return 0;
    12891289}
    12901290
    1291 /* WE-21 added support for IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
    1292  * Note: IW_RETRY_SHORT/IW_RETRY_LONG was just a userspace improvement so
    1293  * we can just add the defines required for its support here and a user
    1294  * with an older kernel but new WE will still be able to benefit from this */
    1295 #if WIRELESS_EXT < 21
    1296 /* Retry limits and lifetime flags available */
    1297 #ifndef IW_RETRY_LIFETIME /* Can't pinpoint when this guy was introduced */
    1298 #define IW_RETRY_LIFETIME       0x2000  /* Maximum duration of retries in us */
    1299 #endif /* IW_RETRY_LIFETIME */
    1300 #define IW_RETRY_SHORT          0x0010  /* Value is for short packets  */
    1301 #define IW_RETRY_LONG           0x0020  /* Value is for long packets */
    1302 #endif /* WIRELESS_EXT < 21 */
    1303 
    13041291static int
    13051292ieee80211_ioctl_siwretry(struct net_device *dev, struct iw_request_info *info,
    13061293    struct iw_param *rrq, char *extra)
    ieee80211_ioctl_siwretry(struct net_devi  
    13131300            vap->iv_flags &= ~IEEE80211_F_SWRETRY;
    13141301            goto done;
    13151302        }
    1316         /* Already disabled in iv_flags, nothing to do */
    13171303        return 0;
    13181304    }
     1305
    13191306    if ((vap->iv_caps & IEEE80211_C_SWRETRY) == 0)
    13201307        return -EOPNOTSUPP;
    1321     if (rrq->value < 0)
    1322         return -EINVAL;
    13231308    if (rrq->flags == IW_RETRY_LIMIT) {
    13241309        if (rrq->value >= 0) {
    1325             if (rrq->flags & IW_RETRY_SHORT)
    1326                 vap->iv_txmin = rrq->value;
    1327             else if (rrq->flags & IW_RETRY_LONG)
    1328                 vap->iv_txmax = rrq->value;
    1329             else {
    1330                 vap->iv_txmin = rrq->value;
    1331                 vap->iv_txmax = rrq->value;
    1332             }
     1310            vap->iv_txmin = rrq->value;
     1311            vap->iv_txmax = rrq->value; /* XXX */
     1312            vap->iv_txlifetime = 0;     /* XXX */
    13331313            vap->iv_flags |= IEEE80211_F_SWRETRY;
    13341314        } else {
    13351315            vap->iv_flags &= ~IEEE80211_F_SWRETRY;
    13361316        }
     1317        return 0;
    13371318    }
    1338     if (rrq->flags & IW_RETRY_LIFETIME)
    1339         vap->iv_txlifetime = 0;
    13401319done:
    1341     return IS_UP(ic->ic_dev) ? ic->ic_reset(ic->ic_dev) : 0;
     1320    return IS_UP(vap->iv_dev) ? ic->ic_reset(vap->iv_dev) : 0;
    13421321}
    13431322
    13441323static int