On Wed, Jun 10, 2015 at 6:23 PM, John Fastabend
<john.fastab...@gmail.com> wrote:
> On 06/10/2015 07:59 AM, Or Gerlitz wrote:
>>
>> From: Eran Ben Elisha <era...@mellanox.com>
>>
>> Add ndo_get_vf_stats where the PF retrieves and fills the VFs traffic
>> statistics. Add rtnl_link_vf_stats64 for passing the VF statistics from
>> the PF to user-space.
>>
>> Signed-off-by: Eran Ben Elisha <era...@mellanox.com>
>> Signed-off-by: Hadar Hen Zion <had...@mellanox.com>
>> Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
>> ---
>>   include/linux/netdevice.h    |    4 ++++
>>   include/uapi/linux/if_link.h |   11 +++++++++++
>>   net/core/rtnetlink.c         |   12 ++++++++++--
>>   3 files changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 6f5f71f..b1d3b88 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -1100,6 +1100,10 @@ struct net_device_ops {
>>                                                      struct ifla_vf_info
>> *ivf);
>>         int                     (*ndo_set_vf_link_state)(struct net_device
>> *dev,
>>                                                          int vf, int
>> link_state);
>> +       int                     (*ndo_get_vf_stats)(struct net_device
>> *dev,
>> +                                                   int vf,
>> +                                                   struct
>> rtnl_link_vf_stats64
>> +                                                   *vf_stats);
>>         int                     (*ndo_set_vf_port)(struct net_device *dev,
>>                                                    int vf,
>>                                                    struct nlattr *port[]);
>> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
>> index 1737b7a..9c25aeb 100644
>> --- a/include/uapi/linux/if_link.h
>> +++ b/include/uapi/linux/if_link.h
>> @@ -70,6 +70,16 @@ struct rtnl_link_stats64 {
>>         __u64   tx_compressed;
>>   };
>>
>> +/* VF statistics structure */
>> +struct rtnl_link_vf_stats64 {
>> +       __u64   rx_packets;             /* total packets received       */
>> +       __u64   tx_packets;             /* total packets transmitted    */
>> +       __u64   rx_bytes;               /* total bytes received         */
>> +       __u64   tx_bytes;               /* total bytes transmitted      */
>> +       __u64   broadcast;              /* broadcast packets received   */
>> +       __u64   multicast;              /* multicast packets received   */
>> +};
>
>
> Can we encode this in a nested netlink structure when its passed
> up to userspace? I have more stats I would like to export in the
> future such as dropped packets and if we put the structure in the UAPI
> we wont be able to easily extend this.

Yep, makes sense, I asked Eran to look on doing so.

> The structure could be moved into ./include/linux/if_link.h though.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to