diff options
author | Andy Grover <andy.grover@oracle.com> | 2009-04-01 04:20:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-02 03:52:22 -0400 |
commit | 8cbd9606a6367c221a7bbcc47f3ab1a8c31b6437 (patch) | |
tree | 9ff2adf88be32383fd59dc133f1cd6670b9ee815 /net/rds/iw.h | |
parent | 745cbccac3fe8cead529a1b3358e1e86a1505bfa (diff) |
RDS: Use spinlock to protect 64b value update on 32b archs
We have a 64bit value that needs to be set atomically.
This is easy and quick on all 64bit archs, and can also be done
on x86/32 with set_64bit() (uses cmpxchg8b). However other
32b archs don't have this.
I actually changed this to the current state in preparation for
mainline because the old way (using a spinlock on 32b) resulted in
unsightly #ifdefs in the code. But obviously, being correct takes
precedence.
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/iw.h')
-rw-r--r-- | net/rds/iw.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/net/rds/iw.h b/net/rds/iw.h index 70eb948f42f4..b4fb27252895 100644 --- a/net/rds/iw.h +++ b/net/rds/iw.h | |||
@@ -131,7 +131,12 @@ struct rds_iw_connection { | |||
131 | 131 | ||
132 | /* sending acks */ | 132 | /* sending acks */ |
133 | unsigned long i_ack_flags; | 133 | unsigned long i_ack_flags; |
134 | #ifdef KERNEL_HAS_ATOMIC64 | ||
135 | atomic64_t i_ack_next; /* next ACK to send */ | ||
136 | #else | ||
137 | spinlock_t i_ack_lock; /* protect i_ack_next */ | ||
134 | u64 i_ack_next; /* next ACK to send */ | 138 | u64 i_ack_next; /* next ACK to send */ |
139 | #endif | ||
135 | struct rds_header *i_ack; | 140 | struct rds_header *i_ack; |
136 | struct ib_send_wr i_ack_wr; | 141 | struct ib_send_wr i_ack_wr; |
137 | struct ib_sge i_ack_sge; | 142 | struct ib_sge i_ack_sge; |
@@ -391,13 +396,4 @@ rds_iw_data_sge(struct rds_iw_connection *ic, struct ib_sge *sge) | |||
391 | return &sge[1]; | 396 | return &sge[1]; |
392 | } | 397 | } |
393 | 398 | ||
394 | static inline void rds_iw_set_64bit(u64 *ptr, u64 val) | ||
395 | { | ||
396 | #if BITS_PER_LONG == 64 | ||
397 | *ptr = val; | ||
398 | #else | ||
399 | set_64bit(ptr, val); | ||
400 | #endif | ||
401 | } | ||
402 | |||
403 | #endif | 399 | #endif |