]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/ethernet/intel/ice/ice_base.c
ice: Add a boundary check in ice_xsk_umem()
[linux.git] / drivers / net / ethernet / intel / ice / ice_base.c
index 77d6a0291e975f887a4672a12103ea6a16ebda90..25f2e0fb38333bfa7ba48c3de9801e89da8d8eed 100644 (file)
@@ -93,7 +93,8 @@ static int ice_pf_rxq_wait(struct ice_pf *pf, int pf_q, bool ena)
  * @vsi: the VSI being configured
  * @v_idx: index of the vector in the VSI struct
  *
- * We allocate one q_vector. If allocation fails we return -ENOMEM.
+ * We allocate one q_vector and set default value for ITR setting associated
+ * with this q_vector. If allocation fails we return -ENOMEM.
  */
 static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, int v_idx)
 {
@@ -108,6 +109,8 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, int v_idx)
 
        q_vector->vsi = vsi;
        q_vector->v_idx = v_idx;
+       q_vector->tx.itr_setting = ICE_DFLT_TX_ITR;
+       q_vector->rx.itr_setting = ICE_DFLT_RX_ITR;
        if (vsi->type == ICE_VSI_VF)
                goto out;
        /* only set affinity_mask if the CPU is online */
@@ -323,6 +326,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
                        dev_info(&vsi->back->pdev->dev, "Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n",
                                 ring->q_index);
                } else {
+                       ring->zca.free = NULL;
                        if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))
                                xdp_rxq_info_reg(&ring->xdp_rxq,
                                                 ring->netdev,
@@ -674,10 +678,6 @@ void ice_cfg_itr(struct ice_hw *hw, struct ice_q_vector *q_vector)
        if (q_vector->num_ring_rx) {
                struct ice_ring_container *rc = &q_vector->rx;
 
-               /* if this value is set then don't overwrite with default */
-               if (!rc->itr_setting)
-                       rc->itr_setting = ICE_DFLT_RX_ITR;
-
                rc->target_itr = ITR_TO_REG(rc->itr_setting);
                rc->next_update = jiffies + 1;
                rc->current_itr = rc->target_itr;
@@ -688,10 +688,6 @@ void ice_cfg_itr(struct ice_hw *hw, struct ice_q_vector *q_vector)
        if (q_vector->num_ring_tx) {
                struct ice_ring_container *rc = &q_vector->tx;
 
-               /* if this value is set then don't overwrite with default */
-               if (!rc->itr_setting)
-                       rc->itr_setting = ICE_DFLT_TX_ITR;
-
                rc->target_itr = ITR_TO_REG(rc->itr_setting);
                rc->next_update = jiffies + 1;
                rc->current_itr = rc->target_itr;