|
1107 |
return isLast; |
1107 |
return isLast; |
1108 |
} |
1108 |
} |
1109 |
|
1109 |
|
|
|
1110 |
bool |
1111 |
WifiRemoteStationManager::IsAllowedControlAnswerModulationClass (enum WifiModulationClass modClassReq, enum WifiModulationClass modClassAnswer) const |
1112 |
{ |
1113 |
switch (modClassReq) |
1114 |
{ |
1115 |
case WIFI_MOD_CLASS_DSSS: |
1116 |
return (modClassAnswer == WIFI_MOD_CLASS_DSSS); |
1117 |
case WIFI_MOD_CLASS_HR_DSSS: |
1118 |
return (modClassAnswer == WIFI_MOD_CLASS_DSSS || modClassAnswer == WIFI_MOD_CLASS_HR_DSSS); |
1119 |
case WIFI_MOD_CLASS_ERP_OFDM: |
1120 |
return (modClassAnswer == WIFI_MOD_CLASS_DSSS || modClassAnswer == WIFI_MOD_CLASS_HR_DSSS || modClassAnswer == WIFI_MOD_CLASS_ERP_OFDM); |
1121 |
case WIFI_MOD_CLASS_OFDM: |
1122 |
return (modClassAnswer == WIFI_MOD_CLASS_OFDM); |
1123 |
case WIFI_MOD_CLASS_HT: |
1124 |
case WIFI_MOD_CLASS_VHT: |
1125 |
return true; |
1126 |
default: |
1127 |
NS_FATAL_ERROR ("Modulation class not defined"); |
1128 |
return false; |
1129 |
} |
1130 |
} |
1131 |
|
1110 |
WifiMode |
1132 |
WifiMode |
1111 |
WifiRemoteStationManager::GetControlAnswerMode (Mac48Address address, WifiMode reqMode) |
1133 |
WifiRemoteStationManager::GetControlAnswerMode (Mac48Address address, WifiMode reqMode) |
1112 |
{ |
1134 |
{ |
|
1127 |
NS_LOG_FUNCTION (this << address << reqMode); |
1149 |
NS_LOG_FUNCTION (this << address << reqMode); |
1128 |
WifiMode mode = GetDefaultMode (); |
1150 |
WifiMode mode = GetDefaultMode (); |
1129 |
bool found = false; |
1151 |
bool found = false; |
1130 |
uint8_t nss = 1; // Use one spatial stream for control response |
|
|
1131 |
//First, search the BSS Basic Rate set |
1152 |
//First, search the BSS Basic Rate set |
1132 |
for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++) |
1153 |
for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++) |
1133 |
{ |
1154 |
{ |
1134 |
if ((!found || i->GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) > mode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1155 |
if ((!found || i->IsHigherDataRate (mode)) |
1135 |
&& (i->GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) <= reqMode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1156 |
&& (!i->IsHigherDataRate (reqMode)) |
1136 |
&& (i->GetConstellationSize (nss) <= reqMode.GetConstellationSize (nss)) |
1157 |
&& (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass (), i->GetModulationClass ()))) |
1137 |
&& ((i->GetModulationClass () == reqMode.GetModulationClass ()) |
|
|
1138 |
|| (reqMode.GetModulationClass () == WIFI_MOD_CLASS_HT) |
1139 |
|| (reqMode.GetModulationClass () == WIFI_MOD_CLASS_VHT))) |
1140 |
|
1141 |
{ |
1158 |
{ |
1142 |
mode = *i; |
1159 |
mode = *i; |
1143 |
//We've found a potentially-suitable transmit rate, but we |
1160 |
//We've found a potentially-suitable transmit rate, but we |
|
1146 |
found = true; |
1163 |
found = true; |
1147 |
} |
1164 |
} |
1148 |
} |
1165 |
} |
1149 |
nss = 1; // Continue the assumption that MIMO not used for control response |
|
|
1150 |
if (HasHtSupported () || HasVhtSupported ()) |
1166 |
if (HasHtSupported () || HasVhtSupported ()) |
1151 |
{ |
1167 |
{ |
1152 |
if (!found) |
1168 |
if (!found) |
|
1154 |
mode = GetDefaultMcs (); |
1170 |
mode = GetDefaultMcs (); |
1155 |
for (WifiModeListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++) |
1171 |
for (WifiModeListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++) |
1156 |
{ |
1172 |
{ |
1157 |
if ((!found || i->GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) > mode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1173 |
if ((!found || i->IsHigherDataRate (mode)) |
1158 |
&& i->GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) <= reqMode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1174 |
&& (!i->IsHigherDataRate (reqMode)) |
1159 |
//&& thismode.GetModulationClass () == reqMode.GetModulationClass ()) //TODO: check standard |
1175 |
&& (i->GetModulationClass () == reqMode.GetModulationClass ())) |
1160 |
{ |
1176 |
{ |
1161 |
mode = *i; |
1177 |
mode = *i; |
1162 |
//We've found a potentially-suitable transmit rate, but we |
1178 |
//We've found a potentially-suitable transmit rate, but we |
|
1192 |
* \todo Note that we're ignoring the last sentence for now, because |
1208 |
* \todo Note that we're ignoring the last sentence for now, because |
1193 |
* there is not yet any manipulation here of PHY options. |
1209 |
* there is not yet any manipulation here of PHY options. |
1194 |
*/ |
1210 |
*/ |
1195 |
nss = 1; // Continue the assumption that MIMO not used for control response |
|
|
1196 |
for (uint32_t idx = 0; idx < m_wifiPhy->GetNModes (); idx++) |
1211 |
for (uint32_t idx = 0; idx < m_wifiPhy->GetNModes (); idx++) |
1197 |
{ |
1212 |
{ |
1198 |
WifiMode thismode = m_wifiPhy->GetMode (idx); |
1213 |
WifiMode thismode = m_wifiPhy->GetMode (idx); |
1199 |
|
|
|
1200 |
/* If the rate: |
1214 |
/* If the rate: |
1201 |
* |
1215 |
* |
1202 |
* - is a mandatory rate for the PHY, and |
1216 |
* - is a mandatory rate for the PHY, and |
|
1207 |
* ...then it's our best choice so far. |
1221 |
* ...then it's our best choice so far. |
1208 |
*/ |
1222 |
*/ |
1209 |
if (thismode.IsMandatory () |
1223 |
if (thismode.IsMandatory () |
1210 |
&& (!found || thismode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) > mode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1224 |
&& (!found || thismode.IsHigherDataRate (mode)) |
1211 |
&& (thismode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) <= reqMode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1225 |
&& (!thismode.IsHigherDataRate (reqMode)) |
1212 |
&& (thismode.GetConstellationSize (nss) <= reqMode.GetConstellationSize (nss)) |
1226 |
&& (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass (), thismode.GetModulationClass ()))) |
1213 |
&& ((thismode.GetModulationClass () == reqMode.GetModulationClass ()) |
|
|
1214 |
|| (reqMode.GetModulationClass () == WIFI_MOD_CLASS_HT) |
1215 |
|| (reqMode.GetModulationClass () == WIFI_MOD_CLASS_HT))) |
1216 |
|
1217 |
{ |
1227 |
{ |
1218 |
mode = thismode; |
1228 |
mode = thismode; |
1219 |
//As above; we've found a potentially-suitable transmit |
1229 |
//As above; we've found a potentially-suitable transmit |
|
1222 |
found = true; |
1232 |
found = true; |
1223 |
} |
1233 |
} |
1224 |
} |
1234 |
} |
1225 |
nss = 1; // Continue the assumption that MIMO not used for control response |
|
|
1226 |
if (HasHtSupported () || HasVhtSupported ()) |
1235 |
if (HasHtSupported () || HasVhtSupported ()) |
1227 |
{ |
1236 |
{ |
1228 |
for (uint32_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++) |
1237 |
for (uint32_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++) |
1229 |
{ |
1238 |
{ |
1230 |
WifiMode thismode = m_wifiPhy->GetMcs (idx); |
1239 |
WifiMode thismode = m_wifiPhy->GetMcs (idx); |
1231 |
if (thismode.IsMandatory () |
1240 |
if (thismode.IsMandatory () |
1232 |
&& (!found || thismode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) > mode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1241 |
&& (!found || thismode.IsHigherDataRate (mode)) |
1233 |
&& thismode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss) <= reqMode.GetPhyRate (m_wifiPhy->GetChannelWidth (), 0, nss)) |
1242 |
&& (!thismode.IsHigherCodeRate(reqMode)) |
1234 |
//&& thismode.GetModulationClass () == reqMode.GetModulationClass ()) //TODO: check standard |
1243 |
&& (thismode.GetModulationClass () == reqMode.GetModulationClass ())) |
1235 |
{ |
1244 |
{ |
1236 |
mode = thismode; |
1245 |
mode = thismode; |
1237 |
//As above; we've found a potentially-suitable transmit |
1246 |
//As above; we've found a potentially-suitable transmit |