Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp593405pxb; Thu, 19 Nov 2020 08:54:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfX0FxRwL7IPYFD8MebmALrsYBJ6+Y1WvqhzrtnpSQP8Fq+wfC9uohqi0DiyilzoHSC0+M X-Received: by 2002:a17:906:a00c:: with SMTP id p12mr30624443ejy.249.1605804862102; Thu, 19 Nov 2020 08:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605804862; cv=none; d=google.com; s=arc-20160816; b=dZc3W/y9YeLgyx4BAY+olZKZzmQhb8d8sOh4gNLpXppXLJ9Bhc0sdH6hDes5otjiqd yvDEX0hNLD82rQhyocNT1evZu8dCZnwrHMeUBS70zYxqcHqPlMC/iYZt2iP8HRUQxXLs 2e3+bfUTOqFMcDN9y7dFBquRPDsjsjnipT8SUm7zFuR938A5N5DTK0TgmV2MWgUz1p/H Y2SrkYCzdz6VmBZ0E4qBRo8P33Yre0c5uNI0YJvDPbGFKVvqSQtKpoyplvFOWd5KM1I4 ivdf6QiD0U9R5Zp+NlfNMNbudAI462VU5GHtHKpqyvM+LVKbjrIONE3c5AkAdGfigTtQ qeaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WnYOafAhGIR02+MUCgtMxCZXgMyaOid7ab2rHWcYBHg=; b=exK1FkYX/dHapj5u7SmAjN+t32FIr4esaPnhYHloPzJBoG20XJ6vssmuJt2Qp4G75/ KvaIrantBzHnZx8qEj6CUrhRTYM2tX8z4k+7exlFxRKwdrUVMrPitJZ65dK9Treyke8R NOoME1P3zCUTsAUNhEudTDEJuLcb5lrk9EI9t88yKOCuhZn8GAjZ0HpdQBTPBw1+1XS7 DX4ixIsiwwdiStJui3mxdwe0QSrdNLEv+dOTNkedAkCmlvLymlrHduKB3Nut1gsYnDYe aJJCtDrBXQNF61ikZm1DDep9ipxSVoWkndy/7/Cru68fcWvFjPr6enaMqec711eKsdqr 7lHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DSYvqMMl; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r18si189894edm.82.2020.11.19.08.53.59; Thu, 19 Nov 2020 08:54:22 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DSYvqMMl; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729252AbgKSQud (ORCPT + 99 others); Thu, 19 Nov 2020 11:50:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbgKSQuc (ORCPT ); Thu, 19 Nov 2020 11:50:32 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67B98C0613CF for ; Thu, 19 Nov 2020 08:50:32 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id a16so8890536ejj.5 for ; Thu, 19 Nov 2020 08:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WnYOafAhGIR02+MUCgtMxCZXgMyaOid7ab2rHWcYBHg=; b=DSYvqMMlbwsKkjFozlJiml8agxccgAQ4votPqfWGHXRQpOyFVLTKvBj5LXvaKc1FPC vZk0CXc3u0SSlFozE9VMymXiQZNMypShrFb+ofUVgoISjz7xDZkT8qL2ryKh3wCl1125 h5IIhRiEF/qMcY2WG2P9e1xg8uUX5SRthyq9mQLPUvPHRJrP3irf+E18MzGMuHK7ebpl XfRrqyPe8qgLyUN1Y52JmuNttO8CfCYKxb4n0lFWfUUMd5AJ9Y2FiGg1SZjYrApUl+BD tRQI2eX1ifyKdpqN+KVi2pQK7UECqEVPoiEHl5ev3cPCqhya4+qKG3z7Mhgtjd/WNy8n xCzA== 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:mime-version:content-transfer-encoding; bh=WnYOafAhGIR02+MUCgtMxCZXgMyaOid7ab2rHWcYBHg=; b=LVmrhbZvIpnQsmXZgmdf8RF2TExz573EmAgph0c5Sy6LIX5cv1DZO+junvmxzYKck1 OvUfGc0GbKVG1zi+ohhtP1WE6a1eR4O7NlnHYfWjDX3RiD4O/e1WFMiEjuPE5Bka8ldQ 4kn3ozQUzvH7S1nmnXpKREptQYvCJc+HRwAoPyKfThNYWcNvb3qxiamEzR4BGztDP6BT P91WN3h/0NjiGrcrkdo+q7yHFJPAYgRXi9xmX8ZaudF5ETjY4jPnKnCVzF2HyJxWGbRV myoGeI7DfUd5tmfIVemoQgOv17S+t3Yt06QyuzuxR3+DTKHVuX36rJz82JSEFPeUhdGw dbow== X-Gm-Message-State: AOAM532pCR0zsIeJrL/NS3L5qZElAQTHgk1qkRAULSScdxrHmRnonPZO 8c4I86oQgitpR+WAswUWg1c= X-Received: by 2002:a17:906:3641:: with SMTP id r1mr28022638ejb.405.1605804631067; Thu, 19 Nov 2020 08:50:31 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id s15sm2176edj.75.2020.11.19.08.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 08:50:30 -0800 (PST) From: Ioana Ciornei To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Ioana Ciornei Subject: [PATCH 2/3] staging: dpaa2-switch: make sure that the VLAN is not already configured Date: Thu, 19 Nov 2020 18:50:16 +0200 Message-Id: <20201119165017.806696-3-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201119165017.806696-1-ciorneiioana@gmail.com> References: <20201119165017.806696-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ioana Ciornei When in the PREPARE state of a switchdev transaction, check if the requested VLAN is not already configured on the switch port. This keeps us from getting into a WARNING as below. [ 1389.683296] dpaa2_ethsw dpsw.0 eth0: VLAN 2 already configured [ 1389.689125] ------------[ cut here ]------------ [ 1389.694084] eth0: Commit of object (id=1) failed. [ 1389.698863] WARNING: CPU: 0 PID: 613 at net/switchdev/switchdev.c:277 switchdev_port_obj_add_now+0xcc/0x110 [ 1389.708589] Modules linked in: [ 1389.711634] CPU: 0 PID: 613 Comm: bridge Not tainted 5.9.0-rc2-next-20200828-00112-g7172078477c5 #59 [ 1389.720753] Hardware name: NXP Layerscape LX2160ARDB (DT) [ 1389.726139] pstate: 40000005 (nZcv daif -PAN -UAO BTYPE=--) [ 1389.731698] pc : switchdev_port_obj_add_now+0xcc/0x110 [ 1389.736824] lr : switchdev_port_obj_add_now+0xcc/0x110 Signed-off-by: Ioana Ciornei --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 20c6326e5dee..d524e92051a3 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -984,10 +984,17 @@ static int dpaa2_switch_port_vlans_add(struct net_device *netdev, int vid, err = 0, new_vlans = 0; if (switchdev_trans_ph_prepare(trans)) { - for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) + for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { if (!port_priv->ethsw_data->vlans[vid]) new_vlans++; + /* Make sure that the VLAN is not already configured + * on the switch port + */ + if (port_priv->vlans[vid] & ETHSW_VLAN_MEMBER) + return -EEXIST; + } + /* Check if there is space for a new VLAN */ err = dpsw_get_attributes(ethsw->mc_io, 0, ethsw->dpsw_handle, ðsw->sw_attr); -- 2.28.0