From patchwork Thu Aug 15 19:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13765097 X-Patchwork-Delegate: kuba@kernel.org Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 B1CF013AD11 for ; Thu, 15 Aug 2024 19:36:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750590; cv=none; b=i3v/Zt5rLArObn2j4nNS1DGKgl8Ecwbpyvc+gkgIfyqg/uHn2ycWrpSqnig4BWiC+GGjAgZYAChjDp7z/az4zpkyOOO9Weo3FEkdycSrIe348mQ8bScIWVziEyh3HQx2sO+cBBatVBTzH2x8hNQaW55mtlhPmEtSLplIfwsGW3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750590; c=relaxed/simple; bh=Skx/W98s0OlT3RwKTPnsB4maHdk8wwKmbbaMdIKJlQU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HOqNwGWs0a4U2BNK5M6gYacGJOg+icLSaXajO1948IIPqk3yYb073tvo6SU/vuUu+yn/rPg5Y5Uzk7/QpOA4bL8YWV771sD4vxyRyvLmU1LS8O+jYsxRrOYObtgiO5budICrMOHOlCCr+fZ3gCe3VDKwhQR92N2YGAgMN+NQZ6Y= 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=hxhnZvhQ; arc=none smtp.client-ip=91.218.175.181 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="hxhnZvhQ" 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=1723750586; 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=mS/XIHwO7Vk4ocj6oR1f4FPm+sxNBxQSiDNNRlZ+GRw=; b=hxhnZvhQUOPTc6d8r1wrCKAE7xhQHxRrW0CiCGtj7PcJ1MXdf59voT/FRZxv2qw7GnBnpB VXSapOfCL5BPff04QtlRnXfjWOxmj/JeBmaV8pvKwMQvkV+3pkXlMDKcfXIPiswVcyRUEe PYCHzE2jo5pApx81G9SaOdVxK61u5+Y= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: "David S . Miller" , Andrew Lunn , linux-arm-kernel@lists.infradead.org, Michal Simek , Daniel Borkmann , linux-kernel@vger.kernel.org, Paolo Abeni , Jakub Kicinski , Eric Dumazet , Sean Anderson , Simon Horman Subject: [PATCH net-next v2 1/5] net: xilinx: axienet: Always disable promiscuous mode Date: Thu, 15 Aug 2024 15:36:10 -0400 Message-Id: <20240815193614.4120810-2-sean.anderson@linux.dev> In-Reply-To: <20240815193614.4120810-1-sean.anderson@linux.dev> References: <20240815193614.4120810-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 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 --- (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 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 Thu Aug 15 19:36:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13765098 X-Patchwork-Delegate: kuba@kernel.org Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) (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 D6C0D145A10 for ; Thu, 15 Aug 2024 19:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750592; cv=none; b=Fj48DUZy7lA2Mo9D1lQz2LAGxNCBlP5TitFwhgs53TYuEOojiaPvavftkKmYVlOwbNqGoyM+cyevhE0jFsCTimFZBOpsKlI3VR6MFnHtTTW4p0RByN2EBQ6unneZtubndEYp7Q3zdnSYYUdodr7DJPQtUI/+yplGwAj6Cr+EQ2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750592; c=relaxed/simple; bh=bTCi7cnH1cvvK2PYzZ6S6D9oZQPDQWAJyHaT/CPlCA8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ylfq8LcSV9VTYIf5k3Vo0nDyvxaPViOgEjsPCpIn0MYfcxa3+DKgfZweuRKzfhbLaYr09gTaiiAvBjca9Rpsu/o6WOx0bstSoMv35YE1GL5E8eEDxgcIS3rr/U5bBzPCdZgqf9EL/UW58goQdLpgmFh5cNCJ8sNInrUJgVXVm4g= 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=dtu1fPm8; arc=none smtp.client-ip=91.218.175.175 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="dtu1fPm8" 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=1723750589; 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=PQ92oWIueYKK0WqbwoFJR3Rcuxeb2Zle0vhVb2VuYC0=; b=dtu1fPm838Pmg8KgMldJf2Zb+Kds1mkWDWgfPAQgxOmo1MXDAM3py5ywOxgD3s34GZOSey BeVHeq2o55rsVqTb+96cCtgp0sY0kiJxYjYbCBlGvAf6UND8sJYderp5LaS1QjIKD5oV1d 1FynfjIwG6u7I5Sqa62BCWK0Rs0JElM= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: "David S . Miller" , Andrew Lunn , linux-arm-kernel@lists.infradead.org, Michal Simek , Daniel Borkmann , linux-kernel@vger.kernel.org, Paolo Abeni , Jakub Kicinski , Eric Dumazet , Sean Anderson , Simon Horman Subject: [PATCH net-next v2 2/5] net: xilinx: axienet: Fix dangling multicast addresses Date: Thu, 15 Aug 2024 15:36:11 -0400 Message-Id: <20240815193614.4120810-3-sean.anderson@linux.dev> In-Reply-To: <20240815193614.4120810-1-sean.anderson@linux.dev> References: <20240815193614.4120810-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 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 Thu Aug 15 19:36:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13765099 X-Patchwork-Delegate: kuba@kernel.org Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 E00C4149E0B; Thu, 15 Aug 2024 19:36:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750594; cv=none; b=F2fEbxlTfysyl0mraVdi36Lrfr7euzA7vCbK+PIbMJi4uYTYTRk3vhayqS/4a6dtPBnP3+q6wuwReXrEszAMACB3nbdeuw5MCEIqwg1NgSUkIB26hHXk4q6gtyFNj1OY1tL7MDe0phV+opQaDzOkDu0ha76PBBfjSAGjcipSdnc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750594; c=relaxed/simple; bh=XPaWYO6owNRbtDyquLZp/UZeQgBynT+pRI3oW7gXEcQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q44389exxJzpXeUCgO5EifIa2CX+ASoW+pJ1EnU9IbdBATcLecOanpPJdoJNvihXR46oNPTdq47pM3Pzjzw1Ku06Aev5JPJzJKy7J3SFekcW6TOm97PEMZES06kkavDtOzDeX8zE9dVE7ouekhE91UIdnPVqypxl9LLRKAlYvho= 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=QFnW878S; arc=none smtp.client-ip=91.218.175.182 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="QFnW878S" 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=1723750591; 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=R6Pbw/gYocam4sHjqG9NKdaOppoUOzZ4RTkpagayTFk=; b=QFnW878SNScRGr/LBVWBwF7PYlcMlJEOQpa3vCVSVbT53mLoUhOjz7tLU0yTOl3qWHJXWZ kLsNxvOEVDwD36UxRr27lmGxFj6dROh3R81AL22hQTP9m1w3QgZ6ok+oz66sHroYDmOVN+ 8ygHBHdMJIuxOm1ucNrhEnSPmGsZCc4= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: "David S . Miller" , Andrew Lunn , linux-arm-kernel@lists.infradead.org, Michal Simek , Daniel Borkmann , linux-kernel@vger.kernel.org, Paolo Abeni , Jakub Kicinski , Eric Dumazet , Sean Anderson Subject: [PATCH net-next v2 3/5] net: xilinx: axienet: Don't print if we go into promiscuous mode Date: Thu, 15 Aug 2024 15:36:12 -0400 Message-Id: <20240815193614.4120810-4-sean.anderson@linux.dev> In-Reply-To: <20240815193614.4120810-1-sean.anderson@linux.dev> References: <20240815193614.4120810-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 --- 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 1bcabb016ca9..9382ce50aeb2 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 15 19:36:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13765100 X-Patchwork-Delegate: kuba@kernel.org Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (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 ED14114B97E for ; Thu, 15 Aug 2024 19:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750596; cv=none; b=hCQatpt5zMwSL4HirYF14W+ipZ1JIzuiHlJSh4dkpqmWCCpqBOsBjWDrdmcgap3LZRgbw9omZlH9iAAvWXJYVLBIzkCByOHGk6YmTVLNXH7i3xDliUFPCgm1B8TpLDkAZwzN9bEiEBisT9/jeyOxkDp+2Q9ZdG3B7TZMCOh2jJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750596; c=relaxed/simple; bh=ohkkFUnqbh4Vd2LZ82fswrcHzKTNgmRmp+nkzLCog44=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Vm6FUENgaK+748HSsqkR/wLzXM4rPRNPQaXJmYBR+XY4pWRFk+ZHyjPw+e1cmqPYgO0624e8NHApmjndS64u049fe0LhlHrOGND9jcb/+wOhcr3OwcyHvbENFeq0PjkRr9GxSf1TtgCiGPVsViSAUkMCBHMZHPsEXeiX0cjmQbE= 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=KrhOF7ys; arc=none smtp.client-ip=91.218.175.180 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="KrhOF7ys" 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=1723750593; 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=pOE+kJnrM8Z+EXIGAGr3PIq2L8K9D/ZSsUhQaL+mhn8=; b=KrhOF7ysLNWCz24ekEIv4aNhHCNrSGD16ra/3Rw9ygb13p6se8RBZgQpZmoZAaJPSkOLuY 7iXPp4uR7Gj84hvlSAqgF0fsOWr9Yx893woeXqFJquZmjQ1x6ggP/iekfbToGA4Gln7brb oObjb81uOda6z2t0gusYdINxe5FFVNA= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: "David S . Miller" , Andrew Lunn , linux-arm-kernel@lists.infradead.org, Michal Simek , Daniel Borkmann , linux-kernel@vger.kernel.org, Paolo Abeni , Jakub Kicinski , Eric Dumazet , Sean Anderson Subject: [PATCH net-next v2 4/5] net: xilinx: axienet: Don't set IFF_PROMISC in ndev->flags Date: Thu, 15 Aug 2024 15:36:13 -0400 Message-Id: <20240815193614.4120810-5-sean.anderson@linux.dev> In-Reply-To: <20240815193614.4120810-1-sean.anderson@linux.dev> References: <20240815193614.4120810-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 --- 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 9382ce50aeb2..9bcad515f156 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 15 19:36:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13765101 X-Patchwork-Delegate: kuba@kernel.org Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 1134C14EC51 for ; Thu, 15 Aug 2024 19:36:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750598; cv=none; b=jb8ZRp7mWRwKtZdJr8+PM3BaCpnprtJ8MsZWmbLps8K36Dww7/6Eaml9MmfzIIIIfzQhKUdORhzxjaV46oczHHxTeiQY1+6tFC7sQ92fYQyzf5X2ThLr1Xlq/EDaVMcL3Aqsq0+TIgRCmlEnEXMxyoWc9ARNukvS7VV7hkBSFFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723750598; c=relaxed/simple; bh=xyG4ID1L/kWmN1CjIqb7sv+QYxyA4Ge8/8dWxThTCYc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=So6jFoHQwpIiExhS636RDjV9lgPFq8R8Kya+ArMRSGu9iX2EKpeTah6Ctz2+5cnPHYSz/9nQRaeaI+FmDqZ4iNdvIPeevNKj1AH1Ah+G2/JZpflzBmUqNdkhNDEpr9kTA8ofMDYfw/uYRlRJVpX6XT43MC8JoGeU96+i7tZqaRE= 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=icv7P/YP; arc=none smtp.client-ip=91.218.175.184 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="icv7P/YP" 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=1723750595; 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=U4kvv6JhT/h3sb0rBqC1P9JMctOhljJhc6Mf41GF+Lc=; b=icv7P/YPIT+rlH5++UI71iq3hQEfP0CMLN1Zs7L4Vb8Zbmvw5imy26tgwHPGds7gl4MKbP Ze+gOuTyc8mO4UUOjFrUXXcDyd4iVpzcVpV/eaNkz01tQTGTU3CA2Px0b1dz8MPILWs1AD bSx676YfzcRN8LiwplcNv5lpyWjDFJE= From: Sean Anderson To: Radhey Shyam Pandey , netdev@vger.kernel.org Cc: "David S . Miller" , Andrew Lunn , linux-arm-kernel@lists.infradead.org, Michal Simek , Daniel Borkmann , linux-kernel@vger.kernel.org, Paolo Abeni , Jakub Kicinski , Eric Dumazet , Sean Anderson , Simon Horman Subject: [PATCH net-next v2 5/5] net: xilinx: axienet: Support IFF_ALLMULTI Date: Thu, 15 Aug 2024 15:36:14 -0400 Message-Id: <20240815193614.4120810-6-sean.anderson@linux.dev> In-Reply-To: <20240815193614.4120810-1-sean.anderson@linux.dev> References: <20240815193614.4120810-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 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);