From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1538DA0C4E; Sun, 5 Dec 2021 05:42:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 988BA40040; Sun, 5 Dec 2021 05:42:46 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id EFA3D4003C for ; Sun, 5 Dec 2021 05:42:45 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id w33-20020a17090a6ba400b001a722a06212so7471083pjj.0 for ; Sat, 04 Dec 2021 20:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=LveDOJlThs8HrpAohuHdLFJiIcFJVWA0bucfIgjfm7o=; b=UFfF5/y/qVNSwvFqVVCw5BQRIAdwzVNpTCcdNZi/NLpr6MgJjiMq66JjmjIdogSJaU lIS3T1aCpkApKVTFJmyxc/Vf+94w0YGI+1P2QRmBdd69qKz6Lofe7DnNHWhHMdCsnGrB kVrJd7tlOCQmo9yV6rYq/GDAz8TQIo+rXzaI/NHM7GKoABkeU4K4z7dN6acYAI7Y0XF5 8rEmQorDGjFsQNFriAzG7Puwdni4CxCsuPSYZ2tCzrqmxrl8gS8laPK8hVMB1k9sYeSF 9Xk4WRwFROq1nxAaz5ggXoJ2VedsoRrcHAJFH164Ik0pcA/14VVctUXHHnUwBfSGSv/t aeNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=LveDOJlThs8HrpAohuHdLFJiIcFJVWA0bucfIgjfm7o=; b=NabNa9LhJ2nyhesaYh01dOW/Ngw/zdrOXCv+V8UVIvhnZKxEpImvrYlt+qjPQ8UZJy KhzlEXuGz5kSXqYclfrSvfDjXuws9D78pwm1UN+qAwfTtUmIeGYZh1hZoco+YjZWBfii UQlVhXwW1SPv3ZzDOaeEIfKzxySEHxS6iYpYuAX+6m/B/NHDZ2aZhH+Gpnj7nN7HneYo kCc9OFmsl8NN84POjdRx/H0nmlxoJ8o2rh4ugIlfF77yoQcg37zYZ6QJaStxqt948xHT HX+dEHGbDlK4Thed+dImaKfmi4WacG9SNRJsJRbyQJhCH2msfSdNwNMYo0ny3WAiCpGI UeBw== X-Gm-Message-State: AOAM530xBhC4FXcCzkahrMyW9Kt2d9055IjLjuOlao0BDcIbRlLyjEni QWdBXOrHMNhWMS6nNVOaLNpGNFXF47c= X-Google-Smtp-Source: ABdhPJz9hK7cEH+6aZPGfIs/otSm5P+aLoPZb4WeCHiPe4kjOs4VqhcU0IoKzxxLq1Lrqcx8uXgD4g== X-Received: by 2002:a17:903:246:b0:143:c007:7d41 with SMTP id j6-20020a170903024600b00143c0077d41mr34378822plh.59.1638679364803; Sat, 04 Dec 2021 20:42:44 -0800 (PST) Received: from localhost.localdomain ([157.255.44.216]) by smtp.gmail.com with ESMTPSA id t13sm7741462pfl.214.2021.12.04.20.42.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 20:42:44 -0800 (PST) From: Harold Huang To: dev@dpdk.org Subject: [PATCH v2] net/kni: reset rte_kni_conf struct before initialization Date: Sun, 5 Dec 2021 12:42:30 +0800 Message-Id: <20211205044230.2146683-1-baymaxhuang@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(+) 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; -- 2.27.0