diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 86 |
1 files changed, 48 insertions, 38 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 05993451147a..333312a1d595 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
@@ -1465,7 +1465,7 @@ skip_req_irq: | |||
1465 | * ice_napi_del - Remove NAPI handler for the VSI | 1465 | * ice_napi_del - Remove NAPI handler for the VSI |
1466 | * @vsi: VSI for which NAPI handler is to be removed | 1466 | * @vsi: VSI for which NAPI handler is to be removed |
1467 | */ | 1467 | */ |
1468 | static void ice_napi_del(struct ice_vsi *vsi) | 1468 | void ice_napi_del(struct ice_vsi *vsi) |
1469 | { | 1469 | { |
1470 | int v_idx; | 1470 | int v_idx; |
1471 | 1471 | ||
@@ -1622,7 +1622,6 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, | |||
1622 | { | 1622 | { |
1623 | struct ice_netdev_priv *np = netdev_priv(netdev); | 1623 | struct ice_netdev_priv *np = netdev_priv(netdev); |
1624 | struct ice_vsi *vsi = np->vsi; | 1624 | struct ice_vsi *vsi = np->vsi; |
1625 | int ret; | ||
1626 | 1625 | ||
1627 | if (vid >= VLAN_N_VID) { | 1626 | if (vid >= VLAN_N_VID) { |
1628 | netdev_err(netdev, "VLAN id requested %d is out of range %d\n", | 1627 | netdev_err(netdev, "VLAN id requested %d is out of range %d\n", |
@@ -1635,7 +1634,8 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, | |||
1635 | 1634 | ||
1636 | /* Enable VLAN pruning when VLAN 0 is added */ | 1635 | /* Enable VLAN pruning when VLAN 0 is added */ |
1637 | if (unlikely(!vid)) { | 1636 | if (unlikely(!vid)) { |
1638 | ret = ice_cfg_vlan_pruning(vsi, true); | 1637 | int ret = ice_cfg_vlan_pruning(vsi, true); |
1638 | |||
1639 | if (ret) | 1639 | if (ret) |
1640 | return ret; | 1640 | return ret; |
1641 | } | 1641 | } |
@@ -1644,12 +1644,7 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, | |||
1644 | * needed to continue allowing all untagged packets since VLAN prune | 1644 | * needed to continue allowing all untagged packets since VLAN prune |
1645 | * list is applied to all packets by the switch | 1645 | * list is applied to all packets by the switch |
1646 | */ | 1646 | */ |
1647 | ret = ice_vsi_add_vlan(vsi, vid); | 1647 | return ice_vsi_add_vlan(vsi, vid); |
1648 | |||
1649 | if (!ret) | ||
1650 | set_bit(vid, vsi->active_vlans); | ||
1651 | |||
1652 | return ret; | ||
1653 | } | 1648 | } |
1654 | 1649 | ||
1655 | /** | 1650 | /** |
@@ -1677,8 +1672,6 @@ static int ice_vlan_rx_kill_vid(struct net_device *netdev, | |||
1677 | if (status) | 1672 | if (status) |
1678 | return status; | 1673 | return status; |
1679 | 1674 | ||
1680 | clear_bit(vid, vsi->active_vlans); | ||
1681 | |||
1682 | /* Disable VLAN pruning when VLAN 0 is removed */ | 1675 | /* Disable VLAN pruning when VLAN 0 is removed */ |
1683 | if (unlikely(!vid)) | 1676 | if (unlikely(!vid)) |
1684 | status = ice_cfg_vlan_pruning(vsi, false); | 1677 | status = ice_cfg_vlan_pruning(vsi, false); |
@@ -2002,6 +1995,22 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf) | |||
2002 | } | 1995 | } |
2003 | 1996 | ||
2004 | /** | 1997 | /** |
1998 | * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines | ||
1999 | * @pf: pointer to the PF structure | ||
2000 | * | ||
2001 | * There is no error returned here because the driver should be able to handle | ||
2002 | * 128 Byte cache lines, so we only print a warning in case issues are seen, | ||
2003 | * specifically with Tx. | ||
2004 | */ | ||
2005 | static void ice_verify_cacheline_size(struct ice_pf *pf) | ||
2006 | { | ||
2007 | if (rd32(&pf->hw, GLPCI_CNF2) & GLPCI_CNF2_CACHELINE_SIZE_M) | ||
2008 | dev_warn(&pf->pdev->dev, | ||
2009 | "%d Byte cache line assumption is invalid, driver may have Tx timeouts!\n", | ||
2010 | ICE_CACHE_LINE_BYTES); | ||
2011 | } | ||
2012 | |||
2013 | /** | ||
2005 | * ice_probe - Device initialization routine | 2014 | * ice_probe - Device initialization routine |
2006 | * @pdev: PCI device information struct | 2015 | * @pdev: PCI device information struct |
2007 | * @ent: entry in ice_pci_tbl | 2016 | * @ent: entry in ice_pci_tbl |
@@ -2151,6 +2160,8 @@ static int ice_probe(struct pci_dev *pdev, | |||
2151 | /* since everything is good, start the service timer */ | 2160 | /* since everything is good, start the service timer */ |
2152 | mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); | 2161 | mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); |
2153 | 2162 | ||
2163 | ice_verify_cacheline_size(pf); | ||
2164 | |||
2154 | return 0; | 2165 | return 0; |
2155 | 2166 | ||
2156 | err_alloc_sw_unroll: | 2167 | err_alloc_sw_unroll: |
@@ -2182,6 +2193,12 @@ static void ice_remove(struct pci_dev *pdev) | |||
2182 | if (!pf) | 2193 | if (!pf) |
2183 | return; | 2194 | return; |
2184 | 2195 | ||
2196 | for (i = 0; i < ICE_MAX_RESET_WAIT; i++) { | ||
2197 | if (!ice_is_reset_in_progress(pf->state)) | ||
2198 | break; | ||
2199 | msleep(100); | ||
2200 | } | ||
2201 | |||
2185 | set_bit(__ICE_DOWN, pf->state); | 2202 | set_bit(__ICE_DOWN, pf->state); |
2186 | ice_service_task_stop(pf); | 2203 | ice_service_task_stop(pf); |
2187 | 2204 | ||
@@ -2510,31 +2527,6 @@ static int ice_vsi_vlan_setup(struct ice_vsi *vsi) | |||
2510 | } | 2527 | } |
2511 | 2528 | ||
2512 | /** | 2529 | /** |
2513 | * ice_restore_vlan - Reinstate VLANs when vsi/netdev comes back up | ||
2514 | * @vsi: the VSI being brought back up | ||
2515 | */ | ||
2516 | static int ice_restore_vlan(struct ice_vsi *vsi) | ||
2517 | { | ||
2518 | int err; | ||
2519 | u16 vid; | ||
2520 | |||
2521 | if (!vsi->netdev) | ||
2522 | return -EINVAL; | ||
2523 | |||
2524 | err = ice_vsi_vlan_setup(vsi); | ||
2525 | if (err) | ||
2526 | return err; | ||
2527 | |||
2528 | for_each_set_bit(vid, vsi->active_vlans, VLAN_N_VID) { | ||
2529 | err = ice_vlan_rx_add_vid(vsi->netdev, htons(ETH_P_8021Q), vid); | ||
2530 | if (err) | ||
2531 | break; | ||
2532 | } | ||
2533 | |||
2534 | return err; | ||
2535 | } | ||
2536 | |||
2537 | /** | ||
2538 | * ice_vsi_cfg - Setup the VSI | 2530 | * ice_vsi_cfg - Setup the VSI |
2539 | * @vsi: the VSI being configured | 2531 | * @vsi: the VSI being configured |
2540 | * | 2532 | * |
@@ -2546,7 +2538,9 @@ static int ice_vsi_cfg(struct ice_vsi *vsi) | |||
2546 | 2538 | ||
2547 | if (vsi->netdev) { | 2539 | if (vsi->netdev) { |
2548 | ice_set_rx_mode(vsi->netdev); | 2540 | ice_set_rx_mode(vsi->netdev); |
2549 | err = ice_restore_vlan(vsi); | 2541 | |
2542 | err = ice_vsi_vlan_setup(vsi); | ||
2543 | |||
2550 | if (err) | 2544 | if (err) |
2551 | return err; | 2545 | return err; |
2552 | } | 2546 | } |
@@ -3296,7 +3290,7 @@ static void ice_rebuild(struct ice_pf *pf) | |||
3296 | struct device *dev = &pf->pdev->dev; | 3290 | struct device *dev = &pf->pdev->dev; |
3297 | struct ice_hw *hw = &pf->hw; | 3291 | struct ice_hw *hw = &pf->hw; |
3298 | enum ice_status ret; | 3292 | enum ice_status ret; |
3299 | int err; | 3293 | int err, i; |
3300 | 3294 | ||
3301 | if (test_bit(__ICE_DOWN, pf->state)) | 3295 | if (test_bit(__ICE_DOWN, pf->state)) |
3302 | goto clear_recovery; | 3296 | goto clear_recovery; |
@@ -3370,6 +3364,22 @@ static void ice_rebuild(struct ice_pf *pf) | |||
3370 | } | 3364 | } |
3371 | 3365 | ||
3372 | ice_reset_all_vfs(pf, true); | 3366 | ice_reset_all_vfs(pf, true); |
3367 | |||
3368 | for (i = 0; i < pf->num_alloc_vsi; i++) { | ||
3369 | bool link_up; | ||
3370 | |||
3371 | if (!pf->vsi[i] || pf->vsi[i]->type != ICE_VSI_PF) | ||
3372 | continue; | ||
3373 | ice_get_link_status(pf->vsi[i]->port_info, &link_up); | ||
3374 | if (link_up) { | ||
3375 | netif_carrier_on(pf->vsi[i]->netdev); | ||
3376 | netif_tx_wake_all_queues(pf->vsi[i]->netdev); | ||
3377 | } else { | ||
3378 | netif_carrier_off(pf->vsi[i]->netdev); | ||
3379 | netif_tx_stop_all_queues(pf->vsi[i]->netdev); | ||
3380 | } | ||
3381 | } | ||
3382 | |||
3373 | /* if we get here, reset flow is successful */ | 3383 | /* if we get here, reset flow is successful */ |
3374 | clear_bit(__ICE_RESET_FAILED, pf->state); | 3384 | clear_bit(__ICE_RESET_FAILED, pf->state); |
3375 | return; | 3385 | return; |