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);