[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH v2 1/2] lib/uknetdev: Save nw_stack data in a netdevice



Hi Sharan,

thanks a lot for this patch. Looks good to me, works as expected.

regards,
Hugo

Reviewed-by: Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx>

On Tue, 2020-06-30 at 12:47 +0200, Sharan Santhanam wrote:
> We extend the uk_netdev to store network stack specific data into
> uk_netdev. The size of the of this data is passed to network stack
> by setting the CONFIG_UK_NETDEV_SCRATCH_SIZE
> 
> Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
> ---
>  lib/uknetdev/Makefile.rules           | 20 ++++++++++++++++++++
>  lib/uknetdev/include/uk/netdev_core.h |  7 +++++++
>  support/build/Makefile.rules          |  2 +-
>  3 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 lib/uknetdev/Makefile.rules
> 
> diff --git a/lib/uknetdev/Makefile.rules
> b/lib/uknetdev/Makefile.rules
> new file mode 100644
> index 00000000..7894e163
> --- /dev/null
> +++ b/lib/uknetdev/Makefile.rules
> @@ -0,0 +1,20 @@
> +UK_SCRATCH_MEM=0
> +UK_SCRATCH_RULE_SET=
> +
> +.SECONDEXPANSION:
> +FORCE:
> +
> +uk_scratch_mem_set: $$(eval CFLAGS-y+=-
> DCONFIG_UK_NETDEV_SCRATCH_SIZE=$$(UK_SCRATCH_MEM))
> +     @:;
> +
> +.PHONY : uk_scratch_mem_set
> +
> +
> +## reserve memory for the network stack
> +## uknetdev_scratch_mem,bytes_of_memory
> +define uknetdev_scratch_mem =
> +$(if $(strip $(1)),\
> +     $(if $(shell test $(1) -gt $(UK_SCRATCH_MEM) && echo
> "scratch mem set"), $(eval UK_SCRATCH_MEM:=$(1))))
> +
> +$(if $(strip $(UK_SCRATCH_RULE_SET)),,$(eval UK_SCRATCH_RULE_SET:=1)
> $(eval UK_PREPARE-$(CONFIG_LIBUKNETDEV)+=uk_scratch_mem_set))
> +endef
> diff --git a/lib/uknetdev/include/uk/netdev_core.h
> b/lib/uknetdev/include/uk/netdev_core.h
> index dba719fc..827f1872 100644
> --- a/lib/uknetdev/include/uk/netdev_core.h
> +++ b/lib/uknetdev/include/uk/netdev_core.h
> @@ -65,6 +65,10 @@
>  extern "C" {
>  #endif
>  
> +#ifndef CONFIG_UK_NETDEV_SCRATCH_SIZE
> +#define CONFIG_UK_NETDEV_SCRATCH_SIZE 0
> +#endif /* CONFIG_UK_NETDEV_SCRATCH_SIZE */
> +
>  struct uk_netdev;
>  UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
>  
> @@ -400,6 +404,9 @@ struct uk_netdev {
>       struct
> uk_netdev_tx_queue   *_tx_queue[CONFIG_LIBUKNETDEV_MAXNBQUEUES];
>  
>       UK_TAILQ_ENTRY(struct uk_netdev) _list;
> +#if (CONFIG_UK_NETDEV_SCRATCH_SIZE > 0)
> +     char scratch_pad[CONFIG_UK_NETDEV_SCRATCH_SIZE];
> +#endif /* CONFIG_UK_NETDEV_SCRATCH_SIZE */
>  };
>  
>  #ifdef __cplusplus
> diff --git a/support/build/Makefile.rules
> b/support/build/Makefile.rules
> index 8c096fa5..5f7db8a3 100644
> --- a/support/build/Makefile.rules
> +++ b/support/build/Makefile.rules
> @@ -450,7 +450,7 @@ $(4): $(2) | prepare
>                      $($(call vprefix_lib,$(1),CINCLUDES))
> $($(call vprefix_lib,$(1),CINCLUDES-y)) \
>                      $($(call
> vprefix_src,$(1),$(2),$(3),INCLUDES)) $($(call
> vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
>                      $($(call vprefix_glb,$(3),ARCHFLAGS))
> $($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> -                    $(CFLAGS) $(CFLAGS-y) \
> +                    $(CFLAGS) $$(CFLAGS-y) \
>                      $($(call vprefix_lib,$(1),CFLAGS)) $($(call
> vprefix_lib,$(1),CFLAGS-y)) \
>                      $($(call vprefix_src,$(1),$(2),$(3),FLAGS))
> $($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
>                      $(5) \



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.