get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1267,
    "url": "https://patches.dpdk.org/api/patches/1267/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1415882995-8697-3-git-send-email-jingjing.wu@intel.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": "<1415882995-8697-3-git-send-email-jingjing.wu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1415882995-8697-3-git-send-email-jingjing.wu@intel.com",
    "date": "2014-11-13T12:49:55",
    "name": "[dpdk-dev,v3,2/2] i40e: implement operation to add/delete an ethertype filter",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "c2d4d0d14b2a14c2823e87f06ff994d471d07518",
    "submitter": {
        "id": 47,
        "url": "https://patches.dpdk.org/api/people/47/?format=api",
        "name": "Jingjing Wu",
        "email": "jingjing.wu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1415882995-8697-3-git-send-email-jingjing.wu@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1267/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1267/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id E93697F89;\n\tThu, 13 Nov 2014 13:40:19 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id E00867F95\n\tfor <dev@dpdk.org>; Thu, 13 Nov 2014 13:40:16 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga103.jf.intel.com with ESMTP; 13 Nov 2014 04:47:40 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 13 Nov 2014 04:50:05 -0800",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id sADCo382025558;\n\tThu, 13 Nov 2014 20:50:03 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid sADCo1ap008747; Thu, 13 Nov 2014 20:50:03 +0800",
            "(from wujingji@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sADCo1UH008743; \n\tThu, 13 Nov 2014 20:50:01 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.07,376,1413270000\"; d=\"scan'208\";a=\"607212671\"",
        "From": "Jingjing Wu <jingjing.wu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Thu, 13 Nov 2014 20:49:55 +0800",
        "Message-Id": "<1415882995-8697-3-git-send-email-jingjing.wu@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1415882995-8697-1-git-send-email-jingjing.wu@intel.com>",
        "References": "<1413965977-15165-1-git-send-email-jingjing.wu@intel.com>\n\t<1415882995-8697-1-git-send-email-jingjing.wu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 2/2] i40e: implement operation to add/delete\n\tan ethertype filter",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://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": "<http://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: \"jingjing.wu\" <jingjing.wu@intel.com>\n\nHandle the RTE_ETH_FILTER_ADD and RTE_ETH_FILTER_DELETE operations\non ethertype filter.\n\nSigned-off-by: jingjing.wu <jingjing.wu@intel.com>\n---\n lib/librte_pmd_i40e/i40e_ethdev.c | 99 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 99 insertions(+)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex 5074262..499270e 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -205,6 +205,12 @@ static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev,\n \t\t\t\tstruct rte_eth_udp_tunnel *udp_tunnel);\n static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev,\n \t\t\t\tstruct rte_eth_udp_tunnel *udp_tunnel);\n+static int i40e_ethertype_filter_set(struct i40e_pf *pf,\n+\t\t\tstruct rte_eth_ethertype_filter *filter,\n+\t\t\tbool add);\n+static int i40e_ethertype_filter_handle(struct rte_eth_dev *dev,\n+\t\t\t\tenum rte_filter_op filter_op,\n+\t\t\t\tvoid *arg);\n static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,\n \t\t\t\tenum rte_filter_type filter_type,\n \t\t\t\tenum rte_filter_op filter_op,\n@@ -4990,6 +4996,96 @@ i40e_pf_config_mq_rx(struct i40e_pf *pf)\n \treturn ret;\n }\n \n+/*\n+ * Configure ethertype filter, which can director packet by filtering\n+ * with mac address and ether_type or only ether_type\n+ */\n+static int\n+i40e_ethertype_filter_set(struct i40e_pf *pf,\n+\t\t\tstruct rte_eth_ethertype_filter *filter,\n+\t\t\tbool add)\n+{\n+\tstruct i40e_hw *hw = I40E_PF_TO_HW(pf);\n+\tstruct i40e_control_filter_stats stats;\n+\tuint16_t flags = 0;\n+\tint ret;\n+\n+\tif (filter->queue >= pf->dev_data->nb_rx_queues) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid queue ID\");\n+\t\treturn -EINVAL;\n+\t}\n+\tif (filter->ether_type == ETHER_TYPE_IPv4 ||\n+\t\tfilter->ether_type == ETHER_TYPE_IPv6) {\n+\t\tPMD_DRV_LOG(ERR, \"unsupported ether_type(0x%04x) in\"\n+\t\t\t\" control packet filter.\", filter->ether_type);\n+\t\treturn -EINVAL;\n+\t}\n+\tif (filter->ether_type == ETHER_TYPE_VLAN)\n+\t\tPMD_DRV_LOG(WARNING, \"filter vlan ether_type in first tag is\"\n+\t\t\t\" not supported.\");\n+\n+\tif (!(filter->flags & RTE_ETHTYPE_FLAGS_MAC))\n+\t\tflags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC;\n+\tif (filter->flags & RTE_ETHTYPE_FLAGS_DROP)\n+\t\tflags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP;\n+\tflags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE;\n+\n+\tmemset(&stats, 0, sizeof(stats));\n+\tret = i40e_aq_add_rem_control_packet_filter(hw,\n+\t\t\tfilter->mac_addr.addr_bytes,\n+\t\t\tfilter->ether_type, flags,\n+\t\t\tpf->main_vsi->seid,\n+\t\t\tfilter->queue, add, &stats, NULL);\n+\n+\tPMD_DRV_LOG(INFO, \"add/rem control packet filter, return %d,\"\n+\t\t\t \" mac_etype_used = %u, etype_used = %u,\"\n+\t\t\t \" mac_etype_free = %u, etype_free = %u\\n\",\n+\t\t\t ret, stats.mac_etype_used, stats.etype_used,\n+\t\t\t stats.mac_etype_free, stats.etype_free);\n+\tif (ret < 0)\n+\t\treturn -ENOSYS;\n+\treturn 0;\n+}\n+\n+/*\n+ * Handle operations for ethertype filter.\n+ */\n+static int\n+i40e_ethertype_filter_handle(struct rte_eth_dev *dev,\n+\t\t\t\tenum rte_filter_op filter_op,\n+\t\t\t\tvoid *arg)\n+{\n+\tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\tint ret = 0;\n+\n+\tif (filter_op == RTE_ETH_FILTER_NOP)\n+\t\treturn ret;\n+\n+\tif (arg == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"arg shouldn't be NULL for operation %u\",\n+\t\t\t    filter_op);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tswitch (filter_op) {\n+\tcase RTE_ETH_FILTER_ADD:\n+\t\tret = i40e_ethertype_filter_set(pf,\n+\t\t\t(struct rte_eth_ethertype_filter *)arg,\n+\t\t\tTRUE);\n+\t\tbreak;\n+\tcase RTE_ETH_FILTER_DELETE:\n+\t\tret = i40e_ethertype_filter_set(pf,\n+\t\t\t(struct rte_eth_ethertype_filter *)arg,\n+\t\t\tFALSE);\n+\t\tbreak;\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"unsupported operation %u\\n\", filter_op);\n+\t\tret = -ENOSYS;\n+\t\tbreak;\n+\t}\n+\treturn ret;\n+}\n+\n static int\n i40e_dev_filter_ctrl(struct rte_eth_dev *dev,\n \t\t     enum rte_filter_type filter_type,\n@@ -5008,6 +5104,9 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev,\n \tcase RTE_ETH_FILTER_TUNNEL:\n \t\tret = i40e_tunnel_filter_handle(dev, filter_op, arg);\n \t\tbreak;\n+\tcase RTE_ETH_FILTER_ETHERTYPE:\n+\t\tret = i40e_ethertype_filter_handle(dev, filter_op, arg);\n+\t\tbreak;\n \tdefault:\n \t\tPMD_DRV_LOG(WARNING, \"Filter type (%d) not supported\",\n \t\t\t\t\t\t\tfilter_type);\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "2/2"
    ]
}