37a5f9dceb
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>
62 lines
1.8 KiB
C
62 lines
1.8 KiB
C
// 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;
|
|
}
|