Skip to content

Commit e872469

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2024-02-20 (ice) This series contains updates to ice driver only. Yochai sets parent device to properly reflect connection state between source DPLL and output pin. Arkadiusz fixes additional issues related to DPLL; proper reporting of phase_adjust value and preventing use/access of data while resetting. Amritha resolves ASSERT_RTNL() being triggered on certain reset/rebuild flows. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: Fix ASSERT_RTNL() warning during certain scenarios ice: fix pin phase adjust updates on PF reset ice: fix dpll periodic work data updates on PF reset ice: fix dpll and dpll_pin data access on PF reset ice: fix dpll input pin phase_adjust value updates ice: fix connection state of DPLL and out pin ==================== Reviewed-by: Vadim Fedorenko <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 5ae1e99 + 080b0c8 commit e872469

File tree

5 files changed

+161
-39
lines changed

5 files changed

+161
-39
lines changed

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,13 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
190190
q_vector = vsi->q_vectors[v_idx];
191191

192192
ice_for_each_tx_ring(tx_ring, q_vector->tx) {
193-
if (vsi->netdev)
194-
netif_queue_set_napi(vsi->netdev, tx_ring->q_index,
195-
NETDEV_QUEUE_TYPE_TX, NULL);
193+
ice_queue_set_napi(vsi, tx_ring->q_index, NETDEV_QUEUE_TYPE_TX,
194+
NULL);
196195
tx_ring->q_vector = NULL;
197196
}
198197
ice_for_each_rx_ring(rx_ring, q_vector->rx) {
199-
if (vsi->netdev)
200-
netif_queue_set_napi(vsi->netdev, rx_ring->q_index,
201-
NETDEV_QUEUE_TYPE_RX, NULL);
198+
ice_queue_set_napi(vsi, rx_ring->q_index, NETDEV_QUEUE_TYPE_RX,
199+
NULL);
202200
rx_ring->q_vector = NULL;
203201
}
204202

drivers/net/ethernet/intel/ice/ice_dpll.c

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ static const char * const pin_type_name[] = {
3030
[ICE_DPLL_PIN_TYPE_RCLK_INPUT] = "rclk-input",
3131
};
3232

33+
/**
34+
* ice_dpll_is_reset - check if reset is in progress
35+
* @pf: private board structure
36+
* @extack: error reporting
37+
*
38+
* If reset is in progress, fill extack with error.
39+
*
40+
* Return:
41+
* * false - no reset in progress
42+
* * true - reset in progress
43+
*/
44+
static bool ice_dpll_is_reset(struct ice_pf *pf, struct netlink_ext_ack *extack)
45+
{
46+
if (ice_is_reset_in_progress(pf->state)) {
47+
NL_SET_ERR_MSG(extack, "PF reset in progress");
48+
return true;
49+
}
50+
return false;
51+
}
52+
3353
/**
3454
* ice_dpll_pin_freq_set - set pin's frequency
3555
* @pf: private board structure
@@ -109,6 +129,9 @@ ice_dpll_frequency_set(const struct dpll_pin *pin, void *pin_priv,
109129
struct ice_pf *pf = d->pf;
110130
int ret;
111131

132+
if (ice_dpll_is_reset(pf, extack))
133+
return -EBUSY;
134+
112135
mutex_lock(&pf->dplls.lock);
113136
ret = ice_dpll_pin_freq_set(pf, p, pin_type, frequency, extack);
114137
mutex_unlock(&pf->dplls.lock);
@@ -254,6 +277,7 @@ ice_dpll_output_frequency_get(const struct dpll_pin *pin, void *pin_priv,
254277
* ice_dpll_pin_enable - enable a pin on dplls
255278
* @hw: board private hw structure
256279
* @pin: pointer to a pin
280+
* @dpll_idx: dpll index to connect to output pin
257281
* @pin_type: type of pin being enabled
258282
* @extack: error reporting
259283
*
@@ -266,7 +290,7 @@ ice_dpll_output_frequency_get(const struct dpll_pin *pin, void *pin_priv,
266290
*/
267291
static int
268292
ice_dpll_pin_enable(struct ice_hw *hw, struct ice_dpll_pin *pin,
269-
enum ice_dpll_pin_type pin_type,
293+
u8 dpll_idx, enum ice_dpll_pin_type pin_type,
270294
struct netlink_ext_ack *extack)
271295
{
272296
u8 flags = 0;
@@ -280,10 +304,12 @@ ice_dpll_pin_enable(struct ice_hw *hw, struct ice_dpll_pin *pin,
280304
ret = ice_aq_set_input_pin_cfg(hw, pin->idx, 0, flags, 0, 0);
281305
break;
282306
case ICE_DPLL_PIN_TYPE_OUTPUT:
307+
flags = ICE_AQC_SET_CGU_OUT_CFG_UPDATE_SRC_SEL;
283308
if (pin->flags[0] & ICE_AQC_GET_CGU_OUT_CFG_ESYNC_EN)
284309
flags |= ICE_AQC_SET_CGU_OUT_CFG_ESYNC_EN;
285310
flags |= ICE_AQC_SET_CGU_OUT_CFG_OUT_EN;
286-
ret = ice_aq_set_output_pin_cfg(hw, pin->idx, flags, 0, 0, 0);
311+
ret = ice_aq_set_output_pin_cfg(hw, pin->idx, flags, dpll_idx,
312+
0, 0);
287313
break;
288314
default:
289315
return -EINVAL;
@@ -370,7 +396,7 @@ ice_dpll_pin_state_update(struct ice_pf *pf, struct ice_dpll_pin *pin,
370396
case ICE_DPLL_PIN_TYPE_INPUT:
371397
ret = ice_aq_get_input_pin_cfg(&pf->hw, pin->idx, NULL, NULL,
372398
NULL, &pin->flags[0],
373-
&pin->freq, NULL);
399+
&pin->freq, &pin->phase_adjust);
374400
if (ret)
375401
goto err;
376402
if (ICE_AQC_GET_CGU_IN_CFG_FLG2_INPUT_EN & pin->flags[0]) {
@@ -398,14 +424,27 @@ ice_dpll_pin_state_update(struct ice_pf *pf, struct ice_dpll_pin *pin,
398424
break;
399425
case ICE_DPLL_PIN_TYPE_OUTPUT:
400426
ret = ice_aq_get_output_pin_cfg(&pf->hw, pin->idx,
401-
&pin->flags[0], NULL,
427+
&pin->flags[0], &parent,
402428
&pin->freq, NULL);
403429
if (ret)
404430
goto err;
405-
if (ICE_AQC_SET_CGU_OUT_CFG_OUT_EN & pin->flags[0])
406-
pin->state[0] = DPLL_PIN_STATE_CONNECTED;
407-
else
408-
pin->state[0] = DPLL_PIN_STATE_DISCONNECTED;
431+
432+
parent &= ICE_AQC_GET_CGU_OUT_CFG_DPLL_SRC_SEL;
433+
if (ICE_AQC_SET_CGU_OUT_CFG_OUT_EN & pin->flags[0]) {
434+
pin->state[pf->dplls.eec.dpll_idx] =
435+
parent == pf->dplls.eec.dpll_idx ?
436+
DPLL_PIN_STATE_CONNECTED :
437+
DPLL_PIN_STATE_DISCONNECTED;
438+
pin->state[pf->dplls.pps.dpll_idx] =
439+
parent == pf->dplls.pps.dpll_idx ?
440+
DPLL_PIN_STATE_CONNECTED :
441+
DPLL_PIN_STATE_DISCONNECTED;
442+
} else {
443+
pin->state[pf->dplls.eec.dpll_idx] =
444+
DPLL_PIN_STATE_DISCONNECTED;
445+
pin->state[pf->dplls.pps.dpll_idx] =
446+
DPLL_PIN_STATE_DISCONNECTED;
447+
}
409448
break;
410449
case ICE_DPLL_PIN_TYPE_RCLK_INPUT:
411450
for (parent = 0; parent < pf->dplls.rclk.num_parents;
@@ -568,9 +607,13 @@ ice_dpll_pin_state_set(const struct dpll_pin *pin, void *pin_priv,
568607
struct ice_pf *pf = d->pf;
569608
int ret;
570609

610+
if (ice_dpll_is_reset(pf, extack))
611+
return -EBUSY;
612+
571613
mutex_lock(&pf->dplls.lock);
572614
if (enable)
573-
ret = ice_dpll_pin_enable(&pf->hw, p, pin_type, extack);
615+
ret = ice_dpll_pin_enable(&pf->hw, p, d->dpll_idx, pin_type,
616+
extack);
574617
else
575618
ret = ice_dpll_pin_disable(&pf->hw, p, pin_type, extack);
576619
if (!ret)
@@ -603,6 +646,11 @@ ice_dpll_output_state_set(const struct dpll_pin *pin, void *pin_priv,
603646
struct netlink_ext_ack *extack)
604647
{
605648
bool enable = state == DPLL_PIN_STATE_CONNECTED;
649+
struct ice_dpll_pin *p = pin_priv;
650+
struct ice_dpll *d = dpll_priv;
651+
652+
if (!enable && p->state[d->dpll_idx] == DPLL_PIN_STATE_DISCONNECTED)
653+
return 0;
606654

607655
return ice_dpll_pin_state_set(pin, pin_priv, dpll, dpll_priv, enable,
608656
extack, ICE_DPLL_PIN_TYPE_OUTPUT);
@@ -665,14 +713,16 @@ ice_dpll_pin_state_get(const struct dpll_pin *pin, void *pin_priv,
665713
struct ice_pf *pf = d->pf;
666714
int ret;
667715

716+
if (ice_dpll_is_reset(pf, extack))
717+
return -EBUSY;
718+
668719
mutex_lock(&pf->dplls.lock);
669720
ret = ice_dpll_pin_state_update(pf, p, pin_type, extack);
670721
if (ret)
671722
goto unlock;
672-
if (pin_type == ICE_DPLL_PIN_TYPE_INPUT)
723+
if (pin_type == ICE_DPLL_PIN_TYPE_INPUT ||
724+
pin_type == ICE_DPLL_PIN_TYPE_OUTPUT)
673725
*state = p->state[d->dpll_idx];
674-
else if (pin_type == ICE_DPLL_PIN_TYPE_OUTPUT)
675-
*state = p->state[0];
676726
ret = 0;
677727
unlock:
678728
mutex_unlock(&pf->dplls.lock);
@@ -790,6 +840,9 @@ ice_dpll_input_prio_set(const struct dpll_pin *pin, void *pin_priv,
790840
struct ice_pf *pf = d->pf;
791841
int ret;
792842

843+
if (ice_dpll_is_reset(pf, extack))
844+
return -EBUSY;
845+
793846
mutex_lock(&pf->dplls.lock);
794847
ret = ice_dpll_hw_input_prio_set(pf, d, p, prio, extack);
795848
mutex_unlock(&pf->dplls.lock);
@@ -910,6 +963,9 @@ ice_dpll_pin_phase_adjust_set(const struct dpll_pin *pin, void *pin_priv,
910963
u8 flag, flags_en = 0;
911964
int ret;
912965

966+
if (ice_dpll_is_reset(pf, extack))
967+
return -EBUSY;
968+
913969
mutex_lock(&pf->dplls.lock);
914970
switch (type) {
915971
case ICE_DPLL_PIN_TYPE_INPUT:
@@ -1069,6 +1125,9 @@ ice_dpll_rclk_state_on_pin_set(const struct dpll_pin *pin, void *pin_priv,
10691125
int ret = -EINVAL;
10701126
u32 hw_idx;
10711127

1128+
if (ice_dpll_is_reset(pf, extack))
1129+
return -EBUSY;
1130+
10721131
mutex_lock(&pf->dplls.lock);
10731132
hw_idx = parent->idx - pf->dplls.base_rclk_idx;
10741133
if (hw_idx >= pf->dplls.num_inputs)
@@ -1123,6 +1182,9 @@ ice_dpll_rclk_state_on_pin_get(const struct dpll_pin *pin, void *pin_priv,
11231182
int ret = -EINVAL;
11241183
u32 hw_idx;
11251184

1185+
if (ice_dpll_is_reset(pf, extack))
1186+
return -EBUSY;
1187+
11261188
mutex_lock(&pf->dplls.lock);
11271189
hw_idx = parent->idx - pf->dplls.base_rclk_idx;
11281190
if (hw_idx >= pf->dplls.num_inputs)
@@ -1305,8 +1367,10 @@ static void ice_dpll_periodic_work(struct kthread_work *work)
13051367
struct ice_pf *pf = container_of(d, struct ice_pf, dplls);
13061368
struct ice_dpll *de = &pf->dplls.eec;
13071369
struct ice_dpll *dp = &pf->dplls.pps;
1308-
int ret;
1370+
int ret = 0;
13091371

1372+
if (ice_is_reset_in_progress(pf->state))
1373+
goto resched;
13101374
mutex_lock(&pf->dplls.lock);
13111375
ret = ice_dpll_update_state(pf, de, false);
13121376
if (!ret)
@@ -1326,6 +1390,7 @@ static void ice_dpll_periodic_work(struct kthread_work *work)
13261390
ice_dpll_notify_changes(de);
13271391
ice_dpll_notify_changes(dp);
13281392

1393+
resched:
13291394
/* Run twice a second or reschedule if update failed */
13301395
kthread_queue_delayed_work(d->kworker, &d->work,
13311396
ret ? msecs_to_jiffies(10) :

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,7 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params)
24262426
ice_vsi_map_rings_to_vectors(vsi);
24272427

24282428
/* Associate q_vector rings to napi */
2429-
ice_vsi_set_napi_queues(vsi, true);
2429+
ice_vsi_set_napi_queues(vsi);
24302430

24312431
vsi->stat_offsets_loaded = false;
24322432

@@ -2904,19 +2904,19 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi)
29042904
}
29052905

29062906
/**
2907-
* ice_queue_set_napi - Set the napi instance for the queue
2907+
* __ice_queue_set_napi - Set the napi instance for the queue
29082908
* @dev: device to which NAPI and queue belong
29092909
* @queue_index: Index of queue
29102910
* @type: queue type as RX or TX
29112911
* @napi: NAPI context
29122912
* @locked: is the rtnl_lock already held
29132913
*
2914-
* Set the napi instance for the queue
2914+
* Set the napi instance for the queue. Caller indicates the lock status.
29152915
*/
29162916
static void
2917-
ice_queue_set_napi(struct net_device *dev, unsigned int queue_index,
2918-
enum netdev_queue_type type, struct napi_struct *napi,
2919-
bool locked)
2917+
__ice_queue_set_napi(struct net_device *dev, unsigned int queue_index,
2918+
enum netdev_queue_type type, struct napi_struct *napi,
2919+
bool locked)
29202920
{
29212921
if (!locked)
29222922
rtnl_lock();
@@ -2926,46 +2926,98 @@ ice_queue_set_napi(struct net_device *dev, unsigned int queue_index,
29262926
}
29272927

29282928
/**
2929-
* ice_q_vector_set_napi_queues - Map queue[s] associated with the napi
2929+
* ice_queue_set_napi - Set the napi instance for the queue
2930+
* @vsi: VSI being configured
2931+
* @queue_index: Index of queue
2932+
* @type: queue type as RX or TX
2933+
* @napi: NAPI context
2934+
*
2935+
* Set the napi instance for the queue. The rtnl lock state is derived from the
2936+
* execution path.
2937+
*/
2938+
void
2939+
ice_queue_set_napi(struct ice_vsi *vsi, unsigned int queue_index,
2940+
enum netdev_queue_type type, struct napi_struct *napi)
2941+
{
2942+
struct ice_pf *pf = vsi->back;
2943+
2944+
if (!vsi->netdev)
2945+
return;
2946+
2947+
if (current_work() == &pf->serv_task ||
2948+
test_bit(ICE_PREPARED_FOR_RESET, pf->state) ||
2949+
test_bit(ICE_DOWN, pf->state) ||
2950+
test_bit(ICE_SUSPENDED, pf->state))
2951+
__ice_queue_set_napi(vsi->netdev, queue_index, type, napi,
2952+
false);
2953+
else
2954+
__ice_queue_set_napi(vsi->netdev, queue_index, type, napi,
2955+
true);
2956+
}
2957+
2958+
/**
2959+
* __ice_q_vector_set_napi_queues - Map queue[s] associated with the napi
29302960
* @q_vector: q_vector pointer
29312961
* @locked: is the rtnl_lock already held
29322962
*
2963+
* Associate the q_vector napi with all the queue[s] on the vector.
2964+
* Caller indicates the lock status.
2965+
*/
2966+
void __ice_q_vector_set_napi_queues(struct ice_q_vector *q_vector, bool locked)
2967+
{
2968+
struct ice_rx_ring *rx_ring;
2969+
struct ice_tx_ring *tx_ring;
2970+
2971+
ice_for_each_rx_ring(rx_ring, q_vector->rx)
2972+
__ice_queue_set_napi(q_vector->vsi->netdev, rx_ring->q_index,
2973+
NETDEV_QUEUE_TYPE_RX, &q_vector->napi,
2974+
locked);
2975+
2976+
ice_for_each_tx_ring(tx_ring, q_vector->tx)
2977+
__ice_queue_set_napi(q_vector->vsi->netdev, tx_ring->q_index,
2978+
NETDEV_QUEUE_TYPE_TX, &q_vector->napi,
2979+
locked);
2980+
/* Also set the interrupt number for the NAPI */
2981+
netif_napi_set_irq(&q_vector->napi, q_vector->irq.virq);
2982+
}
2983+
2984+
/**
2985+
* ice_q_vector_set_napi_queues - Map queue[s] associated with the napi
2986+
* @q_vector: q_vector pointer
2987+
*
29332988
* Associate the q_vector napi with all the queue[s] on the vector
29342989
*/
2935-
void ice_q_vector_set_napi_queues(struct ice_q_vector *q_vector, bool locked)
2990+
void ice_q_vector_set_napi_queues(struct ice_q_vector *q_vector)
29362991
{
29372992
struct ice_rx_ring *rx_ring;
29382993
struct ice_tx_ring *tx_ring;
29392994

29402995
ice_for_each_rx_ring(rx_ring, q_vector->rx)
2941-
ice_queue_set_napi(q_vector->vsi->netdev, rx_ring->q_index,
2942-
NETDEV_QUEUE_TYPE_RX, &q_vector->napi,
2943-
locked);
2996+
ice_queue_set_napi(q_vector->vsi, rx_ring->q_index,
2997+
NETDEV_QUEUE_TYPE_RX, &q_vector->napi);
29442998

29452999
ice_for_each_tx_ring(tx_ring, q_vector->tx)
2946-
ice_queue_set_napi(q_vector->vsi->netdev, tx_ring->q_index,
2947-
NETDEV_QUEUE_TYPE_TX, &q_vector->napi,
2948-
locked);
3000+
ice_queue_set_napi(q_vector->vsi, tx_ring->q_index,
3001+
NETDEV_QUEUE_TYPE_TX, &q_vector->napi);
29493002
/* Also set the interrupt number for the NAPI */
29503003
netif_napi_set_irq(&q_vector->napi, q_vector->irq.virq);
29513004
}
29523005

29533006
/**
29543007
* ice_vsi_set_napi_queues
29553008
* @vsi: VSI pointer
2956-
* @locked: is the rtnl_lock already held
29573009
*
29583010
* Associate queue[s] with napi for all vectors
29593011
*/
2960-
void ice_vsi_set_napi_queues(struct ice_vsi *vsi, bool locked)
3012+
void ice_vsi_set_napi_queues(struct ice_vsi *vsi)
29613013
{
29623014
int i;
29633015

29643016
if (!vsi->netdev)
29653017
return;
29663018

29673019
ice_for_each_q_vector(vsi, i)
2968-
ice_q_vector_set_napi_queues(vsi->q_vectors[i], locked);
3020+
ice_q_vector_set_napi_queues(vsi->q_vectors[i]);
29693021
}
29703022

29713023
/**

drivers/net/ethernet/intel/ice/ice_lib.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,15 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc);
9191
struct ice_vsi *
9292
ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params);
9393

94-
void ice_q_vector_set_napi_queues(struct ice_q_vector *q_vector, bool locked);
94+
void
95+
ice_queue_set_napi(struct ice_vsi *vsi, unsigned int queue_index,
96+
enum netdev_queue_type type, struct napi_struct *napi);
97+
98+
void __ice_q_vector_set_napi_queues(struct ice_q_vector *q_vector, bool locked);
99+
100+
void ice_q_vector_set_napi_queues(struct ice_q_vector *q_vector);
95101

96-
void ice_vsi_set_napi_queues(struct ice_vsi *vsi, bool locked);
102+
void ice_vsi_set_napi_queues(struct ice_vsi *vsi);
97103

98104
int ice_vsi_release(struct ice_vsi *vsi);
99105

0 commit comments

Comments
 (0)