From patchwork Thu Aug 22 15:40:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13773793 X-Patchwork-Delegate: kuba@kernel.org Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C68621CB33B for ; Thu, 22 Aug 2024 15:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341286; cv=none; b=PSFAKqlh8/4DPR61fjU4SYxlxAL3MzccUPeaCS9LU2hPdLlYzkHNQo1ychaQ4IFXtiAqQNIYtuwVAIBY6cx4R1wpmkR+k+MlLXBkb8gwIMpgSoBK5u1rxeGXj7ICnJuPoxCG2btbInlN/Epr+6TgKNnT9BQZtFZcF6ah1LVKSEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341286; c=relaxed/simple; bh=dzCXGaFReauwOK1YthHIV8ZrILBfMiz1n2GhKtNfezI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MmOUTjCIrBI5oGY8Bdxl+j1OElQEw34IbvI6O0eltXMWstqyokMdhE755VjV5/E9eSXyUYJh7X+bu0ecb3T95umCmKhPihtLFA9c6NocCNQEVQfOrm/RW1HqvK6qXYy1Il1kyqxykZW3uCPy9ICiulwa0Ir89sk3eXs0KokE8Do= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=cpyg94nP; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="cpyg94nP" 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=1724341281; 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=Swnhdbla4FFcBOXmANTpBJTCNvMqxhSTYkB1DquWAZQ=; b=cpyg94nPbPW0BA/TdsKmBx18YBoIKViU7/9NMB3UYey6CtoMEuaGQDwVLvUh9m0HxAO8AI wuGOcUveW/Eagx467n269MXAx0AaGreqPRVEqqsuHii626gpcyPSanI6Q23r51ZPY0NkCW Uqr7jiRPYzDNXwRbL8mASrDqjKjIC6k= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Eric Dumazet , Michal Simek , Andrew Lunn , Daniel Borkmann , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Paolo Abeni , Sean Anderson , Simon Horman Subject: [PATCH net-next v3 1/5] net: xilinx: axienet: Always disable promiscuous mode Date: Thu, 22 Aug 2024 11:40:55 -0400 Message-Id: <20240822154059.1066595-2-sean.anderson@linux.dev> In-Reply-To: <20240822154059.1066595-1-sean.anderson@linux.dev> References: <20240822154059.1066595-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Patchwork-Delegate: kuba@kernel.org If promiscuous mode is disabled when there are fewer than four multicast addresses, then it will not 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 --- (no changes since v1) 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 38f7b764fe66..6fad473a937b 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 Thu Aug 22 15:40:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13773795 X-Patchwork-Delegate: kuba@kernel.org Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E25491CCB23 for ; Thu, 22 Aug 2024 15:41:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341288; cv=none; b=dGIJqGSNmk+EXEs4Cr9EcM4c5kjBQTVJbhlxzrmIab8sgkkfXCk6i5/dLTyf4Wwbfor0whTKmfsiY0bKFESZ6Ou0bDlHYybNIWn5kzSWM0O0KCeygi97c/84VkM5BQit7kXdRWunGGNoyEgfcPZwEiAJMapKgUawXzfAQC6fQk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341288; c=relaxed/simple; bh=ohfgIxeTRkOynqIzCgEfaM2k2evnvYdBi/1XB5KwvYk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pymaIduo0s1du4A8IS7TmaJjIgfrbR+KLwbR5plpMscoubFfWCt/x8CcAFDC/ZNGLyveGp1u3dyWWAT4WXPI91JZEK9hw+OSBGuabVpoDH4vlkDMaIdohLG0UBCWeb6eWSumXPCgVPg/raFcqZ44l1zICHejwyhAQmgtQTl4KzM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=wpbdy4IR; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="wpbdy4IR" 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=1724341284; 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=K3Ul9dr4s0FV4zx4bC150nxiBfsOJmq4YQc7DzBJrag=; b=wpbdy4IRMQLwHZGkL61ND+PvbrxOcqyS662/tmiXVD+QeQB39rXooWX7QebrpvPnFoWHi/ yiw1SofstlxTF0MYmi6eS+LZDdZfu3AxARN6rLTAUcUUNrqaUsRzSV20vEGLd9KWiSNrQB g7xWp8fFeZUZHXs9WL+9HqCYzLHJOcw= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Eric Dumazet , Michal Simek , Andrew Lunn , Daniel Borkmann , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Paolo Abeni , Sean Anderson , Simon Horman Subject: [PATCH net-next v3 2/5] net: xilinx: axienet: Fix dangling multicast addresses Date: Thu, 22 Aug 2024 11:40:56 -0400 Message-Id: <20240822154059.1066595-3-sean.anderson@linux.dev> In-Reply-To: <20240822154059.1066595-1-sean.anderson@linux.dev> References: <20240822154059.1066595-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Patchwork-Delegate: kuba@kernel.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 --- (no changes since v1) 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 8165f5f271ff..5a7d6b872f5d 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -172,6 +172,7 @@ #define XAE_UAW0_OFFSET 0x00000700 /* Unicast address word 0 */ #define XAE_UAW1_OFFSET 0x00000704 /* Unicast address word 1 */ #define XAE_FMI_OFFSET 0x00000708 /* Frame Filter Control */ +#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 6fad473a937b..88ff82c52d0c 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 Thu Aug 22 15:40:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13773796 X-Patchwork-Delegate: kuba@kernel.org Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E44B1CCB36 for ; Thu, 22 Aug 2024 15:41:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341289; cv=none; b=EHBKwaMlr7A/lMZFvnTfIFg/QvZeDpu+4DWTgQbS+wsA/lnxbR2EXWbw1Dsl+PYGJebhPdnc38pbe0Y+Barv22lfPNvee1Orb5d7vAIfLfkqRxgJgYgSJ26310ZvWiSSjSnt7/yGreWRfaVf7V/E1b1IiTx1hF4OS4Ow5KSvWSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341289; c=relaxed/simple; bh=Ze4hmZ31kbNNIFYUn/vNQZ3JN5wL90sfLeN9bE2VJkY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=prrsFK8PCOxVySHo1+vzJlRed12xk6592upny2xRkHkMIAe0zoPdB9NZCjl2GND0DKrGAOfkZ6HtO//czMrO8glXZYJcZZWDRkXkn19u4VDmYUgjLLZwqt2M/JYu4Lt0+A4n137Wwf3tP/ZaQ49jVriMLV/UbouO/JUS7VV6ws4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dnNEq5Mu; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dnNEq5Mu" 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=1724341286; 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=WrVWUSGAi65g2KGYwS084DcxvQZ1Z3a88yLyeu+WdHE=; b=dnNEq5MubHTWTpg/iJjWqZPAMYW39Bt1K0dhA+YrbCeve7VJX6nTkj8fSpMLA6QTJ7CUPm XlUcnYOihpkJAU5iFQ5z3670De/TpykOAzYrFH5KKmcdFhhueyIhvD7bpQ85gXo4yYCmhn pGKMQ3KrTKdZXMQgmEM3V+Eohi+iqTs= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Eric Dumazet , Michal Simek , Andrew Lunn , Daniel Borkmann , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Paolo Abeni , Sean Anderson , Simon Horman Subject: [PATCH net-next v3 3/5] net: xilinx: axienet: Don't print if we go into promiscuous mode Date: Thu, 22 Aug 2024 11:40:57 -0400 Message-Id: <20240822154059.1066595-4-sean.anderson@linux.dev> In-Reply-To: <20240822154059.1066595-1-sean.anderson@linux.dev> References: <20240822154059.1066595-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Patchwork-Delegate: kuba@kernel.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. Signed-off-by: Sean Anderson Reviewed-by: Simon Horman --- (no changes since v2) Changes in v2: - Split off IFF_PROMISC change drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 88ff82c52d0c..f612adb07a25 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -447,7 +447,6 @@ static void axienet_set_multicast_list(struct net_device *ndev) 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 +480,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 Thu Aug 22 15:40:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13773797 X-Patchwork-Delegate: kuba@kernel.org Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF2731CDA23 for ; Thu, 22 Aug 2024 15:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341291; cv=none; b=DVTX38dopjioVTcMBhBKq/kEnzXP93OHIFlSgg2Dz4k7m48CURUSHkgCnAKO6o98eWdsVJt6hzDmO7AwLgf4hv9Grhkz7SWKx1Ecf0ZlkoI05KpSo5W/LHm+JpxKb6rnH8Y/023eHn6TsKP8mH90tUAz0UUype5HdR9TtjD3CCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341291; c=relaxed/simple; bh=t7Xgw5NCVuK76Fz/E17ZKV8gj8CWvvXKXFCDS1nYvac=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E8usjzNyIb+Q0bPTh3YSVW3UIo4H2GGY4r3ka//OmW/YkDudc6pRHDE8Ui+1cI1HCuxrK3yP7o1MivjWP77HOLItDKBxDyiin+tAVhwH4WCAUl1hJDx1T1Qx/FGf1B2abGVXaqiW1PZ73Y1Ynmog4REt/UVHWXyeRUqOZ0ulTV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=r2dEk7DT; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="r2dEk7DT" 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=1724341288; 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=4y1OuMckJ3uTXKaUmgng1b/Utw2qqR8UebmEH8zDxio=; b=r2dEk7DTgH7boJ7IQiCxQoBkZAH+lrVePjlZ84P9uN3Ysm+E/uTV3k3oxbBgEuowf0kfjj XhQbKSi8twLwFkTKlwJNzyQxIH+4EKOkgGqmuYeUTFZkGkq44j85L4BSjgnLzrSzF9lg5z aHvICp3mzETUCdpzutJGWQsR1zvlKV8= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Eric Dumazet , Michal Simek , Andrew Lunn , Daniel Borkmann , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Paolo Abeni , Sean Anderson , Simon Horman Subject: [PATCH net-next v3 4/5] net: xilinx: axienet: Don't set IFF_PROMISC in ndev->flags Date: Thu, 22 Aug 2024 11:40:58 -0400 Message-Id: <20240822154059.1066595-5-sean.anderson@linux.dev> In-Reply-To: <20240822154059.1066595-1-sean.anderson@linux.dev> References: <20240822154059.1066595-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Patchwork-Delegate: kuba@kernel.org Contrary to the comment, we don't have to inform the net subsystem. Signed-off-by: Sean Anderson Reviewed-by: Simon Horman --- (no changes since v2) Changes in v2: - Split off from printing changes drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index f612adb07a25..5c4a5949a021 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -439,11 +439,6 @@ 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); From patchwork Thu Aug 22 15:40:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13773798 X-Patchwork-Delegate: kuba@kernel.org Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAB101CDFD6 for ; Thu, 22 Aug 2024 15:41:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341294; cv=none; b=T5iFWHm3C7cUQq1vkRuDD0020DEcRlOVJOvYO6v5zuqAQ+t51horaQrOIl8gkHSmyrU4IAipfAQ+I1O8u6dyibeVZSGEOuvEUY6pdlFG/4C2daUBSKDVA7s1BKuMeYrtpClsxMTBIWLQpzoVUCiAIxaMUqtRDNzJ7PfDMVCJjYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724341294; c=relaxed/simple; bh=8/XFPh25xGSUZ1P8YK1SABWsinsK0clgjIwNTRAEvUY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SwnAixh5F/u7rHpeLk5wZWIhPTE2WJC5gObKNMVe7C+h0wj1kQf2WVAjUzQBg2Fj43fJMMaInXrv/YKrPNfBrmGShTSpZ1OgAE3ExVewj/rdiACX9nffZE3bxtC4sL4y/CmQm15CcTw6kG0MyZ6tST3rXZ+6ipfl1oW7wIQOr5M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=xrOW7BOI; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="xrOW7BOI" 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=1724341290; 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=6XRAKJklo9vBktdRNWOH6AnRZImaO00oA0lmHQ28GKY=; b=xrOW7BOICT3ZrLBwTKvk8/GDpheqAjKRKpfd4DQuOyY/9hRd4HODr+fhUFtTcfofIiPOBe 6HRXugEyX/D8XI3SC0FjP4pPcGOS3/hNyA5GKzGKaKomNbOVHQCVJCmGK3Bb5HoTFWg54e IRFuzu8h4XY7bmXzoVyxqoxFqbakPM8= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Eric Dumazet , Michal Simek , Andrew Lunn , Daniel Borkmann , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Paolo Abeni , Sean Anderson , Simon Horman Subject: [PATCH net-next v3 5/5] net: xilinx: axienet: Support IFF_ALLMULTI Date: Thu, 22 Aug 2024 11:40:59 -0400 Message-Id: <20240822154059.1066595-6-sean.anderson@linux.dev> In-Reply-To: <20240822154059.1066595-1-sean.anderson@linux.dev> References: <20240822154059.1066595-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Patchwork-Delegate: kuba@kernel.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 --- (no changes since v1) 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 5a7d6b872f5d..c301dd2ee083 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -175,6 +175,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 5c4a5949a021..fe6a0e2e463f 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);