[ovs-discuss] Regarding where function pointers in netdev_class/tc_ops hook to their implementations?

YoungTae Noh devbabopol at gmail.com
Thu Apr 16 01:26:29 UTC 2015


Hi Ben and all,

Thank you for the quick turnaround. I believe my previous explanation
was not very clear.

Here is my objective:
>> I would like to implement/manipulate queueing priority (possibly multiple queues per port in a shared memory) by user-definition.

Please correct me if my understanding/approach is wrong.
To realize this - control this type of queue from OVS cmd (or controller),
1. I need add expression for this type of queue in ovs-vsctl cmd (or
ovsdb client)
2. add an option field (for this type of queue) in ovsdb
3. ovs-vswitdhd dispatches it to  ofproto->netdev(lib)->netdev-linux
4. extending netdev-linux to allocate&construct this queue in linux
kernel implementation ==> I believe I am standing here with the
question! (also not sure hooking is correct term here)
5. extend queue & its management implementation (socket buffer in linux kernel)

Here is a very specific example:
struct netdev_rxq *(*rxq_alloc)(void);

This will allocate a queue for an interface (netdev) in user-sapce. I
believe this rxq_alloc will actually allocate a queue (FIFO) to a
physical/virtual port in linux kernel (socket buffer). I would like to
know which function is actually executed in kernel space and how they
are interacting each other.

Thanks in advance.
YoungTae




On Wed, Apr 15, 2015 at 12:04 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Wed, Apr 15, 2015 at 12:05:09PM -0400, YoungTae Noh wrote:
>> Hello,
>>
>> I would like to implement/manipulate queueing priority (possibly
>> multiple queues per port in a shared memory) by user-definition.
>>
>> To this end, I browsed 2.3.1 OVS codebase from adding a port (from
>> ovsdb or ova-vsctl cmd) as a queue is also allocated by default.
>>
>> At the end of user-sapce, adding a port is done by
>> netdev_open(iface_cfg->name, iface_get_type(iface_cfg, br->cfg),
>> &netdev);
>>
>> In this function:
>> Interface allocation: netdev->netdev_class->alloc();
>> Queue alloction:
>> /* By default enable one rx queue per netdev. */
>>                 if (netdev->netdev_class->rxq_alloc) {
>>                     netdev->n_rxq = 1;
>>                 } else {
>>                     netdev->n_rxq = 0;
>>                 }
>>                 list_init(&netdev->saved_flags_list);
>>                 error = rc->class->construct(netdev);
>> Construction of Interfade: netdev->netdev_class->construct(netdev);
>>
>> Here is my question below:
>>
>> Question) how the function pointer (of
>> netdev->netdev_class->rxq_alloc) is hooked to actual linux
>> implementation? I believe all the function pointers in the struct
>> netdev_class need to be defined later for a specific hardware. I
>> cannot find the location where hooking is really happening.
>>
>> I believe this is the same question (correct me if netdev_class and
>> tc_ops follow different hooking mechanisms). I would like to
>> understand the hooking mechanism for function pointers in struct
>> tc_ops (such as class_set for queueID, qdisc_set for QoS type).
>
> I think that you're looking for the static definitions of
> netdev_linux_class, etc., and of tc_ops_htb, etc., in
> lib/netdev-linux.c.  They are easy to find; I'm not sure why you don't
> see them.



More information about the discuss mailing list