Skip to content

Commit 41898c6

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
i40e: move I40E_FLAG_UDP_FILTER_SYNC to the state field
This flag is modified during run time, possibly even when the RTNL lock is not held. Additionally it has a few places which should be using test_and_set or test_and_clear atomic bit operations. Create a new state bit __I40E_UDP_SYNC_PENDING and use it instead of the ole I40E_FLAG_UDP_FILTER_SYNC flag. This is part of a larger effort to remove the need for using 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 bfe040c commit 41898c6

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ enum i40e_state_t {
163163
__I40E_PORT_SUSPENDED,
164164
__I40E_VF_DISABLE,
165165
__I40E_MACVLAN_SYNC_PENDING,
166+
__I40E_UDP_FILTER_SYNC_PENDING,
166167
/* This must be last as it determines the size of the BITMAP */
167168
__I40E_STATE_SIZE__,
168169
};
@@ -526,7 +527,7 @@ struct i40e_pf {
526527
#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT_ULL(11)
527528
#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT_ULL(12)
528529
#define I40E_FLAG_MFP_ENABLED BIT_ULL(13)
529-
#define I40E_FLAG_UDP_FILTER_SYNC BIT_ULL(14)
530+
/* Gap for BIT_ULL(14) */
530531
#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(15)
531532
#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(16)
532533
#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(17)

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9721,7 +9721,7 @@ static void i40e_sync_udp_filters(struct i40e_pf *pf)
97219721
pf->pending_udp_bitmap |= BIT_ULL(i);
97229722
}
97239723

9724-
pf->flags |= I40E_FLAG_UDP_FILTER_SYNC;
9724+
set_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state);
97259725
}
97269726

97279727
/**
@@ -9735,11 +9735,9 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)
97359735
u16 port;
97369736
int i;
97379737

9738-
if (!(pf->flags & I40E_FLAG_UDP_FILTER_SYNC))
9738+
if (!test_and_clear_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state))
97399739
return;
97409740

9741-
pf->flags &= ~I40E_FLAG_UDP_FILTER_SYNC;
9742-
97439741
for (i = 0; i < I40E_MAX_PF_UDP_OFFLOAD_PORTS; i++) {
97449742
if (pf->pending_udp_bitmap & BIT_ULL(i)) {
97459743
pf->pending_udp_bitmap &= ~BIT_ULL(i);
@@ -11439,7 +11437,7 @@ static void i40e_udp_tunnel_add(struct net_device *netdev,
1143911437
/* New port: add it and mark its index in the bitmap */
1144011438
pf->udp_ports[next_idx].port = port;
1144111439
pf->pending_udp_bitmap |= BIT_ULL(next_idx);
11442-
pf->flags |= I40E_FLAG_UDP_FILTER_SYNC;
11440+
set_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state);
1144311441
}
1144411442

1144511443
/**
@@ -11480,7 +11478,7 @@ static void i40e_udp_tunnel_del(struct net_device *netdev,
1148011478
*/
1148111479
pf->udp_ports[idx].port = 0;
1148211480
pf->pending_udp_bitmap |= BIT_ULL(idx);
11483-
pf->flags |= I40E_FLAG_UDP_FILTER_SYNC;
11481+
set_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state);
1148411482

1148511483
return;
1148611484
not_found:

0 commit comments

Comments
 (0)