• Xuan Zhuo's avatar
    virtio-net: support queue stat · d888f04c
    Xuan Zhuo authored
    To enhance functionality, we now support reporting statistics through
    the netdev-generic netlink (netdev-genl) queue stats interface. However,
    this does not extend to all statistics, so a new field, qstat_offset,
    has been introduced. This field determines which statistics should be
    reported via netdev-genl queue stats.
    
    Given that queue stats are retrieved individually per queue, it's
    necessary for the virtnet_get_hw_stats() function to be capable of
    fetching statistics for a specific queue.
    
    As the document https://docs.kernel.org/next/networking/statistics.html#notes-for-driver-authors
    
    We should not duplicate the stats which get reported via the netlink API in
    ethtool. If the stats are for queue stat, that will not be reported by
    ethtool -S.
    
    python3 ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml
        --dump qstats-get --json '{"scope": "queue"}'
    [{'ifindex': 2,
      'queue-id': 0,
      'queue-type': 'rx',
      'rx-bytes': 157844011,
      'rx-csum-bad': 0,
      'rx-csum-none': 0,
      'rx-csum-unnecessary': 2195386,
      'rx-hw-drop-overruns': 0,
      'rx-hw-drop-ratelimits': 0,
      'rx-hw-drops': 12964,
      'rx-packets': 598929},
     {'ifindex': 2,
      'queue-id': 0,
      'queue-type': 'tx',
      'tx-bytes': 1938511,
      'tx-csum-none': 0,
      'tx-hw-drop-errors': 0,
      'tx-hw-drop-ratelimits': 0,
      'tx-hw-drops': 0,
      'tx-needs-csum': 61263,
      'tx-packets': 15515}]
    Signed-off-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
    Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    d888f04c
virtio_net.c 158 KB