get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 40929,
    "url": "https://patches.dpdk.org/api/patches/40929/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1e8a8ad0cda86e0a61ce42e82f01dce4f888b842.1528469677.git.rahul.lakkireddy@chelsio.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1e8a8ad0cda86e0a61ce42e82f01dce4f888b842.1528469677.git.rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1e8a8ad0cda86e0a61ce42e82f01dce4f888b842.1528469677.git.rahul.lakkireddy@chelsio.com",
    "date": "2018-06-08T17:58:15",
    "name": "[dpdk-dev,5/7] net/cxgbe: implement flow destroy operation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "f03729076746adb5d0c05320cc769fb264a6e5ac",
    "submitter": {
        "id": 241,
        "url": "https://patches.dpdk.org/api/people/241/?format=api",
        "name": "Rahul Lakkireddy",
        "email": "rahul.lakkireddy@chelsio.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1e8a8ad0cda86e0a61ce42e82f01dce4f888b842.1528469677.git.rahul.lakkireddy@chelsio.com/mbox/",
    "series": [
        {
            "id": 63,
            "url": "https://patches.dpdk.org/api/series/63/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=63",
            "date": "2018-06-08T17:58:10",
            "name": "cxgbe: add support to offload flows via rte_flow",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/63/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/40929/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/40929/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 5FECD1BB2F;\n\tFri,  8 Jun 2018 19:59:34 +0200 (CEST)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n\tby dpdk.org (Postfix) with ESMTP id BCE361BB2E\n\tfor <dev@dpdk.org>; Fri,  8 Jun 2018 19:59:32 +0200 (CEST)",
            "from localhost (scalar.blr.asicdesigners.com [10.193.185.94])\n\tby stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w58HxTqS017300; \n\tFri, 8 Jun 2018 10:59:30 -0700"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Cc": "shaguna@chelsio.com, kumaras@chelsio.com, indranil@chelsio.com,\n\tnirranjan@chelsio.com",
        "Date": "Fri,  8 Jun 2018 23:28:15 +0530",
        "Message-Id": "<1e8a8ad0cda86e0a61ce42e82f01dce4f888b842.1528469677.git.rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "In-Reply-To": [
            "<cover.1528469677.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1528469677.git.rahul.lakkireddy@chelsio.com>"
        ],
        "References": [
            "<cover.1528469677.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1528469677.git.rahul.lakkireddy@chelsio.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 5/7] net/cxgbe: implement flow destroy operation",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/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: Shagun Agrawal <shaguna@chelsio.com>\n\nAdd API to construct delete filter work request to remove filter\nat specified index in LE-TCAM (maskfull) region.\n\nSigned-off-by: Shagun Agrawal <shaguna@chelsio.com>\nSigned-off-by: Kumar Sanghvi <kumaras@chelsio.com>\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\n drivers/net/cxgbe/cxgbe_filter.c | 114 +++++++++++++++++++++++++++++++++++++++\n drivers/net/cxgbe/cxgbe_filter.h |   3 ++\n drivers/net/cxgbe/cxgbe_flow.c   |  53 +++++++++++++++++-\n 3 files changed, 169 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c\nindex cf83ec9c0..8129ed01f 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.c\n+++ b/drivers/net/cxgbe/cxgbe_filter.c\n@@ -134,6 +134,60 @@ void clear_filter(struct filter_entry *f)\n \tmemset(f, 0, sizeof(*f));\n }\n \n+/**\n+ * t4_mk_filtdelwr - create a delete filter WR\n+ * @ftid: the filter ID\n+ * @wr: the filter work request to populate\n+ * @qid: ingress queue to receive the delete notification\n+ *\n+ * Creates a filter work request to delete the supplied filter.  If @qid is\n+ * negative the delete notification is suppressed.\n+ */\n+static void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid)\n+{\n+\tmemset(wr, 0, sizeof(*wr));\n+\twr->op_pkd = cpu_to_be32(V_FW_WR_OP(FW_FILTER_WR));\n+\twr->len16_pkd = cpu_to_be32(V_FW_WR_LEN16(sizeof(*wr) / 16));\n+\twr->tid_to_iq = cpu_to_be32(V_FW_FILTER_WR_TID(ftid) |\n+\t\t\t\t    V_FW_FILTER_WR_NOREPLY(qid < 0));\n+\twr->del_filter_to_l2tix = cpu_to_be32(F_FW_FILTER_WR_DEL_FILTER);\n+\tif (qid >= 0)\n+\t\twr->rx_chan_rx_rpl_iq =\n+\t\t\t\tcpu_to_be16(V_FW_FILTER_WR_RX_RPL_IQ(qid));\n+}\n+\n+/**\n+ * Create FW work request to delete the filter at a specified index\n+ */\n+static int del_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)\n+{\n+\tstruct adapter *adapter = ethdev2adap(dev);\n+\tstruct filter_entry *f = &adapter->tids.ftid_tab[fidx];\n+\tstruct rte_mbuf *mbuf;\n+\tstruct fw_filter_wr *fwr;\n+\tstruct sge_ctrl_txq *ctrlq;\n+\tunsigned int port_id = ethdev2pinfo(dev)->port_id;\n+\n+\tctrlq = &adapter->sge.ctrlq[port_id];\n+\tmbuf = rte_pktmbuf_alloc(ctrlq->mb_pool);\n+\tif (!mbuf)\n+\t\treturn -ENOMEM;\n+\n+\tmbuf->data_len = sizeof(*fwr);\n+\tmbuf->pkt_len = mbuf->data_len;\n+\n+\tfwr = rte_pktmbuf_mtod(mbuf, struct fw_filter_wr *);\n+\tt4_mk_filtdelwr(f->tid, fwr, adapter->sge.fw_evtq.abs_id);\n+\n+\t/*\n+\t * Mark the filter as \"pending\" and ship off the Filter Work Request.\n+\t * When we get the Work Request Reply we'll clear the pending status.\n+\t */\n+\tf->pending = 1;\n+\tt4_mgmt_tx(ctrlq, mbuf);\n+\treturn 0;\n+}\n+\n int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)\n {\n \tstruct adapter *adapter = ethdev2adap(dev);\n@@ -244,6 +298,58 @@ static void cxgbe_clear_ftid(struct tid_info *t, int fidx, int family)\n \tt4_os_unlock(&t->ftid_lock);\n }\n \n+/**\n+ * Check a delete filter request for validity and send it to the hardware.\n+ * Return 0 on success, an error number otherwise.  We attach any provided\n+ * filter operation context to the internal filter specification in order to\n+ * facilitate signaling completion of the operation.\n+ */\n+int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id,\n+\t\t     struct ch_filter_specification *fs,\n+\t\t     struct filter_ctx *ctx)\n+{\n+\tstruct port_info *pi = (struct port_info *)(dev->data->dev_private);\n+\tstruct adapter *adapter = pi->adapter;\n+\tstruct filter_entry *f;\n+\tint ret;\n+\n+\tif (filter_id >= adapter->tids.nftids)\n+\t\treturn -ERANGE;\n+\n+\tret = is_filter_set(&adapter->tids, filter_id, fs->type);\n+\tif (!ret) {\n+\t\tdev_warn(adap, \"%s: could not find filter entry: %u\\n\",\n+\t\t\t __func__, filter_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tf = &adapter->tids.ftid_tab[filter_id];\n+\tret = writable_filter(f);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (f->valid) {\n+\t\tf->ctx = ctx;\n+\t\tcxgbe_clear_ftid(&adapter->tids,\n+\t\t\t\t f->tid - adapter->tids.ftid_base,\n+\t\t\t\t f->fs.type ? FILTER_TYPE_IPV6 :\n+\t\t\t\t\t      FILTER_TYPE_IPV4);\n+\t\treturn del_filter_wr(dev, filter_id);\n+\t}\n+\n+\t/*\n+\t * If the caller has passed in a Completion Context then we need to\n+\t * mark it as a successful completion so they don't stall waiting\n+\t * for it.\n+\t */\n+\tif (ctx) {\n+\t\tctx->result = 0;\n+\t\tt4_complete(&ctx->completion);\n+\t}\n+\n+\treturn 0;\n+}\n+\n /**\n  * Check a Chelsio Filter Request for validity, convert it into our internal\n  * format and send it to the hardware.  Return 0 on success, an error number\n@@ -415,6 +521,14 @@ void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl)\n \t\t\t\tctx->tid = f->tid;\n \t\t\t\tctx->result = 0;\n \t\t\t}\n+\t\t} else if (ret == FW_FILTER_WR_FLT_DELETED) {\n+\t\t\t/*\n+\t\t\t * Clear the filter when we get confirmation from the\n+\t\t\t * hardware that the filter has been deleted.\n+\t\t\t */\n+\t\t\tclear_filter(f);\n+\t\t\tif (ctx)\n+\t\t\t\tctx->result = 0;\n \t\t} else {\n \t\t\t/*\n \t\t\t * Something went wrong.  Issue a warning about the\ndiff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h\nindex e12baa7f9..e0ba6a4d3 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.h\n+++ b/drivers/net/cxgbe/cxgbe_filter.h\n@@ -215,6 +215,9 @@ int writable_filter(struct filter_entry *f);\n int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,\n \t\t     struct ch_filter_specification *fs,\n \t\t     struct filter_ctx *ctx);\n+int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id,\n+\t\t     struct ch_filter_specification *fs,\n+\t\t     struct filter_ctx *ctx);\n int cxgbe_alloc_ftid(struct adapter *adap, unsigned int family);\n int validate_filter(struct adapter *adap, struct ch_filter_specification *fs);\n #endif /* _CXGBE_FILTER_H_ */\ndiff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c\nindex 7fa3f5810..1584df392 100644\n--- a/drivers/net/cxgbe/cxgbe_flow.c\n+++ b/drivers/net/cxgbe/cxgbe_flow.c\n@@ -471,6 +471,57 @@ cxgbe_flow_create(struct rte_eth_dev *dev,\n \treturn flow;\n }\n \n+static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)\n+{\n+\tstruct adapter *adap = ethdev2adap(dev);\n+\tstruct filter_entry *f = flow->f;\n+\tstruct ch_filter_specification *fs;\n+\tstruct filter_ctx ctx;\n+\tint err;\n+\n+\tfs = &f->fs;\n+\tif (cxgbe_verify_fidx(flow, flow->fidx, 1))\n+\t\treturn -1;\n+\n+\tt4_init_completion(&ctx.completion);\n+\terr = cxgbe_del_filter(dev, flow->fidx, fs, &ctx);\n+\tif (err) {\n+\t\tdev_err(adap, \"Error %d while deleting filter.\\n\", err);\n+\t\treturn err;\n+\t}\n+\n+\t/* Poll the FW for reply */\n+\terr = cxgbe_poll_for_completion(&adap->sge.fw_evtq,\n+\t\t\t\t\tCXGBE_FLOW_POLL_US,\n+\t\t\t\t\tCXGBE_FLOW_POLL_CNT,\n+\t\t\t\t\t&ctx.completion);\n+\tif (err) {\n+\t\tdev_err(adap, \"Filter delete operation timed out (%d)\\n\", err);\n+\t\treturn err;\n+\t}\n+\tif (ctx.result) {\n+\t\tdev_err(adap, \"Hardware error %d while deleting the filter.\\n\",\n+\t\t\tctx.result);\n+\t\treturn ctx.result;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,\n+\t\t   struct rte_flow_error *e)\n+{\n+\tint ret;\n+\n+\tret = __cxgbe_flow_destroy(dev, flow);\n+\tif (ret)\n+\t\treturn rte_flow_error_set(e, ret, RTE_FLOW_ERROR_TYPE_HANDLE,\n+\t\t\t\t\t  flow, \"error destroying filter.\");\n+\tt4_os_free(flow);\n+\treturn 0;\n+}\n+\n static int\n cxgbe_flow_validate(struct rte_eth_dev *dev,\n \t\t    const struct rte_flow_attr *attr,\n@@ -524,7 +575,7 @@ cxgbe_flow_validate(struct rte_eth_dev *dev,\n static const struct rte_flow_ops cxgbe_flow_ops = {\n \t.validate\t= cxgbe_flow_validate,\n \t.create\t\t= cxgbe_flow_create,\n-\t.destroy\t= NULL,\n+\t.destroy\t= cxgbe_flow_destroy,\n \t.flush\t\t= NULL,\n \t.query\t\t= NULL,\n \t.isolate\t= NULL,\n",
    "prefixes": [
        "dpdk-dev",
        "5/7"
    ]
}