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
|
6887 | 6887 | sc->sc_rc->ops->findrate(sc, an, shortPreamble, skb->len, |
6888 | 6888 | &rix, &try0, &txrate); |
6889 | 6889 | |
| 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 | |
6890 | 6896 | /* Ratecontrol sometimes returns invalid rate index */ |
6891 | 6897 | if (rix != 0xff) |
6892 | 6898 | an->an_prevdatarix = rix; |
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
|
6887 | 6887 | sc->sc_rc->ops->findrate(sc, an, shortPreamble, skb->len, |
6888 | 6888 | &rix, &try0, &txrate); |
6889 | 6889 | |
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 | | |
6896 | 6890 | /* Ratecontrol sometimes returns invalid rate index */ |
6897 | 6891 | if (rix != 0xff) |
6898 | 6892 | an->an_prevdatarix = rix; |
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
|
452 | 452 | vap->iv_mcast_rate = 1000; |
453 | 453 | #endif |
454 | 454 | 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; |
455 | 457 | switch (opmode) { |
456 | 458 | case IEEE80211_M_STA: |
457 | 459 | /* WDS/Repeater */ |
458 | 460 | if (flags & IEEE80211_NO_STABEACONS) |
459 | 461 | vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS; |
| 462 | vap->iv_caps |= IEEE80211_C_SWRETRY; |
460 | 463 | break; |
461 | 464 | case IEEE80211_M_IBSS: |
462 | | vap->iv_caps |= IEEE80211_C_IBSS; |
| 465 | vap->iv_caps |= IEEE80211_C_IBSS | IEEE80211_C_SWRETRY; |
463 | 466 | vap->iv_ath_cap &= ~IEEE80211_ATHC_XR; |
464 | 467 | break; |
465 | 468 | case IEEE80211_M_AHDEMO: |
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
|
1288 | 1288 | return 0; |
1289 | 1289 | } |
1290 | 1290 | |
| 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 | |
1291 | 1304 | static int |
1292 | 1305 | ieee80211_ioctl_siwretry(struct net_device *dev, struct iw_request_info *info, |
1293 | 1306 | struct iw_param *rrq, char *extra) |
… |
… |
ieee80211_ioctl_siwretry(struct net_devi
|
1300 | 1313 | vap->iv_flags &= ~IEEE80211_F_SWRETRY; |
1301 | 1314 | goto done; |
1302 | 1315 | } |
| 1316 | /* Already disabled in iv_flags, nothing to do */ |
1303 | 1317 | return 0; |
1304 | 1318 | } |
1305 | | |
1306 | 1319 | if ((vap->iv_caps & IEEE80211_C_SWRETRY) == 0) |
1307 | 1320 | return -EOPNOTSUPP; |
| 1321 | if (rrq->value < 0) |
| 1322 | return -EINVAL; |
1308 | 1323 | if (rrq->flags == IW_RETRY_LIMIT) { |
1309 | 1324 | 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 | } |
1313 | 1333 | vap->iv_flags |= IEEE80211_F_SWRETRY; |
1314 | 1334 | } else { |
1315 | 1335 | vap->iv_flags &= ~IEEE80211_F_SWRETRY; |
1316 | 1336 | } |
1317 | | return 0; |
1318 | 1337 | } |
| 1338 | if (rrq->flags & IW_RETRY_LIFETIME) |
| 1339 | vap->iv_txlifetime = 0; |
1319 | 1340 | done: |
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; |
1321 | 1342 | } |
1322 | 1343 | |
1323 | 1344 | static int |
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
|
1288 | 1288 | return 0; |
1289 | 1289 | } |
1290 | 1290 | |
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 | | |
1304 | 1291 | static int |
1305 | 1292 | ieee80211_ioctl_siwretry(struct net_device *dev, struct iw_request_info *info, |
1306 | 1293 | struct iw_param *rrq, char *extra) |
… |
… |
ieee80211_ioctl_siwretry(struct net_devi
|
1313 | 1300 | vap->iv_flags &= ~IEEE80211_F_SWRETRY; |
1314 | 1301 | goto done; |
1315 | 1302 | } |
1316 | | /* Already disabled in iv_flags, nothing to do */ |
1317 | 1303 | return 0; |
1318 | 1304 | } |
| 1305 | |
1319 | 1306 | if ((vap->iv_caps & IEEE80211_C_SWRETRY) == 0) |
1320 | 1307 | return -EOPNOTSUPP; |
1321 | | if (rrq->value < 0) |
1322 | | return -EINVAL; |
1323 | 1308 | if (rrq->flags == IW_RETRY_LIMIT) { |
1324 | 1309 | 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 */ |
1333 | 1313 | vap->iv_flags |= IEEE80211_F_SWRETRY; |
1334 | 1314 | } else { |
1335 | 1315 | vap->iv_flags &= ~IEEE80211_F_SWRETRY; |
1336 | 1316 | } |
| 1317 | return 0; |
1337 | 1318 | } |
1338 | | if (rrq->flags & IW_RETRY_LIFETIME) |
1339 | | vap->iv_txlifetime = 0; |
1340 | 1319 | done: |
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; |
1342 | 1321 | } |
1343 | 1322 | |
1344 | 1323 | static int |