FCS verification in P4 switch

How can I perform Ethernet FCS verification in P4? I have looked at many examples and I can’t find any example implementing FCS verification, is it something P4 does not handle and left to the hardware?

Most Ethernet MAC hardware on networking devices have FCS checking built into them, in what we would sometimes call a “fixed function” part of a networking device, i.e. not P4-programmable. Thus it would be duplication of effort to write code in the P4-programmable part to repeat this check.

Even if you did want to duplicate such a check, it requires examining every byte of a packet, and Ethernet jumbo frames can be up to ~9 KBytes long. Given that P4 does not have loops, it would be inconvenient (not quite impossible) to write code without loops that works for all packet lengths.

1 Like

Does BMv2 simple switch have FCS checking built into it?

How can we control the switching technique between “cut through” and “store and forward” in P4 switches?

BMv2 does not do FCS checking on received frames, but physical Ethernet ports typically do (unless you somehow disable it). For software veth ports I do not know whether they check FCS or not. Since they are memory-to-memory copies of packets, probably FCS is not even generated in the first place?

There is no standard target-independent way to control cut through vs store-and-forward in all P4-programmable switches. Some devices can switch between those, some only implement store-and-forward. I am pretty sure that BMv2 only does store-and-forward, for example.

1 Like