[ovs-discuss] Help in understanding the code

sujith p s sujithpandels at gmail.com
Sun Jul 14 06:14:16 UTC 2013


Really sorry to bother you guys once again. ( I guess this won't be the
last time :P )
I'm taking small steps into the code. Especially the kernel part.

Consider the topology:$sudo mn --topo linear --switch=ovsk
h1 -- s1 -- s2 -- h2

h1 is connected to s1-eth1.
h2 is connected to s2-eth1.

$ovs-dpctl show:
Port numbering in ovs: for linear topology:
    port 0: ovs-system (internal)
    port 1: s1 (internal)
    port 2: s1-eth1
    port 3: s1-eth2
    port 4: s2 (internal)
    port 5: s2-eth1
    port 6: s2-eth2

Say at switch s2:
When the controller sends the flow-mod for h1 ping h2 saying
if input port:2 <eth-address>:<etc> then output port:1 ;
These port numbers of s2:(1,2) shall be mapped to Openflow port
numbers:(5,6) as listed by ovs-dpctl show.

Tracing dp_process_received_packet() --calls--> ovs_execute_actions() -->
do_output().
I check the port numbers given as input parameter to the do_output() and
see that they are already mapped to Openflow ports.
Ex: For h1 ping h2, input to do_output were numbered as 2,3,5 and 6.

Getting prev_port = nla_get_u32(a);
Won't this retrieve port numbers as (1,2) in the above mentioned case?

So, where exactly does this mapping happen then?
ovs_lookup_vport()?  //Called by dp_ouput()




On Thu, Jul 11, 2013 at 7:50 PM, sujith p s <sujithpandels at gmail.com> wrote:

> Yes! That made it work as expected. Thanks!
> Found out that this command was mentioned in the older version of document
> in Internet (INSTALL.Linux).
>
> Running $sudo insmod datapath/linux/openvswitch.ko
> showed 'Unknown symbol in the module" error at first. Searching the
> archive of this mailing list gave me a workaround:
> http://openvswitch.org/pipermail/dev/2013-June/029007.html
> The mentioned workaround worked fine for me. Haven't looked into the
> mentioned patch yet.
>
> Thanks for the help.
>
> Regards,
> Sujith
>
>
>
>
>
> On Thu, Jul 11, 2013 at 1:45 PM, Justin Pettit <jpettit at nicira.com> wrote:
>
>> Are you sure modprobe picked up your new kernel module?  You may want to
>> try running insmod with the path to your new ".ko".
>>
>> --Justin
>>
>>
>> On Jul 11, 2013, at 12:56 AM, sujith p s <sujithpandels at gmail.com> wrote:
>>
>> Need a hand here..Please..
>>
>> Installed OpenvSwitch at first.Worked as expected.
>> Later made a few, small changes (basically, inserting printk statements)
>> in the ovs_dp_process_received_packet() of datapath.c in datapath directory.
>>
>> I compile using following commands:
>> sudo kill `cd /usr/local/var/run/openvswitch && cat ovsdb-server.pid
>> ovs-vswitchd.pid`
>> ./boot.sh
>> ./configure
>> ./configure --with-linux=/lib/modules/3.5.0-17-generic/build
>> make
>> sudo make install
>> sudo make modules_install
>> sudo /sbin/modprobe openvswitch
>> lsmod --> shows openvswitch
>>
>>
>> Then start daemons using commands:
>> sudo ovsdb-tool convert /usr/local/etc/openvswitch/conf.db
>> vswitchd/vswitch.ovsschema
>> sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock <
>> etc > < etc > --pidfile --detach
>> sudo ovs-vsctl --no-wait init
>> sudo ovs-vswitchd --pidfile --detach
>>
>> Everything goes fine.
>>
>> But I am unable to see my changes after running the "$sudo mn
>> --switch=ovsk" and tried ping command in mininet.
>> mininet> h1 ping -c5 h2
>> Checked dmesg and syslog.
>> Am I going wrong somewhere in dealing with ovs kernel modules?
>> ( printk statements are having KERN_INFO severity. Ex: printk(KERN_INFO
>> "Received packet..Trying to match the flow.."); )
>>
>> Thanks in advance,
>> Sujith
>>
>>
>> On Wed, Jul 10, 2013 at 10:12 PM, sujith p s <sujithpandels at gmail.com>wrote:
>>
>>> Thanks for the quick reply!
>>>
>>> Regarding the reason for not getting error for VLOG_INFO in my datapath
>>> module:
>>> Backtracing my steps, I found out that i missed configuring/make-ing the
>>> kernel modules after the code changes.
>>> Thanks for suggesting printk option.
>>>
>>>
>>> Regards,
>>> Sujith
>>>
>>>
>>> On Wed, Jul 10, 2013 at 8:08 PM, Andy Zhou <azhou at nicira.com> wrote:
>>>
>>>> The remaining icmp packets are indeed processed in the kernel (via
>>>> ovs_dp_process_received_packet()). ovs-vswitchd will install a flow entry
>>>> in the kernel to handle those packets.
>>>> You can inspect kernel flows with "ovs-dpctl dump-flows".
>>>>
>>>> VLOG_INFO is only for user space programs. I am surprised it compiled
>>>> with kernel module. printk may work better.
>>>>
>>>> --andy
>>>>
>>>>
>>>>  On Wed, Jul 10, 2013 at 4:20 AM, sujith p s <sujithpandels at gmail.com>wrote:
>>>>
>>>>>  Hi everyone!
>>>>> I'm a newcomer to OpenvSwitch. I installed it in mininet-VM using the
>>>>> INSTALL guide provided.
>>>>> I am curious to understand the flow of the code in case of ping.
>>>>>
>>>>> Example topology:
>>>>> $ sudo mn --switch=ovsk --topo linear
>>>>>
>>>>>  h1 -- s1 -- s2 -- h2
>>>>>
>>>>> command:
>>>>> mininet> h1 ping -c5 h2
>>>>>
>>>>> ofproto_run recognises a new flow ( 1st ping packet - icmp echo from
>>>>> h1 to h2 ) and send it as PACKET_IN to the controller.
>>>>> Controller sends back the respective FLOW_MOD back to switch s1.
>>>>> handle_openflow() function takes care of these things.
>>>>> Similarly above 2 steps happens for icmp echo reply from h2 to h1.
>>>>>
>>>>> Now, I understand that since flow_mods are already installed in the
>>>>> flow table, there's no need to contact the controller once again for the
>>>>> 2nd icmp-echo packet from h1 to h2.
>>>>>
>>>>> What I wanted to know is which module(s) manages the remaining icmp
>>>>> packets, i.e. checking for a match and do the forwarding of these packets
>>>>> through mentioned port of the switch.
>>>>>
>>>>> It looks like ovs_dp_process_received_packet() in datapath.c So I
>>>>> tried checking by inserting VLOG_INFO statements in the module and
>>>>> installed it again. Looks like I was wrong about that.
>>>>>
>>>>> I wanted to make sure that I am in the correct path.
>>>>>
>>>>> Can anyone help me please!
>>>>>
>>>>> Thanks in advance
>>>>> Sujith
>>>>>
>>>>> _______________________________________________
>>>>> discuss mailing list
>>>>> discuss at openvswitch.org
>>>>> http://openvswitch.org/mailman/listinfo/discuss
>>>>>
>>>>>
>>>>
>>>
>> _______________________________________________
>> discuss mailing list
>> discuss at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/discuss
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20130714/5f92b160/attachment.html>


More information about the discuss mailing list