Module Name: src Committed By: msaitoh Date: Fri Oct 6 14:32:05 UTC 2023
Modified Files: src/sys/dev/pci/ixgbe: ixgbe_vf.c Log Message: ixv(4): Improve error check. ixgbe_vf.c rev. 1.31 changed the behavior of the ixgbe_check_mac_link_vf() function. It was from FreeBSD's ixv-1.5.25 to resolve mailbox collision problem. The change had a problem that error checks have not done at all if the API version >= 1.5. Fix it. From FreeBSD ixv-1.5.27. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/ixgbe/ixgbe_vf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe_vf.c diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.31 src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.32 --- src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.31 Fri Dec 24 05:11:04 2021 +++ src/sys/dev/pci/ixgbe/ixgbe_vf.c Fri Oct 6 14:32:05 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_vf.c,v 1.31 2021/12/24 05:11:04 msaitoh Exp $ */ +/* $NetBSD: ixgbe_vf.c,v 1.32 2023/10/06 14:32:05 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -36,7 +36,7 @@ /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 331224 2018-03-19 20:55:05Z erj $*/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe_vf.c,v 1.31 2021/12/24 05:11:04 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe_vf.c,v 1.32 2023/10/06 14:32:05 msaitoh Exp $"); #include "ixgbe_api.h" #include "ixgbe_type.h" @@ -624,7 +624,9 @@ s32 ixgbe_check_mac_link_vf(struct ixgbe struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mac_info *mac = &hw->mac; s32 ret_val = IXGBE_SUCCESS; + u32 in_msg = 0; u32 links_reg; + UNREFERENCED_1PARAMETER(autoneg_wait_to_complete); /* If we were hit with a reset drop the link */ @@ -682,27 +684,26 @@ s32 ixgbe_check_mac_link_vf(struct ixgbe *speed = IXGBE_LINK_SPEED_UNKNOWN; } - if (hw->api_version < ixgbe_mbox_api_15) { - u32 in_msg = 0; - - /* if the read failed it could just be a mailbox collision, best wait - * until we are called again and don't report an error - */ - if (ixgbe_read_mbx(hw, &in_msg, 1, 0)) - goto out; + /* if the read failed it could just be a mailbox collision, best wait + * until we are called again and don't report an error + */ + if (ixgbe_read_mbx(hw, &in_msg, 1, 0)) { + if (hw->api_version >= ixgbe_mbox_api_15) + mac->get_link_status = FALSE; + goto out; + } - if (!(in_msg & IXGBE_VT_MSGTYPE_CTS)) { - /* msg is not CTS and is NACK we must have lost CTS status */ - if (in_msg & IXGBE_VT_MSGTYPE_FAILURE) - ret_val = IXGBE_ERR_MBX; - goto out; - } + if (!(in_msg & IXGBE_VT_MSGTYPE_CTS)) { + /* msg is not CTS and is NACK we must have lost CTS status */ + if (in_msg & IXGBE_VT_MSGTYPE_FAILURE) + ret_val = IXGBE_ERR_MBX; + goto out; + } - /* the pf is talking, if we timed out in the past we reinit */ - if (!mbx->timeout) { - ret_val = IXGBE_ERR_TIMEOUT; - goto out; - } + /* the pf is talking, if we timed out in the past we reinit */ + if (!mbx->timeout) { + ret_val = IXGBE_ERR_TIMEOUT; + goto out; } /* if we passed all the tests above then the link is up and we no