From nobody Sat Sep 28 09:23:12 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XG21r34z8z5Y34P; Sat, 28 Sep 2024 09:23:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XG21r22Nwz4qTs; Sat, 28 Sep 2024 09:23:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727515392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OZAwCZNRDMIi7xLfAbIyog1fwq7oVa1xIeqrj0JTxY4=; b=jzoPDMWPP97P9TQZ/9Lr4F8CfA49XtLlby0yIoTjnVxyZ2S5WEFGWJavBktYn8mArfeF9V 1s5r8rV0K+Z6UBMVZv8XCF//pK9I73bhStBtnFSS5dEjhrZRG0fB1xUQafOQYOw2dprFWw lgDBDKJUYlognj/mTdo3SxeerYU+cD/VQ+47Q/TzHRrwTqSAWBwJ3FNKsIlHSTPThA/SDL TL+uIsTBJuxEhaetj7S0VlqaZ7Pf+915uCP7TQBrcLuFmrcI3mu2wfXjSLQyXSdlUnGKKw cqyz6+I/EJtm+5g9TDl1CrJYgJFbDk5Tw3LqIJGig+Wyo4/gQLaGPuLngon3Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727515392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OZAwCZNRDMIi7xLfAbIyog1fwq7oVa1xIeqrj0JTxY4=; b=EVGpvzm3GXpkNqGdiGzc7WulLisEcpg/2dwDdXYxOYPzfUCmxU2KFvn50KUNLfCvig5Pdv sToDi3/Rz0elcl+pp/v7AG7nlNBy0bZ985fVG5vgMgyBzd3jtCHcuU1Xos2FJ6daONktfs AFD6xC44Nv+14HxjH56hnSdGtdxh6tft3fd7xfxLxfcmbhR/dYGCGhY1a6kPNvHrqjwotn 7ek1WkxiQb4HLlSAdhF45so8uEeIRm7VIT3jhudxTdFPixpvkjNT8dD9Dap0p+/uZ8fVLw tFFPRZSGwP11pBPLdvzBe1Cp1KaSa3l/bv01HRhfUkdExZ6Zf0Kf0C+n4aYo2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727515392; a=rsa-sha256; cv=none; b=tm+lvrdNg5KKwZre5n+oIAGGpMKDaO1ROZ89Zb61gOcwWEv7fZkknNteVa3RbXqlZrby2k DGtS9l8h7+MkjAlon7L+fqk4/m8OzNwnG7LQnQo6OdRPiBNDvvNeiKjRA3/ryoAkTKxtU8 FXHQejKYqo0TmQyTxDkkbaOeY9m5HOjcghwmxJUpeNTT7oCKP2nFIyMKCDfj1LGY1bFG+f zqplvBXe/oMz94wXKOVoZpWoG5OzuK4UpbHbsy2LdZ8zeiQzN3oyUDHoZR/Thhm3sqV+0O xVTsL6s6QoeD9LrfhERVsFZ4OLTGm0EHaKHGeBq4J1+61LTSyJCaGnaitOQnWA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XG21r0nYgzJgT; Sat, 28 Sep 2024 09:23:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48S9NCHc076284; Sat, 28 Sep 2024 09:23:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48S9NCY6076281; Sat, 28 Sep 2024 09:23:12 GMT (envelope-from git) Date: Sat, 28 Sep 2024 09:23:12 GMT Message-Id: <202409280923.48S9NCY6076281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: e9e57ee70bfa - stable/14 - ixgbe: update if_sriov with ix-3.3.38 changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e9e57ee70bfac510c0efa9af7900540e489dacec Auto-Submitted: auto-generated The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=e9e57ee70bfac510c0efa9af7900540e489dacec commit e9e57ee70bfac510c0efa9af7900540e489dacec Author: Kevin Bowling AuthorDate: 2024-09-21 09:56:19 +0000 Commit: Kevin Bowling CommitDate: 2024-09-28 09:22:27 +0000 ixgbe: update if_sriov with ix-3.3.38 changes There are some critical fixes here. The PF must communicate with each VF slot (vf->pool), only VFs shall use 0 for everything. IXGBE_FEATURE_SRIOV needs to be set before calling ixgbe_if_init(). With these changes, ixv(4) now attaches to VFs, but after bringing up VFs, the PF and VF still are not correctly passing traffic. (cherry picked from commit b6cd053e6da9bb8f77d2c6069260e52bbd53fa4a) --- sys/dev/ixgbe/if_sriov.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index eab5ff8f5da0..6a2dad4bca42 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -95,26 +95,26 @@ ixgbe_align_all_queue_indices(struct ixgbe_softc *sc) /* Support functions for SR-IOV/VF management */ static inline void -ixgbe_send_vf_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg) +ixgbe_send_vf_msg(struct ixgbe_hw *hw, struct ixgbe_vf *vf, u32 msg) { if (vf->flags & IXGBE_VF_CTS) msg |= IXGBE_VT_MSGTYPE_CTS; - ixgbe_write_mbx(&sc->hw, &msg, 1, vf->pool); + hw->mbx.ops[vf->pool].write(hw, &msg, 1, vf->pool); } static inline void ixgbe_send_vf_success(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg) { msg &= IXGBE_VT_MSG_MASK; - ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_SUCCESS); + ixgbe_send_vf_msg(&sc->hw, vf, msg | IXGBE_VT_MSGTYPE_SUCCESS); } static inline void ixgbe_send_vf_failure(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg) { msg &= IXGBE_VT_MSG_MASK; - ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_FAILURE); + ixgbe_send_vf_msg(&sc->hw, vf, msg | IXGBE_VT_MSGTYPE_FAILURE); } static inline void @@ -210,7 +210,7 @@ ixgbe_ping_all_vfs(struct ixgbe_softc *sc) for (int i = 0; i < sc->num_vfs; i++) { vf = &sc->vfs[i]; if (vf->flags & IXGBE_VF_ACTIVE) - ixgbe_send_vf_msg(sc, vf, IXGBE_PF_CONTROL_MSG); + ixgbe_send_vf_msg(&sc->hw, vf, IXGBE_PF_CONTROL_MSG); } } /* ixgbe_ping_all_vfs */ @@ -254,6 +254,17 @@ ixgbe_vf_set_default_vlan(struct ixgbe_softc *sc, struct ixgbe_vf *vf, IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf->pool), vmvir); } /* ixgbe_vf_set_default_vlan */ +static void +ixgbe_clear_vfmbmem(struct ixgbe_softc *sc, struct ixgbe_vf *vf) +{ + struct ixgbe_hw *hw = &sc->hw; + uint32_t vf_index = IXGBE_VF_INDEX(vf->pool); + uint16_t mbx_size = hw->mbx.size; + uint16_t i; + + for (i = 0; i < mbx_size; ++i) + IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_index), i, 0x0); +} /* ixgbe_clear_vfmbmem */ static boolean_t ixgbe_vf_frame_size_compatible(struct ixgbe_softc *sc, struct ixgbe_vf *vf) @@ -310,6 +321,8 @@ ixgbe_process_vf_reset(struct ixgbe_softc *sc, struct ixgbe_vf *vf) // XXX clear multicast addresses ixgbe_clear_rar(&sc->hw, vf->rar_index); + ixgbe_clear_vfmbmem(sc, vf); + ixgbe_toggle_txdctl(&sc->hw, IXGBE_VF_INDEX(vf->pool)); vf->api_ver = IXGBE_API_VER_UNKNOWN; } /* ixgbe_process_vf_reset */ @@ -371,7 +384,7 @@ ixgbe_vf_reset_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg) vf->flags |= IXGBE_VF_CTS; - resp[0] = IXGBE_VF_RESET | ack | IXGBE_VT_MSGTYPE_CTS; + resp[0] = IXGBE_VF_RESET | ack; bcopy(vf->ether_addr, &resp[1], ETHER_ADDR_LEN); resp[3] = hw->mac.mc_filter_type; ixgbe_write_mbx(hw, resp, IXGBE_VF_PERMADDR_MSG_LEN, vf->pool); @@ -582,7 +595,8 @@ ixgbe_process_vf_msg(if_ctx_t ctx, struct ixgbe_vf *vf) hw = &sc->hw; - error = ixgbe_read_mbx(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool); + error = hw->mbx.ops[vf->pool].read(hw, msg, IXGBE_VFMAILBOX_SIZE, + vf->pool); if (error != 0) return; @@ -643,13 +657,13 @@ ixgbe_handle_mbx(void *context) vf = &sc->vfs[i]; if (vf->flags & IXGBE_VF_ACTIVE) { - if (hw->mbx.ops[0].check_for_rst(hw, vf->pool) == 0) + if (hw->mbx.ops[vf->pool].check_for_rst(hw, vf->pool) == 0) ixgbe_process_vf_reset(sc, vf); - if (hw->mbx.ops[0].check_for_msg(hw, vf->pool) == 0) + if (hw->mbx.ops[vf->pool].check_for_msg(hw, vf->pool) == 0) ixgbe_process_vf_msg(ctx, vf); - if (hw->mbx.ops[0].check_for_ack(hw, vf->pool) == 0) + if (hw->mbx.ops[vf->pool].check_for_ack(hw, vf->pool) == 0) ixgbe_process_vf_ack(sc, vf); } } @@ -698,8 +712,10 @@ ixgbe_if_iov_init(if_ctx_t ctx, u16 num_vfs, const nvlist_t *config) } sc->num_vfs = num_vfs; - ixgbe_if_init(sc->ctx); + ixgbe_init_mbx_params_pf(&sc->hw); + sc->feat_en |= IXGBE_FEATURE_SRIOV; + ixgbe_if_init(sc->ctx); return (retval); @@ -769,7 +785,7 @@ ixgbe_init_vf(struct ixgbe_softc *sc, struct ixgbe_vf *vf) ixgbe_vf_enable_transmit(sc, vf); ixgbe_vf_enable_receive(sc, vf); - ixgbe_send_vf_msg(sc, vf, IXGBE_PF_CONTROL_MSG); + ixgbe_send_vf_msg(&sc->hw, vf, IXGBE_PF_CONTROL_MSG); } /* ixgbe_init_vf */ void