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.
170 lines
5.2 KiB
170 lines
5.2 KiB
From 345da077d523267494a9414944cde11bef6ff3cf Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Toppins <jtoppins@redhat.com>
|
|
Date: Wed, 2 Oct 2019 18:23:16 -0400
|
|
Subject: [PATCH 61/96] [netdrv] bnxt_en: Simplify error checking in the SR-IOV
|
|
message forwarding functions
|
|
|
|
Message-id: <0c9d8a2c5d2d4eee088584ec4dc51aecd8c624a2.1570027456.git.jtoppins@redhat.com>
|
|
Patchwork-id: 276479
|
|
O-Subject: [RHEL-8.2 PATCH 54/78] bnxt_en: Simplify error checking in the SR-IOV message forwarding functions.
|
|
Bugzilla: 1724766
|
|
RH-Acked-by: John Linville <linville@redhat.com>
|
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
There are 4 functions handling message forwarding for SR-IOV. They
|
|
check for non-zero firmware response code and then return -1. There
|
|
is no need to do this anymore. The main messaging function will
|
|
now return standard error code. Since we don't need to examine the
|
|
response, we can use the hwrm_send_message() variant which will
|
|
take the mutex automatically.
|
|
|
|
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
(cherry picked from commit a798302d56f56fb7ad6a01f64f495aeafeb6c0f0)
|
|
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_sriov.c | 72 +++----------------------
|
|
1 file changed, 8 insertions(+), 64 deletions(-)
|
|
|
|
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:18.307489314 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c 2020-02-06 16:23:18.477487753 +0100
|
|
@@ -25,7 +25,6 @@
|
|
static int bnxt_hwrm_fwd_async_event_cmpl(struct bnxt *bp,
|
|
struct bnxt_vf_info *vf, u16 event_id)
|
|
{
|
|
- struct hwrm_fwd_async_event_cmpl_output *resp = bp->hwrm_cmd_resp_addr;
|
|
struct hwrm_fwd_async_event_cmpl_input req = {0};
|
|
struct hwrm_async_event_cmpl *async_cmpl;
|
|
int rc = 0;
|
|
@@ -40,23 +39,10 @@
|
|
async_cmpl->type = cpu_to_le16(ASYNC_EVENT_CMPL_TYPE_HWRM_ASYNC_EVENT);
|
|
async_cmpl->event_id = cpu_to_le16(event_id);
|
|
|
|
- mutex_lock(&bp->hwrm_cmd_lock);
|
|
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
-
|
|
- if (rc) {
|
|
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
+ if (rc)
|
|
netdev_err(bp->dev, "hwrm_fwd_async_event_cmpl failed. rc:%d\n",
|
|
rc);
|
|
- goto fwd_async_event_cmpl_exit;
|
|
- }
|
|
-
|
|
- if (resp->error_code) {
|
|
- netdev_err(bp->dev, "hwrm_fwd_async_event_cmpl error %d\n",
|
|
- resp->error_code);
|
|
- rc = -1;
|
|
- }
|
|
-
|
|
-fwd_async_event_cmpl_exit:
|
|
- mutex_unlock(&bp->hwrm_cmd_lock);
|
|
return rc;
|
|
}
|
|
|
|
@@ -864,7 +850,6 @@
|
|
{
|
|
int rc = 0;
|
|
struct hwrm_fwd_resp_input req = {0};
|
|
- struct hwrm_fwd_resp_output *resp = bp->hwrm_cmd_resp_addr;
|
|
|
|
if (BNXT_FWD_RESP_SIZE_ERR(msg_size))
|
|
return -EINVAL;
|
|
@@ -879,22 +864,9 @@
|
|
req.encap_resp_cmpl_ring = encap_resp_cpr;
|
|
memcpy(req.encap_resp, encap_resp, msg_size);
|
|
|
|
- mutex_lock(&bp->hwrm_cmd_lock);
|
|
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
-
|
|
- if (rc) {
|
|
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
+ if (rc)
|
|
netdev_err(bp->dev, "hwrm_fwd_resp failed. rc:%d\n", rc);
|
|
- goto fwd_resp_exit;
|
|
- }
|
|
-
|
|
- if (resp->error_code) {
|
|
- netdev_err(bp->dev, "hwrm_fwd_resp error %d\n",
|
|
- resp->error_code);
|
|
- rc = -1;
|
|
- }
|
|
-
|
|
-fwd_resp_exit:
|
|
- mutex_unlock(&bp->hwrm_cmd_lock);
|
|
return rc;
|
|
}
|
|
|
|
@@ -903,7 +875,6 @@
|
|
{
|
|
int rc = 0;
|
|
struct hwrm_reject_fwd_resp_input req = {0};
|
|
- struct hwrm_reject_fwd_resp_output *resp = bp->hwrm_cmd_resp_addr;
|
|
|
|
if (BNXT_REJ_FWD_RESP_SIZE_ERR(msg_size))
|
|
return -EINVAL;
|
|
@@ -914,22 +885,9 @@
|
|
req.encap_resp_target_id = cpu_to_le16(vf->fw_fid);
|
|
memcpy(req.encap_request, vf->hwrm_cmd_req_addr, msg_size);
|
|
|
|
- mutex_lock(&bp->hwrm_cmd_lock);
|
|
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
-
|
|
- if (rc) {
|
|
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
+ if (rc)
|
|
netdev_err(bp->dev, "hwrm_fwd_err_resp failed. rc:%d\n", rc);
|
|
- goto fwd_err_resp_exit;
|
|
- }
|
|
-
|
|
- if (resp->error_code) {
|
|
- netdev_err(bp->dev, "hwrm_fwd_err_resp error %d\n",
|
|
- resp->error_code);
|
|
- rc = -1;
|
|
- }
|
|
-
|
|
-fwd_err_resp_exit:
|
|
- mutex_unlock(&bp->hwrm_cmd_lock);
|
|
return rc;
|
|
}
|
|
|
|
@@ -938,7 +896,6 @@
|
|
{
|
|
int rc = 0;
|
|
struct hwrm_exec_fwd_resp_input req = {0};
|
|
- struct hwrm_exec_fwd_resp_output *resp = bp->hwrm_cmd_resp_addr;
|
|
|
|
if (BNXT_EXEC_FWD_RESP_SIZE_ERR(msg_size))
|
|
return -EINVAL;
|
|
@@ -949,22 +906,9 @@
|
|
req.encap_resp_target_id = cpu_to_le16(vf->fw_fid);
|
|
memcpy(req.encap_request, vf->hwrm_cmd_req_addr, msg_size);
|
|
|
|
- mutex_lock(&bp->hwrm_cmd_lock);
|
|
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
-
|
|
- if (rc) {
|
|
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
|
+ if (rc)
|
|
netdev_err(bp->dev, "hwrm_exec_fw_resp failed. rc:%d\n", rc);
|
|
- goto exec_fwd_resp_exit;
|
|
- }
|
|
-
|
|
- if (resp->error_code) {
|
|
- netdev_err(bp->dev, "hwrm_exec_fw_resp error %d\n",
|
|
- resp->error_code);
|
|
- rc = -1;
|
|
- }
|
|
-
|
|
-exec_fwd_resp_exit:
|
|
- mutex_unlock(&bp->hwrm_cmd_lock);
|
|
return rc;
|
|
}
|
|
|