Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xcap
xcap-capability-linux
Commits
f3521958
Commit
f3521958
authored
Jun 06, 2017
by
Vikram Narayanan
Browse files
lcd/ixgbe: Replace mutex with spinlock in hashtable
Signed-off-by:
Vikram Narayanan
<
vikram186@gmail.com
>
parent
8ee91304
Changes
1
Hide whitespace changes
Inline
Side-by-side
lcd-domains/test_mods/ixgbe/net_klcd/glue/ixgbe_callee.c
View file @
f3521958
...
...
@@ -45,7 +45,7 @@ static DEFINE_HASHTABLE(cptr_table, CPTR_HASH_BITS);
struct
pci_dev
*
g_pdev
=
NULL
;
struct
net_device
*
g_ndev
=
NULL
;
DEFINE_
MUTEX
(
hash
_lock
);
DEFINE_
SPINLOCK
(
hspin
_lock
);
static
unsigned
long
pool_pfn_start
,
pool_pfn_end
;
priv_pool_t
*
pool
;
...
...
@@ -108,10 +108,10 @@ int glue_insert_skbuff(struct hlist_head *htable, struct sk_buff_container *skb_
skb_c
->
my_ref
=
__cptr
((
unsigned
long
)
skb_c
->
skb
);
mutex_lock_interruptible
(
&
hash
_lock
);
hash_add
_rcu
(
cptr_table
,
&
skb_c
->
hentry
,
spin_lock
(
&
hspin
_lock
);
hash_add
(
cptr_table
,
&
skb_c
->
hentry
,
(
unsigned
long
)
skb_c
->
skb
);
mutex
_unlock
(
&
h
ash
_lock
);
spin
_unlock
(
&
h
spin
_lock
);
return
0
;
}
...
...
@@ -119,19 +119,21 @@ int glue_lookup_skbuff(struct hlist_head *htable, struct cptr c, struct sk_buff_
{
struct
sk_buff_container
*
skb_c
;
hash_for_each_possible_rcu
(
cptr_table
,
skb_c
,
spin_lock
(
&
hspin_lock
);
hash_for_each_possible
(
cptr_table
,
skb_c
,
hentry
,
(
unsigned
long
)
cptr_val
(
c
))
{
if
(
skb_c
->
skb
==
(
struct
sk_buff
*
)
c
.
cptr
)
*
skb_cout
=
skb_c
;
}
spin_unlock
(
&
hspin_lock
);
return
0
;
}
void
glue_remove_skbuff
(
struct
sk_buff_container
*
skb_c
)
{
mutex_lock_interruptible
(
&
hash
_lock
);
hash_del
_rcu
(
&
skb_c
->
hentry
);
mutex
_unlock
(
&
h
ash
_lock
);
spin_lock
(
&
hspin
_lock
);
hash_del
(
&
skb_c
->
hentry
);
spin
_unlock
(
&
h
spin
_lock
);
}
void
destroy_async_net_ring_channel
(
struct
thc_channel
*
chnl
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment