From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-ft5.fr.colt.net (smtp-ft5.fr.colt.net [213.41.78.197]) by dpdk.org (Postfix) with ESMTP id B3EB058C4 for ; Mon, 12 May 2014 16:11:51 +0200 (CEST) Received: from smtp-ex4.fr.colt.net (smtp-ex4.fr.colt.net [213.41.78.193]) by smtp-ft5.fr.colt.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id s4CEBxxO001947 for ; Mon, 12 May 2014 16:11:59 +0200 Received: from 33.106-14-84.ripe.coltfrance.com ([84.14.106.33] helo=proxy.6wind.com) by smtp-ex4.fr.colt.net with esmtp (Exim) (envelope-from ) id 1WjqxS-0005mQ-15 for ; Mon, 12 May 2014 16:11:59 +0200 Received: from 6wind.com (unknown [10.16.0.189]) by proxy.6wind.com (Postfix) with SMTP id E831F282B6; Mon, 12 May 2014 16:11:56 +0200 (CEST) Received: by 6wind.com (sSMTP sendmail emulation); Mon, 12 May 2014 16:11:56 +0200 From: Ivan Boule To: dev@dpdk.org Date: Mon, 12 May 2014 16:11:54 +0200 Message-Id: <1399903914-22074-1-git-send-email-ivan.boule@6wind.com> X-Mailer: git-send-email 1.7.10.4 X-ACL-Warn: 1/1 recipients OK. Subject: [dpdk-dev] [PATCH 4/5] ixgbe: reset unused VF mailbox data registers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 May 2014 14:11:51 -0000 The VF_RESET message of the 82599 PF/VF communication protocol issued by a a Guest VF driver may include an optional permanent MAC address assigned to the VF by the Guest OS, in order to make it recorded into the 82599 RAR registers by the Host PF driver. To indicate the absence of this optional MAC address, the VF_RESET command assumes that a NULL MAC address is sent, instead of using a dedicated bit for this purpose. However, when sending a VF_RESET command with no permanent MAC address, the function ixgbe_reset_hw_vf() of the 82599 VF driver directly invokes the function ixgbe_write_mbx_vf() with a message that does not include a NULL MAC address, wrongly assuming that this function fills in with zero all unused mailbox data registers. More globally, it is safer to explicitely reset to zero all remaining mailbox data registers that are not used to store the content of a message, in order to reset the data sent in a previous VF/PF exchange (in either side), including the last exchange performed by another Guest OS to which that VF was previously assigned. Signed-off-by: Ivan Boule --- lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c index 1dc13dc..d0ab8b3 100644 --- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c +++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c @@ -431,6 +431,17 @@ STATIC s32 ixgbe_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size, for (i = 0; i < size; i++) IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]); + /* + * Complete the remaining mailbox data registers with zero to reset + * the data sent in a previous exchange (in either side) with the PF, + * including exchanges performed by another Guest OS to which that VF + * was previously assigned. + */ + while (i < hw->mbx.size) { + IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, 0); + i++; + } + /* update stats */ hw->mbx.stats.msgs_tx++; @@ -661,6 +672,17 @@ STATIC s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size, for (i = 0; i < size; i++) IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, msg[i]); + /* + * Complete the remaining mailbox data registers with zero to reset + * the data sent in a previous exchange (in either side) with the VF, + * including exchanges performed by another Guest OS to which that VF + * was previously assigned. + */ + while (i < hw->mbx.size) { + IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, 0); + i++; + } + /* Interrupt VF to tell it a message has been sent and release buffer*/ IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_STS); -- 1.7.10.4