From patchwork Thu Sep 27 00:32:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Gora X-Patchwork-Id: 45468 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 869341B2B3; Thu, 27 Sep 2018 02:34:18 +0200 (CEST) Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by dpdk.org (Postfix) with ESMTP id 56D9F1B1C1 for ; Thu, 27 Sep 2018 02:34:10 +0200 (CEST) Received: by mail-qt1-f196.google.com with SMTP id n6-v6so973116qtl.4 for ; Wed, 26 Sep 2018 17:34:10 -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=jIg7umEQ3J9mRhgEb92YgwdoXyr1NQ1SIQPLZwwzNZBjxTmOzc5J4blE5+o0m/vNId e55RdL9iXoDtqok1BJl61LUk4vYQ0R5sfZhBDJf5XNdbN053E1/hDR/inJDRAxYCmqRo ZmocoZtJl7svpj+EI6Pxd8GiJ6Rbr4uvUXBYt2QMQO1BVAC/X79sjO2HuMIOr9p8nI+5 mX6EJxpWcurwAA5r+Z5SxjqoMe14GOSdKjFUu67TTgapVAzD/isA6N3Y5HLTpHe3wYvI NWS5CJ15MUMzgMfU8rg6DeQzQ9H1+NC22SEFdm9mr49ZPw+0EWIhScpo1BtCARGvhzVh 2/vQ== 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=DxpBq6A+YXD4ldJCCjd/oKrqtvGkIIKAEFd8/CXVQ+qZZkwi0iZTThP2vSpkcXzJHg 2QKN/ZxV8lArRj4U/gwHlthF62DFtrtXBEB8UdpRFfr52QkWBSxp//HGIyVwQwViBZ6i sKSnHYH2D7cYOg5eL5mkA7zqEjcC4JL+eeGDBpjKasXq2Q0a7IxR6UptZz4AeZVH2iVP +5iciUeR+QQhjW6dXGPGo8J/+gArf/usI0bMgJcFdh/9sdprQd7+n2Xr9OTf1MXU/Pji Ghmy2NeRRVdkf4Bd4I+Arr9fZQw+Oe+cLbiAWBPZnwyRTisZ5rniU9R1vNT3Ayj76zRm /lNQ== X-Gm-Message-State: ABuFfohFVNlFOX/FfThEOpQ8NG2bzOE+fT7lKusYXk9rr754iDNqfCgz VL2k3cZa0rfw3ahulH2WDzCyBgUX X-Google-Smtp-Source: ACcGV63sJn60EtcVezgRpeeHChDEzM3iKwmbWD0OF/ti1pzC/31jcfRJTzLSJ8/4yEl9ZfiS0l44fg== X-Received: by 2002:a05:6214:114b:: with SMTP id b11mr6266277qvt.168.1538008449406; Wed, 26 Sep 2018 17:34:09 -0700 (PDT) Received: from snappy.local.lan (189-46-124-178.dsl.telesp.net.br. [189.46.124.178]) by smtp.gmail.com with ESMTPSA id x26-v6sm463053qth.15.2018.09.26.17.34.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Sep 2018 17:34:08 -0700 (PDT) From: Dan Gora To: dev@dpdk.org Cc: Igor Ryzhov , Stephen Hemminger , Ferruh Yigit , Dan Gora Date: Wed, 26 Sep 2018 21:32:53 -0300 Message-Id: <20180927003256.6901-4-dg@adax.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927003256.6901-1-dg@adax.com> References: <20180911232906.18352-1-dg@adax.com> <20180927003256.6901-1-dg@adax.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 3/6] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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;