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

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



Hey Sharan,

thanks for your work. I have a small comment inline.

Cheers,

Simon

On 07.10.19 11:50, 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_DEV_RESERVE

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
  lib/uknetdev/Makefile.rules           | 7 +++++++
  lib/uknetdev/include/uk/netdev_core.h | 7 +++++++
  2 files changed, 14 insertions(+)
  create mode 100644 lib/uknetdev/Makefile.rules

diff --git a/lib/uknetdev/Makefile.rules b/lib/uknetdev/Makefile.rules
new file mode 100644
index 0000000..905b633
--- /dev/null
+++ b/lib/uknetdev/Makefile.rules
@@ -0,0 +1,7 @@
+## reserve memory for the network stack
+## uknetdev_scratch_mem,libname,bytes_of_memory
+define uknetdev_scratch_mem =
+$(if $(strip $(2)),\
+       $(eval CFLAGS-$(CONFIG_$(call uc,$(1))) += \
+               -DCONFIG_UK_NETDEV_SCRATCH_SIZE=$(2)))
+endef

I like that libraries can set the scratch_mem size but I thought the maximum value should be taken. This rule adds multiple times the size as compile flag if the Make function is used multiple times. Is this intended?

diff --git a/lib/uknetdev/include/uk/netdev_core.h 
b/lib/uknetdev/include/uk/netdev_core.h
index dba719f..827f187 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


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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