qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/10] Net patches
@ 2023-02-14  6:11 Jason Wang
  2023-02-14  6:11 ` [PULL 01/10] net: Move the code to collect available NIC models to a separate function Jason Wang
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Jason Wang

The following changes since commit f670b3eec7f5d1ed8c4573ef244e7b8c6b32001b:

  Merge tag 'migration-20230213-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-02-13 11:54:05 +0000)

are available in the git repository at:

  https://github.com/jasowang/qemu.git tags/net-pull-request

for you to fetch changes up to e4b953a26da11d214f91516cb9b0542eab5afaa0:

  vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check (2023-02-14 14:00:30 +0800)

----------------------------------------------------------------

----------------------------------------------------------------
Christian Svensson (1):
      net: Increase L2TPv3 buffer to fit jumboframes

Eugenio Pérez (1):
      vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check

Fiona Ebner (1):
      hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value

Joelle van Dyne (1):
      vmnet: stop recieving events when VM is stopped

Laurent Vivier (1):
      net: stream: add a new option to automatically reconnect

Qiang Liu (2):
      hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort
      hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo()

Thomas Huth (3):
      net: Move the code to collect available NIC models to a separate function
      net: Restore printing of the help text with "-nic help"
      net: Replace "Supported NIC models" with "Available NIC models"

 hw/net/can/xlnx-zynqmp-can.c |   9 +++-
 hw/net/lan9118.c             |  17 ++++----
 hw/net/vmxnet3.c             |   2 +-
 hw/pci/pci.c                 |  29 +------------
 include/net/net.h            |  14 ++++++
 net/l2tpv3.c                 |   2 +-
 net/net.c                    |  50 +++++++++++++++++++--
 net/stream.c                 |  53 ++++++++++++++++++++++-
 net/vhost-vdpa.c             |   2 +-
 net/vmnet-common.m           |  48 ++++++++++++++------
 net/vmnet_int.h              |   2 +
 qapi/net.json                |   7 ++-
 qemu-options.hx              |   6 +--
 tests/qtest/netdev-socket.c  | 101 +++++++++++++++++++++++++++++++++++++++++++
 14 files changed, 280 insertions(+), 62 deletions(-)



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PULL 01/10] net: Move the code to collect available NIC models to a separate function
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 02/10] net: Restore printing of the help text with "-nic help" Jason Wang
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Thomas Huth, Jason Wang

From: Thomas Huth <thuth@redhat.com>

The code that collects the available NIC models is not really specific
to PCI anymore and will be required in the next patch, too, so let's
move this into a new separate function in net.c instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/pci/pci.c      | 29 +----------------------------
 include/net/net.h | 14 ++++++++++++++
 net/net.c         | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 28 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 208c16f..cc51f98 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1789,7 +1789,6 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
                                const char *default_devaddr)
 {
     const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;
-    GSList *list;
     GPtrArray *pci_nic_models;
     PCIBus *bus;
     PCIDevice *pci_dev;
@@ -1804,33 +1803,7 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
         nd->model = g_strdup("virtio-net-pci");
     }
 
-    list = object_class_get_list_sorted(TYPE_PCI_DEVICE, false);
-    pci_nic_models = g_ptr_array_new();
-    while (list) {
-        DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, list->data,
-                                             TYPE_DEVICE);
-        GSList *next;
-        if (test_bit(DEVICE_CATEGORY_NETWORK, dc->categories) &&
-            dc->user_creatable) {
-            const char *name = object_class_get_name(list->data);
-            /*
-             * A network device might also be something else than a NIC, see
-             * e.g. the "rocker" device. Thus we have to look for the "netdev"
-             * property, too. Unfortunately, some devices like virtio-net only
-             * create this property during instance_init, so we have to create
-             * a temporary instance here to be able to check it.
-             */
-            Object *obj = object_new_with_class(OBJECT_CLASS(dc));
-            if (object_property_find(obj, "netdev")) {
-                g_ptr_array_add(pci_nic_models, (gpointer)name);
-            }
-            object_unref(obj);
-        }
-        next = list->next;
-        g_slist_free_1(list);
-        list = next;
-    }
-    g_ptr_array_add(pci_nic_models, NULL);
+    pci_nic_models = qemu_get_nic_models(TYPE_PCI_DEVICE);
 
     if (qemu_show_nic_models(nd->model, (const char **)pci_nic_models->pdata)) {
         exit(0);
diff --git a/include/net/net.h b/include/net/net.h
index fad589c..1d88621 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -203,6 +203,20 @@ void net_socket_rs_init(SocketReadState *rs,
                         bool vnet_hdr);
 NetClientState *qemu_get_peer(NetClientState *nc, int queue_index);
 
+/**
+ * qemu_get_nic_models:
+ * @device_type: Defines which devices should be taken into consideration
+ *               (e.g. TYPE_DEVICE for all devices, or TYPE_PCI_DEVICE for PCI)
+ *
+ * Get an array of pointers to names of NIC devices that are available in
+ * the QEMU binary. The array is terminated with a NULL pointer entry.
+ * The caller is responsible for freeing the memory when it is not required
+ * anymore, e.g. with g_ptr_array_free(..., true).
+ *
+ * Returns: Pointer to the array that contains the pointers to the names.
+ */
+GPtrArray *qemu_get_nic_models(const char *device_type);
+
 /* NIC info */
 
 #define MAX_NICS 8
diff --git a/net/net.c b/net/net.c
index 251fc5a..476a4b7 100644
--- a/net/net.c
+++ b/net/net.c
@@ -899,6 +899,40 @@ static int nic_get_free_idx(void)
     return -1;
 }
 
+GPtrArray *qemu_get_nic_models(const char *device_type)
+{
+    GPtrArray *nic_models = g_ptr_array_new();
+    GSList *list = object_class_get_list_sorted(device_type, false);
+
+    while (list) {
+        DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, list->data,
+                                             TYPE_DEVICE);
+        GSList *next;
+        if (test_bit(DEVICE_CATEGORY_NETWORK, dc->categories) &&
+            dc->user_creatable) {
+            const char *name = object_class_get_name(list->data);
+            /*
+             * A network device might also be something else than a NIC, see
+             * e.g. the "rocker" device. Thus we have to look for the "netdev"
+             * property, too. Unfortunately, some devices like virtio-net only
+             * create this property during instance_init, so we have to create
+             * a temporary instance here to be able to check it.
+             */
+            Object *obj = object_new_with_class(OBJECT_CLASS(dc));
+            if (object_property_find(obj, "netdev")) {
+                g_ptr_array_add(nic_models, (gpointer)name);
+            }
+            object_unref(obj);
+        }
+        next = list->next;
+        g_slist_free_1(list);
+        list = next;
+    }
+    g_ptr_array_add(nic_models, NULL);
+
+    return nic_models;
+}
+
 int qemu_show_nic_models(const char *arg, const char *const *models)
 {
     int i;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 02/10] net: Restore printing of the help text with "-nic help"
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
  2023-02-14  6:11 ` [PULL 01/10] net: Move the code to collect available NIC models to a separate function Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 03/10] net: Replace "Supported NIC models" with "Available NIC models" Jason Wang
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Thomas Huth, Jason Wang

From: Thomas Huth <thuth@redhat.com>

Running QEMU with "-nic help" used to work in QEMU 5.2 and earlier versions
(it showed the available netdev backends), but this feature got broken during
some refactoring in version 6.0. Let's restore the old behavior, and while
we're at it, let's also print the available NIC models here now since this
option can be used to configure both, netdev backend and model in one go.

Fixes: ad6f932fe8 ("net: do not exit on "netdev_add help" monitor command")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/net.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/net.c b/net/net.c
index 476a4b7..e8cd95c 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1542,8 +1542,18 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
     const char *type;
 
     type = qemu_opt_get(opts, "type");
-    if (type && g_str_equal(type, "none")) {
-        return 0;    /* Nothing to do, default_net is cleared in vl.c */
+    if (type) {
+        if (g_str_equal(type, "none")) {
+            return 0;    /* Nothing to do, default_net is cleared in vl.c */
+        }
+        if (is_help_option(type)) {
+            GPtrArray *nic_models = qemu_get_nic_models(TYPE_DEVICE);
+            show_netdevs();
+            printf("\n");
+            qemu_show_nic_models(type, (const char **)nic_models->pdata);
+            g_ptr_array_free(nic_models, true);
+            exit(0);
+        }
     }
 
     idx = nic_get_free_idx();
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 03/10] net: Replace "Supported NIC models" with "Available NIC models"
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
  2023-02-14  6:11 ` [PULL 01/10] net: Move the code to collect available NIC models to a separate function Jason Wang
  2023-02-14  6:11 ` [PULL 02/10] net: Restore printing of the help text with "-nic help" Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 04/10] hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort Jason Wang
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Thomas Huth, Claudio Fontana, Jason Wang

From: Thomas Huth <thuth@redhat.com>

Just because a NIC model is compiled into the QEMU binary does not
necessary mean that it can be used with each and every machine.
So let's rather talk about "available" models instead of "supported"
models, just to avoid confusion.

Reviewed-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/net.c b/net/net.c
index e8cd95c..ebc7ce0 100644
--- a/net/net.c
+++ b/net/net.c
@@ -941,7 +941,7 @@ int qemu_show_nic_models(const char *arg, const char *const *models)
         return 0;
     }
 
-    printf("Supported NIC models:\n");
+    printf("Available NIC models:\n");
     for (i = 0 ; models[i]; i++) {
         printf("%s\n", models[i]);
     }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 04/10] hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (2 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 03/10] net: Replace "Supported NIC models" with "Available NIC models" Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 05/10] hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value Jason Wang
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel
  Cc: Qiang Liu, Philippe Mathieu-Daudé, Jason Wang

From: Qiang Liu <cyruscyliu@gmail.com>

This patch replaces hw_error to guest error log for [read|write]b
accesses when mode_16bit is enabled. This avoids aborting qemu.

Fixes: 1248f8d4cbc3 ("hw/lan9118: Add basic 16-bit mode support.")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1433
Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/lan9118.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index f1cba55..e5c4af1 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -15,7 +15,6 @@
 #include "migration/vmstate.h"
 #include "net/net.h"
 #include "net/eth.h"
-#include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/net/lan9118.h"
 #include "hw/ptimer.h"
@@ -32,12 +31,8 @@
 #ifdef DEBUG_LAN9118
 #define DPRINTF(fmt, ...) \
 do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { hw_error("lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
 #else
 #define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
 #endif
 
 /* The tx and rx fifo ports are a range of aliased 32-bit registers */
@@ -848,7 +843,8 @@ static uint32_t do_phy_read(lan9118_state *s, int reg)
     case 30: /* Interrupt mask */
         return s->phy_int_mask;
     default:
-        BADF("PHY read reg %d\n", reg);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "do_phy_read: PHY read reg %d\n", reg);
         return 0;
     }
 }
@@ -876,7 +872,8 @@ static void do_phy_write(lan9118_state *s, int reg, uint32_t val)
         phy_update_irq(s);
         break;
     default:
-        BADF("PHY write reg %d = 0x%04x\n", reg, val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "do_phy_write: PHY write reg %d = 0x%04x\n", reg, val);
     }
 }
 
@@ -1209,7 +1206,8 @@ static void lan9118_16bit_mode_write(void *opaque, hwaddr offset,
         return;
     }
 
-    hw_error("lan9118_write: Bad size 0x%x\n", size);
+    qemu_log_mask(LOG_GUEST_ERROR,
+                  "lan9118_16bit_mode_write: Bad size 0x%x\n", size);
 }
 
 static uint64_t lan9118_readl(void *opaque, hwaddr offset,
@@ -1324,7 +1322,8 @@ static uint64_t lan9118_16bit_mode_read(void *opaque, hwaddr offset,
         return lan9118_readl(opaque, offset, size);
     }
 
-    hw_error("lan9118_read: Bad size 0x%x\n", size);
+    qemu_log_mask(LOG_GUEST_ERROR,
+                  "lan9118_16bit_mode_read: Bad size 0x%x\n", size);
     return 0;
 }
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 05/10] hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (3 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 04/10] hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 06/10] net: Increase L2TPv3 buffer to fit jumboframes Jason Wang
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Fiona Ebner, Jason Wang

From: Fiona Ebner <f.ebner@proxmox.com>

Currently, VMXNET3_MAX_MTU itself (being 9000) is not considered a
valid value for the MTU, but a guest running ESXi 7.0 might try to
set it and fail the assert [0].

In the Linux kernel, dev->max_mtu itself is a valid value for the MTU
and for the vmxnet3 driver it's 9000, so a guest running Linux will
also fail the assert when trying to set an MTU of 9000.

VMXNET3_MAX_MTU and s->mtu don't seem to be used in relation to buffer
allocations/accesses, so allowing the upper limit itself as a value
should be fine.

[0]: https://forum.proxmox.com/threads/114011/

Fixes: d05dcd94ae ("net: vmxnet3: validate configuration values during activate (CVE-2021-20203)")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/vmxnet3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index d2ab527..56559cd 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1441,7 +1441,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
-    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU);
+    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu <= VMXNET3_MAX_MTU);
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 06/10] net: Increase L2TPv3 buffer to fit jumboframes
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (4 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 05/10] hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 07/10] vmnet: stop recieving events when VM is stopped Jason Wang
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Christian Svensson, Jason Wang

From: Christian Svensson <blue@cmd.nu>

Increase the allocated buffer size to fit larger packets.
Given that jumboframes can commonly be up to 9000 bytes the closest suitable
value seems to be 16 KiB.

Tested by running qemu towards a Linux L2TPv3 endpoint and pushing
jumboframe traffic through the interfaces.

Signed-off-by: Christian Svensson <blue@cmd.nu>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/l2tpv3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 53b2d32..b5547cb 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -42,7 +42,7 @@
  */
 
 #define BUFFER_ALIGN sysconf(_SC_PAGESIZE)
-#define BUFFER_SIZE 2048
+#define BUFFER_SIZE 16384
 #define IOVSIZE 2
 #define MAX_L2TPV3_MSGCNT 64
 #define MAX_L2TPV3_IOVCNT (MAX_L2TPV3_MSGCNT * IOVSIZE)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 07/10] vmnet: stop recieving events when VM is stopped
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (5 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 06/10] net: Increase L2TPv3 buffer to fit jumboframes Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 08/10] hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo() Jason Wang
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Joelle van Dyne, Jason Wang

From: Joelle van Dyne <j@getutm.app>

When the VM is stopped using the HMP command "stop", soon the handler will
stop reading from the vmnet interface. This causes a flood of
`VMNET_INTERFACE_PACKETS_AVAILABLE` events to arrive and puts the host CPU
at 100%. We fix this by removing the event handler from vmnet when the VM
is no longer in a running state and restore it when we return to a running
state.

Signed-off-by: Joelle van Dyne <j@getutm.app>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/vmnet-common.m | 48 +++++++++++++++++++++++++++++++++++-------------
 net/vmnet_int.h    |  2 ++
 2 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/net/vmnet-common.m b/net/vmnet-common.m
index 2cb60b9..2958283 100644
--- a/net/vmnet-common.m
+++ b/net/vmnet-common.m
@@ -17,6 +17,7 @@
 #include "clients.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
+#include "sysemu/runstate.h"
 
 #include <vmnet/vmnet.h>
 #include <dispatch/dispatch.h>
@@ -242,6 +243,35 @@ static void vmnet_bufs_init(VmnetState *s)
     }
 }
 
+/**
+ * Called on state change to un-register/re-register handlers
+ */
+static void vmnet_vm_state_change_cb(void *opaque, bool running, RunState state)
+{
+    VmnetState *s = opaque;
+
+    if (running) {
+        vmnet_interface_set_event_callback(
+            s->vmnet_if,
+            VMNET_INTERFACE_PACKETS_AVAILABLE,
+            s->if_queue,
+            ^(interface_event_t event_id, xpc_object_t event) {
+                assert(event_id == VMNET_INTERFACE_PACKETS_AVAILABLE);
+                /*
+                 * This function is being called from a non qemu thread, so
+                 * we only schedule a BH, and do the rest of the io completion
+                 * handling from vmnet_send_bh() which runs in a qemu context.
+                 */
+                qemu_bh_schedule(s->send_bh);
+            });
+    } else {
+        vmnet_interface_set_event_callback(
+            s->vmnet_if,
+            VMNET_INTERFACE_PACKETS_AVAILABLE,
+            NULL,
+            NULL);
+    }
+}
 
 int vmnet_if_create(NetClientState *nc,
                     xpc_object_t if_desc,
@@ -329,19 +359,9 @@ int vmnet_if_create(NetClientState *nc,
     s->packets_send_current_pos = 0;
     s->packets_send_end_pos = 0;
 
-    vmnet_interface_set_event_callback(
-        s->vmnet_if,
-        VMNET_INTERFACE_PACKETS_AVAILABLE,
-        s->if_queue,
-        ^(interface_event_t event_id, xpc_object_t event) {
-            assert(event_id == VMNET_INTERFACE_PACKETS_AVAILABLE);
-            /*
-             * This function is being called from a non qemu thread, so
-             * we only schedule a BH, and do the rest of the io completion
-             * handling from vmnet_send_bh() which runs in a qemu context.
-             */
-            qemu_bh_schedule(s->send_bh);
-        });
+    vmnet_vm_state_change_cb(s, 1, RUN_STATE_RUNNING);
+
+    s->change = qemu_add_vm_change_state_handler(vmnet_vm_state_change_cb, s);
 
     return 0;
 }
@@ -356,6 +376,8 @@ void vmnet_cleanup_common(NetClientState *nc)
         return;
     }
 
+    vmnet_vm_state_change_cb(s, 0, RUN_STATE_SHUTDOWN);
+    qemu_del_vm_change_state_handler(s->change);
     if_stopped_sem = dispatch_semaphore_create(0);
     vmnet_stop_interface(
         s->vmnet_if,
diff --git a/net/vmnet_int.h b/net/vmnet_int.h
index d0b9059..a8a033d 100644
--- a/net/vmnet_int.h
+++ b/net/vmnet_int.h
@@ -45,6 +45,8 @@ typedef struct VmnetState {
     int packets_send_end_pos;
 
     struct iovec iov_buf[VMNET_PACKETS_LIMIT];
+
+    VMChangeStateEntry *change;
 } VmnetState;
 
 const char *vmnet_status_map_str(vmnet_return_t status);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 08/10] hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo()
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (6 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 07/10] vmnet: stop recieving events when VM is stopped Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-15 14:56   ` Philippe Mathieu-Daudé
  2023-02-14  6:11 ` [PULL 09/10] net: stream: add a new option to automatically reconnect Jason Wang
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Qiang Liu, Jason Wang

From: Qiang Liu <cyruscyliu@gmail.com>

Check fifos before poping data from and pushing data into it.

Fixes: 98e5d7a2b726 ("hw/net/can: Introduce Xilinx ZynqMP CAN controller")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1425
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1427
Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/can/xlnx-zynqmp-can.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/net/can/xlnx-zynqmp-can.c b/hw/net/can/xlnx-zynqmp-can.c
index e93e6c5..55d3221 100644
--- a/hw/net/can/xlnx-zynqmp-can.c
+++ b/hw/net/can/xlnx-zynqmp-can.c
@@ -451,6 +451,12 @@ static void transfer_fifo(XlnxZynqMPCANState *s, Fifo32 *fifo)
     }
 
     while (!fifo32_is_empty(fifo)) {
+        if (fifo32_num_used(fifo) < (4 * CAN_FRAME_SIZE)) {
+            g_autofree char *path = object_get_canonical_path(OBJECT(s));
+            qemu_log_mask(LOG_GUEST_ERROR, "%s: data left in the fifo is not"
+                          " enough for transfer.\n", path);
+            break;
+        }
         for (i = 0; i < CAN_FRAME_SIZE; i++) {
             data[i] = fifo32_pop(fifo);
         }
@@ -463,7 +469,8 @@ static void transfer_fifo(XlnxZynqMPCANState *s, Fifo32 *fifo)
              * acknowledged. The XlnxZynqMPCAN core receives any message
              * that it transmits.
              */
-            if (fifo32_is_full(&s->rx_fifo)) {
+            if (fifo32_is_full(&s->rx_fifo) ||
+                    (fifo32_num_free(&s->rx_fifo) < (4 * CAN_FRAME_SIZE))) {
                 ARRAY_FIELD_DP32(s->regs, INTERRUPT_STATUS_REGISTER, RXOFLW, 1);
             } else {
                 for (i = 0; i < CAN_FRAME_SIZE; i++) {
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 09/10] net: stream: add a new option to automatically reconnect
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (7 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 08/10] hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo() Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14  6:11 ` [PULL 10/10] vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check Jason Wang
  2023-02-14 14:29 ` [PULL 00/10] Net patches Peter Maydell
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Laurent Vivier, Jason Wang

From: Laurent Vivier <lvivier@redhat.com>

In stream mode, if the server shuts down there is currently
no way to reconnect the client to a new server without removing
the NIC device and the netdev backend (or to reboot).

This patch introduces a reconnect option that specifies a delay
to try to reconnect with the same parameters.

Add a new test in qtest to test the reconnect option and the
connect/disconnect events.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/stream.c                |  53 ++++++++++++++++++++++-
 qapi/net.json               |   7 ++-
 qemu-options.hx             |   6 +--
 tests/qtest/netdev-socket.c | 101 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 162 insertions(+), 5 deletions(-)

diff --git a/net/stream.c b/net/stream.c
index 37ff727..9204b4c 100644
--- a/net/stream.c
+++ b/net/stream.c
@@ -39,6 +39,8 @@
 #include "io/channel-socket.h"
 #include "io/net-listener.h"
 #include "qapi/qapi-events-net.h"
+#include "qapi/qapi-visit-sockets.h"
+#include "qapi/clone-visitor.h"
 
 typedef struct NetStreamState {
     NetClientState nc;
@@ -49,11 +51,15 @@ typedef struct NetStreamState {
     guint ioc_write_tag;
     SocketReadState rs;
     unsigned int send_index;      /* number of bytes sent*/
+    uint32_t reconnect;
+    guint timer_tag;
+    SocketAddress *addr;
 } NetStreamState;
 
 static void net_stream_listen(QIONetListener *listener,
                               QIOChannelSocket *cioc,
                               void *opaque);
+static void net_stream_arm_reconnect(NetStreamState *s);
 
 static gboolean net_stream_writable(QIOChannel *ioc,
                                     GIOCondition condition,
@@ -170,6 +176,7 @@ static gboolean net_stream_send(QIOChannel *ioc,
         qemu_set_info_str(&s->nc, "%s", "");
 
         qapi_event_send_netdev_stream_disconnected(s->nc.name);
+        net_stream_arm_reconnect(s);
 
         return G_SOURCE_REMOVE;
     }
@@ -187,6 +194,14 @@ static gboolean net_stream_send(QIOChannel *ioc,
 static void net_stream_cleanup(NetClientState *nc)
 {
     NetStreamState *s = DO_UPCAST(NetStreamState, nc, nc);
+    if (s->timer_tag) {
+        g_source_remove(s->timer_tag);
+        s->timer_tag = 0;
+    }
+    if (s->addr) {
+        qapi_free_SocketAddress(s->addr);
+        s->addr = NULL;
+    }
     if (s->ioc) {
         if (QIO_CHANNEL_SOCKET(s->ioc)->fd != -1) {
             if (s->ioc_read_tag) {
@@ -346,12 +361,37 @@ static void net_stream_client_connected(QIOTask *task, gpointer opaque)
 error:
     object_unref(OBJECT(s->ioc));
     s->ioc = NULL;
+    net_stream_arm_reconnect(s);
+}
+
+static gboolean net_stream_reconnect(gpointer data)
+{
+    NetStreamState *s = data;
+    QIOChannelSocket *sioc;
+
+    s->timer_tag = 0;
+
+    sioc = qio_channel_socket_new();
+    s->ioc = QIO_CHANNEL(sioc);
+    qio_channel_socket_connect_async(sioc, s->addr,
+                                     net_stream_client_connected, s,
+                                     NULL, NULL);
+    return G_SOURCE_REMOVE;
+}
+
+static void net_stream_arm_reconnect(NetStreamState *s)
+{
+    if (s->reconnect && s->timer_tag == 0) {
+        s->timer_tag = g_timeout_add_seconds(s->reconnect,
+                                             net_stream_reconnect, s);
+    }
 }
 
 static int net_stream_client_init(NetClientState *peer,
                                   const char *model,
                                   const char *name,
                                   SocketAddress *addr,
+                                  uint32_t reconnect,
                                   Error **errp)
 {
     NetStreamState *s;
@@ -364,6 +404,10 @@ static int net_stream_client_init(NetClientState *peer,
     s->ioc = QIO_CHANNEL(sioc);
     s->nc.link_down = true;
 
+    s->reconnect = reconnect;
+    if (reconnect) {
+        s->addr = QAPI_CLONE(SocketAddress, addr);
+    }
     qio_channel_socket_connect_async(sioc, addr,
                                      net_stream_client_connected, s,
                                      NULL, NULL);
@@ -380,7 +424,14 @@ int net_init_stream(const Netdev *netdev, const char *name,
     sock = &netdev->u.stream;
 
     if (!sock->has_server || !sock->server) {
-        return net_stream_client_init(peer, "stream", name, sock->addr, errp);
+        return net_stream_client_init(peer, "stream", name, sock->addr,
+                                      sock->has_reconnect ? sock->reconnect : 0,
+                                      errp);
+    }
+    if (sock->has_reconnect) {
+        error_setg(errp, "'reconnect' option is incompatible with "
+                         "socket in server mode");
+        return -1;
     }
     return net_stream_server_init(peer, "stream", name, sock->addr, errp);
 }
diff --git a/qapi/net.json b/qapi/net.json
index 522ac58..d6eb300 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -585,6 +585,10 @@
 # @addr: socket address to listen on (server=true)
 #        or connect to (server=false)
 # @server: create server socket (default: false)
+# @reconnect: For a client socket, if a socket is disconnected,
+#             then attempt a reconnect after the given number of seconds.
+#             Setting this to zero disables this function. (default: 0)
+#             (since 8.0)
 #
 # Only SocketAddress types 'unix', 'inet' and 'fd' are supported.
 #
@@ -593,7 +597,8 @@
 { 'struct': 'NetdevStreamOptions',
   'data': {
     'addr':   'SocketAddress',
-    '*server': 'bool' } }
+    '*server': 'bool',
+    '*reconnect': 'uint32' } }
 
 ##
 # @NetdevDgramOptions:
diff --git a/qemu-options.hx b/qemu-options.hx
index 88e93c6..1417fab 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2769,9 +2769,9 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n"
     "                configure a network backend to connect to another network\n"
     "                using an UDP tunnel\n"
-    "-netdev stream,id=str[,server=on|off],addr.type=inet,addr.host=host,addr.port=port[,to=maxport][,numeric=on|off][,keep-alive=on|off][,mptcp=on|off][,addr.ipv4=on|off][,addr.ipv6=on|off]\n"
-    "-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off]\n"
-    "-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor\n"
+    "-netdev stream,id=str[,server=on|off],addr.type=inet,addr.host=host,addr.port=port[,to=maxport][,numeric=on|off][,keep-alive=on|off][,mptcp=on|off][,addr.ipv4=on|off][,addr.ipv6=on|off][,reconnect=seconds]\n"
+    "-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off][,reconnect=seconds]\n"
+    "-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor[,reconnect=seconds]\n"
     "                configure a network backend to connect to another network\n"
     "                using a socket connection in stream mode.\n"
     "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]\n"
diff --git a/tests/qtest/netdev-socket.c b/tests/qtest/netdev-socket.c
index 1d98dca..270e424 100644
--- a/tests/qtest/netdev-socket.c
+++ b/tests/qtest/netdev-socket.c
@@ -11,6 +11,10 @@
 #include <glib/gstdio.h>
 #include "../unit/socket-helpers.h"
 #include "libqtest.h"
+#include "qapi/qmp/qstring.h"
+#include "qemu/sockets.h"
+#include "qapi/qobject-input-visitor.h"
+#include "qapi/qapi-visit-sockets.h"
 
 #define CONNECTION_TIMEOUT    60
 
@@ -142,6 +146,101 @@ static void test_stream_inet_ipv4(void)
     qtest_quit(qts0);
 }
 
+static void wait_stream_connected(QTestState *qts, const char *id,
+                                  SocketAddress **addr)
+{
+    QDict *resp, *data;
+    QString *qstr;
+    QObject *obj;
+    Visitor *v = NULL;
+
+    resp = qtest_qmp_eventwait_ref(qts, "NETDEV_STREAM_CONNECTED");
+    g_assert_nonnull(resp);
+    data = qdict_get_qdict(resp, "data");
+    g_assert_nonnull(data);
+
+    qstr = qobject_to(QString, qdict_get(data, "netdev-id"));
+    g_assert_nonnull(data);
+
+    g_assert(!strcmp(qstring_get_str(qstr), id));
+
+    obj = qdict_get(data, "addr");
+
+    v = qobject_input_visitor_new(obj);
+    visit_type_SocketAddress(v, NULL, addr, NULL);
+    visit_free(v);
+    qobject_unref(resp);
+}
+
+static void wait_stream_disconnected(QTestState *qts, const char *id)
+{
+    QDict *resp, *data;
+    QString *qstr;
+
+    resp = qtest_qmp_eventwait_ref(qts, "NETDEV_STREAM_DISCONNECTED");
+    g_assert_nonnull(resp);
+    data = qdict_get_qdict(resp, "data");
+    g_assert_nonnull(data);
+
+    qstr = qobject_to(QString, qdict_get(data, "netdev-id"));
+    g_assert_nonnull(data);
+
+    g_assert(!strcmp(qstring_get_str(qstr), id));
+    qobject_unref(resp);
+}
+
+static void test_stream_inet_reconnect(void)
+{
+    QTestState *qts0, *qts1;
+    int port;
+    SocketAddress *addr;
+
+    port = inet_get_free_port(false);
+    qts0 = qtest_initf("-nodefaults -M none "
+                       "-netdev stream,id=st0,server=true,addr.type=inet,"
+                       "addr.ipv4=on,addr.ipv6=off,"
+                       "addr.host=127.0.0.1,addr.port=%d", port);
+
+    EXPECT_STATE(qts0, "st0: index=0,type=stream,\r\n", 0);
+
+    qts1 = qtest_initf("-nodefaults -M none "
+                       "-netdev stream,server=false,id=st0,addr.type=inet,"
+                       "addr.ipv4=on,addr.ipv6=off,reconnect=1,"
+                       "addr.host=127.0.0.1,addr.port=%d", port);
+
+    wait_stream_connected(qts0, "st0", &addr);
+    g_assert_cmpint(addr->type, ==, SOCKET_ADDRESS_TYPE_INET);
+    g_assert_cmpstr(addr->u.inet.host, ==, "127.0.0.1");
+    qapi_free_SocketAddress(addr);
+
+    /* kill server */
+    qtest_quit(qts0);
+
+    /* check client has been disconnected */
+    wait_stream_disconnected(qts1, "st0");
+
+    /* restart server */
+    qts0 = qtest_initf("-nodefaults -M none "
+                       "-netdev stream,id=st0,server=true,addr.type=inet,"
+                       "addr.ipv4=on,addr.ipv6=off,"
+                       "addr.host=127.0.0.1,addr.port=%d", port);
+
+    /* wait connection events*/
+    wait_stream_connected(qts0, "st0", &addr);
+    g_assert_cmpint(addr->type, ==, SOCKET_ADDRESS_TYPE_INET);
+    g_assert_cmpstr(addr->u.inet.host, ==, "127.0.0.1");
+    qapi_free_SocketAddress(addr);
+
+    wait_stream_connected(qts1, "st0", &addr);
+    g_assert_cmpint(addr->type, ==, SOCKET_ADDRESS_TYPE_INET);
+    g_assert_cmpstr(addr->u.inet.host, ==, "127.0.0.1");
+    g_assert_cmpint(atoi(addr->u.inet.port), ==, port);
+    qapi_free_SocketAddress(addr);
+
+    qtest_quit(qts1);
+    qtest_quit(qts0);
+}
+
 static void test_stream_inet_ipv6(void)
 {
     QTestState *qts0, *qts1;
@@ -418,6 +517,8 @@ int main(int argc, char **argv)
 #ifndef _WIN32
         qtest_add_func("/netdev/dgram/mcast", test_dgram_mcast);
 #endif
+        qtest_add_func("/netdev/stream/inet/reconnect",
+                       test_stream_inet_reconnect);
     }
     if (has_ipv6) {
         qtest_add_func("/netdev/stream/inet/ipv6", test_stream_inet_ipv6);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL 10/10] vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (8 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 09/10] net: stream: add a new option to automatically reconnect Jason Wang
@ 2023-02-14  6:11 ` Jason Wang
  2023-02-14 14:29 ` [PULL 00/10] Net patches Peter Maydell
  10 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-14  6:11 UTC (permalink / raw)
  To: peter.maydell, qemu-devel
  Cc: Eugenio Pérez, Michael S . Tsirkin, Jason Wang

From: Eugenio Pérez <eperezma@redhat.com>

VHOST_BACKEND_F_IOTLB_ASID is the feature bit, not the bitmask. Since
the device under test also provided VHOST_BACKEND_F_IOTLB_MSG_V2 and
VHOST_BACKEND_F_IOTLB_BATCH, this went unnoticed.

Fixes: c1a1008685 ("vdpa: always start CVQ in SVQ mode if possible")
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/vhost-vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 1a13a34..de5ed8f 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -384,7 +384,7 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc)
             g_strerror(errno), errno);
         return -1;
     }
-    if (!(backend_features & VHOST_BACKEND_F_IOTLB_ASID) ||
+    if (!(backend_features & BIT_ULL(VHOST_BACKEND_F_IOTLB_ASID)) ||
         !vhost_vdpa_net_valid_svq_features(v->dev->features, NULL)) {
         return 0;
     }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
                   ` (9 preceding siblings ...)
  2023-02-14  6:11 ` [PULL 10/10] vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check Jason Wang
@ 2023-02-14 14:29 ` Peter Maydell
  2023-02-14 14:30   ` Peter Maydell
  10 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2023-02-14 14:29 UTC (permalink / raw)
  To: Jason Wang; +Cc: qemu-devel

On Tue, 14 Feb 2023 at 06:11, Jason Wang <jasowang@redhat.com> wrote:
>
> The following changes since commit f670b3eec7f5d1ed8c4573ef244e7b8c6b32001b:
>
>   Merge tag 'migration-20230213-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-02-13 11:54:05 +0000)
>
> are available in the git repository at:
>
>   https://github.com/jasowang/qemu.git tags/net-pull-request
>
> for you to fetch changes up to e4b953a26da11d214f91516cb9b0542eab5afaa0:
>
>   vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check (2023-02-14 14:00:30 +0800)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------

xlnx-can-test fails on multiple CI hosts:

https://gitlab.com/qemu-project/qemu/-/jobs/3767000949
https://gitlab.com/qemu-project/qemu/-/jobs/3767000974
https://gitlab.com/qemu-project/qemu/-/jobs/3767000994
https://gitlab.com/qemu-project/qemu/-/jobs/3767000970
https://gitlab.com/qemu-project/qemu/-/jobs/3767001009
https://gitlab.com/qemu-project/qemu/-/jobs/3767000851
https://gitlab.com/qemu-project/qemu/-/jobs/3767000849

thanks
-- PMM


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2023-02-14 14:29 ` [PULL 00/10] Net patches Peter Maydell
@ 2023-02-14 14:30   ` Peter Maydell
  2023-02-15 14:39     ` Laurent Vivier
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2023-02-14 14:30 UTC (permalink / raw)
  To: Jason Wang; +Cc: qemu-devel

On Tue, 14 Feb 2023 at 14:29, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Tue, 14 Feb 2023 at 06:11, Jason Wang <jasowang@redhat.com> wrote:
> >
> > The following changes since commit f670b3eec7f5d1ed8c4573ef244e7b8c6b32001b:
> >
> >   Merge tag 'migration-20230213-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-02-13 11:54:05 +0000)
> >
> > are available in the git repository at:
> >
> >   https://github.com/jasowang/qemu.git tags/net-pull-request
> >
> > for you to fetch changes up to e4b953a26da11d214f91516cb9b0542eab5afaa0:
> >
> >   vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check (2023-02-14 14:00:30 +0800)
> >
> > ----------------------------------------------------------------
> >
> > ----------------------------------------------------------------
>
> xlnx-can-test fails on multiple CI hosts:
>
> https://gitlab.com/qemu-project/qemu/-/jobs/3767000949
> https://gitlab.com/qemu-project/qemu/-/jobs/3767000974
> https://gitlab.com/qemu-project/qemu/-/jobs/3767000994
> https://gitlab.com/qemu-project/qemu/-/jobs/3767000970
> https://gitlab.com/qemu-project/qemu/-/jobs/3767001009
> https://gitlab.com/qemu-project/qemu/-/jobs/3767000851
> https://gitlab.com/qemu-project/qemu/-/jobs/3767000849

more specifically, it asserts:

ERROR:../tests/qtest/xlnx-can-test.c:96:read_data: assertion failed
(int_status == ISR_RXOK): (0 == 16)

-- PMM


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2023-02-14 14:30   ` Peter Maydell
@ 2023-02-15 14:39     ` Laurent Vivier
  2023-02-16  4:45       ` Jason Wang
  0 siblings, 1 reply; 21+ messages in thread
From: Laurent Vivier @ 2023-02-15 14:39 UTC (permalink / raw)
  To: Peter Maydell, Jason Wang, Qiang Liu; +Cc: qemu-devel

On 2/14/23 15:30, Peter Maydell wrote:
> On Tue, 14 Feb 2023 at 14:29, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> On Tue, 14 Feb 2023 at 06:11, Jason Wang <jasowang@redhat.com> wrote:
>>>
>>> The following changes since commit f670b3eec7f5d1ed8c4573ef244e7b8c6b32001b:
>>>
>>>    Merge tag 'migration-20230213-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-02-13 11:54:05 +0000)
>>>
>>> are available in the git repository at:
>>>
>>>    https://github.com/jasowang/qemu.git tags/net-pull-request
>>>
>>> for you to fetch changes up to e4b953a26da11d214f91516cb9b0542eab5afaa0:
>>>
>>>    vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check (2023-02-14 14:00:30 +0800)
>>>
>>> ----------------------------------------------------------------
>>>
>>> ----------------------------------------------------------------
>>
>> xlnx-can-test fails on multiple CI hosts:
>>
>> https://gitlab.com/qemu-project/qemu/-/jobs/3767000949
>> https://gitlab.com/qemu-project/qemu/-/jobs/3767000974
>> https://gitlab.com/qemu-project/qemu/-/jobs/3767000994
>> https://gitlab.com/qemu-project/qemu/-/jobs/3767000970
>> https://gitlab.com/qemu-project/qemu/-/jobs/3767001009
>> https://gitlab.com/qemu-project/qemu/-/jobs/3767000851
>> https://gitlab.com/qemu-project/qemu/-/jobs/3767000849
> 
> more specifically, it asserts:
> 
> ERROR:../tests/qtest/xlnx-can-test.c:96:read_data: assertion failed
> (int_status == ISR_RXOK): (0 == 16)

It seems the problem is with the loopback test (net/can/can_loopback).

as fifo32_num_used() and fifo32_num_free() return the number of uint32_t slots, the patch 
should be fixed with (remove the "4 *"):

diff --git a/hw/net/can/xlnx-zynqmp-can.c b/hw/net/can/xlnx-zynqmp-can.c
index 55d3221b4980..8a56734b3ca2 100644
--- a/hw/net/can/xlnx-zynqmp-can.c
+++ b/hw/net/can/xlnx-zynqmp-can.c
@@ -451,7 +451,7 @@ static void transfer_fifo(XlnxZynqMPCANState *s, Fifo32 *fifo)
      }

      while (!fifo32_is_empty(fifo)) {
-        if (fifo32_num_used(fifo) < (4 * CAN_FRAME_SIZE)) {
+        if (fifo32_num_used(fifo) < CAN_FRAME_SIZE) {
              g_autofree char *path = object_get_canonical_path(OBJECT(s));
              qemu_log_mask(LOG_GUEST_ERROR, "%s: data left in the fifo is not"
                            " enough for transfer.\n", path);
@@ -470,7 +470,7 @@ static void transfer_fifo(XlnxZynqMPCANState *s, Fifo32 *fifo)
               * that it transmits.
               */
              if (fifo32_is_full(&s->rx_fifo) ||
-                    (fifo32_num_free(&s->rx_fifo) < (4 * CAN_FRAME_SIZE))) {
+                    (fifo32_num_free(&s->rx_fifo) < CAN_FRAME_SIZE)) {
                  ARRAY_FIELD_DP32(s->regs, INTERRUPT_STATUS_REGISTER, RXOFLW, 1);
              } else {
                  for (i = 0; i < CAN_FRAME_SIZE; i++) {


Thanks,
Laurent



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PULL 08/10] hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo()
  2023-02-14  6:11 ` [PULL 08/10] hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo() Jason Wang
@ 2023-02-15 14:56   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-15 14:56 UTC (permalink / raw)
  To: Jason Wang, peter.maydell, qemu-devel, Pavel Pisa,
	Vikram Garhwal, Francisco Iglesias
  Cc: Qiang Liu

Adding CAN bus maintainers.

On 14/2/23 07:11, Jason Wang wrote:
> From: Qiang Liu <cyruscyliu@gmail.com>
> 
> Check fifos before poping data from and pushing data into it.
> 
> Fixes: 98e5d7a2b726 ("hw/net/can: Introduce Xilinx ZynqMP CAN controller")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1425
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1427
> Reported-by: Qiang Liu <cyruscyliu@gmail.com>
> Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>   hw/net/can/xlnx-zynqmp-can.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/net/can/xlnx-zynqmp-can.c b/hw/net/can/xlnx-zynqmp-can.c
> index e93e6c5..55d3221 100644
> --- a/hw/net/can/xlnx-zynqmp-can.c
> +++ b/hw/net/can/xlnx-zynqmp-can.c
> @@ -451,6 +451,12 @@ static void transfer_fifo(XlnxZynqMPCANState *s, Fifo32 *fifo)
>       }
>   
>       while (!fifo32_is_empty(fifo)) {
> +        if (fifo32_num_used(fifo) < (4 * CAN_FRAME_SIZE)) {
> +            g_autofree char *path = object_get_canonical_path(OBJECT(s));
> +            qemu_log_mask(LOG_GUEST_ERROR, "%s: data left in the fifo is not"
> +                          " enough for transfer.\n", path);
> +            break;

This change looks dubious... Shouldn't this rejected earlier?
Shouldn't we assert(fifo32_num_used(fifo)) >= CAN_FRAME_SIZE here?
Is this really how this works on the hardware?

>           for (i = 0; i < CAN_FRAME_SIZE; i++) {
>               data[i] = fifo32_pop(fifo);
>           }


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2023-02-15 14:39     ` Laurent Vivier
@ 2023-02-16  4:45       ` Jason Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2023-02-16  4:45 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Peter Maydell, Qiang Liu, qemu-devel

On Wed, Feb 15, 2023 at 10:39 PM Laurent Vivier <lvivier@redhat.com> wrote:
>
> On 2/14/23 15:30, Peter Maydell wrote:
> > On Tue, 14 Feb 2023 at 14:29, Peter Maydell <peter.maydell@linaro.org> wrote:
> >>
> >> On Tue, 14 Feb 2023 at 06:11, Jason Wang <jasowang@redhat.com> wrote:
> >>>
> >>> The following changes since commit f670b3eec7f5d1ed8c4573ef244e7b8c6b32001b:
> >>>
> >>>    Merge tag 'migration-20230213-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-02-13 11:54:05 +0000)
> >>>
> >>> are available in the git repository at:
> >>>
> >>>    https://github.com/jasowang/qemu.git tags/net-pull-request
> >>>
> >>> for you to fetch changes up to e4b953a26da11d214f91516cb9b0542eab5afaa0:
> >>>
> >>>    vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check (2023-02-14 14:00:30 +0800)
> >>>
> >>> ----------------------------------------------------------------
> >>>
> >>> ----------------------------------------------------------------
> >>
> >> xlnx-can-test fails on multiple CI hosts:
> >>
> >> https://gitlab.com/qemu-project/qemu/-/jobs/3767000949
> >> https://gitlab.com/qemu-project/qemu/-/jobs/3767000974
> >> https://gitlab.com/qemu-project/qemu/-/jobs/3767000994
> >> https://gitlab.com/qemu-project/qemu/-/jobs/3767000970
> >> https://gitlab.com/qemu-project/qemu/-/jobs/3767001009
> >> https://gitlab.com/qemu-project/qemu/-/jobs/3767000851
> >> https://gitlab.com/qemu-project/qemu/-/jobs/3767000849
> >
> > more specifically, it asserts:
> >
> > ERROR:../tests/qtest/xlnx-can-test.c:96:read_data: assertion failed
> > (int_status == ISR_RXOK): (0 == 16)
>
> It seems the problem is with the loopback test (net/can/can_loopback).
>
> as fifo32_num_used() and fifo32_num_free() return the number of uint32_t slots, the patch
> should be fixed with (remove the "4 *"):
>
> diff --git a/hw/net/can/xlnx-zynqmp-can.c b/hw/net/can/xlnx-zynqmp-can.c
> index 55d3221b4980..8a56734b3ca2 100644
> --- a/hw/net/can/xlnx-zynqmp-can.c
> +++ b/hw/net/can/xlnx-zynqmp-can.c
> @@ -451,7 +451,7 @@ static void transfer_fifo(XlnxZynqMPCANState *s, Fifo32 *fifo)
>       }
>
>       while (!fifo32_is_empty(fifo)) {
> -        if (fifo32_num_used(fifo) < (4 * CAN_FRAME_SIZE)) {
> +        if (fifo32_num_used(fifo) < CAN_FRAME_SIZE) {
>               g_autofree char *path = object_get_canonical_path(OBJECT(s));
>               qemu_log_mask(LOG_GUEST_ERROR, "%s: data left in the fifo is not"
>                             " enough for transfer.\n", path);
> @@ -470,7 +470,7 @@ static void transfer_fifo(XlnxZynqMPCANState *s, Fifo32 *fifo)
>                * that it transmits.
>                */
>               if (fifo32_is_full(&s->rx_fifo) ||
> -                    (fifo32_num_free(&s->rx_fifo) < (4 * CAN_FRAME_SIZE))) {
> +                    (fifo32_num_free(&s->rx_fifo) < CAN_FRAME_SIZE)) {
>                   ARRAY_FIELD_DP32(s->regs, INTERRUPT_STATUS_REGISTER, RXOFLW, 1);
>               } else {
>                   for (i = 0; i < CAN_FRAME_SIZE; i++) {
>
>
> Thanks,
> Laurent

Exactly, I will squash this and send a new pull request.

Thanks

>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2021-05-11 20:20 ` Peter Maydell
@ 2021-05-12  2:53   ` Jason Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2021-05-12  2:53 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Andrew Melnychenko, QEMU Developers


在 2021/5/12 上午4:20, Peter Maydell 写道:
> On Sat, 8 May 2021 at 08:18, Jason Wang <jasowang@redhat.com> wrote:
>> The following changes since commit d90f154867ec0ec22fd719164b88716e8fd48672:
>>
>>    Merge remote-tracking branch 'remotes/dg-gitlab/tags/ppc-for-6.1-20210504' into staging (2021-05-05 20:29:14 +0100)
>>
>> are available in the git repository at:
>>
>>    https://github.com/jasowang/qemu.git tags/net-pull-request
>>
>> for you to fetch changes up to 2bdeb0c2564c36b218ac73e21d7a6f6accb49091:
>>
>>    tap-bsd: Remove special casing for older OpenBSD releases (2021-05-08 13:59:12 +0800)
>>
>> ----------------------------------------------------------------
>>
>> ---------------------------------------------------------------
> This causes meson to emit a warning on one of my build machines:
>
> Run-time dependency libkeyutils found: NO (tried pkgconfig)
> Checking for function "gettid" : NO (cached)
> Run-time dependency fuse3 found: NO (tried pkgconfig)
> Found CMake: /usr/bin/cmake (2.8.12.2)
> WARNING: The version of CMake /usr/bin/cmake is 2.8.12.2 but version
>> =3.4 is required
> Run-time dependency libbpf found: NO (tried pkgconfig and cmake)
> Has header "linux/btrfs.h" : YES (cached)
> Has header "libdrm/drm.h" : YES (cached)
>
>
> We shouldn't be looking for cmake at all.
>
> thanks
> -- PMM


Right, the reason is method is not specified when detecting libbpf so 
meson may try cmake:

libbpf = dependency('libbpf', required: get_option('bpf'),)

Andrew, want to repost the series (with possible style warnings)?

Thanks




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2021-05-08  7:18 Jason Wang
  2021-05-08  7:31 ` no-reply
@ 2021-05-11 20:20 ` Peter Maydell
  2021-05-12  2:53   ` Jason Wang
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2021-05-11 20:20 UTC (permalink / raw)
  To: Jason Wang; +Cc: QEMU Developers

On Sat, 8 May 2021 at 08:18, Jason Wang <jasowang@redhat.com> wrote:
>
> The following changes since commit d90f154867ec0ec22fd719164b88716e8fd48672:
>
>   Merge remote-tracking branch 'remotes/dg-gitlab/tags/ppc-for-6.1-20210504' into staging (2021-05-05 20:29:14 +0100)
>
> are available in the git repository at:
>
>   https://github.com/jasowang/qemu.git tags/net-pull-request
>
> for you to fetch changes up to 2bdeb0c2564c36b218ac73e21d7a6f6accb49091:
>
>   tap-bsd: Remove special casing for older OpenBSD releases (2021-05-08 13:59:12 +0800)
>
> ----------------------------------------------------------------
>
> ---------------------------------------------------------------

This causes meson to emit a warning on one of my build machines:

Run-time dependency libkeyutils found: NO (tried pkgconfig)
Checking for function "gettid" : NO (cached)
Run-time dependency fuse3 found: NO (tried pkgconfig)
Found CMake: /usr/bin/cmake (2.8.12.2)
WARNING: The version of CMake /usr/bin/cmake is 2.8.12.2 but version
>=3.4 is required
Run-time dependency libbpf found: NO (tried pkgconfig and cmake)
Has header "linux/btrfs.h" : YES (cached)
Has header "libdrm/drm.h" : YES (cached)


We shouldn't be looking for cmake at all.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2021-05-08  7:31 ` no-reply
@ 2021-05-08  7:59   ` Jason Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Jason Wang @ 2021-05-08  7:59 UTC (permalink / raw)
  To: qemu-devel, andrew; +Cc: peter.maydell

On Sat, May 8, 2021 at 3:31 PM <no-reply@patchew.org> wrote:
>
> Patchew URL: https://patchew.org/QEMU/1620458319-5670-1-git-send-email-jasowang@redhat.com/
>
>
>
> Hi,
>
> This series seems to have some coding style problems. See output below for
> more information:
>
> Type: series
> Message-id: 1620458319-5670-1-git-send-email-jasowang@redhat.com
> Subject: [PULL 00/10] Net patches
>
> === 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/1620402803-9237-1-git-send-email-jag.raman@oracle.com -> patchew/1620402803-9237-1-git-send-email-jag.raman@oracle.com
>  * [new tag]         patchew/1620458319-5670-1-git-send-email-jasowang@redhat.com -> patchew/1620458319-5670-1-git-send-email-jasowang@redhat.com
> Switched to a new branch 'test'
> a34d81a tap-bsd: Remove special casing for older OpenBSD releases
> 4b987f4 virtio-net: failover: add missing remove_migration_state_change_notifier()
> 3dc299d hw/net/imx_fec: return 0xffff when accessing non-existing PHY
> 729e8df MAINTAINERS: Added eBPF maintainers information.
> ab65d98 docs: Added eBPF documentation.
> 905729a virtio-net: Added eBPF RSS to virtio-net.
> 5a7d393 ebpf: Added eBPF RSS loader.
> eae9462 ebpf: Added eBPF RSS program.
> b6962be net: Added SetSteeringEBPF method for NetClientState.
> 1207c8e net/tap: Added TUNSETSTEERINGEBPF code.



Andrew, please fix those style issues except for the skeleton which is
generated by bpftool and I will send a new version of pull request.

>
> === OUTPUT BEGIN ===
> 1/10 Checking commit 1207c8e2a076 (net/tap: Added TUNSETSTEERINGEBPF code.)
> 2/10 Checking commit b6962be9ca91 (net: Added SetSteeringEBPF method for NetClientState.)
> 3/10 Checking commit eae94621a4b1 (ebpf: Added eBPF RSS program.)
> Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #23:
> new file mode 100755
>
> WARNING: line over 80 characters
> #211: FILE: tools/ebpf/rss.bpf.c:157:
> + * According to https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml
>
> WARNING: line over 80 characters
> #214: FILE: tools/ebpf/rss.bpf.c:160:
> + * Need to choose reasonable amount of maximum extensions/options we may check to find
>
> WARNING: line over 80 characters
> #281: FILE: tools/ebpf/rss.bpf.c:227:
> +                        *l4_offset + opt_offset + offsetof(struct ipv6_destopt_hao, addr),
>
> total: 0 errors, 4 warnings, 590 lines checked
>
> Patch 3/10 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 4/10 Checking commit 5a7d3933bfa3 (ebpf: Added eBPF RSS loader.)
> Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #72:
> new file mode 100644
>
> WARNING: architecture specific defines should be avoided
> #354: FILE: ebpf/rss.bpf.skeleton.h:4:
> +#ifndef __RSS_BPF_SKEL_H__
>
> ERROR: code indent should never use tabs
> #361: FILE: ebpf/rss.bpf.skeleton.h:11:
> +^Istruct bpf_object_skeleton *skeleton;$
>
> ERROR: code indent should never use tabs
> #362: FILE: ebpf/rss.bpf.skeleton.h:12:
> +^Istruct bpf_object *obj;$
>
> ERROR: code indent should never use tabs
> #363: FILE: ebpf/rss.bpf.skeleton.h:13:
> +^Istruct {$
>
> ERROR: code indent should never use tabs
> #364: FILE: ebpf/rss.bpf.skeleton.h:14:
> +^I^Istruct bpf_map *tap_rss_map_configurations;$
>
> ERROR: code indent should never use tabs
> #365: FILE: ebpf/rss.bpf.skeleton.h:15:
> +^I^Istruct bpf_map *tap_rss_map_indirection_table;$
>
> ERROR: code indent should never use tabs
> #366: FILE: ebpf/rss.bpf.skeleton.h:16:
> +^I^Istruct bpf_map *tap_rss_map_toeplitz_key;$
>
> ERROR: code indent should never use tabs
> #367: FILE: ebpf/rss.bpf.skeleton.h:17:
> +^I} maps;$
>
> ERROR: code indent should never use tabs
> #368: FILE: ebpf/rss.bpf.skeleton.h:18:
> +^Istruct {$
>
> ERROR: code indent should never use tabs
> #369: FILE: ebpf/rss.bpf.skeleton.h:19:
> +^I^Istruct bpf_program *tun_rss_steering_prog;$
>
> ERROR: code indent should never use tabs
> #370: FILE: ebpf/rss.bpf.skeleton.h:20:
> +^I} progs;$
>
> ERROR: code indent should never use tabs
> #371: FILE: ebpf/rss.bpf.skeleton.h:21:
> +^Istruct {$
>
> ERROR: code indent should never use tabs
> #372: FILE: ebpf/rss.bpf.skeleton.h:22:
> +^I^Istruct bpf_link *tun_rss_steering_prog;$
>
> ERROR: code indent should never use tabs
> #373: FILE: ebpf/rss.bpf.skeleton.h:23:
> +^I} links;$
>
> ERROR: code indent should never use tabs
> #379: FILE: ebpf/rss.bpf.skeleton.h:29:
> +^Iif (!obj)$
>
> ERROR: braces {} are necessary for all arms of this statement
> #379: FILE: ebpf/rss.bpf.skeleton.h:29:
> +       if (!obj)
> [...]
>
> ERROR: code indent should never use tabs
> #380: FILE: ebpf/rss.bpf.skeleton.h:30:
> +^I^Ireturn;$
>
> ERROR: code indent should never use tabs
> #381: FILE: ebpf/rss.bpf.skeleton.h:31:
> +^Iif (obj->skeleton)$
>
> ERROR: braces {} are necessary for all arms of this statement
> #381: FILE: ebpf/rss.bpf.skeleton.h:31:
> +       if (obj->skeleton)
> [...]
>
> ERROR: code indent should never use tabs
> #382: FILE: ebpf/rss.bpf.skeleton.h:32:
> +^I^Ibpf_object__destroy_skeleton(obj->skeleton);$
>
> ERROR: code indent should never use tabs
> #383: FILE: ebpf/rss.bpf.skeleton.h:33:
> +^Ifree(obj);$
>
> ERROR: code indent should never use tabs
> #392: FILE: ebpf/rss.bpf.skeleton.h:42:
> +^Istruct rss_bpf *obj;$
>
> ERROR: code indent should never use tabs
> #394: FILE: ebpf/rss.bpf.skeleton.h:44:
> +^Iobj = (struct rss_bpf *)calloc(1, sizeof(*obj));$
>
> ERROR: code indent should never use tabs
> #395: FILE: ebpf/rss.bpf.skeleton.h:45:
> +^Iif (!obj)$
>
> ERROR: braces {} are necessary for all arms of this statement
> #395: FILE: ebpf/rss.bpf.skeleton.h:45:
> +       if (!obj)
> [...]
>
> ERROR: code indent should never use tabs
> #396: FILE: ebpf/rss.bpf.skeleton.h:46:
> +^I^Ireturn NULL;$
>
> ERROR: code indent should never use tabs
> #397: FILE: ebpf/rss.bpf.skeleton.h:47:
> +^Iif (rss_bpf__create_skeleton(obj))$
>
> ERROR: braces {} are necessary for all arms of this statement
> #397: FILE: ebpf/rss.bpf.skeleton.h:47:
> +       if (rss_bpf__create_skeleton(obj))
> [...]
>
> ERROR: code indent should never use tabs
> #398: FILE: ebpf/rss.bpf.skeleton.h:48:
> +^I^Igoto err;$
>
> ERROR: code indent should never use tabs
> #399: FILE: ebpf/rss.bpf.skeleton.h:49:
> +^Iif (bpf_object__open_skeleton(obj->skeleton, opts))$
>
> ERROR: braces {} are necessary for all arms of this statement
> #399: FILE: ebpf/rss.bpf.skeleton.h:49:
> +       if (bpf_object__open_skeleton(obj->skeleton, opts))
> [...]
>
> ERROR: code indent should never use tabs
> #400: FILE: ebpf/rss.bpf.skeleton.h:50:
> +^I^Igoto err;$
>
> ERROR: code indent should never use tabs
> #402: FILE: ebpf/rss.bpf.skeleton.h:52:
> +^Ireturn obj;$
>
> ERROR: code indent should never use tabs
> #404: FILE: ebpf/rss.bpf.skeleton.h:54:
> +^Irss_bpf__destroy(obj);$
>
> ERROR: code indent should never use tabs
> #405: FILE: ebpf/rss.bpf.skeleton.h:55:
> +^Ireturn NULL;$
>
> ERROR: code indent should never use tabs
> #411: FILE: ebpf/rss.bpf.skeleton.h:61:
> +^Ireturn rss_bpf__open_opts(NULL);$
>
> ERROR: code indent should never use tabs
> #417: FILE: ebpf/rss.bpf.skeleton.h:67:
> +^Ireturn bpf_object__load_skeleton(obj->skeleton);$
>
> ERROR: code indent should never use tabs
> #423: FILE: ebpf/rss.bpf.skeleton.h:73:
> +^Istruct rss_bpf *obj;$
>
> ERROR: code indent should never use tabs
> #425: FILE: ebpf/rss.bpf.skeleton.h:75:
> +^Iobj = rss_bpf__open();$
>
> ERROR: code indent should never use tabs
> #426: FILE: ebpf/rss.bpf.skeleton.h:76:
> +^Iif (!obj)$
>
> ERROR: braces {} are necessary for all arms of this statement
> #426: FILE: ebpf/rss.bpf.skeleton.h:76:
> +       if (!obj)
> [...]
>
> ERROR: code indent should never use tabs
> #427: FILE: ebpf/rss.bpf.skeleton.h:77:
> +^I^Ireturn NULL;$
>
> ERROR: code indent should never use tabs
> #428: FILE: ebpf/rss.bpf.skeleton.h:78:
> +^Iif (rss_bpf__load(obj)) {$
>
> ERROR: code indent should never use tabs
> #429: FILE: ebpf/rss.bpf.skeleton.h:79:
> +^I^Irss_bpf__destroy(obj);$
>
> ERROR: code indent should never use tabs
> #430: FILE: ebpf/rss.bpf.skeleton.h:80:
> +^I^Ireturn NULL;$
>
> ERROR: code indent should never use tabs
> #431: FILE: ebpf/rss.bpf.skeleton.h:81:
> +^I}$
>
> ERROR: code indent should never use tabs
> #432: FILE: ebpf/rss.bpf.skeleton.h:82:
> +^Ireturn obj;$
>
> ERROR: code indent should never use tabs
> #438: FILE: ebpf/rss.bpf.skeleton.h:88:
> +^Ireturn bpf_object__attach_skeleton(obj->skeleton);$
>
> ERROR: code indent should never use tabs
> #444: FILE: ebpf/rss.bpf.skeleton.h:94:
> +^Ireturn bpf_object__detach_skeleton(obj->skeleton);$
>
> ERROR: code indent should never use tabs
> #450: FILE: ebpf/rss.bpf.skeleton.h:100:
> +^Istruct bpf_object_skeleton *s;$
>
> ERROR: code indent should never use tabs
> #452: FILE: ebpf/rss.bpf.skeleton.h:102:
> +^Is = (struct bpf_object_skeleton *)calloc(1, sizeof(*s));$
>
> ERROR: code indent should never use tabs
> #453: FILE: ebpf/rss.bpf.skeleton.h:103:
> +^Iif (!s)$
>
> ERROR: braces {} are necessary for all arms of this statement
> #453: FILE: ebpf/rss.bpf.skeleton.h:103:
> +       if (!s)
> [...]
>
> ERROR: code indent should never use tabs
> #454: FILE: ebpf/rss.bpf.skeleton.h:104:
> +^I^Ireturn -1;$
>
> ERROR: code indent should never use tabs
> #455: FILE: ebpf/rss.bpf.skeleton.h:105:
> +^Iobj->skeleton = s;$
>
> ERROR: code indent should never use tabs
> #457: FILE: ebpf/rss.bpf.skeleton.h:107:
> +^Is->sz = sizeof(*s);$
>
> ERROR: code indent should never use tabs
> #458: FILE: ebpf/rss.bpf.skeleton.h:108:
> +^Is->name = "rss_bpf";$
>
> ERROR: code indent should never use tabs
> #459: FILE: ebpf/rss.bpf.skeleton.h:109:
> +^Is->obj = &obj->obj;$
>
> ERROR: code indent should never use tabs
> #461: FILE: ebpf/rss.bpf.skeleton.h:111:
> +^I/* maps */$
>
> ERROR: code indent should never use tabs
> #462: FILE: ebpf/rss.bpf.skeleton.h:112:
> +^Is->map_cnt = 3;$
>
> ERROR: code indent should never use tabs
> #463: FILE: ebpf/rss.bpf.skeleton.h:113:
> +^Is->map_skel_sz = sizeof(*s->maps);$
>
> ERROR: code indent should never use tabs
> #464: FILE: ebpf/rss.bpf.skeleton.h:114:
> +^Is->maps = (struct bpf_map_skeleton *)calloc(s->map_cnt, s->map_skel_sz);$
>
> ERROR: code indent should never use tabs
> #465: FILE: ebpf/rss.bpf.skeleton.h:115:
> +^Iif (!s->maps)$
>
> ERROR: braces {} are necessary for all arms of this statement
> #465: FILE: ebpf/rss.bpf.skeleton.h:115:
> +       if (!s->maps)
> [...]
>
> ERROR: code indent should never use tabs
> #466: FILE: ebpf/rss.bpf.skeleton.h:116:
> +^I^Igoto err;$
>
> ERROR: code indent should never use tabs
> #468: FILE: ebpf/rss.bpf.skeleton.h:118:
> +^Is->maps[0].name = "tap_rss_map_configurations";$
>
> ERROR: code indent should never use tabs
> #469: FILE: ebpf/rss.bpf.skeleton.h:119:
> +^Is->maps[0].map = &obj->maps.tap_rss_map_configurations;$
>
> ERROR: code indent should never use tabs
> #471: FILE: ebpf/rss.bpf.skeleton.h:121:
> +^Is->maps[1].name = "tap_rss_map_indirection_table";$
>
> ERROR: code indent should never use tabs
> #472: FILE: ebpf/rss.bpf.skeleton.h:122:
> +^Is->maps[1].map = &obj->maps.tap_rss_map_indirection_table;$
>
> ERROR: code indent should never use tabs
> #474: FILE: ebpf/rss.bpf.skeleton.h:124:
> +^Is->maps[2].name = "tap_rss_map_toeplitz_key";$
>
> ERROR: code indent should never use tabs
> #475: FILE: ebpf/rss.bpf.skeleton.h:125:
> +^Is->maps[2].map = &obj->maps.tap_rss_map_toeplitz_key;$
>
> ERROR: code indent should never use tabs
> #477: FILE: ebpf/rss.bpf.skeleton.h:127:
> +^I/* programs */$
>
> ERROR: code indent should never use tabs
> #478: FILE: ebpf/rss.bpf.skeleton.h:128:
> +^Is->prog_cnt = 1;$
>
> ERROR: code indent should never use tabs
> #479: FILE: ebpf/rss.bpf.skeleton.h:129:
> +^Is->prog_skel_sz = sizeof(*s->progs);$
>
> WARNING: line over 80 characters
> #480: FILE: ebpf/rss.bpf.skeleton.h:130:
> +       s->progs = (struct bpf_prog_skeleton *)calloc(s->prog_cnt, s->prog_skel_sz);
>
> ERROR: code indent should never use tabs
> #480: FILE: ebpf/rss.bpf.skeleton.h:130:
> +^Is->progs = (struct bpf_prog_skeleton *)calloc(s->prog_cnt, s->prog_skel_sz);$
>
> ERROR: code indent should never use tabs
> #481: FILE: ebpf/rss.bpf.skeleton.h:131:
> +^Iif (!s->progs)$
>
> ERROR: braces {} are necessary for all arms of this statement
> #481: FILE: ebpf/rss.bpf.skeleton.h:131:
> +       if (!s->progs)
> [...]
>
> ERROR: code indent should never use tabs
> #482: FILE: ebpf/rss.bpf.skeleton.h:132:
> +^I^Igoto err;$
>
> ERROR: code indent should never use tabs
> #484: FILE: ebpf/rss.bpf.skeleton.h:134:
> +^Is->progs[0].name = "tun_rss_steering_prog";$
>
> ERROR: code indent should never use tabs
> #485: FILE: ebpf/rss.bpf.skeleton.h:135:
> +^Is->progs[0].prog = &obj->progs.tun_rss_steering_prog;$
>
> ERROR: code indent should never use tabs
> #486: FILE: ebpf/rss.bpf.skeleton.h:136:
> +^Is->progs[0].link = &obj->links.tun_rss_steering_prog;$
>
> ERROR: code indent should never use tabs
> #488: FILE: ebpf/rss.bpf.skeleton.h:138:
> +^Is->data_sz = 8088;$
>
> ERROR: code indent should never use tabs
> #489: FILE: ebpf/rss.bpf.skeleton.h:139:
> +^Is->data = (void *)"\$
>
> ERROR: code indent should never use tabs
> #775: FILE: ebpf/rss.bpf.skeleton.h:425:
> +^Ireturn 0;$
>
> ERROR: code indent should never use tabs
> #777: FILE: ebpf/rss.bpf.skeleton.h:427:
> +^Ibpf_object__destroy_skeleton(s);$
>
> ERROR: code indent should never use tabs
> #778: FILE: ebpf/rss.bpf.skeleton.h:428:
> +^Ireturn -1;$
>
> total: 85 errors, 3 warnings, 779 lines checked
>
> Patch 4/10 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
>
> 5/10 Checking commit 905729afbb3f (virtio-net: Added eBPF RSS to virtio-net.)
> WARNING: line over 80 characters
> #186: FILE: hw/net/virtio-net.c:2868:
> +                    warn_report("Can't post-load eBPF RSS - fallback to software RSS");
>
> total: 0 errors, 1 warnings, 214 lines checked
>
> Patch 5/10 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 6/10 Checking commit ab65d982d37d (docs: Added eBPF documentation.)
> Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #17:
> new file mode 100644
>
> total: 0 errors, 1 warnings, 129 lines checked
>
> Patch 6/10 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 7/10 Checking commit 729e8df02f0b (MAINTAINERS: Added eBPF maintainers information.)
> 8/10 Checking commit 3dc299dfc4b7 (hw/net/imx_fec: return 0xffff when accessing non-existing PHY)
> 9/10 Checking commit 4b987f4d63d7 (virtio-net: failover: add missing remove_migration_state_change_notifier())
> 10/10 Checking commit a34d81aa5179 (tap-bsd: Remove special casing for older OpenBSD releases)
> === OUTPUT END ===
>
> Test command exited with code: 1
>
>
> The full log is available at
> http://patchew.org/logs/1620458319-5670-1-git-send-email-jasowang@redhat.com/testing.checkpatch/?type=message.
> ---
> Email generated automatically by Patchew [https://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL 00/10] Net patches
  2021-05-08  7:18 Jason Wang
@ 2021-05-08  7:31 ` no-reply
  2021-05-08  7:59   ` Jason Wang
  2021-05-11 20:20 ` Peter Maydell
  1 sibling, 1 reply; 21+ messages in thread
From: no-reply @ 2021-05-08  7:31 UTC (permalink / raw)
  To: jasowang; +Cc: peter.maydell, qemu-devel

Patchew URL: https://patchew.org/QEMU/1620458319-5670-1-git-send-email-jasowang@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1620458319-5670-1-git-send-email-jasowang@redhat.com
Subject: [PULL 00/10] Net patches

=== 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/1620402803-9237-1-git-send-email-jag.raman@oracle.com -> patchew/1620402803-9237-1-git-send-email-jag.raman@oracle.com
 * [new tag]         patchew/1620458319-5670-1-git-send-email-jasowang@redhat.com -> patchew/1620458319-5670-1-git-send-email-jasowang@redhat.com
Switched to a new branch 'test'
a34d81a tap-bsd: Remove special casing for older OpenBSD releases
4b987f4 virtio-net: failover: add missing remove_migration_state_change_notifier()
3dc299d hw/net/imx_fec: return 0xffff when accessing non-existing PHY
729e8df MAINTAINERS: Added eBPF maintainers information.
ab65d98 docs: Added eBPF documentation.
905729a virtio-net: Added eBPF RSS to virtio-net.
5a7d393 ebpf: Added eBPF RSS loader.
eae9462 ebpf: Added eBPF RSS program.
b6962be net: Added SetSteeringEBPF method for NetClientState.
1207c8e net/tap: Added TUNSETSTEERINGEBPF code.

=== OUTPUT BEGIN ===
1/10 Checking commit 1207c8e2a076 (net/tap: Added TUNSETSTEERINGEBPF code.)
2/10 Checking commit b6962be9ca91 (net: Added SetSteeringEBPF method for NetClientState.)
3/10 Checking commit eae94621a4b1 (ebpf: Added eBPF RSS program.)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#23: 
new file mode 100755

WARNING: line over 80 characters
#211: FILE: tools/ebpf/rss.bpf.c:157:
+ * According to https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml

WARNING: line over 80 characters
#214: FILE: tools/ebpf/rss.bpf.c:160:
+ * Need to choose reasonable amount of maximum extensions/options we may check to find

WARNING: line over 80 characters
#281: FILE: tools/ebpf/rss.bpf.c:227:
+                        *l4_offset + opt_offset + offsetof(struct ipv6_destopt_hao, addr),

total: 0 errors, 4 warnings, 590 lines checked

Patch 3/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/10 Checking commit 5a7d3933bfa3 (ebpf: Added eBPF RSS loader.)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#72: 
new file mode 100644

WARNING: architecture specific defines should be avoided
#354: FILE: ebpf/rss.bpf.skeleton.h:4:
+#ifndef __RSS_BPF_SKEL_H__

ERROR: code indent should never use tabs
#361: FILE: ebpf/rss.bpf.skeleton.h:11:
+^Istruct bpf_object_skeleton *skeleton;$

ERROR: code indent should never use tabs
#362: FILE: ebpf/rss.bpf.skeleton.h:12:
+^Istruct bpf_object *obj;$

ERROR: code indent should never use tabs
#363: FILE: ebpf/rss.bpf.skeleton.h:13:
+^Istruct {$

ERROR: code indent should never use tabs
#364: FILE: ebpf/rss.bpf.skeleton.h:14:
+^I^Istruct bpf_map *tap_rss_map_configurations;$

ERROR: code indent should never use tabs
#365: FILE: ebpf/rss.bpf.skeleton.h:15:
+^I^Istruct bpf_map *tap_rss_map_indirection_table;$

ERROR: code indent should never use tabs
#366: FILE: ebpf/rss.bpf.skeleton.h:16:
+^I^Istruct bpf_map *tap_rss_map_toeplitz_key;$

ERROR: code indent should never use tabs
#367: FILE: ebpf/rss.bpf.skeleton.h:17:
+^I} maps;$

ERROR: code indent should never use tabs
#368: FILE: ebpf/rss.bpf.skeleton.h:18:
+^Istruct {$

ERROR: code indent should never use tabs
#369: FILE: ebpf/rss.bpf.skeleton.h:19:
+^I^Istruct bpf_program *tun_rss_steering_prog;$

ERROR: code indent should never use tabs
#370: FILE: ebpf/rss.bpf.skeleton.h:20:
+^I} progs;$

ERROR: code indent should never use tabs
#371: FILE: ebpf/rss.bpf.skeleton.h:21:
+^Istruct {$

ERROR: code indent should never use tabs
#372: FILE: ebpf/rss.bpf.skeleton.h:22:
+^I^Istruct bpf_link *tun_rss_steering_prog;$

ERROR: code indent should never use tabs
#373: FILE: ebpf/rss.bpf.skeleton.h:23:
+^I} links;$

ERROR: code indent should never use tabs
#379: FILE: ebpf/rss.bpf.skeleton.h:29:
+^Iif (!obj)$

ERROR: braces {} are necessary for all arms of this statement
#379: FILE: ebpf/rss.bpf.skeleton.h:29:
+       if (!obj)
[...]

ERROR: code indent should never use tabs
#380: FILE: ebpf/rss.bpf.skeleton.h:30:
+^I^Ireturn;$

ERROR: code indent should never use tabs
#381: FILE: ebpf/rss.bpf.skeleton.h:31:
+^Iif (obj->skeleton)$

ERROR: braces {} are necessary for all arms of this statement
#381: FILE: ebpf/rss.bpf.skeleton.h:31:
+       if (obj->skeleton)
[...]

ERROR: code indent should never use tabs
#382: FILE: ebpf/rss.bpf.skeleton.h:32:
+^I^Ibpf_object__destroy_skeleton(obj->skeleton);$

ERROR: code indent should never use tabs
#383: FILE: ebpf/rss.bpf.skeleton.h:33:
+^Ifree(obj);$

ERROR: code indent should never use tabs
#392: FILE: ebpf/rss.bpf.skeleton.h:42:
+^Istruct rss_bpf *obj;$

ERROR: code indent should never use tabs
#394: FILE: ebpf/rss.bpf.skeleton.h:44:
+^Iobj = (struct rss_bpf *)calloc(1, sizeof(*obj));$

ERROR: code indent should never use tabs
#395: FILE: ebpf/rss.bpf.skeleton.h:45:
+^Iif (!obj)$

ERROR: braces {} are necessary for all arms of this statement
#395: FILE: ebpf/rss.bpf.skeleton.h:45:
+       if (!obj)
[...]

ERROR: code indent should never use tabs
#396: FILE: ebpf/rss.bpf.skeleton.h:46:
+^I^Ireturn NULL;$

ERROR: code indent should never use tabs
#397: FILE: ebpf/rss.bpf.skeleton.h:47:
+^Iif (rss_bpf__create_skeleton(obj))$

ERROR: braces {} are necessary for all arms of this statement
#397: FILE: ebpf/rss.bpf.skeleton.h:47:
+       if (rss_bpf__create_skeleton(obj))
[...]

ERROR: code indent should never use tabs
#398: FILE: ebpf/rss.bpf.skeleton.h:48:
+^I^Igoto err;$

ERROR: code indent should never use tabs
#399: FILE: ebpf/rss.bpf.skeleton.h:49:
+^Iif (bpf_object__open_skeleton(obj->skeleton, opts))$

ERROR: braces {} are necessary for all arms of this statement
#399: FILE: ebpf/rss.bpf.skeleton.h:49:
+       if (bpf_object__open_skeleton(obj->skeleton, opts))
[...]

ERROR: code indent should never use tabs
#400: FILE: ebpf/rss.bpf.skeleton.h:50:
+^I^Igoto err;$

ERROR: code indent should never use tabs
#402: FILE: ebpf/rss.bpf.skeleton.h:52:
+^Ireturn obj;$

ERROR: code indent should never use tabs
#404: FILE: ebpf/rss.bpf.skeleton.h:54:
+^Irss_bpf__destroy(obj);$

ERROR: code indent should never use tabs
#405: FILE: ebpf/rss.bpf.skeleton.h:55:
+^Ireturn NULL;$

ERROR: code indent should never use tabs
#411: FILE: ebpf/rss.bpf.skeleton.h:61:
+^Ireturn rss_bpf__open_opts(NULL);$

ERROR: code indent should never use tabs
#417: FILE: ebpf/rss.bpf.skeleton.h:67:
+^Ireturn bpf_object__load_skeleton(obj->skeleton);$

ERROR: code indent should never use tabs
#423: FILE: ebpf/rss.bpf.skeleton.h:73:
+^Istruct rss_bpf *obj;$

ERROR: code indent should never use tabs
#425: FILE: ebpf/rss.bpf.skeleton.h:75:
+^Iobj = rss_bpf__open();$

ERROR: code indent should never use tabs
#426: FILE: ebpf/rss.bpf.skeleton.h:76:
+^Iif (!obj)$

ERROR: braces {} are necessary for all arms of this statement
#426: FILE: ebpf/rss.bpf.skeleton.h:76:
+       if (!obj)
[...]

ERROR: code indent should never use tabs
#427: FILE: ebpf/rss.bpf.skeleton.h:77:
+^I^Ireturn NULL;$

ERROR: code indent should never use tabs
#428: FILE: ebpf/rss.bpf.skeleton.h:78:
+^Iif (rss_bpf__load(obj)) {$

ERROR: code indent should never use tabs
#429: FILE: ebpf/rss.bpf.skeleton.h:79:
+^I^Irss_bpf__destroy(obj);$

ERROR: code indent should never use tabs
#430: FILE: ebpf/rss.bpf.skeleton.h:80:
+^I^Ireturn NULL;$

ERROR: code indent should never use tabs
#431: FILE: ebpf/rss.bpf.skeleton.h:81:
+^I}$

ERROR: code indent should never use tabs
#432: FILE: ebpf/rss.bpf.skeleton.h:82:
+^Ireturn obj;$

ERROR: code indent should never use tabs
#438: FILE: ebpf/rss.bpf.skeleton.h:88:
+^Ireturn bpf_object__attach_skeleton(obj->skeleton);$

ERROR: code indent should never use tabs
#444: FILE: ebpf/rss.bpf.skeleton.h:94:
+^Ireturn bpf_object__detach_skeleton(obj->skeleton);$

ERROR: code indent should never use tabs
#450: FILE: ebpf/rss.bpf.skeleton.h:100:
+^Istruct bpf_object_skeleton *s;$

ERROR: code indent should never use tabs
#452: FILE: ebpf/rss.bpf.skeleton.h:102:
+^Is = (struct bpf_object_skeleton *)calloc(1, sizeof(*s));$

ERROR: code indent should never use tabs
#453: FILE: ebpf/rss.bpf.skeleton.h:103:
+^Iif (!s)$

ERROR: braces {} are necessary for all arms of this statement
#453: FILE: ebpf/rss.bpf.skeleton.h:103:
+       if (!s)
[...]

ERROR: code indent should never use tabs
#454: FILE: ebpf/rss.bpf.skeleton.h:104:
+^I^Ireturn -1;$

ERROR: code indent should never use tabs
#455: FILE: ebpf/rss.bpf.skeleton.h:105:
+^Iobj->skeleton = s;$

ERROR: code indent should never use tabs
#457: FILE: ebpf/rss.bpf.skeleton.h:107:
+^Is->sz = sizeof(*s);$

ERROR: code indent should never use tabs
#458: FILE: ebpf/rss.bpf.skeleton.h:108:
+^Is->name = "rss_bpf";$

ERROR: code indent should never use tabs
#459: FILE: ebpf/rss.bpf.skeleton.h:109:
+^Is->obj = &obj->obj;$

ERROR: code indent should never use tabs
#461: FILE: ebpf/rss.bpf.skeleton.h:111:
+^I/* maps */$

ERROR: code indent should never use tabs
#462: FILE: ebpf/rss.bpf.skeleton.h:112:
+^Is->map_cnt = 3;$

ERROR: code indent should never use tabs
#463: FILE: ebpf/rss.bpf.skeleton.h:113:
+^Is->map_skel_sz = sizeof(*s->maps);$

ERROR: code indent should never use tabs
#464: FILE: ebpf/rss.bpf.skeleton.h:114:
+^Is->maps = (struct bpf_map_skeleton *)calloc(s->map_cnt, s->map_skel_sz);$

ERROR: code indent should never use tabs
#465: FILE: ebpf/rss.bpf.skeleton.h:115:
+^Iif (!s->maps)$

ERROR: braces {} are necessary for all arms of this statement
#465: FILE: ebpf/rss.bpf.skeleton.h:115:
+       if (!s->maps)
[...]

ERROR: code indent should never use tabs
#466: FILE: ebpf/rss.bpf.skeleton.h:116:
+^I^Igoto err;$

ERROR: code indent should never use tabs
#468: FILE: ebpf/rss.bpf.skeleton.h:118:
+^Is->maps[0].name = "tap_rss_map_configurations";$

ERROR: code indent should never use tabs
#469: FILE: ebpf/rss.bpf.skeleton.h:119:
+^Is->maps[0].map = &obj->maps.tap_rss_map_configurations;$

ERROR: code indent should never use tabs
#471: FILE: ebpf/rss.bpf.skeleton.h:121:
+^Is->maps[1].name = "tap_rss_map_indirection_table";$

ERROR: code indent should never use tabs
#472: FILE: ebpf/rss.bpf.skeleton.h:122:
+^Is->maps[1].map = &obj->maps.tap_rss_map_indirection_table;$

ERROR: code indent should never use tabs
#474: FILE: ebpf/rss.bpf.skeleton.h:124:
+^Is->maps[2].name = "tap_rss_map_toeplitz_key";$

ERROR: code indent should never use tabs
#475: FILE: ebpf/rss.bpf.skeleton.h:125:
+^Is->maps[2].map = &obj->maps.tap_rss_map_toeplitz_key;$

ERROR: code indent should never use tabs
#477: FILE: ebpf/rss.bpf.skeleton.h:127:
+^I/* programs */$

ERROR: code indent should never use tabs
#478: FILE: ebpf/rss.bpf.skeleton.h:128:
+^Is->prog_cnt = 1;$

ERROR: code indent should never use tabs
#479: FILE: ebpf/rss.bpf.skeleton.h:129:
+^Is->prog_skel_sz = sizeof(*s->progs);$

WARNING: line over 80 characters
#480: FILE: ebpf/rss.bpf.skeleton.h:130:
+       s->progs = (struct bpf_prog_skeleton *)calloc(s->prog_cnt, s->prog_skel_sz);

ERROR: code indent should never use tabs
#480: FILE: ebpf/rss.bpf.skeleton.h:130:
+^Is->progs = (struct bpf_prog_skeleton *)calloc(s->prog_cnt, s->prog_skel_sz);$

ERROR: code indent should never use tabs
#481: FILE: ebpf/rss.bpf.skeleton.h:131:
+^Iif (!s->progs)$

ERROR: braces {} are necessary for all arms of this statement
#481: FILE: ebpf/rss.bpf.skeleton.h:131:
+       if (!s->progs)
[...]

ERROR: code indent should never use tabs
#482: FILE: ebpf/rss.bpf.skeleton.h:132:
+^I^Igoto err;$

ERROR: code indent should never use tabs
#484: FILE: ebpf/rss.bpf.skeleton.h:134:
+^Is->progs[0].name = "tun_rss_steering_prog";$

ERROR: code indent should never use tabs
#485: FILE: ebpf/rss.bpf.skeleton.h:135:
+^Is->progs[0].prog = &obj->progs.tun_rss_steering_prog;$

ERROR: code indent should never use tabs
#486: FILE: ebpf/rss.bpf.skeleton.h:136:
+^Is->progs[0].link = &obj->links.tun_rss_steering_prog;$

ERROR: code indent should never use tabs
#488: FILE: ebpf/rss.bpf.skeleton.h:138:
+^Is->data_sz = 8088;$

ERROR: code indent should never use tabs
#489: FILE: ebpf/rss.bpf.skeleton.h:139:
+^Is->data = (void *)"\$

ERROR: code indent should never use tabs
#775: FILE: ebpf/rss.bpf.skeleton.h:425:
+^Ireturn 0;$

ERROR: code indent should never use tabs
#777: FILE: ebpf/rss.bpf.skeleton.h:427:
+^Ibpf_object__destroy_skeleton(s);$

ERROR: code indent should never use tabs
#778: FILE: ebpf/rss.bpf.skeleton.h:428:
+^Ireturn -1;$

total: 85 errors, 3 warnings, 779 lines checked

Patch 4/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

5/10 Checking commit 905729afbb3f (virtio-net: Added eBPF RSS to virtio-net.)
WARNING: line over 80 characters
#186: FILE: hw/net/virtio-net.c:2868:
+                    warn_report("Can't post-load eBPF RSS - fallback to software RSS");

total: 0 errors, 1 warnings, 214 lines checked

Patch 5/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
6/10 Checking commit ab65d982d37d (docs: Added eBPF documentation.)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#17: 
new file mode 100644

total: 0 errors, 1 warnings, 129 lines checked

Patch 6/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/10 Checking commit 729e8df02f0b (MAINTAINERS: Added eBPF maintainers information.)
8/10 Checking commit 3dc299dfc4b7 (hw/net/imx_fec: return 0xffff when accessing non-existing PHY)
9/10 Checking commit 4b987f4d63d7 (virtio-net: failover: add missing remove_migration_state_change_notifier())
10/10 Checking commit a34d81aa5179 (tap-bsd: Remove special casing for older OpenBSD releases)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/1620458319-5670-1-git-send-email-jasowang@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PULL 00/10] Net patches
@ 2021-05-08  7:18 Jason Wang
  2021-05-08  7:31 ` no-reply
  2021-05-11 20:20 ` Peter Maydell
  0 siblings, 2 replies; 21+ messages in thread
From: Jason Wang @ 2021-05-08  7:18 UTC (permalink / raw)
  To: peter.maydell; +Cc: qemu-devel

The following changes since commit d90f154867ec0ec22fd719164b88716e8fd48672:

  Merge remote-tracking branch 'remotes/dg-gitlab/tags/ppc-for-6.1-20210504' into staging (2021-05-05 20:29:14 +0100)

are available in the git repository at:

  https://github.com/jasowang/qemu.git tags/net-pull-request

for you to fetch changes up to 2bdeb0c2564c36b218ac73e21d7a6f6accb49091:

  tap-bsd: Remove special casing for older OpenBSD releases (2021-05-08 13:59:12 +0800)

----------------------------------------------------------------

----------------------------------------------------------------
Andrew Melnychenko (7):
      net/tap: Added TUNSETSTEERINGEBPF code.
      net: Added SetSteeringEBPF method for NetClientState.
      ebpf: Added eBPF RSS program.
      ebpf: Added eBPF RSS loader.
      virtio-net: Added eBPF RSS to virtio-net.
      docs: Added eBPF documentation.
      MAINTAINERS: Added eBPF maintainers information.

Brad Smith (1):
      tap-bsd: Remove special casing for older OpenBSD releases

Guenter Roeck (1):
      hw/net/imx_fec: return 0xffff when accessing non-existing PHY

Laurent Vivier (1):
      virtio-net: failover: add missing remove_migration_state_change_notifier()

 MAINTAINERS                    |   8 +
 configure                      |   8 +-
 docs/devel/ebpf_rss.rst        | 125 +++++++++
 docs/devel/index.rst           |   1 +
 ebpf/ebpf_rss-stub.c           |  40 +++
 ebpf/ebpf_rss.c                | 165 ++++++++++++
 ebpf/ebpf_rss.h                |  44 ++++
 ebpf/meson.build               |   1 +
 ebpf/rss.bpf.skeleton.h        | 431 +++++++++++++++++++++++++++++++
 ebpf/trace-events              |   4 +
 ebpf/trace.h                   |   1 +
 hw/net/imx_fec.c               |   8 +-
 hw/net/trace-events            |   2 +
 hw/net/vhost_net.c             |   3 +
 hw/net/virtio-net.c            | 116 ++++++++-
 include/hw/virtio/virtio-net.h |   4 +
 include/net/net.h              |   2 +
 meson.build                    |  23 ++
 meson_options.txt              |   2 +
 net/tap-bsd.c                  |  13 +-
 net/tap-linux.c                |  13 +
 net/tap-linux.h                |   1 +
 net/tap-solaris.c              |   5 +
 net/tap-stub.c                 |   5 +
 net/tap.c                      |   9 +
 net/tap_int.h                  |   1 +
 net/vhost-vdpa.c               |   2 +
 tools/ebpf/Makefile.ebpf       |  21 ++
 tools/ebpf/rss.bpf.c           | 569 +++++++++++++++++++++++++++++++++++++++++
 29 files changed, 1610 insertions(+), 17 deletions(-)
 create mode 100644 docs/devel/ebpf_rss.rst
 create mode 100644 ebpf/ebpf_rss-stub.c
 create mode 100644 ebpf/ebpf_rss.c
 create mode 100644 ebpf/ebpf_rss.h
 create mode 100644 ebpf/meson.build
 create mode 100644 ebpf/rss.bpf.skeleton.h
 create mode 100644 ebpf/trace-events
 create mode 100644 ebpf/trace.h
 create mode 100755 tools/ebpf/Makefile.ebpf
 create mode 100644 tools/ebpf/rss.bpf.c




^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-02-16  4:46 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14  6:11 [PULL 00/10] Net patches Jason Wang
2023-02-14  6:11 ` [PULL 01/10] net: Move the code to collect available NIC models to a separate function Jason Wang
2023-02-14  6:11 ` [PULL 02/10] net: Restore printing of the help text with "-nic help" Jason Wang
2023-02-14  6:11 ` [PULL 03/10] net: Replace "Supported NIC models" with "Available NIC models" Jason Wang
2023-02-14  6:11 ` [PULL 04/10] hw/net/lan9118: log [read|write]b when mode_16bit is enabled rather than abort Jason Wang
2023-02-14  6:11 ` [PULL 05/10] hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value Jason Wang
2023-02-14  6:11 ` [PULL 06/10] net: Increase L2TPv3 buffer to fit jumboframes Jason Wang
2023-02-14  6:11 ` [PULL 07/10] vmnet: stop recieving events when VM is stopped Jason Wang
2023-02-14  6:11 ` [PULL 08/10] hw/net/can/xlnx-zynqmp-can: fix assertion failures in transfer_fifo() Jason Wang
2023-02-15 14:56   ` Philippe Mathieu-Daudé
2023-02-14  6:11 ` [PULL 09/10] net: stream: add a new option to automatically reconnect Jason Wang
2023-02-14  6:11 ` [PULL 10/10] vdpa: fix VHOST_BACKEND_F_IOTLB_ASID flag check Jason Wang
2023-02-14 14:29 ` [PULL 00/10] Net patches Peter Maydell
2023-02-14 14:30   ` Peter Maydell
2023-02-15 14:39     ` Laurent Vivier
2023-02-16  4:45       ` Jason Wang
  -- strict thread matches above, loose matches on Subject: below --
2021-05-08  7:18 Jason Wang
2021-05-08  7:31 ` no-reply
2021-05-08  7:59   ` Jason Wang
2021-05-11 20:20 ` Peter Maydell
2021-05-12  2:53   ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).