Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/irdma/irdma_pble.c
/*- | /*- | ||||
* SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB | * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB | ||||
* | * | ||||
* Copyright (c) 2015 - 2021 Intel Corporation | * Copyright (c) 2015 - 2022 Intel Corporation | ||||
* | * | ||||
* This software is available to you under a choice of one of two | * This software is available to you under a choice of one of two | ||||
* licenses. You may choose to be licensed under the terms of the GNU | * licenses. You may choose to be licensed under the terms of the GNU | ||||
Context not available. | |||||
* get_lvl1_lvl2_pble - calls get_lvl1 and get_lvl2 pble routine | * get_lvl1_lvl2_pble - calls get_lvl1 and get_lvl2 pble routine | ||||
* @pble_rsrc: pble resources | * @pble_rsrc: pble resources | ||||
* @palloc: contains all inforamtion regarding pble (idx + pble addr) | * @palloc: contains all inforamtion regarding pble (idx + pble addr) | ||||
* @level1_only: flag for a level 1 PBLE | * @lvl: Bitmask for requested pble level | ||||
*/ | */ | ||||
static int | static int | ||||
get_lvl1_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, | get_lvl1_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, | ||||
struct irdma_pble_alloc *palloc, bool level1_only) | struct irdma_pble_alloc *palloc, u8 lvl) | ||||
{ | { | ||||
int status = 0; | int status = 0; | ||||
status = get_lvl1_pble(pble_rsrc, palloc); | status = get_lvl1_pble(pble_rsrc, palloc); | ||||
if (!status || level1_only || palloc->total_cnt <= PBLE_PER_PAGE) | if (!status || lvl == PBLE_LEVEL_1 || palloc->total_cnt <= PBLE_PER_PAGE) | ||||
return status; | return status; | ||||
status = get_lvl2_pble(pble_rsrc, palloc); | status = get_lvl2_pble(pble_rsrc, palloc); | ||||
Context not available. | |||||
* @pble_rsrc: pble resources | * @pble_rsrc: pble resources | ||||
* @palloc: contains all inforamtion regarding pble (idx + pble addr) | * @palloc: contains all inforamtion regarding pble (idx + pble addr) | ||||
* @pble_cnt: #of pbles requested | * @pble_cnt: #of pbles requested | ||||
* @level1_only: true if only pble level 1 to acquire | * @lvl: requested pble level mask | ||||
*/ | */ | ||||
int | int | ||||
irdma_get_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, | irdma_get_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, | ||||
struct irdma_pble_alloc *palloc, u32 pble_cnt, | struct irdma_pble_alloc *palloc, u32 pble_cnt, | ||||
bool level1_only) | u8 lvl) | ||||
{ | { | ||||
int status = 0; | int status = 0; | ||||
int max_sds = 0; | int max_sds = 0; | ||||
Context not available. | |||||
/* | /* | ||||
* check first to see if we can get pble's without acquiring additional sd's | * check first to see if we can get pble's without acquiring additional sd's | ||||
*/ | */ | ||||
status = get_lvl1_lvl2_pble(pble_rsrc, palloc, level1_only); | status = get_lvl1_lvl2_pble(pble_rsrc, palloc, lvl); | ||||
if (!status) | if (!status) | ||||
goto exit; | goto exit; | ||||
Context not available. | |||||
if (status) | if (status) | ||||
break; | break; | ||||
status = get_lvl1_lvl2_pble(pble_rsrc, palloc, level1_only); | status = get_lvl1_lvl2_pble(pble_rsrc, palloc, lvl); | ||||
/* if level1_only, only go through it once */ | /* if level1_only, only go through it once */ | ||||
if (!status || level1_only) | if (!status || lvl == PBLE_LEVEL_1) | ||||
break; | break; | ||||
} | } | ||||
Context not available. |