From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3BFAFA0577; Tue, 14 Apr 2020 10:14:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A2A3C1C1C9; Tue, 14 Apr 2020 10:13:57 +0200 (CEST) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 7FC9A1C1B2 for ; Tue, 14 Apr 2020 10:13:53 +0200 (CEST) Received: by mail-pg1-f193.google.com with SMTP id n16so35506pgb.7 for ; Tue, 14 Apr 2020 01:13:53 -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=OQIt2/bA9f3YQjSoKHHVn+Ha79D3FMHMOB3ysV/7og4=; b=OYa5nRbFW15GzjVCZNCCjQJOjn6u5frCO/itVCzEosJ6bTWA3h2w/BqY+Cp3g5vpjD dmhqi+OM7av+bPK+vCXO53ITKoY2pekaEV+V4Uv+/vB7xgmIhoU947apmMEegbam6Kn/ YS53NKWog934zteuzS6zJT+eYpdicUqt4uiYk= 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=OQIt2/bA9f3YQjSoKHHVn+Ha79D3FMHMOB3ysV/7og4=; b=hJ+X/UamdLV32vhSH3gvLCTuAMiBM2yY5nZ0VYVHoLs6FrFnfd9ntklHLKdq4zQBUv R7S6Bc+f0Ki5b267+mVW/VBiSi0Qi8Fgb6sKFzjY91hOkD812Qe2EJMXumg5HeJi4jb6 KTZ5TNB2+o55atIIf/QcrRIoVlpjtfpfev2wqofB8En6prForKcNpNgiShBEy1EygqNy zFVDhq8LDNBcDCG6+0zRTCo4ABZleHUr/sDfK48xF7LX8JmR83WQh8VtW5TOgrpkB+uy 4TNMKlPHf9xzAP/6bzJicYtJ/O+03c4Y5dL7Q2zzgKzIjNXrurKN3ISbZHZ2t5qEhWvh z8Pg== X-Gm-Message-State: AGi0PuZ4XIGWlbpfwunkksrbltR1G+1JYalf02G8Curgpizwvww2+0+p rPgtLEe95hleoGEmROt6uc+ATqW0SUJCqWMyTbdTwgNAZZAeBUdTTCKE47t9TYwM7bbn8t8L/N/ uUm3NKIf9+7JUQERIg/gDQo6JbGlGe37rkEXt/iN0QvPcCLAFfniKf2VY0SiPBh98deMs X-Google-Smtp-Source: APiQypI/GYUFXDBuBCHV2CuT0LT2ASxyAqo2VNw+YcHUAhNlFKldPhwc8clr9voERyTsDEW0BTHLRw== X-Received: by 2002:a63:314f:: with SMTP id x76mr21220897pgx.340.1586852032211; Tue, 14 Apr 2020 01:13:52 -0700 (PDT) Received: from S60.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id e196sm671176pfh.43.2020.04.14.01.13.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2020 01:13:51 -0700 (PDT) From: Venkat Duvvuru To: dev@dpdk.org Cc: Pete Spreadborough , Randy Schacher Date: Tue, 14 Apr 2020 13:43:00 +0530 Message-Id: <1586852011-37536-4-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1586852011-37536-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1586806811-21736-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <1586852011-37536-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH v3 03/34] net/bnxt: add truflow message handlers 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" From: Pete Spreadborough - Add bnxt message functions for truflow APIs Signed-off-by: Pete Spreadborough Signed-off-by: Randy Schacher Reviewed-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 83 ++++++++++++++++++++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 18 ++++++++++ 2 files changed, 101 insertions(+) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 93b2ea7..443553b 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -257,6 +257,89 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, #define HWRM_UNLOCK() rte_spinlock_unlock(&bp->hwrm_lock) +int bnxt_hwrm_tf_message_direct(struct bnxt *bp, + bool use_kong_mb, + uint16_t msg_type, + void *msg, + uint32_t msg_len, + void *resp_msg, + uint32_t resp_len) +{ + int rc = 0; + bool mailbox = BNXT_USE_CHIMP_MB; + struct input *req = msg; + struct output *resp = bp->hwrm_cmd_resp_addr; + + if (use_kong_mb) + mailbox = BNXT_USE_KONG(bp); + + HWRM_PREP(req, msg_type, mailbox); + + rc = bnxt_hwrm_send_message(bp, req, msg_len, mailbox); + + HWRM_CHECK_RESULT(); + + if (resp_msg) + memcpy(resp_msg, resp, resp_len); + + HWRM_UNLOCK(); + + return rc; +} + +int bnxt_hwrm_tf_message_tunneled(struct bnxt *bp, + bool use_kong_mb, + uint16_t tf_type, + uint16_t tf_subtype, + uint32_t *tf_response_code, + void *msg, + uint32_t msg_len, + void *response, + uint32_t response_len) +{ + int rc = 0; + struct hwrm_cfa_tflib_input req = { .req_type = 0 }; + struct hwrm_cfa_tflib_output *resp = bp->hwrm_cmd_resp_addr; + bool mailbox = BNXT_USE_CHIMP_MB; + + if (msg_len > sizeof(req.tf_req)) + return -ENOMEM; + + if (use_kong_mb) + mailbox = BNXT_USE_KONG(bp); + + HWRM_PREP(&req, HWRM_TF, mailbox); + /* Build request using the user supplied request payload. + * TLV request size is checked at build time against HWRM + * request max size, thus no checking required. + */ + req.tf_type = tf_type; + req.tf_subtype = tf_subtype; + memcpy(req.tf_req, msg, msg_len); + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), mailbox); + HWRM_CHECK_RESULT(); + + /* Copy the resp to user provided response buffer */ + if (response != NULL) + /* Post process response data. We need to copy only + * the 'payload' as the HWRM data structure really is + * HWRM header + msg header + payload and the TFLIB + * only provided a payload place holder. + */ + if (response_len != 0) { + memcpy(response, + resp->tf_resp, + response_len); + } + + /* Extract the internal tflib response code */ + *tf_response_code = resp->tf_resp_code; + HWRM_UNLOCK(); + + return rc; +} + int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic) { int rc = 0; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 5eb2ee8..df7aa74 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -69,6 +69,24 @@ HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_L2_HEADER_SOURCE_FIELDS_SUPPORTED bp->rx_cos_queue[x].profile = \ resp->queue_id##x##_service_profile +int bnxt_hwrm_tf_message_tunneled(struct bnxt *bp, + bool use_kong_mb, + uint16_t tf_type, + uint16_t tf_subtype, + uint32_t *tf_response_code, + void *msg, + uint32_t msg_len, + void *response, + uint32_t response_len); + +int bnxt_hwrm_tf_message_direct(struct bnxt *bp, + bool use_kong_mb, + uint16_t msg_type, + void *msg, + uint32_t msg_len, + void *resp_msg, + uint32_t resp_len); + int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic); int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic, -- 2.7.4