get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 88627,
    "url": "http://patches.dpdk.org/api/patches/88627/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210306153404.10781-31-ndabilpuram@marvell.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": "<20210306153404.10781-31-ndabilpuram@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210306153404.10781-31-ndabilpuram@marvell.com",
    "date": "2021-03-06T15:33:50",
    "name": "[30/44] net/cnxk: add flow ctrl set/get ops",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "fb8c1d658ec4fec92ac83a3f1e550d3cebcd5471",
    "submitter": {
        "id": 1202,
        "url": "http://patches.dpdk.org/api/people/1202/?format=api",
        "name": "Nithin Dabilpuram",
        "email": "ndabilpuram@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210306153404.10781-31-ndabilpuram@marvell.com/mbox/",
    "series": [
        {
            "id": 15515,
            "url": "http://patches.dpdk.org/api/series/15515/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15515",
            "date": "2021-03-06T15:33:20",
            "name": "Marvell CNXK Ethdev Driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/15515/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/88627/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/88627/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 59F76A0548;\n\tSat,  6 Mar 2021 16:39:09 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E986222A447;\n\tSat,  6 Mar 2021 16:35:52 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 13F1D22A447\n for <dev@dpdk.org>; Sat,  6 Mar 2021 16:35:50 +0100 (CET)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id\n 126FVumP029368 for <dev@dpdk.org>; Sat, 6 Mar 2021 07:35:50 -0800",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com with ESMTP id 3747yurcdw-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Sat, 06 Mar 2021 07:35:50 -0800",
            "from SC-EXCH02.marvell.com (10.93.176.82) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sat, 6 Mar 2021 07:35:48 -0800",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com\n (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sat, 6 Mar 2021 07:35:48 -0800",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Sat, 6 Mar 2021 07:35:48 -0800",
            "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id ED2AD3F703F;\n Sat,  6 Mar 2021 07:35:45 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0220; bh=xfaaxrf4spgVNOPcnbwyvarsqA2kzW+2tiLL6oIkKvE=;\n b=kTUeLcp8WGEpPc9CA6ZK+C1Ap27pWsEHxFV7PD2tQ+bSe+9jwSXnb3am8jGWI4Eszli1\n W144V+RDeDSx7SZEkilUuUxR/RFnR+EzvAeVa4F96fluwAfGGirBFz/dD/z8ll2H5aXu\n Hb1tycDD0GnR0lW0oC/URdqn+hNmcKqELStu9hFHAYveyLeIBboQJGJQ6BvEyGRPyyw9\n H//Bu6I3IuBR+dJkOd5On5GDPoQNE2XI5ZtycDhXpql4aDaKyvN4YlQGYxtF/sXbHZsr\n ZNiW3+1LMK9IZffK68gVQKUvD9kJskhpuQADVJvED4yJr4WGss/hxDG4fswERwUWWN48 MQ==",
        "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<jerinj@marvell.com>, <skori@marvell.com>, <skoteshwar@marvell.com>,\n <pbhagavatula@marvell.com>, <kirankumark@marvell.com>,\n <psatheesh@marvell.com>, <asekhar@marvell.com>",
        "Date": "Sat, 6 Mar 2021 21:03:50 +0530",
        "Message-ID": "<20210306153404.10781-31-ndabilpuram@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20210306153404.10781-1-ndabilpuram@marvell.com>",
        "References": "<20210306153404.10781-1-ndabilpuram@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761\n definitions=2021-03-06_08:2021-03-03,\n 2021-03-06 signatures=0",
        "Subject": "[dpdk-dev] [PATCH 30/44] net/cnxk: add flow ctrl set/get ops",
        "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: Sunil Kumar Kori <skori@marvell.com>\n\nPatch implements set and get operations for flow control.\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\n---\n doc/guides/nics/cnxk.rst              |  1 +\n doc/guides/nics/features/cnxk.ini     |  1 +\n doc/guides/nics/features/cnxk_vec.ini |  1 +\n drivers/net/cnxk/cnxk_ethdev.c        | 74 +++++++++++++++++++++++++++\n drivers/net/cnxk/cnxk_ethdev.h        | 13 +++++\n drivers/net/cnxk/cnxk_ethdev_ops.c    | 95 +++++++++++++++++++++++++++++++++++\n 6 files changed, 185 insertions(+)",
    "diff": "diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst\nindex ce33f17..96b2c5d 100644\n--- a/doc/guides/nics/cnxk.rst\n+++ b/doc/guides/nics/cnxk.rst\n@@ -26,6 +26,7 @@ Features of the CNXK Ethdev PMD are:\n - MAC filtering\n - Inner and Outer Checksum offload\n - Link state information\n+- Link flow control\n - MTU update\n - Scatter-Gather IO support\n - Vector Poll mode driver\ndiff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini\nindex 298f167..afd0f01 100644\n--- a/doc/guides/nics/features/cnxk.ini\n+++ b/doc/guides/nics/features/cnxk.ini\n@@ -23,6 +23,7 @@ Allmulticast mode    = Y\n Unicast MAC filter   = Y\n RSS hash             = Y\n Inner RSS            = Y\n+Flow control         = Y\n Jumbo frame          = Y\n Scattered Rx         = Y\n L3 checksum offload  = Y\ndiff --git a/doc/guides/nics/features/cnxk_vec.ini b/doc/guides/nics/features/cnxk_vec.ini\nindex a673cc1..4bd11ce 100644\n--- a/doc/guides/nics/features/cnxk_vec.ini\n+++ b/doc/guides/nics/features/cnxk_vec.ini\n@@ -22,6 +22,7 @@ Allmulticast mode    = Y\n Unicast MAC filter   = Y\n RSS hash             = Y\n Inner RSS            = Y\n+Flow control         = Y\n Jumbo frame          = Y\n L3 checksum offload  = Y\n L4 checksum offload  = Y\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c\nindex 28fcf8c..0ffc45b 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.c\n+++ b/drivers/net/cnxk/cnxk_ethdev.c\n@@ -81,6 +81,55 @@ nix_recalc_mtu(struct rte_eth_dev *eth_dev)\n \treturn rc;\n }\n \n+static int\n+nix_init_flow_ctrl_config(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n+\tstruct cnxk_fc_cfg *fc = &dev->fc_cfg;\n+\tstruct rte_eth_fc_conf fc_conf = {0};\n+\tint rc;\n+\n+\t/* Both Rx & Tx flow ctrl get enabled(RTE_FC_FULL) in HW\n+\t * by AF driver, update those info in PMD structure.\n+\t */\n+\trc = cnxk_nix_flow_ctrl_get(eth_dev, &fc_conf);\n+\tif (rc)\n+\t\tgoto exit;\n+\n+\tfc->mode = fc_conf.mode;\n+\tfc->rx_pause = (fc_conf.mode == RTE_FC_FULL) ||\n+\t\t\t(fc_conf.mode == RTE_FC_RX_PAUSE);\n+\tfc->tx_pause = (fc_conf.mode == RTE_FC_FULL) ||\n+\t\t\t(fc_conf.mode == RTE_FC_TX_PAUSE);\n+\n+exit:\n+\treturn rc;\n+}\n+\n+static int\n+nix_update_flow_ctrl_config(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n+\tstruct cnxk_fc_cfg *fc = &dev->fc_cfg;\n+\tstruct rte_eth_fc_conf fc_cfg = {0};\n+\n+\tif (roc_nix_is_vf_or_sdp(&dev->nix))\n+\t\treturn 0;\n+\n+\tfc_cfg.mode = fc->mode;\n+\n+\t/* To avoid Link credit deadlock on Ax, disable Tx FC if it's enabled */\n+\tif (roc_model_is_cn96_Ax() &&\n+\t    (fc_cfg.mode == RTE_FC_FULL || fc_cfg.mode == RTE_FC_RX_PAUSE)) {\n+\t\tfc_cfg.mode =\n+\t\t\t\t(fc_cfg.mode == RTE_FC_FULL ||\n+\t\t\t\tfc_cfg.mode == RTE_FC_TX_PAUSE) ?\n+\t\t\t\tRTE_FC_TX_PAUSE : RTE_FC_NONE;\n+\t}\n+\n+\treturn cnxk_nix_flow_ctrl_set(eth_dev, &fc_cfg);\n+}\n+\n uint64_t\n cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev)\n {\n@@ -640,6 +689,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)\n \tstruct rte_eth_rxmode *rxmode = &conf->rxmode;\n \tstruct rte_eth_txmode *txmode = &conf->txmode;\n \tchar ea_fmt[RTE_ETHER_ADDR_FMT_SIZE];\n+\tstruct roc_nix_fc_cfg fc_cfg = {0};\n \tstruct roc_nix *nix = &dev->nix;\n \tstruct rte_ether_addr *ea;\n \tuint8_t nb_rxq, nb_txq;\n@@ -820,6 +870,21 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)\n \t\tgoto cq_fini;\n \t}\n \n+\t/* Init flow control configuration */\n+\tfc_cfg.cq_cfg_valid = false;\n+\tfc_cfg.rxchan_cfg.enable = true;\n+\trc = roc_nix_fc_config_set(nix, &fc_cfg);\n+\tif (rc) {\n+\t\tplt_err(\"Failed to initialize flow control rc=%d\", rc);\n+\t\tgoto cq_fini;\n+\t}\n+\n+\t/* Update flow control configuration to PMD */\n+\trc = nix_init_flow_ctrl_config(eth_dev);\n+\tif (rc) {\n+\t\tplt_err(\"Failed to initialize flow control rc=%d\", rc);\n+\t\tgoto cq_fini;\n+\t}\n \t/*\n \t * Restore queue config when reconfigure followed by\n \t * reconfigure and no queue configure invoked from application case.\n@@ -1019,6 +1084,13 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)\n \t\t\treturn rc;\n \t}\n \n+\t/* Update Flow control configuration */\n+\trc = nix_update_flow_ctrl_config(eth_dev);\n+\tif (rc) {\n+\t\tplt_err(\"Failed to enable flow control. error code(%d)\", rc);\n+\t\treturn rc;\n+\t}\n+\n \t/* Enable Rx in NPC */\n \trc = roc_nix_npc_rx_ena_dis(&dev->nix, true);\n \tif (rc) {\n@@ -1068,6 +1140,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {\n \t.allmulticast_disable = cnxk_nix_allmulticast_disable,\n \t.rx_burst_mode_get = cnxk_nix_rx_burst_mode_get,\n \t.tx_burst_mode_get = cnxk_nix_tx_burst_mode_get,\n+\t.flow_ctrl_get = cnxk_nix_flow_ctrl_get,\n+\t.flow_ctrl_set = cnxk_nix_flow_ctrl_set,\n };\n \n static int\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h\nindex 481ede9..77139d0 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.h\n+++ b/drivers/net/cnxk/cnxk_ethdev.h\n@@ -113,6 +113,12 @@\n \t((1ull << (PKT_TX_TUNNEL_VXLAN >> 45)) |                               \\\n \t (1ull << (PKT_TX_TUNNEL_GENEVE >> 45)))\n \n+struct cnxk_fc_cfg {\n+\tenum rte_eth_fc_mode mode;\n+\tuint8_t rx_pause;\n+\tuint8_t tx_pause;\n+};\n+\n struct cnxk_eth_qconf {\n \tunion {\n \t\tstruct rte_eth_txconf tx;\n@@ -174,6 +180,9 @@ struct cnxk_eth_dev {\n \tstruct cnxk_eth_qconf *tx_qconf;\n \tstruct cnxk_eth_qconf *rx_qconf;\n \n+\t/* Flow control configuration */\n+\tstruct cnxk_fc_cfg fc_cfg;\n+\n \t/* Rx burst for cleanup(Only Primary) */\n \teth_rx_burst_t rx_pkt_burst_no_offload;\n \n@@ -223,6 +232,10 @@ int cnxk_nix_rx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,\n \t\t\t       struct rte_eth_burst_mode *mode);\n int cnxk_nix_tx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,\n \t\t\t       struct rte_eth_burst_mode *mode);\n+int cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,\n+\t\t\t   struct rte_eth_fc_conf *fc_conf);\n+int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,\n+\t\t\t   struct rte_eth_fc_conf *fc_conf);\n int cnxk_nix_configure(struct rte_eth_dev *eth_dev);\n int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,\n \t\t\t    uint16_t nb_desc, uint16_t fp_tx_q_sz,\ndiff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c\nindex 7ae961a..eac50a2 100644\n--- a/drivers/net/cnxk/cnxk_ethdev_ops.c\n+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c\n@@ -199,6 +199,101 @@ cnxk_nix_tx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,\n }\n \n int\n+cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,\n+\t\t       struct rte_eth_fc_conf *fc_conf)\n+{\n+\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n+\tenum rte_eth_fc_mode mode_map[] = {\n+\t\t\t\t\t   RTE_FC_NONE, RTE_FC_RX_PAUSE,\n+\t\t\t\t\t   RTE_FC_TX_PAUSE, RTE_FC_FULL\n+\t\t\t\t\t  };\n+\tstruct roc_nix *nix = &dev->nix;\n+\tint mode;\n+\n+\tmode = roc_nix_fc_mode_get(nix);\n+\tif (mode < 0)\n+\t\treturn mode;\n+\n+\tmemset(fc_conf, 0, sizeof(struct rte_eth_fc_conf));\n+\tfc_conf->mode = mode_map[mode];\n+\treturn 0;\n+}\n+\n+int\n+cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,\n+\t\t       struct rte_eth_fc_conf *fc_conf)\n+{\n+\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n+\tenum roc_nix_fc_mode mode_map[] = {\n+\t\t\t\t\t   ROC_NIX_FC_NONE, ROC_NIX_FC_RX,\n+\t\t\t\t\t   ROC_NIX_FC_TX, ROC_NIX_FC_FULL\n+\t\t\t\t\t  };\n+\tstruct rte_eth_dev_data *data = eth_dev->data;\n+\tstruct cnxk_fc_cfg *fc = &dev->fc_cfg;\n+\tstruct roc_nix *nix = &dev->nix;\n+\tstruct roc_nix_fc_cfg fc_cfg;\n+\tstruct cnxk_eth_rxq_sp *rxq;\n+\tuint8_t rx_pause, tx_pause;\n+\tstruct roc_nix_cq *cq;\n+\tint rc, i;\n+\n+\tif (roc_nix_is_vf_or_sdp(nix)) {\n+\t\tplt_err(\"Flow control configuration is not allowed on VFs\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\tif (fc_conf->high_water || fc_conf->low_water || fc_conf->pause_time ||\n+\t    fc_conf->mac_ctrl_frame_fwd || fc_conf->autoneg) {\n+\t\tplt_info(\"Only MODE configuration is supported\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (fc_conf->mode == fc->mode)\n+\t\treturn 0;\n+\n+\trx_pause = (fc_conf->mode == RTE_FC_FULL) ||\n+\t\t    (fc_conf->mode == RTE_FC_RX_PAUSE);\n+\ttx_pause = (fc_conf->mode == RTE_FC_FULL) ||\n+\t\t    (fc_conf->mode == RTE_FC_TX_PAUSE);\n+\n+\t/* Check if TX pause frame is already enabled or not */\n+\tif (fc->tx_pause ^ tx_pause) {\n+\t\tif (roc_model_is_cn96_Ax() && data->dev_started) {\n+\t\t\t/* On Ax, CQ should be in disabled state\n+\t\t\t * while setting flow control configuration.\n+\t\t\t */\n+\t\t\tplt_info(\"Stop the port=%d for setting flow control\",\n+\t\t\t\t data->port_id);\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\tfor (i = 0; i < data->nb_rx_queues; i++) {\n+\t\t\tmemset(&fc_cfg, 0, sizeof(struct roc_nix_fc_cfg));\n+\t\t\trxq = ((struct cnxk_eth_rxq_sp *)\n+\t\t\t\tdata->rx_queues[i]) - 1;\n+\t\t\tcq = &dev->cqs[rxq->qid];\n+\t\t\tfc_cfg.cq_cfg_valid = true;\n+\t\t\tfc_cfg.cq_cfg.enable = tx_pause;\n+\t\t\tfc_cfg.cq_cfg.rq = rxq->qid;\n+\t\t\tfc_cfg.cq_cfg.cq_drop = cq->drop_thresh;\n+\t\t\trc = roc_nix_fc_config_set(nix, &fc_cfg);\n+\t\t\tif (rc)\n+\t\t\t\treturn rc;\n+\t\t}\n+\t}\n+\n+\trc = roc_nix_fc_mode_set(nix, mode_map[fc_conf->mode]);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tfc->rx_pause = rx_pause;\n+\tfc->tx_pause = tx_pause;\n+\tfc->mode = fc_conf->mode;\n+\n+\treturn rc;\n+}\n+\n+int\n cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)\n {\n \tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n",
    "prefixes": [
        "30/44"
    ]
}