Let the receive checksum offload for TCP/IPv6 and UDP/IPv6 be controlled by ifconfig rxcsum6 and not by ifconfig rxcsum.
While there, make the code more compact and improve stlye.9 conformity.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
| sys/dev/usb/net/if_ure.c | ||
|---|---|---|
| 2142 | This condition: (csum & URE_RXPKT_IPV4_CS) != 0 is checked in line 2148 again. Seems better to check this only once. | |
| 2148โ2151 | For a consistent style: if ((csum & URE_RXPKT_IPV4_CS) != 0) { | |
| 2150 | Should a __predict_true be used for this condition? | |
| sys/dev/usb/net/if_ure.c | ||
|---|---|---|
| 2142 |
That is true. But I am checking the same condition in two different contexts:
I would prefer to not mix these two things. | |
| 2148โ2151 | Makes sense, done. | |
| 2150 | Make sense. Done. | |
| sys/dev/usb/net/if_ure.c | ||
|---|---|---|
| 2142 | I would have done it like this: if ((csum & URE_RXPKT_IPV6_CS) != 0 &&
(capenb & IFCAP_RXCSUM_IPV6) == 0)
return;
if ((csum & URE_RXPKT_IPV4_CS) != 0) {
if ((capenb & IFCAP_RXCSUM) == 0)
return;
m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED;
if (__predict_true((misc & URE_RXPKT_IP_F) == 0))
m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
}If it looks too much mixed up to you, leave it as it is. | |
| sys/dev/usb/net/if_ure.c | ||
|---|---|---|
| 2142 | I see. My mental model of the code is:
Your proposal mixes 1. and 2. | |