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]
Message-ID: <20240125182632.47652d20@kernel.org>
Date: Thu, 25 Jan 2024 18:26:32 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: David Wei <dw@...idwei.uk>
Cc: Jiri Pirko <jiri@...nulli.us>, Sabrina Dubroca <sd@...asysnail.net>,
 netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next v6 2/4] netdevsim: forward skbs from one
 connected port to another

On Thu, 25 Jan 2024 17:23:55 -0800 David Wei wrote:
>  	struct netdevsim *ns = netdev_priv(dev);
> +	struct netdevsim *peer_ns;
> +	unsigned int len = skb->len;
> +	int ret = NETDEV_TX_OK;

nit: order variables longest to shortest

>  	if (!nsim_ipsec_tx(ns, skb))
>  		goto out;
>  
> +	rcu_read_lock();
> +	peer_ns = rcu_dereference(ns->peer);
> +	if (!peer_ns)
> +		goto out_stats;
> +
> +	skb_tx_timestamp(skb);
> +	if (unlikely(dev_forward_skb(peer_ns->netdev, skb) == NET_RX_DROP))
> +		ret = NET_XMIT_DROP;
> +
> +out_stats:
> +	rcu_read_unlock();
>  	u64_stats_update_begin(&ns->syncp);
>  	ns->tx_packets++;
> -	ns->tx_bytes += skb->len;
> +	ns->tx_bytes += len;
> +	if (ret == NET_XMIT_DROP)
> +		ns->tx_dropped++;

drops should not be counted as Tx

>  	u64_stats_update_end(&ns->syncp);
> +	return ret;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ