Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3513308pxf; Mon, 15 Mar 2021 11:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtbqAzUsI+OVphA1PKauZnhm8Er7swJCcPW2wu5DRvy5oQLFCem3kj93vTPOugXBGEv8ed X-Received: by 2002:aa7:c345:: with SMTP id j5mr30623576edr.338.1615831946342; Mon, 15 Mar 2021 11:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831946; cv=none; d=google.com; s=arc-20160816; b=b0G+g9D8w/bufTtnj5Fi0vxrW9oXiIVMbYIu0erssJkuSnBxjADNuxBC+ESgyP4cSi W7nfBJp2vNHPPbo/yoBkRQvtew15OnoHE2Ud+VXjZJqA5HKRA/xPPIp5bG5LaBD5M6wt BAY1x4fvZ9uLD1sAnCVhVOPz351PCYXOqeIEuJxqkaQTaZUHicmVwzM1Bh+l4Tav2xYr SW25XWCbDdRCeFA0ACk7AP3f9RcCDBpV1MvgXSnea4TR0TT0EPqL1ktNBa50bpbSpzoI ovyFzHK7z3+WL1Qd2nVwTTX9w84P/CAU6Ccg5FAJC1OQC89mVtR0QyA1e3QQ6KP0sak7 QATA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CaZkFKYTdMluGOCmjxYrLypEgwYLw9HhWfpOs+tk6i0=; b=DJfH/lJ4czU/sCMMWx7/SbLvnpkbAbNh4QMg/sHH+3xljVqK5F0Ni0eNmkqTPJIHYy I0wzNIU7JmAU9maHYxgHzyh6hx3RhPKr7trdGN7EeBQ1SFDO7jr7yCzCI1CEqhjt/a0a xUTNR33mZglJnC4ewFpaMV3AQgkpa5ftpbrrDg0gUizTOIeRqygUNq+zHctxqRA9swDi Qz1RNjeShGbSpOv6+y3W1wodx/Zk8nS7c5p02JpGQ7J91zubENrUBpHj/GY0Dy40803W 0mNsBXsRahtIavaRyAJzsFzEJ7vXBLS+PWKAGYeA3ceiLjuQwvVp0FRcnVYPECkdMjRy Otcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NZ2ZlV4j; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si11129926edz.154.2021.03.15.11.11.59; Mon, 15 Mar 2021 11:12:26 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=NZ2ZlV4j; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235933AbhCOOL7 (ORCPT + 99 others); Mon, 15 Mar 2021 10:11:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:35644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbhCON5o (ORCPT ); Mon, 15 Mar 2021 09:57:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2368064F19; Mon, 15 Mar 2021 13:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816664; bh=KyhRkJu76SQjITrL0Y+C/w9/g1Uj7Z66XJy9r1h2G1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NZ2ZlV4jatvHRMlt9zjELVbjYxgPzrr00k9XrQUDpMhKa/JHDSIsyQ45d7zS3Um7E 2dQOi03Z6zj3yof/uHI42SVzZ48i1OV6RJx9Nwt0iRZL3T8EExXK1oyfuSKbkMj6Fr 2dhxHEfv76Q3ZgQgTLvSMhpUVSU3Ugpzzb92rvIU= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Markus=20Bl=C3=B6chl?= , Vladimir Oltean , "David S. Miller" Subject: [PATCH 5.11 050/306] net: enetc: dont disable VLAN filtering in IFF_PROMISC mode Date: Mon, 15 Mar 2021 14:51:53 +0100 Message-Id: <20210315135509.342682516@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Vladimir Oltean commit a74dbce9d4541888fe0d39afe69a3a95004669b4 upstream. 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 5 ----- 1 file changed, 5 deletions(-) --- 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 { 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 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 */