core/ip: Add with_broadcast parameter and set it to True by default (Allow IP broadcast reception).
This commit is contained in:
parent
b903b7257b
commit
aff1916a03
|
@ -186,7 +186,7 @@ class LiteEthIPV4Depacketizer(Depacketizer):
|
||||||
|
|
||||||
|
|
||||||
class LiteEthIPRX(Module):
|
class LiteEthIPRX(Module):
|
||||||
def __init__(self, mac_address, ip_address, dw=8):
|
def __init__(self, mac_address, ip_address, with_broadcast=True, dw=8):
|
||||||
self.sink = sink = stream.Endpoint(eth_mac_description(dw))
|
self.sink = sink = stream.Endpoint(eth_mac_description(dw))
|
||||||
self.source = source = stream.Endpoint(eth_ipv4_user_description(dw))
|
self.source = source = stream.Endpoint(eth_ipv4_user_description(dw))
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ class LiteEthIPRX(Module):
|
||||||
fsm.act("IDLE",
|
fsm.act("IDLE",
|
||||||
If(depacketizer.source.valid & checksum.done,
|
If(depacketizer.source.valid & checksum.done,
|
||||||
NextState("DROP"),
|
NextState("DROP"),
|
||||||
If((depacketizer.source.target_ip == ip_address) &
|
If(((depacketizer.source.target_ip == ip_address) | with_broadcast) &
|
||||||
(depacketizer.source.version == 0x4) &
|
(depacketizer.source.version == 0x4) &
|
||||||
(depacketizer.source.ihl == 0x5) &
|
(depacketizer.source.ihl == 0x5) &
|
||||||
(checksum.value == 0),
|
(checksum.value == 0),
|
||||||
|
@ -247,9 +247,9 @@ class LiteEthIPRX(Module):
|
||||||
# IP -----------------------------------------------------------------------------------------------
|
# IP -----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class LiteEthIP(Module):
|
class LiteEthIP(Module):
|
||||||
def __init__(self, mac, mac_address, ip_address, arp_table, dw=8):
|
def __init__(self, mac, mac_address, ip_address, arp_table, with_broadcast=True, dw=8):
|
||||||
self.submodules.tx = tx = LiteEthIPTX(mac_address, ip_address, arp_table, dw=dw)
|
self.submodules.tx = tx = LiteEthIPTX(mac_address, ip_address, arp_table, dw=dw)
|
||||||
self.submodules.rx = rx = LiteEthIPRX(mac_address, ip_address, dw=dw)
|
self.submodules.rx = rx = LiteEthIPRX(mac_address, ip_address, with_broadcast, dw=dw)
|
||||||
mac_port = mac.crossbar.get_port(ethernet_type_ip, dw)
|
mac_port = mac.crossbar.get_port(ethernet_type_ip, dw)
|
||||||
self.comb += [
|
self.comb += [
|
||||||
tx.source.connect(mac_port.sink),
|
tx.source.connect(mac_port.sink),
|
||||||
|
|
Loading…
Reference in New Issue