From patchwork Mon Mar 30 20:40:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07623C43331 for ; Mon, 30 Mar 2020 20:40:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D41E920784 for ; Mon, 30 Mar 2020 20:40:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U0Yxdpos" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729258AbgC3Uks (ORCPT ); Mon, 30 Mar 2020 16:40:48 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36825 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728047AbgC3Ukr (ORCPT ); Mon, 30 Mar 2020 16:40:47 -0400 Received: by mail-wm1-f65.google.com with SMTP id g62so322463wme.1 for ; Mon, 30 Mar 2020 13:40:45 -0700 (PDT) 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; bh=bl0yu2j4T+LH6lKOM5xoWi5HPF7bOq1CzLFkv/S3kcI=; b=U0Yxdpos0iSRNJLHt+4crgex7qmMuBuOV9IGuugJrlXEWr1WW2OND9nH46veyawvgq Fb3ljVH8saxAPIATTlayEHJ2l9y215pPJOBFZ6DkVNr3OcnfpbUAHVSIfmaTjrGugISK qltenYX5AKt1aYWgHBewedLqiYUFoYY781cn6rAYL5a16XQt7RL4PwH30Sv8pu9OLgl5 8KVSwVtCMSNKzYsMcVFv/ZOQPFxwGE9LuakvZxCBLVjh3n0oqNrqIcoOQ/8CiSLhStMB 8QxViOy+pa6icy/rYoYlRq0ktezKQsG1ada7bza9DxOnvUBXTu0EF7oOoqsQcUIS99jv Uhjw== 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=bl0yu2j4T+LH6lKOM5xoWi5HPF7bOq1CzLFkv/S3kcI=; b=WWAnKkapJGB6WXyTety7MxCoEDVnjzc8rOxf0RivrShI/SoGhQIuC8kwPqdkZPuACM 6ln5saFLaG53rKDHrPdji7/kAn7J8m4Ky7GgBvnhSLLtHIBKHntTLPIm95CBJEJT9mPp B3VNuzEBLATNpamQ4ecDOnjDTZUes07pxBwQxXeSkzlvu/dKlwSDE19LrAo2xlcJeZ3C gzpXh9n/bA8QFovRkzIC+trDQu1yPMO/h13dmzNSTZn3+1fCH5/bEu8C7u5iUSbiFQtF oRP8vvxao5CpCK//DWlly4XLf9KMc+ELwKQiu+wjISBxbq5FiheFzapJQ6K0Nvpds2dl X8jg== X-Gm-Message-State: ANhLgQ3nnAnV8W3DcAQCb/8rHNDfGnwj9z7IR2Qc7XiU/9M/K68R9h4F YC4vdpXBMM6tV45Ao0RaAIRpCeiW X-Google-Smtp-Source: ADFU+vtrrVGiFoRhxkxQX2Sa67KF0gubkUZVvVNJAPJgxTnSA3uJShMhIBqzCBP3MCL40jsyE4O/DQ== X-Received: by 2002:a7b:c004:: with SMTP id c4mr1068627wmb.108.1585600844727; Mon, 30 Mar 2020 13:40:44 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o16sm23371109wrs.44.2020.03.30.13.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 13:40:44 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , andrew@lunn.ch, vivien.didelot@gmail.com, davem@davemloft.net, kuba@kernel.org, dan.carpenter@oracle.com Subject: [PATCH net-next 2/9] net: dsa: b53: Restore VLAN entries upon (re)configuration Date: Mon, 30 Mar 2020 13:40:25 -0700 Message-Id: <20200330204032.26313-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330204032.26313-1-f.fainelli@gmail.com> References: <20200330204032.26313-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The first time b53_configure_vlan() is called we have not configured any VLAN entries yet, since that happens later when interfaces get brought up. When b53_configure_vlan() is called again from suspend/resume we need to restore all VLAN entries though. Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 39ae4ed87d1d..5cb678e8b9cd 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -681,7 +681,9 @@ int b53_configure_vlan(struct dsa_switch *ds) { struct b53_device *dev = ds->priv; struct b53_vlan vl = { 0 }; + struct b53_vlan *v; int i, def_vid; + u16 vid; def_vid = b53_default_pvid(dev); @@ -699,6 +701,19 @@ int b53_configure_vlan(struct dsa_switch *ds) b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(i), def_vid); + /* Upon initial call we have not set-up any VLANs, but upon + * system resume, we need to restore all VLAN entries. + */ + for (vid = def_vid; vid < dev->num_vlans; vid++) { + v = &dev->vlans[vid]; + + if (!v->members) + continue; + + b53_set_vlan_entry(dev, vid, v); + b53_fast_age_vlan(dev, vid); + } + return 0; } EXPORT_SYMBOL(b53_configure_vlan); From patchwork Mon Mar 30 20:40:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221550 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92452C43331 for ; Mon, 30 Mar 2020 20:40:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 693C920733 for ; Mon, 30 Mar 2020 20:40:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jLWl3OQ2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729284AbgC3Ukx (ORCPT ); Mon, 30 Mar 2020 16:40:53 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55736 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728494AbgC3Ukv (ORCPT ); Mon, 30 Mar 2020 16:40:51 -0400 Received: by mail-wm1-f65.google.com with SMTP id r16so269253wmg.5 for ; Mon, 30 Mar 2020 13:40:50 -0700 (PDT) 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; bh=TLSkwbkBmT9mvdGuUe/8YRoz6F0Zjj10CnTJyh7civM=; b=jLWl3OQ2xJ6UZIPQKsIXcNBti+Uxd3OvQ6mMriWgs5l7d4T+j1RKoq+8KJrDpmA8Q3 sStRwPRDDcQlXh4uL73/vVawiO8ZuiqNWizVv7ECzkrjWQOMmi29X2kqA8Mdm+QY9nwn Q5f+o2YWIMXGwjW+lhdcj5UrCnK5eYeYBNPvKGYryZGaDB2c7ZCCZiXxn3WcQafc7+if lt0dBwGmh/v497kqUThpN0V3q66O412MG7p/kz1LAvp2VqXTsqz/ZosB+nt5YqseT/lO pAZLZk0UaQxV4CbHTj8q3MvhelnUJVZj6O7ZWz0fL49uFlc/38Ct2ggDwnEPqf00KWs/ /LuA== 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=TLSkwbkBmT9mvdGuUe/8YRoz6F0Zjj10CnTJyh7civM=; b=N8Sz9HtkHd1Fo1Mf49zHyyY/jYO0Zv+EAQj+R9QD54HXnLt/ZBUAjAL73mmczvh056 L/HS+Y3TBmCtJ2hdwr/knhSBPFN5V33pILnRJTQ/Cg5UoPF/SRPs0Ern9mzhTCgLOjC5 ZJ0MrkvfPakLH2pHgBhn+QYu0n79SpAoADZe6XhEP1LQtNqaJYawIpdZeVzXKxufMPBH MWWJuzwvBgWNHlsRM3ma4rmyzNnAmSBwM34Tnl1b3dW95saj13R6JZ0NqeXGMRDQzZn2 8Y1jK2jc3n90PptaqM3O0CE+dY1T4w6vJJZpSapXDkRgYehKbbPdU8NeRUTelfh1GIBx Ij6g== X-Gm-Message-State: ANhLgQ2+06wjNTEd+ZSqm59wsR8Br3qFDqsd2QWpJnZFlbz4SDKSonmr PO5Y9LdgOdA8G+jpF1nt4G84wGfO X-Google-Smtp-Source: ADFU+vs5QK78xGFx05bMsLdo1WCyAWcj5HBSr/DvJ9D42hCQ4Cn8fbCQ9YdtAjCz5MmfzcjKFlPnHQ== X-Received: by 2002:a1c:56d5:: with SMTP id k204mr1131432wmb.13.1585600849172; Mon, 30 Mar 2020 13:40:49 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o16sm23371109wrs.44.2020.03.30.13.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 13:40:48 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , andrew@lunn.ch, vivien.didelot@gmail.com, davem@davemloft.net, kuba@kernel.org, dan.carpenter@oracle.com Subject: [PATCH net-next 4/9] net: dsa: b53: Deny enslaving port 7 for 7278 into a bridge Date: Mon, 30 Mar 2020 13:40:27 -0700 Message-Id: <20200330204032.26313-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330204032.26313-1-f.fainelli@gmail.com> References: <20200330204032.26313-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 7278, port 7 connects to the ASP which should only receive frames through the use of CFP rules, it is not desirable to have it be part of a bridge at all since that would make it pick up unwanted traffic that it may not even be able to filter or sustain. Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 42c41b091682..68e2381694b9 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1728,6 +1728,12 @@ int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br) u16 pvlan, reg; unsigned int i; + /* On 7278, port 7 which connects to the ASP should only receive + * traffic from matching CFP rules. + */ + if (dev->chip_id == BCM7278_DEVICE_ID && port == 7) + return -EINVAL; + /* Make this port leave the all VLANs join since we will have proper * VLAN entries from now on */ From patchwork Mon Mar 30 20:40:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F503C43331 for ; Mon, 30 Mar 2020 20:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE90B20757 for ; Mon, 30 Mar 2020 20:40:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aO0qjK0q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729311AbgC3Uk5 (ORCPT ); Mon, 30 Mar 2020 16:40:57 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46801 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729285AbgC3Ukz (ORCPT ); Mon, 30 Mar 2020 16:40:55 -0400 Received: by mail-wr1-f68.google.com with SMTP id j17so23260415wru.13 for ; Mon, 30 Mar 2020 13:40:54 -0700 (PDT) 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; bh=dDCxEQUMx7omsUPWXKxd3IbegM/d//gGYNCpsBduu7o=; b=aO0qjK0qVrhBTUXjPXLfO3/Znc5QD+VufQU9P3QpohSmsOSwFQsXp7yLOLmiR/osRt I56vVtcHak/yTkxhBEzcbMSIm6/EOY/rMAqdd8sYHOYimQ8skCUsqiBYrCtNYRusFvhZ YS2OQHEtvWw8lr5YwbFdhda6gi2B8Fv58DUQoAyqoT4N6c/1ZYytkNJRtgRSKAgxaPop AmigK+Z1Nn6CERFF1TaKmpr1qzok/mlT4rVYabepjtLmT+h/opcYluk9Z1yzSAhBg/8H cYQxg4AcqABTEUKuu0yO3U59A/4zvh3cwkmNRDJ68WYLVqaFdKSyoHFczk4H4RZLEUv9 nbPw== 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=dDCxEQUMx7omsUPWXKxd3IbegM/d//gGYNCpsBduu7o=; b=JKKrGS3vqUzO4YCYsp0NnrW11ujY2Tn7Z8fL9JOqoYOZTQz0O120lt2XzT9WXm2BCt P0IJSs+rVmnv52lrknqd2uTR6O57XiYV2bifoqIXkw3cnSF/wEC/9Sz36n1MJoCg/yC5 OW5k4MfgI8+E0l5H5Rg8KBdVjb3EyYI8K9H7oFvAUhM50fHYUnORUQ9C9erNEWBrGt1f cHvIm9wDNW80yBInKUaLqgIlcopwjw15VvAinllATVpp57dUENGQlWbLOceQx9+KXu9j +w3dh9bpIeti0cJtCZjd2jLxtSHwK7Q4UnbTFilGewvk1qJLouCDcbo0I4JyntUT6Xav 6RDw== X-Gm-Message-State: ANhLgQ2TqxUKmSWi3ADN0wc2l6E4KqfnFSrgb2udB4ymDe3owezhFjXV oCEL5BWXgyq3CK5xGr9V8+tZVWyk X-Google-Smtp-Source: ADFU+vvMYwn6ilqSfdgo2y9BcnF9dOCNJuW4yMRUKofSvcGDrsLUJpfibYOi62jOzFi2FC97lC/BYQ== X-Received: by 2002:a5d:630e:: with SMTP id i14mr16774157wru.260.1585600853971; Mon, 30 Mar 2020 13:40:53 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o16sm23371109wrs.44.2020.03.30.13.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 13:40:53 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , andrew@lunn.ch, vivien.didelot@gmail.com, davem@davemloft.net, kuba@kernel.org, dan.carpenter@oracle.com Subject: [PATCH net-next 6/9] net: dsa: bcm_sf2: Check earlier for FLOW_EXT and FLOW_MAC_EXT Date: Mon, 30 Mar 2020 13:40:29 -0700 Message-Id: <20200330204032.26313-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330204032.26313-1-f.fainelli@gmail.com> References: <20200330204032.26313-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We do not currently support matching on FLOW_EXT or FLOW_MAC_EXT, but we were not checking for those bits being set in the flow specification. Signed-off-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2_cfp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index f9785027c096..6e26a9083d32 100644 --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c @@ -878,8 +878,8 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, int ret = -EINVAL; /* Check for unsupported extensions */ - if ((fs->flow_type & FLOW_EXT) && (fs->m_ext.vlan_etype || - fs->m_ext.data[1])) + if ((fs->flow_type & (FLOW_EXT || FLOW_MAC_EXT)) || + fs->m_ext.data[1]) return -EINVAL; if (fs->location != RX_CLS_LOC_ANY && From patchwork Mon Mar 30 20:40:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221548 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D2D3C43331 for ; Mon, 30 Mar 2020 20:41:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AACE20733 for ; Mon, 30 Mar 2020 20:41:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VZIIAfkT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729373AbgC3UlC (ORCPT ); Mon, 30 Mar 2020 16:41:02 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45334 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729299AbgC3UlC (ORCPT ); Mon, 30 Mar 2020 16:41:02 -0400 Received: by mail-wr1-f66.google.com with SMTP id t7so23307094wrw.12 for ; Mon, 30 Mar 2020 13:40:59 -0700 (PDT) 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; bh=+tGIG6SQUzoIjfO4WQZB6NRMG2/a22HH7D+VatxbZMY=; b=VZIIAfkToEXAlJH29tZkatAj/G/ICOLghfx/cdhzlgC4yKQGpwGwav4cgQZhJFtd5H pNdpfIKHpyYRzSTkcxkoe/vBy0MeVYvIap6StxdDXVZyAvXptf0WNh35O4jTSDM/mD/g iC+3G3NRv2ofXwcaxaWtrnOZaTIqJmLTELfbTA4es9dux0+gtxH1GQ+sXvksKvdeJku+ cniyFSNCKZ0PuorrtmdmO7wmK68xvhimFGuK3oj18h0fpI/PAnuez/FnJ9CJboqaAq/z DSCsRz9z4DLNTHxi30/F07ImXDIw24Pzcb93wR8Iy0k3YoScIKaG4Job/JEpoLpxdhVh vrGQ== 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=+tGIG6SQUzoIjfO4WQZB6NRMG2/a22HH7D+VatxbZMY=; b=bAH40GPUaU5R+AJ+/+8WqXxM4z5MejyrkmJC+rUJosXjaJei/oAv3Qan7LfExQsH1M cm8U92n8Mpv1SQgvrfkK4kXr80Z3/kBysW+JdmE5Qmr40bPycvTlEY55Hy9JUOep7nd2 GYmtlUsED+wx6um4lFNB6b2+l44MR0ljICcfqPDDgPEXs3u9iQaSEsIcr4bLEs0NftJU 2aM44giIhoe7u1iYUiyfyXG77dbxXflfwwoZwqrwyr8WQWNLq8ZvWPDIAW9Zgsm9ID5R TB9aJjMI+KXsHteZmqFDTmQXegEIHXdU092nD2tk3QJYPN+wmH1pzwCxWR5wderwSSDE iFbA== X-Gm-Message-State: ANhLgQ356Cnxe7LK5QBh+b9wd454RB2+8YmCV0nTRMqUOH18FIvi4aUz azFcQ9u21B5WxrgyRmyYiFJJ0KPL X-Google-Smtp-Source: ADFU+vuIExxRnwnkFnsSVNz3JOxk9ORo1GM9EPqhN4mS7YMO8imXJNILZ+lbqC8z4JH2G7QEyruJiA== X-Received: by 2002:a5d:5687:: with SMTP id f7mr15973672wrv.425.1585600858286; Mon, 30 Mar 2020 13:40:58 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o16sm23371109wrs.44.2020.03.30.13.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 13:40:57 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , andrew@lunn.ch, vivien.didelot@gmail.com, davem@davemloft.net, kuba@kernel.org, dan.carpenter@oracle.com Subject: [PATCH net-next 8/9] net: dsa: bcm_sf2: Add support for matching VLAN TCI Date: Mon, 30 Mar 2020 13:40:31 -0700 Message-Id: <20200330204032.26313-9-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330204032.26313-1-f.fainelli@gmail.com> References: <20200330204032.26313-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Update relevant code paths to support the programming and matching of VLAN TCI, this is the only member of the ethtool_flow_ext that we can match, the switch does not permit matching the VLAN Ethernet Type field. Signed-off-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2_cfp.c | 52 +++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index 8529f55a4d1f..7b10a9f31538 100644 --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c @@ -261,6 +261,7 @@ static int bcm_sf2_cfp_act_pol_set(struct bcm_sf2_priv *priv, static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv, struct flow_dissector_key_ipv4_addrs *addrs, struct flow_dissector_key_ports *ports, + const __be16 vlan_tci, unsigned int slice_num, u8 num_udf, bool mask) { @@ -270,16 +271,17 @@ static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv, * S-Tag [23:8] * C-Tag [7:0] */ + reg = udf_lower_bits(num_udf) << 24 | be16_to_cpu(vlan_tci) >> 8; if (mask) - core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); + core_writel(priv, reg, CORE_CFP_MASK_PORT(5)); else - core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); + core_writel(priv, reg, CORE_CFP_DATA_PORT(5)); /* C-Tag [31:24] * UDF_n_A8 [23:8] * UDF_n_A7 [7:0] */ - reg = 0; + reg = (u32)(be16_to_cpu(vlan_tci) & 0xff) << 24; if (mask) offset = CORE_CFP_MASK_PORT(4); else @@ -345,6 +347,7 @@ static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port, struct ethtool_rx_flow_spec *fs) { struct ethtool_rx_flow_spec_input input = {}; + __be16 vlan_tci = 0 , vlan_m_tci = 0xffff; const struct cfp_udf_layout *layout; unsigned int slice_num, rule_index; struct ethtool_rx_flow_rule *flow; @@ -369,6 +372,12 @@ static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port, ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); + /* Extract VLAN TCI */ + if (fs->flow_type & FLOW_EXT) { + vlan_tci = fs->h_ext.vlan_tci; + vlan_m_tci = fs->m_ext.vlan_tci; + } + /* Locate the first rule available */ if (fs->location == RX_CLS_LOC_ANY) rule_index = find_first_zero_bit(priv->cfp.used, @@ -431,10 +440,10 @@ static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port, udf_upper_bits(num_udf), CORE_CFP_MASK_PORT(6)); /* Program the match and the mask */ - bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, slice_num, - num_udf, false); - bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, SLICE_NUM_MASK, - num_udf, true); + bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, vlan_tci, + slice_num, num_udf, false); + bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, vlan_m_tci, + SLICE_NUM_MASK, num_udf, true); /* Insert into TCAM now */ bcm_sf2_cfp_rule_addr_set(priv, rule_index); @@ -470,6 +479,7 @@ static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port, static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, const __be32 *ip6_addr, const __be16 port, + const __be16 vlan_tci, unsigned int slice_num, u32 udf_bits, bool mask) { @@ -479,10 +489,11 @@ static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, * S-Tag [23:8] * C-Tag [7:0] */ + reg = udf_bits << 24 | be16_to_cpu(vlan_tci) >> 8; if (mask) - core_writel(priv, udf_bits << 24, CORE_CFP_MASK_PORT(5)); + core_writel(priv, reg, CORE_CFP_MASK_PORT(5)); else - core_writel(priv, udf_bits << 24, CORE_CFP_DATA_PORT(5)); + core_writel(priv, reg, CORE_CFP_DATA_PORT(5)); /* C-Tag [31:24] * UDF_n_B8 [23:8] (port) @@ -490,6 +501,7 @@ static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, */ reg = be32_to_cpu(ip6_addr[3]); val = (u32)be16_to_cpu(port) << 8 | ((reg >> 8) & 0xff); + val |= (u32)(be16_to_cpu(vlan_tci) & 0xff) << 24; if (mask) offset = CORE_CFP_MASK_PORT(4); else @@ -598,6 +610,11 @@ static int bcm_sf2_cfp_rule_cmp(struct bcm_sf2_priv *priv, int port, ret = memcmp(&rule->fs.h_u, &fs->h_u, fs_size); ret |= memcmp(&rule->fs.m_u, &fs->m_u, fs_size); + /* Compare VLAN TCI values as well */ + if (rule->fs.flow_type & FLOW_EXT) { + ret |= rule->fs.h_ext.vlan_tci != fs->h_ext.vlan_tci; + ret |= rule->fs.m_ext.vlan_tci != fs->m_ext.vlan_tci; + } if (ret == 0) break; } @@ -611,6 +628,7 @@ static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port, struct ethtool_rx_flow_spec *fs) { struct ethtool_rx_flow_spec_input input = {}; + __be16 vlan_tci = 0, vlan_m_tci = 0xffff; unsigned int slice_num, rule_index[2]; const struct cfp_udf_layout *layout; struct ethtool_rx_flow_rule *flow; @@ -634,6 +652,12 @@ static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port, ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); + /* Extract VLAN TCI */ + if (fs->flow_type & FLOW_EXT) { + vlan_tci = fs->h_ext.vlan_tci; + vlan_m_tci = fs->m_ext.vlan_tci; + } + layout = &udf_tcpip6_layout; slice_num = bcm_sf2_get_slice_number(layout, 0); if (slice_num == UDF_NUM_SLICES) @@ -717,10 +741,10 @@ static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port, /* Slice the IPv6 source address and port */ bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->src.in6_u.u6_addr32, - ports.key->src, slice_num, + ports.key->src, vlan_tci, slice_num, udf_lower_bits(num_udf), false); bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->src.in6_u.u6_addr32, - ports.mask->src, SLICE_NUM_MASK, + ports.mask->src, vlan_m_tci, SLICE_NUM_MASK, udf_lower_bits(num_udf), true); /* Insert into TCAM now because we need to insert a second rule */ @@ -773,10 +797,10 @@ static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port, core_writel(priv, reg, CORE_CFP_MASK_PORT(6)); bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->dst.in6_u.u6_addr32, - ports.key->dst, slice_num, + ports.key->dst, 0, slice_num, 0, false); bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->dst.in6_u.u6_addr32, - ports.key->dst, SLICE_NUM_MASK, + ports.key->dst, 0, SLICE_NUM_MASK, 0, true); /* Insert into TCAM now */ @@ -878,7 +902,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, int ret = -EINVAL; /* Check for unsupported extensions */ - if ((fs->flow_type & (FLOW_EXT || FLOW_MAC_EXT)) || + if ((fs->flow_type & FLOW_MAC_EXT) || fs->m_ext.data[1]) return -EINVAL;