Commit bb3f21ed authored by Kohei Enju's avatar Kohei Enju Committed by Tony Nguyen
Browse files

ice: ptp: don't WARN when controlling PF is unavailable



In VFIO passthrough setups, it is possible to pass through only a PF
which doesn't own the source timer. In that case the PTP controlling PF
(adapter->ctrl_pf) is never initialized in the VM, so ice_get_ctrl_ptp()
returns NULL and triggers WARN_ON() in ice_ptp_setup_pf().

Since this is an expected behavior in that configuration, replace
WARN_ON() with an informational message and return -EOPNOTSUPP.

Fixes: e800654e ("ice: Use ice_adapter for PTP shared data instead of auxdev")
Signed-off-by: default avatarKohei Enju <kohei@enjuk.jp>
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 8e2a2420
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -3080,7 +3080,13 @@ static int ice_ptp_setup_pf(struct ice_pf *pf)
	struct ice_ptp *ctrl_ptp = ice_get_ctrl_ptp(pf);
	struct ice_ptp *ptp = &pf->ptp;

	if (WARN_ON(!ctrl_ptp) || pf->hw.mac_type == ICE_MAC_UNKNOWN)
	if (!ctrl_ptp) {
		dev_info(ice_pf_to_dev(pf),
			 "PTP unavailable: no controlling PF\n");
		return -EOPNOTSUPP;
	}

	if (pf->hw.mac_type == ICE_MAC_UNKNOWN)
		return -ENODEV;

	INIT_LIST_HEAD(&ptp->port.list_node);