Commit a5d3db16 authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez Committed by Grzegorz Daniluk

dev/ep_pfilter: Updated filter rules for wr-nic repository.

- Added CONFIG_WRNIC in Kconfig to decide which filter rules will be use.
- Updated ep_pfilter using CONFIG_WRNIC.
- We do not use drop because all other packet goes to NIC core.

Note: filter rules to wr-nic do not have DROP instruction because all traffic
does not go to LM32/Etherbone is re-direct to NIC by default.
parent 838f428a
...@@ -40,6 +40,14 @@ config ETHERBONE ...@@ -40,6 +40,14 @@ config ETHERBONE
You need to run a gateware file that includes Etherbone support. You need to run a gateware file that includes Etherbone support.
If in doubt, say No. If in doubt, say No.
config WRNIC
boolean "Compile White Rabbit NIC support in wrpc-sw"
help
This allows to run LM32 code that is aware of Etherbone and
NIC. You need to run a gateware file that includes Etherbone
and NIC support. This option needs ETHERBONE enabled.
If in doubt, say No.
config CMD_CONFIG config CMD_CONFIG
boolean "Include configuration in the output binary" boolean "Include configuration in the output binary"
help help
......
...@@ -8,7 +8,9 @@ CONFIG_PRINTF_XINT=y ...@@ -8,7 +8,9 @@ CONFIG_PRINTF_XINT=y
CONFIG_PPSI=y CONFIG_PPSI=y
CONFIG_UART=y CONFIG_UART=y
CONFIG_W1=y CONFIG_W1=y
# CONFIG_ETHERBONE is not set CONFIG_ETHERBONE=y
CONFIG_WRNIC=y
# CONFIG_CMD_CONFIG is not set # CONFIG_CMD_CONFIG is not set
# #
......
...@@ -238,25 +238,52 @@ void pfilter_init_default() ...@@ -238,25 +238,52 @@ void pfilter_init_default()
pfilter_cmp(11, 0x0011, 0x00ff, MOV, 8); /* r8 = 1 when IP type = UDP */ pfilter_cmp(11, 0x0011, 0x00ff, MOV, 8); /* r8 = 1 when IP type = UDP */
#ifdef CONFIG_ETHERBONE #ifdef CONFIG_ETHERBONE
pfilter_logic3(10, 3, OR, 0, AND, 4); /* r10 = IP(unicast) */
pfilter_logic3(11, 1, OR, 3, AND, 4); /* r11 = IP(unicast+broadcast) */
pfilter_logic3(14, 1, AND, 6, OR, 5); /* r14 = ARP(broadcast) or PTPv2 */ #ifdef CONFIG_WRNIC
pfilter_logic3(15, 10, AND, 7, OR, 14); /* r15 = ICMP/IP(unicast) or ARP(broadcast) or PTPv2 */
pfilter_logic3(10, 3, OR, 0, AND, 4); /* r10 = IP(unicast) */
/* Ethernet = 14 bytes, IPv4 = 20 bytes, offset to dport: 2 = 36/2 = 18 */ pfilter_logic3(11, 1, OR, 3, AND, 4); /* r11 = IP(unicast+broadcast) */
pfilter_cmp(18, 0x0044, 0xffff, MOV, 14); /* r14 = 1 when dport = BOOTPC */
pfilter_logic3(14, 1, AND, 6, OR, 5); /* r14 = ARP(broadcast) or PTPv2 */
pfilter_logic3(14, 14, AND, 8, AND, 11); /* r14 = BOOTP/UDP/IP(unicast|broadcast) */ pfilter_logic3(15, 10, AND, 7, OR, 14); /* r15 = ICMP/IP(unicast) or ARP(broadcast) or PTPv2 */
pfilter_logic2(15, 14, OR, 15); /* r15 = BOOTP/UDP/IP(unicast|broadcast) or ICMP/IP(unicast) or ARP(broadcast) or PTPv2 */
/* Ethernet = 14 bytes, IPv4 = 20 bytes, offset to dport: 2 = 36/2 = 18 */
pfilter_logic3(20, 11, AND, 8, OR, 15); /* r16 = Something we accept */ pfilter_cmp(18, 0x0044, 0xffff, MOV, 14); /* r14 = 1 when dport = BOOTPC */
pfilter_logic3(R_DROP, 20, OR, 9, NOT, 0); /* None match? drop */ pfilter_cmp(18,0xebd0,0xffff,MOV,6); /* r6 = 1 when dport = ETHERBONE */
pfilter_logic2(R_CLASS(7), 11, AND, 8); /* class 7: UDP/IP(unicast|broadcast) => external fabric */ pfilter_logic3(14, 14, AND, 8, AND, 11); /* r14 = BOOTP/UDP/IP(unicast|broadcast) */
pfilter_logic2(R_CLASS(6), 1, AND, 9); /* class 6: streamer broadcasts => external fabric */ pfilter_logic2(15,14, OR, 15); /* r15 = BOOTP/UDP/IP(unicast|broadcast) or ICMP/IP(unicast) or ARP(broadcast) or PTPv2 */
pfilter_logic2(R_CLASS(0), 15, MOV, 0); /* class 0: ICMP/IP(unicast) or ARP(broadcast) or PTPv2 => PTP LM32 core */
pfilter_cmp(21,0x4e6f,0xffff,MOV,9); /* r9 = 1 when magic number = ETHERBONE */
pfilter_logic2(6,6,AND,9);
pfilter_logic2(R_CLASS(0), 15, MOV, 0); /* class 0: ICMP/IP(unicast) or ARP(broadcast) or PTPv2 => PTP LM32 core */
pfilter_logic2(R_CLASS(5), 6, OR, 0); /* class 5: Etherbone packet => Etherbone Core */
pfilter_logic3(R_CLASS(7), 15, OR, 6, NOT, 0); /* class 7: All other packets (no drop) => NIC Core */
#else
pfilter_logic3(10, 3, OR, 0, AND, 4); /* r10 = IP(unicast) */
pfilter_logic3(11, 1, OR, 3, AND, 4); /* r11 = IP(unicast+broadcast) */
pfilter_logic3(14, 1, AND, 6, OR, 5); /* r14 = ARP(broadcast) or PTPv2 */
pfilter_logic3(15, 10, AND, 7, OR, 14); /* r15 = ICMP/IP(unicast) or ARP(broadcast) or PTPv2 */
/* Ethernet = 14 bytes, IPv4 = 20 bytes, offset to dport: 2 = 36/2 = 18 */
pfilter_cmp(18, 0x0044, 0xffff, MOV, 14); /* r14 = 1 when dport = BOOTPC */
pfilter_logic3(14, 14, AND, 8, AND, 11); /* r14 = BOOTP/UDP/IP(unicast|broadcast) */
pfilter_logic2(15, 14, OR, 15); /* r15 = BOOTP/UDP/IP(unicast|broadcast) or ICMP/IP(unicast) or ARP(broadcast) or PTPv2 */
pfilter_logic3(20, 11, AND, 8, OR, 15); /* r16 = Something we accept */
pfilter_logic3(R_DROP, 20, OR, 9, NOT, 0); /* None match? drop */
pfilter_logic2(R_CLASS(7), 11, AND, 8); /* class 7: UDP/IP(unicast|broadcast) => external fabric */
pfilter_logic2(R_CLASS(6), 1, AND, 9); /* class 6: streamer broadcasts => external fabric */
pfilter_logic2(R_CLASS(0), 15, MOV, 0); /* class 0: ICMP/IP(unicast) or ARP(broadcast) or PTPv2 => PTP LM32 core */
#endif
#else #else
pfilter_logic3(10, 3, OR, 2, AND, 5); /* r10 = PTP (multicast or unicast) */ pfilter_logic3(10, 3, OR, 2, AND, 5); /* r10 = PTP (multicast or unicast) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment