get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 609808,
    "url": "http://patchwork.ozlabs.org/api/patches/609808/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1460475052-6348-13-git-send-email-harshitha.ramamurthy@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": "<1460475052-6348-13-git-send-email-harshitha.ramamurthy@intel.com>",
    "list_archive_url": null,
    "date": "2016-04-12T15:30:51",
    "name": "[next,S33,12/13] i40e: Add VF promiscuous mode driver support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ac030164fb9b45ba0d4deaf6c293b71c4aa8b30a",
    "submitter": {
        "id": 68642,
        "url": "http://patchwork.ozlabs.org/api/people/68642/?format=api",
        "name": "Harshitha Ramamurthy",
        "email": "harshitha.ramamurthy@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/1460475052-6348-13-git-send-email-harshitha.ramamurthy@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/609808/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/609808/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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 3ql3H90KdWz9t4B\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Apr 2016 09:36:37 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 3E33295C08;\n\tTue, 12 Apr 2016 23:36:36 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ucXZZ3r7iadU; Tue, 12 Apr 2016 23:36:34 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 7A08E95BCE;\n\tTue, 12 Apr 2016 23:36:34 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 4565B1C0E44\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 12 Apr 2016 23:36:33 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 4125FC019E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 12 Apr 2016 23:36:33 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id JxDaWI8hIEIQ for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 12 Apr 2016 23:36:32 +0000 (UTC)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id E014DC01A7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 12 Apr 2016 23:36:31 +0000 (UTC)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga103.fm.intel.com with ESMTP; 12 Apr 2016 16:36:31 -0700",
            "from harshitha-linux1.jf.intel.com ([10.166.45.81])\n\tby orsmga002.jf.intel.com with ESMTP; 12 Apr 2016 16:36:30 -0700"
        ],
        "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.24,476,1455004800\"; d=\"scan'208\";a=\"953677418\"",
        "From": "Harshitha Ramamurthy <harshitha.ramamurthy@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 12 Apr 2016 08:30:51 -0700",
        "Message-Id": "<1460475052-6348-13-git-send-email-harshitha.ramamurthy@intel.com>",
        "X-Mailer": "git-send-email 2.4.3",
        "In-Reply-To": "<1460475052-6348-1-git-send-email-harshitha.ramamurthy@intel.com>",
        "References": "<1460475052-6348-1-git-send-email-harshitha.ramamurthy@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S33 12/13] i40e: Add VF promiscuous\n\tmode driver support",
        "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": "From: Anjali Singhai Jain <anjali.singhai@intel.com>\n\nAdd infrastructure for Network Function Virtualization VLAN tagged\npacket steering feature.\n\nSigned-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>\nSigned-off-by: Greg Rose <gregory.v.rose@intel.com>\nChange-Id: I9b873d8fcc253858e6baba65ac68ec5b9363944e\n---\nTesting Hints : Test the feature with\nIp link set dev veth0 promisc on  (do this from the VF for the VF)\nAlso test with adding vlan on VF plus port vlan for VF.\n\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 153 ++++++++++++++++++++-\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |   2 +\n 2 files changed, 149 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex c364588..33224ac 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -1427,6 +1427,25 @@ static void i40e_vc_reset_vf_msg(struct i40e_vf *vf)\n }\n \n /**\n+ * i40e_getnum_vf_vsi_vlan_filters\n+ * @vsi: pointer to the vsi\n+ *\n+ * called to get the number of vlans offloaded on this vf\n+ **/\n+static inline int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)\n+{\n+\tstruct i40e_mac_filter *f;\n+\tint num_vlans = 0;\n+\n+\tlist_for_each_entry(f, &vsi->mac_filter_list, list) {\n+\t\tif (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID)\n+\t\t\tnum_vlans++;\n+\t}\n+\n+\treturn num_vlans;\n+}\n+\n+/**\n  * i40e_vc_config_promiscuous_mode_msg\n  * @vf: pointer to the VF info\n  * @msg: pointer to the msg buffer\n@@ -1442,22 +1461,122 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,\n \t    (struct i40e_virtchnl_promisc_info *)msg;\n \tstruct i40e_pf *pf = vf->pf;\n \tstruct i40e_hw *hw = &pf->hw;\n-\tstruct i40e_vsi *vsi;\n+\tstruct i40e_mac_filter *f;\n+\ti40e_status aq_ret = 0;\n \tbool allmulti = false;\n-\ti40e_status aq_ret;\n+\tstruct i40e_vsi *vsi;\n+\tbool alluni = false;\n+\tint aq_err = 0;\n \n \tvsi = i40e_find_vsi_from_id(pf, info->vsi_id);\n \tif (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) ||\n \t    !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) ||\n-\t    !i40e_vc_isvalid_vsi_id(vf, info->vsi_id) ||\n-\t    (vsi->type != I40E_VSI_FCOE)) {\n+\t    !i40e_vc_isvalid_vsi_id(vf, info->vsi_id)) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"VF %d doesn't meet requirements to enter promiscuous mode\\n\",\n+\t\t\tvf->vf_id);\n \t\taq_ret = I40E_ERR_PARAM;\n \t\tgoto error_param;\n \t}\n+\t/* Multicast promiscuous handling*/\n \tif (info->flags & I40E_FLAG_VF_MULTICAST_PROMISC)\n \t\tallmulti = true;\n-\taq_ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,\n-\t\t\t\t\t\t       allmulti, NULL);\n+\n+\tif (vf->port_vlan_id) {\n+\t\taq_ret = i40e_aq_set_vsi_mc_promisc_on_vlan(hw, vsi->seid,\n+\t\t\t\t\t\t\t    allmulti,\n+\t\t\t\t\t\t\t    vf->port_vlan_id,\n+\t\t\t\t\t\t\t    NULL);\n+\t} else if (i40e_getnum_vf_vsi_vlan_filters(vsi)) {\n+\t\tlist_for_each_entry(f, &vsi->mac_filter_list, list) {\n+\t\t\tif (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID)\n+\t\t\t\taq_ret = i40e_aq_set_vsi_mc_promisc_on_vlan\n+\t\t\t\t\t\t\t\t   (hw,\n+\t\t\t\t\t\t\t\t   vsi->seid,\n+\t\t\t\t\t\t\t\t   allmulti,\n+\t\t\t\t\t\t\t\t   f->vlan,\n+\t\t\t\t\t\t\t\t   NULL);\n+\t\t\taq_err = pf->hw.aq.asq_last_status;\n+\t\t\tif (aq_ret) {\n+\t\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\t\"Could not add VLAN %d to multicast promiscuous domain err %s aq_err %s\\n\",\n+\t\t\t\t\tf->vlan,\n+\t\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t} else {\n+\t\taq_ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,\n+\t\t\t\t\t\t\t       allmulti, NULL);\n+\t\taq_err = pf->hw.aq.asq_last_status;\n+\t\tif (aq_ret) {\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"VF %d failed to set multicast promiscuous mode err %s aq_err %s\\n\",\n+\t\t\t\tvf->vf_id,\n+\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t\t\tgoto error_param_int;\n+\t\t}\n+\t}\n+\n+\tif (!aq_ret) {\n+\t\tdev_info(&pf->pdev->dev,\n+\t\t\t \"VF %d successfully set multicast promiscuous mode\\n\",\n+\t\t\t vf->vf_id);\n+\t\tif (allmulti)\n+\t\t\tset_bit(I40E_VF_STAT_MC_PROMISC, &vf->vf_states);\n+\t\telse\n+\t\t\tclear_bit(I40E_VF_STAT_MC_PROMISC, &vf->vf_states);\n+\t}\n+\n+\tif (info->flags & I40E_FLAG_VF_UNICAST_PROMISC)\n+\t\talluni = true;\n+\tif (vf->port_vlan_id) {\n+\t\taq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, vsi->seid,\n+\t\t\t\t\t\t\t    alluni,\n+\t\t\t\t\t\t\t    vf->port_vlan_id,\n+\t\t\t\t\t\t\t    NULL);\n+\t} else if (i40e_getnum_vf_vsi_vlan_filters(vsi)) {\n+\t\tlist_for_each_entry(f, &vsi->mac_filter_list, list) {\n+\t\t\taq_ret = 0;\n+\t\t\tif (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID)\n+\t\t\t\taq_ret =\n+\t\t\t\ti40e_aq_set_vsi_uc_promisc_on_vlan(hw,\n+\t\t\t\t\t\t\t\t   vsi->seid,\n+\t\t\t\t\t\t\t\t   alluni,\n+\t\t\t\t\t\t\t\t   f->vlan,\n+\t\t\t\t\t\t\t\t   NULL);\n+\t\t\t\taq_err = pf->hw.aq.asq_last_status;\n+\t\t\tif (aq_ret)\n+\t\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\t\"Could not add VLAN %d to Unicast promiscuous domain err %s aq_err %s\\n\",\n+\t\t\t\t\tf->vlan,\n+\t\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t\t}\n+\t} else {\n+\t\taq_ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,\n+\t\t\t\t\t\t\t     allmulti, NULL);\n+\t\taq_err = pf->hw.aq.asq_last_status;\n+\t\tif (aq_ret)\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"VF %d failed to set unicast promiscuous mode %8.8x err %s aq_err %s\\n\",\n+\t\t\t\tvf->vf_id, info->flags,\n+\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t}\n+\n+error_param_int:\n+\tif (!aq_ret) {\n+\t\tdev_info(&pf->pdev->dev,\n+\t\t\t \"VF %d successfully set unicast promiscuous mode\\n\",\n+\t\t\t vf->vf_id);\n+\t\tif (alluni)\n+\t\t\tset_bit(I40E_VF_STAT_UC_PROMISC, &vf->vf_states);\n+\t\telse\n+\t\t\tclear_bit(I40E_VF_STAT_UC_PROMISC, &vf->vf_states);\n+\t}\n \n error_param:\n \t/* send the response to the VF */\n@@ -1919,6 +2038,17 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)\n \t\t/* add new VLAN filter */\n \t\tint ret = i40e_vsi_add_vlan(vsi, vfl->vlan_id[i]);\n \n+\t\tif (test_bit(I40E_VF_STAT_UC_PROMISC, &vf->vf_states))\n+\t\t\ti40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid,\n+\t\t\t\t\t\t\t   true,\n+\t\t\t\t\t\t\t   vfl->vlan_id[i],\n+\t\t\t\t\t\t\t   NULL);\n+\t\tif (test_bit(I40E_VF_STAT_MC_PROMISC, &vf->vf_states))\n+\t\t\ti40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid,\n+\t\t\t\t\t\t\t   true,\n+\t\t\t\t\t\t\t   vfl->vlan_id[i],\n+\t\t\t\t\t\t\t   NULL);\n+\n \t\tif (ret)\n \t\t\tdev_err(&pf->pdev->dev,\n \t\t\t\t\"Unable to add VLAN filter %d for VF %d, error %d\\n\",\n@@ -1971,6 +2101,17 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)\n \tfor (i = 0; i < vfl->num_elements; i++) {\n \t\tint ret = i40e_vsi_kill_vlan(vsi, vfl->vlan_id[i]);\n \n+\t\tif (test_bit(I40E_VF_STAT_UC_PROMISC, &vf->vf_states))\n+\t\t\ti40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid,\n+\t\t\t\t\t\t\t   false,\n+\t\t\t\t\t\t\t   vfl->vlan_id[i],\n+\t\t\t\t\t\t\t   NULL);\n+\t\tif (test_bit(I40E_VF_STAT_MC_PROMISC, &vf->vf_states))\n+\t\t\ti40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid,\n+\t\t\t\t\t\t\t   false,\n+\t\t\t\t\t\t\t   vfl->vlan_id[i],\n+\t\t\t\t\t\t\t   NULL);\n+\n \t\tif (ret)\n \t\t\tdev_err(&pf->pdev->dev,\n \t\t\t\t\"Unable to delete VLAN filter %d for VF %d, error %d\\n\",\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\nindex 838cbd2..8cbf579 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n@@ -61,6 +61,8 @@ enum i40e_vf_states {\n \tI40E_VF_STAT_IWARPENA,\n \tI40E_VF_STAT_FCOEENA,\n \tI40E_VF_STAT_DISABLED,\n+\tI40E_VF_STAT_MC_PROMISC,\n+\tI40E_VF_STAT_UC_PROMISC,\n };\n \n /* VF capabilities */\n",
    "prefixes": [
        "next",
        "S33",
        "12/13"
    ]
}