diff mbox series

net/kni: reset rte_kni_conf struct before initialization

Message ID CAHJXk3bKEZr5oDPP6WCWWAr=j9urWQU030aMr4g3BFn0_Ar2Hw@mail.gmail.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series net/kni: reset rte_kni_conf struct before initialization | expand

Checks

Context Check Description
ci/iol-testing warning apply patch failure
ci/Intel-compilation warning apply issues
ci/checkpatch warning coding style issues

Commit Message

Harold Huang Dec. 3, 2021, 7:24 a.m. UTC
When kni driver calls eth_kni_start to start device, some fields such
as min_mtu and max_mtu of rte_kni_conf are not initialized. It will
cause kni_ioctl_create create a kni netdevice with a random min_mtu
and max_mtu value. This is unexpected and in some time we could not
change the kni device mtu with ip link command.

Fixes: ff1e35fb5f8 ("kni: calculate MTU from mbuf size")
Signed-off-by: Harold Huang <baymaxhuang@gmail.com>
---
 drivers/net/kni/rte_eth_kni.c | 1 +
 1 file changed, 1 insertion(+)

--
2.18.2
diff mbox series

Patch

diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index c428caf441..23b15edfac 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -128,6 +128,7 @@  eth_kni_start(struct rte_eth_dev *dev)
  const char *name = dev->device->name + 4; /* remove net_ */

  mb_pool = internals->rx_queues[0].mb_pool;
+ memset(&conf, 0, sizeof(conf));
  strlcpy(conf.name, name, RTE_KNI_NAMESIZE);
  conf.force_bind = 0;
  conf.group_id = port_id;