get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 88173,
    "url": "http://patches.dpdk.org/api/patches/88173/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210224155553.26893-12-kalesh-anakkur.purayil@broadcom.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20210224155553.26893-12-kalesh-anakkur.purayil@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210224155553.26893-12-kalesh-anakkur.purayil@broadcom.com",
    "date": "2021-02-24T15:55:53",
    "name": "[11/11] net/bnxt: fix PTP support for thor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "15bd25b66f952894dfcb3506d44a5cac6b2c42e5",
    "submitter": {
        "id": 1479,
        "url": "http://patches.dpdk.org/api/people/1479/?format=api",
        "name": "Kalesh A P",
        "email": "kalesh-anakkur.purayil@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "http://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210224155553.26893-12-kalesh-anakkur.purayil@broadcom.com/mbox/",
    "series": [
        {
            "id": 15364,
            "url": "http://patches.dpdk.org/api/series/15364/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15364",
            "date": "2021-02-24T15:55:42",
            "name": "bnxt fixes",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/15364/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/88173/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/88173/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 7C5DBA054F;\n\tWed, 24 Feb 2021 16:35:18 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 92978160857;\n\tWed, 24 Feb 2021 16:33:50 +0100 (CET)",
            "from relay.smtp-ext.broadcom.com (saphodev.broadcom.com\n [192.19.232.172])\n by mails.dpdk.org (Postfix) with ESMTP id 068DB160892\n for <dev@dpdk.org>; Wed, 24 Feb 2021 16:33:49 +0100 (CET)",
            "from dhcp-10-123-153-22.dhcp.broadcom.net\n (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22])\n by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 84DF780F4;\n Wed, 24 Feb 2021 07:33:47 -0800 (PST)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 84DF780F4",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1614180828;\n bh=MmjZtdf4svT/ZZWLTOgpk8BkAFXbc3Nnai/h/37KEtg=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=b7qD/LtgXWTeo7dZo1VcUgKMFuCfnPi8vZfSwen4XA0GLWYkBEVItyd+NRjmVLJHu\n KeU7a28QgutnBZvSa1x9Ofm4Fm64zDRQgMPhCjKQbOjWW4bJXXpVYh0k1SzsDhrCKB\n Y7buuKMGDKy+6rkHm9wmvzAkZD4mi6SM87ckw7bE=",
        "From": "Kalesh A P <kalesh-anakkur.purayil@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "ferruh.yigit@intel.com,\n\tajit.khaparde@broadcom.com",
        "Date": "Wed, 24 Feb 2021 21:25:53 +0530",
        "Message-Id": "<20210224155553.26893-12-kalesh-anakkur.purayil@broadcom.com>",
        "X-Mailer": "git-send-email 2.10.1",
        "In-Reply-To": "<20210224155553.26893-1-kalesh-anakkur.purayil@broadcom.com>",
        "References": "<20210224155553.26893-1-kalesh-anakkur.purayil@broadcom.com>",
        "Subject": "[dpdk-dev] [PATCH 11/11] net/bnxt: fix PTP support for thor",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>\n\nOn Thor, Rx timestamp is present in the Rx completion record.\nOnly 32 bits of the timestamp is present in the completion.\nThe driver needs to periodically poll the current 48 bit\nfree running timer using the HWRM_PORT_TS_QUERY command.\nIt can combine the upper 16 bits from the HWRM response\nwith the lower 32 bits in the Rx completion to produce\nthe 48 bit timestamp for the Rx packet.\n\nThis patch adds an alarm thread to periodically poll the current 48 bit\nfree running timer using the HWRM_PORT_TS_QUERY command.\nThis avoids issuing the hwrm command from the rx handler.\nThis patch also handles the timer roll over condition.\n\nFixes: 6cbd89f9f3d8 (\"net/bnxt: support PTP for Thor\")\nCc: stable@dpdk.org\n\nSigned-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>\nReviewed-by: Lance Richardson <lance.richardson@broadcom.com>\n---\n drivers/net/bnxt/bnxt.h        |  8 +++++\n drivers/net/bnxt/bnxt_ethdev.c | 79 +++++++++++++++++++++++++++++++++++++++++-\n drivers/net/bnxt/bnxt_rxr.c    | 17 +++++----\n 3 files changed, 97 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex bf3459e..de1b4af 100644\n--- a/drivers/net/bnxt/bnxt.h\n+++ b/drivers/net/bnxt/bnxt.h\n@@ -309,6 +309,7 @@ struct rte_flow {\n #define BNXT_PTP_FLAGS_PATH_TX\t\t0x0\n #define BNXT_PTP_FLAGS_PATH_RX\t\t0x1\n #define BNXT_PTP_FLAGS_CURRENT_TIME\t0x2\n+#define BNXT_PTP_CURRENT_TIME_MASK\t0xFFFF00000000ULL\n \n struct bnxt_ptp_cfg {\n #define BNXT_GRCPF_REG_WINDOW_BASE_OUT  0x400\n@@ -358,6 +359,7 @@ struct bnxt_ptp_cfg {\n \n \t/* On Thor, the Rx timestamp is present in the Rx completion record */\n \tuint64_t\t\t\trx_timestamp;\n+\tuint64_t\t\t\tcurrent_time;\n };\n \n struct bnxt_coal {\n@@ -671,6 +673,12 @@ struct bnxt {\n #define BNXT_TRUFLOW_EN(bp)\t((bp)->flags & BNXT_FLAG_TRUFLOW_EN)\n #define BNXT_GFID_ENABLED(bp)\t((bp)->flags & BNXT_FLAG_GFID_ENABLE)\n \n+\tuint32_t\t\t\tflags2;\n+#define BNXT_FLAGS2_PTP_TIMESYNC_ENABLED\tBIT(0)\n+#define BNXT_FLAGS2_PTP_ALARM_SCHEDULED\t\tBIT(1)\n+#define BNXT_P5_PTP_TIMESYNC_ENABLED(bp)\t\\\n+\t((bp)->flags2 & BNXT_FLAGS2_PTP_TIMESYNC_ENABLED)\n+\n \tuint16_t\t\tchip_num;\n #define CHIP_NUM_58818\t\t0xd818\n #define BNXT_CHIP_SR2(bp)\t((bp)->chip_num == CHIP_NUM_58818)\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex c4f334f..c1ba749 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -1300,6 +1300,73 @@ static void bnxt_free_switch_domain(struct bnxt *bp)\n \t}\n }\n \n+static void bnxt_ptp_get_current_time(void *arg)\n+{\n+\tstruct bnxt *bp = arg;\n+\tstruct bnxt_ptp_cfg *ptp = bp->ptp_cfg;\n+\tint rc;\n+\n+\trc = is_bnxt_in_error(bp);\n+\tif (rc)\n+\t\treturn;\n+\n+\tif (!ptp)\n+\t\treturn;\n+\n+\tbnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,\n+\t\t\t\t&ptp->current_time);\n+\n+\trc = rte_eal_alarm_set(US_PER_S, bnxt_ptp_get_current_time, (void *)bp);\n+\tif (rc != 0) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to re-schedule PTP alarm\\n\");\n+\t\tbp->flags2 &= ~BNXT_FLAGS2_PTP_ALARM_SCHEDULED;\n+\t}\n+}\n+\n+static int bnxt_schedule_ptp_alarm(struct bnxt *bp)\n+{\n+\tstruct bnxt_ptp_cfg *ptp = bp->ptp_cfg;\n+\tint rc;\n+\n+\tif (bp->flags2 & BNXT_FLAGS2_PTP_ALARM_SCHEDULED)\n+\t\treturn 0;\n+\n+\tbnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,\n+\t\t\t\t&ptp->current_time);\n+\n+\trc = rte_eal_alarm_set(US_PER_S, bnxt_ptp_get_current_time, (void *)bp);\n+\treturn rc;\n+}\n+\n+static void bnxt_cancel_ptp_alarm(struct bnxt *bp)\n+{\n+\tif (bp->flags2 & BNXT_FLAGS2_PTP_ALARM_SCHEDULED) {\n+\t\trte_eal_alarm_cancel(bnxt_ptp_get_current_time, (void *)bp);\n+\t\tbp->flags2 &= ~BNXT_FLAGS2_PTP_ALARM_SCHEDULED;\n+\t}\n+}\n+\n+static void bnxt_ptp_stop(struct bnxt *bp)\n+{\n+\tbnxt_cancel_ptp_alarm(bp);\n+\tbp->flags2 &= ~BNXT_FLAGS2_PTP_TIMESYNC_ENABLED;\n+}\n+\n+static int bnxt_ptp_start(struct bnxt *bp)\n+{\n+\tint rc;\n+\n+\trc = bnxt_schedule_ptp_alarm(bp);\n+\tif (rc != 0) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to schedule PTP alarm\\n\");\n+\t} else {\n+\t\tbp->flags2 |= BNXT_FLAGS2_PTP_TIMESYNC_ENABLED;\n+\t\tbp->flags2 |= BNXT_FLAGS2_PTP_ALARM_SCHEDULED;\n+\t}\n+\n+\treturn rc;\n+}\n+\n static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)\n {\n \tstruct bnxt *bp = eth_dev->data->dev_private;\n@@ -1330,6 +1397,9 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)\n \n \tbnxt_cancel_fw_health_check(bp);\n \n+\tif (BNXT_P5_PTP_TIMESYNC_ENABLED(bp))\n+\t\tbnxt_cancel_ptp_alarm(bp);\n+\n \t/* Do not bring link down during reset recovery */\n \tif (!is_bnxt_in_error(bp)) {\n \t\tbnxt_dev_set_link_down_op(eth_dev);\n@@ -1449,6 +1519,9 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)\n \n \tbnxt_schedule_fw_health_check(bp);\n \n+\tif (BNXT_P5_PTP_TIMESYNC_ENABLED(bp))\n+\t\tbnxt_schedule_ptp_alarm(bp);\n+\n \treturn 0;\n \n error:\n@@ -3323,8 +3396,10 @@ bnxt_timesync_enable(struct rte_eth_dev *dev)\n \n \tif (!BNXT_CHIP_P5(bp))\n \t\tbnxt_map_ptp_regs(bp);\n+\telse\n+\t\trc = bnxt_ptp_start(bp);\n \n-\treturn 0;\n+\treturn rc;\n }\n \n static int\n@@ -3344,6 +3419,8 @@ bnxt_timesync_disable(struct rte_eth_dev *dev)\n \n \tif (!BNXT_CHIP_P5(bp))\n \t\tbnxt_unmap_ptp_regs(bp);\n+\telse\n+\t\tbnxt_ptp_stop(bp);\n \n \treturn 0;\n }\ndiff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c\nindex 4674f7c..3f530bd 100644\n--- a/drivers/net/bnxt/bnxt_rxr.c\n+++ b/drivers/net/bnxt/bnxt_rxr.c\n@@ -603,9 +603,11 @@ bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, struct rx_pkt_cmpl *rxcmp,\n static void\n bnxt_get_rx_ts_p5(struct bnxt *bp, uint32_t rx_ts_cmpl)\n {\n-\tuint64_t systime_cycles = 0;\n+\tstruct bnxt_ptp_cfg *ptp = bp->ptp_cfg;\n+\tuint64_t last_hwrm_time;\n+\tuint64_t pkt_time = 0;\n \n-\tif (!BNXT_CHIP_P5(bp))\n+\tif (!BNXT_CHIP_P5(bp) || !ptp)\n \t\treturn;\n \n \t/* On Thor, Rx timestamps are provided directly in the\n@@ -616,10 +618,13 @@ bnxt_get_rx_ts_p5(struct bnxt *bp, uint32_t rx_ts_cmpl)\n \t * from the HWRM response with the lower 32 bits in the\n \t * Rx completion to produce the 48 bit timestamp for the Rx packet\n \t */\n-\tbnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,\n-\t\t\t\t&systime_cycles);\n-\tbp->ptp_cfg->rx_timestamp = (systime_cycles & 0xFFFF00000000);\n-\tbp->ptp_cfg->rx_timestamp |= rx_ts_cmpl;\n+\tlast_hwrm_time = ptp->current_time;\n+\tpkt_time = (last_hwrm_time & BNXT_PTP_CURRENT_TIME_MASK) | rx_ts_cmpl;\n+\tif (rx_ts_cmpl < (uint32_t)last_hwrm_time) {\n+\t\t/* timer has rolled over */\n+\t\tpkt_time += (1ULL << 32);\n+\t}\n+\tptp->rx_timestamp = pkt_time;\n }\n #endif\n \n",
    "prefixes": [
        "11/11"
    ]
}