Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp692014lqs; Fri, 14 Jun 2024 02:53:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYh28IePWGuG9ZcuzdGRd4bDcBLRe0GtzSvcL/7X15NGpjxUSvgG3G27o27t+6CCdXR3G3BnGItpZwlYkXVd8HKFfBwFmX0GrpYlixWQ== X-Google-Smtp-Source: AGHT+IGix8QwVnKFCge+pvHBL6gnZ7v+1IzkGUDsy0Nk5Lm09iYRC5XKoBypbMHZD7jWeIHkFWVj X-Received: by 2002:a17:906:6d4e:b0:a6e:fad2:971 with SMTP id a640c23a62f3a-a6f60d3c2bdmr129427166b.40.1718358784582; Fri, 14 Jun 2024 02:53:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718358784; cv=pass; d=google.com; s=arc-20160816; b=GzH0ysf36a+FEBRd2X3GqHlI9L+Xe86KMuQEnttoKq3FCUFUf+L71BOjxZQg2qCJ3u PF0L2jc/E4TbRaEwA2naO5/48PB7vwK2A4hqEGFmit66Y+dzIrzS05PDyi+o2TbMBALx 5AVeMCG7RyGWDtGmCN/CuyKHZFqKeDsjUDetQYAEtBd8MW8EfhmgdPuJtYk5Sr5n6foN bdLzp38hAeTi49z6kF/GFtTdu3x8oivj9zG4SJNAlYrLzY0XpvDva1S/2f2QMMqH8cTu FbdH9udVMYt67Dgxn55NvIKpeNzFLizntB1gkhhE0rfAnuyMn93qEQNbY4BWk/UeWpzv ieLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id:dkim-signature; bh=49kqpfNtEJVAp6h4kYqZK0c4CReSme2XQohBc3CWwNA=; fh=vnlkhyYNnpnD82iRlIc+rSDk6hmZ+N5KP9mCawwFGCY=; b=zWlZxCI2kDfbQQvSeNVCpDPXS6cB1nAi24ZmJybwjW8RZqLZ+JaEZvDO+uBFLFwkN0 tQAm1cfAZyBiZ+sQbKppLmOXPzwYl3W9v+CaVwtNdQJSTTPWVVo2DM6LJvsVZRDdYZON kC3Y7DgaFOG3iGijm71J/DBZe35OlLmtpPMnBWlFdIFvD2+Jqu9pZXi/RPekhjdjRvrm iKF418lWiRnv24/1Kw+FMyr99zKrv0wJj7mfBaA4VwoIEZ/ZUwgdyeSp4JOQ78RljsKc KS2mqZaRgRBlCUOoif9T8aA9Oia38G+C2j/7OmVf+4JKeTehECXMjS1WP5+JQPDCGKbl BIzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fd1852FH; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-214655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56e26afasi153765566b.788.2024.06.14.02.53.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 02:53:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fd1852FH; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-214655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 924261F27D08 for ; Fri, 14 Jun 2024 09:43:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 279241922FE; Fri, 14 Jun 2024 09:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Fd1852FH" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88BF5192B7D for ; Fri, 14 Jun 2024 09:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718358178; cv=none; b=f6Q+72Y9HUmLyhNrGeg1A4OvEOgIZufjXjR5J4WICAjKTBWsloTUH9o+PrOxtdBx4yVBrSfxK6r88QZdPTUHLEG/TAovqu2AIguq+uDidfBETgsnsGt7RaaexGPXGpBM6rLnzUZsmJnmuWuDERKsEXtWlkt3yyTRmMmcLuUSS1A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718358178; c=relaxed/simple; bh=I1iBGOoWQpj8pNaZCVoh6D0cVztaXLFRZEggNb2CDKo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=fAkCewjqTG5jDpz0FZnGdC4imHPGJ0jGnSPTWjy0dDZtj0UGoGirs+aQPF8m6LJAqLSoCpndSZkl132DnwiIn55SE87V0zWgasukntfi/jjH7bzh+OfvSwcADpoo05yLK/EDPxJZ2Ptk6b3UCjdvGzx3V5w225bZWa5Ey2Ldwgg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Fd1852FH; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718358175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=49kqpfNtEJVAp6h4kYqZK0c4CReSme2XQohBc3CWwNA=; b=Fd1852FHoatB2asgm2u3HrAM0a4rmBY/TL6FSNNe6s4BHaZHvPzpU3JFoLOgH3XtFe+D8B Tjpo1JDwgtNrDpBleCRk4GrVmvcnLNXzET+41+4tyXCVGhrApZf/B5IgxbAbaAoq7CyNJL NF8yGuk3Z+RCREA2QLvSc2xAVpHPllI= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-197-Z8E2f63ZOeKR-ippOZbuUA-1; Fri, 14 Jun 2024 05:42:53 -0400 X-MC-Unique: Z8E2f63ZOeKR-ippOZbuUA-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-35f291b147dso109542f8f.0 for ; Fri, 14 Jun 2024 02:42:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718358172; x=1718962972; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=49kqpfNtEJVAp6h4kYqZK0c4CReSme2XQohBc3CWwNA=; b=HD4z6Eerk+/v3nHtc58gnUnX/atDJQ+Ql3UzLGgXvXPMlZRgBHYB3Dm6en3mxc4ho1 sRWbkX+ofEcf8jdWC/Nq/qiOh4ynON6XEVreTNAn+g93eJD80zF0vTJr4iV8ldfl2Kwy FOSj+U3mqNgBZtrlc6fiLloXwegCjKAoDeFaf2ZSgAFEU8BXXlJ3aEOsPwMwpVGLlfgq XPTc2inUQ91qpgjwKgJqjS2m5xk/phUoz4lRonrKz0w/puG+7ABjInfT2VN2wgoscvvu 9/6CdJy9TkJ3RPSwQY3CcYHpF4LlEYbehjVRuS58ZMiO3LyKZkH3dk9pd3aEmSLhWfz+ a8NA== X-Forwarded-Encrypted: i=1; AJvYcCUTBD2AXMt2hZMmDNHUAy/gB0pQXgDMWVlwAs7VqrsdeeYtdAoxOmrKUiBXKgPgpJNVEhNNFTUiktfz+nrlW1MJVdmc4Q9UjjxHtyWm X-Gm-Message-State: AOJu0Yx969d7sK/KxFl1mFL+CBYDb1uQT2enMHyw38W4HJFn0hJkzlIC JSr1lR6A1u9wHXGQaoqDnw/tUc+/CEy8vfl8hZTQKKiL/KzgzETtUYHPPUfkgafHLFTv9/rPLYX WBKtgvazQp5+DFSEw4DnCMZjopwSPTnbkKjsn/OxqO5Frrb04ZW/CpmBmYa+TKg== X-Received: by 2002:a05:600c:3b1d:b0:422:70d4:7e72 with SMTP id 5b1f17b1804b1-4230484ea2emr17133875e9.2.1718358172526; Fri, 14 Jun 2024 02:42:52 -0700 (PDT) X-Received: by 2002:a05:600c:3b1d:b0:422:70d4:7e72 with SMTP id 5b1f17b1804b1-4230484ea2emr17133615e9.2.1718358172093; Fri, 14 Jun 2024 02:42:52 -0700 (PDT) Received: from gerbillo.redhat.com ([2a0d:3341:b083:7210:de1e:fd05:fa25:40db]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36075104b2esm3857063f8f.101.2024.06.14.02.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 02:42:51 -0700 (PDT) Message-ID: <84281d30907c09a2f15d741088833b0ae6597b89.camel@redhat.com> Subject: Re: [PATCH net-next 02/12] net: dsa: vsc73xx: Add vlan filtering From: Paolo Abeni To: Pawel Dembicki , netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Russell King , linux-kernel@vger.kernel.org Date: Fri, 14 Jun 2024 11:42:50 +0200 In-Reply-To: <20240611195007.486919-3-paweldembicki@gmail.com> References: <20240611195007.486919-1-paweldembicki@gmail.com> <20240611195007.486919-3-paweldembicki@gmail.com> Autocrypt: addr=pabeni@redhat.com; prefer-encrypt=mutual; keydata=mQINBGISiDUBEAC5uMdJicjm3ZlWQJG4u2EU1EhWUSx8IZLUTmEE8zmjPJFSYDcjtfGcbzLPb63BvX7FADmTOkO7gwtDgm501XnQaZgBUnCOUT8qv5MkKsFH20h1XJyqjPeGM55YFAXc+a4WD0YyO5M0+KhDeRLoildeRna1ey944VlZ6Inf67zMYw9vfE5XozBtytFIrRyGEWkQwkjaYhr1cGM8ia24QQVQid3P7SPkR78kJmrT32sGk+TdR4YnZzBvVaojX4AroZrrAQVdOLQWR+w4w1mONfJvahNdjq73tKv51nIpu4SAC1Zmnm3x4u9r22mbMDr0uWqDqwhsvkanYmn4umDKc1ZkBnDIbbumd40x9CKgG6ogVlLYeJa9WyfVMOHDF6f0wRjFjxVoPO6p/ZDkuEa67KCp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CIxXSWqPAhQq8d3hB/Ww2A0H0PBTN1REVw8pRLNApEA7C2nX6RW0XmA53PIQvAP0EAakWsqHoKZ5WdpeOcH9iVlUQhRgemQSkhfNaP9LqR1XKujlTuUTpoyT3xwAzkmSxN1nABoutHEO/N87fpIbpbZaIdinF7b9srwUvDOKsywfs5HMiUZhLKoZzCcU/AEFjQsPTATACGsWf3JYPnWxL9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Hi, On Tue, 2024-06-11 at 21:49 +0200, Pawel Dembicki wrote: > +static int vsc73xx_port_vlan_add(struct dsa_switch *ds, int port, > + const struct switchdev_obj_port_vlan *vlan, > + struct netlink_ext_ack *extack) > +{ > + bool untagged =3D vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; > + bool pvid =3D vlan->flags & BRIDGE_VLAN_INFO_PVID; > + struct dsa_port *dp =3D dsa_to_port(ds, port); > + struct vsc73xx_bridge_vlan *vsc73xx_vlan; > + struct vsc73xx_vlan_summary summary; > + struct vsc73xx_portinfo *portinfo; > + struct vsc73xx *vsc =3D ds->priv; > + bool commit_to_hardware; > + int ret =3D 0; > + > + /* Be sure to deny alterations to the configuration done by tag_8021q. > + */ > + if (vid_is_dsa_8021q(vlan->vid)) { > + NL_SET_ERR_MSG_MOD(extack, > + "Range 3072-4095 reserved for dsa_8021q operation"); > + return -EBUSY; > + } > + > + /* The processed vlan->vid is excluded from the search because the VLAN > + * can be re-added with a different set of flags, so it's easiest to > + * ignore its old flags from the VLAN database software copy. > + */ > + vsc73xx_bridge_vlan_summary(vsc, port, &summary, vlan->vid); > + > + /* VSC73XX allow only three untagged states: none, one or all */ > + if ((untagged && summary.num_tagged > 0 && summary.num_untagged > 0) || > + (!untagged && summary.num_untagged > 1)) { > + NL_SET_ERR_MSG_MOD(extack, > + "Port can have only none, one or all untagged vlan"); > + return -EBUSY; > + } > + > + vsc73xx_vlan =3D vsc73xx_bridge_vlan_find(vsc, vlan->vid); > + > + if (!vsc73xx_vlan) { > + vsc73xx_vlan =3D kzalloc(sizeof(*vsc73xx_vlan), GFP_KERNEL); > + if (!vsc73xx_vlan) > + return -ENOMEM; > + > + vsc73xx_vlan->vid =3D vlan->vid; > + vsc73xx_vlan->portmask =3D 0; > + vsc73xx_vlan->untagged =3D 0; > + > + INIT_LIST_HEAD(&vsc73xx_vlan->list); INIT_LIST_HEAD() is not needed, as the entry will be unconditionally added in the statement below. > + list_add_tail(&vsc73xx_vlan->list, &vsc->vlans); > + } > + > + /* CPU port must be always tagged because port separation is based on > + * tag_8021q. > + */ > + if (port =3D=3D CPU_PORT) > + goto update_vlan_table; > + > + vsc73xx_vlan->portmask |=3D BIT(port); > + > + if (untagged) > + vsc73xx_vlan->untagged |=3D BIT(port); > + else > + vsc73xx_vlan->untagged &=3D ~BIT(port); > + > + portinfo =3D &vsc->portinfo[port]; > + > + if (pvid) { > + portinfo->pvid_vlan_filtering_configured =3D true; > + portinfo->pvid_vlan_filtering =3D vlan->vid; > + } else if (portinfo->pvid_vlan_filtering_configured && > + portinfo->pvid_vlan_filtering =3D=3D vlan->vid) { > + portinfo->pvid_vlan_filtering_configured =3D false; > + } > + > + commit_to_hardware =3D !vsc73xx_tag_8021q_active(dp); > + if (commit_to_hardware) { > + vsc73xx_vlan_commit_pvid(vsc, port); > + vsc73xx_vlan_commit_untagged(vsc, port); > + vsc73xx_vlan_commit_conf(vsc, port); > + } > + > +update_vlan_table: > + ret =3D vsc73xx_update_vlan_table(vsc, port, vlan->vid, true); > + if (!ret) > + return 0; > + > + list_del(&vsc73xx_vlan->list); > + kfree(vsc73xx_vlan); This does not look correct. I guess you should clear bit(port) in vsc73xx_vlan->portmask and dispose the entry only when portmask becomes 0. You probably can factor out a common helper to be used here and in vsc73xx_port_vlan_del().=20 Thanks, Paolo