From patchwork Fri Aug 10 12:47:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 10562663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BD9C1390 for ; Fri, 10 Aug 2018 12:47:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C57A2BA08 for ; Fri, 10 Aug 2018 12:47:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10E312BA0C; Fri, 10 Aug 2018 12:47:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEB1A2BA08 for ; Fri, 10 Aug 2018 12:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbeHJPR1 (ORCPT ); Fri, 10 Aug 2018 11:17:27 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44815 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728084AbeHJPRJ (ORCPT ); Fri, 10 Aug 2018 11:17:09 -0400 Received: by mail-lj1-f193.google.com with SMTP id q127-v6so7043049ljq.11 for ; Fri, 10 Aug 2018 05:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V6hmd09XYpCGXiuhvOsp9DvV/Bv2s+eIOM1qddmcKlA=; b=FFp/WRu+t+oYQsOuluFJ1lNh743K69Nyj2sGogRbZEY//48Lk92pasBpLUbkujQcp2 YXGV36K9+aPkTb1//CchS6jdiJ4skHp5VfbyphKKW6V0H2wsCg2AYRZWgQ/fOSXpwFPK 2hsMwDwiE+kGZyhO58WEKVq9DKTNYzEN4d7Mo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V6hmd09XYpCGXiuhvOsp9DvV/Bv2s+eIOM1qddmcKlA=; b=P+LD4ePKYFhiVyYEAb7BX1YynpBqxcMBBMq4+lgeswoDd4gmBog3gXT3fpAv8loTge LGYV5SnsOU0edtGC8qKIhqN3KO/ZxnlrLXEKRjEHgHKrku+r2iI3a1mikj8tLFrzm0Rg iy2zRQ9SQOXhiYPz5e4knui1ezVNWhgNAlDMs38i9Q5+b66z5pbV1KajhXGzaYOEtwdn PMTFJn+d0GBvojnsrNO4BLW0aKBP1MuyPYvVirLdYRcJduNrWT6w5+MEKR5q0teRlr18 vhX4z0B5VP9On3jo4fbo+E65+aCH2nOTDNdTUM76wgbviyqJ4b1FU6PW0ePswO/iTpxK YwNA== X-Gm-Message-State: AOUpUlGzRynF58lYCxOIsSDpJzW2mEz0uy5xDS1UZCGkr2QF/7SByJkj 1aQlz5sNkzbfPxPK1Sp29gaWPg== X-Google-Smtp-Source: AA+uWPxfkmV+5juHXoN/gDE5EDOqgduRjgKS86Z4/XlBN6wOXwUx4474A8zQ3UL7M1R0ns8aUhaYnQ== X-Received: by 2002:a2e:8617:: with SMTP id a23-v6mr4985207lji.43.1533905241225; Fri, 10 Aug 2018 05:47:21 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id 84-v6sm1626382lje.48.2018.08.10.05.47.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 05:47:20 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, davem@davemloft.net Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH 1/2] net: ethernet: ti: cpsw: clear all entries when delete vid Date: Fri, 10 Aug 2018 15:47:08 +0300 Message-Id: <20180810124709.25089-2-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810124709.25089-1-ivan.khoronzhuk@linaro.org> References: <20180810124709.25089-1-ivan.khoronzhuk@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In cases if some of the entries were not found in forwarding table while killing vlan, the rest not needed entries still left in the table. No need to stop, as entry was deleted anyway. So fix this by returning error only after all was cleaned. To implement this, return -ENOENT in cpsw_ale_del_mcast() as it's supposed to be. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 14 ++++---------- drivers/net/ethernet/ti/cpsw_ale.c | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 358edab9e72e..9edac671f276 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2125,16 +2125,10 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid); ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0); - if (ret != 0) - return ret; - - ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, - HOST_PORT_NUM, ALE_VLAN, vid); - if (ret != 0) - return ret; - - ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, - 0, ALE_VLAN, vid); + ret |= cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, + HOST_PORT_NUM, ALE_VLAN, vid); + ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, + 0, ALE_VLAN, vid); pm_runtime_put(cpsw->dev); return ret; } diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 93dc05c194d3..5766225a4ce1 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c @@ -394,7 +394,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); if (idx < 0) - return -EINVAL; + return -ENOENT; cpsw_ale_read(ale, idx, ale_entry); From patchwork Fri Aug 10 12:47:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 10562661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFCB31390 for ; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFF432BA08 for ; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B40A22BA0C; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BD502BA08 for ; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728188AbeHJPRK (ORCPT ); Fri, 10 Aug 2018 11:17:10 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36442 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbeHJPRK (ORCPT ); Fri, 10 Aug 2018 11:17:10 -0400 Received: by mail-lj1-f193.google.com with SMTP id u7-v6so7103972lji.3 for ; Fri, 10 Aug 2018 05:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0/BAzsY3ygWwvCiEZ/10Pn/Lg/p2uPBAkEn1J4zXy7s=; b=elfy2KSglYDEJJxxOi/LXkMdCR5gy14vWgFCPrrD2WTXhDnvaUc1VJDFb0m6LYIODJ i63AlPUo3meeXB7hhfstAUfH6LFR25BNdJFVHeMzqBwAzFyY6bjS+cZEAOIwi7gvyQRV g0ZtlAxvALSeX2oqVwEh8x+KLpn64hiVpXNUk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0/BAzsY3ygWwvCiEZ/10Pn/Lg/p2uPBAkEn1J4zXy7s=; b=t7dJpHRM9rjxAJCbr7EtiLrK2fWweRZePdgOBkf5HJEdt+JsmbFGtMRbd7gciM71uF +3+59GTA0L1bu/dgvjPUBoiUanoAxqQzGhcLmiRvrOomzaqy9B7kl6J5Bo+g+72Do7ty d3xl5grYmpdiJcQJ985l1sdt2spQ9O/3MCeLM4WdQGL+Pm69YvyS2wCPDP9YHz6MW3md 9/9ouQhggYYu2QS7h+9aU5y3dmvqXFnRs4Mos6WiiJeh2GkGfCaIOJiBYiHtBM3OaWg9 Qqa7RJ0qL/ASS1wQQ9LCXoV8fjZdImuxx41W+wvx+et92sfzMqJy4JuLCxQ6ifYITnhp AftQ== X-Gm-Message-State: AOUpUlH0xbsx+j3THIskDOtyzi5tSc3AfeqQrLR4gDqGsTZf5agSJd3U tJW2KX1j353YWyJd2xrCSUG8mw== X-Google-Smtp-Source: AA+uWPy4nUa6KyEGWUGvlrXze3jkwirmAPKsARS+ANvFwdwU8ME/1u3CLQEyZN/QiS5US2giVg7GVQ== X-Received: by 2002:a2e:498:: with SMTP id a24-v6mr4875106ljf.27.1533905242306; Fri, 10 Aug 2018 05:47:22 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id 84-v6sm1626382lje.48.2018.08.10.05.47.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 05:47:21 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, davem@davemloft.net Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH 2/2] net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan Date: Fri, 10 Aug 2018 15:47:09 +0300 Message-Id: <20180810124709.25089-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810124709.25089-1-ivan.khoronzhuk@linaro.org> References: <20180810124709.25089-1-ivan.khoronzhuk@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's exclusive with normal behaviour but if try to set vlan to one of the reserved values is made, the cpsw runtime pm is broken. Fixes: commit a6c5d14f5136 ("drivers: net: cpsw: ndev: fix accessing to suspended device") Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 9edac671f276..3e34cb8ac1d3 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2086,14 +2086,16 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, int i; for (i = 0; i < cpsw->data.slaves; i++) { - if (vid == cpsw->slaves[i].port_vlan) - return -EINVAL; + if (vid == cpsw->slaves[i].port_vlan) { + ret = -EINVAL; + goto err; + } } } dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); ret = cpsw_add_vlan_ale_entry(priv, vid); - +err: pm_runtime_put(cpsw->dev); return ret; } @@ -2119,7 +2121,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, for (i = 0; i < cpsw->data.slaves; i++) { if (vid == cpsw->slaves[i].port_vlan) - return -EINVAL; + goto err; } } @@ -2129,6 +2131,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, HOST_PORT_NUM, ALE_VLAN, vid); ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, 0, ALE_VLAN, vid); +err: pm_runtime_put(cpsw->dev); return ret; }