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: <0e71321a-127e-474c-b494-9fdece2faef5@davidwei.uk>
Date: Fri, 26 Jan 2024 10:55:48 -0800
From: David Wei <dw@...idwei.uk>
To: Jakub Kicinski <kuba@...nel.org>
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 2024-01-25 18:26, Jakub Kicinski wrote:
> 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

Thanks, I'll be more mindful about this.

> 
>>  	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

Will address.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ