Page MenuHomeFreeBSD

e1000: fix interface capabilities management
ClosedPublic

Authored by vmaffione on Nov 28 2021, 10:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 1:05 PM
Unknown Object (File)
Sep 30 2024, 11:28 PM
Unknown Object (File)
Sep 24 2024, 6:06 PM
Unknown Object (File)
Sep 24 2024, 6:06 PM
Unknown Object (File)
Sep 24 2024, 6:06 PM
Unknown Object (File)
Sep 24 2024, 6:06 PM
Unknown Object (File)
Sep 21 2024, 4:41 AM
Unknown Object (File)
Sep 17 2024, 11:45 AM
Subscribers

Details

Summary

The e1000 drivers (em, lem, igb) are currently looking at the
iflib copies of the capabilities bitvectors (scctx->isc_capabilities
and scctx->isc_capenable) rather than the ifnet ones
(ifp->if_capabilities and ifp->if_capenable). However, the latter
are the ones that are actually updated by ifconfig and that should
be used by the drivers during interface operation. The former are
set by the driver on interface attach (for iflib internal use)
and should not be used anymore by the driver.
This patch fixes the e1000 driver to use the correct bitvectors.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Could you please upload a diff with context?

Doesn't this change need to go further? I see some uses of isc_capenable in the data path, e.g., in igb_isc_rxd_pkt_get(), why do we not go to the ifp there? I'd guess it's to avoid extra memory accesses, but we do query the ifp capenable flags in some places.

I also wonder why exactly iflib maintains its own capenable bitset, and why SIOCSIFCAP doesn't modify it.

sys/dev/e1000/if_em.c
929

Stray newline.

Indeed. I had put the changes to igb in a separate review: https://reviews.freebsd.org/D33156

Regarding the iflib private copies of capabilities (isc_capenable and isc_capabilities), it's also a bit unclear to me why those are necessary. It looks they're mostly used to pass the info from the driver to iflib, so that iflib can call if_setcapabilities() and if_setcapenable().
I guess SIOCSIFCAP could update them to align to if_capenable and if_capabilities. That could be useful to avoid an additional indirection in the drivers.

Indeed. I had put the changes to igb in a separate review: https://reviews.freebsd.org/D33156

Ah, sorry I missed it.

Regarding the iflib private copies of capabilities (isc_capenable and isc_capabilities), it's also a bit unclear to me why those are necessary. It looks they're mostly used to pass the info from the driver to iflib, so that iflib can call if_setcapabilities() and if_setcapenable().
I guess SIOCSIFCAP could update them to align to if_capenable and if_capabilities. That could be useful to avoid an additional indirection in the drivers.

I suspect that isc_capenable should just go away. This change looks like a good step forward though.

This revision is now accepted and ready to land.Dec 3 2021, 3:04 PM
sys/dev/e1000/if_em.c
929

Thanks, I'll apply this before committing