From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by dpdk.org (Postfix) with ESMTP id 0D94E4C74 for ; Wed, 12 Sep 2018 01:29:34 +0200 (CEST) Received: by mail-qt0-f196.google.com with SMTP id g53-v6so26417qtg.10 for ; Tue, 11 Sep 2018 16:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xX5BCN1EA1YvdGifpFtBi3+Bd3fV7UXIa4dFxGhfigs=; b=lDrW5xwn5txmyUMWCyqYldoDx8rKm+fnxw+vUUIMejQnodaWavIkRDCytwtOfioLOJ /zcd8pl2f8GQiPfwz91eY/ntH1+DKfrGe8QuGPlElCVSibfoCtoWPzHhOtd7mkENwFnx 0U2JnJH4W4/5LpKYrFT/cEtfGI/G8hjgVGuo3Ywxic+G4g8PkB9J1PdJ3B15hKa5C6uj pctz6zTYufWw4g9bsuWtPwQGpIzd7OosvgWyeKKd3iqy24QYH7qGE40Enhn2vyDHCYzo 5rbKIOwhGz3RW7NkfZAb/aPsxK0zL5FRCeu3C/GK9VEoultqUmVPIMQoNo48SK042xqW IIFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xX5BCN1EA1YvdGifpFtBi3+Bd3fV7UXIa4dFxGhfigs=; b=gzWle38a5ZO2KXQuHWujfdr1Mhh7hM6yZfW1YTBY1iXHNPzVC04jc3ytSvh/cqZq1C XQ44ioNsE6zgrnJnGvKFWvxDcwGFEbKNp/URbnTVwDqLkZ2BUF6+lKFBw0YOmMdcTmk9 M3dgY5N4j/u4Fqa5l4jhO7wmMxYx3OZFPIOoUWPCu0HFR4t5r9Y+lsvcMVcDksUgyfXV QdEDs/EPlWe+i4KbscljSIiX/jEzfvndvOtIov9nSjeS7NAR+3abVbUvi/fp6IOx2ILy XHTCbcUYLz4n/HS4xcXAI+toh692BIaSttLlRO3lDalcDYBwH/27LmFXkZroEOezBKaA 3d4Q== X-Gm-Message-State: APzg51D9mk19Q04mFvpvtZoRUbeLsB05FXXuZzXKdhWhapggfkNTN+kt Gk/K2I8Igp+un8BWCpZMM1fEdTZc X-Google-Smtp-Source: ANB0Vda7hH9Io1AYjU/lkBnhKDoCYz8OxkrJhgV8o60uM8EguNyit13hJdGx2EQp0X4VaUQefrnHdg== X-Received: by 2002:aed:3ceb:: with SMTP id e40-v6mr22251160qtf.157.1536708568925; Tue, 11 Sep 2018 16:29:28 -0700 (PDT) Received: from snappy.local.lan (189-46-164-241.dsl.telesp.net.br. [189.46.164.241]) by smtp.gmail.com with ESMTPSA id p30-v6sm12767814qta.4.2018.09.11.16.29.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Sep 2018 16:29:28 -0700 (PDT) Sender: Dan Gora From: Dan Gora To: dev@dpdk.org Cc: Igor Ryzhov , Stephen Hemminger , Ferruh Yigit , Dan Gora Date: Tue, 11 Sep 2018 20:29:06 -0300 Message-Id: <20180911232906.18352-3-dg@adax.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180911232906.18352-1-dg@adax.com> References: <20180911232906.18352-1-dg@adax.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/2] kni: set default carrier state to 'off' X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2018 23:29:34 -0000 Set the carrier state to 'off' when the interface is instantiated or when it is marked 'up' or 'down'. This is necessary to set the interface to a known operational state until the carrier state is changed with rte_kni_update_link(). Signed-off-by: Dan Gora --- kernel/linux/kni/kni_misc.c | 2 ++ kernel/linux/kni/kni_net.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c index fa69f8e63..45649499d 100644 --- a/kernel/linux/kni/kni_misc.c +++ b/kernel/linux/kni/kni_misc.c @@ -466,6 +466,8 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num, return -ENODEV; } + netif_carrier_off(net_dev); + ret = kni_run_thread(knet, kni, dev_info.force_bind); if (ret != 0) return ret; diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index 7fcfa106c..1f8ba0700 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -133,6 +133,7 @@ kni_net_open(struct net_device *dev) struct kni_dev *kni = netdev_priv(dev); netif_start_queue(dev); + netif_carrier_off(dev); memset(&req, 0, sizeof(req)); req.req_id = RTE_KNI_REQ_CFG_NETWORK_IF; @@ -152,6 +153,7 @@ kni_net_release(struct net_device *dev) struct kni_dev *kni = netdev_priv(dev); netif_stop_queue(dev); /* can't transmit any more */ + netif_carrier_off(dev); memset(&req, 0, sizeof(req)); req.req_id = RTE_KNI_REQ_CFG_NETWORK_IF; -- 2.19.0