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(-)

-- 
2.50.1


Reply via email to