virtio-net: Add check for mac address while peer is vdpa
PATCH 1/1 virtio-net: Add check for mac address while peer is vdpa
Sometime vdpa get an all 0 mac address from the hardware, this will cause the traffic down So we add the check for this part.
if we get an 0 mac address we will use the default mac address instead
--- hw/net/virtio-net.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +6 -1
@@ -126,6 +126,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)VirtIONet *n =VIRTIO_NET (vdev);struct virtio_net_config netcfg;NetClientState *nc =qemu_get_queue (n->nic); +static const MACAddr zero = { .a = {0 ,0 ,0 ,0 ,0 ,0 } };int ret =0 ;memset (&netcfg,0 ,sizeof (struct virtio_net_config ));
@@ -151,7 +152,11 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config) ret =vhost_net_get_config (get_vhost_net (nc->peer), (uint8_t *)&netcfg, n->config_size);if (ret !=-1 ) { -memcpy (config, &netcfg, n->config_size); +if (memcmp (&netcfg.mac, &zero,sizeof (zero)) !=0 ) { +memcpy (config, &netcfg, n->config_size); + }else { +error_report ("Get an all zero mac address from hardware" ); + } } } }
Signature · 1 line
2.21.3
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [PATCH] virtio-net: Add check for mac address while peer is vdpa
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/160343854912.8460.17915238517799132371.stgit@pasha-ThinkPad-X280 -> patchew/160343854912.8460.17915238517799132371.stgit@pasha-ThinkPad-X280 - [tag update] patchew/[email protected] -> patchew/[email protected] - [tag update] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
e1cc13b virtio-net: Add check for mac address while peer is vdpa
=== OUTPUT BEGIN ===
ERROR: Missing Signed-off-by: line(s)
total: 1 errors, 0 warnings, 19 lines checked
Commit e1cc13b8bc77 (virtio-net: Add check for mac address while peer is vdpa) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]