Skip to content

Commit d0f5c70

Browse files
Mahesh Bandewardavem330
authored andcommitted
ipvlan: fix device features
Processing NETDEV_FEAT_CHANGE causes IPvlan links to lose NETIF_F_LLTX feature because of the incorrect handling of features in ipvlan_fix_features(). --before-- lpaa10:~# ethtool -k ipvl0 | grep tx-lockless tx-lockless: on [fixed] lpaa10:~# ethtool -K ipvl0 tso off Cannot change tcp-segmentation-offload Actual changes: vlan-challenged: off [fixed] tx-lockless: off [fixed] lpaa10:~# ethtool -k ipvl0 | grep tx-lockless tx-lockless: off [fixed] lpaa10:~# --after-- lpaa10:~# ethtool -k ipvl0 | grep tx-lockless tx-lockless: on [fixed] lpaa10:~# ethtool -K ipvl0 tso off Cannot change tcp-segmentation-offload Could not change any device features lpaa10:~# ethtool -k ipvl0 | grep tx-lockless tx-lockless: on [fixed] lpaa10:~# Fixes: 2ad7bf3 ("ipvlan: Initial check-in of the IPVLAN driver.") Signed-off-by: Mahesh Bandewar <[email protected]> Cc: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8327070 commit d0f5c70

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

drivers/net/ipvlan/ipvlan_main.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,21 @@ static void ipvlan_port_destroy(struct net_device *dev)
106106
kfree(port);
107107
}
108108

109+
#define IPVLAN_ALWAYS_ON_OFLOADS \
110+
(NETIF_F_SG | NETIF_F_HW_CSUM | \
111+
NETIF_F_GSO_ROBUST | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL)
112+
113+
#define IPVLAN_ALWAYS_ON \
114+
(IPVLAN_ALWAYS_ON_OFLOADS | NETIF_F_LLTX | NETIF_F_VLAN_CHALLENGED)
115+
109116
#define IPVLAN_FEATURES \
110-
(NETIF_F_SG | NETIF_F_CSUM_MASK | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
117+
(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
111118
NETIF_F_GSO | NETIF_F_ALL_TSO | NETIF_F_GSO_ROBUST | \
112119
NETIF_F_GRO | NETIF_F_RXCSUM | \
113120
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)
114121

122+
/* NETIF_F_GSO_ENCAP_ALL NETIF_F_GSO_SOFTWARE Newly added */
123+
115124
#define IPVLAN_STATE_MASK \
116125
((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
117126

@@ -125,7 +134,9 @@ static int ipvlan_init(struct net_device *dev)
125134
dev->state = (dev->state & ~IPVLAN_STATE_MASK) |
126135
(phy_dev->state & IPVLAN_STATE_MASK);
127136
dev->features = phy_dev->features & IPVLAN_FEATURES;
128-
dev->features |= NETIF_F_LLTX | NETIF_F_VLAN_CHALLENGED;
137+
dev->features |= IPVLAN_ALWAYS_ON;
138+
dev->vlan_features = phy_dev->vlan_features & IPVLAN_FEATURES;
139+
dev->vlan_features |= IPVLAN_ALWAYS_ON_OFLOADS;
129140
dev->hw_enc_features |= dev->features;
130141
dev->gso_max_size = phy_dev->gso_max_size;
131142
dev->gso_max_segs = phy_dev->gso_max_segs;
@@ -227,7 +238,14 @@ static netdev_features_t ipvlan_fix_features(struct net_device *dev,
227238
{
228239
struct ipvl_dev *ipvlan = netdev_priv(dev);
229240

230-
return features & (ipvlan->sfeatures | ~IPVLAN_FEATURES);
241+
features |= NETIF_F_ALL_FOR_ALL;
242+
features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES);
243+
features = netdev_increment_features(ipvlan->phy_dev->features,
244+
features, features);
245+
features |= IPVLAN_ALWAYS_ON;
246+
features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON);
247+
248+
return features;
231249
}
232250

233251
static void ipvlan_change_rx_flags(struct net_device *dev, int change)
@@ -734,10 +752,9 @@ static int ipvlan_device_event(struct notifier_block *unused,
734752

735753
case NETDEV_FEAT_CHANGE:
736754
list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
737-
ipvlan->dev->features = dev->features & IPVLAN_FEATURES;
738755
ipvlan->dev->gso_max_size = dev->gso_max_size;
739756
ipvlan->dev->gso_max_segs = dev->gso_max_segs;
740-
netdev_features_change(ipvlan->dev);
757+
netdev_update_features(ipvlan->dev);
741758
}
742759
break;
743760

0 commit comments

Comments
 (0)