Skip to content

Commit bfe040c

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
i40e: move I40E_FLAG_FILTER_SYNC to a state bit
The I40E_FLAG_FILTER_SYNC flag is modified during run time possibly when the RTNL lock is not held. Thus, it should not be part of pf->flags, and instead should be using atomic bit operations in the pf->state field. Create a __I40E_MACVLAN_SYNC_PENDING state bit, and use it instead of the old I40E_FLAG_FILTER_SYNC flag. This is part of a larger effort to remove the need for cmpxchg64 in i40e_set_priv_flags(). Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 996bfed commit bfe040c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ enum i40e_state_t {
162162
__I40E_RESET_FAILED,
163163
__I40E_PORT_SUSPENDED,
164164
__I40E_VF_DISABLE,
165+
__I40E_MACVLAN_SYNC_PENDING,
165166
/* This must be last as it determines the size of the BITMAP */
166167
__I40E_STATE_SIZE__,
167168
};
@@ -516,7 +517,7 @@ struct i40e_pf {
516517
#define I40E_FLAG_MSIX_ENABLED BIT_ULL(2)
517518
#define I40E_FLAG_RSS_ENABLED BIT_ULL(3)
518519
#define I40E_FLAG_VMDQ_ENABLED BIT_ULL(4)
519-
#define I40E_FLAG_FILTER_SYNC BIT_ULL(5)
520+
/* Gap for BIT_ULL(5) */
520521
#define I40E_FLAG_SRIOV_ENABLED BIT_ULL(6)
521522
#define I40E_FLAG_DCB_CAPABLE BIT_ULL(7)
522523
#define I40E_FLAG_DCB_ENABLED BIT_ULL(8)

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
13821382
hash_add(vsi->mac_filter_hash, &f->hlist, key);
13831383

13841384
vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
1385-
vsi->back->flags |= I40E_FLAG_FILTER_SYNC;
1385+
set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->back->state);
13861386
}
13871387

13881388
/* If we're asked to add a filter that has been marked for removal, it
@@ -1432,7 +1432,7 @@ void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f)
14321432
}
14331433

14341434
vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
1435-
vsi->back->flags |= I40E_FLAG_FILTER_SYNC;
1435+
set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->state);
14361436
}
14371437

14381438
/**
@@ -1955,7 +1955,7 @@ static void i40e_set_rx_mode(struct net_device *netdev)
19551955
/* check for other flag changes */
19561956
if (vsi->current_netdev_flags != vsi->netdev->flags) {
19571957
vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
1958-
vsi->back->flags |= I40E_FLAG_FILTER_SYNC;
1958+
set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->back->state);
19591959
}
19601960
}
19611961

@@ -2577,9 +2577,10 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
25772577
{
25782578
int v;
25792579

2580-
if (!pf || !(pf->flags & I40E_FLAG_FILTER_SYNC))
2580+
if (!pf)
2581+
return;
2582+
if (!test_and_clear_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state))
25812583
return;
2582-
pf->flags &= ~I40E_FLAG_FILTER_SYNC;
25832584

25842585
for (v = 0; v < pf->num_alloc_vsi; v++) {
25852586
if (pf->vsi[v] &&
@@ -2588,7 +2589,8 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
25882589

25892590
if (ret) {
25902591
/* come back and try again later */
2591-
pf->flags |= I40E_FLAG_FILTER_SYNC;
2592+
set_bit(__I40E_MACVLAN_SYNC_PENDING,
2593+
pf->state);
25922594
break;
25932595
}
25942596
}
@@ -12240,7 +12242,7 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
1224012242

1224112243
if (f_count) {
1224212244
vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
12243-
pf->flags |= I40E_FLAG_FILTER_SYNC;
12245+
set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state);
1224412246
}
1224512247

1224612248
/* Update VSI BW information */

0 commit comments

Comments
 (0)