Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1208830/?format=api
{ "id": 1208830, "url": "http://patchwork.ozlabs.org/api/patches/1208830/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191212111307.33566-3-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": "<20191212111307.33566-3-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2019-12-12T11:12:55", "name": "[S35,03/15] ice: Add code to keep track of current dflt_vsi", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "1c451bcc2656ed81b0ebc7428abe08b4d13eb3ab", "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/20191212111307.33566-3-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 148167, "url": "http://patchwork.ozlabs.org/api/series/148167/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=148167", "date": "2019-12-12T11:13:03", "name": "[S35,01/15] ice: Support UDP segmentation offload", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/148167/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1208830/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1208830/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.136;\n\thelo=silver.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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 47Ykln6dfMz9sPL\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 13 Dec 2019 06:44:53 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 46B2C24F06;\n\tThu, 12 Dec 2019 19:44:52 +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 voy5YtuQCMwI; Thu, 12 Dec 2019 19:44:47 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id BA67324F78;\n\tThu, 12 Dec 2019 19:44:45 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 9E6941BF340\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:39 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 83C8A888C3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:39 +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 CA4WsMLZ1Oh4 for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:36 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 04A73888C1\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:35 +0000 (UTC)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t12 Dec 2019 11:44:35 -0800", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby orsmga001.jf.intel.com with ESMTP; 12 Dec 2019 11:44:34 -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.69,306,1571727600\"; d=\"scan'208\";a=\"296698850\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Thu, 12 Dec 2019 03:12:55 -0800", "Message-Id": "<20191212111307.33566-3-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20191212111307.33566-1-anthony.l.nguyen@intel.com>", "References": "<20191212111307.33566-1-anthony.l.nguyen@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S35 03/15] ice: Add code to keep track of\n\tcurrent dflt_vsi", "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\nWe can't have more than one default VSI so prevent another VSI from\noverwriting the current dflt_vsi. This was achieved by adding the\nfollowing functions:\n\nice_is_dflt_vsi_in_use()\n- Used to check if the default VSI is already being used.\n\nice_is_vsi_dflt_vsi()\n- Used to check if VSI passed in is in fact the default VSI.\n\nice_set_dflt_vsi()\n- Used to set the default VSI via a switch rule\n\nice_clear_dflt_vsi()\n- Used to clear the default VSI via a switch rule.\n\nAlso, there was no need to introduce any locking because all mailbox\nevents and synchronization of switch filters for the PF happen in the\nservice task.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice.h | 2 +\n drivers/net/ethernet/intel/ice/ice_lib.c | 118 ++++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_lib.h | 4 +\n drivers/net/ethernet/intel/ice/ice_main.c | 43 +++++---\n 4 files changed, 151 insertions(+), 16 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 5746c07814b7..b2b1f7b1d932 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -177,6 +177,8 @@ struct ice_sw {\n \tstruct ice_pf *pf;\n \tu16 sw_id;\t\t/* switch ID for this switch */\n \tu16 bridge_mode;\t/* VEB/VEPA/Port Virtualizer */\n+\tstruct ice_vsi *dflt_vsi;\t/* default VSI for this switch */\n+\tu8 dflt_vsi_ena:1;\t/* true if above dflt_vsi is enabled */\n };\n \n enum ice_state {\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex a05d30f86619..0581df95f3a1 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -2792,3 +2792,121 @@ ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set)\n \tice_free_fltr_list(&vsi->back->pdev->dev, &tmp_add_list);\n \treturn status;\n }\n+\n+/**\n+ * ice_is_dflt_vsi_in_use - check if the default forwarding VSI is being used\n+ * @sw: switch to check if its default forwarding VSI is free\n+ *\n+ * Return true if the default forwarding VSI is already being used, else returns\n+ * false signalling that it's available to use.\n+ */\n+bool ice_is_dflt_vsi_in_use(struct ice_sw *sw)\n+{\n+\treturn (sw->dflt_vsi && sw->dflt_vsi_ena);\n+}\n+\n+/**\n+ * ice_is_vsi_dflt_vsi - check if the VSI passed in is the default VSI\n+ * @sw: switch for the default forwarding VSI to compare against\n+ * @vsi: VSI to compare against default forwarding VSI\n+ *\n+ * If this VSI passed in is the default forwarding VSI then return true, else\n+ * return false\n+ */\n+bool ice_is_vsi_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi)\n+{\n+\treturn (sw->dflt_vsi == vsi && sw->dflt_vsi_ena);\n+}\n+\n+/**\n+ * ice_set_dflt_vsi - set the default forwarding VSI\n+ * @sw: switch used to assign the default forwarding VSI\n+ * @vsi: VSI getting set as the default forwarding VSI on the switch\n+ *\n+ * If the VSI passed in is already the default VSI and it's enabled just return\n+ * success.\n+ *\n+ * If there is already a default VSI on the switch and it's enabled then return\n+ * -EEXIST since there can only be one default VSI per switch.\n+ *\n+ * Otherwise try to set the VSI passed in as the switch's default VSI and\n+ * return the result.\n+ */\n+int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi)\n+{\n+\tenum ice_status status;\n+\tstruct device *dev;\n+\n+\tif (!sw || !vsi)\n+\t\treturn -EINVAL;\n+\n+\tdev = ice_pf_to_dev(vsi->back);\n+\n+\t/* the VSI passed in is already the default VSI */\n+\tif (ice_is_vsi_dflt_vsi(sw, vsi)) {\n+\t\tdev_dbg(dev, \"VSI %d passed in is already the default forwarding VSI, nothing to do\\n\",\n+\t\t\tvsi->vsi_num);\n+\t\treturn 0;\n+\t}\n+\n+\t/* another VSI is already the default VSI for this switch */\n+\tif (ice_is_dflt_vsi_in_use(sw)) {\n+\t\tdev_err(dev,\n+\t\t\t\"Default forwarding VSI %d already in use, disable it and try again\\n\",\n+\t\t\tsw->dflt_vsi->vsi_num);\n+\t\treturn -EEXIST;\n+\t}\n+\n+\tstatus = ice_cfg_dflt_vsi(&vsi->back->hw, vsi->idx, true, ICE_FLTR_RX);\n+\tif (status) {\n+\t\tdev_err(dev,\n+\t\t\t\"Failed to set VSI %d as the default forwarding VSI, error %d\\n\",\n+\t\t\tvsi->vsi_num, status);\n+\t\treturn -EIO;\n+\t}\n+\n+\tsw->dflt_vsi = vsi;\n+\tsw->dflt_vsi_ena = true;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_clear_dflt_vsi - clear the default forwarding VSI\n+ * @sw: switch used to clear the default VSI\n+ *\n+ * If the switch has no default VSI or it's not enabled then return error.\n+ *\n+ * Otherwise try to clear the default VSI and return the result.\n+ */\n+int ice_clear_dflt_vsi(struct ice_sw *sw)\n+{\n+\tstruct ice_vsi *dflt_vsi;\n+\tenum ice_status status;\n+\tstruct device *dev;\n+\n+\tif (!sw)\n+\t\treturn -EINVAL;\n+\n+\tdev = ice_pf_to_dev(sw->pf);\n+\n+\tdflt_vsi = sw->dflt_vsi;\n+\n+\t/* there is no default VSI configured */\n+\tif (!ice_is_dflt_vsi_in_use(sw))\n+\t\treturn -ENODEV;\n+\n+\tstatus = ice_cfg_dflt_vsi(&dflt_vsi->back->hw, dflt_vsi->idx, false,\n+\t\t\t\t ICE_FLTR_RX);\n+\tif (status) {\n+\t\tdev_err(dev,\n+\t\t\t\"Failed to clear the default forwarding VSI %d, error %d\\n\",\n+\t\t\tdflt_vsi->vsi_num, status);\n+\t\treturn -EIO;\n+\t}\n+\n+\tsw->dflt_vsi = NULL;\n+\tsw->dflt_vsi_ena = false;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex 1cb8513fcf1f..d7092bbaf3a8 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -106,4 +106,8 @@ ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set);\n \n bool ice_is_safe_mode(struct ice_pf *pf);\n bool ice_is_peer_ena(struct ice_pf *pf);\n+bool ice_is_dflt_vsi_in_use(struct ice_sw *sw);\n+bool ice_is_vsi_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi);\n+int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi);\n+int ice_clear_dflt_vsi(struct ice_sw *sw);\n #endif /* !_ICE_LIB_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 31cd816e7cfb..ca6a0880e7aa 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -379,25 +379,29 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)\n \t\tclear_bit(ICE_VSI_FLAG_PROMISC_CHANGED, vsi->flags);\n \t\tif (vsi->current_netdev_flags & IFF_PROMISC) {\n \t\t\t/* Apply Rx filter rule to get traffic from wire */\n-\t\t\tstatus = ice_cfg_dflt_vsi(hw, vsi->idx, true,\n-\t\t\t\t\t\t ICE_FLTR_RX);\n-\t\t\tif (status) {\n-\t\t\t\tnetdev_err(netdev, \"Error setting default VSI %i Rx rule\\n\",\n-\t\t\t\t\t vsi->vsi_num);\n-\t\t\t\tvsi->current_netdev_flags &= ~IFF_PROMISC;\n-\t\t\t\terr = -EIO;\n-\t\t\t\tgoto out_promisc;\n+\t\t\tif (!ice_is_dflt_vsi_in_use(pf->first_sw)) {\n+\t\t\t\terr = ice_set_dflt_vsi(pf->first_sw, vsi);\n+\t\t\t\tif (err && err != -EEXIST) {\n+\t\t\t\t\tnetdev_err(netdev,\n+\t\t\t\t\t\t \"Error %d setting default VSI %i Rx rule\\n\",\n+\t\t\t\t\t\t err, vsi->vsi_num);\n+\t\t\t\t\tvsi->current_netdev_flags &=\n+\t\t\t\t\t\t~IFF_PROMISC;\n+\t\t\t\t\tgoto out_promisc;\n+\t\t\t\t}\n \t\t\t}\n \t\t} else {\n \t\t\t/* Clear Rx filter to remove traffic from wire */\n-\t\t\tstatus = ice_cfg_dflt_vsi(hw, vsi->idx, false,\n-\t\t\t\t\t\t ICE_FLTR_RX);\n-\t\t\tif (status) {\n-\t\t\t\tnetdev_err(netdev, \"Error clearing default VSI %i Rx rule\\n\",\n-\t\t\t\t\t vsi->vsi_num);\n-\t\t\t\tvsi->current_netdev_flags |= IFF_PROMISC;\n-\t\t\t\terr = -EIO;\n-\t\t\t\tgoto out_promisc;\n+\t\t\tif (ice_is_vsi_dflt_vsi(pf->first_sw, vsi)) {\n+\t\t\t\terr = ice_clear_dflt_vsi(pf->first_sw);\n+\t\t\t\tif (err) {\n+\t\t\t\t\tnetdev_err(netdev,\n+\t\t\t\t\t\t \"Error %d clearing default VSI %i Rx rule\\n\",\n+\t\t\t\t\t\t err, vsi->vsi_num);\n+\t\t\t\t\tvsi->current_netdev_flags |=\n+\t\t\t\t\t\tIFF_PROMISC;\n+\t\t\t\t\tgoto out_promisc;\n+\t\t\t\t}\n \t\t\t}\n \t\t}\n \t}\n@@ -4736,6 +4740,13 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)\n \t\tgoto err_init_ctrlq;\n \t}\n \n+\tif (pf->first_sw->dflt_vsi_ena)\n+\t\tdev_info(dev,\n+\t\t\t \"Clearing default VSI, re-enable after reset completes\\n\");\n+\t/* clear the default VSI configuration if it exists */\n+\tpf->first_sw->dflt_vsi = NULL;\n+\tpf->first_sw->dflt_vsi_ena = false;\n+\n \tice_clear_pxe_mode(hw);\n \n \tret = ice_get_caps(hw);\n", "prefixes": [ "S35", "03/15" ] }