get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 745021,
    "url": "http://patchwork.ozlabs.org/api/patches/745021/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1490833375-2788-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": "<1490833375-2788-8-git-send-email-sridhar.samudrala@intel.com>",
    "list_archive_url": null,
    "date": "2017-03-30T00:22:55",
    "name": "[next-queue,v6,7/7] i40e: Add support to get switch id and port number for port netdevs",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "5ac370fb8c621840d17032a6ca45e64759457dca",
    "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-8-git-send-email-sridhar.samudrala@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/745021/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/745021/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 3vtlj40F8Yz9s77\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 30 Mar 2017 11:23:19 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 7CFBE2EEFB;\n\tThu, 30 Mar 2017 00:23:18 +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 8twOitiuq4BU; Thu, 30 Mar 2017 00:23:13 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 87DDE2FB0E;\n\tThu, 30 Mar 2017 00:23:03 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 60EB61CE8BC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:59 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5D50A8902A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:59 +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 zrYRFzxWB6bx for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:57 +0000 (UTC)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 63FEA89021\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:57 +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:56 -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=\"949601335\"",
        "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:55 -0700",
        "Message-Id": "<1490833375-2788-8-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 7/7] i40e: Add support to\n\tget switch id and port number for port 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 port netdevs to return the switch id via\nSWITCHDEV_ATTR_ID_PORT_PARENT_ID attribute.\nAlso, ndo_get_phys_port_name() support is added to port netdevs to return\nthe port number.\n\nPF: p4p1, VFs: p4p1_0,p4p1_1, VF port reps:p4p1-vf0, p4p1-vf1,\nPF port rep: p4p1-pf\n# rmmod i40e; modprobe i40e\n# devlink dev eswitch set pci/0000:42:00.0 mode switchdev\n# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs\n# ip -d l show p4p1\n27: p4p1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n    link/ether 3c:fd:fe:a3:18:f8 brd ff:ff:ff:ff:ff:ff promiscuity 0 numtxqueues 64 numrxqueues 64 gso_max_size 65536 gso_max_segs 65535 portid 3cfdfea318f8 switchid 3cfdfea318f8\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 p4p1-pf\n29: p4p1-pf: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n    link/ether 42:7a:b5:dc:85:11 brd ff:ff:ff:ff:ff:ff promiscuity 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 portname 65535 switchid 3cfdfea318f8\n# ip -d l show p4p1-vf0\n30: p4p1-vf0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n    link/ether 6e:ff:0b:5a:63:6d brd ff:ff:ff:ff:ff:ff promiscuity 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 portname 0 switchid 3cfdfea318f8\n# ip -d l show p4p1-vf1\n31: p4p1-vf1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n    link/ether 92:6e:ff:35:05:d5 brd ff:ff:ff:ff:ff:ff promiscuity 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 portname 1 switchid 3cfdfea318f8\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 | 97 +++++++++++++++++++++++++++++\n 2 files changed, 98 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 72e11b2..9eb2ba5 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 4f0eebc..85f214d 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -4862,6 +4862,32 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,\n \treturn 0;\n }\n \n+static int i40e_switchdev_pf_attr_get(struct net_device *dev,\n+\t\t\t\t      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_switchdev_pf_ops = {\n+\t.switchdev_port_attr_get\t= i40e_switchdev_pf_attr_get,\n+};\n+\n /**\n  * i40e_vsi_config_netdev_tc - Setup the netdev TC configuration\n  * @vsi: the VSI being configured\n@@ -9364,6 +9390,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)\n \tnetdev->netdev_ops = &i40e_netdev_ops;\n \tnetdev->watchdog_timeo = 5 * HZ;\n \ti40e_set_ethtool_ops(netdev);\n+#ifdef CONFIG_NET_SWITCHDEV\n+\tnetdev->switchdev_ops = &i40e_switchdev_pf_ops;\n+#endif\n \n \t/* MTU range: 68 - 9706 */\n \tnetdev->min_mtu = ETH_MIN_MTU;\n@@ -11111,6 +11140,32 @@ static int i40e_port_netdev_stop(struct net_device *dev)\n \treturn -EINVAL;\n }\n \n+static int\n+i40e_port_netdev_get_phys_port_name(struct net_device *dev, char *buf,\n+\t\t\t\t    size_t len)\n+{\n+\tstruct i40e_port_netdev_priv *priv = netdev_priv(dev);\n+\tstruct i40e_vf *vf;\n+\tint ret;\n+\n+\tswitch (priv->type) {\n+\tcase I40E_PORT_NETDEV_VF:\n+\t\tvf = (struct i40e_vf *)priv->f;\n+\t\tret = snprintf(buf, len, \"%d\", vf->vf_id);\n+\t\tbreak;\n+\tcase I40E_PORT_NETDEV_PF:\n+\t\tret = snprintf(buf, len, \"%d\", I40E_MAIN_VSI_PORT_ID);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\tif (ret >= len)\n+\t\treturn -EOPNOTSUPP;\n+\n+\treturn 0;\n+}\n+\n static const struct net_device_ops i40e_port_netdev_ops = {\n \t.ndo_open\t\t= i40e_port_netdev_open,\n \t.ndo_stop\t\t= i40e_port_netdev_stop,\n@@ -11118,6 +11173,44 @@ static int i40e_port_netdev_stop(struct net_device *dev)\n \t.ndo_get_stats64\t= i40e_port_netdev_get_stats64,\n \t.ndo_has_offload_stats\t= i40e_port_netdev_has_offload_stats,\n \t.ndo_get_offload_stats\t= i40e_port_netdev_get_offload_stats,\n+\t.ndo_get_phys_port_name\t= i40e_port_netdev_get_phys_port_name,\n+};\n+\n+static int i40e_switchdev_port_attr_get(struct net_device *dev,\n+\t\t\t\t\tstruct switchdev_attr *attr)\n+{\n+\tstruct i40e_port_netdev_priv *priv = netdev_priv(dev);\n+\tstruct i40e_vsi *vsi;\n+\tstruct i40e_pf *pf;\n+\tstruct i40e_vf *vf;\n+\n+\tswitch (priv->type) {\n+\tcase I40E_PORT_NETDEV_VF:\n+\t\tvf = (struct i40e_vf *)priv->f;\n+\t\tpf = vf->pf;\n+\t\tbreak;\n+\tcase I40E_PORT_NETDEV_PF:\n+\t\tpf = (struct i40e_pf *)priv->f;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\tvsi = pf->vsi[pf->lan_vsi];\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, vsi->netdev->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_switchdev_port_ops = {\n+\t.switchdev_port_attr_get\t= i40e_switchdev_port_attr_get,\n };\n \n /**\n@@ -11203,6 +11296,10 @@ int i40e_alloc_port_netdev(void *f, enum i40e_port_netdev_type type)\n \tport_netdev->netdev_ops = &i40e_port_netdev_ops;\n \teth_hw_addr_random(port_netdev);\n \n+#ifdef CONFIG_NET_SWITCHDEV\n+\tport_netdev->switchdev_ops = &i40e_switchdev_port_ops;\n+#endif\n+\n \tnetif_carrier_off(port_netdev);\n \tnetif_tx_stop_all_queues(port_netdev);\n \n",
    "prefixes": [
        "next-queue",
        "v6",
        "7/7"
    ]
}