mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
bnxt_en: Add Virtual Admin Link State Support for VFs
The firmware can now cache the virtual link admin state (auto/on/off) of all VFs and as such, the PF driver no longer has to intercept the VF driver's port_phy_qcfg() call and then provide the link admin state. If the FW does not have this capability, fall back to the existing interception method. The initial default link admin state (auto) is also set initially when the VFs are created. Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com> Signed-off-by: Rob Miller <rmiller@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20251126215648.1885936-7-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
30f253f8d9
commit
72405298e9
@@ -5695,6 +5695,10 @@ int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap, int bmap_size,
|
||||
u16 cmd = bnxt_vf_req_snif[i];
|
||||
unsigned int bit, idx;
|
||||
|
||||
if ((bp->fw_cap & BNXT_FW_CAP_LINK_ADMIN) &&
|
||||
cmd == HWRM_PORT_PHY_QCFG)
|
||||
continue;
|
||||
|
||||
idx = cmd / 32;
|
||||
bit = cmd % 32;
|
||||
data[idx] |= 1 << bit;
|
||||
@@ -9665,6 +9669,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
|
||||
bp->flags |= BNXT_FLAG_ROCEV1_CAP;
|
||||
if (flags & FUNC_QCAPS_RESP_FLAGS_ROCE_V2_SUPPORTED)
|
||||
bp->flags |= BNXT_FLAG_ROCEV2_CAP;
|
||||
if (flags & FUNC_QCAPS_RESP_FLAGS_LINK_ADMIN_STATUS_SUPPORTED)
|
||||
bp->fw_cap |= BNXT_FW_CAP_LINK_ADMIN;
|
||||
if (flags & FUNC_QCAPS_RESP_FLAGS_PCIE_STATS_SUPPORTED)
|
||||
bp->fw_cap |= BNXT_FW_CAP_PCIE_STATS_SUPPORTED;
|
||||
if (flags & FUNC_QCAPS_RESP_FLAGS_HOT_RESET_CAPABLE)
|
||||
|
||||
@@ -2484,6 +2484,7 @@ struct bnxt {
|
||||
#define BNXT_FW_CAP_ROCE_VF_RESC_MGMT_SUPPORTED BIT_ULL(6)
|
||||
#define BNXT_FW_CAP_KONG_MB_CHNL BIT_ULL(7)
|
||||
#define BNXT_FW_CAP_ROCE_VF_DYN_ALLOC_SUPPORT BIT_ULL(8)
|
||||
#define BNXT_FW_CAP_LINK_ADMIN BIT_ULL(9)
|
||||
#define BNXT_FW_CAP_OVS_64BIT_HANDLE BIT_ULL(10)
|
||||
#define BNXT_FW_CAP_TRUSTED_VF BIT_ULL(11)
|
||||
#define BNXT_FW_CAP_ERROR_RECOVERY BIT_ULL(13)
|
||||
|
||||
@@ -332,6 +332,38 @@ int bnxt_set_vf_bw(struct net_device *dev, int vf_id, int min_tx_rate,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int bnxt_set_vf_link_admin_state(struct bnxt *bp, int vf_id)
|
||||
{
|
||||
struct hwrm_func_cfg_input *req;
|
||||
struct bnxt_vf_info *vf;
|
||||
int rc;
|
||||
|
||||
if (!(bp->fw_cap & BNXT_FW_CAP_LINK_ADMIN))
|
||||
return 0;
|
||||
|
||||
vf = &bp->pf.vf[vf_id];
|
||||
|
||||
rc = bnxt_hwrm_func_cfg_short_req_init(bp, &req);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
req->fid = cpu_to_le16(vf->fw_fid);
|
||||
switch (vf->flags & (BNXT_VF_LINK_FORCED | BNXT_VF_LINK_UP)) {
|
||||
case BNXT_VF_LINK_FORCED:
|
||||
req->options =
|
||||
FUNC_CFG_REQ_OPTIONS_LINK_ADMIN_STATE_FORCED_DOWN;
|
||||
break;
|
||||
case (BNXT_VF_LINK_FORCED | BNXT_VF_LINK_UP):
|
||||
req->options = FUNC_CFG_REQ_OPTIONS_LINK_ADMIN_STATE_FORCED_UP;
|
||||
break;
|
||||
default:
|
||||
req->options = FUNC_CFG_REQ_OPTIONS_LINK_ADMIN_STATE_AUTO;
|
||||
break;
|
||||
}
|
||||
req->enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_ADMIN_LINK_STATE);
|
||||
return hwrm_req_send(bp, req);
|
||||
}
|
||||
|
||||
int bnxt_set_vf_link_state(struct net_device *dev, int vf_id, int link)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
@@ -357,10 +389,11 @@ int bnxt_set_vf_link_state(struct net_device *dev, int vf_id, int link)
|
||||
break;
|
||||
default:
|
||||
netdev_err(bp->dev, "Invalid link option\n");
|
||||
rc = -EINVAL;
|
||||
break;
|
||||
return -EINVAL;
|
||||
}
|
||||
if (vf->flags & (BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED))
|
||||
if (bp->fw_cap & BNXT_FW_CAP_LINK_ADMIN)
|
||||
rc = bnxt_set_vf_link_admin_state(bp, vf_id);
|
||||
else if (vf->flags & (BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED))
|
||||
rc = bnxt_hwrm_fwd_async_event_cmpl(bp, vf,
|
||||
ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE);
|
||||
return rc;
|
||||
@@ -666,15 +699,21 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
|
||||
|
||||
hwrm_req_hold(bp, req);
|
||||
for (i = 0; i < num_vfs; i++) {
|
||||
struct bnxt_vf_info *vf = &pf->vf[i];
|
||||
|
||||
vf->fw_fid = pf->first_vf_id + i;
|
||||
rc = bnxt_set_vf_link_admin_state(bp, i);
|
||||
if (rc)
|
||||
break;
|
||||
|
||||
if (reset)
|
||||
__bnxt_set_vf_params(bp, i);
|
||||
|
||||
req->vf_id = cpu_to_le16(pf->first_vf_id + i);
|
||||
req->vf_id = cpu_to_le16(vf->fw_fid);
|
||||
rc = hwrm_req_send(bp, req);
|
||||
if (rc)
|
||||
break;
|
||||
pf->active_vfs = i + 1;
|
||||
pf->vf[i].fw_fid = pf->first_vf_id + i;
|
||||
}
|
||||
|
||||
if (pf->active_vfs) {
|
||||
@@ -741,6 +780,12 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs)
|
||||
FUNC_CFG_REQ_ENABLES_NUM_VNICS |
|
||||
FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS);
|
||||
|
||||
if (bp->fw_cap & BNXT_FW_CAP_LINK_ADMIN) {
|
||||
req->options = FUNC_CFG_REQ_OPTIONS_LINK_ADMIN_STATE_AUTO;
|
||||
req->enables |=
|
||||
cpu_to_le32(FUNC_CFG_REQ_ENABLES_ADMIN_LINK_STATE);
|
||||
}
|
||||
|
||||
mtu = bp->dev->mtu + VLAN_ETH_HLEN;
|
||||
req->mru = cpu_to_le16(mtu);
|
||||
req->admin_mtu = cpu_to_le16(mtu);
|
||||
|
||||
Reference in New Issue
Block a user