Skip to content

RFC net: add ndo_update_offloads for offload computation

Hangbin Liu bridge lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 2 repliesIn review

Changes from the cover letter

1. Patch 1: Add ndo_update_offloads callback to net_device_ops and invoke it from __netdev_update_features()
2. Patch 2: Convert bonding, bridge, and team drivers to use the new callback, removing manual feature computation calls
3. Patch 3: Convert net_failover driver, significantly simplifying its feature management code

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net: add ndo_update_offloadsinclude/linux/netdevice.h net/core/dev.c+10 -00 replies
2/3net: use ndo_update_offloads for bonding/bridge/teamdrivers/net/bonding/bond_main.c drivers/net/team/team_core.c net/bridge/br_device.c +2 more+26 -131 reply
3/3failover: use .ndo_update_offloads for failoverdrivers/net/net_failover.c include/net/net_failover.h+6 -651 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH net-next 0/3] net: add ndo_update_offloads for offload computation

Currently, master devices (bonding, bridge, team) manually call netdev_compute_master_upper_features() scattered throughout their port add/remove operations. This approach requires each driver to remember to update features at the right times and leads to code duplication.

The series adds a new ndo_update_offloads callback that is automatically invoked during feature updates when upper/lower device relationships change. This centralizes the feature computation flow and removes the burden from individual drivers.

Changes:
1. Patch 1: Add ndo_update_offloads callback to net_device_ops and invoke it from __netdev_update_features()
2. Patch 2: Convert bonding, bridge, and team drivers to use the new callback, removing manual feature computation calls
3. Patch 3: Convert net_failover driver, significantly simplifying its feature management code

*Discuss*:
1. Should we set ndo_update_offloads after ndo_set_features? Or maybe just call netdev_compute_master_upper_features() in ndo_set_features?
2. Do we need to compute the offload feature for hsr?

Hangbin Liu (3):
net: add ndo_update_offloads
net: use ndo_update_offloads for bonding/bridge/team
failover: use .ndo_update_offloads for failover

 drivers/net/bonding/bond_main.c | 10 ++++--
 drivers/net/net_failover.c      | 64 ++++-----------------------------
 drivers/net/team/team_core.c    | 11 +++---
 include/linux/netdevice.h       |  7 ++++
 include/net/net_failover.h      |  7 ----
 net/bridge/br_device.c          |  6 ++++
 net/bridge/br_if.c              |  4 ---
 net/core/dev.c                  | 11 ++++--
 8 files changed, 42 insertions(+), 78 deletions(-)
Signature · 1 line
2.50.1