From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 080C5A09FF; Mon, 28 Dec 2020 04:00:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6A4D42BA2; Mon, 28 Dec 2020 04:00:37 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by dpdk.org (Postfix) with ESMTP id 244F92B94; Mon, 28 Dec 2020 04:00:35 +0100 (CET) Received: from localhost.localdomain (unknown [188.242.7.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 941797F507; Mon, 28 Dec 2020 06:00:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 941797F507 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1609124433; bh=Wr2++gpnVaGsGcEcAddAtbNVSiCxEXjZj59zb5BURpc=; h=From:To:Cc:Subject:Date; b=N3BA712oJTsYTmjulh2Hvd53mCyKWA+j3GSTCkq/GgVGrCqjL/1ijheBqNp3qfEUM YJ82yFTzZwky/oz7J/QQW1p4VdknRM8PkPx658BNWu4GGCnx9OEf9WBq9qq3TSHKQ1 3PrS/D4RZmiiCQZwx/ItZ2Uz0HelyEr6HwqGdzT8= From: Ivan Malov To: dev@dpdk.org Cc: stable@dpdk.org, Andy Moreton , Andrew Rybchenko Date: Mon, 28 Dec 2020 06:00:23 +0300 Message-Id: <20201228030023.24248-1-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] common/sfc_efx/base: fix MPORT-related byte order handling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" MPORT values derived by helper functions are little-endian. At the same time, MCDIs which consume these values perform one more host-order to little-endian conversion internally. Fix the helper functions to return host-order MPORT values. Fixes: 370ed675a952 ("common/sfc_efx/base: support setting PPORT in match spec") Fixes: bb024542fffd ("common/sfc_efx/base: add API for adding action drop") Fixes: 097058033f03 ("common/sfc_efx/base: add API to get mport of PF/VF") Cc: stable@dpdk.org Reported-by: Andy Moreton Reviewed-by: Andy Moreton Reviewed-by: Andrew Rybchenko Signed-off-by: Ivan Malov --- drivers/common/sfc_efx/base/efx_mae.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index a54d5f6e6..22f29d454 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -593,7 +593,13 @@ efx_mae_mport_by_phy_port( MAE_MPORT_SELECTOR_PPORT_ID, phy_port); memset(mportp, 0, sizeof (*mportp)); - mportp->sel = dword.ed_u32[0]; + /* + * The constructed DWORD is little-endian, + * but the resulting value is meant to be + * passed to MCDIs, where it will undergo + * host-order to little endian conversion. + */ + mportp->sel = EFX_DWORD_FIELD(dword, EFX_DWORD_0); return (0); @@ -630,7 +636,13 @@ efx_mae_mport_by_pcie_function( MAE_MPORT_SELECTOR_FUNC_VF_ID, vf); memset(mportp, 0, sizeof (*mportp)); - mportp->sel = dword.ed_u32[0]; + /* + * The constructed DWORD is little-endian, + * but the resulting value is meant to be + * passed to MCDIs, where it will undergo + * host-order to little endian conversion. + */ + mportp->sel = EFX_DWORD_FIELD(dword, EFX_DWORD_0); return (0); @@ -1319,7 +1331,13 @@ efx_mae_action_set_populate_drop( EFX_POPULATE_DWORD_1(dword, MAE_MPORT_SELECTOR_FLAT, MAE_MPORT_SELECTOR_NULL); - mport.sel = dword.ed_u32[0]; + /* + * The constructed DWORD is little-endian, + * but the resulting value is meant to be + * passed to MCDIs, where it will undergo + * host-order to little endian conversion. + */ + mport.sel = EFX_DWORD_FIELD(dword, EFX_DWORD_0); arg = (const uint8_t *)&mport.sel; -- 2.20.1