Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to fix the MCS of APs

45 views
Skip to first unread message

mspku...@gmail.com

unread,
Aug 18, 2024, 12:10:00 PM8/18/24
to mininet-wifi-discuss
Hi,

I am working on the simulation of a hetnet using mininet wifi. I am using the following code to add APs to my topology.

APLengths = [5, 9, 14, 21]
ap_index =1
APChannelList = [36, 40, 44, 48, 149, 153, 157, 161, 36, 165, 36, 40, 44, 48, 149, 153, 157, 161, 165, 36, 40]

for i in range(APLengths[ap_index]):
AP = net.addAccessPoint(f"ap{i+1}", cls=OVSKernelAP, ssid = f'ap{i+1}-ssid', channel=APChannelList[i-1], mode='ax5', range=60))

I want to assign a fixed MCS value for these APs. Every time my system restarts, I get different MCS values, leading to different tx_bitrate in the output of iwconfig command. Is there a way of doing this?

Regards,
Pavan

Ramon Fontes

unread,
Aug 18, 2024, 12:11:39 PM8/18/24
to mspku...@gmail.com, mininet-wifi-discuss
You may use iw.

--
You received this message because you are subscribed to the Google Groups "mininet-wifi-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mininet-wifi-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mininet-wifi-discuss/1b50ecc0-efa7-4c78-a636-3d8a1cb5fb75n%40googlegroups.com.

mspku...@gmail.com

unread,
Aug 20, 2024, 5:58:00 PM8/20/24
to mininet-wifi-discuss
I tried it, but it's not working.

        mcs_to_bitrate = {
            0: '6.5', 1: '13', 2: '19.5', 3: '26',
            4: '39', 5: '52', 6: '58.5', 7: '65'
        }
        mcs_values = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5]  # Example MCS indices
        for ap, mcs in zip(APs, mcs_values):
            bitrate = mcs_to_bitrate[mcs]
            cmd = f"iw dev {ap.name}-wlan0 set bitrates ht-mcs-2.4 {bitrate}"
            ap.cmd(cmd)

This is what I am using, trying to set each ap with different mcs (even tried all aps at mcs 7), but the simulation shows mcs 13 for all of the APs, not the ones i mention in the iw command

Ramon Fontes

unread,
Aug 20, 2024, 6:10:14 PM8/20/24
to mspku...@gmail.com, mininet-wifi-discuss
I just tried it and it worked. ;/

Ramon Fontes

unread,
Aug 20, 2024, 6:10:18 PM8/20/24
to mspku...@gmail.com, mininet-wifi-discuss
BTW, are you trying ht-mcs-2.4 with 5GHz??

Pavan Kumar Mangipudi

unread,
Aug 20, 2024, 7:15:52 PM8/20/24
to Ramon Fontes, mininet-wifi-discuss
I've tried it with both 5Hhz and 2.4GHz, changing according to the APS I initialize. It's not working for me for some reason. I still get 117Mhz MCS 12. I've also changed the mcs to be 15 for all APs. No change.

Did you run it before starting the network or after? Do you think checking the MCS via ifconfig from mobility.py or node.py would have an impact?

Ramon Fontes

unread,
Aug 20, 2024, 7:17:55 PM8/20/24
to Pavan Kumar Mangipudi, mininet-wifi-discuss
> Did you run it before starting the network or after? 

After starting the network topology.

> Do you think checking the MCS via ifconfig from mobility.py or node.py would have an impact?

ifconfig? It doesn't affect MCS.

mspku...@gmail.com

unread,
Sep 4, 2024, 6:30:14 PM9/4/24
to mininet-wifi-discuss
Hi again Ramon,

I am unable to fix the problem despite using multiple ways. Since you mentioned that it worked for you, is it possible to share your code or snippets of the topology in any capacity? Any help would be greatly appreciated as I am struggling to fix the MCS for some reason.

Regards,
Pavan

Ramon Fontes

unread,
Sep 6, 2024, 4:52:37 PM9/6/24
to Pavan Kumar Mangipudi, mininet-wifi-discuss
> 4: iw After Starting the Network 
> didn't work

Why not? Could you please provide more  details?

On Fri, Sep 6, 2024, 15:44 Pavan Kumar Mangipudi <mspku...@gmail.com> wrote:

 

Problem: checking max bitrate of a link using sta1 iw dev sta1-wlan0 link gives a one of the following for every position of stations which are moving in hte network. {1,6,x}

x here is dependent on the MCS. It is varying for each time i restart my VM. As long as it doesn't restart, i get a constant x. example: for MCS 15, 130Mbps

 

Things I have tried:

 

1: set a random seed in addition to setting seeds for mobility in my topology file, node.py, mobility.py files.

2: setTxParam:mcs_values = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5] # Example MCS indices for ap, mcs in zip(aps, mcs_values):  ap.setTxParam('mcs', mcs)

 

Error: AttributeError: 'OVSAP' object has no attribute 'setTxParam'

3:  iw command with vht-mcs-5:

 

mcs_to_bitrate = {

    0: '6.5', 1: '13', 2: '19.5', 3: '26',

    4: '39', 5: '52', 6: '58.5', 7: '65',

    8: '78', 9: '104', 10: '117', 11: '130',

    12: '156', 13: '208', 14: '234', 15: '260'

}

mcs_value = 15  # MCS index 15 for 130 Mbps

for ap in APs:

    bitrate = mcs_to_bitrate[mcs_value]

    cmd = f"iw dev {ap.name}-wlan0 set bitrates vht-mcs-5 {mcs_value}"

    ap.cmd(cmd)

Didn't work.

 

 

4: iw After Starting the Network 

didn't work

5: setting mcs when adding APs, realized there may be a problem with the interface used with iw dev, so included both wlan0 and wlan1 interfaces. made the following changes:

 

    # Add APs with specific channel, mode, and range

    APLengths = [5, 9, 14, 21]

        for i in range(4):

            sta = net.addStation(f"sta{i+1}", ip=f"10.0.0.{i+1}", min_x=-50, max_x=150, min_y=-50, max_y=150, min_v=0.60, max_v=0.65,

                                 freq_list='2.412,5.2', mode='g,ax5', staLength=STALengths[j], apLength=APLengths[ap_index], range=58)

            stas.append(sta)

        for i in range(APLengths[ap_index]):

            if i == 0:

                AP = net.addAccessPoint(f"ap{i+1}", cls=OVSKernelAP, ssid=f'ap{i+1}-ssid',

                                 channel=1, mode='g', position=positions[i], range=150)

            else:

                AP = net.addAccessPoint(f"ap{i+1}", cls=OVSKernelAP, ssid=f'ap{i+1}-ssid',

                                 channel=APChannelList[i-1], ht_capab='[HE20][SHORT-GI-20]', mode='ax5', position=positions[i], range=60)

           

            APs.append(AP)

 

iw command after starting the network:

        net.build()

        c1.start()

        for i in range(1, len(APs)):  # Starts from AP2 to AP14 (index 1 to 13)

            ap = APs[i]

            ap.start([c1])

            for iface in ['wlan0', 'wlan1']:

                response = ap.cmd(f"iw dev {ap.name}-{iface} link")

                if 'Not connected.' not in response:

                    # Set the desired MCS index value. Here using HE MCS index 11 for 130 Mbps.

                    mcs_value = 11

                    ap.cmd(f"iw dev {ap.name}-{iface} set bitrates he-mcs-5g {mcs_value}")

                    info(f"Set MCS {mcs_value} on {ap.name}-{iface} for ~130 Mbps\n")

                    break

Didnt work.

 

6: to check for possible wireless Interface consistency, changed the iw command to iterate over all wireless interfaces (wintfs) of the access points and check the name.

Command for Setting MCS: Used he-mcs-5 directly without mentioning specific interfaces like wlan0 or wlan1 based on interfaces present on access points.

used hasattr to check if iface has the attribute name before trying to access it.

 

        for i in range(1, len(APs)):  # Starts from AP2 to AP14 (index 1 to 13)

            ap = APs[i]

            ap.start([c1])

 

            info(f"Interfaces for {ap.name}: {ap.wintfs}\n")

           

            # Correctly access each interface of AP

            for iface in ap.wintfs:

                info(f"Interface: {iface}, type: {type(iface)}, name: {iface.name if hasattr(iface, 'name') else 'N/A'}\n")

                if hasattr(iface, 'name') and 'wlan' in iface.name:

                    mcs_value = 11  # Desired MCS index value for ~130 Mbps in 802.11ax

                    ap.cmd(f"iw dev {iface.name} set bitrates he-mcs-5 {mcs_value}")

                    info(f"Set MCS {mcs_value} on {iface.name} for ~130 Mbps\n")

No use. MCS not being fixed.

 

7: Given that the MCS value isn't being applied as expected, wanted to verify if an issue with either the specific commands or the timing and context in which they are applied. steps:

Ensure the iw commands are run after the APs are fully initialized.

Check the output of each iw command execution to verify if there are any errors.

using sleep to ensure commands are applied after initialization.

 

        info("*** Starting network\n")

        net.build()

        c1.start()

        # Ensure APs are initialized and started

        for ap in APs:

            ap.start([c1])

        # Adding a sleep to ensure everything is initialized

        time.sleep(5)

        for i in range(1, len(APs)):  # Starts from AP2 to AP14 (index 1 to 13)

            ap = APs[i]

           # Ensuring we directly access the wlan interface if available

            if hasattr(ap, 'wintfs'):

                for iface in ap.wintfs.values():

                    iface_name = iface.name if hasattr(iface, 'name') else 'null'

                    info(f"Setting MCS for {iface_name}")

                    if 'wlan' in iface_name:

                        mcs_value = 11  # Desired MCS index value for ~130 Mbps in 802.11ax

                        cmd_result = ap.cmd(f"iw dev {iface_name} set bitrates he-mcs-5 {mcs_value}")

                        info(f"Set MCS {mcs_value} on {iface_name} for ~130 Mbps\n")

                        info(f"Command result: {cmd_result}")

                        # Verify set bitrates

                        verify_result = ap.cmd(f"iw dev {iface_name} link")

                        info(f"Verification result for {iface_name}:\n{verify_result}")

        info("*** Running CLI\n")

        CLI(net)\

        info("*** Stopping network\n")

 

Output of the debugging:

Setting MCS for ap2-wlan1Set MCS 11 on ap2-wlan1 for ~130 Mbps

Command result: command failed: Invalid argument (-22)

Verification result for ap2-wlan1:

Not connected.

 

Notes: my output suggests mobility.py and node.py files are being run before going to the part of the code where MCS is being set.

Moreover, my output suggests mobility.py and node.py files are being run before going to the part of the code where MCS is being set.

 

8:
cmd_result = ap.cmd(f"iw dev {iface_name} set bitrates he-mcs-5 {mcs_value}")

iw dev command is returning an "Invalid argument" error, indicating that the parameters or the command itself might not be compatible with current setup.

Using iw list to check the detailed capabilities of interfaces. Ensuring any adjustments comply with the listed capabilities.



code:

            for iface in ap.wintfs.values():

                iface_name = iface.name if hasattr(iface, 'name') else 'null'

                if 'wlan' in iface_name:

                    info(f"Capabilities for {iface_name}")

                    capabilities_dump = ap.cmd(f"iw dev {iface_name} info")

                    info(f"Capabilities for {iface_name}:\n{capabilities_dump}")

 

                    # Attempt to set bitrates (trying with different MCS)

                    mcs_value = 11

                    cmd_result = ap.cmd(f"iw dev {iface_name} set bitrates he-mcs-5 {mcs_value}")

                    info(f"Set MCS {mcs_value} on {iface_name} for ~130 Mbps\n")

                    info(f"Command result: {cmd_result}")

                   

                    # Verify set bitrates

                    verify_result = ap.cmd(f"iw dev {iface_name} link")

                    info(f"Verification result for {iface_name}:\n{verify_result}")

Output:

Capabilities for ap2-wlan1Capabilities for ap2-wlan1:

Interface ap2-wlan1

        ifindex 537

        wdev 0xa700000001

        addr 02:00:00:00:05:00

        ssid ap2-ssid

        type AP

        wiphy 167

        channel 36 (5180 MHz), width: 20 MHz, center1: 5180 MHz

        txpower 2.00 dBm

Set MCS 11 on ap2-wlan1 for ~130 Mbps

Command result: command failed: Invalid argument (-22)

Verification result for ap2-wlan1:

Not connected.

9: changed the schemes to ht-mcs, vht-mcs, and he-mcs and corresponding modes of APs.

 No change.

10: changed to legacy bitrate 54Mbps, iw dev {iface_name} set bitrates legacy-5 {legacy_rate}. Used ht_capab='[SHORT-GI-20]', mode='a' in addAccessPoint for the 5GHZ APs.

No change

Pavan Kumar Mangipudi

unread,
Sep 6, 2024, 4:52:41 PM9/6/24
to Ramon Fontes, mininet-wifi-discuss
Also, all the steps listed step 4 were done after starting the network. All of them give the same problem of MCS not being fixed

On Fri, Sep 6, 2024 at 4:50 PM Pavan Kumar Mangipudi <mspku...@gmail.com> wrote:
I wasn't sure why it didn't work. I was checking for step 4 using the iw dev sta1-wlan0 command. . I have noticed that the simulation is pretty asynchronous through the output in my command window. Mobility.py is being called before the print statements from the for loop with iw dev {ap.name}-wlan0 set bitrates vht-mcs-5 {mcs_value} were shown. Apart from this, to figure out the cause of why it was not working, I have done the other subsequent steps.

Pavan Kumar Mangipudi

unread,
Sep 6, 2024, 4:52:46 PM9/6/24
to Ramon Fontes, mininet-wifi-discuss

Problem: checking max bitrate of a link using sta1 iw dev sta1-wlan0 link gives a one of the following for every position of stations which are moving in hte network. {1,6,x}

x here is dependent on the MCS. It is varying for each time i restart my VM. As long as it doesn't restart, i get a constant x. example: for MCS 15, 130Mbps

 

Things I have tried:

 

1: set a random seed in addition to setting seeds for mobility in my topology file, node.py, mobility.py files.

2: setTxParam:mcs_values = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5] # Example MCS indices for ap, mcs in zip(aps, mcs_values):  ap.setTxParam('mcs', mcs)

 

Error: AttributeError: 'OVSAP' object has no attribute 'setTxParam'

3:  iw command with vht-mcs-5:

 

mcs_to_bitrate = {

    0: '6.5', 1: '13', 2: '19.5', 3: '26',

    4: '39', 5: '52', 6: '58.5', 7: '65',

    8: '78', 9: '104', 10: '117', 11: '130',

    12: '156', 13: '208', 14: '234', 15: '260'

}

mcs_value = 15  # MCS index 15 for 130 Mbps

for ap in APs:

    bitrate = mcs_to_bitrate[mcs_value]

    cmd = f"iw dev {ap.name}-wlan0 set bitrates vht-mcs-5 {mcs_value}"

    ap.cmd(cmd)

Didn't work.

 

 

4: iw After Starting the Network 

didn't work

5: setting mcs when adding APs, realized there may be a problem with the interface used with iw dev, so included both wlan0 and wlan1 interfaces. made the following changes:

 

    # Add APs with specific channel, mode, and range

    APLengths = [5, 9, 14, 21]

        for i in range(4):

            sta = net.addStation(f"sta{i+1}", ip=f"10.0.0.{i+1}", min_x=-50, max_x=150, min_y=-50, max_y=150, min_v=0.60, max_v=0.65,

                                 freq_list='2.412,5.2', mode='g,ax5', staLength=STALengths[j], apLength=APLengths[ap_index], range=58)

            stas.append(sta)

        for i in range(APLengths[ap_index]):

            if i == 0:

Pavan Kumar Mangipudi

unread,
Sep 6, 2024, 4:52:51 PM9/6/24
to Ramon Fontes, mininet-wifi-discuss
I wasn't sure why it didn't work. I was checking for step 4 using the iw dev sta1-wlan0 command. . I have noticed that the simulation is pretty asynchronous through the output in my command window. Mobility.py is being called before the print statements from the for loop with iw dev {ap.name}-wlan0 set bitrates vht-mcs-5 {mcs_value} were shown. Apart from this, to figure out the cause of why it was not working, I have done the other subsequent steps.

Ramon Fontes

unread,
Sep 6, 2024, 4:52:54 PM9/6/24
to Pavan Kumar Mangipudi, mininet-wifi-discuss
Please tell us the steps you tried for 4.

Pavan Kumar Mangipudi

unread,
Sep 7, 2024, 11:43:22 AM9/7/24
to Ramon Fontes, mininet-wifi-discuss
forgot one step, corrected sequence:

add controller
set propagation model,
        net.setPropagationModel(model="logDistance", exp=3.5)
configure wifi nodes
create links

On Sat, Sep 7, 2024 at 11:19 AM Pavan Kumar Mangipudi <mspku...@gmail.com> wrote:
Here are the detailed steps for step4 with the code

initialize 4 stations with following specifications:

APLengths = [5, 9, 14, 21]
APChannelList = [36, 40, 44, 48, 149, 153, 157, 161, 36, 165, 36, 40, 44, 48, 149, 153, 157, 161, 165, 36, 40]

sta = net.addStation(f"sta{i+1}", ip = f"10.0.0.{i+1}", min_x=-50, max_x=150, min_y=-50, max_y=150, min_v=0.60, max_v=0.65, freq_list='2.412,5.2', mode='g,ax5', staLength = 4, apLength=14, range=58)

Initialize 14 APs, with ap1 operating in 2.4GHz mode g, range 150 and remaining APs operating 5GHz mode ax5 range 60:
        for i in range(14):

            if i == 0:
                AP = net.addAccessPoint(f"ap{i+1}", cls=OVSKernelAP, ssid=f'ap{i+1}-ssid',
                                 channel=1, mode='g', position=positions[i], range=150)
            else:
                AP = net.addAccessPoint(f"ap{i+1}", cls=OVSKernelAP, ssid=f'ap{i+1}-ssid',
                                 channel=APChannelList[i-1], ht_capab='[HE20][SHORT-GI-20]', mode='ax5', position=positions[i], range=60)
            APs.append(AP)
add controller
configure wifi nodes
create links
        info("*** Creating links\n")
        for i in range(APLengths[ap_index]-1):
            net.addLink(APs[i], APs[i+1])
plot graph
set mobility model
        if '-s' not in args:
            net.setMobilityModel(time=0, model='RandomDirection', min_x=-50, min_y=-50, max_x=150, max_y=150, seed=6)
start network and use iw to set mcs:

        info("*** Starting network\n")
        net.build()
        c1.start()
        for ap in APs:
            ap.start([c1])
            for iface in ['wlan0', 'wlan1']:
                response = ap.cmd(f"iw dev {ap.name}-{iface} link")
                if 'Not connected.' not in response:
                    # Set the desired MCS index value. Here using VHT MCS index 7 as an example.
                    mcs_value = 7
                    ap.cmd(f"iw dev {ap.name}-{iface} set bitrates vht-mcs-5 {mcs_value}")
                    info(f"Set MCS {mcs_value} on {ap.name}-{iface}\n")
                    break
        info("*** Running CLI\n")
        CLI(net)
        info("*** Stopping network\n")
        net.stop()
if __name__ == '__main__':
    setLogLevel('info')
    netTopo.topology(sys.argv)

Pavan Kumar Mangipudi

unread,
Sep 7, 2024, 11:43:29 AM9/7/24
to Ramon Fontes, mininet-wifi-discuss
Here are the detailed steps for step4 with the code

initialize 4 stations with following specifications:
APLengths = [5, 9, 14, 21]
APChannelList = [36, 40, 44, 48, 149, 153, 157, 161, 36, 165, 36, 40, 44, 48, 149, 153, 157, 161, 165, 36, 40]

sta = net.addStation(f"sta{i+1}", ip = f"10.0.0.{i+1}", min_x=-50, max_x=150, min_y=-50, max_y=150, min_v=0.60, max_v=0.65, freq_list='2.412,5.2', mode='g,ax5', staLength = 4, apLength=14, range=58)

Initialize 14 APs, with ap1 operating in 2.4GHz mode g, range 150 and remaining APs operating 5GHz mode ax5 range 60:
        for i in range(14):
            if i == 0:
                AP = net.addAccessPoint(f"ap{i+1}", cls=OVSKernelAP, ssid=f'ap{i+1}-ssid',
                                 channel=1, mode='g', position=positions[i], range=150)
            else:
                AP = net.addAccessPoint(f"ap{i+1}", cls=OVSKernelAP, ssid=f'ap{i+1}-ssid',
                                 channel=APChannelList[i-1], ht_capab='[HE20][SHORT-GI-20]', mode='ax5', position=positions[i], range=60)
            APs.append(AP)
add controller
configure wifi nodes
create links
        info("*** Creating links\n")
        for i in range(APLengths[ap_index]-1):
            net.addLink(APs[i], APs[i+1])
plot graph
set mobility model
        if '-s' not in args:
            net.setMobilityModel(time=0, model='RandomDirection', min_x=-50, min_y=-50, max_x=150, max_y=150, seed=6)
start network and use iw to set mcs:
        info("*** Starting network\n")
        net.build()
        c1.start()
        for ap in APs:
            ap.start([c1])
            for iface in ['wlan0', 'wlan1']:
                response = ap.cmd(f"iw dev {ap.name}-{iface} link")
                if 'Not connected.' not in response:
                    # Set the desired MCS index value. Here using VHT MCS index 7 as an example.
                    mcs_value = 7
                    ap.cmd(f"iw dev {ap.name}-{iface} set bitrates vht-mcs-5 {mcs_value}")
                    info(f"Set MCS {mcs_value} on {ap.name}-{iface}\n")
                    break
        info("*** Running CLI\n")
        CLI(net)
        info("*** Stopping network\n")
        net.stop()
if __name__ == '__main__':
    setLogLevel('info')
    netTopo.topology(sys.argv)

Ramon Fontes

unread,
Sep 7, 2024, 11:47:23 AM9/7/24
to Pavan Kumar Mangipudi, mininet-wifi-discuss
Please don't use code for that. Prefer to use iw manually. Then, you can code after some validation steps.
Reply all
Reply to author
Forward
0 new messages