Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/714687/?format=api
{ "id": 714687, "url": "http://patchwork.ozlabs.org/api/patches/714687/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1484260510-9162-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": "<1484260510-9162-2-git-send-email-sridhar.samudrala@intel.com>", "list_archive_url": null, "date": "2017-01-12T22:35:04", "name": "[next-queue,v4,1/7] i40e: Introduce devlink interface.", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "12f76b253389b72f145f8a1aef71aa579e600ba4", "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/1484260510-9162-2-git-send-email-sridhar.samudrala@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/714687/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/714687/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 3v00vc33vxz9t0G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 13 Jan 2017 09:35:24 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 7571F22EC0;\n\tThu, 12 Jan 2017 22:35:22 +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 VB-Qqq9fx-xw; Thu, 12 Jan 2017 22:35:18 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id D0F33268F4;\n\tThu, 12 Jan 2017 22:35:18 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id C2B8B1C001E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:17 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id BADE430215\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:17 +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 N1yH8pQkkUNy for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:16 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby silver.osuosl.org (Postfix) with ESMTPS id E00E0268F4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:15 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga101.fm.intel.com with ESMTP; 12 Jan 2017 14:35:15 -0800", "from sri-mi-02.jf.intel.com ([10.166.188.51])\n\tby FMSMGA003.fm.intel.com with ESMTP; 12 Jan 2017 14:35:15 -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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.33,220,1477983600\"; d=\"scan'208\";a=\"808217560\"", "From": "Sridhar Samudrala <sridhar.samudrala@intel.com>", "To": "alexander.h.duyck@intel.com, john.r.fastabend@intel.com,\n\tanjali.singhai@intel.com, jakub.kicinski@netronome.com,\n\tdavem@davemloft.net, scott.d.peterson@intel.com, gerlitz.or@gmail.com,\n\tjiri@resnulli.us, intel-wired-lan@lists.osuosl.org,\n\tnetdev@vger.kernel.org", "Date": "Thu, 12 Jan 2017 14:35:04 -0800", "Message-Id": "<1484260510-9162-2-git-send-email-sridhar.samudrala@intel.com>", "X-Mailer": "git-send-email 2.5.5", "In-Reply-To": "<1484260510-9162-1-git-send-email-sridhar.samudrala@intel.com>", "References": "<1484260510-9162-1-git-send-email-sridhar.samudrala@intel.com>", "Subject": "[Intel-wired-lan] [next-queue v4 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:05:00.0\npci/0000:05:00.0: mode legacy\n# devlink dev eswitch set pci/0000:05:00.0 mode switchdev\ndevlink answers: Operation not supported\n# devlink dev eswitch set pci/0000:05:00.0 mode legacy\n# devlink dev eswitch show pci/0000:05: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 | 80 ++++++++++++++++++++++++++---\n 3 files changed, 76 insertions(+), 8 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig\nindex 1349b45..0dbb87e 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 9b51026..331a1e0 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 #ifdef I40E_FCOE\n@@ -476,6 +478,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 b685b55..ac49f89 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -11294,6 +11294,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@@ -11310,6 +11361,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;\n@@ -11343,20 +11395,28 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tpci_enable_pcie_error_reporting(pdev);\n \tpci_set_master(pdev);\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_devlink_alloc;\n+\t}\n+\n \t/* Now that we have a PCI connection, we need to do the\n \t * low level device setup. This is primarily setting up\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-\t\terr = -ENOMEM;\n-\t\tgoto err_pf_alloc;\n-\t}\n+\tpf = devlink_priv(devlink);\n \tpf->next_vsi = 0;\n \tpf->pdev = pdev;\n \tset_bit(__I40E_DOWN, &pf->state);\n \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 \thw = &pf->hw;\n \thw->back = pf;\n \n@@ -11830,8 +11890,10 @@ 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_unregister(devlink);\n+err_devlink_register:\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@@ -11853,6 +11915,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@@ -11941,7 +12004,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", "v4", "1/7" ] }