get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44578,
    "url": "http://patchwork.dpdk.org/api/patches/44578/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1536675645-10105-11-git-send-email-reshma.pattan@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1536675645-10105-11-git-send-email-reshma.pattan@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1536675645-10105-11-git-send-email-reshma.pattan@intel.com",
    "date": "2018-09-11T14:20:40",
    "name": "[v2,10/15] net/softnic: validate and map flow with hash table match",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ac798bd332ff793eee1b16e14d6364d4960f6614",
    "submitter": {
        "id": 70,
        "url": "http://patchwork.dpdk.org/api/people/70/?format=api",
        "name": "Pattan, Reshma",
        "email": "reshma.pattan@intel.com"
    },
    "delegate": {
        "id": 10018,
        "url": "http://patchwork.dpdk.org/api/users/10018/?format=api",
        "username": "cristian_dumitrescu",
        "first_name": "Cristian",
        "last_name": "Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1536675645-10105-11-git-send-email-reshma.pattan@intel.com/mbox/",
    "series": [
        {
            "id": 1276,
            "url": "http://patchwork.dpdk.org/api/series/1276/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=1276",
            "date": "2018-09-11T14:20:40",
            "name": null,
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/1276/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/44578/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/44578/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 DFDF85F12;\n\tTue, 11 Sep 2018 16:21:09 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 2FDC756A3\n\tfor <dev@dpdk.org>; Tue, 11 Sep 2018 16:21:00 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Sep 2018 07:20:59 -0700",
            "from sivswdev02.ir.intel.com (HELO localhost.localdomain)\n\t([10.237.217.46])\n\tby fmsmga007.fm.intel.com with ESMTP; 11 Sep 2018 07:20:58 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,360,1531810800\"; d=\"scan'208\";a=\"69156896\"",
        "From": "Reshma Pattan <reshma.pattan@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>,\n\tReshma Pattan <reshma.pattan@intel.com>",
        "Date": "Tue, 11 Sep 2018 15:20:40 +0100",
        "Message-Id": "<1536675645-10105-11-git-send-email-reshma.pattan@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": "<1536251222-17275-1-git-send-email-reshma.pattan@intel.com>",
        "References": "<1536251222-17275-1-git-send-email-reshma.pattan@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 10/15] net/softnic: validate and map flow with\n\thash table match",
        "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": "Support for validating and mapping flow rule with HASH\ntable match is added.\n\nAs part of this, below helper functions are added.\nflow_rule_match_hash_get()\nhash_key_mask_is_same()\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Reshma Pattan <reshma.pattan@intel.com>\n---\n drivers/net/softnic/rte_eth_softnic_flow.c | 201 ++++++++++++++++++++++++++++-\n 1 file changed, 200 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c\nindex 94af66391..dc3dd493b 100644\n--- a/drivers/net/softnic/rte_eth_softnic_flow.c\n+++ b/drivers/net/softnic/rte_eth_softnic_flow.c\n@@ -791,7 +791,195 @@ flow_rule_match_acl_get(struct pmd_internals *softnic __rte_unused,\n \treturn 0;\n }\n \n-\tstatic int\n+/***\n+ * Both *tmask* and *fmask* are byte arrays of size *tsize* and *fsize*\n+ * respectively.\n+ * They are located within a larger buffer at offsets *toffset* and *foffset*\n+ * respectivelly. Both *tmask* and *fmask* represent bitmasks for the larger\n+ * buffer.\n+ * Question: are the two masks equivalent?\n+ *\n+ * Notes:\n+ * 1. Offset basically indicates that the first offset bytes in the buffer\n+ *    are \"don't care\", so offset is equivalent to pre-pending an \"all-zeros\"\n+ *    array of *offset* bytes to the *mask*.\n+ * 2. Each *mask* might contain a number of zero bytes at the beginning or\n+ *    at the end.\n+ * 3. Bytes in the larger buffer after the end of the *mask* are also considered\n+ *    \"don't care\", so they are equivalent to appending an \"all-zeros\" array of\n+ *    bytes to the *mask*.\n+ *\n+ * Example:\n+ * Buffer = [xx xx xx xx xx xx xx xx], buffer size = 8 bytes\n+ * tmask = [00 22 00 33 00], toffset = 2, tsize = 5\n+ *    => buffer mask = [00 00 00 22 00 33 00 00]\n+ * fmask = [22 00 33], foffset = 3, fsize = 3 =>\n+ *    => buffer mask = [00 00 00 22 00 33 00 00]\n+ * Therefore, the tmask and fmask from this example are equivalent.\n+ */\n+static int\n+hash_key_mask_is_same(uint8_t *tmask,\n+\tsize_t toffset,\n+\tsize_t tsize,\n+\tuint8_t *fmask,\n+\tsize_t foffset,\n+\tsize_t fsize,\n+\tsize_t *toffset_plus,\n+\tsize_t *foffset_plus)\n+{\n+\tsize_t tpos; /* Position of first non-zero byte in the tmask buffer. */\n+\tsize_t fpos; /* Position of first non-zero byte in the fmask buffer. */\n+\n+\t/* Compute tpos and fpos. */\n+\tfor (tpos = 0; tmask[tpos] == 0; tpos++)\n+\t\t;\n+\tfor (fpos = 0; fmask[fpos] == 0; fpos++)\n+\t\t;\n+\n+\tif (toffset + tpos != foffset + fpos)\n+\t\treturn 0; /* FALSE */\n+\n+\ttsize -= tpos;\n+\tfsize -= fpos;\n+\n+\tif (tsize < fsize) {\n+\t\tsize_t i;\n+\n+\t\tfor (i = 0; i < tsize; i++)\n+\t\t\tif (tmask[tpos + i] != fmask[fpos + i])\n+\t\t\t\treturn 0; /* FALSE */\n+\n+\t\tfor ( ; i < fsize; i++)\n+\t\t\tif (fmask[fpos + i])\n+\t\t\t\treturn 0; /* FALSE */\n+\t} else {\n+\t\tsize_t i;\n+\n+\t\tfor (i = 0; i < fsize; i++)\n+\t\t\tif (tmask[tpos + i] != fmask[fpos + i])\n+\t\t\t\treturn 0; /* FALSE */\n+\n+\t\tfor ( ; i < tsize; i++)\n+\t\t\tif (tmask[tpos + i])\n+\t\t\t\treturn 0; /* FALSE */\n+\t}\n+\n+\tif (toffset_plus)\n+\t\t*toffset_plus = tpos;\n+\n+\tif (foffset_plus)\n+\t\t*foffset_plus = fpos;\n+\n+\treturn 1; /* TRUE */\n+}\n+\n+static int\n+flow_rule_match_hash_get(struct pmd_internals *softnic __rte_unused,\n+\tstruct pipeline *pipeline __rte_unused,\n+\tstruct softnic_table *table,\n+\tconst struct rte_flow_attr *attr __rte_unused,\n+\tconst struct rte_flow_item *item,\n+\tstruct softnic_table_rule_match *rule_match,\n+\tstruct rte_flow_error *error)\n+{\n+\tstruct softnic_table_rule_match_hash key, key_mask;\n+\tstruct softnic_table_hash_params *params = &table->params.match.hash;\n+\tsize_t offset = 0, length = 0, tpos, fpos;\n+\tint status;\n+\n+\tmemset(&key, 0, sizeof(key));\n+\tmemset(&key_mask, 0, sizeof(key_mask));\n+\n+\t/* VOID or disabled protos only, if any. */\n+\tstatus = flow_item_skip_disabled_protos(&item, 0, &offset, error);\n+\tif (status)\n+\t\treturn status;\n+\n+\tif (item->type == RTE_FLOW_ITEM_TYPE_END)\n+\t\treturn rte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\titem,\n+\t\t\t\"HASH: END detected too early\");\n+\n+\t/* VOID or any protocols (enabled or disabled). */\n+\tfor ( ; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {\n+\t\tunion flow_item spec, mask;\n+\t\tsize_t size;\n+\t\tint disabled, status;\n+\n+\t\tif (item->type == RTE_FLOW_ITEM_TYPE_VOID)\n+\t\t\tcontinue;\n+\n+\t\tstatus = flow_item_proto_preprocess(item,\n+\t\t\t&spec,\n+\t\t\t&mask,\n+\t\t\t&size,\n+\t\t\t&disabled,\n+\t\t\terror);\n+\t\tif (status)\n+\t\t\treturn status;\n+\n+\t\tif (length + size > sizeof(key)) {\n+\t\t\tif (disabled)\n+\t\t\t\tbreak;\n+\n+\t\t\treturn rte_flow_error_set(error,\n+\t\t\t\tENOTSUP,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\titem,\n+\t\t\t\t\"HASH: Item too big\");\n+\t\t}\n+\n+\t\tmemcpy(&key.key[length], &spec, size);\n+\t\tmemcpy(&key_mask.key[length], &mask, size);\n+\t\tlength += size;\n+\t}\n+\n+\tif (item->type != RTE_FLOW_ITEM_TYPE_END) {\n+\t\t/* VOID or disabled protos only, if any. */\n+\t\tstatus = flow_item_skip_disabled_protos(&item, 0, NULL, error);\n+\t\tif (status)\n+\t\t\treturn status;\n+\n+\t\t/* END only. */\n+\t\tif (item->type != RTE_FLOW_ITEM_TYPE_END)\n+\t\t\treturn rte_flow_error_set(error,\n+\t\t\t\tEINVAL,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\titem,\n+\t\t\t\t\"HASH: Expecting END item\");\n+\t}\n+\n+\t/* Compare flow key mask against table key mask. */\n+\toffset += sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM;\n+\n+\tif (!hash_key_mask_is_same(params->key_mask,\n+\t\tparams->key_offset,\n+\t\tparams->key_size,\n+\t\tkey_mask.key,\n+\t\toffset,\n+\t\tlength,\n+\t\t&tpos,\n+\t\t&fpos))\n+\t\treturn rte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\tNULL,\n+\t\t\t\"HASH: Item list is not observing the match format\");\n+\n+\t/* Rule match. */\n+\tmemset(rule_match, 0, sizeof(*rule_match));\n+\trule_match->match_type = TABLE_HASH;\n+\tmemcpy(&rule_match->match.hash.key[tpos],\n+\t\t&key.key[fpos],\n+\t\tRTE_MIN(sizeof(rule_match->match.hash.key) - tpos,\n+\t\t\tlength - fpos));\n+\n+\treturn 0;\n+}\n+\n+static int\n flow_rule_match_get(struct pmd_internals *softnic,\n \t\tstruct pipeline *pipeline,\n \t\tstruct softnic_table *table,\n@@ -809,7 +997,18 @@ flow_rule_match_get(struct pmd_internals *softnic,\n \t\t\titem,\n \t\t\trule_match,\n \t\t\terror);\n+\n \t\t/* FALLTHROUGH */\n+\n+\tcase TABLE_HASH:\n+\t\treturn flow_rule_match_hash_get(softnic,\n+\t\t\tpipeline,\n+\t\t\ttable,\n+\t\t\tattr,\n+\t\t\titem,\n+\t\t\trule_match,\n+\t\t\terror);\n+\n \tdefault:\n \t\treturn rte_flow_error_set(error,\n \t\t\tENOTSUP,\n",
    "prefixes": [
        "v2",
        "10/15"
    ]
}