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):
|
||||
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.source = source = stream.Endpoint(eth_ipv4_user_description(dw))
|
||||
|
||||
|
@ -209,7 +209,7 @@ class LiteEthIPRX(Module):
|
|||
fsm.act("IDLE",
|
||||
If(depacketizer.source.valid & checksum.done,
|
||||
NextState("DROP"),
|
||||
If((depacketizer.source.target_ip == ip_address) &
|
||||
If(((depacketizer.source.target_ip == ip_address) | with_broadcast) &
|
||||
(depacketizer.source.version == 0x4) &
|
||||
(depacketizer.source.ihl == 0x5) &
|
||||
(checksum.value == 0),
|
||||
|
@ -247,9 +247,9 @@ class LiteEthIPRX(Module):
|
|||
# IP -----------------------------------------------------------------------------------------------
|
||||
|
||||
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.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)
|
||||
self.comb += [
|
||||
tx.source.connect(mac_port.sink),
|
||||
|
|
Loading…
Reference in New Issue