File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
drivers/net/ethernet/intel/fm10k Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,6 @@ enum fm10k_state_t {
276
276
__FM10K_SERVICE_SCHED ,
277
277
__FM10K_SERVICE_REQUEST ,
278
278
__FM10K_SERVICE_DISABLE ,
279
- __FM10K_MBX_LOCK ,
280
279
__FM10K_LINK_DOWN ,
281
280
__FM10K_UPDATING_STATS ,
282
281
/* This value must be last and determines the BITMAP size */
@@ -346,6 +345,8 @@ struct fm10k_intfc {
346
345
347
346
struct fm10k_hw_stats stats ;
348
347
struct fm10k_hw hw ;
348
+ /* Mailbox lock */
349
+ spinlock_t mbx_lock ;
349
350
u32 __iomem * uc_addr ;
350
351
u32 __iomem * sw_addr ;
351
352
u16 msg_enable ;
@@ -386,23 +387,17 @@ struct fm10k_intfc {
386
387
387
388
static inline void fm10k_mbx_lock (struct fm10k_intfc * interface )
388
389
{
389
- /* busy loop if we cannot obtain the lock as some calls
390
- * such as ndo_set_rx_mode may be made in atomic context
391
- */
392
- while (test_and_set_bit (__FM10K_MBX_LOCK , interface -> state ))
393
- udelay (20 );
390
+ spin_lock (& interface -> mbx_lock );
394
391
}
395
392
396
393
static inline void fm10k_mbx_unlock (struct fm10k_intfc * interface )
397
394
{
398
- /* flush memory to make sure state is correct */
399
- smp_mb__before_atomic ();
400
- clear_bit (__FM10K_MBX_LOCK , interface -> state );
395
+ spin_unlock (& interface -> mbx_lock );
401
396
}
402
397
403
398
static inline int fm10k_mbx_trylock (struct fm10k_intfc * interface )
404
399
{
405
- return ! test_and_set_bit ( __FM10K_MBX_LOCK , interface -> state );
400
+ return spin_trylock ( & interface -> mbx_lock );
406
401
}
407
402
408
403
/* fm10k_test_staterr - test bits in Rx descriptor status and error fields */
Original file line number Diff line number Diff line change @@ -1921,6 +1921,9 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
1921
1921
netdev_rss_key_fill (rss_key , sizeof (rss_key ));
1922
1922
memcpy (interface -> rssrk , rss_key , sizeof (rss_key ));
1923
1923
1924
+ /* Initialize the mailbox lock */
1925
+ spin_lock_init (& interface -> mbx_lock );
1926
+
1924
1927
/* Start off interface as being down */
1925
1928
set_bit (__FM10K_DOWN , interface -> state );
1926
1929
set_bit (__FM10K_UPDATING_STATS , interface -> state );
You can’t perform that action at this time.
0 commit comments