From a3a7693c02d383ce9cab3c1a54ade6274bbb6dec Mon Sep 17 00:00:00 2001
From: liyang_12921 <[email protected]>
Date: Mon, 30 Aug 2021 17:41:56 +0800
Subject: [PATCH] netdev-dpdk: Fix comparing virtio driver name


---
 lib/netdev-dpdk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


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;
--
2.20.1




| |
liyang_12921
|
|
|
签名由网易邮箱大师定制
On 8/30/2021 17:23,liyang_12921<[email protected]> wrote:
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
|
|
|

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to