nfp: pass cpp_id to nfp_cpp_map_area()
Align nfp_cpp_map_area() with other CPP-level APIs and pass encoded cpp_id/dest rather than target, action, domain tuple. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Francois H. Theron <francois.theron@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3f0e55a2a6
commit
8f6d6052cf
|
@ -470,8 +470,8 @@ static void nfp_net_pci_unmap_mem(struct nfp_pf *pf)
|
|||
|
||||
static int nfp_net_pci_map_mem(struct nfp_pf *pf)
|
||||
{
|
||||
u32 min_size, cpp_id;
|
||||
u8 __iomem *mem;
|
||||
u32 min_size;
|
||||
int err;
|
||||
|
||||
min_size = pf->max_data_vnics * NFP_PF_CSR_SLICE_SIZE;
|
||||
|
@ -519,9 +519,9 @@ static int nfp_net_pci_map_mem(struct nfp_pf *pf)
|
|||
pf->vfcfg_tbl2 = NULL;
|
||||
}
|
||||
|
||||
mem = nfp_cpp_map_area(pf->cpp, "net.qc", 0, 0,
|
||||
NFP_PCIE_QUEUE(0), NFP_QCP_QUEUE_AREA_SZ,
|
||||
&pf->qc_area);
|
||||
cpp_id = NFP_CPP_ISLAND_ID(0, NFP_CPP_ACTION_RW, 0, 0);
|
||||
mem = nfp_cpp_map_area(pf->cpp, "net.qc", cpp_id, NFP_PCIE_QUEUE(0),
|
||||
NFP_QCP_QUEUE_AREA_SZ, &pf->qc_area);
|
||||
if (IS_ERR(mem)) {
|
||||
nfp_err(pf->cpp, "Failed to map Queue Controller area.\n");
|
||||
err = PTR_ERR(mem);
|
||||
|
|
|
@ -294,8 +294,8 @@ int nfp_cpp_writeq(struct nfp_cpp *cpp, u32 cpp_id,
|
|||
unsigned long long address, u64 value);
|
||||
|
||||
u8 __iomem *
|
||||
nfp_cpp_map_area(struct nfp_cpp *cpp, const char *name, int domain, int target,
|
||||
u64 addr, unsigned long size, struct nfp_cpp_area **area);
|
||||
nfp_cpp_map_area(struct nfp_cpp *cpp, const char *name, u32 cpp_id, u64 addr,
|
||||
unsigned long size, struct nfp_cpp_area **area);
|
||||
|
||||
struct nfp_cpp_mutex;
|
||||
|
||||
|
|
|
@ -294,8 +294,7 @@ exit_release:
|
|||
* nfp_cpp_map_area() - Helper function to map an area
|
||||
* @cpp: NFP CPP handler
|
||||
* @name: Name for the area
|
||||
* @domain: CPP domain
|
||||
* @target: CPP target
|
||||
* @cpp_id: CPP ID for operation
|
||||
* @addr: CPP address
|
||||
* @size: Size of the area
|
||||
* @area: Area handle (output)
|
||||
|
@ -306,15 +305,12 @@ exit_release:
|
|||
* Return: Pointer to memory mapped area or ERR_PTR
|
||||
*/
|
||||
u8 __iomem *
|
||||
nfp_cpp_map_area(struct nfp_cpp *cpp, const char *name, int domain, int target,
|
||||
u64 addr, unsigned long size, struct nfp_cpp_area **area)
|
||||
nfp_cpp_map_area(struct nfp_cpp *cpp, const char *name, u32 cpp_id, u64 addr,
|
||||
unsigned long size, struct nfp_cpp_area **area)
|
||||
{
|
||||
u8 __iomem *res;
|
||||
u32 dest;
|
||||
|
||||
dest = NFP_CPP_ISLAND_ID(target, NFP_CPP_ACTION_RW, 0, domain);
|
||||
|
||||
*area = nfp_cpp_area_alloc_acquire(cpp, name, dest, addr, size);
|
||||
*area = nfp_cpp_area_alloc_acquire(cpp, name, cpp_id, addr, size);
|
||||
if (!*area)
|
||||
goto err_eio;
|
||||
|
||||
|
|
|
@ -481,18 +481,22 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, const char *id,
|
|||
{
|
||||
const struct nfp_rtsym *sym;
|
||||
u8 __iomem *mem;
|
||||
u32 cpp_id;
|
||||
|
||||
sym = nfp_rtsym_lookup(rtbl, name);
|
||||
if (!sym)
|
||||
return (u8 __iomem *)ERR_PTR(-ENOENT);
|
||||
|
||||
cpp_id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0,
|
||||
sym->domain);
|
||||
|
||||
if (sym->size < min_size) {
|
||||
nfp_err(rtbl->cpp, "Symbol %s too small\n", name);
|
||||
return (u8 __iomem *)ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
mem = nfp_cpp_map_area(rtbl->cpp, id, sym->domain, sym->target,
|
||||
sym->addr, sym->size, area);
|
||||
mem = nfp_cpp_map_area(rtbl->cpp, id, cpp_id, sym->addr,
|
||||
sym->size, area);
|
||||
if (IS_ERR(mem)) {
|
||||
nfp_err(rtbl->cpp, "Failed to map symbol %s: %ld\n",
|
||||
name, PTR_ERR(mem));
|
||||
|
|
Loading…
Reference in New Issue