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: <986ca495-ef49-4eff-4d92-3f96e7b37fb3@engleder-embedded.com>
Date:   Tue, 18 Apr 2023 20:25:54 +0200
From:   Gerhard Engleder <gerhard@...leder-embedded.com>
To:     Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org
Cc:     davem@...emloft.net, kuba@...nel.org, edumazet@...gle.com,
        bjorn@...nel.org, magnus.karlsson@...el.com,
        maciej.fijalkowski@...el.com, jonathan.lemon@...il.com
Subject: Re: [PATCH net-next v2 6/6] tsnep: Add XDP socket zero-copy TX
 support

On 18.04.23 10:27, Paolo Abeni wrote:
> On Sat, 2023-04-15 at 16:42 +0200, Gerhard Engleder wrote:
>> Send and complete XSK pool frames within TX NAPI context. NAPI context
>> is triggered by ndo_xsk_wakeup.
>>
>> Test results with A53 1.2GHz:
>>
>> xdpsock txonly copy mode:
>>                     pps            pkts           1.00
>> tx                 284,409        11,398,144
>> Two CPUs with 100% and 10% utilization.
>>
>> xdpsock txonly zero-copy mode:
>>                     pps            pkts           1.00
>> tx                 511,929        5,890,368
>> Two CPUs with 100% and 1% utilization.
>>
>> Packet rate increases and CPU utilization is reduced.
>>
>> Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
>> ---
>>   drivers/net/ethernet/engleder/tsnep.h      |   2 +
>>   drivers/net/ethernet/engleder/tsnep_main.c | 131 +++++++++++++++++++--
>>   2 files changed, 123 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/engleder/tsnep.h b/drivers/net/ethernet/engleder/tsnep.h
>> index d0bea605a1d1..11b29f56aaf9 100644
>> --- a/drivers/net/ethernet/engleder/tsnep.h
>> +++ b/drivers/net/ethernet/engleder/tsnep.h
>> @@ -70,6 +70,7 @@ struct tsnep_tx_entry {
>>   	union {
>>   		struct sk_buff *skb;
>>   		struct xdp_frame *xdpf;
>> +		bool zc;
>>   	};
>>   	size_t len;
>>   	DEFINE_DMA_UNMAP_ADDR(dma);
>> @@ -88,6 +89,7 @@ struct tsnep_tx {
>>   	int read;
>>   	u32 owner_counter;
>>   	int increment_owner_counter;
>> +	struct xsk_buff_pool *xsk_pool;
>>   
>>   	u32 packets;
>>   	u32 bytes;
>> diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
>> index 13e5d4438082..de51d0cc8935 100644
>> --- a/drivers/net/ethernet/engleder/tsnep_main.c
>> +++ b/drivers/net/ethernet/engleder/tsnep_main.c
>> @@ -54,6 +54,8 @@
>>   #define TSNEP_TX_TYPE_SKB_FRAG	BIT(1)
>>   #define TSNEP_TX_TYPE_XDP_TX	BIT(2)
>>   #define TSNEP_TX_TYPE_XDP_NDO	BIT(3)
>> +#define TSNEP_TX_TYPE_XDP	(TSNEP_TX_TYPE_XDP_TX | TSNEP_TX_TYPE_XDP_NDO)
>> +#define TSNEP_TX_TYPE_XSK	BIT(4)
>>   
>>   #define TSNEP_XDP_TX		BIT(0)
>>   #define TSNEP_XDP_REDIRECT	BIT(1)
>> @@ -322,13 +324,51 @@ static void tsnep_tx_init(struct tsnep_tx *tx)
>>   	tx->increment_owner_counter = TSNEP_RING_SIZE - 1;
>>   }
>>   
>> +static void tsnep_tx_enable(struct tsnep_tx *tx)
>> +{
>> +	struct netdev_queue *nq;
>> +
>> +	nq = netdev_get_tx_queue(tx->adapter->netdev, tx->queue_index);
>> +
>> +	local_bh_disable();
>> +	__netif_tx_lock(nq, smp_processor_id());
> 
> The above 2 statements could be replaced with:
> 
> 	__netif_tx_lock_bh()
> 
>> +	netif_tx_wake_queue(nq);
>> +	__netif_tx_unlock(nq);
>> +	local_bh_enable();
> 
> __netif_tx_unlock_bh()
> 
>> +}
>> +
>> +static void tsnep_tx_disable(struct tsnep_tx *tx, struct napi_struct *napi)
>> +{
>> +	struct netdev_queue *nq;
>> +	u32 val;
>> +
>> +	nq = netdev_get_tx_queue(tx->adapter->netdev, tx->queue_index);
>> +
>> +	local_bh_disable();
>> +	__netif_tx_lock(nq, smp_processor_id());
> 
> Same here.

Will be done.

Thank you!

Gerhard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ