Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-08 Thread Mattias Rönnblom
On 2024-05-07 18:00, Morten Brørup wrote: From: Stephen Hemminger [mailto:step...@networkplumber.org] Sent: Tuesday, 7 May 2024 16.51 I would prefer that the SW statistics be handled generically by ethdev layers and used by all such drivers. I agree. Please note that maintaining counters in

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-08 Thread Mattias Rönnblom
On 2024-05-08 09:10, Morten Brørup wrote: From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] Sent: Wednesday, 8 May 2024 08.35 On 2024-05-07 21:19, Morten Brørup wrote: From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] Sent: Tuesday, 7 May 2024 09.24 On 2024-04-28 17:11, Mattias Rönnblo

RE: [RFC v2] net/af_packet: make stats reset reliable

2024-05-08 Thread Morten Brørup
> From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > Sent: Wednesday, 8 May 2024 08.35 > > On 2024-05-07 21:19, Morten Brørup wrote: > >> From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > >> Sent: Tuesday, 7 May 2024 09.24 > >> > >> On 2024-04-28 17:11, Mattias Rönnblom wrote: > >>> On

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Mattias Rönnblom
On 2024-05-07 21:19, Morten Brørup wrote: From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] Sent: Tuesday, 7 May 2024 09.24 On 2024-04-28 17:11, Mattias Rönnblom wrote: On 2024-04-26 16:38, Ferruh Yigit wrote: [...] static uint64_t counter_value(struct counter *counter) { uint64_t

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Mattias Rönnblom
On 2024-05-07 16:51, Stephen Hemminger wrote: On Tue, 7 May 2024 14:49:19 +0100 Ferruh Yigit wrote: On 5/7/2024 8:23 AM, Mattias Rönnblom wrote: On 2024-04-28 17:11, Mattias Rönnblom wrote: On 2024-04-26 16:38, Ferruh Yigit wrote: For stats reset, use an offset instead of zeroing out actual

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Mattias Rönnblom
On 2024-05-07 15:49, Ferruh Yigit wrote: On 5/7/2024 8:23 AM, Mattias Rönnblom wrote: On 2024-04-28 17:11, Mattias Rönnblom wrote: On 2024-04-26 16:38, Ferruh Yigit wrote: For stats reset, use an offset instead of zeroing out actual stats values, get_stats() displays diff between stats and off

RE: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Morten Brørup
> From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > Sent: Tuesday, 7 May 2024 09.24 > > On 2024-04-28 17:11, Mattias Rönnblom wrote: > > On 2024-04-26 16:38, Ferruh Yigit wrote: [...] > > static uint64_t > > counter_value(struct counter *counter) > > { > > uint64_t count = __atomic_lo

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Stephen Hemminger
On Tue, 7 May 2024 17:54:18 +0100 Ferruh Yigit wrote: > On 5/7/2024 5:00 PM, Morten Brørup wrote: > >> From: Stephen Hemminger [mailto:step...@networkplumber.org] > >> Sent: Tuesday, 7 May 2024 16.51 > > > >> I would prefer that the SW statistics be handled generically by ethdev > >> layers

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Ferruh Yigit
On 5/7/2024 5:00 PM, Morten Brørup wrote: >> From: Stephen Hemminger [mailto:step...@networkplumber.org] >> Sent: Tuesday, 7 May 2024 16.51 > >> I would prefer that the SW statistics be handled generically by ethdev >> layers and used by all such drivers. > > I agree. > > Please note that mainta

RE: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Morten Brørup
> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Tuesday, 7 May 2024 16.51 > I would prefer that the SW statistics be handled generically by ethdev > layers and used by all such drivers. I agree. Please note that maintaining counters in the ethdev layer might cause more cac

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Stephen Hemminger
On Tue, 7 May 2024 14:49:19 +0100 Ferruh Yigit wrote: > On 5/7/2024 8:23 AM, Mattias Rönnblom wrote: > > On 2024-04-28 17:11, Mattias Rönnblom wrote: > >> On 2024-04-26 16:38, Ferruh Yigit wrote: > >>> For stats reset, use an offset instead of zeroing out actual stats > >>> values, > >>> get_

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Ferruh Yigit
On 5/7/2024 8:23 AM, Mattias Rönnblom wrote: > On 2024-04-28 17:11, Mattias Rönnblom wrote: >> On 2024-04-26 16:38, Ferruh Yigit wrote: >>> For stats reset, use an offset instead of zeroing out actual stats >>> values, >>> get_stats() displays diff between stats and offset. >>> This way stats only

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-07 Thread Mattias Rönnblom
On 2024-04-28 17:11, Mattias Rönnblom wrote: On 2024-04-26 16:38, Ferruh Yigit wrote: For stats reset, use an offset instead of zeroing out actual stats values, get_stats() displays diff between stats and offset. This way stats only updated in datapath and offset only updated in stats reset fun

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-02 Thread Mattias Rönnblom
On 2024-05-02 20:26, Stephen Hemminger wrote: On Thu, 2 May 2024 19:37:28 +0200 Mattias Rönnblom wrote: Do we need to declare count as '_Atomic', I wasn't planning to make variable _Atomic. This way assignment won't introduce any memory barrier. To use atomics in DPDK, the current requi

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-02 Thread Stephen Hemminger
On Thu, 2 May 2024 19:37:28 +0200 Mattias Rönnblom wrote: > > > > Do we need to declare count as '_Atomic', I wasn't planning to make > > variable _Atomic. This way assignment won't introduce any memory barrier. > > > > To use atomics in DPDK, the current requirements seems to be to use > R

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-02 Thread Ferruh Yigit
On 5/2/2024 4:59 PM, Stephen Hemminger wrote: > On Thu, 2 May 2024 15:22:35 +0100 > Ferruh Yigit wrote: > >>> >>> It's not going to be completely MT safe, since you can't have two >>> threads calling the reset function in parallel. >>> >> >> This is what I meant with "MT-safe reset", so multip

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-02 Thread Mattias Rönnblom
On 2024-05-02 16:22, Ferruh Yigit wrote: On 5/2/2024 6:51 AM, Mattias Rönnblom wrote: On 2024-05-01 18:19, Ferruh Yigit wrote: On 4/28/2024 4:11 PM, Mattias Rönnblom wrote: On 2024-04-26 16:38, Ferruh Yigit wrote: For stats reset, use an offset instead of zeroing out actual stats values, get_

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-02 Thread Stephen Hemminger
On Thu, 2 May 2024 15:22:35 +0100 Ferruh Yigit wrote: > > > > It's not going to be completely MT safe, since you can't have two > > threads calling the reset function in parallel. > > > > This is what I meant with "MT-safe reset", so multiple threads not > allowed to call stats reset in para

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-02 Thread Ferruh Yigit
On 5/2/2024 6:51 AM, Mattias Rönnblom wrote: > On 2024-05-01 18:19, Ferruh Yigit wrote: >> On 4/28/2024 4:11 PM, Mattias Rönnblom wrote: >>> On 2024-04-26 16:38, Ferruh Yigit wrote: For stats reset, use an offset instead of zeroing out actual stats values, get_stats() displays diff b

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-01 Thread Mattias Rönnblom
On 2024-05-01 18:19, Ferruh Yigit wrote: On 4/28/2024 4:11 PM, Mattias Rönnblom wrote: On 2024-04-26 16:38, Ferruh Yigit wrote: For stats reset, use an offset instead of zeroing out actual stats values, get_stats() displays diff between stats and offset. This way stats only updated in datapath

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-05-01 Thread Ferruh Yigit
On 4/28/2024 4:11 PM, Mattias Rönnblom wrote: > On 2024-04-26 16:38, Ferruh Yigit wrote: >> For stats reset, use an offset instead of zeroing out actual stats >> values, >> get_stats() displays diff between stats and offset. >> This way stats only updated in datapath and offset only updated in stat

Re: [RFC v2] net/af_packet: make stats reset reliable

2024-04-28 Thread Mattias Rönnblom
On 2024-04-26 16:38, Ferruh Yigit wrote: For stats reset, use an offset instead of zeroing out actual stats values, get_stats() displays diff between stats and offset. This way stats only updated in datapath and offset only updated in stats reset function. This makes stats reset function more rel

RE: [RFC v2] net/af_packet: make stats reset reliable

2024-04-26 Thread Morten Brørup
> +static uint64_t > +stats_get_diff(uint64_t stats, uint64_t offset) > +{ > + return stats - offset; > +} No need for this function; just subtract inline instead. With the suggested change, Reviewed-by: Morten Brørup

[RFC v2] net/af_packet: make stats reset reliable

2024-04-26 Thread Ferruh Yigit
For stats reset, use an offset instead of zeroing out actual stats values, get_stats() displays diff between stats and offset. This way stats only updated in datapath and offset only updated in stats reset function. This makes stats reset function more reliable. As stats only written by single thr