common/sfc_efx/base: fix MPORT related byte order handling

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: 370ed675a9 ("common/sfc_efx/base: support setting PPORT in match spec")
Fixes: bb024542ff ("common/sfc_efx/base: add API for adding action drop")
Fixes: 097058033f ("common/sfc_efx/base: add API to get mport of PF/VF")
Cc: stable@dpdk.org

Reported-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
This commit is contained in:
Ivan Malov 2020-12-28 06:00:23 +03:00 committed by Ferruh Yigit
parent e53562d7ab
commit f0d58c4b50

View File

@ -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;