aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_common.c
diff options
context:
space:
mode:
authorAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>2018-03-20 10:58:18 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-03-26 15:32:17 -0400
commit0b28b702e72a6ff90d417689159f72e8891fed78 (patch)
tree20244773c6ec798142587a77116c1f20148703f1 /drivers/net/ethernet/intel/ice/ice_common.c
parent5513b920a4f7869acffc8e6d800aebee608409e0 (diff)
ice: Support link events, reset and rebuild
Link events are posted to a PF's admin receive queue (ARQ). This patch adds the ability to detect and process link events. This patch also adds the ability to process resets. The driver can process the following resets: 1) EMP Reset (EMPR) 2) Global Reset (GLOBR) 3) Core Reset (CORER) 4) Physical Function Reset (PFR) EMPR is the largest level of reset that the driver can handle. An EMPR resets the manageability block and also the data path, including PHY and link for all the PFs. The affected PFs are notified of this event through a miscellaneous interrupt. GLOBR is a subset of EMPR. It does everything EMPR does except that it doesn't reset the manageability block. CORER is a subset of GLOBR. It does everything GLOBR does but doesn't reset PHY and link. PFR is a subset of CORER and affects only the given physical function. In other words, PFR can be thought of as a CORER for a single PF. Since only the issuing PF is affected, a PFR doesn't result in the miscellaneous interrupt being triggered. All the resets have the following in common: 1) Tx/Rx is halted and all queues are stopped. 2) All the VSIs and filters programmed for the PF are lost and have to be reprogrammed. 3) Control queue interfaces are reset and have to be reprogrammed. In the rebuild flow, control queues are reinitialized, VSIs are reallocated and filters are restored. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Tony Brelinski <tonyx.brelinski@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_common.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_common.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 0ab9bf66c84e..791f1eba5953 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1428,6 +1428,39 @@ out:
1428} 1428}
1429 1429
1430/** 1430/**
1431 * ice_get_link_status - get status of the HW network link
1432 * @pi: port information structure
1433 * @link_up: pointer to bool (true/false = linkup/linkdown)
1434 *
1435 * Variable link_up is true if link is up, false if link is down.
1436 * The variable link_up is invalid if status is non zero. As a
1437 * result of this call, link status reporting becomes enabled
1438 */
1439enum ice_status ice_get_link_status(struct ice_port_info *pi, bool *link_up)
1440{
1441 struct ice_phy_info *phy_info;
1442 enum ice_status status = 0;
1443
1444 if (!pi)
1445 return ICE_ERR_PARAM;
1446
1447 phy_info = &pi->phy;
1448
1449 if (phy_info->get_link_info) {
1450 status = ice_update_link_info(pi);
1451
1452 if (status)
1453 ice_debug(pi->hw, ICE_DBG_LINK,
1454 "get link status error, status = %d\n",
1455 status);
1456 }
1457
1458 *link_up = phy_info->link_info.link_info & ICE_AQ_LINK_UP;
1459
1460 return status;
1461}
1462
1463/**
1431 * ice_aq_set_link_restart_an 1464 * ice_aq_set_link_restart_an
1432 * @pi: pointer to the port information structure 1465 * @pi: pointer to the port information structure
1433 * @ena_link: if true: enable link, if false: disable link 1466 * @ena_link: if true: enable link, if false: disable link
@@ -1457,6 +1490,33 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
1457} 1490}
1458 1491
1459/** 1492/**
1493 * ice_aq_set_event_mask
1494 * @hw: pointer to the hw struct
1495 * @port_num: port number of the physical function
1496 * @mask: event mask to be set
1497 * @cd: pointer to command details structure or NULL
1498 *
1499 * Set event mask (0x0613)
1500 */
1501enum ice_status
1502ice_aq_set_event_mask(struct ice_hw *hw, u8 port_num, u16 mask,
1503 struct ice_sq_cd *cd)
1504{
1505 struct ice_aqc_set_event_mask *cmd;
1506 struct ice_aq_desc desc;
1507
1508 cmd = &desc.params.set_event_mask;
1509
1510 ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_event_mask);
1511
1512 cmd->lport_num = port_num;
1513
1514 cmd->event_mask = cpu_to_le16(mask);
1515
1516 return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
1517}
1518
1519/**
1460 * __ice_aq_get_set_rss_lut 1520 * __ice_aq_get_set_rss_lut
1461 * @hw: pointer to the hardware structure 1521 * @hw: pointer to the hardware structure
1462 * @vsi_id: VSI FW index 1522 * @vsi_id: VSI FW index