Skip to content

Commit 1da63dd

Browse files
Edwin Peerdavem330
authored andcommitted
bnxt_en: allow firmware to disable VLAN offloads
Bare-metal use cases require giving firmware and the embedded application processor control over VLAN offloads. The driver should not attempt to override or utilize this feature in such scenarios since it will not work as expected. Signed-off-by: Edwin Peer <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a196e96 commit 1da63dd

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5218,6 +5218,14 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
52185218
if (flags &
52195219
VNIC_QCAPS_RESP_FLAGS_ROCE_MIRRORING_CAPABLE_VNIC_CAP)
52205220
bp->flags |= BNXT_FLAG_ROCE_MIRROR_CAP;
5221+
5222+
/* Older P5 fw before EXT_HW_STATS support did not set
5223+
* VLAN_STRIP_CAP properly.
5224+
*/
5225+
if ((flags & VNIC_QCAPS_RESP_FLAGS_VLAN_STRIP_CAP) ||
5226+
((bp->flags & BNXT_FLAG_CHIP_P5) &&
5227+
!(bp->fw_cap & BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED)))
5228+
bp->fw_cap |= BNXT_FW_CAP_VLAN_RX_STRIP;
52215229
bp->max_tpa_v2 = le16_to_cpu(resp->max_aggs_supported);
52225230
if (bp->max_tpa_v2)
52235231
bp->hw_ring_stats_size =
@@ -7049,7 +7057,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
70497057
struct hwrm_func_qcaps_input req = {0};
70507058
struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr;
70517059
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
7052-
u32 flags;
7060+
u32 flags, flags_ext;
70537061

70547062
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCAPS, -1, -1);
70557063
req.fid = cpu_to_le16(0xffff);
@@ -7074,6 +7082,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
70747082
bp->fw_cap |= BNXT_FW_CAP_ERROR_RECOVERY;
70757083
if (flags & FUNC_QCAPS_RESP_FLAGS_ERR_RECOVER_RELOAD)
70767084
bp->fw_cap |= BNXT_FW_CAP_ERR_RECOVER_RELOAD;
7085+
if (!(flags & FUNC_QCAPS_RESP_FLAGS_VLAN_ACCELERATION_TX_DISABLED))
7086+
bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT;
7087+
7088+
flags_ext = le32_to_cpu(resp->flags_ext);
7089+
if (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_EXT_HW_STATS_SUPPORTED)
7090+
bp->fw_cap |= BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED;
70777091

70787092
bp->tx_push_thresh = 0;
70797093
if ((flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED) &&
@@ -12052,8 +12066,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1205212066
dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM |
1205312067
NETIF_F_GSO_GRE_CSUM;
1205412068
dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA;
12055-
dev->hw_features |= BNXT_HW_FEATURE_VLAN_ALL_RX |
12056-
BNXT_HW_FEATURE_VLAN_ALL_TX;
12069+
if (bp->fw_cap & BNXT_FW_CAP_VLAN_RX_STRIP)
12070+
dev->hw_features |= BNXT_HW_FEATURE_VLAN_ALL_RX;
12071+
if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT)
12072+
dev->hw_features |= BNXT_HW_FEATURE_VLAN_ALL_TX;
1205712073
if (BNXT_SUPPORTS_TPA(bp))
1205812074
dev->hw_features |= NETIF_F_GRO_HW;
1205912075
dev->features |= dev->hw_features | NETIF_F_HIGHDMA;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,9 @@ struct bnxt {
17161716
#define BNXT_FW_CAP_ERR_RECOVER_RELOAD 0x00100000
17171717
#define BNXT_FW_CAP_HOT_RESET 0x00200000
17181718
#define BNXT_FW_CAP_SHARED_PORT_CFG 0x00400000
1719+
#define BNXT_FW_CAP_VLAN_RX_STRIP 0x01000000
1720+
#define BNXT_FW_CAP_VLAN_TX_INSERT 0x02000000
1721+
#define BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED 0x04000000
17191722

17201723
#define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
17211724
u32 hwrm_spec_code;

0 commit comments

Comments
 (0)