@@ -1789,6 +1789,26 @@ static void bond_ether_setup(struct net_device *bond_dev)
17891789 bond_dev -> priv_flags &= ~IFF_TX_SKB_SHARING ;
17901790}
17911791
1792+ void bond_xdp_set_features (struct net_device * bond_dev )
1793+ {
1794+ struct bonding * bond = netdev_priv (bond_dev );
1795+ xdp_features_t val = NETDEV_XDP_ACT_MASK ;
1796+ struct list_head * iter ;
1797+ struct slave * slave ;
1798+
1799+ ASSERT_RTNL ();
1800+
1801+ if (!bond_xdp_check (bond )) {
1802+ xdp_clear_features_flag (bond_dev );
1803+ return ;
1804+ }
1805+
1806+ bond_for_each_slave (bond , slave , iter )
1807+ val &= slave -> dev -> xdp_features ;
1808+
1809+ xdp_set_features_flag (bond_dev , val );
1810+ }
1811+
17921812/* enslave device <slave> to bond device <master> */
17931813int bond_enslave (struct net_device * bond_dev , struct net_device * slave_dev ,
17941814 struct netlink_ext_ack * extack )
@@ -2236,6 +2256,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
22362256 bpf_prog_inc (bond -> xdp_prog );
22372257 }
22382258
2259+ bond_xdp_set_features (bond_dev );
2260+
22392261 slave_info (bond_dev , slave_dev , "Enslaving as %s interface with %s link\n" ,
22402262 bond_is_active_slave (new_slave ) ? "an active" : "a backup" ,
22412263 new_slave -> link != BOND_LINK_DOWN ? "an up" : "a down" );
@@ -2483,6 +2505,7 @@ static int __bond_release_one(struct net_device *bond_dev,
24832505 if (!netif_is_bond_master (slave_dev ))
24842506 slave_dev -> priv_flags &= ~IFF_BONDING ;
24852507
2508+ bond_xdp_set_features (bond_dev );
24862509 kobject_put (& slave -> kobj );
24872510
24882511 return 0 ;
@@ -3930,6 +3953,9 @@ static int bond_slave_netdev_event(unsigned long event,
39303953 /* Propagate to master device */
39313954 call_netdevice_notifiers (event , slave -> bond -> dev );
39323955 break ;
3956+ case NETDEV_XDP_FEAT_CHANGE :
3957+ bond_xdp_set_features (bond_dev );
3958+ break ;
39333959 default :
39343960 break ;
39353961 }
@@ -5874,6 +5900,9 @@ void bond_setup(struct net_device *bond_dev)
58745900 if (BOND_MODE (bond ) == BOND_MODE_ACTIVEBACKUP )
58755901 bond_dev -> features |= BOND_XFRM_FEATURES ;
58765902#endif /* CONFIG_XFRM_OFFLOAD */
5903+
5904+ if (bond_xdp_check (bond ))
5905+ bond_dev -> xdp_features = NETDEV_XDP_ACT_MASK ;
58775906}
58785907
58795908/* Destroy a bonding device.
0 commit comments