Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1757060ybh; Tue, 14 Jul 2020 06:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYRFi+Fz1mXMyY2aLTerLLJdhdzSDBlWxe/LUGMrll4Jgjrq+PUrbQVHB2SIHABxnuZAuH X-Received: by 2002:a17:906:e91:: with SMTP id p17mr4756616ejf.252.1594733838918; Tue, 14 Jul 2020 06:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594733838; cv=none; d=google.com; s=arc-20160816; b=kqrXjbM2A/8YI9MGHYszXFnpv+iz+zkUnTw8zKrCwqWA3puF7j80k6MZ+BWFDxtB5z v5dtnCm4pmpEzzlzO560c8IDgzUMJLhZtFQgnGmmTqC4Cg7bxbeW4sVrmxEuv45bgRVt VetI5xPah/kNqNl99y/9yvml5YcrJ2Nnq6aMZVnknUjOqIt9VoewcQTduEgNMUVdS3jC T/4y7NPT6/bJJfkk2xGgIEn6Mf1vF5O/qeK38mGDnn1njnFIXSMaRSbBIyXqvD4UnLu4 GNiu/WrTZPeHsejg4DFZkaohv604bWjHvUYYNZGjB5GutklzmOLxcRWLdCgs3kK+FGR4 ibnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=D8Vwpo8pBEPpxLH98J4NCPENyuSECFy+9LPBJAPPOdE=; b=Yp5TQ+IQBRfv2WjuvhYIqgPGwQ2dY0Gfokd5PkIg/Ra18lQ7d0yVosmYq79FP6n+qa Kutkmg/Hz1cmET2X165ThHiOSoWiXVXbDbhbfXlVwk28wmAzZj2ASg7gkChRLauO2dgS tH14i4ZTYlm8nMw83pX+7xL2hQPGup2aEUdo0Jw+7BT9SNeuNeYgxn+IFYJo1QG/qfQL zp/JGWJIdAC9n4/Fz908NXdXXlZV+wD9NYkCHZ8+Wgrp4Qn1yoSF3MMiAyIks5t9BhC+ 8uVT8vEqeoSUid57qU/QjZp5Z4ame/TUUnpElIhIz5UjJUTAHWFrsHMCRUkP+igw7qQ7 CTHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj20si680366ejb.504.2020.07.14.06.36.54; Tue, 14 Jul 2020 06:37:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728440AbgGNNfi (ORCPT + 99 others); Tue, 14 Jul 2020 09:35:38 -0400 Received: from inva020.nxp.com ([92.121.34.13]:49972 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728187AbgGNNfS (ORCPT ); Tue, 14 Jul 2020 09:35:18 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 11A481A01FC; Tue, 14 Jul 2020 15:35:16 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 052921A01E7; Tue, 14 Jul 2020 15:35:16 +0200 (CEST) Received: from fsr-ub1864-126.ea.freescale.net (fsr-ub1864-126.ea.freescale.net [10.171.82.212]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id C18EA205A4; Tue, 14 Jul 2020 15:35:15 +0200 (CEST) From: Ioana Ciornei To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Ioana Ciornei Subject: [PATCH 3/6] staging: dpaa2-ethsw: use netif_running when checking for port up Date: Tue, 14 Jul 2020 16:34:28 +0300 Message-Id: <20200714133431.17532-4-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200714133431.17532-1-ioana.ciornei@nxp.com> References: <20200714133431.17532-1-ioana.ciornei@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are some cases where the switch interface needs to be disabled so that changes in the configuration can be made. In such cases, we should check for a running interface (bit __LINK_STATE_START of the netdev) instead of netif_carrier_ok(). This is because on open() we enable the switch interface even though the link up has not come out yet. Signed-off-by: Ioana Ciornei --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index b57bc705c2ee..a1917842536e 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -48,7 +48,7 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid) struct ethsw_core *ethsw = port_priv->ethsw_data; struct net_device *netdev = port_priv->netdev; struct dpsw_tci_cfg tci_cfg = { 0 }; - bool is_oper; + bool up; int err, ret; err = dpsw_if_get_tci(ethsw->mc_io, 0, ethsw->dpsw_handle, @@ -61,8 +61,8 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid) tci_cfg.vlan_id = pvid; /* Interface needs to be down to change PVID */ - is_oper = netif_oper_up(netdev); - if (is_oper) { + up = netif_running(netdev); + if (up) { err = dpsw_if_disable(ethsw->mc_io, 0, ethsw->dpsw_handle, port_priv->idx); @@ -85,7 +85,7 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid) port_priv->pvid = pvid; set_tci_error: - if (is_oper) { + if (up) { ret = dpsw_if_enable(ethsw->mc_io, 0, ethsw->dpsw_handle, port_priv->idx); @@ -188,7 +188,7 @@ static int ethsw_port_set_stp_state(struct ethsw_port_priv *port_priv, u8 state) }; int err; - if (!netif_oper_up(port_priv->netdev) || state == port_priv->stp_state) + if (!netif_running(port_priv->netdev) || state == port_priv->stp_state) return 0; /* Nothing to do */ err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0, -- 2.25.1