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

YoungTae Noh devbabopol at gmail.com
Wed Apr 15 16:05:09 UTC 2015


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).

Thanks,
YoungTae



More information about the discuss mailing list