[ovs-dev] How to tell which code is for userspace

ted.y.liang at gmail.com ted.y.liang at gmail.com
Tue Aug 1 14:39:38 UTC 2017


Thanks. 

But there is a function in datapath/vport.c, as below:
struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
                          const struct vport_parms *parms)
{
        struct vport *vport;
        size_t alloc_size;

        alloc_size = sizeof(struct vport);
        if (priv_size) {
                alloc_size = ALIGN(alloc_size, VPORT_ALIGN);
                alloc_size += priv_size;
        }

        vport = kzalloc(alloc_size, GFP_KERNEL);
        if (!vport)
                return ERR_PTR(-ENOMEM);

        vport->dp = parms->dp;
        vport->port_no = parms->port_no;
        vport->ops = ops;
        INIT_HLIST_NODE(&vport->dp_hash_node);

        if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) {
                kfree(vport);
                return ERR_PTR(-EINVAL);
        }

        return vport;
}

It uses kzalloc. Does not that mean it is part of the kernel code?

Br,

Ted
From: Russell Bryant
Sent: Tuesday, August 1, 2017 10:12 PM
To: ted.y.liang at gmail.com
Cc: ovs-dev at openvswitch.org
Subject: Re: [ovs-dev] How to tell which code is for userspace

On Tue, Aug 1, 2017 at 10:01 AM,  <ted.y.liang at gmail.com> wrote:
> Dear all,
>
> I am reading ovs 2.7.90 code, do you have a quick way to tell which code is for userspace and which for kernel?

The ovs/datapath/linux/ directory is the Linux kernel datapath code.
The rest is userspace (with the exception of the Windows datapath
code).

-- 
Russell Bryant



More information about the dev mailing list