aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/ref.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-02 23:53:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-02 23:53:45 -0400
commitcd6362befe4cc7bf589a5236d2a780af2d47bcc9 (patch)
tree3bd4e13ec3f92a00dc4f6c3d65e820b54dbfe46e /net/tipc/ref.c
parent0f1b1e6d73cb989ce2c071edc57deade3b084dfe (diff)
parentb1586f099ba897542ece36e8a23c1a62907261ef (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Here is my initial pull request for the networking subsystem during this merge window: 1) Support for ESN in AH (RFC 4302) from Fan Du. 2) Add full kernel doc for ethtool command structures, from Ben Hutchings. 3) Add BCM7xxx PHY driver, from Florian Fainelli. 4) Export computed TCP rate information in netlink socket dumps, from Eric Dumazet. 5) Allow IPSEC SA to be dumped partially using a filter, from Nicolas Dichtel. 6) Convert many drivers to pci_enable_msix_range(), from Alexander Gordeev. 7) Record SKB timestamps more efficiently, from Eric Dumazet. 8) Switch to microsecond resolution for TCP round trip times, also from Eric Dumazet. 9) Clean up and fix 6lowpan fragmentation handling by making use of the existing inet_frag api for it's implementation. 10) Add TX grant mapping to xen-netback driver, from Zoltan Kiss. 11) Auto size SKB lengths when composing netlink messages based upon past message sizes used, from Eric Dumazet. 12) qdisc dumps can take a long time, add a cond_resched(), From Eric Dumazet. 13) Sanitize netpoll core and drivers wrt. SKB handling semantics. Get rid of never-used-in-tree netpoll RX handling. From Eric W Biederman. 14) Support inter-address-family and namespace changing in VTI tunnel driver(s). From Steffen Klassert. 15) Add Altera TSE driver, from Vince Bridgers. 16) Optimizing csum_replace2() so that it doesn't adjust the checksum by checksumming the entire header, from Eric Dumazet. 17) Expand BPF internal implementation for faster interpreting, more direct translations into JIT'd code, and much cleaner uses of BPF filtering in non-socket ocntexts. From Daniel Borkmann and Alexei Starovoitov" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1976 commits) netpoll: Use skb_irq_freeable to make zap_completion_queue safe. net: Add a test to see if a skb is freeable in irq context qlcnic: Fix build failure due to undefined reference to `vxlan_get_rx_port' net: ptp: move PTP classifier in its own file net: sxgbe: make "core_ops" static net: sxgbe: fix logical vs bitwise operation net: sxgbe: sxgbe_mdio_register() frees the bus Call efx_set_channels() before efx->type->dimension_resources() xen-netback: disable rogue vif in kthread context net/mlx4: Set proper build dependancy with vxlan be2net: fix build dependency on VxLAN mac802154: make csma/cca parameters per-wpan mac802154: allow only one WPAN to be up at any given time net: filter: minor: fix kdoc in __sk_run_filter netlink: don't compare the nul-termination in nla_strcmp can: c_can: Avoid led toggling for every packet. can: c_can: Simplify TX interrupt cleanup can: c_can: Store dlc private can: c_can: Reduce register access can: c_can: Make the code readable ...
Diffstat (limited to 'net/tipc/ref.c')
-rw-r--r--net/tipc/ref.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index de3d593e2fee..3d4ecd754eee 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -89,7 +89,7 @@ struct ref_table {
89 89
90static struct ref_table tipc_ref_table; 90static struct ref_table tipc_ref_table;
91 91
92static DEFINE_RWLOCK(ref_table_lock); 92static DEFINE_SPINLOCK(ref_table_lock);
93 93
94/** 94/**
95 * tipc_ref_table_init - create reference table for objects 95 * tipc_ref_table_init - create reference table for objects
@@ -159,7 +159,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
159 } 159 }
160 160
161 /* take a free entry, if available; otherwise initialize a new entry */ 161 /* take a free entry, if available; otherwise initialize a new entry */
162 write_lock_bh(&ref_table_lock); 162 spin_lock_bh(&ref_table_lock);
163 if (tipc_ref_table.first_free) { 163 if (tipc_ref_table.first_free) {
164 index = tipc_ref_table.first_free; 164 index = tipc_ref_table.first_free;
165 entry = &(tipc_ref_table.entries[index]); 165 entry = &(tipc_ref_table.entries[index]);
@@ -175,7 +175,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
175 } else { 175 } else {
176 ref = 0; 176 ref = 0;
177 } 177 }
178 write_unlock_bh(&ref_table_lock); 178 spin_unlock_bh(&ref_table_lock);
179 179
180 /* 180 /*
181 * Grab the lock so no one else can modify this entry 181 * Grab the lock so no one else can modify this entry
@@ -216,7 +216,7 @@ void tipc_ref_discard(u32 ref)
216 index = ref & index_mask; 216 index = ref & index_mask;
217 entry = &(tipc_ref_table.entries[index]); 217 entry = &(tipc_ref_table.entries[index]);
218 218
219 write_lock_bh(&ref_table_lock); 219 spin_lock_bh(&ref_table_lock);
220 220
221 if (!entry->object) { 221 if (!entry->object) {
222 pr_err("Attempt to discard ref. to non-existent obj\n"); 222 pr_err("Attempt to discard ref. to non-existent obj\n");
@@ -242,7 +242,7 @@ void tipc_ref_discard(u32 ref)
242 tipc_ref_table.last_free = index; 242 tipc_ref_table.last_free = index;
243 243
244exit: 244exit:
245 write_unlock_bh(&ref_table_lock); 245 spin_unlock_bh(&ref_table_lock);
246} 246}
247 247
248/** 248/**
@@ -264,20 +264,3 @@ void *tipc_ref_lock(u32 ref)
264 } 264 }
265 return NULL; 265 return NULL;
266} 266}
267
268
269/**
270 * tipc_ref_deref - return pointer referenced object (without locking it)
271 */
272void *tipc_ref_deref(u32 ref)
273{
274 if (likely(tipc_ref_table.entries)) {
275 struct reference *entry;
276
277 entry = &tipc_ref_table.entries[ref &
278 tipc_ref_table.index_mask];
279 if (likely(entry->ref == ref))
280 return entry->object;
281 }
282 return NULL;
283}