get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 717936,
    "url": "http://patchwork.ozlabs.org/api/patches/717936/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170120221156.7616.66811.stgit@localhost6.localdomain6/",
    "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": "<20170120221156.7616.66811.stgit@localhost6.localdomain6>",
    "list_archive_url": null,
    "date": "2017-01-20T22:11:56",
    "name": "[3/3] ixgbe: do not use adapter->num_vfs when setting VFs via module parameter",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d82269656d1e03f90fdd3b561646a6e70622dab7",
    "submitter": {
        "id": 1670,
        "url": "http://patchwork.ozlabs.org/api/people/1670/?format=api",
        "name": "Tantilov, Emil S",
        "email": "emil.s.tantilov@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/20170120221156.7616.66811.stgit@localhost6.localdomain6/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/717936/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/717936/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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3v4wB43m2fz9t1P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 21 Jan 2017 09:19:56 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id D47B386A52;\n\tFri, 20 Jan 2017 22:19:54 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rJw4rm-s9qyp; Fri, 20 Jan 2017 22:19:53 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id F09F986A51;\n\tFri, 20 Jan 2017 22:19:52 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id F36DA1BFEC6\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:51 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id EDDE12DB59\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:51 +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 2U38oa7M1XIP for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:50 +0000 (UTC)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 565C52A182\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:50 +0000 (UTC)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga104.jf.intel.com with ESMTP; 20 Jan 2017 14:19:50 -0800",
            "from estantil-desk3.jf.intel.com (HELO localhost6.localdomain6)\n\t([134.134.3.64])\n\tby orsmga002.jf.intel.com with ESMTP; 20 Jan 2017 14:19:49 -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,260,1477983600\"; d=\"scan'208\";a=\"33366245\"",
        "From": "Emil Tantilov <emil.s.tantilov@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 20 Jan 2017 14:11:56 -0800",
        "Message-ID": "<20170120221156.7616.66811.stgit@localhost6.localdomain6>",
        "In-Reply-To": "<20170120221145.7616.93906.stgit@localhost6.localdomain6>",
        "References": "<20170120221145.7616.93906.stgit@localhost6.localdomain6>",
        "User-Agent": "StGit/0.17.1-17-ge4e0",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH 3/3] ixgbe: do not use adapter->num_vfs\n\twhen setting VFs via module parameter",
        "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>",
        "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": "Avoid setting adapter->num_vfs early in the init code path when\nusing the max_vfs module parameter by passing it to ixgbe_enable_sriov()\nas a function parameter.\n\nThis fixes an issue where if we failed to allocate vfinfo in\n__ixgbe_enable_sriov() the driver will crash with NULL pointer in\nixgbe_disable_sriov() when attempting to free the vfinfo struct based\non adapter->num_vfs. Also it cleans up the assignment of adapter->num_vfs\nsince now it will only be set in __ixgbe_enable_sriov() and cleared in\nixgbe_disable_sriov().\n\nSigned-off-by: Emil Tantilov <emil.s.tantilov@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |    6 +--\n drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |   50 ++++++++++++------------\n drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h |    2 -\n 3 files changed, 28 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex 657fc70..e4c4b34 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -5989,10 +5989,8 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,\n \t/* assign number of SR-IOV VFs */\n \tif (hw->mac.type != ixgbe_mac_82598EB) {\n \t\tif (max_vfs > IXGBE_MAX_VFS_DRV_LIMIT) {\n-\t\t\tadapter->num_vfs = 0;\n+\t\t\tmax_vfs = 0;\n \t\t\te_dev_warn(\"max_vfs parameter out of range. Not assigning any SR-IOV VFs\\n\");\n-\t\t} else {\n-\t\t\tadapter->num_vfs = max_vfs;\n \t\t}\n \t}\n #endif /* CONFIG_PCI_IOV */\n@@ -9854,7 +9852,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tixgbe_init_mbx_params_pf(hw);\n \thw->mbx.ops = ii->mbx_ops;\n \tpci_sriov_set_totalvfs(pdev, IXGBE_MAX_VFS_DRV_LIMIT);\n-\tixgbe_enable_sriov(adapter);\n+\tixgbe_enable_sriov(adapter, max_vfs);\n skip_sriov:\n \n #endif\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\nindex 16952d3..102ca93 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n@@ -46,14 +46,15 @@\n #include \"ixgbe_sriov.h\"\n \n #ifdef CONFIG_PCI_IOV\n-static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter)\n+static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter,\n+\t\t\t\t\t   unsigned int num_vfs)\n {\n \tstruct ixgbe_hw *hw = &adapter->hw;\n \tstruct vf_macvlans *mv_list;\n \tint num_vf_macvlans, i;\n \n \tnum_vf_macvlans = hw->mac.num_rar_entries -\n-\t\t\t  (IXGBE_MAX_PF_MACVLANS + 1 + adapter->num_vfs);\n+\t\t\t  (IXGBE_MAX_PF_MACVLANS + 1 + num_vfs);\n \tif (!num_vf_macvlans)\n \t\treturn;\n \n@@ -71,7 +72,8 @@ static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter)\n \t}\n }\n \n-static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n+static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter,\n+\t\t\t\tunsigned int num_vfs)\n {\n \tstruct ixgbe_hw *hw = &adapter->hw;\n \tint i;\n@@ -82,28 +84,27 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n \tadapter->flags |= IXGBE_FLAG_VMDQ_ENABLED;\n \tif (!adapter->ring_feature[RING_F_VMDQ].limit)\n \t\tadapter->ring_feature[RING_F_VMDQ].limit = 1;\n-\tadapter->ring_feature[RING_F_VMDQ].offset = adapter->num_vfs;\n \n-\t/* If call to enable VFs succeeded then allocate memory\n-\t * for per VF control structures.\n-\t */\n-\tadapter->vfinfo = kcalloc(adapter->num_vfs,\n-\t\t\t\t  sizeof(struct vf_data_storage), GFP_KERNEL);\n+\t/* Allocate memory for per VF control structures */\n+\tadapter->vfinfo = kcalloc(num_vfs, sizeof(struct vf_data_storage),\n+\t\t\t\t  GFP_KERNEL);\n \tif (!adapter->vfinfo)\n \t\treturn -ENOMEM;\n \n-\tixgbe_alloc_vf_macvlans(adapter);\n+\tadapter->num_vfs = num_vfs;\n+\n+\tixgbe_alloc_vf_macvlans(adapter, num_vfs);\n+\tadapter->ring_feature[RING_F_VMDQ].offset = num_vfs;\n \n \t/* Initialize default switching mode VEB */\n \tIXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);\n \tadapter->bridge_mode = BRIDGE_MODE_VEB;\n \n \t/* limit trafffic classes based on VFs enabled */\n-\tif ((adapter->hw.mac.type == ixgbe_mac_82599EB) &&\n-\t    (adapter->num_vfs < 16)) {\n+\tif ((adapter->hw.mac.type == ixgbe_mac_82599EB) && (num_vfs < 16)) {\n \t\tadapter->dcb_cfg.num_tcs.pg_tcs = MAX_TRAFFIC_CLASS;\n \t\tadapter->dcb_cfg.num_tcs.pfc_tcs = MAX_TRAFFIC_CLASS;\n-\t} else if (adapter->num_vfs < 32) {\n+\t} else if (num_vfs < 32) {\n \t\tadapter->dcb_cfg.num_tcs.pg_tcs = 4;\n \t\tadapter->dcb_cfg.num_tcs.pfc_tcs = 4;\n \t} else {\n@@ -115,7 +116,7 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n \tadapter->flags2 &= ~(IXGBE_FLAG2_RSC_CAPABLE |\n \t\t\t     IXGBE_FLAG2_RSC_ENABLED);\n \n-\tfor (i = 0; i < adapter->num_vfs; i++) {\n+\tfor (i = 0; i < num_vfs; i++) {\n \t\t/* enable spoof checking for all VFs */\n \t\tadapter->vfinfo[i].spoofchk_enabled = true;\n \n@@ -133,7 +134,7 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n \t\tadapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE;\n \t}\n \n-\te_info(probe, \"SR-IOV enabled with %d VFs\\n\", adapter->num_vfs);\n+\te_info(probe, \"SR-IOV enabled with %d VFs\\n\", num_vfs);\n \treturn 0;\n }\n \n@@ -172,12 +173,13 @@ static void ixgbe_get_vfs(struct ixgbe_adapter *adapter)\n /* Note this function is called when the user wants to enable SR-IOV\n  * VFs using the now deprecated module parameter\n  */\n-void ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n+void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs)\n {\n \tint pre_existing_vfs = 0;\n+\tunsigned int num_vfs;\n \n \tpre_existing_vfs = pci_num_vf(adapter->pdev);\n-\tif (!pre_existing_vfs && !adapter->num_vfs)\n+\tif (!pre_existing_vfs && !max_vfs)\n \t\treturn;\n \n \t/* If there are pre-existing VFs then we have to force\n@@ -187,7 +189,7 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n \t * have been created via the new PCI SR-IOV sysfs interface.\n \t */\n \tif (pre_existing_vfs) {\n-\t\tadapter->num_vfs = pre_existing_vfs;\n+\t\tnum_vfs = pre_existing_vfs;\n \t\tdev_warn(&adapter->pdev->dev,\n \t\t\t \"Virtual Functions already enabled for this device - Please reload all VF drivers to avoid spoofed packet errors\\n\");\n \t} else {\n@@ -199,17 +201,16 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n \t\t * physical function.  If the user requests greater than\n \t\t * 63 VFs then it is an error - reset to default of zero.\n \t\t */\n-\t\tadapter->num_vfs = min_t(unsigned int, adapter->num_vfs, IXGBE_MAX_VFS_DRV_LIMIT);\n+\t\tnum_vfs = min_t(unsigned int, max_vfs, IXGBE_MAX_VFS_DRV_LIMIT);\n \n-\t\terr = pci_enable_sriov(adapter->pdev, adapter->num_vfs);\n+\t\terr = pci_enable_sriov(adapter->pdev, num_vfs);\n \t\tif (err) {\n \t\t\te_err(probe, \"Failed to enable PCI sriov: %d\\n\", err);\n-\t\t\tadapter->num_vfs = 0;\n \t\t\treturn;\n \t\t}\n \t}\n \n-\tif (!__ixgbe_enable_sriov(adapter)) {\n+\tif (!__ixgbe_enable_sriov(adapter, num_vfs)) {\n \t\tixgbe_get_vfs(adapter);\n \t\treturn;\n \t}\n@@ -347,13 +348,12 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)\n \t\t\treturn -EPERM;\n \t\t}\n \t}\n-\tadapter->num_vfs = num_vfs;\n \n-\terr = __ixgbe_enable_sriov(adapter);\n+\terr = __ixgbe_enable_sriov(adapter, num_vfs);\n \tif (err)\n \t\treturn  err;\n \n-\tfor (i = 0; i < adapter->num_vfs; i++)\n+\tfor (i = 0; i < num_vfs; i++)\n \t\tixgbe_vf_configuration(dev, (i | 0x10000000));\n \n \t/* reset before enabling SRIOV to avoid mailbox issues */\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h\nindex 3166fd1..cf67b9b 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h\n@@ -59,7 +59,7 @@ int ixgbe_ndo_get_vf_config(struct net_device *netdev,\n void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);\n int ixgbe_disable_sriov(struct ixgbe_adapter *adapter);\n #ifdef CONFIG_PCI_IOV\n-void ixgbe_enable_sriov(struct ixgbe_adapter *adapter);\n+void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs);\n #endif\n int ixgbe_pci_sriov_configure(struct pci_dev *dev, int num_vfs);\n \n",
    "prefixes": [
        "3/3"
    ]
}