Skip to content

Commit 5f76a70

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
i40e: move client flags into state bits
The iWarp client flags are all potentially changed when the RTNL lock is not held, so they should not be part of the pf->flags variable. Instead, move them into the state field so that we can use atomic bit operations. This is part of a larger effort to remove 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 0605c45 commit 5f76a70

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ enum i40e_state_t {
167167
__I40E_MACVLAN_SYNC_PENDING,
168168
__I40E_UDP_FILTER_SYNC_PENDING,
169169
__I40E_TEMP_LINK_POLLING,
170+
__I40E_CLIENT_SERVICE_REQUESTED,
171+
__I40E_CLIENT_L2_CHANGE,
172+
__I40E_CLIENT_RESET,
170173
/* This must be last as it determines the size of the BITMAP */
171174
__I40E_STATE_SIZE__,
172175
};
@@ -539,9 +542,7 @@ struct i40e_pf {
539542
#define I40E_FLAG_LEGACY_RX BIT_ULL(21)
540543
#define I40E_FLAG_PTP BIT_ULL(22)
541544
#define I40E_FLAG_IWARP_ENABLED BIT_ULL(23)
542-
#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT_ULL(24)
543-
#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(25)
544-
#define I40E_FLAG_CLIENT_RESET BIT_ULL(26)
545+
/* Gap for BIT_ULL(24) through BIT_ULL(26) */
545546
#define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT_ULL(27)
546547
#define I40E_FLAG_SOURCE_PRUNING_DISABLED BIT_ULL(28)
547548
#define I40E_FLAG_TC_MQPRIO BIT_ULL(29)

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,8 @@ void i40e_client_subtask(struct i40e_pf *pf)
376376
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
377377
int ret = 0;
378378

379-
if (!(pf->flags & I40E_FLAG_SERVICE_CLIENT_REQUESTED))
379+
if (!test_and_clear_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state))
380380
return;
381-
pf->flags &= ~I40E_FLAG_SERVICE_CLIENT_REQUESTED;
382381
cdev = pf->cinst;
383382

384383
/* If we're down or resetting, just bail */
@@ -459,7 +458,7 @@ int i40e_lan_add_device(struct i40e_pf *pf)
459458
* added, we can schedule a subtask to go initiate the clients if
460459
* they can be launched at probe time.
461460
*/
462-
pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED;
461+
set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);
463462
i40e_service_event_schedule(pf);
464463

465464
out:
@@ -554,7 +553,7 @@ static void i40e_client_prepare(struct i40e_client *client)
554553
pf = ldev->pf;
555554
i40e_client_add_instance(pf);
556555
/* Start the client subtask */
557-
pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED;
556+
set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);
558557
i40e_service_event_schedule(pf);
559558
}
560559
mutex_unlock(&i40e_device_mutex);

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,8 +2634,8 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu)
26342634
netdev->mtu = new_mtu;
26352635
if (netif_running(netdev))
26362636
i40e_vsi_reinit_locked(vsi);
2637-
pf->flags |= (I40E_FLAG_SERVICE_CLIENT_REQUESTED |
2638-
I40E_FLAG_CLIENT_L2_CHANGE);
2637+
set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);
2638+
set_bit(__I40E_CLIENT_L2_CHANGE, pf->state);
26392639
return 0;
26402640
}
26412641

@@ -4722,9 +4722,9 @@ static void i40e_vsi_close(struct i40e_vsi *vsi)
47224722
i40e_vsi_free_tx_resources(vsi);
47234723
i40e_vsi_free_rx_resources(vsi);
47244724
vsi->current_netdev_flags = 0;
4725-
pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED;
4725+
set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);
47264726
if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))
4727-
pf->flags |= I40E_FLAG_CLIENT_RESET;
4727+
set_bit(__I40E_CLIENT_RESET, pf->state);
47284728
}
47294729

47304730
/**
@@ -6495,7 +6495,7 @@ static int i40e_up_complete(struct i40e_vsi *vsi)
64956495
/* On the next run of the service_task, notify any clients of the new
64966496
* opened netdev
64976497
*/
6498-
pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED;
6498+
set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);
64996499
i40e_service_event_schedule(pf);
65006500

65016501
return 0;
@@ -8037,8 +8037,8 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,
80378037
i40e_service_event_schedule(pf);
80388038
} else {
80398039
i40e_pf_unquiesce_all_vsi(pf);
8040-
pf->flags |= (I40E_FLAG_SERVICE_CLIENT_REQUESTED |
8041-
I40E_FLAG_CLIENT_L2_CHANGE);
8040+
set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);
8041+
set_bit(__I40E_CLIENT_L2_CHANGE, pf->state);
80428042
}
80438043

80448044
exit:
@@ -9785,17 +9785,15 @@ static void i40e_service_task(struct work_struct *work)
97859785
i40e_vc_process_vflr_event(pf);
97869786
i40e_watchdog_subtask(pf);
97879787
i40e_fdir_reinit_subtask(pf);
9788-
if (pf->flags & I40E_FLAG_CLIENT_RESET) {
9788+
if (test_and_clear_bit(__I40E_CLIENT_RESET, pf->state)) {
97899789
/* Client subtask will reopen next time through. */
97909790
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], true);
9791-
pf->flags &= ~I40E_FLAG_CLIENT_RESET;
97929791
} else {
97939792
i40e_client_subtask(pf);
9794-
if (pf->flags & I40E_FLAG_CLIENT_L2_CHANGE) {
9793+
if (test_and_clear_bit(__I40E_CLIENT_L2_CHANGE,
9794+
pf->state))
97959795
i40e_notify_client_of_l2_param_changes(
97969796
pf->vsi[pf->lan_vsi]);
9797-
pf->flags &= ~I40E_FLAG_CLIENT_L2_CHANGE;
9798-
}
97999797
}
98009798
i40e_sync_filters_subtask(pf);
98019799
i40e_sync_udp_filters_subtask(pf);

0 commit comments

Comments
 (0)