Thread (1 message) 1 message, 1 author, 2011-11-21

Re: [PATCH v2 5/5] net: Add Open vSwitch kernel components.

From: Stephen Hemminger <hidden>
Date: 2011-11-21 23:25:18

On Mon, 21 Nov 2011 15:18:43 -0800
Jesse Gross [off-list ref] wrote:
On Mon, Nov 21, 2011 at 1:59 PM, Stephen Hemminger
[off-list ref] wrote:
quoted
On Mon, 21 Nov 2011 13:30:29 -0800
Jesse Gross [off-list ref] wrote:
quoted
+/**
+ *   vport_record_error - indicate device error to generic stats layer
+ *
+ * @vport: vport that encountered the error
+ * @err_type: one of enum vport_err_type types to indicate the error type
+ *
+ * If using the vport generic stats layer indicate that an error of the given
+ * type has occured.
+ */
+void vport_record_error(struct vport *vport, enum vport_err_type err_type)
+{
+     spin_lock(&vport->stats_lock);
Sorry for over analyzing this... but I don't think the stats_lock
is necessary either. The only thing it is protecting is against 64 bit
wrap. If you used another u64_stat_sync for that one, it could be eliminated.

Maybe?
The reason for stats_lock is that the error stats are not expected to
be contended so in order to save some memory they're not per-cpu and
we just use a spin lock to protect them.
Assignment or increment of native type size (64 bit on 64 bit cpu)
is always atomic.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help