hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/net/team/team.c
....@@ -1624,6 +1624,7 @@
16241624
16251625 team->dev = dev;
16261626 team_set_no_mode(team);
1627
+ team->notifier_ctx = false;
16271628
16281629 team->pcpu_stats = netdev_alloc_pcpu_stats(struct team_pcpu_stats);
16291630 if (!team->pcpu_stats)
....@@ -2121,7 +2122,12 @@
21212122 static void team_setup_by_port(struct net_device *dev,
21222123 struct net_device *port_dev)
21232124 {
2124
- dev->header_ops = port_dev->header_ops;
2125
+ struct team *team = netdev_priv(dev);
2126
+
2127
+ if (port_dev->type == ARPHRD_ETHER)
2128
+ dev->header_ops = team->header_ops_cache;
2129
+ else
2130
+ dev->header_ops = port_dev->header_ops;
21252131 dev->type = port_dev->type;
21262132 dev->hard_header_len = port_dev->hard_header_len;
21272133 dev->needed_headroom = port_dev->needed_headroom;
....@@ -2129,6 +2135,15 @@
21292135 dev->mtu = port_dev->mtu;
21302136 memcpy(dev->broadcast, port_dev->broadcast, port_dev->addr_len);
21312137 eth_hw_addr_inherit(dev, port_dev);
2138
+
2139
+ if (port_dev->flags & IFF_POINTOPOINT) {
2140
+ dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);
2141
+ dev->flags |= (IFF_POINTOPOINT | IFF_NOARP);
2142
+ } else if ((port_dev->flags & (IFF_BROADCAST | IFF_MULTICAST)) ==
2143
+ (IFF_BROADCAST | IFF_MULTICAST)) {
2144
+ dev->flags |= (IFF_BROADCAST | IFF_MULTICAST);
2145
+ dev->flags &= ~(IFF_POINTOPOINT | IFF_NOARP);
2146
+ }
21322147 }
21332148
21342149 static int team_dev_type_check_change(struct net_device *dev,
....@@ -2159,8 +2174,11 @@
21592174
21602175 static void team_setup(struct net_device *dev)
21612176 {
2177
+ struct team *team = netdev_priv(dev);
2178
+
21622179 ether_setup(dev);
21632180 dev->max_mtu = ETH_MAX_MTU;
2181
+ team->header_ops_cache = dev->header_ops;
21642182
21652183 dev->netdev_ops = &team_netdev_ops;
21662184 dev->ethtool_ops = &team_ethtool_ops;
....@@ -2185,7 +2203,9 @@
21852203
21862204 dev->hw_features = TEAM_VLAN_FEATURES |
21872205 NETIF_F_HW_VLAN_CTAG_RX |
2188
- NETIF_F_HW_VLAN_CTAG_FILTER;
2206
+ NETIF_F_HW_VLAN_CTAG_FILTER |
2207
+ NETIF_F_HW_VLAN_STAG_RX |
2208
+ NETIF_F_HW_VLAN_STAG_FILTER;
21892209
21902210 dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
21912211 dev->features |= dev->hw_features;
....@@ -3016,7 +3036,11 @@
30163036 team_del_slave(port->team->dev, dev);
30173037 break;
30183038 case NETDEV_FEAT_CHANGE:
3019
- team_compute_features(port->team);
3039
+ if (!port->team->notifier_ctx) {
3040
+ port->team->notifier_ctx = true;
3041
+ team_compute_features(port->team);
3042
+ port->team->notifier_ctx = false;
3043
+ }
30203044 break;
30213045 case NETDEV_PRECHANGEMTU:
30223046 /* Forbid to change mtu of underlaying device */