Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/745012/?format=api
{ "id": 745012, "url": "http://patchwork.ozlabs.org/api/patches/745012/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1490833375-2788-2-git-send-email-sridhar.samudrala@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": "<1490833375-2788-2-git-send-email-sridhar.samudrala@intel.com>", "list_archive_url": null, "date": "2017-03-30T00:22:49", "name": "[next-queue,v6,1/7] i40e: Introduce devlink interface", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "09a54af6651270e87dc6d6b223d9e4606c568578", "submitter": { "id": 65219, "url": "http://patchwork.ozlabs.org/api/people/65219/?format=api", "name": "Samudrala, Sridhar", "email": "sridhar.samudrala@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/1490833375-2788-2-git-send-email-sridhar.samudrala@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/745012/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/745012/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 3vtlhm5rgWz9s79\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 30 Mar 2017 11:23:04 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id E2B532F9DC;\n\tThu, 30 Mar 2017 00:23:02 +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 oal8ewbpTeZh; Thu, 30 Mar 2017 00:22:59 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 969732E223;\n\tThu, 30 Mar 2017 00:22:59 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6ADEA1CE8BC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:57 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 4F4D489046\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:57 +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 P3yCqEEQ85sg for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:56 +0000 (UTC)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 8F80E89021\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:56 +0000 (UTC)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga105.jf.intel.com with ESMTP; 29 Mar 2017 17:22:56 -0700", "from arch-p28.jf.intel.com ([10.166.187.27])\n\tby orsmga003.jf.intel.com with ESMTP; 29 Mar 2017 17:22:55 -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.36,244,1486454400\"; d=\"scan'208\";a=\"949601315\"", "From": "Sridhar Samudrala <sridhar.samudrala@intel.com>", "To": "intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,\n\talexander.h.duyck@intel.com, anjali.singhai@intel.com,\n\tjakub.kicinski@netronome.com, gerlitz.or@gmail.com, jiri@resnulli.us, \n\tsridhar.samudrala@intel.com", "Date": "Wed, 29 Mar 2017 17:22:49 -0700", "Message-Id": "<1490833375-2788-2-git-send-email-sridhar.samudrala@intel.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1490833375-2788-1-git-send-email-sridhar.samudrala@intel.com>", "References": "<1490833375-2788-1-git-send-email-sridhar.samudrala@intel.com>", "Subject": "[Intel-wired-lan] [next-queue v6 PATCH 1/7] i40e: Introduce devlink\n\tinterface", "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": "Add initial devlink support to get/set the mode of SRIOV switch.\nThis patch sets the default mode as 'legacy' and enables getting the mode\nand and setting it to 'legacy'.\n\nThe switch mode can be get/set via following 'devlink' commands.\n\n# devlink dev eswitch show pci/0000:42:00.0\npci/0000:42:00.0: mode legacy\n# devlink dev eswitch set pci/0000:42:00.0 mode switchdev\ndevlink answers: Operation not supported\n# devlink dev eswitch set pci/0000:42:00.0 mode legacy\n# devlink dev eswitch show pci/0000:42:00.0\npci/0000:05:00.0: mode legacy\n\nSigned-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>\n---\n drivers/net/ethernet/intel/Kconfig | 1 +\n drivers/net/ethernet/intel/i40e/i40e.h | 3 ++\n drivers/net/ethernet/intel/i40e/i40e_main.c | 77 ++++++++++++++++++++++++++---\n 3 files changed, 75 insertions(+), 6 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig\nindex 1542a21..ababcae 100644\n--- a/drivers/net/ethernet/intel/Kconfig\n+++ b/drivers/net/ethernet/intel/Kconfig\n@@ -215,6 +215,7 @@ config I40E\n \ttristate \"Intel(R) Ethernet Controller XL710 Family support\"\n \timply PTP_1588_CLOCK\n \tdepends on PCI\n+\tdepends on MAY_USE_DEVLINK\n \t---help---\n \t This driver supports Intel(R) Ethernet Controller XL710 Family of\n \t devices. For more information on how to identify your adapter, go\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 421ea57..f788125c 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -54,6 +54,8 @@\n #include <linux/clocksource.h>\n #include <linux/net_tstamp.h>\n #include <linux/ptp_clock_kernel.h>\n+#include <net/devlink.h>\n+\n #include \"i40e_type.h\"\n #include \"i40e_prototype.h\"\n #include \"i40e_client.h\"\n@@ -517,6 +519,7 @@ struct i40e_pf {\n \tu32 ioremap_len;\n \tu32 fd_inv;\n \tu16 phy_led_val;\n+\tenum devlink_eswitch_mode eswitch_mode;\n };\n \n /**\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 1a4643c..afcf14d 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -10823,6 +10823,57 @@ static void i40e_get_platform_mac_addr(struct pci_dev *pdev, struct i40e_pf *pf)\n }\n \n /**\n+ * i40e_devlink_eswitch_mode_get\n+ *\n+ * @devlink: pointer to devlink struct\n+ * @mode: sr-iov switch mode pointer\n+ *\n+ * Returns the switch mode of the associated PF in the @mode pointer.\n+ */\n+static int i40e_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode)\n+{\n+\tstruct i40e_pf *pf = devlink_priv(devlink);\n+\n+\t*mode = pf->eswitch_mode;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * i40e_devlink_eswitch_mode_set\n+ *\n+ * @devlink: pointer to devlink struct\n+ * @mode: sr-iov switch mode\n+ *\n+ * Set the switch mode of the associated PF.\n+ * Returns 0 on success and -EOPNOTSUPP on error.\n+ */\n+static int i40e_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode)\n+{\n+\tstruct i40e_pf *pf = devlink_priv(devlink);\n+\tint err = 0;\n+\n+\tif (mode == pf->eswitch_mode)\n+\t\tgoto done;\n+\n+\tswitch (mode) {\n+\tcase DEVLINK_ESWITCH_MODE_LEGACY:\n+\t\tpf->eswitch_mode = mode;\n+\t\tbreak;\n+\tdefault:\n+\t\terr = -EOPNOTSUPP;\n+\t\tbreak;\n+\t}\n+done:\n+\treturn err;\n+}\n+\n+static const struct devlink_ops i40e_devlink_ops = {\n+\t.eswitch_mode_get = i40e_devlink_eswitch_mode_get,\n+\t.eswitch_mode_set = i40e_devlink_eswitch_mode_set,\n+};\n+\n+/**\n * i40e_probe - Device initialization routine\n * @pdev: PCI device information struct\n * @ent: entry in i40e_pci_tbl\n@@ -10839,6 +10890,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tstruct i40e_pf *pf;\n \tstruct i40e_hw *hw;\n \tstatic u16 pfs_found;\n+\tstruct devlink *devlink;\n \tu16 wol_nvm_bits;\n \tu16 link_status;\n \tint err, globr_probe = 1;\n@@ -10877,11 +10929,15 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t * the Admin Queue structures and then querying for the\n \t * device's current profile information.\n \t */\n-\tpf = kzalloc(sizeof(*pf), GFP_KERNEL);\n-\tif (!pf) {\n+\n+\tdevlink = devlink_alloc(&i40e_devlink_ops, sizeof(*pf));\n+\tif (!devlink) {\n+\t\tdev_err(&pdev->dev, \"devlink_alloc failed\\n\");\n \t\terr = -ENOMEM;\n-\t\tgoto err_pf_alloc;\n+\t\tgoto err_devlink_alloc;\n \t}\n+\n+\tpf = devlink_priv(devlink);\n \tpf->next_vsi = 0;\n \tpf->pdev = pdev;\n \tset_bit(__I40E_DOWN, &pf->state);\n@@ -11080,6 +11136,11 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tdevice_set_wakeup_enable(&pf->pdev->dev, pf->wol_en);\n \n \t/* set up the main switch operations */\n+\tpf->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY;\n+\terr = devlink_register(devlink, &pdev->dev);\n+\tif (err)\n+\t\tgoto err_devlink_register;\n+\n \ti40e_determine_queue_usage(pf);\n \terr = i40e_init_interrupt_scheme(pf);\n \tif (err)\n@@ -11339,6 +11400,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n err_switch_setup:\n \ti40e_reset_interrupt_capability(pf);\n \tdel_timer_sync(&pf->service_timer);\n+\tdevlink_unregister(devlink);\n+err_devlink_register:\n err_mac_addr:\n err_configure_lan_hmc:\n \t(void)i40e_shutdown_lan_hmc(hw);\n@@ -11349,8 +11412,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n err_pf_reset:\n \tiounmap(hw->hw_addr);\n err_ioremap:\n-\tkfree(pf);\n-err_pf_alloc:\n+\tdevlink_free(devlink);\n+err_devlink_alloc:\n \tpci_disable_pcie_error_reporting(pdev);\n \tpci_release_mem_regions(pdev);\n err_pci_reg:\n@@ -11372,6 +11435,7 @@ static void i40e_remove(struct pci_dev *pdev)\n {\n \tstruct i40e_pf *pf = pci_get_drvdata(pdev);\n \tstruct i40e_hw *hw = &pf->hw;\n+\tstruct devlink *devlink = priv_to_devlink(pf);\n \ti40e_status ret_code;\n \tint i;\n \n@@ -11458,7 +11522,8 @@ static void i40e_remove(struct pci_dev *pdev)\n \tkfree(pf->vsi);\n \n \tiounmap(hw->hw_addr);\n-\tkfree(pf);\n+\tdevlink_unregister(devlink);\n+\tdevlink_free(devlink);\n \tpci_release_mem_regions(pdev);\n \n \tpci_disable_pcie_error_reporting(pdev);\n", "prefixes": [ "next-queue", "v6", "1/7" ] }