i40e: Set RX_ONLY mode for unicast promiscuous on VLAN
Subsystems (2)
PATCH 1/1 i40e: Set RX_ONLY mode for unicast promiscuous on VLAN
From: Przemyslaw Patynowski <[email protected]>
Trusted VF with unicast promiscuous mode set, could listen to TX traffic of other VFs.
Set unicast promiscuous mode to rx traffic, if VSI has port VLAN configured. Rename misleading I40E_AQC_SET_VSI_PROMISC_TX bit to I40E_AQC_SET_VSI_PROMISC_RX_ONLY. Aligned unicast promiscuous with VLAN to the one without VLAN.
Previously, other trusted VFs with port VLAN could listen to unicast tx traffic of other VFs.
--- .../net/ethernet/intel/i40e/i40e_adminq_cmd.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_common.c | 35 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +1 -1
@@ -981,7 +981,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {#define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04#define I40E_AQC_SET_VSI_DEFAULT 0x08#define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10 -#define I40E_AQC_SET_VSI_PROMISC_TX 0x8000 +#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY 0x8000__le16 seid;__le16 vlan_tag;#define I40E_AQC_SET_VSI_VLAN_VALID 0x8000
drivers/net/ethernet/intel/i40e/i40e_common.c +27 -8
@@ -1966,6 +1966,21 @@ i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,return status; } +/** +* i40e_is_aq_api_ver_ge +* @hw: pointer to the hw struct +* @maj: api major value +* @min: api minor value +* +* Assert whether current HW api version is greater/equal than provided. +**/ +static bool i40e_is_aq_api_ver_ge (struct i40e_adminq_info *aq,u16 maj, +u16 min) +{ +return (aq->api_maj_ver > maj || + (aq->api_maj_ver == maj && aq->api_min_ver >= min)); +} +/** * i40e_aq_add_vsi * @hw: pointer to the hw struct
@@ -2091,18 +2106,16 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,if (set) { flags |=I40E_AQC_SET_VSI_PROMISC_UNICAST ; -if (rx_only_promisc && - (((hw->aq.api_maj_ver ==1 ) && (hw->aq.api_min_ver >=5 )) || - (hw->aq.api_maj_ver >1 ))) - flags |=I40E_AQC_SET_VSI_PROMISC_TX ; +if (rx_only_promisc &&i40e_is_aq_api_ver_ge (&hw->aq,1 ,5 )) + flags |=I40E_AQC_SET_VSI_PROMISC_RX_ONLY ; } cmd->promiscuous_flags =cpu_to_le16 (flags); cmd->valid_flags =cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_UNICAST ); -if (((hw->aq.api_maj_ver >=1 ) && (hw->aq.api_min_ver >=5 )) || - (hw->aq.api_maj_ver >1 )) - cmd->valid_flags |=cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_TX ); +if (i40e_is_aq_api_ver_ge (&hw->aq,1 ,5 )) + cmd->valid_flags |= +cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_RX_ONLY ); cmd->seid =cpu_to_le16 (seid); status =i40e_asq_send_command (hw, &desc,NULL ,0 , cmd_details);
@@ -2199,11 +2212,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,i40e_fill_default_direct_cmd_desc (&desc, i40e_aqc_opc_set_vsi_promiscuous_modes); -if (enable) +if (enable) { flags |=I40E_AQC_SET_VSI_PROMISC_UNICAST ; +if (i40e_is_aq_api_ver_ge (&hw->aq,1 ,5 )) + flags |=I40E_AQC_SET_VSI_PROMISC_RX_ONLY ; + } cmd->promiscuous_flags =cpu_to_le16 (flags); cmd->valid_flags =cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_UNICAST ); +if (i40e_is_aq_api_ver_ge (&hw->aq,1 ,5 )) + cmd->valid_flags |= +cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_RX_ONLY ); cmd->seid =cpu_to_le16 (seid); cmd->vlan_tag =cpu_to_le16 (vid |I40E_AQC_SET_VSI_VLAN_VALID );
Signature · 7 lines
2.26.0 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN. Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
Bowers
PATCH 1/1 i40e: Set RX_ONLY mode for unicast promiscuous on VLAN
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Arkadiusz Kubalewski
Sent: Thursday, August 6, 2020 6:41 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Loktionov, Aleksandr <[email protected]>; Patynowski, PrzemyslawX <[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e: SetRX_ONLYmode for unicast promiscuous on VLANFrom: Przemyslaw Patynowski <[email protected]>
Trusted VF with unicast promiscuous mode set, could listen to TX traffic of other VFs.
Set unicast promiscuous mode to rx traffic, if VSI has port VLAN configured. Rename misleadingI40E_AQC_SET_VSI_PROMISC_TXbit toI40E_AQC_SET_VSI_PROMISC_RX_ONLY. Aligned unicast promiscuous with VLAN to the one without VLAN.
Previously, other trusted VFs with port VLAN could listen to unicast tx traffic of other VFs.
Quoted 8 lines
Signed-off-by: Przemyslaw Patynowski
<[email protected]>Signed-off-by Aleksandr Loktionov <[email protected]>Signed-off-by Arkadiusz Kubalewski <[email protected]>--- .../net/ethernet/intel/i40e/i40e_adminq_cmd.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_common.c | 35 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-)