Deleted Added
full compact
mlx5_pagealloc.c (322146) mlx5_pagealloc.c (322148)
1/*-
2 * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
1/*-
2 * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 * $FreeBSD: stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c 322146 2017-08-07 12:41:06Z hselasky $
25 * $FreeBSD: stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c 322148 2017-08-07 12:44:18Z hselasky $
26 */
27
28#include <linux/kernel.h>
29#include <linux/module.h>
30#include <linux/delay.h>
31#include <dev/mlx5/driver.h>
32#include "mlx5_core.h"
33

--- 436 unchanged lines hidden (view full) ---

470 struct rb_node *p;
471 int nclaimed = 0;
472 int err;
473
474 do {
475 p = rb_first(&dev->priv.page_root);
476 if (p) {
477 fwp = rb_entry(p, struct mlx5_fw_page, rb_node);
26 */
27
28#include <linux/kernel.h>
29#include <linux/module.h>
30#include <linux/delay.h>
31#include <dev/mlx5/driver.h>
32#include "mlx5_core.h"
33

--- 436 unchanged lines hidden (view full) ---

470 struct rb_node *p;
471 int nclaimed = 0;
472 int err;
473
474 do {
475 p = rb_first(&dev->priv.page_root);
476 if (p) {
477 fwp = rb_entry(p, struct mlx5_fw_page, rb_node);
478 err = reclaim_pages(dev, fwp->func_id,
479 optimal_reclaimed_pages(),
480 &nclaimed);
481 if (err) {
482 mlx5_core_warn(dev, "failed reclaiming pages (%d)\n",
483 err);
484 return err;
478 if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
479 --dev->priv.fw_pages;
480 free_4k(dev, fwp->addr);
481 nclaimed = 1;
482 } else {
483 err = reclaim_pages(dev, fwp->func_id,
484 optimal_reclaimed_pages(),
485 &nclaimed);
486 if (err) {
487 mlx5_core_warn(dev, "failed reclaiming pages (%d)\n",
488 err);
489 return err;
490 }
485 }
491 }
492
486 if (nclaimed)
487 end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS);
488 }
489 if (time_after(jiffies, end)) {
490 mlx5_core_warn(dev, "FW did not return all pages. giving up...\n");
491 break;
492 }
493 } while (p);

--- 28 unchanged lines hidden ---
493 if (nclaimed)
494 end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS);
495 }
496 if (time_after(jiffies, end)) {
497 mlx5_core_warn(dev, "FW did not return all pages. giving up...\n");
498 break;
499 }
500 } while (p);

--- 28 unchanged lines hidden ---