From 615fdc5ad34401521f1493bdbdc9de91e021b05e Mon Sep 17 00:00:00 2001 From: Tristan Gingold <tristan.gingold@cern.ch> Date: Thu, 6 Apr 2023 13:56:37 +0200 Subject: [PATCH] wrtd-rt-common.h: add an option to use VLAN For #11 --- software/firmware/include/wrtd-rt-common.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/software/firmware/include/wrtd-rt-common.h b/software/firmware/include/wrtd-rt-common.h index c7709b1..e3785c9 100644 --- a/software/firmware/include/wrtd-rt-common.h +++ b/software/firmware/include/wrtd-rt-common.h @@ -23,6 +23,7 @@ * #define WRTD_NET_TX x // 1 if transmit events to the network * #define WRTD_LOCAL_RX x // 1 if consume events * #define WRTD_LOCAL_TX x // 1 if generate events + * #define WRTD_NET_VLAN // Define to tag tx frames (with vlan 0) * #include "wrtd-rt-common.h" * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @@ -465,6 +466,11 @@ static void wrtd_log_discard(struct wrtd_rule *rule, } #if WRTD_NET_TX > 0 +#ifdef WRTD_NET_VLAN +#define FILTER_TX (TRTL_EP_FILTER_VLAN) +#else +#define FILTER_TX 0 +#endif static void wrtd_init_tx(void) { static const struct trtl_ep_eth_address addr = { @@ -474,7 +480,7 @@ static void wrtd_init_tx(void) .dst_port = WRTD_UDP_PORT, .src_port = WRTD_UDP_PORT, .ethertype = 0x800, /* IPv4 */ - .filter = 0 /* only the TX path of the endpoint is used */ + .filter = FILTER_TX }; rmq_bind_out(WRTD_RMQ, TRTL_EP_ETH, &addr); } @@ -688,6 +694,11 @@ static void wrtd_route_in(struct wrtd_event *ev) #endif #if WRTD_NET_RX > 0 +#ifdef WRTD_NET_VLAN +#define FILTER_RX (TRTL_EP_FILTER_VLAN_DIS) +#else +#define FILTER_RX 0 +#endif static void wrtd_init_rx(void) { static const struct trtl_ep_eth_address addr = { @@ -699,6 +710,7 @@ static void wrtd_init_rx(void) | TRTL_EP_FILTER_DST_PORT | TRTL_EP_FILTER_ETHERTYPE | TRTL_EP_FILTER_DST_IP + | FILTER_RX | TRTL_EP_FILTER_ENABLE) }; rmq_bind_in(WRTD_RMQ, TRTL_EP_ETH, &addr); -- GitLab