lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 May 2021 22:04:01 +0000
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     Andrew Lunn <andrew@...n.ch>
CC:     David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netdev <netdev@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        "cao88yu@...il.com" <cao88yu@...il.com>
Subject: Re: [PATCH net 3/3] net: dsa: Include tagger overhead when setting
 MTU for DSA and CPU ports

On Mon, May 24, 2021 at 11:33:13PM +0200, Andrew Lunn wrote:
> Same members of the Marvell Ethernet switches impose MTU restrictions
> on ports used for connecting to the CPU or DSA. If the MTU is set too
> low, tagged frames will be discarded. Ensure the tagger overhead is
> included in setting the MTU for DSA and CPU ports.
> 
> Fixes: 1baf0fac10fb ("net: dsa: mv88e6xxx: Use chip-wide max frame size for MTU")
> Reported by: 曹煜 <cao88yu@...il.com>
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> ---

Some switches account for the DSA tag automatically in hardware. So far
it has been the convention that if a switch doesn't do that, the driver
should, not DSA.

>  net/dsa/switch.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/net/dsa/switch.c b/net/dsa/switch.c
> index 9bf8e20ecdf3..48c737b0b802 100644
> --- a/net/dsa/switch.c
> +++ b/net/dsa/switch.c
> @@ -67,14 +67,26 @@ static bool dsa_switch_mtu_match(struct dsa_switch *ds, int port,
>  static int dsa_switch_mtu(struct dsa_switch *ds,
>  			  struct dsa_notifier_mtu_info *info)
>  {
> -	int port, ret;
> +	struct dsa_port *cpu_dp;
> +	int port, ret, overhead;
>  
>  	if (!ds->ops->port_change_mtu)
>  		return -EOPNOTSUPP;
>  
>  	for (port = 0; port < ds->num_ports; port++) {
>  		if (dsa_switch_mtu_match(ds, port, info)) {
> -			ret = ds->ops->port_change_mtu(ds, port, info->mtu);
> +			overhead = 0;
> +			if (dsa_is_cpu_port(ds, port)) {
> +				cpu_dp = dsa_to_port(ds, port);
> +				overhead = cpu_dp->tag_ops->overhead;
> +			}
> +			if (dsa_is_dsa_port(ds, port)) {
> +					cpu_dp = dsa_to_port(ds, port)->cpu_dp;
> +					overhead = cpu_dp->tag_ops->overhead;

Too Much Indentation.

> +			}
> +
> +			ret = ds->ops->port_change_mtu(ds, port,
> +						       info->mtu + overhead);
>  			if (ret)
>  				return ret;
>  		}
> -- 
> 2.31.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ