Skip to content

Commit e76d44f

Browse files
sreekanthbrcmdavem330
authored andcommitted
bnxt_en: Support QOS and TPID settings for the SRIOV VLAN
Add these missing settings in the .ndo_set_vf_vlan() method. Older firmware does not support the TPID setting so check for proper support. Remove the unused BNXT_VF_QOS flag. Signed-off-by: Sreekanth Reddy <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a19b480 commit e76d44f

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7750,6 +7750,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
77507750
bp->fw_cap |= BNXT_FW_CAP_HOT_RESET_IF;
77517751
if (BNXT_PF(bp) && (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_FW_LIVEPATCH_SUPPORTED))
77527752
bp->fw_cap |= BNXT_FW_CAP_LIVEPATCH;
7753+
if (BNXT_PF(bp) && (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_DFLT_VLAN_TPID_PCP_SUPPORTED))
7754+
bp->fw_cap |= BNXT_FW_CAP_DFLT_VLAN_TPID_PCP;
77537755

77547756
flags_ext2 = le32_to_cpu(resp->flags_ext2);
77557757
if (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,6 @@ struct bnxt_vf_info {
11351135
u16 vlan;
11361136
u16 func_qcfg_flags;
11371137
u32 flags;
1138-
#define BNXT_VF_QOS 0x1
11391138
#define BNXT_VF_SPOOFCHK 0x2
11401139
#define BNXT_VF_LINK_FORCED 0x4
11411140
#define BNXT_VF_LINK_UP 0x8
@@ -2014,6 +2013,7 @@ struct bnxt {
20142013
#define BNXT_FW_CAP_DBG_QCAPS BIT_ULL(31)
20152014
#define BNXT_FW_CAP_PTP BIT_ULL(32)
20162015
#define BNXT_FW_CAP_THRESHOLD_TEMP_SUPPORTED BIT_ULL(33)
2016+
#define BNXT_FW_CAP_DFLT_VLAN_TPID_PCP BIT_ULL(34)
20172017

20182018
u32 fw_dbg_cap;
20192019

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/if_vlan.h>
1616
#include <linux/interrupt.h>
1717
#include <linux/etherdevice.h>
18+
#include <net/dcbnl.h>
1819
#include "bnxt_hsi.h"
1920
#include "bnxt.h"
2021
#include "bnxt_hwrm.h"
@@ -196,11 +197,8 @@ int bnxt_get_vf_config(struct net_device *dev, int vf_id,
196197
memcpy(&ivi->mac, vf->vf_mac_addr, ETH_ALEN);
197198
ivi->max_tx_rate = vf->max_tx_rate;
198199
ivi->min_tx_rate = vf->min_tx_rate;
199-
ivi->vlan = vf->vlan;
200-
if (vf->flags & BNXT_VF_QOS)
201-
ivi->qos = vf->vlan >> VLAN_PRIO_SHIFT;
202-
else
203-
ivi->qos = 0;
200+
ivi->vlan = vf->vlan & VLAN_VID_MASK;
201+
ivi->qos = vf->vlan >> VLAN_PRIO_SHIFT;
204202
ivi->spoofchk = !!(vf->flags & BNXT_VF_SPOOFCHK);
205203
ivi->trusted = bnxt_is_trusted_vf(bp, vf);
206204
if (!(vf->flags & BNXT_VF_LINK_FORCED))
@@ -256,21 +254,21 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos,
256254
if (bp->hwrm_spec_code < 0x10201)
257255
return -ENOTSUPP;
258256

259-
if (vlan_proto != htons(ETH_P_8021Q))
257+
if (vlan_proto != htons(ETH_P_8021Q) &&
258+
(vlan_proto != htons(ETH_P_8021AD) ||
259+
!(bp->fw_cap & BNXT_FW_CAP_DFLT_VLAN_TPID_PCP)))
260260
return -EPROTONOSUPPORT;
261261

262262
rc = bnxt_vf_ndo_prep(bp, vf_id);
263263
if (rc)
264264
return rc;
265265

266-
/* TODO: needed to implement proper handling of user priority,
267-
* currently fail the command if there is valid priority
268-
*/
269-
if (vlan_id > 4095 || qos)
266+
if (vlan_id >= VLAN_N_VID || qos >= IEEE_8021Q_MAX_PRIORITIES ||
267+
(!vlan_id && qos))
270268
return -EINVAL;
271269

272270
vf = &bp->pf.vf[vf_id];
273-
vlan_tag = vlan_id;
271+
vlan_tag = vlan_id | (u16)qos << VLAN_PRIO_SHIFT;
274272
if (vlan_tag == vf->vlan)
275273
return 0;
276274

@@ -279,6 +277,10 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos,
279277
req->fid = cpu_to_le16(vf->fw_fid);
280278
req->dflt_vlan = cpu_to_le16(vlan_tag);
281279
req->enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_VLAN);
280+
if (bp->fw_cap & BNXT_FW_CAP_DFLT_VLAN_TPID_PCP) {
281+
req->enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_TPID);
282+
req->tpid = vlan_proto;
283+
}
282284
rc = hwrm_req_send(bp, req);
283285
if (!rc)
284286
vf->vlan = vlan_tag;

0 commit comments

Comments
 (0)