[ovs-dev] [PATCH] netdev: Swap transmit and receive stats on internal ports.

Jesse Gross jesse at nicira.com
Mon Sep 14 21:39:46 UTC 2009



Ben Pfaff wrote:
> Jesse Gross <jesse at nicira.com> writes:
>
>   
>> +    if (dpif && !internal_port) {
>> +        struct odp_port port;
>> +
>> +        error = dpif_port_query_by_name(dpif, netdev_get_name(&netdev->netdev),
>> +                                        &port);
>> +        if (!error) {
>> +            internal_port |= port.flags & ODP_PORT_INTERNAL;
>> +        }
>> +    }
>>     
>
> It's pretty awkward to have to add a dpif parameter to this
> function.  Not pretty at all.
>
> I think we can avoid it, though.  Datapath internal ports can be
> identified with the Ethtool operation ETHTOOL_GDRVINFO: the
> driver name is "openvswitch".  This is what lookup_minor() in
> dpif-linux.c does.
>
>   

Yeah, I knew that adding dpif parameter was really ugly.  Thanks for 
pointing out the Ethtool operation - it is much cleaner.

> When you change this code to do that you should also add a cache
> bit for whether a port is internal (VALID_IS_INTERNAL?) and a
> cache member to struct netdev_linux_cache (is_internal?), so that
> we don't have to check more than once in the common case.
>   

I made both of these changes and pushed.




More information about the dev mailing list