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 1B2FF1B12C for ; Wed, 19 Sep 2018 21:56:23 +0200 (CEST) Received: by mail-qt0-f196.google.com with SMTP id j7-v6so6337564qtp.2 for ; Wed, 19 Sep 2018 12:56:23 -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=oxilflxMgAVO+MlDkzBPxA1lbAk9vUIhRj5RVOh2Unggc0Zu01vMtvU6D/NPrnYrlH CC5NtmBzy0kebirm3BolqLBnCmIswdxWH2VCQMTrXSRgGzFDEb5vQgABwlG4vh0kfLqp kSBUo6dYyZNalRIWg2usjNPABRV+eL0S/aIUQL3UpUrU5aZJmoBaY7pQTF8vWEKGLqwU ZWSGGh2rWJtwcczHFkdGOLCRq0Z6NMnDHG77NHgPfhirTsUML9nA3QVCHGLxnBhhPkA+ 1Oz2VXtwcRWddzb79q8oQRvuLEmmQUmCpIvTpGnL83jGGskALKDYtMDUqkwkTHAhR3I7 T/uw== 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=gv8XE3zFmM32yT20C+tcIUcXyKXIjIoZx/6kD8kO+AZOM7s0xsDHHZcC1sA055piM2 CaugbShMZ2471TdWgv4yPJyPlPm3IoTZ1anADM/QLyXyRokcnRmUf28P5sYYhjCwhucn 9uudFYFtrFVeEMUIFZ05f90CzQ6yS7IT6C+G+oZqoWJWflQe8Ap3h+U+UALTEyEYo+s4 OEgKwfJc5YTJd0A+ai1f5oI10mdIus87kiU0uJGOCxxmtNEB3IC8nm9XrUQ94VqhprBO Gt1bXuwqPPlRn0xcCL5b8/15fMFhbk5DMj7EtTEcKQEGXUCMOCv4uhFD/KVwmv3HJ3SO xRaA== X-Gm-Message-State: APzg51CcF5Q7FW7iRFPVhups3NZCOxO28uS5K+uhkOvLJ3UD+V1KJ89b x9eGqDpLyJHWRqhKVFcjTYXVV5QB X-Google-Smtp-Source: ANB0VdYlTC9zAwbG6JzHKecb1SShNB+amd17QACrCI1dHpyGvtvyLV+lQdUZRh+I7OzaRYf4ltPHqw== X-Received: by 2002:aed:3584:: with SMTP id c4-v6mr25403664qte.155.1537386982203; Wed, 19 Sep 2018 12:56:22 -0700 (PDT) Received: from snappy.local.lan ([187.10.145.241]) by smtp.gmail.com with ESMTPSA id g184-v6sm12431369qkb.15.2018.09.19.12.56.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Sep 2018 12:56:21 -0700 (PDT) Sender: Dan Gora From: Dan Gora To: dev@dpdk.org Cc: Igor Ryzhov , Stephen Hemminger , Dan Gora , Ferruh Yigit Date: Wed, 19 Sep 2018 16:55:46 -0300 Message-Id: <20180919195549.5585-3-dg@adax.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180919195549.5585-1-dg@adax.com> References: <20180911232906.18352-1-dg@adax.com> <20180919195549.5585-1-dg@adax.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/5] 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: Wed, 19 Sep 2018 19:56:23 -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