Hi Monica,

Take a look at vport-netdev.c. When issuing add-port command, ovs_vport_add
calls netdev_create:
[root@vm-dev datapath]# ovs-vsctl add-port br5 eth0
    ovs-vswitchd-1804  [000] .... 10761.168537: netdev_create
<-ovs_vport_add

At initialization we register these callbacks
static struct vport_ops ovs_netdev_vport_ops = {
    .type       = OVS_VPORT_TYPE_NETDEV,
    .create     = netdev_create,
    .destroy    = netdev_destroy,
    .send       = dev_queue_xmit,
};

So when netdev_create is invoked, it does the following
    ovs_vport_alloc()
    ovs_netdev_link()
        // Register a receive handler for a device. This handler will then
be
        // called from __netif_receive_skb.
        // ovs_netdev_link has a parameter 'name' specifying device name,
then it register a receive handler by calling
           netdev_rx_handler_register(vport->dev, netdev_frame_hook, vport)

So our call back "netdev_frame_hook" will receive a packet from the device
'name'. If you keep tracing the code, it will call into

    ovs_vport_receive - pass up received packet to the datapath for
processing


And ovs_vport_send calls
    vport->opvs->send
        .send       = dev_queue_xmit,

              dev_queue_xmit_sk(skb->sk, skb);

Regards,
William


On Thu, Mar 10, 2016 at 12:54 PM, Rajasekaran, Monica <
monica.rajaseka...@us.fujitsu.com> wrote:

> Thanks for pointing that out David.
>
> One more question: When we add-port using vsctl, that gets added to the
> bridge and lets us map to a physical port right. So, where does vport come
> in here ? I mean, how does it map with the physical port? I see from the
> code that vports are used to receive packets coming to the switch
> (ovs_vport_receive) and to send (ovs_vport_send).
>
> Thanks,
> Monica
>
>
> -----Original Message-----
> From: discuss [mailto:discuss-boun...@openvswitch.org] On Behalf Of
> dsa...@cs.technion.ac.il
> Sent: Wednesday, March 09, 2016 8:05 PM
> To: discuss@openvswitch.org
> Subject: Re: [ovs-discuss] Queuing a packet to user space
>
> Hi Monica,
>
> The messaging mechanism that OVS is using is provided by the operating
> system, OVS doesn't implement it, it just uses and invokes it.
>
> cheers,
>
> David.
>
> > Hi all,
> >
> > Once call in the data path hits queue_userspace_packet(), how is the
> > packet received by user space ?
> >
> > I understand that recv_upcalls-->dpif_recv() and handle_upcalls() will
> > take care of upcall processing.
> >
> > But how are queue_userspace_packet() in the data path and
> > recv_upcalls() in the user space connected? I can't seem to find the
> link.
> >
> > Thanks,
> > Monica
> >
> > _______________________________________________
> > discuss mailing list
> > discuss@openvswitch.org
> > http://openvswitch.org/mailman/listinfo/discuss
> >
>
>
> _______________________________________________
> discuss mailing list
> discuss@openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss
> _______________________________________________
> discuss mailing list
> discuss@openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss
>
_______________________________________________
discuss mailing list
discuss@openvswitch.org
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to