Skip to content

Commit 4f4be03

Browse files
refactormanJeff Kirsher
authored andcommitted
ice: Poll for link status change
When the physical link goes up or down, the driver is supposed to receive a link status event (LSE). The driver currently has the code to handle LSEs but there is no firmware support for this feature yet. So this patch adds the ability for the driver to poll for link status changes. The polling itself is done in ice_watchdog_subtask. For namespace cleanliness, this patch also removes code that handles LSE. This code will be reintroduced once the feature is officially supported. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 982b121 commit 4f4be03

3 files changed

Lines changed: 25 additions & 120 deletions

File tree

‎drivers/net/ethernet/intel/ice/ice_common.c‎

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi)
235235
*
236236
* Get Link Status (0x607). Returns the link status of the adapter.
237237
*/
238-
enum ice_status
238+
static enum ice_status
239239
ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
240240
struct ice_link_status *link, struct ice_sq_cd *cd)
241241
{
@@ -2004,33 +2004,6 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
20042004
return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
20052005
}
20062006

2007-
/**
2008-
* ice_aq_set_event_mask
2009-
* @hw: pointer to the hw struct
2010-
* @port_num: port number of the physical function
2011-
* @mask: event mask to be set
2012-
* @cd: pointer to command details structure or NULL
2013-
*
2014-
* Set event mask (0x0613)
2015-
*/
2016-
enum ice_status
2017-
ice_aq_set_event_mask(struct ice_hw *hw, u8 port_num, u16 mask,
2018-
struct ice_sq_cd *cd)
2019-
{
2020-
struct ice_aqc_set_event_mask *cmd;
2021-
struct ice_aq_desc desc;
2022-
2023-
cmd = &desc.params.set_event_mask;
2024-
2025-
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_event_mask);
2026-
2027-
cmd->lport_num = port_num;
2028-
2029-
cmd->event_mask = cpu_to_le16(mask);
2030-
2031-
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
2032-
}
2033-
20342007
/**
20352008
* __ice_aq_get_set_rss_lut
20362009
* @hw: pointer to the hardware structure

‎drivers/net/ethernet/intel/ice/ice_common.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ enum ice_status
8686
ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
8787
struct ice_sq_cd *cd);
8888
enum ice_status
89-
ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
90-
struct ice_link_status *link, struct ice_sq_cd *cd);
91-
enum ice_status
92-
ice_aq_set_event_mask(struct ice_hw *hw, u8 port_num, u16 mask,
93-
struct ice_sq_cd *cd);
94-
enum ice_status
9589
ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,
9690
u32 *q_teids, enum ice_disq_rst_src rst_src, u16 vmvf_num,
9791
struct ice_sq_cd *cmd_details);

‎drivers/net/ethernet/intel/ice/ice_main.c‎

Lines changed: 24 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -456,35 +456,6 @@ static void ice_reset_subtask(struct ice_pf *pf)
456456
}
457457
}
458458

459-
/**
460-
* ice_watchdog_subtask - periodic tasks not using event driven scheduling
461-
* @pf: board private structure
462-
*/
463-
static void ice_watchdog_subtask(struct ice_pf *pf)
464-
{
465-
int i;
466-
467-
/* if interface is down do nothing */
468-
if (test_bit(__ICE_DOWN, pf->state) ||
469-
test_bit(__ICE_CFG_BUSY, pf->state))
470-
return;
471-
472-
/* make sure we don't do these things too often */
473-
if (time_before(jiffies,
474-
pf->serv_tmr_prev + pf->serv_tmr_period))
475-
return;
476-
477-
pf->serv_tmr_prev = jiffies;
478-
479-
/* Update the stats for active netdevs so the network stack
480-
* can look at updated numbers whenever it cares to
481-
*/
482-
ice_update_pf_stats(pf);
483-
for (i = 0; i < pf->num_alloc_vsi; i++)
484-
if (pf->vsi[i] && pf->vsi[i]->netdev)
485-
ice_update_vsi_stats(pf->vsi[i]);
486-
}
487-
488459
/**
489460
* ice_print_link_msg - print link up or down message
490461
* @vsi: the VSI whose link status is being queried
@@ -554,36 +525,6 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup)
554525
speed, fc);
555526
}
556527

557-
/**
558-
* ice_init_link_events - enable/initialize link events
559-
* @pi: pointer to the port_info instance
560-
*
561-
* Returns -EIO on failure, 0 on success
562-
*/
563-
static int ice_init_link_events(struct ice_port_info *pi)
564-
{
565-
u16 mask;
566-
567-
mask = ~((u16)(ICE_AQ_LINK_EVENT_UPDOWN | ICE_AQ_LINK_EVENT_MEDIA_NA |
568-
ICE_AQ_LINK_EVENT_MODULE_QUAL_FAIL));
569-
570-
if (ice_aq_set_event_mask(pi->hw, pi->lport, mask, NULL)) {
571-
dev_dbg(ice_hw_to_dev(pi->hw),
572-
"Failed to set link event mask for port %d\n",
573-
pi->lport);
574-
return -EIO;
575-
}
576-
577-
if (ice_aq_get_link_info(pi, true, NULL, NULL)) {
578-
dev_dbg(ice_hw_to_dev(pi->hw),
579-
"Failed to enable link events for port %d\n",
580-
pi->lport);
581-
return -EIO;
582-
}
583-
584-
return 0;
585-
}
586-
587528
/**
588529
* ice_vsi_link_event - update the vsi's netdev
589530
* @vsi: the vsi on which the link event occurred
@@ -671,27 +612,35 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi)
671612
}
672613

673614
/**
674-
* ice_handle_link_event - handle link event via ARQ
675-
* @pf: pf that the link event is associated with
676-
*
677-
* Return -EINVAL if port_info is null
678-
* Return status on succes
615+
* ice_watchdog_subtask - periodic tasks not using event driven scheduling
616+
* @pf: board private structure
679617
*/
680-
static int ice_handle_link_event(struct ice_pf *pf)
618+
static void ice_watchdog_subtask(struct ice_pf *pf)
681619
{
682-
struct ice_port_info *port_info;
683-
int status;
620+
int i;
684621

685-
port_info = pf->hw.port_info;
686-
if (!port_info)
687-
return -EINVAL;
622+
/* if interface is down do nothing */
623+
if (test_bit(__ICE_DOWN, pf->state) ||
624+
test_bit(__ICE_CFG_BUSY, pf->state))
625+
return;
688626

689-
status = ice_link_event(pf, port_info);
690-
if (status)
691-
dev_dbg(&pf->pdev->dev,
692-
"Could not process link event, error %d\n", status);
627+
/* make sure we don't do these things too often */
628+
if (time_before(jiffies,
629+
pf->serv_tmr_prev + pf->serv_tmr_period))
630+
return;
693631

694-
return status;
632+
pf->serv_tmr_prev = jiffies;
633+
634+
if (ice_link_event(pf, pf->hw.port_info))
635+
dev_dbg(&pf->pdev->dev, "ice_link_event failed\n");
636+
637+
/* Update the stats for active netdevs so the network stack
638+
* can look at updated numbers whenever it cares to
639+
*/
640+
ice_update_pf_stats(pf);
641+
for (i = 0; i < pf->num_alloc_vsi; i++)
642+
if (pf->vsi[i] && pf->vsi[i]->netdev)
643+
ice_update_vsi_stats(pf->vsi[i]);
695644
}
696645

697646
/**
@@ -797,11 +746,6 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
797746
opcode = le16_to_cpu(event.desc.opcode);
798747

799748
switch (opcode) {
800-
case ice_aqc_opc_get_link_status:
801-
if (ice_handle_link_event(pf))
802-
dev_err(&pf->pdev->dev,
803-
"Could not handle link event\n");
804-
break;
805749
case ice_mbx_opc_send_msg_to_pf:
806750
ice_vc_process_vf_msg(pf, &event);
807751
break;
@@ -2207,12 +2151,6 @@ static int ice_probe(struct pci_dev *pdev,
22072151
/* since everything is good, start the service timer */
22082152
mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period));
22092153

2210-
err = ice_init_link_events(pf->hw.port_info);
2211-
if (err) {
2212-
dev_err(&pdev->dev, "ice_init_link_events failed: %d\n", err);
2213-
goto err_alloc_sw_unroll;
2214-
}
2215-
22162154
return 0;
22172155

22182156
err_alloc_sw_unroll:

0 commit comments

Comments
 (0)