diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ice')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_common.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_hw_autogen.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_lib.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 86 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_switch.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_switch.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_txrx.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_txrx.h | 17 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_type.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 4 |
12 files changed, 101 insertions, 52 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index 4c4b5717a627..b8548370f1c7 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h | |||
@@ -76,6 +76,8 @@ extern const char ice_drv_ver[]; | |||
76 | #define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1) | 76 | #define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1) |
77 | #define ICE_DFLT_INTR_PER_VF (ICE_DFLT_QS_PER_VF + 1) | 77 | #define ICE_DFLT_INTR_PER_VF (ICE_DFLT_QS_PER_VF + 1) |
78 | 78 | ||
79 | #define ICE_MAX_RESET_WAIT 20 | ||
80 | |||
79 | #define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4) | 81 | #define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4) |
80 | 82 | ||
81 | #define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) | 83 | #define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) |
@@ -189,7 +191,6 @@ struct ice_vsi { | |||
189 | u64 tx_linearize; | 191 | u64 tx_linearize; |
190 | DECLARE_BITMAP(state, __ICE_STATE_NBITS); | 192 | DECLARE_BITMAP(state, __ICE_STATE_NBITS); |
191 | DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS); | 193 | DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS); |
192 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; | ||
193 | unsigned int current_netdev_flags; | 194 | unsigned int current_netdev_flags; |
194 | u32 tx_restart; | 195 | u32 tx_restart; |
195 | u32 tx_busy; | 196 | u32 tx_busy; |
@@ -369,5 +370,6 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); | |||
369 | int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); | 370 | int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); |
370 | void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size); | 371 | void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size); |
371 | void ice_print_link_msg(struct ice_vsi *vsi, bool isup); | 372 | void ice_print_link_msg(struct ice_vsi *vsi, bool isup); |
373 | void ice_napi_del(struct ice_vsi *vsi); | ||
372 | 374 | ||
373 | #endif /* _ICE_H_ */ | 375 | #endif /* _ICE_H_ */ |
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 8cd6a2401fd9..554fd707a6d6 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c | |||
@@ -811,6 +811,9 @@ void ice_deinit_hw(struct ice_hw *hw) | |||
811 | /* Attempt to disable FW logging before shutting down control queues */ | 811 | /* Attempt to disable FW logging before shutting down control queues */ |
812 | ice_cfg_fw_log(hw, false); | 812 | ice_cfg_fw_log(hw, false); |
813 | ice_shutdown_all_ctrlq(hw); | 813 | ice_shutdown_all_ctrlq(hw); |
814 | |||
815 | /* Clear VSI contexts if not already cleared */ | ||
816 | ice_clear_all_vsi_ctx(hw); | ||
814 | } | 817 | } |
815 | 818 | ||
816 | /** | 819 | /** |
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 96923580f2a6..648acdb4c644 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c | |||
@@ -1517,10 +1517,15 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) | |||
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | if (!test_bit(__ICE_DOWN, pf->state)) { | 1519 | if (!test_bit(__ICE_DOWN, pf->state)) { |
1520 | /* Give it a little more time to try to come back */ | 1520 | /* Give it a little more time to try to come back. If still |
1521 | * down, restart autoneg link or reinitialize the interface. | ||
1522 | */ | ||
1521 | msleep(75); | 1523 | msleep(75); |
1522 | if (!test_bit(__ICE_DOWN, pf->state)) | 1524 | if (!test_bit(__ICE_DOWN, pf->state)) |
1523 | return ice_nway_reset(netdev); | 1525 | return ice_nway_reset(netdev); |
1526 | |||
1527 | ice_down(vsi); | ||
1528 | ice_up(vsi); | ||
1524 | } | 1529 | } |
1525 | 1530 | ||
1526 | return err; | 1531 | return err; |
diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h index 5fdea6ec7675..596b9fb1c510 100644 --- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h +++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h | |||
@@ -242,6 +242,8 @@ | |||
242 | #define GLNVM_ULD 0x000B6008 | 242 | #define GLNVM_ULD 0x000B6008 |
243 | #define GLNVM_ULD_CORER_DONE_M BIT(3) | 243 | #define GLNVM_ULD_CORER_DONE_M BIT(3) |
244 | #define GLNVM_ULD_GLOBR_DONE_M BIT(4) | 244 | #define GLNVM_ULD_GLOBR_DONE_M BIT(4) |
245 | #define GLPCI_CNF2 0x000BE004 | ||
246 | #define GLPCI_CNF2_CACHELINE_SIZE_M BIT(1) | ||
245 | #define PF_FUNC_RID 0x0009E880 | 247 | #define PF_FUNC_RID 0x0009E880 |
246 | #define PF_FUNC_RID_FUNC_NUM_S 0 | 248 | #define PF_FUNC_RID_FUNC_NUM_S 0 |
247 | #define PF_FUNC_RID_FUNC_NUM_M ICE_M(0x7, 0) | 249 | #define PF_FUNC_RID_FUNC_NUM_M ICE_M(0x7, 0) |
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 5bacad01f0c9..1041fa2a7767 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c | |||
@@ -1997,7 +1997,7 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena) | |||
1997 | status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL); | 1997 | status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL); |
1998 | if (status) { | 1998 | if (status) { |
1999 | netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %d\n", | 1999 | netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %d\n", |
2000 | ena ? "Ena" : "Dis", vsi->idx, vsi->vsi_num, status, | 2000 | ena ? "En" : "Dis", vsi->idx, vsi->vsi_num, status, |
2001 | vsi->back->hw.adminq.sq_last_status); | 2001 | vsi->back->hw.adminq.sq_last_status); |
2002 | goto err_out; | 2002 | goto err_out; |
2003 | } | 2003 | } |
@@ -2458,6 +2458,7 @@ int ice_vsi_release(struct ice_vsi *vsi) | |||
2458 | * on this wq | 2458 | * on this wq |
2459 | */ | 2459 | */ |
2460 | if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) { | 2460 | if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) { |
2461 | ice_napi_del(vsi); | ||
2461 | unregister_netdev(vsi->netdev); | 2462 | unregister_netdev(vsi->netdev); |
2462 | free_netdev(vsi->netdev); | 2463 | free_netdev(vsi->netdev); |
2463 | vsi->netdev = NULL; | 2464 | vsi->netdev = NULL; |
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; |
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 33403f39f1b3..40c9c6558956 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c | |||
@@ -348,6 +348,18 @@ static void ice_clear_vsi_ctx(struct ice_hw *hw, u16 vsi_handle) | |||
348 | } | 348 | } |
349 | 349 | ||
350 | /** | 350 | /** |
351 | * ice_clear_all_vsi_ctx - clear all the VSI context entries | ||
352 | * @hw: pointer to the hw struct | ||
353 | */ | ||
354 | void ice_clear_all_vsi_ctx(struct ice_hw *hw) | ||
355 | { | ||
356 | u16 i; | ||
357 | |||
358 | for (i = 0; i < ICE_MAX_VSI; i++) | ||
359 | ice_clear_vsi_ctx(hw, i); | ||
360 | } | ||
361 | |||
362 | /** | ||
351 | * ice_add_vsi - add VSI context to the hardware and VSI handle list | 363 | * ice_add_vsi - add VSI context to the hardware and VSI handle list |
352 | * @hw: pointer to the hw struct | 364 | * @hw: pointer to the hw struct |
353 | * @vsi_handle: unique VSI handle provided by drivers | 365 | * @vsi_handle: unique VSI handle provided by drivers |
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h index b88d96a1ef69..d5ef0bd58bf9 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.h +++ b/drivers/net/ethernet/intel/ice/ice_switch.h | |||
@@ -190,6 +190,8 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, | |||
190 | struct ice_sq_cd *cd); | 190 | struct ice_sq_cd *cd); |
191 | bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); | 191 | bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); |
192 | struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); | 192 | struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); |
193 | void ice_clear_all_vsi_ctx(struct ice_hw *hw); | ||
194 | /* Switch config */ | ||
193 | enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); | 195 | enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); |
194 | 196 | ||
195 | /* Switch/bridge related commands */ | 197 | /* Switch/bridge related commands */ |
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index 5dae968d853e..fe5bbabbb41e 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c | |||
@@ -1520,7 +1520,7 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off) | |||
1520 | 1520 | ||
1521 | /* update gso_segs and bytecount */ | 1521 | /* update gso_segs and bytecount */ |
1522 | first->gso_segs = skb_shinfo(skb)->gso_segs; | 1522 | first->gso_segs = skb_shinfo(skb)->gso_segs; |
1523 | first->bytecount = (first->gso_segs - 1) * off->header_len; | 1523 | first->bytecount += (first->gso_segs - 1) * off->header_len; |
1524 | 1524 | ||
1525 | cd_tso_len = skb->len - off->header_len; | 1525 | cd_tso_len = skb->len - off->header_len; |
1526 | cd_mss = skb_shinfo(skb)->gso_size; | 1526 | cd_mss = skb_shinfo(skb)->gso_size; |
@@ -1556,15 +1556,15 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off) | |||
1556 | * magnitude greater than our largest possible GSO size. | 1556 | * magnitude greater than our largest possible GSO size. |
1557 | * | 1557 | * |
1558 | * This would then be implemented as: | 1558 | * This would then be implemented as: |
1559 | * return (((size >> 12) * 85) >> 8) + 1; | 1559 | * return (((size >> 12) * 85) >> 8) + ICE_DESCS_FOR_SKB_DATA_PTR; |
1560 | * | 1560 | * |
1561 | * Since multiplication and division are commutative, we can reorder | 1561 | * Since multiplication and division are commutative, we can reorder |
1562 | * operations into: | 1562 | * operations into: |
1563 | * return ((size * 85) >> 20) + 1; | 1563 | * return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR; |
1564 | */ | 1564 | */ |
1565 | static unsigned int ice_txd_use_count(unsigned int size) | 1565 | static unsigned int ice_txd_use_count(unsigned int size) |
1566 | { | 1566 | { |
1567 | return ((size * 85) >> 20) + 1; | 1567 | return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR; |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | /** | 1570 | /** |
@@ -1706,7 +1706,8 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) | |||
1706 | * + 1 desc for context descriptor, | 1706 | * + 1 desc for context descriptor, |
1707 | * otherwise try next time | 1707 | * otherwise try next time |
1708 | */ | 1708 | */ |
1709 | if (ice_maybe_stop_tx(tx_ring, count + 4 + 1)) { | 1709 | if (ice_maybe_stop_tx(tx_ring, count + ICE_DESCS_PER_CACHE_LINE + |
1710 | ICE_DESCS_FOR_CTX_DESC)) { | ||
1710 | tx_ring->tx_stats.tx_busy++; | 1711 | tx_ring->tx_stats.tx_busy++; |
1711 | return NETDEV_TX_BUSY; | 1712 | return NETDEV_TX_BUSY; |
1712 | } | 1713 | } |
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h b/drivers/net/ethernet/intel/ice/ice_txrx.h index 1d0f58bd389b..75d0eaf6c9dd 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.h +++ b/drivers/net/ethernet/intel/ice/ice_txrx.h | |||
@@ -22,8 +22,21 @@ | |||
22 | #define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */ | 22 | #define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */ |
23 | #define ICE_MAX_TXQ_PER_TXQG 128 | 23 | #define ICE_MAX_TXQ_PER_TXQG 128 |
24 | 24 | ||
25 | /* Tx Descriptors needed, worst case */ | 25 | /* We are assuming that the cache line is always 64 Bytes here for ice. |
26 | #define DESC_NEEDED (MAX_SKB_FRAGS + 4) | 26 | * In order to make sure that is a correct assumption there is a check in probe |
27 | * to print a warning if the read from GLPCI_CNF2 tells us that the cache line | ||
28 | * size is 128 bytes. We do it this way because we do not want to read the | ||
29 | * GLPCI_CNF2 register or a variable containing the value on every pass through | ||
30 | * the Tx path. | ||
31 | */ | ||
32 | #define ICE_CACHE_LINE_BYTES 64 | ||
33 | #define ICE_DESCS_PER_CACHE_LINE (ICE_CACHE_LINE_BYTES / \ | ||
34 | sizeof(struct ice_tx_desc)) | ||
35 | #define ICE_DESCS_FOR_CTX_DESC 1 | ||
36 | #define ICE_DESCS_FOR_SKB_DATA_PTR 1 | ||
37 | /* Tx descriptors needed, worst case */ | ||
38 | #define DESC_NEEDED (MAX_SKB_FRAGS + ICE_DESCS_FOR_CTX_DESC + \ | ||
39 | ICE_DESCS_PER_CACHE_LINE + ICE_DESCS_FOR_SKB_DATA_PTR) | ||
27 | #define ICE_DESC_UNUSED(R) \ | 40 | #define ICE_DESC_UNUSED(R) \ |
28 | ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ | 41 | ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ |
29 | (R)->next_to_clean - (R)->next_to_use - 1) | 42 | (R)->next_to_clean - (R)->next_to_use - 1) |
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h index 12f9432abf11..f4dbc81c1988 100644 --- a/drivers/net/ethernet/intel/ice/ice_type.h +++ b/drivers/net/ethernet/intel/ice/ice_type.h | |||
@@ -92,12 +92,12 @@ struct ice_link_status { | |||
92 | u64 phy_type_low; | 92 | u64 phy_type_low; |
93 | u16 max_frame_size; | 93 | u16 max_frame_size; |
94 | u16 link_speed; | 94 | u16 link_speed; |
95 | u16 req_speeds; | ||
95 | u8 lse_ena; /* Link Status Event notification */ | 96 | u8 lse_ena; /* Link Status Event notification */ |
96 | u8 link_info; | 97 | u8 link_info; |
97 | u8 an_info; | 98 | u8 an_info; |
98 | u8 ext_info; | 99 | u8 ext_info; |
99 | u8 pacing; | 100 | u8 pacing; |
100 | u8 req_speeds; | ||
101 | /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of | 101 | /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of |
102 | * ice_aqc_get_phy_caps structure | 102 | * ice_aqc_get_phy_caps structure |
103 | */ | 103 | */ |
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c index 45f10f8f01dc..e71065f9d391 100644 --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | |||
@@ -348,7 +348,7 @@ static int ice_vsi_set_pvid(struct ice_vsi *vsi, u16 vid) | |||
348 | struct ice_vsi_ctx ctxt = { 0 }; | 348 | struct ice_vsi_ctx ctxt = { 0 }; |
349 | enum ice_status status; | 349 | enum ice_status status; |
350 | 350 | ||
351 | ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_TAGGED | | 351 | ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_UNTAGGED | |
352 | ICE_AQ_VSI_PVLAN_INSERT_PVID | | 352 | ICE_AQ_VSI_PVLAN_INSERT_PVID | |
353 | ICE_AQ_VSI_VLAN_EMOD_STR; | 353 | ICE_AQ_VSI_VLAN_EMOD_STR; |
354 | ctxt.info.pvid = cpu_to_le16(vid); | 354 | ctxt.info.pvid = cpu_to_le16(vid); |
@@ -2171,7 +2171,6 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) | |||
2171 | 2171 | ||
2172 | if (!ice_vsi_add_vlan(vsi, vid)) { | 2172 | if (!ice_vsi_add_vlan(vsi, vid)) { |
2173 | vf->num_vlan++; | 2173 | vf->num_vlan++; |
2174 | set_bit(vid, vsi->active_vlans); | ||
2175 | 2174 | ||
2176 | /* Enable VLAN pruning when VLAN 0 is added */ | 2175 | /* Enable VLAN pruning when VLAN 0 is added */ |
2177 | if (unlikely(!vid)) | 2176 | if (unlikely(!vid)) |
@@ -2190,7 +2189,6 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) | |||
2190 | */ | 2189 | */ |
2191 | if (!ice_vsi_kill_vlan(vsi, vid)) { | 2190 | if (!ice_vsi_kill_vlan(vsi, vid)) { |
2192 | vf->num_vlan--; | 2191 | vf->num_vlan--; |
2193 | clear_bit(vid, vsi->active_vlans); | ||
2194 | 2192 | ||
2195 | /* Disable VLAN pruning when removing VLAN 0 */ | 2193 | /* Disable VLAN pruning when removing VLAN 0 */ |
2196 | if (unlikely(!vid)) | 2194 | if (unlikely(!vid)) |