Commit 9536c2f5 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2023-08-21 (ice)

This series contains updates to ice driver only.

Jesse fixes an issue on calculating buffer size.

Petr Oros reverts a commit that does not fully resolve VF reset issues
and implements one that provides a fuller fix.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
  ice: Fix NULL pointer deref during VF reset
  Revert "ice: Fix ice VF reset during iavf initialization"
  ice: fix receive buffer size miscalculation
====================

Link: https://lore.kernel.org/r/20230821171633.2203505-1-anthony.l.nguyen@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents c8777fa6 67f6317d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -435,7 +435,8 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
	/* Receive Packet Data Buffer Size.
	 * The Packet Data Buffer Size is defined in 128 byte units.
	 */
	rlan_ctx.dbuf = ring->rx_buf_len >> ICE_RLAN_CTX_DBUF_S;
	rlan_ctx.dbuf = DIV_ROUND_UP(ring->rx_buf_len,
				     BIT_ULL(ICE_RLAN_CTX_DBUF_S));

	/* use 32 byte descriptors */
	rlan_ctx.dsize = 1;
+4 −4
Original line number Diff line number Diff line
@@ -1131,7 +1131,7 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)
	if (!vf)
		return -EINVAL;

	ret = ice_check_vf_ready_for_reset(vf);
	ret = ice_check_vf_ready_for_cfg(vf);
	if (ret)
		goto out_put_vf;

@@ -1246,7 +1246,7 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
		goto out_put_vf;
	}

	ret = ice_check_vf_ready_for_reset(vf);
	ret = ice_check_vf_ready_for_cfg(vf);
	if (ret)
		goto out_put_vf;

@@ -1300,7 +1300,7 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted)
		return -EOPNOTSUPP;
	}

	ret = ice_check_vf_ready_for_reset(vf);
	ret = ice_check_vf_ready_for_cfg(vf);
	if (ret)
		goto out_put_vf;

@@ -1613,7 +1613,7 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
	if (!vf)
		return -EINVAL;

	ret = ice_check_vf_ready_for_reset(vf);
	ret = ice_check_vf_ready_for_cfg(vf);
	if (ret)
		goto out_put_vf;

+8 −26
Original line number Diff line number Diff line
@@ -185,25 +185,6 @@ int ice_check_vf_ready_for_cfg(struct ice_vf *vf)
	return 0;
}

/**
 * ice_check_vf_ready_for_reset - check if VF is ready to be reset
 * @vf: VF to check if it's ready to be reset
 *
 * The purpose of this function is to ensure that the VF is not in reset,
 * disabled, and is both initialized and active, thus enabling us to safely
 * initialize another reset.
 */
int ice_check_vf_ready_for_reset(struct ice_vf *vf)
{
	int ret;

	ret = ice_check_vf_ready_for_cfg(vf);
	if (!ret && !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))
		ret = -EAGAIN;

	return ret;
}

/**
 * ice_trigger_vf_reset - Reset a VF on HW
 * @vf: pointer to the VF structure
@@ -631,11 +612,17 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
		return 0;
	}

	if (flags & ICE_VF_RESET_LOCK)
		mutex_lock(&vf->cfg_lock);
	else
		lockdep_assert_held(&vf->cfg_lock);

	if (ice_is_vf_disabled(vf)) {
		vsi = ice_get_vf_vsi(vf);
		if (!vsi) {
			dev_dbg(dev, "VF is already removed\n");
			return -EINVAL;
			err = -EINVAL;
			goto out_unlock;
		}
		ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id);

@@ -644,14 +631,9 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)

		dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n",
			vf->vf_id);
		return 0;
		goto out_unlock;
	}

	if (flags & ICE_VF_RESET_LOCK)
		mutex_lock(&vf->cfg_lock);
	else
		lockdep_assert_held(&vf->cfg_lock);

	/* Set VF disable bit state here, before triggering reset */
	set_bit(ICE_VF_STATE_DIS, vf->vf_states);
	ice_trigger_vf_reset(vf, flags & ICE_VF_RESET_VFLR, false);
+0 −1
Original line number Diff line number Diff line
@@ -215,7 +215,6 @@ u16 ice_get_num_vfs(struct ice_pf *pf);
struct ice_vsi *ice_get_vf_vsi(struct ice_vf *vf);
bool ice_is_vf_disabled(struct ice_vf *vf);
int ice_check_vf_ready_for_cfg(struct ice_vf *vf);
int ice_check_vf_ready_for_reset(struct ice_vf *vf);
void ice_set_vf_state_dis(struct ice_vf *vf);
bool ice_is_any_vf_in_unicast_promisc(struct ice_pf *pf);
void
+0 −1
Original line number Diff line number Diff line
@@ -3947,7 +3947,6 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event,
		ice_vc_notify_vf_link_state(vf);
		break;
	case VIRTCHNL_OP_RESET_VF:
		clear_bit(ICE_VF_STATE_ACTIVE, vf->vf_states);
		ops->reset_vf(vf);
		break;
	case VIRTCHNL_OP_ADD_ETH_ADDR: