You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
5.8 KiB
163 lines
5.8 KiB
From 94a4266dd4286313065805b7d482f1aa7c61acd8 Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Toppins <jtoppins@redhat.com>
|
|
Date: Wed, 2 Oct 2019 18:23:30 -0400
|
|
Subject: [PATCH 75/96] [netdrv] bnxt_en: Retain user settings on a VF after
|
|
RESET_NOTIFY event
|
|
|
|
Message-id: <dd4423a80cc562371bcf6ad7b9dc860e4c0041f5.1570027456.git.jtoppins@redhat.com>
|
|
Patchwork-id: 276489
|
|
O-Subject: [RHEL-8.2 PATCH 68/78] bnxt_en: Retain user settings on a VF after RESET_NOTIFY event.
|
|
Bugzilla: 1724766
|
|
RH-Acked-by: John Linville <linville@redhat.com>
|
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
Retain the VF MAC address, default VLAN, TX rate control, trust settings
|
|
of VFs after firmware reset.
|
|
|
|
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
|
|
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
(cherry picked from commit 2cd8696850450b750f278be06ee56eb51d84621c)
|
|
Bugzilla: 1724766
|
|
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23809532
|
|
Tested: build, boot, basic ping
|
|
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
|
|
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
|
|
---
|
|
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
|
|
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 50 +++++++++++++++++++++----
|
|
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h | 2 +-
|
|
3 files changed, 45 insertions(+), 9 deletions(-)
|
|
|
|
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt.c
|
|
===================================================================
|
|
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt.c 2020-02-06 16:23:20.307470956 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt.c 2020-02-06 16:23:20.461469542 +0100
|
|
@@ -9216,7 +9216,7 @@
|
|
int n = pf->active_vfs;
|
|
|
|
if (n)
|
|
- bnxt_cfg_hw_sriov(bp, &n);
|
|
+ bnxt_cfg_hw_sriov(bp, &n, true);
|
|
}
|
|
bnxt_hwmon_open(bp);
|
|
}
|
|
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
|
|
===================================================================
|
|
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c 2020-02-06 16:23:19.750476068 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c 2020-02-06 16:23:20.461469542 +0100
|
|
@@ -470,10 +470,43 @@
|
|
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
}
|
|
|
|
+/* Caller holds bp->hwrm_cmd_lock mutex lock */
|
|
+static void __bnxt_set_vf_params(struct bnxt *bp, int vf_id)
|
|
+{
|
|
+ struct hwrm_func_cfg_input req = {0};
|
|
+ struct bnxt_vf_info *vf;
|
|
+
|
|
+ vf = &bp->pf.vf[vf_id];
|
|
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
|
|
+ req.fid = cpu_to_le16(vf->fw_fid);
|
|
+ req.flags = cpu_to_le32(vf->func_flags);
|
|
+
|
|
+ if (is_valid_ether_addr(vf->mac_addr)) {
|
|
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR);
|
|
+ memcpy(req.dflt_mac_addr, vf->mac_addr, ETH_ALEN);
|
|
+ }
|
|
+ if (vf->vlan) {
|
|
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_VLAN);
|
|
+ req.dflt_vlan = cpu_to_le16(vf->vlan);
|
|
+ }
|
|
+ if (vf->max_tx_rate) {
|
|
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_MAX_BW);
|
|
+ req.max_bw = cpu_to_le32(vf->max_tx_rate);
|
|
+#ifdef HAVE_IFLA_TX_RATE
|
|
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_MIN_BW);
|
|
+ req.min_bw = cpu_to_le32(vf->min_tx_rate);
|
|
+#endif
|
|
+ }
|
|
+ if (vf->flags & BNXT_VF_TRUST)
|
|
+ req.flags |= cpu_to_le32(FUNC_CFG_REQ_FLAGS_TRUSTED_VF_ENABLE);
|
|
+
|
|
+ _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
+}
|
|
+
|
|
/* Only called by PF to reserve resources for VFs, returns actual number of
|
|
* VFs configured, or < 0 on error.
|
|
*/
|
|
-static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs)
|
|
+static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
|
|
{
|
|
struct hwrm_func_vf_resource_cfg_input req = {0};
|
|
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
|
|
@@ -545,6 +578,9 @@
|
|
|
|
mutex_lock(&bp->hwrm_cmd_lock);
|
|
for (i = 0; i < num_vfs; i++) {
|
|
+ if (reset)
|
|
+ __bnxt_set_vf_params(bp, i);
|
|
+
|
|
req.vf_id = cpu_to_le16(pf->first_vf_id + i);
|
|
rc = _hwrm_send_message(bp, &req, sizeof(req),
|
|
HWRM_CMD_TIMEOUT);
|
|
@@ -659,15 +695,15 @@
|
|
return rc;
|
|
}
|
|
|
|
-static int bnxt_func_cfg(struct bnxt *bp, int num_vfs)
|
|
+static int bnxt_func_cfg(struct bnxt *bp, int num_vfs, bool reset)
|
|
{
|
|
if (BNXT_NEW_RM(bp))
|
|
- return bnxt_hwrm_func_vf_resc_cfg(bp, num_vfs);
|
|
+ return bnxt_hwrm_func_vf_resc_cfg(bp, num_vfs, reset);
|
|
else
|
|
return bnxt_hwrm_func_cfg(bp, num_vfs);
|
|
}
|
|
|
|
-int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs)
|
|
+int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset)
|
|
{
|
|
int rc;
|
|
|
|
@@ -677,7 +713,7 @@
|
|
return rc;
|
|
|
|
/* Reserve resources for VFs */
|
|
- rc = bnxt_func_cfg(bp, *num_vfs);
|
|
+ rc = bnxt_func_cfg(bp, *num_vfs, reset);
|
|
if (rc != *num_vfs) {
|
|
if (rc <= 0) {
|
|
netdev_warn(bp->dev, "Unable to reserve resources for SRIOV.\n");
|
|
@@ -758,7 +794,7 @@
|
|
if (rc)
|
|
goto err_out1;
|
|
|
|
- rc = bnxt_cfg_hw_sriov(bp, num_vfs);
|
|
+ rc = bnxt_cfg_hw_sriov(bp, num_vfs, false);
|
|
if (rc)
|
|
goto err_out2;
|
|
|
|
@@ -1144,7 +1180,7 @@
|
|
}
|
|
#else
|
|
|
|
-int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs)
|
|
+int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset)
|
|
{
|
|
if (*num_vfs)
|
|
return -EOPNOTSUPP;
|
|
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
|
|
===================================================================
|
|
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h 2020-02-06 16:23:18.878484072 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h 2020-02-06 16:23:20.461469542 +0100
|
|
@@ -36,7 +36,7 @@
|
|
int bnxt_set_vf_spoofchk(struct net_device *, int, bool);
|
|
int bnxt_set_vf_trust(struct net_device *dev, int vf_id, bool trust);
|
|
int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs);
|
|
-int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs);
|
|
+int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset);
|
|
void bnxt_sriov_disable(struct bnxt *);
|
|
void bnxt_hwrm_exec_fwd_req(struct bnxt *);
|
|
void bnxt_update_vf_mac(struct bnxt *);
|