netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [resend PATCH 1/2] dim: make dim_calc_stats() inputs const pointers
@ 2024-10-31  0:23 Caleb Sander Mateos
  2024-10-31  0:23 ` [resend PATCH 2/2] dim: pass dim_sample to net_dim() by reference Caleb Sander Mateos
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Caleb Sander Mateos @ 2024-10-31  0:23 UTC (permalink / raw)
  To: Andrew Lunn, AngeloGioacchino Del Regno, Arthur Kiyanovski,
	Brett Creeley, Broadcom internal kernel review list,
	Christophe Leroy, Claudiu Manoil, David Arinzon, David S. Miller,
	Doug Berger, Eric Dumazet, Eugenio Pérez, Felix Fietkau,
	Florian Fainelli, Geetha sowjanya, hariprasad, Jakub Kicinski,
	Jason Wang, Jonathan Corbet, Leon Romanovsky, Lorenzo Bianconi,
	Louis Peens, Mark Lee, Matthias Brugger, Michael Chan,
	Michael S. Tsirkin, Noam Dagan, Paolo Abeni, Przemek Kitszel,
	Roy Pledge, Saeed Bishara, Saeed Mahameed, Sean Wang,
	Shannon Nelson, Shay Agroskin, Simon Horman, Subbaraya Sundeep,
	Sunil Goutham, Tal Gilboa, Tariq Toukan, Tony Nguyen,
	Vladimir Oltean, Xuan Zhuo
  Cc: Caleb Sander Mateos, intel-wired-lan, linux-arm-kernel, linux-doc,
	linux-kernel, linux-mediatek, linuxppc-dev, linux-rdma, netdev,
	oss-drivers, virtualization

Make the start and end arguments to dim_calc_stats() const pointers
to clarify that the function does not modify their values.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 include/linux/dim.h | 3 ++-
 lib/dim/dim.c       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/dim.h b/include/linux/dim.h
index 1b581ff25a15..84579a50ae7f 100644
--- a/include/linux/dim.h
+++ b/include/linux/dim.h
@@ -349,11 +349,12 @@ void dim_park_tired(struct dim *dim);
  *
  * Calculate the delta between two samples (in data rates).
  * Takes into consideration counter wrap-around.
  * Returned boolean indicates whether curr_stats are reliable.
  */
-bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
+bool dim_calc_stats(const struct dim_sample *start,
+		    const struct dim_sample *end,
 		    struct dim_stats *curr_stats);
 
 /**
  *	dim_update_sample - set a sample's fields with given values
  *	@event_ctr: number of events to set
diff --git a/lib/dim/dim.c b/lib/dim/dim.c
index 83b65ac74d73..97c3d084ebf0 100644
--- a/lib/dim/dim.c
+++ b/lib/dim/dim.c
@@ -52,11 +52,12 @@ void dim_park_tired(struct dim *dim)
 	dim->steps_left   = 0;
 	dim->tune_state   = DIM_PARKING_TIRED;
 }
 EXPORT_SYMBOL(dim_park_tired);
 
-bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
+bool dim_calc_stats(const struct dim_sample *start,
+		    const struct dim_sample *end,
 		    struct dim_stats *curr_stats)
 {
 	/* u32 holds up to 71 minutes, should be enough */
 	u32 delta_us = ktime_us_delta(end->time, start->time);
 	u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-11-04  2:52 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31  0:23 [resend PATCH 1/2] dim: make dim_calc_stats() inputs const pointers Caleb Sander Mateos
2024-10-31  0:23 ` [resend PATCH 2/2] dim: pass dim_sample to net_dim() by reference Caleb Sander Mateos
2024-10-31 12:49   ` Louis Peens
2024-10-31 17:19     ` Caleb Sander
2024-11-01  8:54       ` Louis Peens
2024-11-01 14:11         ` Vladimir Oltean
2024-10-31 16:48   ` Vladimir Oltean
2024-10-31 16:57   ` Nelson, Shannon
2024-10-31 17:17   ` Florian Fainelli
2024-10-31 18:28   ` Kiyanovski, Arthur
2024-11-03 20:21   ` Jakub Kicinski
2024-11-03 22:50     ` Caleb Sander
2024-11-04  2:52   ` Xuan Zhuo
2024-10-31 16:44 ` [resend PATCH 1/2] dim: make dim_calc_stats() inputs const pointers Vladimir Oltean
2024-10-31 17:15 ` Florian Fainelli
2024-10-31 18:22   ` Kiyanovski, Arthur
2024-11-04  2:45 ` Xuan Zhuo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).