diff mbox series

[net-next,1/4] net: xilinx: axienet: Always disable promiscuous mode

Message ID 20240812200437.3581990-2-sean.anderson@linux.dev (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: xilinx: axienet: Multicast fixes and improvements | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 31 this patch: 31
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 3 this patch: 3
netdev/source_inline success Was 0 now: 0
netdev/contest warning net-next-2024-08-14--09-00 (tests: 708)

Commit Message

Sean Anderson Aug. 12, 2024, 8:04 p.m. UTC
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 <sean.anderson@linux.dev>
---

 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Horman Aug. 15, 2024, 2:58 p.m. UTC | #1
On Mon, Aug 12, 2024 at 04:04:34PM -0400, Sean Anderson wrote:
> 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 <sean.anderson@linux.dev>
> ---
> 
>  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);
> +

Hi Sean,

I notice that this replicates code in another part of this function.
And that is then factored out into common code as part of the last
patch of this series.

I guess that it is in the wash, but perhaps it would
be nicer to factor out the common promisc mode setting code
as part of this patch.

Otherwise, this LGTM.

>  		i = 0;
>  		netdev_for_each_mc_addr(ha, ndev) {
>  			if (i >= XAE_MULTICAST_CAM_TABLE_NUM)
> -- 
> 2.35.1.1320.gc452695387.dirty
> 
>
Sean Anderson Aug. 15, 2024, 3:14 p.m. UTC | #2
On 8/15/24 10:58, Simon Horman wrote:
> On Mon, Aug 12, 2024 at 04:04:34PM -0400, Sean Anderson wrote:
>> 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 <sean.anderson@linux.dev>
>> ---
>> 
>>  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);
>> +
> 
> Hi Sean,
> 
> I notice that this replicates code in another part of this function.
> And that is then factored out into common code as part of the last
> patch of this series.
> 
> I guess that it is in the wash, but perhaps it would
> be nicer to factor out the common promisc mode setting code
> as part of this patch.
> 
> Otherwise, this LGTM.

I thought about doing that, but it would have required changing the
indentation of ~10 lines and I thought it would be easier to review
the patch without that noise.

--Sean
Simon Horman Aug. 15, 2024, 3:17 p.m. UTC | #3
On Thu, Aug 15, 2024 at 11:14:41AM -0400, Sean Anderson wrote:
> On 8/15/24 10:58, Simon Horman wrote:
> > On Mon, Aug 12, 2024 at 04:04:34PM -0400, Sean Anderson wrote:
> >> 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 <sean.anderson@linux.dev>
> >> ---
> >> 
> >>  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);
> >> +
> > 
> > Hi Sean,
> > 
> > I notice that this replicates code in another part of this function.
> > And that is then factored out into common code as part of the last
> > patch of this series.
> > 
> > I guess that it is in the wash, but perhaps it would
> > be nicer to factor out the common promisc mode setting code
> > as part of this patch.
> > 
> > Otherwise, this LGTM.
> 
> I thought about doing that, but it would have required changing the
> indentation of ~10 lines and I thought it would be easier to review
> the patch without that noise.

Sure, I was also wrestling with that in my mind.
I think we can stick with what you have :)

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

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)