From patchwork Mon Aug 12 20:04:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13760996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6FE4C52D7C for ; Mon, 12 Aug 2024 20:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2aEOu7t9R2rrRYQa/tCBbrIef976QFuVjDof5KuWorE=; b=PQ0OTQBncL2uQ6nby7ZWah4a1f XFdDJ8laCPvGQY619aEIgU9Hgj+YbHyfZBDlrlprtQaAbBHsxGrTRqVmEBvT4nOXi3GwJ2/QbOWw+ kKd+qfIXGXK1rBKkF/0iddlSZulC8UwYPFzLH31KnqzIBvZFidXQaf3PsUZIIRoWZvSZ3N5fhiImf nNTDeEKs5ghMfN+chNaKET2RpR31qOTR8tJqqNKLT/kGmzgr51qCNX6oS6gy4fYEGXpPLQR2mkVmN ocQ7Q4FA4W2WPwtH4JxgCchImV53+ZW/Za+M70xou8OP881WWGKYNbsT0UwZqetaabYHZUbZRFA92 MCWc5GPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbLK-00000001Pi0-3Mc1; Mon, 12 Aug 2024 20:08:38 +0000 Received: from out-189.mta0.migadu.com ([2001:41d0:1004:224b::bd]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbHl-00000001OeL-3tOH for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:04:59 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723493095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2aEOu7t9R2rrRYQa/tCBbrIef976QFuVjDof5KuWorE=; b=wuJ+bUQqmA1t8WZh2560Iy9mVSd4EB1b3t+TOK8Oap1ftO+/ZV+gTC9AzYJ4/FANBqyZkb +x92iV8nQkS63VrUuB47v1x3sBDsgi4bSElOHokJveG3ydfD7orarYxsP7+vGp2ftm2NM1 3RxgnjOUY2xkZu1vRqtC0zQ7dsPjKho= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Andrew Lunn , Michal Simek , Daniel Borkmann , Paolo Abeni , "David S . Miller" , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Jakub Kicinski , Ariane Keller , Sean Anderson Subject: [PATCH net-next 1/4] net: xilinx: axienet: Always disable promiscuous mode Date: Mon, 12 Aug 2024 16:04:34 -0400 Message-Id: <20240812200437.3581990-2-sean.anderson@linux.dev> In-Reply-To: <20240812200437.3581990-1-sean.anderson@linux.dev> References: <20240812200437.3581990-1-sean.anderson@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_130458_217190_5054F32A X-CRM114-Status: UNSURE ( 9.44 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If prmiscuous mode is disabled when there are fewer than four multicast addresses, then it will to be reflected in the hardware. Fix this by always clearing the promiscuous mode flag even when we program multicast addresses. Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Sean Anderson Reviewed-by: Simon Horman --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index ca04c298daa2..e664611c29cf 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -451,6 +451,10 @@ static void axienet_set_multicast_list(struct net_device *ndev) } else if (!netdev_mc_empty(ndev)) { struct netdev_hw_addr *ha; + reg = axienet_ior(lp, XAE_FMI_OFFSET); + reg &= ~XAE_FMI_PM_MASK; + axienet_iow(lp, XAE_FMI_OFFSET, reg); + i = 0; netdev_for_each_mc_addr(ha, ndev) { if (i >= XAE_MULTICAST_CAM_TABLE_NUM) From patchwork Mon Aug 12 20:04:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13760997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7A171C52D7C for ; Mon, 12 Aug 2024 20:09:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zANh4vceacIX4TWJ6+rU9HLMP5zVjL0NeNhMa3hIyN8=; b=3knfsyUTdGIBLg8J6mFRa2UyAM aexxdmr9LZmQCwbA6LMkHvWhk/7k0VIJCCgZVg6MVLmR5lW25sx9UH6kW8vmtIQViOWKEAiUJ9V/5 /hNn4F4YL42F5PwclJAjse3B02D1LxDOVYgYFq3a1VPMHAnX5RyqTUnPHrt1EZfTMLUkN6nuxD+TF 7XlLyeqK/sRwhGutl5G47Wejq7zg1QqNLVR/sPWJ9pVd15LwHMx7fqrxDR1ppaZyP4LT6lmxbeQXw sRxOhh7r5tFys9pwY0oz/hNNlXtltB6fOHuA9VA14qoH1icoJe73YEhossK+iwOuJ6avdxpq47UlX rdcBqISA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbLt-00000001PrN-1sC3; Mon, 12 Aug 2024 20:09:13 +0000 Received: from out-181.mta0.migadu.com ([2001:41d0:1004:224b::b5]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbHo-00000001Oez-0s8f for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:05:01 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723493097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zANh4vceacIX4TWJ6+rU9HLMP5zVjL0NeNhMa3hIyN8=; b=hs+PySwPtDmxd9V49Zz3wqM8t8s2mSoqgcy6QyaqFkIgoAFHdVnu1Mh74PGNRMcpabgSPE /RPJMnX/CbQo4L/80awF/xK+j3/pCUdHs/5j8VbAubieKC0z0FaiN4NXIOK86OegJjrC6F 0vmDkIf7M4v2v+M8Q/AzA5Um1HmvWT0= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Andrew Lunn , Michal Simek , Daniel Borkmann , Paolo Abeni , "David S . Miller" , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Jakub Kicinski , Ariane Keller , Sean Anderson Subject: [PATCH net-next 2/4] net: xilinx: axienet: Fix dangling multicast addresses Date: Mon, 12 Aug 2024 16:04:35 -0400 Message-Id: <20240812200437.3581990-3-sean.anderson@linux.dev> In-Reply-To: <20240812200437.3581990-1-sean.anderson@linux.dev> References: <20240812200437.3581990-1-sean.anderson@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_130500_412512_50AF3D24 X-CRM114-Status: GOOD ( 12.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If a multicast address is removed but there are still some multicast addresses, that address would remain programmed into the frame filter. Fix this by explicitly setting the enable bit for each filter. Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Sean Anderson Reviewed-by: Simon Horman --- drivers/net/ethernet/xilinx/xilinx_axienet.h | 1 + .../net/ethernet/xilinx/xilinx_axienet_main.c | 21 ++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index 0d5b300107e0..03fef656478e 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -170,6 +170,7 @@ #define XAE_UAW0_OFFSET 0x00000700 /* Unicast address word 0 */ #define XAE_UAW1_OFFSET 0x00000704 /* Unicast address word 1 */ #define XAE_FMI_OFFSET 0x00000708 /* Filter Mask Index */ +#define XAE_FFE_OFFSET 0x0000070C /* Frame Filter Enable */ #define XAE_AF0_OFFSET 0x00000710 /* Address Filter 0 */ #define XAE_AF1_OFFSET 0x00000714 /* Address Filter 1 */ diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index e664611c29cf..1bcabb016ca9 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -433,7 +433,7 @@ static int netdev_set_mac_address(struct net_device *ndev, void *p) */ static void axienet_set_multicast_list(struct net_device *ndev) { - int i; + int i = 0; u32 reg, af0reg, af1reg; struct axienet_local *lp = netdev_priv(ndev); @@ -455,7 +455,6 @@ static void axienet_set_multicast_list(struct net_device *ndev) reg &= ~XAE_FMI_PM_MASK; axienet_iow(lp, XAE_FMI_OFFSET, reg); - i = 0; netdev_for_each_mc_addr(ha, ndev) { if (i >= XAE_MULTICAST_CAM_TABLE_NUM) break; @@ -474,6 +473,7 @@ static void axienet_set_multicast_list(struct net_device *ndev) axienet_iow(lp, XAE_FMI_OFFSET, reg); axienet_iow(lp, XAE_AF0_OFFSET, af0reg); axienet_iow(lp, XAE_AF1_OFFSET, af1reg); + axienet_iow(lp, XAE_FFE_OFFSET, 1); i++; } } else { @@ -481,18 +481,15 @@ static void axienet_set_multicast_list(struct net_device *ndev) reg &= ~XAE_FMI_PM_MASK; axienet_iow(lp, XAE_FMI_OFFSET, reg); - - for (i = 0; i < XAE_MULTICAST_CAM_TABLE_NUM; i++) { - reg = axienet_ior(lp, XAE_FMI_OFFSET) & 0xFFFFFF00; - reg |= i; - - axienet_iow(lp, XAE_FMI_OFFSET, reg); - axienet_iow(lp, XAE_AF0_OFFSET, 0); - axienet_iow(lp, XAE_AF1_OFFSET, 0); - } - dev_info(&ndev->dev, "Promiscuous mode disabled.\n"); } + + for (; i < XAE_MULTICAST_CAM_TABLE_NUM; i++) { + reg = axienet_ior(lp, XAE_FMI_OFFSET) & 0xFFFFFF00; + reg |= i; + axienet_iow(lp, XAE_FMI_OFFSET, reg); + axienet_iow(lp, XAE_FFE_OFFSET, 0); + } } /** From patchwork Mon Aug 12 20:04:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13760998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94E18C52D7C for ; Mon, 12 Aug 2024 20:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NN9ohrWDzAKh5ND5oSSWFgfVnLGZgDo0j5pkupfMzYI=; b=C/rA1C77QOcFsfa3yx9TRf6d03 n0VVB8zCrkclpmEJcM24VeoTV9tfjtFtg7WB5DTvDrqLhUkjq+LJVTpEb/9WcgFye0CPP8AHAq1gm /BEZhu/AE6rI6Kx4y7hFc0W+dfUnDB59nSJZarOOUsV2d5AWQ1+DRdIpIsNds387XF6nVRxn/c+Nh oiRYS7rE2fv5bUyXZ0nqc7ntncJKS7s40e3V8XlmbiO5zbYvV4AjSLfy7SFuJlf11hciI6t7oZu0N KhS84znYJRG+tVRzYt0UJ1AUfaodyeDYig25rqbP5xMqCpkv8LD3iAKJaZmdt1RKI7AudY6KJnDa7 51CMdG/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbMS-00000001Pz8-2NdF; Mon, 12 Aug 2024 20:09:48 +0000 Received: from out-179.mta0.migadu.com ([91.218.175.179]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbHp-00000001OfT-3nO9 for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:05:04 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723493099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NN9ohrWDzAKh5ND5oSSWFgfVnLGZgDo0j5pkupfMzYI=; b=fSR5TP+G+9NhbxgRPp1WjkDzeBcETQMBkXkUaIiEp0R2hoLUpJzv/znbINWUcT5pBZMyIZ 9ZlfjPIU8fVhxweLrdlVaQhB9hBRPSgXZYYu3V5QFQ94d1yb225JEOz7KAj0luo6Pdg5Wu 3lnG9fwbW5iuNz6FcRX9ITtCaNqf0fU= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Andrew Lunn , Michal Simek , Daniel Borkmann , Paolo Abeni , "David S . Miller" , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Jakub Kicinski , Ariane Keller , Sean Anderson Subject: [PATCH net-next 3/4] net: xilinx: axienet: Don't print if we go into promiscuous mode Date: Mon, 12 Aug 2024 16:04:36 -0400 Message-Id: <20240812200437.3581990-4-sean.anderson@linux.dev> In-Reply-To: <20240812200437.3581990-1-sean.anderson@linux.dev> References: <20240812200437.3581990-1-sean.anderson@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_130502_534044_DF5CB269 X-CRM114-Status: GOOD ( 11.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A message about being in promiscuous mode is printed every time each additional multicast address beyond four is added. Suppress this message like is done in other drivers. And don't set IFF_PROMISC in ndev->flags; contrary to the comment we don't have to inform the net subsystem. Signed-off-by: Sean Anderson --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 1bcabb016ca9..9bcad515f156 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -439,15 +439,9 @@ static void axienet_set_multicast_list(struct net_device *ndev) if (ndev->flags & (IFF_ALLMULTI | IFF_PROMISC) || netdev_mc_count(ndev) > XAE_MULTICAST_CAM_TABLE_NUM) { - /* We must make the kernel realize we had to move into - * promiscuous mode. If it was a promiscuous mode request - * the flag is already set. If not we set it. - */ - ndev->flags |= IFF_PROMISC; reg = axienet_ior(lp, XAE_FMI_OFFSET); reg |= XAE_FMI_PM_MASK; axienet_iow(lp, XAE_FMI_OFFSET, reg); - dev_info(&ndev->dev, "Promiscuous mode enabled.\n"); } else if (!netdev_mc_empty(ndev)) { struct netdev_hw_addr *ha; @@ -481,7 +475,6 @@ static void axienet_set_multicast_list(struct net_device *ndev) reg &= ~XAE_FMI_PM_MASK; axienet_iow(lp, XAE_FMI_OFFSET, reg); - dev_info(&ndev->dev, "Promiscuous mode disabled.\n"); } for (; i < XAE_MULTICAST_CAM_TABLE_NUM; i++) { From patchwork Mon Aug 12 20:04:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13760999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFC39C3DA7F for ; Mon, 12 Aug 2024 20:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gz6kqBszY+cseMf7LyOPT5w873d07nAeofNso5US4fw=; b=BRwTPxgqGkWHhQPm66nKolwkMY dsGgmtVXjuD+f9bnjLTZlPJGSegh9R1DeXOpcjrSsrfhNcpQBjo4/LYCYl3kTU2JZ9A/i2HcvWbqZ ye2e2uA79fXlJWeAST2o3PlmG+jXGEs8ZcvpRWSUv1iO9mpDlVwcYWyV13raVcCujSx/8GEDtM2y2 vLwhJxdwsQvONtrlzgqL9/ac2ZD0miHBaGe2yyTHJny7n/KjaBBJH88x36fB5Tyg327zx2cBDLoF9 TDY+Df8EE7LtZ1CLjyQX6EUwGYOJMil7aMlzgslMMEDY0Z3EecMF69gkxqDef8rNNvk9fwcoLGFK7 ZcQlBSDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbN0-00000001Q5b-28fo; Mon, 12 Aug 2024 20:10:22 +0000 Received: from out-185.mta0.migadu.com ([91.218.175.185]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbHs-00000001Ofw-1w2B for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:05:06 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723493101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gz6kqBszY+cseMf7LyOPT5w873d07nAeofNso5US4fw=; b=lIMEF2ayO7W2cR/Lxrhhj9s8kZlnYgs1QD5e+qUPU5IuLIeUw/r5oOA4RFYJPJa5ll3sYg 4hWTZ/12ZwIxGpE4YGdA7LSh4FxP0JCKamxcyO+qUzAcUse1IW9ScUFVZYJvSPqaAkc0Wm pm2cU6LiM7GtN+BF4+aAhYBlwVuATPY= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Andrew Lunn , Michal Simek , Daniel Borkmann , Paolo Abeni , "David S . Miller" , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Jakub Kicinski , Ariane Keller , Sean Anderson Subject: [PATCH net-next 4/4] net: xilinx: axienet: Support IFF_ALLMULTI Date: Mon, 12 Aug 2024 16:04:37 -0400 Message-Id: <20240812200437.3581990-5-sean.anderson@linux.dev> In-Reply-To: <20240812200437.3581990-1-sean.anderson@linux.dev> References: <20240812200437.3581990-1-sean.anderson@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_130504_674676_FCC7C1FB X-CRM114-Status: GOOD ( 13.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for IFF_ALLMULTI by configuring a single filter to match the multicast address bit. This allows us to keep promiscuous mode disabled, even when we have more than four multicast addresses. An even better solution would be to "pack" addresses into the available CAM registers, but that can wait for a future series. Signed-off-by: Sean Anderson Reviewed-by: Simon Horman --- drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 ++ .../net/ethernet/xilinx/xilinx_axienet_main.c | 34 +++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index 03fef656478e..d1b68a040f5a 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -173,6 +173,8 @@ #define XAE_FFE_OFFSET 0x0000070C /* Frame Filter Enable */ #define XAE_AF0_OFFSET 0x00000710 /* Address Filter 0 */ #define XAE_AF1_OFFSET 0x00000714 /* Address Filter 1 */ +#define XAE_AM0_OFFSET 0x00000750 /* Frame Filter Mask Value Bytes 3-0 */ +#define XAE_AM1_OFFSET 0x00000754 /* Frame Filter Mask Value Bytes 7-4 */ #define XAE_TX_VLAN_DATA_OFFSET 0x00004000 /* TX VLAN data table address */ #define XAE_RX_VLAN_DATA_OFFSET 0x00008000 /* RX VLAN data table address */ diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 9bcad515f156..c420bc753750 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -437,18 +437,27 @@ static void axienet_set_multicast_list(struct net_device *ndev) u32 reg, af0reg, af1reg; struct axienet_local *lp = netdev_priv(ndev); - if (ndev->flags & (IFF_ALLMULTI | IFF_PROMISC) || - netdev_mc_count(ndev) > XAE_MULTICAST_CAM_TABLE_NUM) { - reg = axienet_ior(lp, XAE_FMI_OFFSET); + reg = axienet_ior(lp, XAE_FMI_OFFSET); + reg &= ~XAE_FMI_PM_MASK; + if (ndev->flags & IFF_PROMISC) reg |= XAE_FMI_PM_MASK; + else + reg &= ~XAE_FMI_PM_MASK; + axienet_iow(lp, XAE_FMI_OFFSET, reg); + + if (ndev->flags & IFF_ALLMULTI || + netdev_mc_count(ndev) > XAE_MULTICAST_CAM_TABLE_NUM) { + reg &= 0xFFFFFF00; axienet_iow(lp, XAE_FMI_OFFSET, reg); + axienet_iow(lp, XAE_AF0_OFFSET, 1); /* Multicast bit */ + axienet_iow(lp, XAE_AF1_OFFSET, 0); + axienet_iow(lp, XAE_AM0_OFFSET, 1); /* ditto */ + axienet_iow(lp, XAE_AM1_OFFSET, 0); + axienet_iow(lp, XAE_FFE_OFFSET, 1); + i = 1; } else if (!netdev_mc_empty(ndev)) { struct netdev_hw_addr *ha; - reg = axienet_ior(lp, XAE_FMI_OFFSET); - reg &= ~XAE_FMI_PM_MASK; - axienet_iow(lp, XAE_FMI_OFFSET, reg); - netdev_for_each_mc_addr(ha, ndev) { if (i >= XAE_MULTICAST_CAM_TABLE_NUM) break; @@ -461,24 +470,21 @@ static void axienet_set_multicast_list(struct net_device *ndev) af1reg = (ha->addr[4]); af1reg |= (ha->addr[5] << 8); - reg = axienet_ior(lp, XAE_FMI_OFFSET) & 0xFFFFFF00; + reg &= 0xFFFFFF00; reg |= i; axienet_iow(lp, XAE_FMI_OFFSET, reg); axienet_iow(lp, XAE_AF0_OFFSET, af0reg); axienet_iow(lp, XAE_AF1_OFFSET, af1reg); + axienet_iow(lp, XAE_AM0_OFFSET, 0xffffffff); + axienet_iow(lp, XAE_AM1_OFFSET, 0x0000ffff); axienet_iow(lp, XAE_FFE_OFFSET, 1); i++; } - } else { - reg = axienet_ior(lp, XAE_FMI_OFFSET); - reg &= ~XAE_FMI_PM_MASK; - - axienet_iow(lp, XAE_FMI_OFFSET, reg); } for (; i < XAE_MULTICAST_CAM_TABLE_NUM; i++) { - reg = axienet_ior(lp, XAE_FMI_OFFSET) & 0xFFFFFF00; + reg &= 0xFFFFFF00; reg |= i; axienet_iow(lp, XAE_FMI_OFFSET, reg); axienet_iow(lp, XAE_FFE_OFFSET, 0);