get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 54111,
    "url": "http://patches.dpdk.org/api/patches/54111/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190602152434.23996-40-jerinj@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": "<20190602152434.23996-40-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190602152434.23996-40-jerinj@marvell.com",
    "date": "2019-06-02T15:24:15",
    "name": "[v1,39/58] net/octeontx2: add flow actions support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "cb0920f6d28562173d7c205ca77779e16d4f960a",
    "submitter": {
        "id": 1188,
        "url": "http://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190602152434.23996-40-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 4848,
            "url": "http://patches.dpdk.org/api/series/4848/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4848",
            "date": "2019-06-02T15:23:36",
            "name": "OCTEON TX2 Ethdev driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4848/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/54111/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/54111/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A715D1BBD6;\n\tSun,  2 Jun 2019 17:26:39 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n\t[67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 3F1E81BA9F\n\tfor <dev@dpdk.org>; Sun,  2 Jun 2019 17:26:37 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n\tby mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id\n\tx52FK6kZ020260; Sun, 2 Jun 2019 08:26:36 -0700",
            "from sc-exch04.marvell.com ([199.233.58.184])\n\tby mx0b-0016f401.pphosted.com with ESMTP id 2survk4989-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tSun, 02 Jun 2019 08:26:36 -0700",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com\n\t(10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tSun, 2 Jun 2019 08:26:35 -0700",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com\n\t(10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n\tTransport; Sun, 2 Jun 2019 08:26:35 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n\tby maili.marvell.com (Postfix) with ESMTP id 7A6D03F703F;\n\tSun,  2 Jun 2019 08:26:33 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : in-reply-to : references : mime-version\n\t: content-transfer-encoding : content-type; s=pfpt0818;\n\tbh=zTt4ftydRsv6FStfkIG4HY5WQ+QtxzmSoaklxMwyn2c=;\n\tb=yEDoZVx+KdR5E5DFBE/jp/xLFSZ4KMl7RL+cXDUYrpe/hW3TamZDXU2Zg0S5OYRxJ3MH\n\tRHafPIuOlbDh6kiAGfX2arUc4oz1OTpxeOJ+luNlY85LadeP2SqfO8VMj88AsUCsas9X\n\tjauOUWMiDPrhluTxlEZHYlOHwwRY+0SAVwI45w3y1RJTJhMocG9uhVw1Bfjm8v/wDCJv\n\tHfE1n28sPJSEFzOsyagYJlE3vriK7OW8vlk2yuXvehSOeNakn+M3qJhE8Q2cUTciF0jy\n\tqhz5XPQ/1KE3oQc4MEwt64TEqCXLOT8IVbVUhYHDgY05PS4IQXH/rjOtbcofDDHbrmyP\n\tiA== ",
        "From": "<jerinj@marvell.com>",
        "To": "<dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>, Nithin Dabilpuram\n\t<ndabilpuram@marvell.com>, Kiran Kumar K <kirankumark@marvell.com>",
        "CC": "<ferruh.yigit@intel.com>, Vivek Sharma <viveksharma@marvell.com>",
        "Date": "Sun, 2 Jun 2019 20:54:15 +0530",
        "Message-ID": "<20190602152434.23996-40-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190602152434.23996-1-jerinj@marvell.com>",
        "References": "<20190602152434.23996-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:, ,\n\tdefinitions=2019-06-02_09:, , signatures=0",
        "Subject": "[dpdk-dev] [PATCH v1 39/58] net/octeontx2: add flow actions support",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Kiran Kumar K <kirankumark@marvell.com>\n\nAdding support to parse flow actions like drop, count, mark, rss, queue.\nOn egress side, only drop and count actions were supported.\n\nSigned-off-by: Kiran Kumar K <kirankumark@marvell.com>\nSigned-off-by: Vivek Sharma <viveksharma@marvell.com>\n---\n drivers/net/octeontx2/otx2_flow_parse.c | 276 ++++++++++++++++++++++++\n drivers/net/octeontx2/otx2_rx.h         |   1 +\n 2 files changed, 277 insertions(+)",
    "diff": "diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c\nindex 1351dff4c..cf13813d8 100644\n--- a/drivers/net/octeontx2/otx2_flow_parse.c\n+++ b/drivers/net/octeontx2/otx2_flow_parse.c\n@@ -663,3 +663,279 @@ otx2_flow_parse_la(struct otx2_parse_state *pst)\n \t/* Update pst if not validate only? clash check? */\n \treturn otx2_flow_update_parse_state(pst, &info, lid, lt, 0);\n }\n+\n+static int\n+parse_rss_action(struct rte_eth_dev *dev,\n+\t\t const struct rte_flow_attr *attr,\n+\t\t const struct rte_flow_action *act,\n+\t\t struct rte_flow_error *error)\n+{\n+\tstruct otx2_eth_dev *hw = dev->data->dev_private;\n+\tstruct otx2_rss_info *rss_info = &hw->rss_info;\n+\tconst struct rte_flow_action_rss *rss;\n+\tuint32_t i;\n+\n+\trss = (const struct rte_flow_action_rss *)act->conf;\n+\n+\t/* Not supported */\n+\tif (attr->egress) {\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,\n+\t\t\t\t\t  attr, \"No support of RSS in egress\");\n+\t}\n+\n+\tif (dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t  act, \"multi-queue mode is disabled\");\n+\n+\t/* Parse RSS related parameters from configuration */\n+\tif (!rss || !rss->queue_num)\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t  act, \"no valid queues\");\n+\n+\tif (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, act,\n+\t\t\t\t\t  \"non-default RSS hash functions\"\n+\t\t\t\t\t  \" are not supported\");\n+\n+\tif (rss->key_len && rss->key_len > RTE_DIM(rss_info->key))\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, act,\n+\t\t\t\t\t  \"RSS hash key too large\");\n+\n+\tif (rss->queue_num > rss_info->rss_size)\n+\t\treturn rte_flow_error_set\n+\t\t\t(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,\n+\t\t\t \"too many queues for RSS context\");\n+\n+\tfor (i = 0; i < rss->queue_num; i++) {\n+\t\tif (rss->queue[i] >= dev->data->nb_rx_queues)\n+\t\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\t  act,\n+\t\t\t\t\t\t  \"queue id > max number\"\n+\t\t\t\t\t\t  \" of queues\");\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+otx2_flow_parse_actions(struct rte_eth_dev *dev,\n+\t\t\tconst struct rte_flow_attr *attr,\n+\t\t\tconst struct rte_flow_action actions[],\n+\t\t\tstruct rte_flow_error *error,\n+\t\t\tstruct rte_flow *flow)\n+{\n+\tstruct otx2_eth_dev *hw = dev->data->dev_private;\n+\tstruct otx2_npc_flow_info *npc = &hw->npc_flow;\n+\tconst struct rte_flow_action_count *act_count;\n+\tconst struct rte_flow_action_mark *act_mark;\n+\tconst struct rte_flow_action_queue *act_q;\n+\tconst char *errmsg = NULL;\n+\tint sel_act, req_act = 0;\n+\tuint16_t pf_func;\n+\tint errcode = 0;\n+\tint mark = 0;\n+\tint rq = 0;\n+\n+\t/* Initialize actions */\n+\tflow->ctr_id = NPC_COUNTER_NONE;\n+\n+\tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {\n+\t\totx2_npc_dbg(\"Action type = %d\", actions->type);\n+\n+\t\tswitch (actions->type) {\n+\t\tcase RTE_FLOW_ACTION_TYPE_VOID:\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_MARK:\n+\t\t\tact_mark =\n+\t\t\t    (const struct rte_flow_action_mark *)actions->conf;\n+\n+\t\t\t/* We have only 16 bits. Use highest val for flag */\n+\t\t\tif (act_mark->id > (OTX2_FLOW_FLAG_VAL - 2)) {\n+\t\t\t\terrmsg = \"mark value must be < 0xfffe\";\n+\t\t\t\terrcode = ENOTSUP;\n+\t\t\t\tgoto err_exit;\n+\t\t\t}\n+\t\t\tmark = act_mark->id + 1;\n+\t\t\treq_act |= OTX2_FLOW_ACT_MARK;\n+\t\t\trte_atomic32_inc(&npc->mark_actions);\n+\t\t\tbreak;\n+\n+\t\tcase RTE_FLOW_ACTION_TYPE_FLAG:\n+\t\t\tmark = OTX2_FLOW_FLAG_VAL;\n+\t\t\treq_act |= OTX2_FLOW_ACT_FLAG;\n+\t\t\trte_atomic32_inc(&npc->mark_actions);\n+\t\t\tbreak;\n+\n+\t\tcase RTE_FLOW_ACTION_TYPE_COUNT:\n+\t\t\tact_count =\n+\t\t\t\t(const struct rte_flow_action_count *)\n+\t\t\t\tactions->conf;\n+\n+\t\t\tif (act_count->shared == 1) {\n+\t\t\t\terrmsg = \"Shared Counters not supported\";\n+\t\t\t\terrcode = ENOTSUP;\n+\t\t\t\tgoto err_exit;\n+\t\t\t}\n+\t\t\t/* Indicates, need a counter */\n+\t\t\tflow->ctr_id = 1;\n+\t\t\treq_act |= OTX2_FLOW_ACT_COUNT;\n+\t\t\tbreak;\n+\n+\t\tcase RTE_FLOW_ACTION_TYPE_DROP:\n+\t\t\treq_act |= OTX2_FLOW_ACT_DROP;\n+\t\t\tbreak;\n+\n+\t\tcase RTE_FLOW_ACTION_TYPE_QUEUE:\n+\t\t\t/* Applicable only to ingress flow */\n+\t\t\tact_q = (const struct rte_flow_action_queue *)\n+\t\t\t\tactions->conf;\n+\t\t\trq = act_q->index;\n+\t\t\tif (rq >= dev->data->nb_rx_queues) {\n+\t\t\t\terrmsg = \"invalid queue index\";\n+\t\t\t\terrcode = EINVAL;\n+\t\t\t\tgoto err_exit;\n+\t\t\t}\n+\t\t\treq_act |= OTX2_FLOW_ACT_QUEUE;\n+\t\t\tbreak;\n+\n+\t\tcase RTE_FLOW_ACTION_TYPE_RSS:\n+\t\t\terrcode = parse_rss_action(dev,\tattr, actions, error);\n+\t\t\tif (errcode)\n+\t\t\t\treturn -rte_errno;\n+\n+\t\t\treq_act |= OTX2_FLOW_ACT_RSS;\n+\t\t\tbreak;\n+\n+\t\tcase RTE_FLOW_ACTION_TYPE_SECURITY:\n+\t\t\t/* Assumes user has already configured security\n+\t\t\t * session for this flow. Associated conf is\n+\t\t\t * opaque. When RTE security is implemented for otx2,\n+\t\t\t * we need to verify that for specified security\n+\t\t\t * session:\n+\t\t\t *  action_type ==\n+\t\t\t *    RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL &&\n+\t\t\t *  session_protocol ==\n+\t\t\t *    RTE_SECURITY_PROTOCOL_IPSEC\n+\t\t\t *\n+\t\t\t * RSS is not supported with inline ipsec. Get the\n+\t\t\t * rq from associated conf, or make\n+\t\t\t * RTE_FLOW_ACTION_TYPE_QUEUE compulsory with this\n+\t\t\t * action.\n+\t\t\t * Currently, rq = 0 is assumed.\n+\t\t\t */\n+\t\t\treq_act |= OTX2_FLOW_ACT_SEC;\n+\t\t\trq = 0;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\terrmsg = \"Unsupported action specified\";\n+\t\t\terrcode = ENOTSUP;\n+\t\t\tgoto err_exit;\n+\t\t}\n+\t}\n+\n+\t/* Check if actions specified are compatible */\n+\tif (attr->egress) {\n+\t\t/* Only DROP/COUNT is supported */\n+\t\tif (!(req_act & OTX2_FLOW_ACT_DROP)) {\n+\t\t\terrmsg = \"DROP is required action for egress\";\n+\t\t\terrcode = EINVAL;\n+\t\t\tgoto err_exit;\n+\t\t} else if (req_act & ~(OTX2_FLOW_ACT_DROP |\n+\t\t\t\t       OTX2_FLOW_ACT_COUNT)) {\n+\t\t\terrmsg = \"Unsupported action specified\";\n+\t\t\terrcode = ENOTSUP;\n+\t\t\tgoto err_exit;\n+\t\t}\n+\t\tflow->npc_action = NIX_TX_ACTIONOP_DROP;\n+\t\treturn 0;\n+\t}\n+\n+\t/* We have already verified the attr, this is ingress.\n+\t * - Exactly one terminating action is supported\n+\t * - Exactly one of MARK or FLAG is supported\n+\t * - If terminating action is DROP, only count is valid.\n+\t */\n+\tsel_act = req_act & OTX2_FLOW_ACT_TERM;\n+\tif ((sel_act & (sel_act - 1)) != 0) {\n+\t\terrmsg = \"Only one terminating action supported\";\n+\t\terrcode = EINVAL;\n+\t\tgoto err_exit;\n+\t}\n+\n+\tif (req_act & OTX2_FLOW_ACT_DROP) {\n+\t\tsel_act = req_act & ~OTX2_FLOW_ACT_COUNT;\n+\t\tif ((sel_act & (sel_act - 1)) != 0) {\n+\t\t\terrmsg = \"Only COUNT action is supported \"\n+\t\t\t\t\"with DROP ingress action\";\n+\t\t\terrcode = ENOTSUP;\n+\t\t\tgoto err_exit;\n+\t\t}\n+\t}\n+\n+\tif ((req_act & (OTX2_FLOW_ACT_FLAG | OTX2_FLOW_ACT_MARK))\n+\t    == (OTX2_FLOW_ACT_FLAG | OTX2_FLOW_ACT_MARK)) {\n+\t\terrmsg = \"Only one of FLAG or MARK action is supported\";\n+\t\terrcode = ENOTSUP;\n+\t\tgoto err_exit;\n+\t}\n+\n+\t/* Set NIX_RX_ACTIONOP */\n+\tif (req_act & OTX2_FLOW_ACT_DROP) {\n+\t\tflow->npc_action = NIX_RX_ACTIONOP_DROP;\n+\t} else if (req_act & OTX2_FLOW_ACT_QUEUE) {\n+\t\tflow->npc_action = NIX_RX_ACTIONOP_UCAST;\n+\t\tflow->npc_action |= (uint64_t)rq << 20;\n+\t} else if (req_act & OTX2_FLOW_ACT_RSS) {\n+\t\t/* When user added a rule for rss, first we will add the\n+\t\t *rule in MCAM and then update the action, once if we have\n+\t\t *FLOW_KEY_ALG index. So, till we update the action with\n+\t\t *flow_key_alg index, set the action to drop.\n+\t\t */\n+\t\tif (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS)\n+\t\t\tflow->npc_action = NIX_RX_ACTIONOP_DROP;\n+\t\telse\n+\t\t\tflow->npc_action = NIX_RX_ACTIONOP_UCAST;\n+\t} else if (req_act & OTX2_FLOW_ACT_SEC) {\n+\t\tflow->npc_action = NIX_RX_ACTIONOP_UCAST_IPSEC;\n+\t\tflow->npc_action |= (uint64_t)rq << 20;\n+\t} else if (req_act & (OTX2_FLOW_ACT_FLAG | OTX2_FLOW_ACT_MARK)) {\n+\t\tflow->npc_action = NIX_RX_ACTIONOP_UCAST;\n+\t} else if (req_act & OTX2_FLOW_ACT_COUNT) {\n+\t\t/* Keep OTX2_FLOW_ACT_COUNT always at the end\n+\t\t * This is default action, when user specify only\n+\t\t * COUNT ACTION\n+\t\t */\n+\t\tflow->npc_action = NIX_RX_ACTIONOP_UCAST;\n+\t} else {\n+\t\t/* Should never reach here */\n+\t\terrmsg = \"Invalid action specified\";\n+\t\terrcode = EINVAL;\n+\t\tgoto err_exit;\n+\t}\n+\n+\tif (mark)\n+\t\tflow->npc_action |= (uint64_t)mark << 40;\n+\n+\tif (rte_atomic32_read(&npc->mark_actions) == 1)\n+\t\thw->rx_offload_flags |= NIX_RX_OFFLOAD_MARK_UPDATE_F;\n+\n+\n+\t/* Ideally AF must ensure that correct pf_func is set */\n+\tpf_func = otx2_pfvf_func(hw->pf, hw->vf);\n+\tflow->npc_action |= (uint64_t)pf_func << 4;\n+\n+\treturn 0;\n+\n+err_exit:\n+\trte_flow_error_set(error, errcode,\n+\t\t\t   RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n+\t\t\t   errmsg);\n+\treturn -rte_errno;\n+}\n+\ndiff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h\nindex 0c3627c12..b9c9ff3cc 100644\n--- a/drivers/net/octeontx2/otx2_rx.h\n+++ b/drivers/net/octeontx2/otx2_rx.h\n@@ -14,6 +14,7 @@\n \n #define NIX_RX_OFFLOAD_PTYPE_F         BIT(1)\n #define NIX_RX_OFFLOAD_TSTAMP_F        BIT(5)\n+#define NIX_RX_OFFLOAD_MARK_UPDATE_F   BIT(4)\n \n #define NIX_TIMESYNC_RX_OFFSET\t\t8\n \n",
    "prefixes": [
        "v1",
        "39/58"
    ]
}