get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 832978,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/832978/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20171101143959.14992-1-desnesn@linux.vnet.ibm.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20171101143959.14992-1-desnesn@linux.vnet.ibm.com>",
    "list_archive_url": null,
    "date": "2017-11-01T14:39:59",
    "name": "[FEAT] ibmvnic: Feature implementation of Vital Product Data (VPD) for the ibmvnic driver",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "7caef940531e8dedeb670c24369a2139f780a528",
    "submitter": {
        "id": 72712,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/72712/?format=api",
        "name": "Desnes A. Nunes do Rosario",
        "email": "desnesn@linux.vnet.ibm.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20171101143959.14992-1-desnesn@linux.vnet.ibm.com/mbox/",
    "series": [
        {
            "id": 11338,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/11338/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=11338",
            "date": "2017-11-01T14:39:59",
            "name": "[FEAT] ibmvnic: Feature implementation of Vital Product Data (VPD) for the ibmvnic driver",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/11338/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/832978/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/832978/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yRrY000dRz9sNV\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu,  2 Nov 2017 01:42:43 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933038AbdKAOml (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 1 Nov 2017 10:42:41 -0400",
            "from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53334 \"EHLO\n\tmx0a-001b2d01.pphosted.com\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S932796AbdKAOmj (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 1 Nov 2017 10:42:39 -0400",
            "from pps.filterd (m0098399.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tvA1EfKsh102185\n\tfor <netdev@vger.kernel.org>; Wed, 1 Nov 2017 10:42:38 -0400",
            "from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2dye04r3bu-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <netdev@vger.kernel.org>; Wed, 01 Nov 2017 10:42:37 -0400",
            "from localhost\n\tby e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <netdev@vger.kernel.org> from <desnesn@linux.vnet.ibm.com>;\n\tWed, 1 Nov 2017 08:42:36 -0600",
            "from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16)\n\tby e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tWed, 1 Nov 2017 08:42:34 -0600",
            "from b03ledav005.gho.boulder.ibm.com\n\t(b03ledav005.gho.boulder.ibm.com [9.17.130.236])\n\tby b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id vA1EgXvV10093036; Wed, 1 Nov 2017 07:42:33 -0700",
            "from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 98694BE042;\n\tWed,  1 Nov 2017 08:42:33 -0600 (MDT)",
            "from ibm.ibmmodules.com (unknown [9.85.139.126])\n\tby b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id C8FB1BE039;\n\tWed,  1 Nov 2017 08:42:31 -0600 (MDT)"
        ],
        "From": "Desnes Augusto Nunes do Rosario <desnesn@linux.vnet.ibm.com>",
        "To": "netdev@vger.kernel.org",
        "Cc": "linuxppc-dev@lists.ozlabs.org, tlfalcon@linux.vnet.ibm.com,\n\tnfont@linux.vnet.ibm.com, jallen@linux.vnet.ibm.com",
        "Subject": "[PATCH FEAT] ibmvnic: Feature implementation of Vital Product Data\n\t(VPD) for the ibmvnic driver",
        "Date": "Wed,  1 Nov 2017 12:39:59 -0200",
        "X-Mailer": "git-send-email 2.9.5",
        "X-TM-AS-GCONF": "00",
        "x-cbid": "17110114-0004-0000-0000-00001325BA47",
        "X-IBM-SpamModules-Scores": "",
        "X-IBM-SpamModules-Versions": "BY=3.00007992; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000239; SDB=6.00939622; UDB=6.00473741;\n\tIPR=6.00719883; \n\tBA=6.00005666; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017822;\n\tXFM=3.00000015; UTC=2017-11-01 14:42:35",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "17110114-0005-0000-0000-000084B382CA",
        "Message-Id": "<20171101143959.14992-1-desnesn@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-11-01_03:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tpriorityscore=1501\n\tmalwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0\n\tclxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0\n\tclassifier=spam adjust=0 reason=mlx scancount=1\n\tengine=8.0.1-1707230000\n\tdefinitions=main-1711010204",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "This patch implements and enables VDP support for the ibmvnic driver. Moreover, it includes the implementation of suitable structs, signal transmission/handling and fuctions which allows the retrival of firmware information from the ibmvnic card.\n\nCo-Authored-By: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>\n---\n drivers/net/ethernet/ibm/ibmvnic.c | 140 ++++++++++++++++++++++++++++++++++++-\n drivers/net/ethernet/ibm/ibmvnic.h |  27 ++++++-\n 2 files changed, 164 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c\nindex d0cff28..120f3c0 100644\n--- a/drivers/net/ethernet/ibm/ibmvnic.c\n+++ b/drivers/net/ethernet/ibm/ibmvnic.c\n@@ -107,6 +107,9 @@ static union sub_crq *ibmvnic_next_scrq(struct ibmvnic_adapter *,\n \t\t\t\t\tstruct ibmvnic_sub_crq_queue *);\n static int ibmvnic_poll(struct napi_struct *napi, int data);\n static void send_map_query(struct ibmvnic_adapter *adapter);\n+static int ibmvnic_get_vpd(struct ibmvnic_adapter *);\n+static void handle_vpd_size_rsp(union ibmvnic_crq *, struct ibmvnic_adapter *);\n+static void handle_vpd_rsp(union ibmvnic_crq *,struct ibmvnic_adapter *);\n static void send_request_map(struct ibmvnic_adapter *, dma_addr_t, __be32, u8);\n static void send_request_unmap(struct ibmvnic_adapter *, u8);\n static void send_login(struct ibmvnic_adapter *adapter);\n@@ -573,6 +576,15 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter)\n \treturn 0;\n }\n \n+static void release_vpd_data(struct ibmvnic_adapter *adapter)\n+{\n+\tif(!adapter->vpd)\n+\t\treturn;\n+\n+\tkfree(adapter->vpd->buff);\n+\tkfree(adapter->vpd);\n+}\n+\n static void release_tx_pools(struct ibmvnic_adapter *adapter)\n {\n \tstruct ibmvnic_tx_pool *tx_pool;\n@@ -753,6 +765,8 @@ static void release_resources(struct ibmvnic_adapter *adapter)\n {\n \tint i;\n \n+\trelease_vpd_data(adapter);\n+\n \trelease_tx_pools(adapter);\n \trelease_rx_pools(adapter);\n \n@@ -850,6 +864,10 @@ static int init_resources(struct ibmvnic_adapter *adapter)\n \tif (rc)\n \t\treturn rc;\n \n+\tadapter->vpd = kzalloc(sizeof(struct ibmvnic_vpd), GFP_KERNEL);\n+\tif (!adapter->vpd)\n+\t\treturn -ENOMEM;\n+\n \tadapter->map_id = 1;\n \tadapter->napi = kcalloc(adapter->req_rx_queues,\n \t\t\t\tsizeof(struct napi_struct), GFP_KERNEL);\n@@ -950,6 +968,10 @@ static int ibmvnic_open(struct net_device *netdev)\n \n \trc = __ibmvnic_open(netdev);\n \tnetif_carrier_on(netdev);\n+\n+\t/* Vital Product Data (VPD) */\n+\tibmvnic_get_vpd(adapter);\n+\n \tmutex_unlock(&adapter->reset_lock);\n \n \treturn rc;\n@@ -1878,11 +1900,15 @@ static int ibmvnic_get_link_ksettings(struct net_device *netdev,\n \treturn 0;\n }\n \n-static void ibmvnic_get_drvinfo(struct net_device *dev,\n+static void ibmvnic_get_drvinfo(struct net_device *netdev,\n \t\t\t\tstruct ethtool_drvinfo *info)\n {\n+\tstruct ibmvnic_adapter *adapter = netdev_priv(netdev);\n+\n \tstrlcpy(info->driver, ibmvnic_driver_name, sizeof(info->driver));\n \tstrlcpy(info->version, IBMVNIC_DRIVER_VERSION, sizeof(info->version));\n+\tstrlcpy(info->fw_version, adapter->fw_version,\n+\t\tsizeof(info->fw_version));\n }\n \n static u32 ibmvnic_get_msglevel(struct net_device *netdev)\n@@ -2923,6 +2947,110 @@ static void send_login(struct ibmvnic_adapter *adapter)\n \treturn;\n }\n \n+static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter)\n+{\n+\tstruct device *dev = &adapter->vdev->dev;\n+\tunion ibmvnic_crq crq;\n+\tdma_addr_t dma_addr;\n+\tint len;\n+\n+\tif (adapter->vpd->buff)\n+\t\tlen = adapter->vpd->len;\n+\n+\treinit_completion(&adapter->fw_done);\n+\tcrq.get_vpd_size.first = IBMVNIC_CRQ_CMD;\n+\tcrq.get_vpd_size.cmd = GET_VPD_SIZE;\n+\tibmvnic_send_crq(adapter, &crq);\n+\twait_for_completion(&adapter->fw_done);\n+\n+\tif (!adapter->vpd->buff)\n+\t\tadapter->vpd->buff = kzalloc(adapter->vpd->len, GFP_KERNEL);\n+\telse if (adapter->vpd->len != len)\n+\t\tadapter->vpd->buff =\n+\t\t\tkrealloc(adapter->vpd->buff,\n+\t\t\t\t adapter->vpd->len, GFP_KERNEL);\n+\n+\tif (!adapter->vpd->buff) {\n+\t\tdev_err(dev, \"Could allocate VPD buffer\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tadapter->vpd->dma_addr =\n+\t\tdma_map_single(dev, adapter->vpd->buff, adapter->vpd->len,\n+\t\t\t       DMA_FROM_DEVICE);\n+\tif (dma_mapping_error(dev, dma_addr)) {\n+\t\tdev_err(dev, \"Could not map VPD buffer\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\treinit_completion(&adapter->fw_done);\n+\tcrq.get_vpd.first = IBMVNIC_CRQ_CMD;\n+\tcrq.get_vpd.cmd = GET_VPD;\n+\tcrq.get_vpd.ioba = cpu_to_be32(adapter->vpd->dma_addr);\n+\tcrq.get_vpd.len = cpu_to_be32((u32)adapter->vpd->len);\n+\tibmvnic_send_crq(adapter, &crq);\n+\twait_for_completion(&adapter->fw_done);\n+\n+\treturn 0;\n+}\n+\n+static void handle_vpd_size_rsp(union ibmvnic_crq *crq,\n+\t\t\t\t   struct ibmvnic_adapter *adapter)\n+{\n+\tstruct device *dev = &adapter->vdev->dev;\n+\n+\tif (crq->get_vpd_size_rsp.rc.code) {\n+\t\tdev_err(dev, \"Error retrieving VPD size, rc=%x\\n\",\n+\t\t\tcrq->get_vpd_size_rsp.rc.code);\n+\t\tcomplete(&adapter->fw_done);\n+\t\treturn;\n+\t}\n+\n+\tadapter->vpd->len = be64_to_cpu(crq->get_vpd_size_rsp.len);\n+\tcomplete(&adapter->fw_done);\n+}\n+\n+static void handle_vpd_rsp(union ibmvnic_crq *crq,\n+\t\t\t      struct ibmvnic_adapter *adapter)\n+{\n+\tstruct device *dev = &adapter->vdev->dev;\n+\tchar *substr = NULL, *ptr = NULL;\n+\tu8 fw_level_len = 0;\n+\n+\tdma_unmap_single(dev, adapter->vpd->dma_addr, adapter->vpd->len,\n+\t\t\t DMA_FROM_DEVICE);\n+\n+\tif (crq->get_vpd_rsp.rc.code) {\n+\t\tdev_err(dev, \"Error retrieving VPD, rc=%x\\n\",\n+\t\t\tcrq->get_vpd_rsp.rc.code);\n+\t\tcomplete(&adapter->fw_done);\n+\t\treturn;\n+\t}\n+\n+\t/* get the position of the firmware version info\n+\t * located after the ASCII 'RM' substring in the buffer\n+\t */\n+\tsubstr = strnstr(adapter->vpd->buff, \"RM\", adapter->vpd->len);\n+\tif (substr == NULL) {\n+\t\tdev_info(dev, \"No FW level provided by VPD\\n\");\n+\t\tcomplete(&adapter->fw_done);\n+\t\treturn;\n+\t}\n+\n+\t/* get length of firmware level ASCII substring */\n+\tfw_level_len = *(substr + 2);\n+\n+\t/* copy firmware version string from vpd into adapter */\n+\tptr = strncpy((char *)adapter->fw_version,\n+\t\t\t  substr + 3, fw_level_len);\n+\tif (!ptr) {\n+\t\tdev_err(dev, \"Failed to isolate FW level string\\n\");\n+\t\tmemset(adapter->fw_version, 0, 32);\n+\t}\n+\n+\tcomplete(&adapter->fw_done);\n+}\n+\n static void send_request_map(struct ibmvnic_adapter *adapter, dma_addr_t addr,\n \t\t\t     u32 len, u8 map_id)\n {\n@@ -3807,6 +3939,12 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,\n \t\tnetdev_dbg(netdev, \"Got Collect firmware trace Response\\n\");\n \t\tcomplete(&adapter->fw_done);\n \t\tbreak;\n+\tcase GET_VPD_SIZE_RSP:\n+\t\thandle_vpd_size_rsp(crq, adapter);\n+\t\tbreak;\n+\tcase GET_VPD_RSP:\n+\t\thandle_vpd_rsp(crq, adapter);\n+\t\tbreak;\n \tdefault:\n \t\tnetdev_err(netdev, \"Got an invalid cmd type 0x%02x\\n\",\n \t\t\t   gen_crq->cmd);\ndiff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h\nindex 4670af8..d3a6959 100644\n--- a/drivers/net/ethernet/ibm/ibmvnic.h\n+++ b/drivers/net/ethernet/ibm/ibmvnic.h\n@@ -558,6 +558,12 @@ struct ibmvnic_multicast_ctrl {\n \tstruct ibmvnic_rc rc;\n } __packed __aligned(8);\n \n+struct ibmvnic_get_vpd_size {\n+\tu8 first;\n+\tu8 cmd;\n+\tu8 reserved[14];\n+} __packed __aligned(8);\n+\n struct ibmvnic_get_vpd_size_rsp {\n \tu8 first;\n \tu8 cmd;\n@@ -575,6 +581,13 @@ struct ibmvnic_get_vpd {\n \tu8 reserved[4];\n } __packed __aligned(8);\n \n+struct ibmvnic_get_vpd_rsp {\n+\tu8 first;\n+\tu8 cmd;\n+\tu8 reserved[10];\n+\tstruct ibmvnic_rc rc;\n+} __packed __aligned(8);\n+\n struct ibmvnic_acl_change_indication {\n \tu8 first;\n \tu8 cmd;\n@@ -700,10 +713,10 @@ union ibmvnic_crq {\n \tstruct ibmvnic_change_mac_addr change_mac_addr_rsp;\n \tstruct ibmvnic_multicast_ctrl multicast_ctrl;\n \tstruct ibmvnic_multicast_ctrl multicast_ctrl_rsp;\n-\tstruct ibmvnic_generic_crq get_vpd_size;\n+\tstruct ibmvnic_get_vpd_size get_vpd_size;\n \tstruct ibmvnic_get_vpd_size_rsp get_vpd_size_rsp;\n \tstruct ibmvnic_get_vpd get_vpd;\n-\tstruct ibmvnic_generic_crq get_vpd_rsp;\n+\tstruct ibmvnic_get_vpd_rsp get_vpd_rsp;\n \tstruct ibmvnic_acl_change_indication acl_change_indication;\n \tstruct ibmvnic_acl_query acl_query;\n \tstruct ibmvnic_generic_crq acl_query_rsp;\n@@ -937,6 +950,12 @@ struct ibmvnic_error_buff {\n \t__be32 error_id;\n };\n \n+struct ibmvnic_vpd {\n+\tunsigned char *buff;\n+\tdma_addr_t dma_addr;\n+\tu64 len;\n+};\n+\n enum vnic_state {VNIC_PROBING = 1,\n \t\t VNIC_PROBED,\n \t\t VNIC_OPENING,\n@@ -978,6 +997,10 @@ struct ibmvnic_adapter {\n \tdma_addr_t ip_offload_ctrl_tok;\n \tu32 msg_enable;\n \n+\t/* Vital Product Data (VPD) */\n+\tstruct ibmvnic_vpd *vpd;\n+\tchar fw_version[32];\n+\n \t/* Statistics */\n \tstruct ibmvnic_statistics stats;\n \tdma_addr_t stats_token;\n",
    "prefixes": [
        "FEAT"
    ]
}