Skip to content

Commit

Permalink
nfp: add nfp_cpp_area_size() accessor
Browse files Browse the repository at this point in the history
Allow users outside of core reading area sizes.  This was not needed
previously because whatever entity created the area would usually know
what size it asked for.  The nfp_rtsym_map() helper, however, will
allocate the area based on the size of an RT-symbol with given name.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Jakub Kicinski authored and Daniel Borkmann committed Dec 15, 2017
1 parent 7310c23 commit a351ab5
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h
Original file line number Diff line number Diff line change
@@ -242,6 +242,7 @@ int nfp_cpp_area_read(struct nfp_cpp_area *area, unsigned long offset,
void *buffer, size_t length);
int nfp_cpp_area_write(struct nfp_cpp_area *area, unsigned long offset,
const void *buffer, size_t length);
size_t nfp_cpp_area_size(struct nfp_cpp_area *area);
const char *nfp_cpp_area_name(struct nfp_cpp_area *cpp_area);
void *nfp_cpp_area_priv(struct nfp_cpp_area *cpp_area);
struct nfp_cpp *nfp_cpp_area_cpp(struct nfp_cpp_area *cpp_area);
11 changes: 11 additions & 0 deletions drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
Original file line number Diff line number Diff line change
@@ -567,6 +567,17 @@ int nfp_cpp_area_write(struct nfp_cpp_area *area,
return area->cpp->op->area_write(area, kernel_vaddr, offset, length);
}

/**
* nfp_cpp_area_size() - return size of a CPP area
* @cpp_area: CPP area handle
*
* Return: Size of the area
*/
size_t nfp_cpp_area_size(struct nfp_cpp_area *cpp_area)
{
return cpp_area->size;
}

/**
* nfp_cpp_area_name() - return name of a CPP area
* @cpp_area: CPP area handle

0 comments on commit a351ab5

Please sign in to comment.