Show a patch.

GET /api/patches/74642/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 74642,
    "url": "https://patches.dpdk.org/api/patches/74642/",
    "web_url": "https://patches.dpdk.org/patch/74642/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<20200723111329.21855-3-somnath.kotur@broadcom.com>",
    "date": "2020-07-23T11:13:11",
    "name": "[02/20] net/bnxt: nat global registers support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6b99dbe9bf5781b7950bec8f385468ef122249c8",
    "submitter": {
        "id": 908,
        "url": "https://patches.dpdk.org/api/people/908/",
        "name": "Somnath Kotur",
        "email": "somnath.kotur@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "https://patches.dpdk.org/api/users/1766/",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "https://patches.dpdk.org/patch/74642/mbox/",
    "series": [
        {
            "id": 11252,
            "url": "https://patches.dpdk.org/api/series/11252/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11252",
            "date": "2020-07-23T11:13:09",
            "name": "bnxt patches",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/11252/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74642/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74642/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "References": "<20200723111329.21855-1-somnath.kotur@broadcom.com>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 4E5581BD951",
        "Subject": "[dpdk-dev] [PATCH 02/20] net/bnxt: nat global registers support",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 27788A0521;\n\tThu, 23 Jul 2020 13:19:16 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 289D71BFEC;\n\tThu, 23 Jul 2020 13:19:10 +0200 (CEST)",
            "from relay.smtp.broadcom.com (unknown [192.19.232.149])\n by dpdk.org (Postfix) with ESMTP id 162631BF94\n for <dev@dpdk.org>; Thu, 23 Jul 2020 13:18:57 +0200 (CEST)",
            "from dhcp-10-123-153-55.dhcp.broadcom.net\n (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55])\n by relay.smtp.broadcom.com (Postfix) with ESMTP id 4E5581BD951;\n Thu, 23 Jul 2020 04:18:56 -0700 (PDT)"
        ],
        "To": "dev@dpdk.org",
        "X-Mailer": "git-send-email 2.10.1.613.g2cc2e70",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1595503137;\n bh=FMmNgzDbl6rcEIhLU2aGORtfWDAltJXPilEScotj3Bg=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=LdxUgA8oe7XcmOJZzx7CVH1tgVoF/r/vVcYi1EvXHv8VC5vH5iH6jyPTQ3gvbjkrx\n uq5UK1F+HoeSSyGTptTG2KGPxJyW4AgD+aXDjounZzN3DoytTryOvDjrnVaKF9xS4f\n OFmGW4Xh4H8M3XvLDYHIlNLd3Izjbb7c41v9V5hs=",
        "Date": "Thu, 23 Jul 2020 16:43:11 +0530",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "From": "Somnath Kotur <somnath.kotur@broadcom.com>",
        "In-Reply-To": "<20200723111329.21855-1-somnath.kotur@broadcom.com>",
        "Cc": "ferruh.yigit@intel.com",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20200723111329.21855-3-somnath.kotur@broadcom.com>",
        "Return-Path": "<dev-bounces@dpdk.org>"
    },
    "content": "From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\n\nAdd support to enable or disable the NAT global registers.\nThe NAT feature is enabled in hardware during initialization\nand disabled at deinitialization of the application.\n\nSigned-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\nReviewed-by: Michael Baucom <michael.baucom@broadcom.com>\n---\n drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 83 ++++++++++++++++++++++++++++++++++++++\n drivers/net/bnxt/tf_ulp/bnxt_ulp.h |  4 ++\n 2 files changed, 87 insertions(+)",
    "diff": "diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c\nindex 0869231..7c65a4b 100644\n--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c\n+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c\n@@ -597,6 +597,52 @@ ulp_session_deinit(struct bnxt_ulp_session_state *session)\n }\n \n /*\n+ * Internal api to enable NAT feature.\n+ * Set set_flag to 1 to set the value or zero to reset the value.\n+ * returns 0 on success.\n+ */\n+static int32_t\n+bnxt_ulp_global_cfg_update(struct bnxt *bp,\n+\t\t\t   enum tf_dir dir,\n+\t\t\t   enum tf_global_config_type type,\n+\t\t\t   uint32_t offset,\n+\t\t\t   uint32_t value,\n+\t\t\t   uint32_t set_flag)\n+{\n+\tuint32_t global_cfg = 0;\n+\tint rc;\n+\tstruct tf_global_cfg_parms parms;\n+\n+\t/* Initialize the params */\n+\tparms.dir = dir,\n+\tparms.type = type,\n+\tparms.offset = offset,\n+\tparms.config = (uint8_t *)&global_cfg,\n+\tparms.config_sz_in_bytes = sizeof(global_cfg);\n+\n+\trc = tf_get_global_cfg(&bp->tfp, &parms);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to get global cfg 0x%x rc:%d\\n\",\n+\t\t\t    type, rc);\n+\t\treturn rc;\n+\t}\n+\n+\tif (set_flag)\n+\t\tglobal_cfg |= value;\n+\telse\n+\t\tglobal_cfg &= ~value;\n+\n+\t/* SET the register RE_CFA_REG_ACT_TECT */\n+\trc = tf_set_global_cfg(&bp->tfp, &parms);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to set global cfg 0x%x rc:%d\\n\",\n+\t\t\t    type, rc);\n+\t\treturn rc;\n+\t}\n+\treturn rc;\n+}\n+\n+/*\n  * When a port is initialized by dpdk. This functions is called\n  * and this function initializes the ULP context and rest of the\n  * infrastructure associated with it.\n@@ -732,6 +778,29 @@ bnxt_ulp_init(struct bnxt *bp)\n \t\tgoto jump_to_error;\n \t}\n \n+\t/*\n+\t * Enable NAT feature. Set the global configuration register\n+\t * Tunnel encap to enable NAT with the reuse of existing inner\n+\t * L2 header smac and dmac\n+\t */\n+\trc = bnxt_ulp_global_cfg_update(bp, TF_DIR_RX, TF_TUNNEL_ENCAP,\n+\t\t\t\t\tTF_TUNNEL_ENCAP_NAT,\n+\t\t\t\t\t(BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |\n+\t\t\t\t\tBNXT_ULP_NAT_INNER_L2_HEADER_DMAC), 1);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to set rx global configuration\\n\");\n+\t\tgoto jump_to_error;\n+\t}\n+\n+\trc = bnxt_ulp_global_cfg_update(bp, TF_DIR_TX, TF_TUNNEL_ENCAP,\n+\t\t\t\t\tTF_TUNNEL_ENCAP_NAT,\n+\t\t\t\t\t(BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |\n+\t\t\t\t\tBNXT_ULP_NAT_INNER_L2_HEADER_DMAC), 1);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to set tx global configuration\\n\");\n+\t\tgoto jump_to_error;\n+\t}\n+\n \treturn rc;\n \n jump_to_error:\n@@ -785,6 +854,19 @@ bnxt_ulp_deinit(struct bnxt *bp)\n \t/* Delete the Port database */\n \tulp_port_db_deinit(bp->ulp_ctx);\n \n+\t/* Disable NAT feature */\n+\t(void)bnxt_ulp_global_cfg_update(bp, TF_DIR_RX, TF_TUNNEL_ENCAP,\n+\t\t\t\t\t TF_TUNNEL_ENCAP_NAT,\n+\t\t\t\t\t (BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |\n+\t\t\t\t\t  BNXT_ULP_NAT_INNER_L2_HEADER_DMAC),\n+\t\t\t\t\t 0);\n+\n+\t(void)bnxt_ulp_global_cfg_update(bp, TF_DIR_TX, TF_TUNNEL_ENCAP,\n+\t\t\t\t\t TF_TUNNEL_ENCAP_NAT,\n+\t\t\t\t\t (BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |\n+\t\t\t\t\t  BNXT_ULP_NAT_INNER_L2_HEADER_DMAC),\n+\t\t\t\t\t 0);\n+\n \t/* Delete the ulp context and tf session */\n \tulp_ctx_detach(bp, session);\n \n@@ -942,6 +1024,7 @@ bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev\t*dev)\n \n \tif (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {\n \t\tstruct bnxt_vf_representor *vfr = dev->data->dev_private;\n+\n \t\tbp = vfr->parent_dev->data->dev_private;\n \t}\n \ndiff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h\nindex f9e5e2b..7c95ead 100644\n--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h\n+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h\n@@ -14,6 +14,10 @@\n \n #include \"ulp_template_db_enum.h\"\n \n+/* NAT defines to reuse existing inner L2 SMAC and DMAC */\n+#define BNXT_ULP_NAT_INNER_L2_HEADER_SMAC\t0x2000\n+#define BNXT_ULP_NAT_INNER_L2_HEADER_DMAC\t0x100\n+\n /* defines for the ulp_flags */\n #define BNXT_ULP_VF_REP_ENABLED\t\t0x1\n #define ULP_VF_REP_IS_ENABLED(flag)\t((flag) & BNXT_ULP_VF_REP_ENABLED)\n",
    "prefixes": [
        "02/20"
    ]
}