]> git.itanic.dy.fi Git - linux-stable/blobdiff - drivers/net/ethernet/intel/ice/ice_main.c
ice: config netdev tc before setting queues number
[linux-stable] / drivers / net / ethernet / intel / ice / ice_main.c
index ff2eac2f8c64423eafff3dff46e9e8ce7e37366e..f963036571e05e61cfaaf35aac2541ee3a4e1429 100644 (file)
@@ -267,8 +267,10 @@ static int ice_set_promisc(struct ice_vsi *vsi, u8 promisc_m)
                status = ice_fltr_set_vsi_promisc(&vsi->back->hw, vsi->idx,
                                                  promisc_m, 0);
        }
+       if (status && status != -EEXIST)
+               return status;
 
-       return status;
+       return 0;
 }
 
 /**
@@ -433,7 +435,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
                                                IFF_PROMISC;
                                        goto out_promisc;
                                }
-                               if (vsi->current_netdev_flags &
+                               if (vsi->netdev->features &
                                    NETIF_F_HW_VLAN_CTAG_FILTER)
                                        vlan_ops->ena_rx_filtering(vsi);
                        }
@@ -2397,8 +2399,6 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset)
                return -EBUSY;
        }
 
-       ice_unplug_aux_dev(pf);
-
        switch (reset) {
        case ICE_RESET_PFR:
                set_bit(ICE_PFR_REQ, pf->state);
@@ -2579,7 +2579,6 @@ static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi)
                if (ice_setup_tx_ring(xdp_ring))
                        goto free_xdp_rings;
                ice_set_ring_xdp(xdp_ring);
-               xdp_ring->xsk_pool = ice_tx_xsk_pool(xdp_ring);
                spin_lock_init(&xdp_ring->tx_lock);
                for (j = 0; j < xdp_ring->count; j++) {
                        tx_desc = ICE_TX_DESC(xdp_ring, j);
@@ -2587,13 +2586,6 @@ static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi)
                }
        }
 
-       ice_for_each_rxq(vsi, i) {
-               if (static_key_enabled(&ice_xdp_locking_key))
-                       vsi->rx_rings[i]->xdp_ring = vsi->xdp_rings[i % vsi->num_xdp_txq];
-               else
-                       vsi->rx_rings[i]->xdp_ring = vsi->xdp_rings[i];
-       }
-
        return 0;
 
 free_xdp_rings:
@@ -2683,6 +2675,23 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog)
                xdp_rings_rem -= xdp_rings_per_v;
        }
 
+       ice_for_each_rxq(vsi, i) {
+               if (static_key_enabled(&ice_xdp_locking_key)) {
+                       vsi->rx_rings[i]->xdp_ring = vsi->xdp_rings[i % vsi->num_xdp_txq];
+               } else {
+                       struct ice_q_vector *q_vector = vsi->rx_rings[i]->q_vector;
+                       struct ice_tx_ring *ring;
+
+                       ice_for_each_tx_ring(ring, q_vector->tx) {
+                               if (ice_ring_is_xdp(ring)) {
+                                       vsi->rx_rings[i]->xdp_ring = ring;
+                                       break;
+                               }
+                       }
+               }
+               ice_tx_xsk_pool(vsi, i);
+       }
+
        /* omit the scheduler update if in reset path; XDP queues will be
         * taken into account at the end of ice_vsi_rebuild, where
         * ice_cfg_vsi_lan is being called
@@ -2887,10 +2896,18 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
                        if (xdp_ring_err)
                                NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Tx resources failed");
                }
+               /* reallocate Rx queues that are used for zero-copy */
+               xdp_ring_err = ice_realloc_zc_buf(vsi, true);
+               if (xdp_ring_err)
+                       NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Rx resources failed");
        } else if (ice_is_xdp_ena_vsi(vsi) && !prog) {
                xdp_ring_err = ice_destroy_xdp_rings(vsi);
                if (xdp_ring_err)
                        NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Tx resources failed");
+               /* reallocate Rx queues that were used for zero-copy */
+               xdp_ring_err = ice_realloc_zc_buf(vsi, false);
+               if (xdp_ring_err)
+                       NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Rx resources failed");
        } else {
                /* safe to call even when prog == vsi->xdp_prog as
                 * dev_xdp_install in net/core/dev.c incremented prog's
@@ -3572,6 +3589,14 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
        while (test_and_set_bit(ICE_CFG_BUSY, vsi->state))
                usleep_range(1000, 2000);
 
+       ret = ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx,
+                                   ICE_MCAST_VLAN_PROMISC_BITS, vid);
+       if (ret) {
+               netdev_err(netdev, "Error clearing multicast promiscuous mode on VSI %i\n",
+                          vsi->vsi_num);
+               vsi->current_netdev_flags |= IFF_ALLMULTI;
+       }
+
        vlan_ops = ice_get_compat_vsi_vlan_ops(vsi);
 
        /* Make sure VLAN delete is successful before updating VLAN
@@ -3885,7 +3910,7 @@ static int ice_init_pf(struct ice_pf *pf)
 
        pf->avail_rxqs = bitmap_zalloc(pf->max_pf_rxqs, GFP_KERNEL);
        if (!pf->avail_rxqs) {
-               devm_kfree(ice_pf_to_dev(pf), pf->avail_txqs);
+               bitmap_free(pf->avail_txqs);
                pf->avail_txqs = NULL;
                return -ENOMEM;
        }
@@ -4656,6 +4681,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
                ice_set_safe_mode_caps(hw);
        }
 
+       hw->ucast_shared = true;
+
        err = ice_init_pf(pf);
        if (err) {
                dev_err(dev, "ice_init_pf failed: %d\n", err);
@@ -6011,10 +6038,12 @@ int ice_vsi_cfg(struct ice_vsi *vsi)
        if (vsi->netdev) {
                ice_set_rx_mode(vsi->netdev);
 
-               err = ice_vsi_vlan_setup(vsi);
+               if (vsi->type != ICE_VSI_LB) {
+                       err = ice_vsi_vlan_setup(vsi);
 
-               if (err)
-                       return err;
+                       if (err)
+                               return err;
+               }
        }
        ice_vsi_cfg_dcb_rings(vsi);
 
@@ -6807,6 +6836,8 @@ int ice_vsi_open(struct ice_vsi *vsi)
        if (err)
                goto err_setup_rx;
 
+       ice_vsi_cfg_netdev_tc(vsi, vsi->tc_cfg.ena_tc);
+
        if (vsi->type == ICE_VSI_PF) {
                /* Notify the stack of the actual queue counts. */
                err = netif_set_real_num_tx_queues(vsi->netdev, vsi->num_txq);