From patchwork Mon Mar 1 11:18:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 389020 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, 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 74FFBC433DB for ; Mon, 1 Mar 2021 11:20:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39F7464DF5 for ; Mon, 1 Mar 2021 11:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232362AbhCALUk (ORCPT ); Mon, 1 Mar 2021 06:20:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232268AbhCALTU (ORCPT ); Mon, 1 Mar 2021 06:19:20 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2459DC0617AB for ; Mon, 1 Mar 2021 03:18:40 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id c6so20190118ede.0 for ; Mon, 01 Mar 2021 03:18:40 -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=buJA7JBdtnLfaYWGzMfKmcyZstmCAza5dcaiN9jkd8o=; b=E5BRthDNboKLvCnPz8qzS1KHvexDGOLIH5ktDX2FxzTLOMMrEQKRhmbXHQmcvSlTQy Ax/+UJ1nsxAtO3e2EJU9dipCZwu2UV0vCsaFbNJEkLxnOfEMdiOtPqkJbVeiG2YRLiCN BnY5wlDx6K2Iru6BfCm0EjH7TgJL8VQJQsmA/9p1l0pbgdBp4AqKx5yJWJmT6UZK4hj1 uFEujr1OWIqau5XkTvAc0hlr61G8YQBtGUGLGozIez3gypaK1cqAy2k6kZaIMMBgYt0s yL1sjewavdoh28ahuI54MLDeTQGxZagPkgHpzF2acyyalkJgOVSn2b1KPnVkhASZO+0M uciA== 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=buJA7JBdtnLfaYWGzMfKmcyZstmCAza5dcaiN9jkd8o=; b=HhqVwIHlqFBI4mOknTTvyYqoN0/SbYtsL4UE4IFz9t/zkdMas2TZXEYjBQnfdOT5+k vjxr1mcoiawhrnBG1xKCC/mPdhqJI3kFLYGVuuG6oyGofV81gLNs/SL/ORRAL9coPLgp 85+dHgR4XYPygpg86aNWf2CXgBYmC//R0CIYoU00nLF3+/EG0xUNUJ2qCfVUbMCVUwjZ JmFkldxdjtQPiH0SR+xHVMe/ASzT1n0lB0Ds6HGh7HxfBNoKV7EI1WqvdMlk8Qen7AnV 83QKFy+5heNQ3QVT3KFoefUd1DXTFFyXqksfoMHIm0dIQWvnkOU6oNiPO0QKhp0cP9T6 bnBg== X-Gm-Message-State: AOAM530Pphh0+IT7ObctBfTy11J0ohZtOY/9mmMB/nwXPI2RGLeo6FOn bBD/f1PpYHmKrk4s4cOaQIE= X-Google-Smtp-Source: ABdhPJxUH6HG/jKtvX1dbx4scwDTPSup7lGW2Jg3wBucA12nkisFA49VbQ4C21MmFHSi0oZJQ2E3wQ== X-Received: by 2002:a05:6402:13ce:: with SMTP id a14mr15924609edx.365.1614597518895; Mon, 01 Mar 2021 03:18:38 -0800 (PST) Received: from localhost.localdomain ([188.25.217.13]) by smtp.gmail.com with ESMTPSA id i13sm13586491ejj.2.2021.03.01.03.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 03:18:38 -0800 (PST) From: Vladimir Oltean To: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Michael Walle , Claudiu Manoil , Alexandru Marginean , Andrew Lunn , Vladimir Oltean , =?utf-8?q?Markus_Bl=C3=B6chl?= Subject: [PATCH v3 net 5/8] net: enetc: don't disable VLAN filtering in IFF_PROMISC mode Date: Mon, 1 Mar 2021 13:18:15 +0200 Message-Id: <20210301111818.2081582-6-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210301111818.2081582-1-olteanv@gmail.com> References: <20210301111818.2081582-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean Quoting from the blamed commit: In promiscuous mode, it is more intuitive that all traffic is received, including VLAN tagged traffic. It appears that it is necessary to set the flag in PSIPVMR for that to be the case, so VLAN promiscuous mode is also temporarily enabled. On exit from promiscuous mode, the setting made by ethtool is restored. Intuitive or not, there isn't any definition issued by a standards body which says that promiscuity has anything to do with VLAN filtering - it only has to do with accepting packets regardless of destination MAC address. In fact people are already trying to use this misunderstanding/bug of the enetc driver as a justification to transform promiscuity into something it never was about: accepting every packet (maybe that would be the "rx-all" netdev feature?): https://lore.kernel.org/netdev/20201110153958.ci5ekor3o2ekg3ky@ipetronik.com/ This is relevant because there are use cases in the kernel (such as tc-flower rules with the protocol 802.1Q and a vlan_id key) which do not (yet) use the vlan_vid_add API to be compatible with VLAN-filtering NICs such as enetc, so for those, disabling rx-vlan-filter is currently the only right solution to make these setups work: https://lore.kernel.org/netdev/CA+h21hoxwRdhq4y+w8Kwgm74d4cA0xLeiHTrmT-VpSaM7obhkg@mail.gmail.com/ The blamed patch has unintentionally introduced one more way for this to work, which is to enable IFF_PROMISC, however this is non-portable because port promiscuity is not meant to disable VLAN filtering. Therefore, it could invite people to write broken scripts for enetc, and then wonder why they are broken when migrating to other drivers that don't handle promiscuity in the same way. Fixes: 7070eea5e95a ("enetc: permit configuration of rx-vlan-filter with ethtool") Cc: Markus Blöchl Signed-off-by: Vladimir Oltean --- Changes in v3: Added one more paragraph in the commit message. Changes in v2: None. drivers/net/ethernet/freescale/enetc/enetc_pf.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 62ba4bf56f0d..49681a0566ed 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -190,7 +190,6 @@ static void enetc_pf_set_rx_mode(struct net_device *ndev) { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_pf *pf = enetc_si_priv(priv->si); - char vlan_promisc_simap = pf->vlan_promisc_simap; struct enetc_hw *hw = &priv->si->hw; bool uprom = false, mprom = false; struct enetc_mac_filter *filter; @@ -203,16 +202,12 @@ static void enetc_pf_set_rx_mode(struct net_device *ndev) psipmr = ENETC_PSIPMR_SET_UP(0) | ENETC_PSIPMR_SET_MP(0); uprom = true; mprom = true; - /* Enable VLAN promiscuous mode for SI0 (PF) */ - vlan_promisc_simap |= BIT(0); } else if (ndev->flags & IFF_ALLMULTI) { /* enable multi cast promisc mode for SI0 (PF) */ psipmr = ENETC_PSIPMR_SET_MP(0); mprom = true; } - enetc_set_vlan_promisc(&pf->si->hw, vlan_promisc_simap); - /* first 2 filter entries belong to PF */ if (!uprom) { /* Update unicast filters */