Date: Tue, 24 Aug 2021 00:50:13 GMT From: Kevin Bowling <kbowling@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 784459fc1641 - stable/13 - ixgbe: Avoid sbuf_trim(9) in sysctl handler Message-ID: <202108240050.17O0oDok007384@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=784459fc1641a3b8f391af1e6aa78e2428188830 commit 784459fc1641a3b8f391af1e6aa78e2428188830 Author: Kevin Bowling <kbowling@FreeBSD.org> AuthorDate: 2021-08-23 16:21:39 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2021-08-24 00:50:02 +0000 ixgbe: Avoid sbuf_trim(9) in sysctl handler This was an error, we cannot use sbuf_trim(9) in the ixgbe_sbuf_fw_version function because it also gets called in the context of sbuf_new_for_sysctl(9). sbuf(9) explains the interaction with drain functions as used by sbuf_new_for_sysctl(9). Reviewed by: imp Fixes: 7660e4ea5cb7 MFC after: 1 day Differential Revision: https://reviews.freebsd.org/D31633 (cherry picked from commit 5de5419b5e8685ab2261edaafe6fdb6fc36e8bbc) --- sys/dev/ixgbe/if_ix.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 8e14a008e09b..91bf7e4dd218 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -4694,27 +4694,33 @@ ixgbe_sbuf_fw_version(struct ixgbe_hw *hw, struct sbuf *buf) struct ixgbe_nvm_version nvm_ver = {0}; uint16_t phyfw = 0; int status; + const char *space = ""; ixgbe_get_oem_prod_version(hw, &nvm_ver); /* OEM's NVM version */ ixgbe_get_orom_version(hw, &nvm_ver); /* Option ROM */ ixgbe_get_etk_id(hw, &nvm_ver); /* eTrack identifies a build in Intel's SCM */ status = ixgbe_get_phy_firmware_version(hw, &phyfw); - if (nvm_ver.oem_valid) - sbuf_printf(buf, "NVM OEM V%d.%d R%d ", nvm_ver.oem_major, + if (nvm_ver.oem_valid) { + sbuf_printf(buf, "NVM OEM V%d.%d R%d", nvm_ver.oem_major, nvm_ver.oem_minor, nvm_ver.oem_release); + space = " "; + } - if (nvm_ver.or_valid) - sbuf_printf(buf, "Option ROM V%d-b%d-p%d ", nvm_ver.or_major, - nvm_ver.or_build, nvm_ver.or_patch); + if (nvm_ver.or_valid) { + sbuf_printf(buf, "%sOption ROM V%d-b%d-p%d", + space, nvm_ver.or_major, nvm_ver.or_build, nvm_ver.or_patch); + space = " "; + } - if (nvm_ver.etk_id != ((NVM_VER_INVALID << NVM_ETK_SHIFT) | NVM_VER_INVALID)) - sbuf_printf(buf, "eTrack 0x%08x ", nvm_ver.etk_id); + if (nvm_ver.etk_id != ((NVM_VER_INVALID << NVM_ETK_SHIFT) | + NVM_VER_INVALID)) { + sbuf_printf(buf, "%seTrack 0x%08x", space, nvm_ver.etk_id); + space = " "; + } if (phyfw != 0 && status == IXGBE_SUCCESS) - sbuf_printf(buf, "PHY FW V%d ", phyfw); - - sbuf_trim(buf); + sbuf_printf(buf, "%sPHY FW V%d", space, phyfw); } /* ixgbe_sbuf_fw_version */ /************************************************************************
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108240050.17O0oDok007384>