@@ -1468,97 +1468,6 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
14681468 return features ;
14691469}
14701470
1471- #define BOND_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
1472- NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
1473- NETIF_F_GSO_ENCAP_ALL | \
1474- NETIF_F_HIGHDMA | NETIF_F_LRO)
1475-
1476- #define BOND_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
1477- NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE | \
1478- NETIF_F_GSO_PARTIAL)
1479-
1480- #define BOND_MPLS_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
1481- NETIF_F_GSO_SOFTWARE)
1482-
1483- #define BOND_GSO_PARTIAL_FEATURES (NETIF_F_GSO_ESP)
1484-
1485-
1486- static void bond_compute_features (struct bonding * bond )
1487- {
1488- netdev_features_t gso_partial_features = BOND_GSO_PARTIAL_FEATURES ;
1489- unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
1490- IFF_XMIT_DST_RELEASE_PERM ;
1491- netdev_features_t vlan_features = BOND_VLAN_FEATURES ;
1492- netdev_features_t enc_features = BOND_ENC_FEATURES ;
1493- #ifdef CONFIG_XFRM_OFFLOAD
1494- netdev_features_t xfrm_features = BOND_XFRM_FEATURES ;
1495- #endif /* CONFIG_XFRM_OFFLOAD */
1496- netdev_features_t mpls_features = BOND_MPLS_FEATURES ;
1497- struct net_device * bond_dev = bond -> dev ;
1498- struct list_head * iter ;
1499- struct slave * slave ;
1500- unsigned short max_hard_header_len = ETH_HLEN ;
1501- unsigned int tso_max_size = TSO_MAX_SIZE ;
1502- u16 tso_max_segs = TSO_MAX_SEGS ;
1503-
1504- if (!bond_has_slaves (bond ))
1505- goto done ;
1506-
1507- vlan_features = netdev_base_features (vlan_features );
1508- mpls_features = netdev_base_features (mpls_features );
1509-
1510- bond_for_each_slave (bond , slave , iter ) {
1511- vlan_features = netdev_increment_features (vlan_features ,
1512- slave -> dev -> vlan_features , BOND_VLAN_FEATURES );
1513-
1514- enc_features = netdev_increment_features (enc_features ,
1515- slave -> dev -> hw_enc_features ,
1516- BOND_ENC_FEATURES );
1517-
1518- #ifdef CONFIG_XFRM_OFFLOAD
1519- xfrm_features = netdev_increment_features (xfrm_features ,
1520- slave -> dev -> hw_enc_features ,
1521- BOND_XFRM_FEATURES );
1522- #endif /* CONFIG_XFRM_OFFLOAD */
1523-
1524- gso_partial_features = netdev_increment_features (gso_partial_features ,
1525- slave -> dev -> gso_partial_features ,
1526- BOND_GSO_PARTIAL_FEATURES );
1527-
1528- mpls_features = netdev_increment_features (mpls_features ,
1529- slave -> dev -> mpls_features ,
1530- BOND_MPLS_FEATURES );
1531-
1532- dst_release_flag &= slave -> dev -> priv_flags ;
1533- if (slave -> dev -> hard_header_len > max_hard_header_len )
1534- max_hard_header_len = slave -> dev -> hard_header_len ;
1535-
1536- tso_max_size = min (tso_max_size , slave -> dev -> tso_max_size );
1537- tso_max_segs = min (tso_max_segs , slave -> dev -> tso_max_segs );
1538- }
1539- bond_dev -> hard_header_len = max_hard_header_len ;
1540-
1541- done :
1542- bond_dev -> gso_partial_features = gso_partial_features ;
1543- bond_dev -> vlan_features = vlan_features ;
1544- bond_dev -> hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
1545- NETIF_F_HW_VLAN_CTAG_TX |
1546- NETIF_F_HW_VLAN_STAG_TX ;
1547- #ifdef CONFIG_XFRM_OFFLOAD
1548- bond_dev -> hw_enc_features |= xfrm_features ;
1549- #endif /* CONFIG_XFRM_OFFLOAD */
1550- bond_dev -> mpls_features = mpls_features ;
1551- netif_set_tso_max_segs (bond_dev , tso_max_segs );
1552- netif_set_tso_max_size (bond_dev , tso_max_size );
1553-
1554- bond_dev -> priv_flags &= ~IFF_XMIT_DST_RELEASE ;
1555- if ((bond_dev -> priv_flags & IFF_XMIT_DST_RELEASE_PERM ) &&
1556- dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM ))
1557- bond_dev -> priv_flags |= IFF_XMIT_DST_RELEASE ;
1558-
1559- netdev_change_features (bond_dev );
1560- }
1561-
15621471static void bond_setup_by_slave (struct net_device * bond_dev ,
15631472 struct net_device * slave_dev )
15641473{
@@ -2311,7 +2220,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
23112220 }
23122221
23132222 bond -> slave_cnt ++ ;
2314- bond_compute_features (bond );
2223+ netdev_compute_master_upper_features (bond -> dev , true );
23152224 bond_set_carrier (bond );
23162225
23172226 /* Needs to be called before bond_select_active_slave(), which will
@@ -2563,7 +2472,7 @@ static int __bond_release_one(struct net_device *bond_dev,
25632472 call_netdevice_notifiers (NETDEV_RELEASE , bond -> dev );
25642473 }
25652474
2566- bond_compute_features (bond );
2475+ netdev_compute_master_upper_features (bond -> dev , true );
25672476 if (!(bond_dev -> features & NETIF_F_VLAN_CHALLENGED ) &&
25682477 (old_features & NETIF_F_VLAN_CHALLENGED ))
25692478 slave_info (bond_dev , slave_dev , "last VLAN challenged slave left bond - VLAN blocking is removed\n" );
@@ -4065,7 +3974,7 @@ static int bond_slave_netdev_event(unsigned long event,
40653974 case NETDEV_FEAT_CHANGE :
40663975 if (!bond -> notifier_ctx ) {
40673976 bond -> notifier_ctx = true;
4068- bond_compute_features (bond );
3977+ netdev_compute_master_upper_features (bond -> dev , true );
40693978 bond -> notifier_ctx = false;
40703979 }
40713980 break ;
@@ -6081,7 +5990,7 @@ void bond_setup(struct net_device *bond_dev)
60815990 /* Don't allow bond devices to change network namespaces. */
60825991 bond_dev -> features |= NETIF_F_NETNS_LOCAL ;
60835992
6084- bond_dev -> hw_features = BOND_VLAN_FEATURES |
5993+ bond_dev -> hw_features = MASTER_UPPER_DEV_VLAN_FEATURES |
60855994 NETIF_F_HW_VLAN_CTAG_RX |
60865995 NETIF_F_HW_VLAN_CTAG_FILTER |
60875996 NETIF_F_HW_VLAN_STAG_RX |
0 commit comments