get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1227522,
    "url": "http://patchwork.ozlabs.org/api/patches/1227522/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200122152138.41585-2-anthony.l.nguyen@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": "<20200122152138.41585-2-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2020-01-22T15:21:25",
    "name": "[S38,02/15] ice: Refactor port vlan configuration for the VF",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4ea2538a5df500454f53702685bc5d2cac35636e",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@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/20200122152138.41585-2-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 154777,
            "url": "http://patchwork.ozlabs.org/api/series/154777/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=154777",
            "date": "2020-01-22T15:21:26",
            "name": "[S38,01/15] ice: Add initial support for QinQ",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/154777/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1227522/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1227522/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@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"
        ],
        "Authentication-Results": [
            "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.138;\n\thelo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4832MV03kQz9sR0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 23 Jan 2020 10:55:01 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 8E06586294;\n\tWed, 22 Jan 2020 23:55:00 +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 4GuImsGO4GPV; Wed, 22 Jan 2020 23:54:54 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id BE9548708C;\n\tWed, 22 Jan 2020 23:54:52 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id DB66F1BF977\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:25 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id D87D681A67\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:25 +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 qKi35mmZHbRu for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:22 +0000 (UTC)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 8580C81A64\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:22 +0000 (UTC)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t22 Jan 2020 15:54:21 -0800",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby fmsmga002.fm.intel.com with ESMTP; 22 Jan 2020 15:54:21 -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-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.70,351,1574150400\"; d=\"scan'208\";a=\"259651610\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 22 Jan 2020 07:21:25 -0800",
        "Message-Id": "<20200122152138.41585-2-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200122152138.41585-1-anthony.l.nguyen@intel.com>",
        "References": "<20200122152138.41585-1-anthony.l.nguyen@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S38 02/15] ice: Refactor port vlan\n\tconfiguration for the VF",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Brett Creeley <brett.creeley@intel.com>\n\nCurrently ice_vsi_manage_pvid() calls\nice_vsi_[set|kill]_pvid_fill_ctxt() when enabling/disabling a port VLAN\non a VSI respectively. These two functions have some duplication so just\nmove their unique pieces inline in ice_vsi_manage_pvid() and then the\nduplicate code can be reused for both the enabling/disabling paths.\n\nBefore this patch the info.pvid field was not being written\ncorrectly via ice_vsi_kill_pvid_fill_ctxt() so it was being hardcoded\nto 0 in ice_set_vf_port_vlan(). Fix this by setting the info.pvid field\nto 0 before calling ice_vsi_update() in ice_vsi_manage_pvid().\n\nWe currently use vf->port_vlan_id to keep track of the port VLAN\nID and QoS, which is a bit misleading. Fix this by renaming it to\nvf->port_vlan_info. Also change the name of the argument for\nice_vsi_manage_pvid() from vid to pvid_info.\n\nIn ice_vsi_manage_pvid() only save the fields that were modified\nin the VSI properties structure on success instead of the entire thing.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\n---\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 86 ++++++++-----------\n .../net/ethernet/intel/ice/ice_virtchnl_pf.h  |  2 +-\n 2 files changed, 37 insertions(+), 51 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex 8230a58a9b19..8349369b06bf 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -406,44 +406,16 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr)\n \t}\n }\n \n-/**\n- * ice_vsi_set_pvid_fill_ctxt - Set VSI ctxt for add PVID\n- * @ctxt: the VSI ctxt to fill\n- * @vid: the VLAN ID to set as a PVID\n- */\n-static void ice_vsi_set_pvid_fill_ctxt(struct ice_vsi_ctx *ctxt, u16 vid)\n-{\n-\tctxt->info.vlan_flags = (ICE_AQ_VSI_VLAN_MODE_UNTAGGED |\n-\t\t\t\t ICE_AQ_VSI_PVLAN_INSERT_PVID |\n-\t\t\t\t ICE_AQ_VSI_VLAN_EMOD_STR);\n-\tctxt->info.pvid = cpu_to_le16(vid);\n-\tctxt->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n-\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID |\n-\t\t\t\t\t\tICE_AQ_VSI_PROP_SW_VALID);\n-}\n-\n-/**\n- * ice_vsi_kill_pvid_fill_ctxt - Set VSI ctx for remove PVID\n- * @ctxt: the VSI ctxt to fill\n- */\n-static void ice_vsi_kill_pvid_fill_ctxt(struct ice_vsi_ctx *ctxt)\n-{\n-\tctxt->info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_NOTHING;\n-\tctxt->info.vlan_flags |= ICE_AQ_VSI_VLAN_MODE_ALL;\n-\tctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n-\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID |\n-\t\t\t\t\t\tICE_AQ_VSI_PROP_SW_VALID);\n-}\n-\n /**\n  * ice_vsi_manage_pvid - Enable or disable port VLAN for VSI\n  * @vsi: the VSI to update\n- * @vid: the VLAN ID to set as a PVID\n+ * @pvid_info: VLAN ID and QoS used to set the PVID VSI context field\n  * @enable: true for enable PVID false for disable\n  */\n-static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 vid, bool enable)\n+static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 pvid_info, bool enable)\n {\n \tstruct ice_hw *hw = &vsi->back->hw;\n+\tstruct ice_aqc_vsi_props *info;\n \tstruct ice_vsi_ctx *ctxt;\n \tenum ice_status status;\n \tint ret = 0;\n@@ -453,20 +425,33 @@ static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 vid, bool enable)\n \t\treturn -ENOMEM;\n \n \tctxt->info = vsi->info;\n-\tif (enable)\n-\t\tice_vsi_set_pvid_fill_ctxt(ctxt, vid);\n-\telse\n-\t\tice_vsi_kill_pvid_fill_ctxt(ctxt);\n+\tinfo = &ctxt->info;\n+\tif (enable) {\n+\t\tinfo->vlan_flags = ICE_AQ_VSI_VLAN_MODE_UNTAGGED |\n+\t\t\tICE_AQ_VSI_PVLAN_INSERT_PVID |\n+\t\t\tICE_AQ_VSI_VLAN_EMOD_STR;\n+\t\tinfo->sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n+\t} else {\n+\t\tinfo->vlan_flags = ICE_AQ_VSI_VLAN_EMOD_NOTHING |\n+\t\t\tICE_AQ_VSI_VLAN_MODE_ALL;\n+\t\tinfo->sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n+\t}\n+\n+\tinfo->pvid = cpu_to_le16(pvid_info);\n+\tinfo->valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID |\n+\t\t\t\t\t   ICE_AQ_VSI_PROP_SW_VALID);\n \n \tstatus = ice_update_vsi(hw, vsi->idx, ctxt, NULL);\n \tif (status) {\n-\t\tdev_info(ice_pf_to_dev(vsi->back), \"update VSI for port VLAN failed, err %d aq_err %d\\n\",\n+\t\tdev_info(ice_hw_to_dev(hw), \"update VSI for port VLAN failed, err %d aq_err %d\\n\",\n \t\t\t status, hw->adminq.sq_last_status);\n \t\tret = -EIO;\n \t\tgoto out;\n \t}\n \n-\tvsi->info = ctxt->info;\n+\tvsi->info.vlan_flags = info->vlan_flags;\n+\tvsi->info.sw_flags2 = info->sw_flags2;\n+\tvsi->info.pvid = info->pvid;\n out:\n \tkfree(ctxt);\n \treturn ret;\n@@ -533,9 +518,9 @@ static int ice_alloc_vsi_res(struct ice_vf *vf)\n \tvf->lan_vsi_num = vsi->vsi_num;\n \n \t/* Check if port VLAN exist before, and restore it accordingly */\n-\tif (vf->port_vlan_id) {\n-\t\tice_vsi_manage_pvid(vsi, vf->port_vlan_id, true);\n-\t\tice_vsi_add_vlan(vsi, vf->port_vlan_id & ICE_VLAN_M);\n+\tif (vf->port_vlan_info) {\n+\t\tice_vsi_manage_pvid(vsi, vf->port_vlan_info, true);\n+\t\tice_vsi_add_vlan(vsi, vf->port_vlan_info & ICE_VLAN_M);\n \t}\n \n \teth_broadcast_addr(broadcast);\n@@ -985,13 +970,13 @@ ice_vf_set_vsi_promisc(struct ice_vf *vf, struct ice_vsi *vsi, u8 promisc_m,\n \tif (vsi->num_vlan) {\n \t\tstatus = ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_m,\n \t\t\t\t\t\t  rm_promisc);\n-\t} else if (vf->port_vlan_id) {\n+\t} else if (vf->port_vlan_info) {\n \t\tif (rm_promisc)\n \t\t\tstatus = ice_clear_vsi_promisc(hw, vsi->idx, promisc_m,\n-\t\t\t\t\t\t       vf->port_vlan_id);\n+\t\t\t\t\t\t       vf->port_vlan_info);\n \t\telse\n \t\t\tstatus = ice_set_vsi_promisc(hw, vsi->idx, promisc_m,\n-\t\t\t\t\t\t     vf->port_vlan_id);\n+\t\t\t\t\t\t     vf->port_vlan_info);\n \t} else {\n \t\tif (rm_promisc)\n \t\t\tstatus = ice_clear_vsi_promisc(hw, vsi->idx, promisc_m,\n@@ -1231,7 +1216,7 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)\n \t */\n \tif (test_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states) ||\n \t    test_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states)) {\n-\t\tif (vf->port_vlan_id || vsi->num_vlan)\n+\t\tif (vf->port_vlan_info || vsi->num_vlan)\n \t\t\tpromisc_m = ICE_UCAST_VLAN_PROMISC_BITS;\n \t\telse\n \t\t\tpromisc_m = ICE_UCAST_PROMISC_BITS;\n@@ -2706,10 +2691,11 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,\n \tif (vlan_id || qos) {\n \t\tret = ice_vsi_manage_pvid(vsi, vlanprio, true);\n \t\tif (ret)\n-\t\t\tgoto error_set_pvid;\n+\t\t\tgoto error_manage_pvid;\n \t} else {\n-\t\tice_vsi_manage_pvid(vsi, 0, false);\n-\t\tvsi->info.pvid = 0;\n+\t\tret = ice_vsi_manage_pvid(vsi, 0, false);\n+\t\tif (ret)\n+\t\t\tgoto error_manage_pvid;\n \t}\n \n \tif (vlan_id) {\n@@ -2719,15 +2705,15 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,\n \t\t/* add new VLAN filter for each MAC */\n \t\tret = ice_vsi_add_vlan(vsi, vlan_id);\n \t\tif (ret)\n-\t\t\tgoto error_set_pvid;\n+\t\t\tgoto error_manage_pvid;\n \t}\n \n \t/* The Port VLAN needs to be saved across resets the same as the\n \t * default LAN MAC address.\n \t */\n-\tvf->port_vlan_id = le16_to_cpu(vsi->info.pvid);\n+\tvf->port_vlan_info = le16_to_cpu(vsi->info.pvid);\n \n-error_set_pvid:\n+error_manage_pvid:\n \treturn ret;\n }\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\nindex 4647d636ed36..80bb1acc7c28 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n@@ -74,7 +74,7 @@ struct ice_vf {\n \tstruct virtchnl_ether_addr dflt_lan_addr;\n \tDECLARE_BITMAP(txq_ena, ICE_MAX_BASE_QS_PER_VF);\n \tDECLARE_BITMAP(rxq_ena, ICE_MAX_BASE_QS_PER_VF);\n-\tu16 port_vlan_id;\n+\tu16 port_vlan_info;\t\t/* Port VLAN ID and QoS */\n \tu8 pf_set_mac:1;\t\t/* VF MAC address set by VMM admin */\n \tu8 trusted:1;\n \tu8 spoofchk:1;\n",
    "prefixes": [
        "S38",
        "02/15"
    ]
}