From patchwork Fri Dec 3 07:24:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harold Huang X-Patchwork-Id: 104846 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E5B65A0548; Fri, 3 Dec 2021 08:24:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78C334014F; Fri, 3 Dec 2021 08:24:42 +0100 (CET) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 1A98B40041 for ; Fri, 3 Dec 2021 08:24:41 +0100 (CET) Received: by mail-pj1-f46.google.com with SMTP id cq22-20020a17090af99600b001a9550a17a5so4476586pjb.2 for ; Thu, 02 Dec 2021 23:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=KuqVvhXWYJA5xFib/b6iGyZNeyVBu2kZ1q8D/bPSUOg=; b=qQvyEdQPYGxsQhcz5YEqtX6/2M8kiKBdQHQ6Ydncq71ZBpHBwq6kR8KZSGMNr4Md4X GWRpaCJPd+q+BL3MD6yOyTmYeLygW+G4vgcD78ixELAhRyr3N7zntN9uSut1e256Z6gY BbjOdAZLtLPf1+74M4VvyIcHrHoOhSSEPlgaaXiwdavn8ALNyYe5nFCjwvD7TVZK2GJP Xa7cPWDic5+o39/adhtO17cBMDmhnQlRhYC8ms9Z9S8oMta3zF88ZPGSqSB3N21ds8ge EqoltQbbnDBBuELApol+H3G6Cj0lboBXrgLAso2NtWaakBW+R2TA/vXd7NXtL9bRoS2+ 2uSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=KuqVvhXWYJA5xFib/b6iGyZNeyVBu2kZ1q8D/bPSUOg=; b=SjvTT86LXaySi9FPd0I9oaRgoyThMPnDMQUq3hYx0wCfotP0Bu6BRghU+4emkuzc+K vi8GbuqLiPSEIQGfdmTryzSD4Zzng4tQZLT/+bKCgNoi1n6O3xk04UZ0YFIrA5qQoT17 cpoIXew4PULNnAoUZ14BULRmYfp3Lu4ygca6P5rtw/l9Mz1uSTkXp17+wvSddaAWEs5Q lQ7CsFda07FCHRKIghUE32H/gcjVcX9aKuQ1462hGUmLFgG4AOglpHJ7hhbpzDcsuuUZ eL4a6yxhQe4/L8DsIu/T5dqTFw+mtu/0kSKXaLTYmpXDb4fVkwCzJ1HBhhmvR+MsmlMe ehDw== X-Gm-Message-State: AOAM530KLDvSzMwrL6LR+ymVL/n7ln2CbHycPlmoC0LeC+PlZnI1spXA Y6FpGDgiCMzjsjRHjtUbE7I6q1wyId05zOWcNcNRHxyvkUs= X-Google-Smtp-Source: ABdhPJwc2dz6iBZ1Y1BN2KqQXiY50ttkWgaVEbrIePHJfnCoN4r3Htp0T/ouL9XFoG8+8h5tSbtiS+vlRju0ogr2oDg= X-Received: by 2002:a17:902:d4c2:b0:142:2039:e8e5 with SMTP id o2-20020a170902d4c200b001422039e8e5mr21135741plg.18.1638516280038; Thu, 02 Dec 2021 23:24:40 -0800 (PST) MIME-Version: 1.0 From: Harold Huang Date: Fri, 3 Dec 2021 15:24:29 +0800 Message-ID: Subject: [PATCH] net/kni: reset rte_kni_conf struct before initialization To: dev@dpdk.org Cc: ferruh.yigit@intel.com, lironh@marvell.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- drivers/net/kni/rte_eth_kni.c | 1 + 1 file changed, 1 insertion(+) -- 2.18.2 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;