Thread (39 messages) 39 messages, 6 authors, 2014-01-14

Re: [PATCH net-next v2 4/4] virtio-net: initial debugfs support, export mergeable rx buffer size

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2014-01-13 09:40:18
Also in: virtualization

On Sun, Jan 12, 2014 at 03:32:28PM -0800, Michael Dalton wrote:
Hi Michael,

On Sun, Jan 12, 2014 at 9:09 AM, Michael S. Tsirkin [off-list ref] wrote:
quoted
Can't we add struct attribute * to netdevice, and pass that in when
creating the kobj?
I like that idea, I think that will work and should be better than
the alternatives. The actual kobjs for RX queues (struct netdev_rx_queue)
are allocated and deallocated by calls to net_rx_queue_update_kobjects,
which resizes RX queue kobjects when the netdev RX queues are resized.

Is this what you had in mind:
(1) Add a pointer to an attribute group to struct net_device, used for
    per-netdev rx queue attributes and initialized before the call to
    register_netdevice().
(2) Declare an attribute group containing the mergeable_rx_buffer_size
    attribute in virtio-net, and initialize the per-netdevice group pointer
    to the address of this group in virtnet_probe before register_netdevice
(3) In net-sysfs, modify net_rx_queue_update_kobjects
    (or rx_queue_add_kobject) to call sysfs_create_group on the
    per-netdev attribute group (if non-NULL), adding the attributes in
    the group to the RX queue kobject.

Exactly.
That should allow us to have per-RX queue attributes that are
device-specific. I'm not a sysfs expert, but it seems that rx_queue_ktype
and rx_queue_sysfs_ops presume that all rx queue sysfs operations are
performed on attributes of type rx_queue_attribute. That type will need
to be moved from net-sysfs.c to a header file like netdevice.h so that
the type can be used in virtio-net when we declare the
mergeable_rx_buffer_size attribute.

The last issue is how the rx_queue_attribute 'show' function
implementation for mergeable_rx_buffer_size will access the appropriate
per-receive queue EWMA data. The arguments to the show function will be
the netdev_rx_queue and the attribute itself. We can get to the
struct net_device from the netdev_rx_queue.  If we extended
netdev_rx_queue to indicate the queue_index or to store a void *priv_data
pointer, that would be sufficient to allow us to resolve this issue.
Hmm netdev_rx_queue is not defined unless CONFIG_RPS is set.
Maybe we should use a different structure.

Please let me know if the above sounds good or if you see a better way
to accomplish this goal. Thanks!

Best,

Mike
Sounds good to me.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help