get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 724787,
    "url": "http://patchwork.ozlabs.org/api/patches/724787/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170206223852.31177-6-jacob.e.keller@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170206223852.31177-6-jacob.e.keller@intel.com>",
    "list_archive_url": null,
    "date": "2017-02-06T22:38:48",
    "name": "[PART2,5/9] i40e: partition the ring_cookie to get VF index",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "665fecd5e152d77f164a21f56dfba9445fb705f6",
    "submitter": {
        "id": 9784,
        "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api",
        "name": "Jacob Keller",
        "email": "jacob.e.keller@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170206223852.31177-6-jacob.e.keller@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/724787/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/724787/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3vHMpZ3Ck6z9s1y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  7 Feb 2017 09:39:18 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id F08E430A47;\n\tMon,  6 Feb 2017 22:39:16 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id buzAV903e3wa; Mon,  6 Feb 2017 22:39:13 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id A585F30A8A;\n\tMon,  6 Feb 2017 22:39:02 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 41B0D1BFF07\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  6 Feb 2017 22:38:58 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 42F57815B4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  6 Feb 2017 22:38:58 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 3rOXXtoREqTS for <intel-wired-lan@lists.osuosl.org>;\n\tMon,  6 Feb 2017 22:38:55 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 7824A88803\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  6 Feb 2017 22:38:55 +0000 (UTC)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga102.fm.intel.com with ESMTP; 06 Feb 2017 14:38:54 -0800",
            "from jekeller-desk.amr.corp.intel.com (HELO\n\tjekeller-desk.jekeller.internal) ([10.166.35.174])\n\tby fmsmga005.fm.intel.com with ESMTP; 06 Feb 2017 14:38:54 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.33,342,1477983600\"; d=\"scan'208\";a=\"61907694\"",
        "From": "Jacob Keller <jacob.e.keller@intel.com>",
        "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>",
        "Date": "Mon,  6 Feb 2017 14:38:48 -0800",
        "Message-Id": "<20170206223852.31177-6-jacob.e.keller@intel.com>",
        "X-Mailer": "git-send-email 2.12.0.rc0.151.g8a5726c42288",
        "In-Reply-To": "<20170206223852.31177-1-jacob.e.keller@intel.com>",
        "References": "<20170206223852.31177-1-jacob.e.keller@intel.com>",
        "Subject": "[Intel-wired-lan] [PART2 PATCH 5/9] i40e: partition the ring_cookie\n\tto get VF index",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "Do not use the user-def field for determining the VF target. Instead,\nsimilar to ixgbe, partition the ring_cookie value into 8bits of VF\nindex, along with 32bits of queue number. This is better than using the\nuser-def field, because it leaves the field open for extension in\na future patch which will enable flexible data. Also, this matches with\nconvention used by ixgbe and other drivers.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-Id: e36745186d817216b12f0313b99ec95cb8a9130c\n---\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 74 ++++++++++++++------------\n 1 file changed, 40 insertions(+), 34 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 595ede664c56..f6cca3254fd4 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -2420,8 +2420,13 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,\n \n \t\tvsi = i40e_find_vsi_from_id(pf, rule->dest_vsi);\n \t\tif (vsi && vsi->type == I40E_VSI_SRIOV) {\n-\t\t\tfsp->h_ext.data[1] = htonl(vsi->vf_id);\n-\t\t\tfsp->m_ext.data[1] = htonl(0x1);\n+\t\t\t/* VFs are zero-indexed by the driver, but ethtool\n+\t\t\t * expects them to be one-indexed, so add one here\n+\t\t\t */\n+\t\t\tu64 ring_vf = vsi->vf_id + 1;\n+\n+\t\t\tring_vf <<= ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;\n+\t\t\tfsp->ring_cookie |= ring_vf;\n \t\t}\n \t}\n \n@@ -3000,9 +3005,10 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,\n {\n \tstruct ethtool_rx_flow_spec *fsp;\n \tstruct i40e_fdir_filter *input;\n+\tu16 dest_vsi = 0, q_index = 0;\n \tstruct i40e_pf *pf;\n \tint ret = -EINVAL;\n-\tu16 vf_id;\n+\tu8 dest_ctl;\n \n \tif (!vsi)\n \t\treturn -EINVAL;\n@@ -3036,9 +3042,32 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,\n \t\treturn -EINVAL;\n \t}\n \n-\tif ((fsp->ring_cookie != RX_CLS_FLOW_DISC) &&\n-\t    (fsp->ring_cookie >= vsi->num_queue_pairs))\n-\t\treturn -EINVAL;\n+\t/* ring_cookie is either the drop index, or is a mask of the queue\n+\t * index and VF id we wish to target.\n+\t */\n+\tif (fsp->ring_cookie == RX_CLS_FLOW_DISC) {\n+\t\tdest_ctl = I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET;\n+\t} else {\n+\t\tu32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie);\n+\t\tu8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);\n+\n+\t\tif (!vf) {\n+\t\t\tif (ring >= vsi->num_queue_pairs)\n+\t\t\t\treturn -EINVAL;\n+\t\t\tdest_vsi = vsi->id;\n+\t\t} else {\n+\t\t\t/* VFs are zero-indexed, so we subtract one here */\n+\t\t\tvf--;\n+\n+\t\t\tif (vf >= pf->num_alloc_vfs)\n+\t\t\t\treturn -EINVAL;\n+\t\t\tif (ring >= pf->vf[vf].num_queue_pairs)\n+\t\t\t\treturn -EINVAL;\n+\t\t\tdest_vsi = pf->vf[vf].lan_vsi_id;\n+\t\t}\n+\t\tdest_ctl = I40E_FILTER_PROGRAM_DESC_DEST_DIRECT_PACKET_QINDEX;\n+\t\tq_index = ring;\n+\t}\n \n \tinput = kzalloc(sizeof(*input), GFP_KERNEL);\n \n@@ -3046,19 +3075,13 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,\n \t\treturn -ENOMEM;\n \n \tinput->fd_id = fsp->location;\n-\n-\tif (fsp->ring_cookie == RX_CLS_FLOW_DISC)\n-\t\tinput->dest_ctl = I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET;\n-\telse\n-\t\tinput->dest_ctl =\n-\t\t\t     I40E_FILTER_PROGRAM_DESC_DEST_DIRECT_PACKET_QINDEX;\n-\n-\tinput->q_index = fsp->ring_cookie;\n-\tinput->flex_off = 0;\n-\tinput->pctype = 0;\n-\tinput->dest_vsi = vsi->id;\n+\tinput->q_index = q_index;\n+\tinput->dest_vsi = dest_vsi;\n+\tinput->dest_ctl = dest_ctl;\n \tinput->fd_status = I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID;\n \tinput->cnt_index  = I40E_FD_SB_STAT_IDX(pf->hw.pf_id);\n+\tinput->dst_ip = fsp->h_u.tcp_ip4_spec.ip4src;\n+\tinput->src_ip = fsp->h_u.tcp_ip4_spec.ip4dst;\n \tinput->flow_type = fsp->flow_type;\n \tinput->ip4_proto = fsp->h_u.usr_ip4_spec.proto;\n \n@@ -3070,23 +3093,6 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,\n \tinput->dst_ip = fsp->h_u.tcp_ip4_spec.ip4src;\n \tinput->src_ip = fsp->h_u.tcp_ip4_spec.ip4dst;\n \n-\tif (ntohl(fsp->m_ext.data[1])) {\n-\t\tvf_id = ntohl(fsp->h_ext.data[1]);\n-\t\tif (vf_id >= pf->num_alloc_vfs) {\n-\t\t\tnetif_info(pf, drv, vsi->netdev,\n-\t\t\t\t   \"Invalid VF id %d\\n\", vf_id);\n-\t\t\tgoto free_input;\n-\t\t}\n-\t\t/* Find vsi id from vf id and override dest vsi */\n-\t\tinput->dest_vsi = pf->vf[vf_id].lan_vsi_id;\n-\t\tif (input->q_index >= pf->vf[vf_id].num_queue_pairs) {\n-\t\t\tnetif_info(pf, drv, vsi->netdev,\n-\t\t\t\t   \"Invalid queue id %d for VF %d\\n\",\n-\t\t\t\t   input->q_index, vf_id);\n-\t\t\tgoto free_input;\n-\t\t}\n-\t}\n-\n \tret = i40e_add_del_fdir(vsi, input, true);\n \tif (ret)\n \t\tgoto free_input;\n",
    "prefixes": [
        "PART2",
        "5/9"
    ]
}