diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 58e9eb40f64a..dd07bf862afe 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
@@ -1259,6 +1259,23 @@ err_txrings: | |||
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | /** | 1261 | /** |
1262 | * ice_msix_clean_rings - MSIX mode Interrupt Handler | ||
1263 | * @irq: interrupt number | ||
1264 | * @data: pointer to a q_vector | ||
1265 | */ | ||
1266 | static irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data) | ||
1267 | { | ||
1268 | struct ice_q_vector *q_vector = (struct ice_q_vector *)data; | ||
1269 | |||
1270 | if (!q_vector->tx.ring && !q_vector->rx.ring) | ||
1271 | return IRQ_HANDLED; | ||
1272 | |||
1273 | napi_schedule(&q_vector->napi); | ||
1274 | |||
1275 | return IRQ_HANDLED; | ||
1276 | } | ||
1277 | |||
1278 | /** | ||
1262 | * ice_vsi_alloc - Allocates the next available struct vsi in the PF | 1279 | * ice_vsi_alloc - Allocates the next available struct vsi in the PF |
1263 | * @pf: board private structure | 1280 | * @pf: board private structure |
1264 | * @type: type of VSI | 1281 | * @type: type of VSI |
@@ -1298,6 +1315,8 @@ static struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type) | |||
1298 | if (ice_vsi_alloc_arrays(vsi, true)) | 1315 | if (ice_vsi_alloc_arrays(vsi, true)) |
1299 | goto err_rings; | 1316 | goto err_rings; |
1300 | 1317 | ||
1318 | /* Setup default MSIX irq handler for VSI */ | ||
1319 | vsi->irq_handler = ice_msix_clean_rings; | ||
1301 | break; | 1320 | break; |
1302 | default: | 1321 | default: |
1303 | dev_warn(&pf->pdev->dev, "Unknown VSI type %d\n", vsi->type); | 1322 | dev_warn(&pf->pdev->dev, "Unknown VSI type %d\n", vsi->type); |
@@ -1741,6 +1760,9 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, int v_idx) | |||
1741 | if (cpu_online(v_idx)) | 1760 | if (cpu_online(v_idx)) |
1742 | cpumask_set_cpu(v_idx, &q_vector->affinity_mask); | 1761 | cpumask_set_cpu(v_idx, &q_vector->affinity_mask); |
1743 | 1762 | ||
1763 | if (vsi->netdev) | ||
1764 | netif_napi_add(vsi->netdev, &q_vector->napi, ice_napi_poll, | ||
1765 | NAPI_POLL_WEIGHT); | ||
1744 | /* tie q_vector and vsi together */ | 1766 | /* tie q_vector and vsi together */ |
1745 | vsi->q_vectors[v_idx] = q_vector; | 1767 | vsi->q_vectors[v_idx] = q_vector; |
1746 | 1768 | ||
@@ -2915,6 +2937,21 @@ static int ice_vsi_stop_tx_rx_rings(struct ice_vsi *vsi) | |||
2915 | } | 2937 | } |
2916 | 2938 | ||
2917 | /** | 2939 | /** |
2940 | * ice_napi_enable_all - Enable NAPI for all q_vectors in the VSI | ||
2941 | * @vsi: the VSI being configured | ||
2942 | */ | ||
2943 | static void ice_napi_enable_all(struct ice_vsi *vsi) | ||
2944 | { | ||
2945 | int q_idx; | ||
2946 | |||
2947 | if (!vsi->netdev) | ||
2948 | return; | ||
2949 | |||
2950 | for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) | ||
2951 | napi_enable(&vsi->q_vectors[q_idx]->napi); | ||
2952 | } | ||
2953 | |||
2954 | /** | ||
2918 | * ice_up_complete - Finish the last steps of bringing up a connection | 2955 | * ice_up_complete - Finish the last steps of bringing up a connection |
2919 | * @vsi: The VSI being configured | 2956 | * @vsi: The VSI being configured |
2920 | * | 2957 | * |
@@ -2939,6 +2976,7 @@ static int ice_up_complete(struct ice_vsi *vsi) | |||
2939 | return err; | 2976 | return err; |
2940 | 2977 | ||
2941 | clear_bit(__ICE_DOWN, vsi->state); | 2978 | clear_bit(__ICE_DOWN, vsi->state); |
2979 | ice_napi_enable_all(vsi); | ||
2942 | ice_vsi_ena_irq(vsi); | 2980 | ice_vsi_ena_irq(vsi); |
2943 | 2981 | ||
2944 | if (vsi->port_info && | 2982 | if (vsi->port_info && |
@@ -2955,6 +2993,21 @@ static int ice_up_complete(struct ice_vsi *vsi) | |||
2955 | } | 2993 | } |
2956 | 2994 | ||
2957 | /** | 2995 | /** |
2996 | * ice_napi_disable_all - Disable NAPI for all q_vectors in the VSI | ||
2997 | * @vsi: VSI having NAPI disabled | ||
2998 | */ | ||
2999 | static void ice_napi_disable_all(struct ice_vsi *vsi) | ||
3000 | { | ||
3001 | int q_idx; | ||
3002 | |||
3003 | if (!vsi->netdev) | ||
3004 | return; | ||
3005 | |||
3006 | for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) | ||
3007 | napi_disable(&vsi->q_vectors[q_idx]->napi); | ||
3008 | } | ||
3009 | |||
3010 | /** | ||
2958 | * ice_down - Shutdown the connection | 3011 | * ice_down - Shutdown the connection |
2959 | * @vsi: The VSI being stopped | 3012 | * @vsi: The VSI being stopped |
2960 | */ | 3013 | */ |
@@ -2972,6 +3025,7 @@ static int ice_down(struct ice_vsi *vsi) | |||
2972 | 3025 | ||
2973 | ice_vsi_dis_irq(vsi); | 3026 | ice_vsi_dis_irq(vsi); |
2974 | err = ice_vsi_stop_tx_rx_rings(vsi); | 3027 | err = ice_vsi_stop_tx_rx_rings(vsi); |
3028 | ice_napi_disable_all(vsi); | ||
2975 | 3029 | ||
2976 | ice_for_each_txq(vsi, i) | 3030 | ice_for_each_txq(vsi, i) |
2977 | ice_clean_tx_ring(vsi->tx_rings[i]); | 3031 | ice_clean_tx_ring(vsi->tx_rings[i]); |
@@ -3251,4 +3305,5 @@ static int ice_stop(struct net_device *netdev) | |||
3251 | static const struct net_device_ops ice_netdev_ops = { | 3305 | static const struct net_device_ops ice_netdev_ops = { |
3252 | .ndo_open = ice_open, | 3306 | .ndo_open = ice_open, |
3253 | .ndo_stop = ice_stop, | 3307 | .ndo_stop = ice_stop, |
3308 | .ndo_start_xmit = ice_start_xmit, | ||
3254 | }; | 3309 | }; |