Thread (32 messages) 32 messages, 6 authors, 2013-06-25

Re: [net-next 1/8] i40e: main driver core

flat view

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2013-06-19 18:55:47

On Thu, 13 Jun 2013 20:55:15 -0700
Jeff Kirsher [off-list ref] wrote:
+
+char i40e_driver_name[] = "i40e";
Obviously const

+/* Helper macros for reading the stats registers
+ *
+ * Since the device stats are not reset at PFReset, they likely will not
+ * be zeroed when the driver starts.  We'll save the first values read
+ * and use them as offsets to be subtracted from the raw values in order
+ * to report stats that count from zero.
+ */
+#define I40E_STAT_UPDATE48(hireg, loreg, offset_loaded, offset, stat)     \
+do {                                                                      \
+	u64 new_data;                                                     \
+	new_data = rd64(hw, (loreg));                                     \
+	if (!(offset_loaded))                                             \
+		(offset) = new_data;                                      \
+	if (likely(new_data >= (offset)))                                 \
+		(stat) = new_data - (offset);                             \
+	else                                                              \
+		(stat) = (new_data + ((u64)1 << 48)) - (offset);          \
+	(stat) &= 0xFFFFFFFFFFFFULL;                                      \
+} while (0)

Macro's suck, this could just as well be a function
or maybe a macro that calls function (and go ahead and do string manipulation)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help