Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/53235/?format=api
http://patchwork.dpdk.org/api/patches/53235/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1556863150-83886-1-git-send-email-haiyue.wang@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<1556863150-83886-1-git-send-email-haiyue.wang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1556863150-83886-1-git-send-email-haiyue.wang@intel.com", "date": "2019-05-03T05:59:10", "name": "[v2] net/ice: add link-up and link-down functions", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "3d585769bc90a87dd641346d57cea0d6912b81fa", "submitter": { "id": 1044, "url": "http://patchwork.dpdk.org/api/people/1044/?format=api", "name": "Wang, Haiyue", "email": "haiyue.wang@intel.com" }, "delegate": { "id": 1540, "url": "http://patchwork.dpdk.org/api/users/1540/?format=api", "username": "qzhan15", "first_name": "Qi", "last_name": "Zhang", "email": "qi.z.zhang@intel.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1556863150-83886-1-git-send-email-haiyue.wang@intel.com/mbox/", "series": [ { "id": 4550, "url": "http://patchwork.dpdk.org/api/series/4550/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=4550", "date": "2019-05-03T05:59:10", "name": "[v2] net/ice: add link-up and link-down functions", "version": 2, "mbox": "http://patchwork.dpdk.org/series/4550/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/53235/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/53235/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2CBAA29CB;\n\tFri, 3 May 2019 08:04:37 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 0106B2986\n\tfor <dev@dpdk.org>; Fri, 3 May 2019 08:04:34 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 May 2019 23:04:34 -0700", "from npg-dpdk-haiyue-2.sh.intel.com ([10.67.110.171])\n\tby fmsmga007.fm.intel.com with ESMTP; 02 May 2019 23:04:33 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.60,424,1549958400\"; d=\"scan'208\";a=\"147880914\"", "From": "Haiyue Wang <haiyue.wang@intel.com>", "To": "dev@dpdk.org,\n\tqi.z.zhang@intel.com,\n\twenzhuo.lu@intel.com", "Cc": "peng.huang@intel.com,\n\tHaiyue Wang <haiyue.wang@intel.com>", "Date": "Fri, 3 May 2019 13:59:10 +0800", "Message-Id": "<1556863150-83886-1-git-send-email-haiyue.wang@intel.com>", "X-Mailer": "git-send-email 2.7.4", "Subject": "[dpdk-dev] [PATCH v2] net/ice: add link-up and link-down functions", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Support link up and down functions for ice, and when stop the ice,\nmakes the link down also.\n\nSigned-off-by: Haiyue Wang <haiyue.wang@intel.com>\n---\n drivers/net/ice/ice_ethdev.c | 85 ++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 85 insertions(+)", "diff": "diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c\nindex 1f06a2c..495dcfc 100644\n--- a/drivers/net/ice/ice_ethdev.c\n+++ b/drivers/net/ice/ice_ethdev.c\n@@ -32,6 +32,9 @@ static void ice_dev_info_get(struct rte_eth_dev *dev,\n \t\t\t struct rte_eth_dev_info *dev_info);\n static int ice_link_update(struct rte_eth_dev *dev,\n \t\t\t int wait_to_complete);\n+static int ice_dev_set_link_up(struct rte_eth_dev *dev);\n+static int ice_dev_set_link_down(struct rte_eth_dev *dev);\n+\n static int ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);\n static int ice_vlan_offload_set(struct rte_eth_dev *dev, int mask);\n static int ice_vlan_tpid_set(struct rte_eth_dev *dev,\n@@ -94,6 +97,8 @@ static const struct eth_dev_ops ice_eth_dev_ops = {\n \t.dev_stop = ice_dev_stop,\n \t.dev_close = ice_dev_close,\n \t.dev_reset = ice_dev_reset,\n+\t.dev_set_link_up = ice_dev_set_link_up,\n+\t.dev_set_link_down = ice_dev_set_link_down,\n \t.rx_queue_start = ice_rx_queue_start,\n \t.rx_queue_stop = ice_rx_queue_stop,\n \t.tx_queue_start = ice_tx_queue_start,\n@@ -1541,6 +1546,8 @@ ice_dev_stop(struct rte_eth_dev *dev)\n \t/* Clear all queues and release mbufs */\n \tice_clear_queues(dev);\n \n+\tice_dev_set_link_down(dev);\n+\n \t/* Clean datapath event and queue/vec mapping */\n \trte_intr_efd_disable(intr_handle);\n \tif (intr_handle->intr_vec) {\n@@ -1557,6 +1564,13 @@ ice_dev_close(struct rte_eth_dev *dev)\n \tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \tstruct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \n+\t/* Since stop will make link down, then the link event will be\n+\t * triggered, disable the irq firstly to avoid the port_infoe etc\n+\t * resources deallocation causing the interrupt service thread\n+\t * crash.\n+\t */\n+\tice_pf_disable_irq0(hw);\n+\n \tice_dev_stop(dev);\n \n \t/* release all queue resource */\n@@ -1566,6 +1580,7 @@ ice_dev_close(struct rte_eth_dev *dev)\n \tice_release_vsi(pf->main_vsi);\n \tice_sched_cleanup_all(hw);\n \trte_free(hw->port_info);\n+\thw->port_info = NULL;\n \tice_shutdown_all_ctrlq(hw);\n }\n \n@@ -1936,6 +1951,8 @@ ice_dev_start(struct rte_eth_dev *dev)\n \tif (ret != ICE_SUCCESS)\n \t\tPMD_DRV_LOG(WARNING, \"Fail to set phy mask\");\n \n+\tice_dev_set_link_up(dev);\n+\n \t/* Call get_link_info aq commond to enable/disable LSE */\n \tice_link_update(dev, 0);\n \n@@ -2218,6 +2235,74 @@ ice_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)\n \treturn 0;\n }\n \n+/* Force the physical link state by getting the current PHY capabilities from\n+ * hardware and setting the PHY config based on the determined capabilities. If\n+ * link changes, link event will be triggered because both the Enable Automatic\n+ * Link Update and LESM Enable bits are set when setting the PHY capabilities.\n+ */\n+static enum ice_status\n+ice_force_phys_link_state(struct ice_hw *hw, bool link_up)\n+{\n+\tstruct ice_aqc_set_phy_cfg_data cfg = { 0 };\n+\tstruct ice_aqc_get_phy_caps_data *pcaps;\n+\tstruct ice_port_info *pi;\n+\tenum ice_status status;\n+\n+\tif (!hw || !hw->port_info)\n+\t\treturn ICE_ERR_PARAM;\n+\n+\tpi = hw->port_info;\n+\n+\tpcaps = (struct ice_aqc_get_phy_caps_data *)\n+\t\tice_malloc(hw, sizeof(*pcaps));\n+\tif (!pcaps)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n+\tstatus = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_SW_CFG, pcaps,\n+\t\t\t\t NULL);\n+\tif (status)\n+\t\tgoto out;\n+\n+\t/* No change in link */\n+\tif (link_up == !!(pcaps->caps & ICE_AQC_PHY_EN_LINK) &&\n+\t link_up == !!(pi->phy.link_info.link_info & ICE_AQ_LINK_UP))\n+\t\tgoto out;\n+\n+\tcfg.phy_type_low = pcaps->phy_type_low;\n+\tcfg.phy_type_high = pcaps->phy_type_high;\n+\tcfg.caps = pcaps->caps | ICE_AQ_PHY_ENA_AUTO_LINK_UPDT;\n+\tcfg.low_power_ctrl = pcaps->low_power_ctrl;\n+\tcfg.eee_cap = pcaps->eee_cap;\n+\tcfg.eeer_value = pcaps->eeer_value;\n+\tcfg.link_fec_opt = pcaps->link_fec_options;\n+\tif (link_up)\n+\t\tcfg.caps |= ICE_AQ_PHY_ENA_LINK;\n+\telse\n+\t\tcfg.caps &= ~ICE_AQ_PHY_ENA_LINK;\n+\n+\tstatus = ice_aq_set_phy_cfg(hw, pi->lport, &cfg, NULL);\n+\n+out:\n+\tice_free(hw, pcaps);\n+\treturn status;\n+}\n+\n+static int\n+ice_dev_set_link_up(struct rte_eth_dev *dev)\n+{\n+\tstruct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\n+\treturn ice_force_phys_link_state(hw, true);\n+}\n+\n+static int\n+ice_dev_set_link_down(struct rte_eth_dev *dev)\n+{\n+\tstruct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\n+\treturn ice_force_phys_link_state(hw, false);\n+}\n+\n static int\n ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)\n {\n", "prefixes": [ "v2" ] }{ "id": 53235, "url": "