From patchwork Mon Aug 24 16:53:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 248233 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp2710447ils; Mon, 24 Aug 2020 09:53:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWr+t/Ph9Ea1RFG4mRTDLCklRvj/WLAOFmoTA20rqfM0AtT9H5FKDPCgI0NvJUBNPpXr93 X-Received: by 2002:aa7:ccd5:: with SMTP id y21mr6094098edt.91.1598288014493; Mon, 24 Aug 2020 09:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598288014; cv=none; d=google.com; s=arc-20160816; b=WgROPkJ0P6C2oWNMJVHrXy9lpchZHy38VG6UgpXaLiAEvNd1GJpIerUB2Ssy6vcXSi Qbl9AMhorl+mzhmel5538Z5BcP2usyW/jZG3Wb6fhB1yj3wpC8UUHA0roYxPQ5WpUDS2 yllnXWlA3ln2mdv/8MWnat5lpCEn0Weeev6rzKWtccWOgCUJNy5J02G+SmImmZgw3xk7 dLzQT8Y1xiLVsyrwDGvaNk4wyedkt5imMdJ5FT1Woamg3Lmr+Yxu0iN0MZQjx54K9y44 7Yj2anFHQtaQ4jkn60P6aLlSLyv3dO1BFGqgc/JYUjTc/Kw5j4T0Jrt49OqhH9x/6cOy Gczw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from:dkim-signature; bh=Js6kMsNm4ATKiNQnBPStvxyMXL9/jE2nxHz5i/lhfp0=; b=vi2b2cYy9Vlm39HvXfk995TacKNC/bEPisf5MZ404IXDRpE8PGwB9L9SJWDGetwd4U +8rvLoL3aH7gvew0LwjmC1n4IYsO8Hn8ergZ50L+gNpegxjbCAF6Et8wf7Fb3X4fh2V7 MixRijFUaNtRckFdZ8PcEE+WUS3bBFzKSXBc4LNEmhRGNQAQmiG9DYRA559XH5aDZG38 L9XfuNwZ8Z7ulF6/ZXVXPpW10G0y1BaHp+rUd+eErpedCSjmwuWlNjK+L0vVwsFO2OfZ Qw5475KMVOJFcZ9IXqG3p8IT9xRHIZ+HdcQbEX5q+nEOuSsYH08LdByGFoRuR6GZEeF0 kXuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tcelBRX2; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c17si3237601ejb.562.2020.08.24.09.53.34; Mon, 24 Aug 2020 09:53:34 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tcelBRX2; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728853AbgHXQxc (ORCPT + 9 others); Mon, 24 Aug 2020 12:53:32 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:55094 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728734AbgHXQxU (ORCPT ); Mon, 24 Aug 2020 12:53:20 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 07OGrF1G102097; Mon, 24 Aug 2020 11:53:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1598287995; bh=Js6kMsNm4ATKiNQnBPStvxyMXL9/jE2nxHz5i/lhfp0=; h=From:To:Subject:Date; b=tcelBRX2222nAtQlt1C6xKNRRUlIXHJLBOcPHcFM+fVkMl9ah4/y9p8n50vFQXdOn hLdaHYJo3bIpvHJzca/tisU2hzTeVuq6IjrJXx84xqc5M15Thvqb9r9tthSSf+zKTa XZ6RKsNL6deiDJo0tosY0aPWMjpPurvCn5ExCnXI= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 07OGrFwH026815 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Aug 2020 11:53:15 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 24 Aug 2020 11:53:14 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 24 Aug 2020 11:53:14 -0500 Received: from uda0868495.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 07OGrEVW001473; Mon, 24 Aug 2020 11:53:14 -0500 From: Murali Karicheri To: , , , , , , Subject: [net v2 PATCH] net: ethernet: ti: cpsw_new: fix error handling in cpsw_ndo_vlan_rx_kill_vid() Date: Mon, 24 Aug 2020 12:53:14 -0400 Message-ID: <20200824165314.21148-1-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch fixes a bunch of issues in cpsw_ndo_vlan_rx_kill_vid() - pm_runtime_get_sync() returns non zero value. This results in non zero value return to caller which will be interpreted as error. So overwrite ret with zero. - Currently when VLAN interface is deleted, all of the VLAN mc addresses are removed from ALE table, however the return values from ale function calls are not checked. These functions can return error code -ENOENT. But that shouldn't happen in a normal case. So add error print to catch the situations so that these can be investigated and addressed. return zero in these cases as these are not real error case, but only serve to catch ALE table update related issues and help address the same in the driver. Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac") Signed-off-by: Murali Karicheri --- v2 - updated based on comments from Grygorii. drivers/net/ethernet/ti/cpsw_new.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index 8d0a2bc7128d..61fa5063d751 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -1032,19 +1032,35 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, return ret; } + /* reset the return code as pm_runtime_get_sync() can return + * non zero values as well. + */ + ret = 0; for (i = 0; i < cpsw->data.slaves; i++) { if (cpsw->slaves[i].ndev && - vid == cpsw->slaves[i].port_vlan) + vid == cpsw->slaves[i].port_vlan) { + ret = -EINVAL; goto err; + } } dev_dbg(priv->dev, "removing vlanid %d from vlan filter\n", vid); - cpsw_ale_del_vlan(cpsw->ale, vid, 0); - cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, - HOST_PORT_NUM, ALE_VLAN, vid); - cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, - 0, ALE_VLAN, vid); + ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0); + if (ret) + dev_err(priv->dev, "%s: failed %d: ret %d\n", + __func__, __LINE__, ret); + ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, + HOST_PORT_NUM, ALE_VLAN, vid); + if (ret) + dev_err(priv->dev, "%s: failed %d: ret %d\n", + __func__, __LINE__, ret); + ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, + 0, ALE_VLAN, vid); + if (ret) + dev_err(priv->dev, "%s: failed %d: ret %d\n", + __func__, __LINE__, ret); cpsw_ale_flush_multicast(cpsw->ale, ALE_PORT_HOST, vid); + ret = 0; err: pm_runtime_put(cpsw->dev); return ret;