summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 13:19:09 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 13:23:33 -0700
commit5be7b1ebd1ab2bce1d53552b627fe55f425bdb38 (patch)
tree890cda05f97bac976c2120ade2df79408bd40c82 /cmd
parentaec7a1209a7c2314acc5703a94509a403c796444 (diff)
Fuss with compile-time config
Diffstat (limited to 'cmd')
-rw-r--r--cmd/sbc_harness/config/config.h25
-rw-r--r--cmd/sbc_harness/main.c2
-rw-r--r--cmd/srv9p/config/config.h15
-rw-r--r--cmd/srv9p/main.c8
4 files changed, 38 insertions, 12 deletions
diff --git a/cmd/sbc_harness/config/config.h b/cmd/sbc_harness/config/config.h
index 5ee8634..e436eb5 100644
--- a/cmd/sbc_harness/config/config.h
+++ b/cmd/sbc_harness/config/config.h
@@ -12,7 +12,18 @@
/**
* How many W5500 chips we have.
*/
-#define CONFIG_W5500_NUM 1
+#define CONFIG_W5500_NUM 1
+
+/**
+ * When allocating an arbitrary local port, what range should it be
+ * allocated from?
+ *
+ * These are the default values of the Linux kernel's
+ * net.ipv4.ip_local_port_range, so I figure they're probably good
+ * values to use.
+ */
+#define CONFIG_W5500_LOCAL_PORT_MIN 32768
+#define CONFIG_W5500_LOCAL_PORT_MAX 60999
/* 9P *************************************************************************/
@@ -44,10 +55,20 @@
#define CONFIG_9P_MAX_FIDS 16
#define CONFIG_9P_MAX_REQS 2
#define CONFIG_9P_MAX_ERR_SIZE 128 /* 128 is what Plan 9 4e uses */
+#define CONFIG_9P_ENABLE_9P2000 1 /* bool */
+#define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */
+#define CONFIG_9P_ENABLE_9P2000_e 0 /* bool */
+
+/* DHCP ***********************************************************************/
+
+#define CONFIG_DHCP_CAN_RECV_UNICAST_IP_WITHOUT_IP 0
+#define CONFIG_DHCP_DEBUG 0
+#define CONFIG_DHCP_OPT_SIZE 312 /* minimum of 312 */
+#define CONFIG_DHCP_SELECTING_NS (5*NS_PER_S)
/* COROUTINE ******************************************************************/
-#define CONFIG_COROUTINE_DEFAULT_STACK_SIZE 512
+#define CONFIG_COROUTINE_DEFAULT_STACK_SIZE (2*1024)
#define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */
#define CONFIG_COROUTINE_PROTECT_STACK 1 /* bool */
#define CONFIG_COROUTINE_DEBUG 0 /* bool */
diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c
index 8ee2e7d..d015259 100644
--- a/cmd/sbc_harness/main.c
+++ b/cmd/sbc_harness/main.c
@@ -90,7 +90,7 @@ int main() {
usb_keyboard_rpc_t keyboard_chan = {0};
coroutine_add(usb_keyboard_cr, &keyboard_chan);
//coroutine_add(hello_world_cr, &keyboard_chan);
- coroutine_add_with_stack_size(3*1024, dhcp_cr, &dev_w5500);
+ coroutine_add_with_stack_size(4*1024, dhcp_cr, &dev_w5500);
/* event loop *********************************************************/
coroutine_main();
diff --git a/cmd/srv9p/config/config.h b/cmd/srv9p/config/config.h
index a184e6f..80c8125 100644
--- a/cmd/srv9p/config/config.h
+++ b/cmd/srv9p/config/config.h
@@ -7,7 +7,9 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
-#define CONFIG_NETIO_NUM_CONNS 8
+#define CONFIG_SRV9P_NUM_CONNS 8
+
+/* 9P *************************************************************************/
#define CONFIG_9P_PORT 564
/**
@@ -37,8 +39,11 @@
#define CONFIG_9P_MAX_FIDS 16
#define CONFIG_9P_MAX_REQS 2
#define CONFIG_9P_MAX_ERR_SIZE 128 /* 128 is what Plan 9 4e uses */
-#define CONFIG_9P_ENABLE_9P2000_u
-/*#define CONFIG_9P_ENABLE_9P2000_e*/
+#define CONFIG_9P_ENABLE_9P2000 1 /* bool */
+#define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */
+#define CONFIG_9P_ENABLE_9P2000_e 0 /* bool */
+
+/* COROUTINE ******************************************************************/
#define CONFIG_COROUTINE_DEFAULT_STACK_SIZE (32*1024)
#define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */
@@ -47,7 +52,7 @@
#define CONFIG_COROUTINE_VALGRIND 1 /* bool */
#define CONFIG_COROUTINE_NUM (1 /* usb_common */ +\
1 /* usb_keyboard */ +\
- CONFIG_NETIO_NUM_CONNS /* accept+read */ +\
- (CONFIG_9P_MAX_REQS*CONFIG_NETIO_NUM_CONNS) /* work+write */ )
+ CONFIG_SRV9P_NUM_CONNS /* accept+read */ +\
+ (CONFIG_9P_MAX_REQS*CONFIG_SRV9P_NUM_CONNS) /* work+write */ )
#endif /* _CONFIG_H_ */
diff --git a/cmd/srv9p/main.c b/cmd/srv9p/main.c
index d30c4f9..c5a3367 100644
--- a/cmd/srv9p/main.c
+++ b/cmd/srv9p/main.c
@@ -19,8 +19,8 @@
#include "config.h"
-#ifndef CONFIG_NETIO_NUM_CONNS
- #error config.h must define CONFIG_NETIO_NUM_CONNS
+#ifndef CONFIG_SRV9P_NUM_CONNS
+ #error config.h must define CONFIG_SRV9P_NUM_CONNS
#endif
/* implementation *************************************************************/
@@ -104,10 +104,10 @@ int main() {
.rootdir = get_root,
};
- for (int i = 0; i < CONFIG_NETIO_NUM_CONNS; i++)
+ for (int i = 0; i < CONFIG_SRV9P_NUM_CONNS; i++)
if (!coroutine_add(read_cr, &srv))
error(1, 0, "coroutine_add(read_cr, &srv)");
- for (int i = 0; i < 2*CONFIG_NETIO_NUM_CONNS; i++)
+ for (int i = 0; i < 2*CONFIG_SRV9P_NUM_CONNS; i++)
if (!coroutine_add(lib9p_srv_write_cr, &srv))
error(1, 0, "coroutine_add(lib9p_srv_write_cr, &srv)");