get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 714690,
    "url": "http://patchwork.ozlabs.org/api/patches/714690/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1484260510-9162-8-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-8-git-send-email-sridhar.samudrala@intel.com>",
    "list_archive_url": null,
    "date": "2017-01-12T22:35:10",
    "name": "[next-queue,v4,7/7] i40e: Add support to get switch id and port number for VFPR netdevs",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ef35070a79bcde82c80c3d71ecb0146c34d98232",
    "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-8-git-send-email-sridhar.samudrala@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/714690/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/714690/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 3v00vn4GVtz9t0G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 13 Jan 2017 09:35:33 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id B768E2DEF9;\n\tThu, 12 Jan 2017 22:35:31 +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 9lT-72-gDKdB; Thu, 12 Jan 2017 22:35:29 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id ECD33308A6;\n\tThu, 12 Jan 2017 22:35:27 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 514A41C001E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:19 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 4890030892\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:19 +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 7wUG+vuwtlqO for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:17 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 3767A2E134\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Jan 2017 22:35:17 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga101.fm.intel.com with ESMTP; 12 Jan 2017 14:35:17 -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:16 -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=\"808217586\"",
        "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:10 -0800",
        "Message-Id": "<1484260510-9162-8-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 7/7] i40e: Add support to\n\tget switch id and port number for VFPR netdevs",
        "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": "Introduce switchdev_ops to PF and VFPR netdevs to return the switch id\nvia SWITCHDEV_ATTR_ID_PORT_PARENT_ID attribute.\nAlso, ndo_get_phys_port_name() support is added to VFPR netdevs to\nreturn the port number.\n\nPF: enp5s0f0, VFs: enp5s2,enp5s2f1 VFPRs:enp5s0f0-vf0, enp5s0f0-vf1\n# rmmod i40e; modprobe i40e\n# devlink dev eswitch set pci/0000:05:00.0 mode switchdev\n# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs\n# ip -d l show enp5s0f0\n32: enp5s0f0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n    link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 numtxqueues 72 numrxqueues 72 gso_max_size 65536 gso_max_segs 65535 portid 6805ca2e7268 switchid 6805ca2e7268\n    vf 0 MAC 00:00:00:00:00:00, spoof checking on, link-state disable, trust off\n    vf 1 MAC 00:00:00:00:00:00, spoof checking on, link-state disable, trust off\n# ip -d l show enp5s0f0-vf0\n34: enp5s0f0-vf0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n    link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 portname 0 switchid 6805ca2e7268\n# ip -d l show enp5s0f0-vf1\n35: enp5s0f0-vf1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n    link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 portname 1 switchid 6805ca2e7268\n\nSigned-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h             |  1 +\n drivers/net/ethernet/intel/i40e/i40e_main.c        | 28 +++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 40 ++++++++++++++++++++++\n 3 files changed, 69 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 95cfe46..61720d6 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -56,6 +56,7 @@\n #include <linux/ptp_clock_kernel.h>\n #include <net/devlink.h>\n #include <net/dst_metadata.h>\n+#include <net/switchdev.h>\n \n #include \"i40e_type.h\"\n #include \"i40e_prototype.h\"\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 9212656..cd55665 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -9650,6 +9650,31 @@ static const struct net_device_ops i40e_netdev_ops = {\n \t.ndo_xdp                = i40e_xdp,\n };\n \n+static int i40e_pf_attr_get(struct net_device *dev, struct switchdev_attr *attr)\n+{\n+\tstruct i40e_netdev_priv *np = netdev_priv(dev);\n+\tstruct i40e_vsi *vsi = np->vsi;\n+\tstruct i40e_pf *pf = vsi->back;\n+\n+\tif (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tswitch (attr->id) {\n+\tcase SWITCHDEV_ATTR_ID_PORT_PARENT_ID:\n+\t\tattr->u.ppid.id_len = ETH_ALEN;\n+\t\tether_addr_copy(attr->u.ppid.id, dev->dev_addr);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static const struct switchdev_ops i40e_pf_switchdev_ops = {\n+\t.switchdev_port_attr_get        = i40e_pf_attr_get,\n+};\n+\n /**\n  * i40e_config_netdev - Setup the netdev flags\n  * @vsi: the VSI being configured\n@@ -9769,6 +9794,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)\n #ifdef I40E_FCOE\n \ti40e_fcoe_config_netdev(netdev, vsi);\n #endif\n+#ifdef CONFIG_NET_SWITCHDEV\n+\tnetdev->switchdev_ops = &i40e_pf_switchdev_ops;\n+#endif\n \n \t/* MTU range: 68 - 9706 */\n \tnetdev->min_mtu = ETH_MIN_MTU;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 1af8472..465154f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -1154,6 +1154,22 @@ i40e_vfpr_netdev_get_offload_stats(int attr_id, const struct net_device *dev,\n \treturn -EINVAL;\n }\n \n+static int\n+i40e_vfpr_netdev_get_phys_port_name(struct net_device *dev, char *buf,\n+\t\t\t\t    size_t len)\n+{\n+\tstruct i40e_vfpr_netdev_priv *priv = netdev_priv(dev);\n+\tstruct i40e_vf *vf = priv->vf;\n+\n+\tint ret;\n+\n+\tret = snprintf(buf, len, \"%d\", vf->vf_id);\n+\tif (ret >= len)\n+\t\treturn -EOPNOTSUPP;\n+\n+\treturn 0;\n+}\n+\n static const struct net_device_ops i40e_vfpr_netdev_ops = {\n \t.ndo_open\t\t= i40e_vfpr_netdev_open,\n \t.ndo_stop\t\t= i40e_vfpr_netdev_stop,\n@@ -1161,6 +1177,26 @@ static const struct net_device_ops i40e_vfpr_netdev_ops = {\n \t.ndo_get_stats64        = i40e_vfpr_netdev_get_stats64,\n \t.ndo_has_offload_stats  = i40e_vfpr_netdev_has_offload_stats,\n \t.ndo_get_offload_stats  = i40e_vfpr_netdev_get_offload_stats,\n+\t.ndo_get_phys_port_name\t= i40e_vfpr_netdev_get_phys_port_name,\n+};\n+\n+static int i40e_vfpr_attr_get(struct net_device *dev,\n+\t\t\t      struct switchdev_attr *attr)\n+{\n+\tswitch (attr->id) {\n+\tcase SWITCHDEV_ATTR_ID_PORT_PARENT_ID:\n+\t\tattr->u.ppid.id_len = ETH_ALEN;\n+\t\tether_addr_copy(attr->u.ppid.id, dev->dev_addr);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static const struct switchdev_ops i40e_vfpr_switchdev_ops = {\n+\t.switchdev_port_attr_get        = i40e_vfpr_attr_get,\n };\n \n /**\n@@ -1235,6 +1271,10 @@ int i40e_alloc_vfpr_netdev(struct i40e_vf *vf, u16 vf_num)\n \tvfpr_netdev->netdev_ops = &i40e_vfpr_netdev_ops;\n \teth_hw_addr_inherit(vfpr_netdev, vsi->netdev);\n \n+#ifdef CONFIG_NET_SWITCHDEV\n+\tvfpr_netdev->switchdev_ops = &i40e_vfpr_switchdev_ops;\n+#endif\n+\n \tnetif_carrier_off(vfpr_netdev);\n \tnetif_tx_disable(vfpr_netdev);\n \n",
    "prefixes": [
        "next-queue",
        "v4",
        "7/7"
    ]
}