From patchwork Mon Mar 30 21:38:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221542 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 D2A5FC2D0F1 for ; Mon, 30 Mar 2020 21:39:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA31220784 for ; Mon, 30 Mar 2020 21:39:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FNwuV9kU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729273AbgC3VjG (ORCPT ); Mon, 30 Mar 2020 17:39:06 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:32984 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728819AbgC3VjG (ORCPT ); Mon, 30 Mar 2020 17:39:06 -0400 Received: by mail-wm1-f66.google.com with SMTP id z14so592916wmf.0 for ; Mon, 30 Mar 2020 14:39:05 -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=FNwuV9kUyjIa/kmWbrt6eViGagkaBYgbU4BItZuNdQ5emO8d7ETIZv3siYpnbL6m8K cYsv1xWqL/kvqAmzCJQbk+c/KthtDanFl9peB9G4OUik8NgsrM21rSYasCAp72SB9hbT Wohoj76B/tqcxsvWynTI/LCBm8EJTAoYYftTJRY7PKY3twRhbU3OT3AIwMCvbfa6IS28 UGJiwgSnZJ9mpsuSD1VCwmckrWsZWJTpUct41vbRD2T6pLHw22vB5XJuHxegfRlg5aqR 9Od00kXh3vVAhQUv2KDbVe7t5w4M0hAa+CmmPvK63fqpRrfouV4BTj7aYa+jniBxjG90 cuug== 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=PgdZWgERddfcwMK5n1WXkhYBlGhGNn8QgZp/jA+P06bFf5hg391y6cQqvoLFl4kO2a xuswWtrA0ABrPd33X97tRYSlFo9MYur9noM0upujSi3UkN01kwBGCUaq0bgOS9V5+XIt lD4iTfvQH6/r32yI8vEPGv7G/p809MJgqSyZDFWznhsgK1OUCXUJjuYzNoTicaZKY3if li5oUZ3ZOHIoZmR/AVebiPuWAHF0XuPWBnGMVlueRQz654sb745nwmVUz0sbdzjQhy5g eKImCn28fr0J6ymnjzinuQJUVe87mCAx/BxFidusvgy3CTaHt9vvr9/KEoTmJzzxZl55 +3+A== X-Gm-Message-State: ANhLgQ2IS5bU8iUmeCex8Az09Vr0wsKZkWD+Q3RiZT1rM0aAir9r0iF3 F3igUijwR3nmJnw6OAGAziwYm5JI X-Google-Smtp-Source: ADFU+vv8GWRPh32K5UKNfhYrJzph0MWtcYHOY4y+UBLRqmx5cLVIR3+5LLkUQi/WmuXsW1hq7uQr5Q== X-Received: by 2002:a05:600c:24a:: with SMTP id 10mr130907wmj.98.1585604344304; Mon, 30 Mar 2020 14:39:04 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r17sm23600853wrx.46.2020.03.30.14.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 14:39:03 -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 v2 2/9] net: dsa: b53: Restore VLAN entries upon (re)configuration Date: Mon, 30 Mar 2020 14:38:47 -0700 Message-Id: <20200330213854.4856-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330213854.4856-1-f.fainelli@gmail.com> References: <20200330213854.4856-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 21:38:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221541 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 76B0DC2D0F1 for ; Mon, 30 Mar 2020 21:39:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 423BD20784 for ; Mon, 30 Mar 2020 21:39:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BjQhtIf1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729319AbgC3VjL (ORCPT ); Mon, 30 Mar 2020 17:39:11 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33842 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729279AbgC3VjK (ORCPT ); Mon, 30 Mar 2020 17:39:10 -0400 Received: by mail-wm1-f65.google.com with SMTP id 26so588514wmk.1 for ; Mon, 30 Mar 2020 14:39:09 -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=BjQhtIf13chJUOY9M790edfFWtH0pLW8dsehVzdjgxoTt4t4t9RSkXpcIEgXsMhy9W 99nRegVKCkNdj2cNTR8WpR0AsoABUC/8Y8TF3S+w/o2NISMC7Ws+cVttV4iiVnYqGmJD mbLg1tkJ/Eko3bKj7z7uxmba3QfvbGVRg6VOSSxCYxDaimQ9vnVM2G3emsHu2jqJy2yI ej2pXW945548CnJPqYxh5rt+sNY3KRMAdG26HUSDV5jWvEhPvQAe6j34fwIktsmlG5yD P3RMtvo+SVmrdMeY8xDbW/UwIQ/7Vy+SNVimUuCkQBMc06Ppyr0ij6qOMNp1aexjCBFw PS7g== 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=FPxSoe8S56IZp8m/Ppx+9s/zigU+9+m6vaS90G0f/mRvOiNoLbdam/ZcXS57/PoMUd UF+xBELNjK33RCxdSnrOgEN76xB686GdVeCS1m9/gKfFxZDRJCsjSngPVAzPErtDszjb uY9au1ybHgX8IaDATMDyu1slBU5VX0h7igaZtE+BZ2i1E27vS+OrnzaU1dG4SHQoMpzT Ut/xOGOWZ3UEfXznyqGptJs+Tm5vkBauuWyNzb8teHrGQEYwWZUYrb28uB9uCdeIH1qn yNrJfVachjC0er28VLk0TKV6sCVIHqqyHe7mKQHXz95MKJk9ESbcPuEObOqWPOdbZwUR UrUA== X-Gm-Message-State: ANhLgQ3oqEdIJLaRGVAFR5QbcTXrHACG+HJIWykfy3iOzmVETgHKv+NG pZyVZpFV9M3QyNteYNR6zX3i/wpS X-Google-Smtp-Source: ADFU+vtazTDFLeFjLvyR12r2nX95fLWkM9JLselUFE8G46okF7wlEufna5rIMqif9dhNGyE4GU356Q== X-Received: by 2002:a7b:c205:: with SMTP id x5mr87312wmi.189.1585604348759; Mon, 30 Mar 2020 14:39:08 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r17sm23600853wrx.46.2020.03.30.14.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 14:39:08 -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 v2 4/9] net: dsa: b53: Deny enslaving port 7 for 7278 into a bridge Date: Mon, 30 Mar 2020 14:38:49 -0700 Message-Id: <20200330213854.4856-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330213854.4856-1-f.fainelli@gmail.com> References: <20200330213854.4856-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 21:38:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221540 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 80C1CC43331 for ; Mon, 30 Mar 2020 21:39:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 52D3820733 for ; Mon, 30 Mar 2020 21:39:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U8NfGzr4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729381AbgC3VjS (ORCPT ); Mon, 30 Mar 2020 17:39:18 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34931 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729335AbgC3VjR (ORCPT ); Mon, 30 Mar 2020 17:39:17 -0400 Received: by mail-wr1-f68.google.com with SMTP id d5so23573464wrn.2 for ; Mon, 30 Mar 2020 14:39:14 -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=uisaVSbt+AjqZJIhEGd05nS3aQ/c+8p2XMpEluonO5o=; b=U8NfGzr4KRjcEg7EmMrMzVRVAhGKRHLhkhNUyu33G4tpjAl0/tPcuMYzfekLVo1z4y 368CCQQD6DwREOqjQE15V/Ud58E8u9slKdgjIBcEweKU9M/bwoKRsBCiV+SPw6wp9WE5 p4otrg601vBB9Tf+tWaL6peX81h3xHmRGX+PF+iz+Cmx0pZP86IrTeDHNCs5HfPwAifB 2/zBVV504x3Zg+c00s2Fs2NBy5XlgiroMe4GYd8dzk02s7g7W4/v2jNX1G24v44IOX4R 2J4jApst4cGsefWZyZYjHne30Bk6z+JVro9BbPNy5M4qGc6hrXqwneXQ4vXvv5IkKnjd S37A== 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=uisaVSbt+AjqZJIhEGd05nS3aQ/c+8p2XMpEluonO5o=; b=DFMxXDP0u+dMGz0vBaTMOlnTt8yxpZEUCyD5l/Zfbbcszp6tM4LtjIaOPxSQ9Guj2E EMiW036n7zcaOkdiUqKVthLMxBqcKBqhhH1bnoyykurzi5n0vYvSCaivN1NTP2lZm0Ye mhUanumHveZ00hWzN7N/i4OPWjmBb1PfGWTm7BzsL8k5auqMAXgGQxlbwPgwyvpqRIAi MctGwYFy9C3pdsk/3MC0s172lrKaTf+ollK8tojUHxXoE9usmwPU+PKm8QKv8JmN8kLy cEAloPd5XYTBYfE8CuMnlC8IpI/p9k62ojVf4fVg8xHxlQhtyaLUwpX3oxZTyvEhebzV gSMA== X-Gm-Message-State: ANhLgQ1qdR8PgW9O/i7QBNczIpwgkwWEsgRaJyJNLDqpece8tnxsbhKB 7YH//8vWKtfb0nuX8HP1EuCGXOiz X-Google-Smtp-Source: ADFU+vtBTX3LOJy/LCbG55wv7xYQDKzDMxR75StZ6mt1fqkgouwdQ6/E/KAw35/m3XbfvyS+oElmCQ== X-Received: by 2002:adf:8187:: with SMTP id 7mr17719315wra.358.1585604353506; Mon, 30 Mar 2020 14:39:13 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r17sm23600853wrx.46.2020.03.30.14.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 14:39:12 -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 v2 6/9] net: dsa: bcm_sf2: Check earlier for FLOW_EXT and FLOW_MAC_EXT Date: Mon, 30 Mar 2020 14:38:51 -0700 Message-Id: <20200330213854.4856-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330213854.4856-1-f.fainelli@gmail.com> References: <20200330213854.4856-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. The check for FLOW_EXT and FLOW_MAC_EXT are separated out because a subsequent commit will add support for matching VLAN TCI which are covered by FLOW_EXT. Signed-off-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2_cfp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index f9785027c096..40ea88c304de 100644 --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c @@ -878,8 +878,9 @@ 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) || + (fs->flow_type & FLOW_MAC_EXT) || + fs->m_ext.data[1]) return -EINVAL; if (fs->location != RX_CLS_LOC_ANY && From patchwork Mon Mar 30 21:38:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 221539 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 88A63C2D0F1 for ; Mon, 30 Mar 2020 21:39:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57C8B20784 for ; Mon, 30 Mar 2020 21:39:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OVbYbMmU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729406AbgC3VjW (ORCPT ); Mon, 30 Mar 2020 17:39:22 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42693 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729129AbgC3VjU (ORCPT ); Mon, 30 Mar 2020 17:39:20 -0400 Received: by mail-wr1-f65.google.com with SMTP id h15so23473948wrx.9 for ; Mon, 30 Mar 2020 14:39:18 -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=Tnxi8udtjZOHkoTyT8NFuYHW6nmYNu3gQRUZG88+tNI=; b=OVbYbMmUYIHFklHhjA8GgDdouDawzA4+2MOEBI43O3WfIuSthL2xP58EE7VjuwSZz8 Ly6VuzqqNCpf5C9PkDHA7zZ/g9cBDlErUoXl0jsVJCrhcDN8qyNmSPz+BVGll+Z8AGmB thzcQJHWIuINiOxmdpRjYES7CnkJRKp1ae9nmMGEoYWCHEFbKQexeyWmOQEpAv08Y7NT ZWTEhXvct0quzP72SdcBkwnPMRui3o0EO4yJQa0YsTPFMbB90C361WVdli2nmVZEWPN8 Kxi0dPc7FiFlG/oKhnUmRVsuA/af7AN07dCdlMzgKDDqaUqZrc0MNRWbx4dbdbKevopq dLcw== 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=Tnxi8udtjZOHkoTyT8NFuYHW6nmYNu3gQRUZG88+tNI=; b=AC1h93r1Qd6BlBDsvNxSp+Svnt4nWAWph99tfLJr3EAfjdNDEUWxN1DmnNB1NLmePI G6pJ7xxLGdNMTnSk258XXtdVYXtISW6zECCCpVAV/iKghFpia/JikDA2l6+jhDtkgtId Wmx1bPUtRPfJrppSRahubtU5eimUbkzdwmqE9QPfJ+6orlqmvw0BoPH5x1fySqAOTFea ZB9c5hYu5wY1YNlKnnztc2LoBvMz50zyGr0WWWkt5fx/JM4AaZDjPzRbHHg/lyr4/tWE XGGlrS1qClz6UUUUC3gN1BWd8ZWfGIBUy0LO9nIZoTQoNmebkJW8ymQHHhr3JXsoVshw h4aw== X-Gm-Message-State: ANhLgQ3pDFnoFqW4S3DzMMafMImxKLAXRJnL/P2kN192o3pv+cS1/XCg K1xuF2R/f1E2YVaagkZcC/eJWDND X-Google-Smtp-Source: ADFU+vsMQiyYCe+51RhcglSexY+U0hu5wp71ICw8Pz5eRBeLRNztYHHmsiV48KLA2vE/2jzAkQW3aQ== X-Received: by 2002:a05:6000:1205:: with SMTP id e5mr17977334wrx.73.1585604357797; Mon, 30 Mar 2020 14:39:17 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r17sm23600853wrx.46.2020.03.30.14.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 14:39:17 -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 v2 8/9] net: dsa: bcm_sf2: Add support for matching VLAN TCI Date: Mon, 30 Mar 2020 14:38:53 -0700 Message-Id: <20200330213854.4856-9-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330213854.4856-1-f.fainelli@gmail.com> References: <20200330213854.4856-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 | 53 +++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index a6cc076f1a67..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,8 +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) || - (fs->flow_type & FLOW_MAC_EXT) || + if ((fs->flow_type & FLOW_MAC_EXT) || fs->m_ext.data[1]) return -EINVAL;