Questions about p4 bmv2 and mptcp

I am a p4 beginner, and I currently want to implement simple mptcp on p4 bmv2, I have installed the mptcp dependency of ubuntu20.04, and also installed the git clone of p4 tutorials.
I used the basic forwarding in the exercises on p4 tutorials to rewrite. The rewritten topology is shown in the picture. Regarding the code, I only changed s1-runtime.json and s2-runtime in the pod-topo folder .json, s3-runtime.json, s4-runtime.json, topology.json files, and then use the p4 file in the solution to execute. After changing the topology, I also executed it smoothly (mininet net and pingall), But my question is why the port (interface) on the host side does not have an ip address (only eth0 of h1 has it)?
I am sure that it is running on the ubuntu version of mptcp, and I also use wireshark to check that there is indeed mptcp traffic, but when I use the general single-tcp ubuntu, the experimental traffic and the throughput measured by the mptcp version of ubuntu are The same, is it because the port (eth1~eth3) of the host cannot be bound to the ip address?
Thank you everyone, I am Asian and my English is not very good, please forgive me

s1-runtime.json~s4-runtime.json are written in the same way!May I ask how to solve the problem that the host has multiple interfaces (eth0~eth3) bound to ipaddr? How should I write it on the topology.josn side? Thanks

Hi @shengyan , welcome to the forum.

This is a new case for me so let me understand it first.

This might be because you have to configure one IP per port (interface) in the exercise. This could be achieved by modifying the topology.json file. See that there is just a dictionary per host, see:

link: https://github.com/p4lang/tutorials/blob/master/exercises/basic/pod-topo/topology.json

And the code is:

"hosts": {
        "h1": { # <-(dict)
                 "ip": "10.0.1.1/24", "mac": "08:00:00:00:01:11",
                 "commands":["route add default gw 10.0.1.10 dev eth0",
                 "arp -i eth0 -s 10.0.1.10 08:00:00:00:01:00"]
              },
(...)

}

What you in reality need is a list, see:

"hosts": {
        "h1": [ #<-(list)
                  {"ip1": "10.0.1.1/24", "mac1": "08:00:00:00:01:11",
                   "commands1":["route add default gw 10.0.1.10 dev eth0",
                   "arp -i eth0 -s 10.0.1.10 08:00:00:00:01:00"]},
                  {"ip2": "10.0.2.1/24", "mac2": "08:00:00:00:01:12",
                   "commands2":["route add default gw 10.0.2.10 dev eth1",
                   "arp -i eth1 -s 10.0.2.10 08:00:00:00:02:00"]},
                  (...)
              ]
(...)
}

You also need to modify the file that parses topology.json, which is utils/run_exercise.py. Particularly from line 171 and on:

        self.logger('Reading topology file.')
        with open(topo_file, 'r') as f:
            topo = json.load(f)
        self.hosts = topo['hosts']
        self.switches = topo['switches']
        self.links = self.parse_links(topo['links'])

Your file has to detect that it gets a list, and the interfaces of the PC, and which IPs and so on. So there are a few more modifications here and there, not sure about the files though. Sorry for that.

This seems to be true. If I understood your issue, you need a different IP from a different subnet on each interface (maybe same subnet would work but I am unsure about how to run route in that case). In that way, if you configure different IPs from different subnets you can have one route command per interface, knowing that every packet from a different subnet can go via a different interface. If you configure the interfaces as explained, you might be able to ping from eth1 (left) to eth1 (right), eth2 (left) to eth2 (right) and so on (second image). Remember that s1-runtime.json and s2-runtime.json also need to be modified to forward the traffic as you expect, so that 10.0.1.1 and 10.0.2.1 (and the rest) can have different rules.

I hope I helped a little bit. Please do not say anything about your English, looks fine :slight_smile:

Good luck