-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
One function was renamed here, the other contains code extracted from another. Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Alex Maftei (amaftei)
authored and
David S. Miller
committed
Jan 9, 2020
1 parent
1cf0f76
commit 37a5f9d
Showing
3 changed files
with
68 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/**************************************************************************** | ||
* Driver for Solarflare network controllers and boards | ||
* Copyright 2019 Solarflare Communications Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 as published | ||
* by the Free Software Foundation, incorporated herein by reference. | ||
*/ | ||
|
||
#include "net_driver.h" | ||
#include "efx.h" | ||
#include "nic.h" | ||
#include "mcdi_functions.h" | ||
#include "mcdi.h" | ||
#include "mcdi_pcol.h" | ||
|
||
int efx_mcdi_free_vis(struct efx_nic *efx) | ||
{ | ||
MCDI_DECLARE_BUF_ERR(outbuf); | ||
size_t outlen; | ||
int rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FREE_VIS, NULL, 0, | ||
outbuf, sizeof(outbuf), &outlen); | ||
|
||
/* -EALREADY means nothing to free, so ignore */ | ||
if (rc == -EALREADY) | ||
rc = 0; | ||
if (rc) | ||
efx_mcdi_display_error(efx, MC_CMD_FREE_VIS, 0, outbuf, outlen, | ||
rc); | ||
return rc; | ||
} | ||
|
||
int efx_mcdi_alloc_vis(struct efx_nic *efx, unsigned int min_vis, | ||
unsigned int max_vis, unsigned int *vi_base, | ||
unsigned int *allocated_vis) | ||
{ | ||
MCDI_DECLARE_BUF(outbuf, MC_CMD_ALLOC_VIS_OUT_LEN); | ||
MCDI_DECLARE_BUF(inbuf, MC_CMD_ALLOC_VIS_IN_LEN); | ||
size_t outlen; | ||
int rc; | ||
|
||
MCDI_SET_DWORD(inbuf, ALLOC_VIS_IN_MIN_VI_COUNT, min_vis); | ||
MCDI_SET_DWORD(inbuf, ALLOC_VIS_IN_MAX_VI_COUNT, max_vis); | ||
rc = efx_mcdi_rpc(efx, MC_CMD_ALLOC_VIS, inbuf, sizeof(inbuf), | ||
outbuf, sizeof(outbuf), &outlen); | ||
if (rc != 0) | ||
return rc; | ||
|
||
if (outlen < MC_CMD_ALLOC_VIS_OUT_LEN) | ||
return -EIO; | ||
|
||
netif_dbg(efx, drv, efx->net_dev, "base VI is A0x%03x\n", | ||
MCDI_DWORD(outbuf, ALLOC_VIS_OUT_VI_BASE)); | ||
|
||
if (vi_base) | ||
*vi_base = MCDI_DWORD(outbuf, ALLOC_VIS_OUT_VI_BASE); | ||
if (allocated_vis) | ||
*allocated_vis = MCDI_DWORD(outbuf, ALLOC_VIS_OUT_VI_COUNT); | ||
return 0; | ||
} |