From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 66404A0096 for ; Sun, 2 Jun 2019 19:44:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 15F531B99F; Sun, 2 Jun 2019 19:43:20 +0200 (CEST) Received: from mail-yb1-f195.google.com (mail-yb1-f195.google.com [209.85.219.195]) by dpdk.org (Postfix) with ESMTP id CA99B4D27 for ; Sun, 2 Jun 2019 19:43:09 +0200 (CEST) Received: by mail-yb1-f195.google.com with SMTP id x7so3188608ybg.5 for ; Sun, 02 Jun 2019 10:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xPq4du0UREu4mhaa6tN8ZhzdPyl/ToV02UmY6Hovy78=; b=gK5GSsqZkIkdnJDYMuhYm8ZZO0+o3kpPwWx/fvyiNT/wM3naSoVWw8E+W6TJDpCIwG d0mBoUNDmioQ2HPhur1XufxPB2cD4qsw9GKcoxPMw2YgJvBzmTh/lGCVQ28mlaJ8jQ2G nMD3xwgA6XABRRpIO7l53JRkt2MVO88hfM+IE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xPq4du0UREu4mhaa6tN8ZhzdPyl/ToV02UmY6Hovy78=; b=l/lurQtNNeH4WEkGE4d4D0ueiZDmqulL84d24GhZoyPlUjWD/zOeaO4JRmjS2TSnno yfwbgQnjCDevf9l3HSLpzHYpYdJ0Jlh2Nc/0HsJd2rxsC52/7FNuIXVD6lfqpEnF1ATQ 0fmrc/kVCmmGvIzPbiA4qY6+hniGxFW1t3y0xAkL6AGir/+a/x/1sFBN2Ong9V9zp1AP Vxp/AKHRsxsvJLtDZy/OpeuJfgXAOdMOtmVzgju8Aj4yU6AG8ceHfYtmLGb4KiEeu+Kk D1G12wzH37Q9R9f0FhQfYeByZVgVXQ9YhKDTccSnbId1fdD+s3H7jrytm0LQufJNeYlA suKw== X-Gm-Message-State: APjAAAUANhhfuQyLejEqfWVJluJ5c9J5jrlz34UpGYaOOdmoqZJR81cH 2frixmN6gxaI7mARrtQRHnMUCHAuPpqcI7+WFN7ndRNI87Pa+3ITAzUtD64sqF5VIYA1aW34/l1 nvavJc7TXWvPfPFMLNPUsXFCaYtwHB+E7BzPGzo0DVWR1prMSgj8Ja1IxqzsvMm5T X-Google-Smtp-Source: APXvYqxTFioPll3A28M74Jz+TM13ILKt7tOm1Bxuv4gGoPrCan7bS416jNz+BnHWaH/RaY3FjUtZLQ== X-Received: by 2002:a25:f506:: with SMTP id a6mr11374024ybe.33.1559497388926; Sun, 02 Jun 2019 10:43:08 -0700 (PDT) Received: from lrichardson-VirtualBox.attlocal.net (69-218-223-106.lightspeed.rlghnc.sbcglobal.net. [69.218.223.106]) by smtp.gmail.com with ESMTPSA id n78sm1000819ywd.2.2019.06.02.10.43.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 10:43:08 -0700 (PDT) From: Lance Richardson To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com, Lance Richardson Date: Sun, 2 Jun 2019 13:42:41 -0400 Message-Id: <20190602174247.32368-7-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602174247.32368-1-lance.richardson@broadcom.com> References: <20190602174247.32368-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH 06/11] net/bnxt: support extended hwrm request sizes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Enable support for extended request sizes. Signed-off-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- 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