From c27153682eac34e04f5346dd554ad74a78d84c0e Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Wed, 4 Oct 2023 11:20:29 -0700 Subject: [PATCH] Revert "bnxt_en: Support QOS and TPID settings for the SRIOV VLAN" This reverts commit e76d44fe722761f5480b908e38c5ce1a2c2cb6d6. We no longer accept drivers extending their use of the legacy SR-IOV configuration APIs. Users should move to bridge offload. Link: https://lore.kernel.org/r/20231004112243.41cb6351@kernel.org/ Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 -- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + .../net/ethernet/broadcom/bnxt/bnxt_sriov.c | 24 +++++++++---------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 82833326a852..b0ca3b319e4f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7750,8 +7750,6 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->fw_cap |= BNXT_FW_CAP_HOT_RESET_IF; if (BNXT_PF(bp) && (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_FW_LIVEPATCH_SUPPORTED)) bp->fw_cap |= BNXT_FW_CAP_LIVEPATCH; - if (BNXT_PF(bp) && (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_DFLT_VLAN_TPID_PCP_SUPPORTED)) - bp->fw_cap |= BNXT_FW_CAP_DFLT_VLAN_TPID_PCP; flags_ext2 = le32_to_cpu(resp->flags_ext2); if (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 5d8252272cc9..9ce0193798d4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1135,6 +1135,7 @@ struct bnxt_vf_info { u16 vlan; u16 func_qcfg_flags; u32 flags; +#define BNXT_VF_QOS 0x1 #define BNXT_VF_SPOOFCHK 0x2 #define BNXT_VF_LINK_FORCED 0x4 #define BNXT_VF_LINK_UP 0x8 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c index 38fe44838639..1f925d247244 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -15,7 +15,6 @@ #include #include #include -#include #include "bnxt_hsi.h" #include "bnxt.h" #include "bnxt_hwrm.h" @@ -197,8 +196,11 @@ int bnxt_get_vf_config(struct net_device *dev, int vf_id, memcpy(&ivi->mac, vf->vf_mac_addr, ETH_ALEN); ivi->max_tx_rate = vf->max_tx_rate; ivi->min_tx_rate = vf->min_tx_rate; - ivi->vlan = vf->vlan & VLAN_VID_MASK; - ivi->qos = vf->vlan >> VLAN_PRIO_SHIFT; + ivi->vlan = vf->vlan; + if (vf->flags & BNXT_VF_QOS) + ivi->qos = vf->vlan >> VLAN_PRIO_SHIFT; + else + ivi->qos = 0; ivi->spoofchk = !!(vf->flags & BNXT_VF_SPOOFCHK); ivi->trusted = bnxt_is_trusted_vf(bp, vf); if (!(vf->flags & BNXT_VF_LINK_FORCED)) @@ -254,21 +256,21 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos, if (bp->hwrm_spec_code < 0x10201) return -ENOTSUPP; - if (vlan_proto != htons(ETH_P_8021Q) && - (vlan_proto != htons(ETH_P_8021AD) || - !(bp->fw_cap & BNXT_FW_CAP_DFLT_VLAN_TPID_PCP))) + if (vlan_proto != htons(ETH_P_8021Q)) return -EPROTONOSUPPORT; rc = bnxt_vf_ndo_prep(bp, vf_id); if (rc) return rc; - if (vlan_id >= VLAN_N_VID || qos >= IEEE_8021Q_MAX_PRIORITIES || - (!vlan_id && qos)) + /* TODO: needed to implement proper handling of user priority, + * currently fail the command if there is valid priority + */ + if (vlan_id > 4095 || qos) return -EINVAL; vf = &bp->pf.vf[vf_id]; - vlan_tag = vlan_id | (u16)qos << VLAN_PRIO_SHIFT; + vlan_tag = vlan_id; if (vlan_tag == vf->vlan) return 0; @@ -277,10 +279,6 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos, req->fid = cpu_to_le16(vf->fw_fid); req->dflt_vlan = cpu_to_le16(vlan_tag); req->enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_VLAN); - if (bp->fw_cap & BNXT_FW_CAP_DFLT_VLAN_TPID_PCP) { - req->enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_TPID); - req->tpid = vlan_proto; - } rc = hwrm_req_send(bp, req); if (!rc) vf->vlan = vlan_tag; -- 2.20.1