Commit 1954fc8d authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez Committed by Benoit Rat

pfilter: ARP & ICMP traffics are re-directed to the external fabric (NIC)

In case we are using the WR_NIC_CPU option we redirect ARP & ICMP to
external fabric (controlled by NIC driver on host CPU).
We have also add this option to Kconfig and update the wrnic_defconfig
used by wr-starting-kit
parent e0d5387b
...@@ -127,8 +127,17 @@ config P2P ...@@ -127,8 +127,17 @@ config P2P
If you deny this option, P2P code is not built, to save some If you deny this option, P2P code is not built, to save some
binary size. binary size.
config IP config WR_NIC_CPU
depends on WR_NODE depends on WR_NODE
boolean "Allows compatibility with external NIC driver on CPU"
default n
help
ARP & ICMP traffic are bypassed to the external fabric (NIC) so
that the CPU handles these packets and not the LM32. (This option
is mainly used by the wr-starting-kit on SPEC cards)
config IP
depends on WR_NODE && !WR_NIC_CPU
boolean "Compile minimal IP support in wrpc-sw" boolean "Compile minimal IP support in wrpc-sw"
help help
This allows to run LM32 code that is aware of IP. The feature is This allows to run LM32 code that is aware of IP. The feature is
...@@ -313,7 +322,7 @@ config ABSCAL ...@@ -313,7 +322,7 @@ config ABSCAL
described and documented by Peter Jansweijer. described and documented by Peter Jansweijer.
config LLDP config LLDP
depends on WR_NODE depends on WR_NODE && IP
boolean "Include LLDP protocol transmit-only" boolean "Include LLDP protocol transmit-only"
default n default n
help help
......
...@@ -24,11 +24,8 @@ CONFIG_PPSI=y ...@@ -24,11 +24,8 @@ CONFIG_PPSI=y
CONFIG_W1=y CONFIG_W1=y
CONFIG_LATENCY_ETHTYPE=291 CONFIG_LATENCY_ETHTYPE=291
# CONFIG_P2P is not set # CONFIG_P2P is not set
CONFIG_IP=y CONFIG_WR_NIC_CPU=y
# CONFIG_CMD_CONFIG is not set # CONFIG_CMD_CONFIG is not set
# CONFIG_SYSLOG is not set
CONFIG_SNMP=y
CONFIG_SNMP_SET=y
CONFIG_BUILD_INIT=y CONFIG_BUILD_INIT=y
CONFIG_INIT_COMMAND="vlan off;ptp stop;sfp match;mode slave;ptp start" CONFIG_INIT_COMMAND="vlan off;ptp stop;sfp match;mode slave;ptp start"
CONFIG_HAS_BUILD_INIT=1 CONFIG_HAS_BUILD_INIT=1
......
...@@ -18,12 +18,15 @@ ...@@ -18,12 +18,15 @@
the internal fabric. The frame, in the fabric, is prefixed with the internal fabric. The frame, in the fabric, is prefixed with
a status word that includes the class bits. a status word that includes the class bits.
The CPU is expected to receive PTP, ICMP, ARP and DHCP replies (so The LM32 CPU is expected to receive PTP and if probably ICMP, ARP
local "bootpc" port). and DHCP replies (so local "bootpc" port).
The fabric should receive Etherbone (i.e. UDP port 0xebd0), the The fabric should receive Etherbone (i.e. UDP port 0xebd0), the
"streamer" protocol used by some CERN installation (ethtype 0xdbff) "streamer" protocol used by some CERN installation (ethtype 0xdbff).
and everything else if the "NIC pfilter" feature by 7Solutions is used.
If an external NIC is used we should redirect everything (including
ARP,ICMP,DHCP) there excepting the PTP packets that should be handle
by LM32.
The logic cells connected to the fabric do their own check on the The logic cells connected to the fabric do their own check on the
frames, so it's not a problem if extra frames reach the fabric. Thus, frames, so it's not a problem if extra frames reach the fabric. Thus,
...@@ -413,9 +416,17 @@ void pfilter_init_novlan(char *fname) ...@@ -413,9 +416,17 @@ void pfilter_init_novlan(char *fname)
pfilter_cmp(11, 0x0011, 0x00ff, MOV, FRAME_UDP); pfilter_cmp(11, 0x0011, 0x00ff, MOV, FRAME_UDP);
pfilter_logic2(FRAME_UDP, FRAME_UDP, AND, FRAME_IP_OK); pfilter_logic2(FRAME_UDP, FRAME_UDP, AND, FRAME_IP_OK);
#ifdef CONFIG_WR_NIC_CPU
/* For CPU: icmp unicast or ptp (or latency) */
/* Now, ARP & ICMP traffic are bypassed to the external fabric (NIC) */
pfilter_logic2(FRAME_FOR_CPU, FRAME_TYPE_PTP2, MOV, R_ZERO);
#else
/* For CPU: arp or icmp unicast or ptp (or latency) */ /* For CPU: arp or icmp unicast or ptp (or latency) */
pfilter_logic2(FRAME_FOR_CPU, FRAME_TYPE_ARP, OR, FRAME_TYPE_PTP2); pfilter_logic2(FRAME_FOR_CPU, FRAME_TYPE_ARP, OR, FRAME_TYPE_PTP2);
pfilter_logic3(FRAME_FOR_CPU, FRAME_IP_OK, AND, FRAME_ICMP, OR, FRAME_FOR_CPU); pfilter_logic3(FRAME_FOR_CPU, FRAME_IP_OK, AND, FRAME_ICMP, OR, FRAME_FOR_CPU);
#endif
/* Now look in UDP ports: at offset 18 (14 + 20 + 8 = 36) */ /* Now look in UDP ports: at offset 18 (14 + 20 + 8 = 36) */
pfilter_cmp(18, 0x0000, 0xff00, MOV, PORT_UDP_HOST); /* ports 0-255 */ pfilter_cmp(18, 0x0000, 0xff00, MOV, PORT_UDP_HOST); /* ports 0-255 */
......
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