| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * Copyright (C) 2015-2017 Netronome Systems, Inc. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This software is dual licensed under the GNU General License Version 2, |
|---|
| 5 | | - * June 1991 as shown in the file COPYING in the top-level directory of this |
|---|
| 6 | | - * source tree or the BSD 2-Clause License provided below. You have the |
|---|
| 7 | | - * option to license this software under the complete terms of either license. |
|---|
| 8 | | - * |
|---|
| 9 | | - * The BSD 2-Clause License: |
|---|
| 10 | | - * |
|---|
| 11 | | - * Redistribution and use in source and binary forms, with or |
|---|
| 12 | | - * without modification, are permitted provided that the following |
|---|
| 13 | | - * conditions are met: |
|---|
| 14 | | - * |
|---|
| 15 | | - * 1. Redistributions of source code must retain the above |
|---|
| 16 | | - * copyright notice, this list of conditions and the following |
|---|
| 17 | | - * disclaimer. |
|---|
| 18 | | - * |
|---|
| 19 | | - * 2. Redistributions in binary form must reproduce the above |
|---|
| 20 | | - * copyright notice, this list of conditions and the following |
|---|
| 21 | | - * disclaimer in the documentation and/or other materials |
|---|
| 22 | | - * provided with the distribution. |
|---|
| 23 | | - * |
|---|
| 24 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|---|
| 25 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|---|
| 26 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|---|
| 27 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
|---|
| 28 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|---|
| 29 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|---|
| 30 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|---|
| 31 | | - * SOFTWARE. |
|---|
| 32 | | - */ |
|---|
| 1 | +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) |
|---|
| 2 | +/* Copyright (C) 2015-2018 Netronome Systems, Inc. */ |
|---|
| 33 | 3 | |
|---|
| 34 | 4 | /* |
|---|
| 35 | 5 | * nfp_netvf_main.c |
|---|
| .. | .. |
|---|
| 136 | 106 | * first NFP_NET_CFG_BAR_SZ of the BAR. This keeps the code |
|---|
| 137 | 107 | * the identical for PF and VF drivers. |
|---|
| 138 | 108 | */ |
|---|
| 139 | | - ctrl_bar = ioremap_nocache(pci_resource_start(pdev, NFP_NET_CTRL_BAR), |
|---|
| 109 | + ctrl_bar = ioremap(pci_resource_start(pdev, NFP_NET_CTRL_BAR), |
|---|
| 140 | 110 | NFP_NET_CFG_BAR_SZ); |
|---|
| 141 | 111 | if (!ctrl_bar) { |
|---|
| 142 | 112 | dev_err(&pdev->dev, |
|---|
| .. | .. |
|---|
| 202 | 172 | rx_bar_off = NFP_PCIE_QUEUE(startq); |
|---|
| 203 | 173 | |
|---|
| 204 | 174 | /* Allocate and initialise the netdev */ |
|---|
| 205 | | - nn = nfp_net_alloc(pdev, true, max_tx_rings, max_rx_rings); |
|---|
| 175 | + nn = nfp_net_alloc(pdev, ctrl_bar, true, max_tx_rings, max_rx_rings); |
|---|
| 206 | 176 | if (IS_ERR(nn)) { |
|---|
| 207 | 177 | err = PTR_ERR(nn); |
|---|
| 208 | 178 | goto err_ctrl_unmap; |
|---|
| .. | .. |
|---|
| 210 | 180 | vf->nn = nn; |
|---|
| 211 | 181 | |
|---|
| 212 | 182 | nn->fw_ver = fw_ver; |
|---|
| 213 | | - nn->dp.ctrl_bar = ctrl_bar; |
|---|
| 214 | 183 | nn->dp.is_vf = 1; |
|---|
| 215 | 184 | nn->stride_tx = stride; |
|---|
| 216 | 185 | nn->stride_rx = stride; |
|---|
| .. | .. |
|---|
| 231 | 200 | bar_sz = (rx_bar_off + rx_bar_sz) - bar_off; |
|---|
| 232 | 201 | |
|---|
| 233 | 202 | map_addr = pci_resource_start(pdev, tx_bar_no) + bar_off; |
|---|
| 234 | | - vf->q_bar = ioremap_nocache(map_addr, bar_sz); |
|---|
| 203 | + vf->q_bar = ioremap(map_addr, bar_sz); |
|---|
| 235 | 204 | if (!vf->q_bar) { |
|---|
| 236 | 205 | nn_err(nn, "Failed to map resource %d\n", tx_bar_no); |
|---|
| 237 | 206 | err = -EIO; |
|---|
| .. | .. |
|---|
| 247 | 216 | |
|---|
| 248 | 217 | /* TX queues */ |
|---|
| 249 | 218 | map_addr = pci_resource_start(pdev, tx_bar_no) + tx_bar_off; |
|---|
| 250 | | - nn->tx_bar = ioremap_nocache(map_addr, tx_bar_sz); |
|---|
| 219 | + nn->tx_bar = ioremap(map_addr, tx_bar_sz); |
|---|
| 251 | 220 | if (!nn->tx_bar) { |
|---|
| 252 | 221 | nn_err(nn, "Failed to map resource %d\n", tx_bar_no); |
|---|
| 253 | 222 | err = -EIO; |
|---|
| .. | .. |
|---|
| 256 | 225 | |
|---|
| 257 | 226 | /* RX queues */ |
|---|
| 258 | 227 | map_addr = pci_resource_start(pdev, rx_bar_no) + rx_bar_off; |
|---|
| 259 | | - nn->rx_bar = ioremap_nocache(map_addr, rx_bar_sz); |
|---|
| 228 | + nn->rx_bar = ioremap(map_addr, rx_bar_sz); |
|---|
| 260 | 229 | if (!nn->rx_bar) { |
|---|
| 261 | 230 | nn_err(nn, "Failed to map resource %d\n", rx_bar_no); |
|---|
| 262 | 231 | err = -EIO; |
|---|
| .. | .. |
|---|
| 313 | 282 | |
|---|
| 314 | 283 | static void nfp_netvf_pci_remove(struct pci_dev *pdev) |
|---|
| 315 | 284 | { |
|---|
| 316 | | - struct nfp_net_vf *vf = pci_get_drvdata(pdev); |
|---|
| 317 | | - struct nfp_net *nn = vf->nn; |
|---|
| 285 | + struct nfp_net_vf *vf; |
|---|
| 286 | + struct nfp_net *nn; |
|---|
| 287 | + |
|---|
| 288 | + vf = pci_get_drvdata(pdev); |
|---|
| 289 | + if (!vf) |
|---|
| 290 | + return; |
|---|
| 291 | + |
|---|
| 292 | + nn = vf->nn; |
|---|
| 318 | 293 | |
|---|
| 319 | 294 | /* Note, the order is slightly different from above as we need |
|---|
| 320 | 295 | * to keep the nn pointer around till we have freed everything. |
|---|
| .. | .. |
|---|
| 348 | 323 | .id_table = nfp_netvf_pci_device_ids, |
|---|
| 349 | 324 | .probe = nfp_netvf_pci_probe, |
|---|
| 350 | 325 | .remove = nfp_netvf_pci_remove, |
|---|
| 326 | + .shutdown = nfp_netvf_pci_remove, |
|---|
| 351 | 327 | }; |
|---|