RE: [net-next 1/8] i40e: main driver core
flat view
From: Nelson, Shannon <hidden>
Date: 2013-06-20 20:50:56
-----Original Message----- From: Stephen Hemminger [mailto:stephen@networkplumber.org] Sent: Wednesday, June 19, 2013 11:56 AM On Thu, 13 Jun 2013 20:55:15 -0700 Jeff Kirsher [off-list ref] wrote:quoted
+ +char i40e_driver_name[] = "i40e";Obviously const
Yep.
+/* 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)Yep - thanks. sln