[ovs-dev] [PATCH 1/1] netdev-dpdk: Fix comparing virtio driver name

liyang_12921 liyang_12921 at 163.com
Mon Aug 30 09:23:10 UTC 2021


Replace strcmp() with strncmp(), because the strcmp() function requires that the two strings are exactly the same.


diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 45a96b9be..4cf372b7a 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -963,7 +963,8 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq)


     /* As of DPDK 19.11, it is not allowed to set a mq_mode for
      * virtio PMD driver. */
-    if (!strcmp(info.driver_name, "net_virtio")) {
+    const char *virtio_driver_name = "net_virtio";
+    if (!strncmp(info.driver_name, virtio_driver_name, sizeof(virtio_driver_name))) {
         conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
     } else {
         conf.rxmode.mq_mode = ETH_MQ_RX_RSS;




| |
liyang_12921
|
|
|



More information about the dev mailing list