Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-mediums for packet queue isolation #9

Merged
merged 11 commits into from May 25, 2022

Conversation

onurklngc
Copy link

Dear Professor Fontes,

In a packet delay calculation, the packet queues of all stations are taken into account for the packet sequence. This leads to drastically reduced throughput estimations when there are multiple traffic loads, even if some stations, APs are far apart.

Separate_networks
For instance, running iperf between sta1&sta2 halves the output of iperf estimation between sta3&sta4 or sta5&sta6.

In order to isolate networks, station queues are grouped by assigning medium IDs to stations. By default, all stations are assigned to the medium #0 so the current behavior shall be experienced if no medium config is given.

I will be creating another PR for mininet-wifi, as well.

Sincerely,
Onur

@ramonfontes
Copy link
Owner

This is really interesting. I have a question: what would be the behavior in a scenario with mobility?

@onurklngc
Copy link
Author

Station medium IDs can be reassigned to new ones via wserver dynamically according to their position.

@ramonfontes
Copy link
Owner

Let's take the interference model as an example: can the PR do this dynamically? How?

@onurklngc
Copy link
Author

onurklngc commented Dec 21, 2021

Let's take the interference model as an example: can the PR do this dynamically? How?

I hadn't taken interference into account. In the latest commit I also added medium ID filtering for interference calculations. Did you mention this case?

By the way, since there are opposite controls on

if (signal < CCA_THRESHOLD)

and
if (signal >= CCA_THRESHOLD)

this control always return 0:
if (set_interference_duration(ctx,

Shall we remove the control or can there be a bug?

@ramonfontes
Copy link
Owner

I hadn't taken interference into account. In the latest commit I also added medium ID filtering for interference calculations. Did you mention this case?

hmm.. not convinced. My concern is with dynamic scenarios. For example, with the interference model the propagation model calculates the RSSI taking into account the distance. Wmediumd can calculcate the distance because it knows the position of the nodes.

That said, please correct me if i am wrong. We can set the medium_id and it works in a static scenario. However, if the node moves towards a new cell, what would happen? Can wmediumd update the medium_id?

@onurklngc
Copy link
Author

onurklngc commented Dec 21, 2021

We can set the medium_id and it works in a static scenario.

Yes; for this case, adding medium definition array to cfg file is enough.

However, if the node moves towards a new cell, what would happen? Can wmediumd update the medium_id?

User should manually set medium_id of the new cell to the moved node. Socket server handles medium_id change event. Similar to gain, position data, etc; medium_id is also stored in the corresponding station object in order to prevent extra array manipulations for such dynamic cases.

https://user-images.githubusercontent.com/22586149/146854988-47976b41-79f6-40ad-a121-1d783da1e1c6.png
For example, if we move sta1 within range of AP3, it will connect to AP3. The initial medium_id of sta1 was 1 and the medium_id of sta5, sta6 and AP3 is 3. The user should set the medium_id of sta1 to 3 to ensure the isolated packet ordering.
On Mininet-WiFi, user could call sta3.setMediumId(3) for that purpose.

@ramonfontes
Copy link
Owner

ramonfontes commented Dec 21, 2021

User should manually set medium_id of the new cell to the moved node.

That's my concern. Ok, it works fine but with some user intervention. What if you consider the BSSID as reference for the medium_id? We know when the node is AP with ->isap, right? Would it be feasible? What is your opinion?

@onurklngc
Copy link
Author

onurklngc commented Dec 21, 2021

You are right, an autonomous system would be much better.

It is possible to get the following data for a mesh network(see the figure below):
Packet from 00:00:00:00:00:11(0|Sta) to 42:00:00:00:04:00(4|AP)
Packet from 02:00:00:00:05:00(5|AP) to 42:00:00:00:07:00(7|AP)
Packet from 02:00:00:00:07:00(7|AP) to 42:00:00:00:05:00(5|AP)
Packet from 02:00:00:00:06:00(6|AP) to 42:00:00:00:02:00(2|Sta)

Suppose i and j represent sta indices.

  • For Stai-APj packets, we can assign the medium_id of APj and Stai j + 1 (+1 since they are initially 0). As I understand, you suggest these. I think it can be done.

  • I believe problematic cases are Adhoc & Mesh groups. For APi-APj mesh packets with i < j we can assign the medium_id of APj to j + 1 if j + 1 is greater than the current medium_id. Then set the APis to the medium_id of APj. This would work for initialization even if there are more than 2 mesh APs on the same network. However, this method cannot be used to track changes as they move or their mesh configuration changes. For example, let's assume that AP1, AP2, AP3, AP4 with 5,6,7,8 sta indices initially share the same network and programmatically we set medium_id to 9 for all of them. Then user moves AP2 and AP4 somewhere far away from others. The traffic between AP1 & AP3 and AP2 & AP4 would continue to influence each other. Do you think there could be a better assignment for these?

We could perhaps have a semi-automatic model, handle the assignment of sta-ap medium_id programmatically, and leave the special cases to the user.

mesh

@ramonfontes
Copy link
Owner

ramonfontes commented Dec 22, 2021

I was actually thinking of getting the BSSID from the kernel. I think we can do this for mesh, adhoc and any other wifi mode. For example, here we have the frequency. We can also have the signal, tx, rx, etc. cfg80211 may help with this task.

@onurklngc
Copy link
Author

Hi Dr. Fontes,
As I saw from wireshark, BSSID is retrievable from under "IEEE 802.11 Data" for sta-ap connection. On the other hand, I could not find BSSID on the mesh connection packets except beacon ones, but packet path data is available under "IEEE 802.11 QoS Data" for them. Considering a line topology with meshed 4+ APs, how do we group them? As I know, all of the mesh intfs should share the same medium.

On the image left side is from station, right is from AP's mesh intf.
BSSID

@ramonfontes
Copy link
Owner

ramonfontes commented Dec 24, 2021

Cannot we identify different Groups through NL80211_ATTR_MESH_ID?

@onurklngc
Copy link
Author

Yes, we can retrieve mesh_id from beacon packets for each mesh interface.

mesh_id

Only case bothers me, separated networks with the same mesh id. We still could cluster them by detecting connected pairs from the channel model. Network change detection could be triggered by position, gain, mesh_id change events.

@ramonfontes
Copy link
Owner

Only case bothers me, separated networks with the same mesh id.

Yes. It seems that there is no way to accomplish this through the kernel.

But I think we can still automate the other wifi modes

@onurklngc
Copy link
Author

onurklngc commented Dec 26, 2021

nl: cmd 2, seq 1640547164: Invalid argument
nl: cmd 2, seq 1640547165: Invalid argument
nl: cmd 2, seq 1640547167: Invalid argument
...

On some occasions the program keeps throwing the error above, is it related to parsing packets from hwsim? In the separate network, printing is stopped after 5-10 seconds, but not in the case of mesh networks. I had to set the log level to debug to prevent excessive CPU usage.

I have added medium change detection support for station AP connections by checking packet source and destination. Related commit: 6651d29
Detection is enabled by default, but can be disabled from config file by setting ifaces.enable_medium_detection to false.

Initial assignment of sta5 with MAC address 00:00:00:00:00:15:
medium_1

After changing position of sta5 from Mininet-Wifi, its medium id is set to -8, same with newly associated AP's:
medium_2

@onurklngc
Copy link
Author

Update on Invalid argument error, it is not related to mesh. Even lines with add mesh links are removed, still observed the nonstop logs in the following one:

#!/usr/bin/python

'This example shows how to create wireless link between two APs'

from mininet.log import setLogLevel, info
from mininet.node import RemoteController, Controller
from mn_wifi.cli import CLI
from mn_wifi.link import wmediumd, mesh
from mn_wifi.net import Mininet_wifi
from mn_wifi.wmediumdConnector import interference

IS_REMOTE_CONTROLLER = False


def topology():
    "Create a network."
    net = Mininet_wifi(controller=RemoteController if IS_REMOTE_CONTROLLER else Controller,
                       link=wmediumd, wmediumd_mode=interference, xterms=True)

    info("*** Creating nodes\n")

    sta1 = net.addStation('sta1', mac='00:00:00:00:00:11', position='125,1,0')
    sta2 = net.addStation('sta2', mac='00:00:00:00:00:12', position='151,51,0')
    ap1 = net.addAccessPoint('ap1', wlans=2, ssid='ssid1', position='300,10,0', channel=6)
    sta3 = net.addStation('sta3', mac='00:00:00:00:00:13', position='675,11,0')
    sta4 = net.addStation('sta4', mac='00:00:00:00:00:14', position='651,52,0')
    ap2 = net.addAccessPoint('ap2', wlans=2, ssid='ssid2', position='500,10,0', channel=5)
    sta5 = net.addStation('sta5', mac='00:00:00:00:00:15', position='851,52,0')
    ap3 = net.addAccessPoint('ap3', wlans=2, ssid='ssid3', position='700,10,0', channel=5)
    h1 = net.addHost('h%d' % 1, mac='00:00:00:00:00:' + hex(1).split('x')[-1].zfill(2))
    h2 = net.addHost('h%d' % 2, mac='00:00:00:00:00:' + hex(2).split('x')[-1].zfill(2))
    if IS_REMOTE_CONTROLLER:
        c0 = net.addController(name='c0',
                               controller=RemoteController,
                               ip='127.0.0.1',
                               protocol='tcp',
                               port=6653, protocols="OpenFlow13")
    else:
        c0 = net.addController(name='c0', port=6654)
    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=3)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Associating Stations\n")

    # net.addLink(ap1, sta1, ht_cap='HT40+')
    # net.addLink(ap2, sta2, ht_cap='HT40+')
    net.addLink(h1, ap1, bw=100, delay='0ms')
    net.addLink(h2, ap2, bw=100, delay='0ms')
    net.addLink(ap1, intf='ap1-wlan2', cls=mesh, ssid='mesh-ssid', mode="ac", channel=40)
    net.addLink(ap2, intf='ap2-wlan2', cls=mesh, ssid='mesh-ssid', mode="ac", channel=40)
    net.addLink(ap3, intf='ap3-wlan2', cls=mesh, ssid='mesh-ssid', mode="ac", channel=40)
    info("*** Starting network\n")
    net.plotGraph(max_x=1000, max_y=500, min_x=-70, min_y=-70)
    net.build()
    c0.start()
    ap1.start([c0])
    ap2.start([c0])
    ap3.start([c0])
    print("AP1 radius %f" % ap1.get_max_radius())
    net.plotGraph(max_x=3000, max_y=1000)
    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()


if __name__ == '__main__':
    setLogLevel('debug')
    topology()

@ramonfontes
Copy link
Owner

On some occasions the program keeps throwing the error above, is it related to parsing packets from hwsim?

I really don't know. This might also be related to the kernel version. Well, we need to investigate this. Which Kernel version do you have and how can I reproduce that behaviour?

@onurklngc
Copy link
Author

It may be so, my kernel is 5.15.8-76051508-generic.

Log level is set to 0 with "-l 0" on WStarter.start() method. After removing it, you may start the topology script above and tail wmediumd log file. I observed the same logs with main branch as well, so no need to checkout. I couldn't figure out if this error has an effect on the system, but I can say it doesn't prevent traffic like pinging.

@ramonfontes
Copy link
Owner

Hi @onurklngc,

Sorry for replying late. Did you get the problem solved? Have you made any progress towards automated configuration?

@onurklngc
Copy link
Author

Hi Dr. Fontes,

No problem at all. I have been using the project regularly for a while. nl: cmd 2, seq 1640547167: Invalid argument error logs don't affect the functionality, so I just supressed them. 6651d29, this one automates the most important one, AP-Sta medium configuration. I tested it as well.

This reverts commit 1feabad.
@ramonfontes ramonfontes merged commit 6b42593 into ramonfontes:mininet-wifi May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants