All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lance Richardson <lance.richardson@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com,
	Lance Richardson <lance.richardson@broadcom.com>
Subject: [dpdk-dev] [PATCH 06/11] net/bnxt: support extended hwrm request sizes
Date: Sun,  2 Jun 2019 13:42:41 -0400	[thread overview]
Message-ID: <20190602174247.32368-7-lance.richardson@broadcom.com> (raw)
In-Reply-To: <20190602174247.32368-1-lance.richardson@broadcom.com>

Enable support for extended request sizes.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      |  1 +
 drivers/net/bnxt/bnxt_hwrm.c | 31 ++++++++++++++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index caacc7258..9bb8d825d 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -320,6 +320,7 @@ struct bnxt {
 	rte_spinlock_t			hwrm_lock;
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
+	uint16_t                        hwrm_max_ext_req_len;
 
 	struct bnxt_link_info	link_info;
 	struct bnxt_cos_queue_info	cos_queue[BNXT_COS_QUEUE_COUNT];
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 7cad3cb4c..45d37f176 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -85,10 +85,11 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 	uint16_t mb_trigger_offset = use_kong_mb ?
 		GRCPF_REG_KONG_COMM_TRIGGER : GRCPF_REG_CHIMP_COMM_TRIGGER;
 
-	if (bp->flags & BNXT_FLAG_SHORT_CMD) {
+	if (bp->flags & BNXT_FLAG_SHORT_CMD ||
+	    msg_len > bp->max_req_len) {
 		void *short_cmd_req = bp->hwrm_short_cmd_req_addr;
 
-		memset(short_cmd_req, 0, bp->max_req_len);
+		memset(short_cmd_req, 0, bp->hwrm_max_ext_req_len);
 		memcpy(short_cmd_req, req, msg_len);
 
 		short_input.req_type = rte_cpu_to_le_16(req->req_type);
@@ -128,8 +129,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 	for (i = 0; i < HWRM_CMD_TIMEOUT; i++) {
 		/* Sanity check on the resp->resp_len */
 		rte_rmb();
-		if (resp->resp_len && resp->resp_len <=
-				bp->max_resp_len) {
+		if (resp->resp_len && resp->resp_len <= bp->max_resp_len) {
 			/* Last byte of resp contains the valid key */
 			valid = (uint8_t *)resp + resp->resp_len - 1;
 			if (*valid == HWRM_RESP_VALID_KEY)
@@ -832,7 +832,11 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 		rc = -EINVAL;
 	}
 	bp->max_req_len = rte_le_to_cpu_16(resp->max_req_win_len);
-	max_resp_len = resp->max_resp_len;
+	bp->hwrm_max_ext_req_len = rte_le_to_cpu_16(resp->max_ext_req_len);
+	if (bp->hwrm_max_ext_req_len < HWRM_MAX_REQ_LEN)
+		bp->hwrm_max_ext_req_len = HWRM_MAX_REQ_LEN;
+
+	max_resp_len = rte_le_to_cpu_16(resp->max_resp_len);
 	dev_caps_cfg = rte_le_to_cpu_32(resp->dev_caps_cfg);
 
 	if (bp->max_resp_len != max_resp_len) {
@@ -864,11 +868,22 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	    (dev_caps_cfg &
 	     HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED)) {
 		PMD_DRV_LOG(DEBUG, "Short command supported\n");
+		bp->flags |= BNXT_FLAG_SHORT_CMD;
+	}
+
+	if (((dev_caps_cfg &
+	      HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED) &&
+	     (dev_caps_cfg &
+	      HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED)) ||
+	    bp->hwrm_max_ext_req_len > HWRM_MAX_REQ_LEN) {
+		sprintf(type, "bnxt_hwrm_short_%04x:%02x:%02x:%02x",
+			bp->pdev->addr.domain, bp->pdev->addr.bus,
+			bp->pdev->addr.devid, bp->pdev->addr.function);
 
 		rte_free(bp->hwrm_short_cmd_req_addr);
 
-		bp->hwrm_short_cmd_req_addr = rte_malloc(type,
-							bp->max_req_len, 0);
+		bp->hwrm_short_cmd_req_addr =
+				rte_malloc(type, bp->hwrm_max_ext_req_len, 0);
 		if (bp->hwrm_short_cmd_req_addr == NULL) {
 			rc = -ENOMEM;
 			goto error;
@@ -883,8 +898,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 			rc = -ENOMEM;
 			goto error;
 		}
-
-		bp->flags |= BNXT_FLAG_SHORT_CMD;
 	}
 	if (dev_caps_cfg &
 	    HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_KONG_MB_CHNL_SUPPORTED) {
-- 
2.17.1


  parent reply	other threads:[~2019-06-02 17:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-02 17:42 [dpdk-dev] [PATCH 00/11] add support for BCM57508 controller Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 01/11] net/bnxt: endianness conversions in cp ring macros Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 02/11] net/bnxt: fix ring type macro name usage Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 03/11] net/bnxt: fix width in stats ctx endian conversion Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 04/11] net/bnxt: use consistent values for vnic RSS rule Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 05/11] net/bnxt: reset function earlier in initialization Lance Richardson
2019-06-02 17:42 ` Lance Richardson [this message]
2019-06-02 17:42 ` [dpdk-dev] [PATCH 07/11] net/bnxt: refactor doorbell handling Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 08/11] net/bnxt: refactor ring allocation code Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 09/11] net/bnxt: add support for thor controller Lance Richardson
2019-06-14  2:17   ` [dpdk-dev] compilation failing - " Thomas Monjalon
2019-06-14  3:34     ` Ajit Khaparde
2019-06-14  3:42       ` Lance Richardson
2019-06-14  4:20     ` [dpdk-dev] [PATCH] net/bnxt: fix compilation error with some compilers Ajit Khaparde
2019-06-14  6:56       ` Thomas Monjalon
2019-06-02 17:42 ` [dpdk-dev] [PATCH 10/11] net/bnxt: enable completion coalescing for thor Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 11/11] net/bnxt: enable RSS for thor-based adapters Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 11/11] net/bnxt: enable RSS for thor-based controllers Lance Richardson
2019-06-07 10:48 ` [dpdk-dev] [PATCH 00/11] add support for BCM57508 controller Ferruh Yigit
2019-06-07 10:52   ` Ferruh Yigit
2019-06-07 13:45     ` Lance Richardson
2019-06-07 14:13       ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190602174247.32368-7-lance.richardson@broadcom.com \
    --to=lance.richardson@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.