aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-10-05 21:38:35 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-07 13:22:11 -0400
commit0287587884b15041203b3a362d485e1ab1f24445 (patch)
tree675ae57663c1ba3ee8768e65e7fb0e6d0259e04c /drivers
parentfe971b95c22578456ff7198537827841c726d3f7 (diff)
net: better IFF_XMIT_DST_RELEASE support
Testing xmit_more support with netperf and connected UDP sockets, I found strange dst refcount false sharing. Current handling of IFF_XMIT_DST_RELEASE is not optimal. Dropping dst in validate_xmit_skb() is certainly too late in case packet was queued by cpu X but dequeued by cpu Y The logical point to take care of drop/force is in __dev_queue_xmit() before even taking qdisc lock. As Julian Anastasov pointed out, need for skb_dst() might come from some packet schedulers or classifiers. This patch adds new helper to cleanly express needs of various drivers or qdiscs/classifiers. Drivers that need skb_dst() in their ndo_start_xmit() should call following helper in their setup instead of the prior : dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; -> netif_keep_dst(dev); Instead of using a single bit, we use two bits, one being eventually rebuilt in bonding/team drivers. The other one, is permanent and blocks IFF_XMIT_DST_RELEASE being rebuilt in bonding/team. Eventually, we could add something smarter later. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Julian Anastasov <ja@ssi.bg> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c2
-rw-r--r--drivers/net/appletalk/ipddp.c2
-rw-r--r--drivers/net/bonding/bond_main.c9
-rw-r--r--drivers/net/eql.c2
-rw-r--r--drivers/net/ifb.c3
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/macvlan.c3
-rw-r--r--drivers/net/ppp/ppp_generic.c2
-rw-r--r--drivers/net/team/team.c8
-rw-r--r--drivers/net/vxlan.c2
-rw-r--r--drivers/net/wan/hdlc_fr.c2
-rw-r--r--drivers/s390/net/qeth_l3_main.c2
12 files changed, 23 insertions, 16 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 13e6e0431592..58b5aa3b6f2d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1364,7 +1364,7 @@ void ipoib_setup(struct net_device *dev)
1364 dev->tx_queue_len = ipoib_sendq_size * 2; 1364 dev->tx_queue_len = ipoib_sendq_size * 2;
1365 dev->features = (NETIF_F_VLAN_CHALLENGED | 1365 dev->features = (NETIF_F_VLAN_CHALLENGED |
1366 NETIF_F_HIGHDMA); 1366 NETIF_F_HIGHDMA);
1367 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1367 netif_keep_dst(dev);
1368 1368
1369 memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN); 1369 memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN);
1370 1370
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
index 10d0dba572c2..e90c6a7333d7 100644
--- a/drivers/net/appletalk/ipddp.c
+++ b/drivers/net/appletalk/ipddp.c
@@ -74,7 +74,7 @@ static struct net_device * __init ipddp_init(void)
74 if (!dev) 74 if (!dev)
75 return ERR_PTR(-ENOMEM); 75 return ERR_PTR(-ENOMEM);
76 76
77 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 77 netif_keep_dst(dev);
78 strcpy(dev->name, "ipddp%d"); 78 strcpy(dev->name, "ipddp%d");
79 79
80 if (version_printed++ == 0) 80 if (version_printed++ == 0)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3ad5413d4f57..c9ac06cfe6b7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1002,7 +1002,8 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
1002 1002
1003static void bond_compute_features(struct bonding *bond) 1003static void bond_compute_features(struct bonding *bond)
1004{ 1004{
1005 unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; 1005 unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
1006 IFF_XMIT_DST_RELEASE_PERM;
1006 netdev_features_t vlan_features = BOND_VLAN_FEATURES; 1007 netdev_features_t vlan_features = BOND_VLAN_FEATURES;
1007 netdev_features_t enc_features = BOND_ENC_FEATURES; 1008 netdev_features_t enc_features = BOND_ENC_FEATURES;
1008 struct net_device *bond_dev = bond->dev; 1009 struct net_device *bond_dev = bond->dev;
@@ -1038,8 +1039,10 @@ done:
1038 bond_dev->gso_max_segs = gso_max_segs; 1039 bond_dev->gso_max_segs = gso_max_segs;
1039 netif_set_gso_max_size(bond_dev, gso_max_size); 1040 netif_set_gso_max_size(bond_dev, gso_max_size);
1040 1041
1041 flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE; 1042 bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
1042 bond_dev->priv_flags = flags | dst_release_flag; 1043 if ((bond_dev->priv_flags & IFF_XMIT_DST_RELEASE_PERM) &&
1044 dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM))
1045 bond_dev->priv_flags |= IFF_XMIT_DST_RELEASE;
1043 1046
1044 netdev_change_features(bond_dev); 1047 netdev_change_features(bond_dev);
1045} 1048}
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index 957e5c0cede3..a10ad74cc8d2 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -199,7 +199,7 @@ static void __init eql_setup(struct net_device *dev)
199 199
200 dev->type = ARPHRD_SLIP; 200 dev->type = ARPHRD_SLIP;
201 dev->tx_queue_len = 5; /* Hands them off fast */ 201 dev->tx_queue_len = 5; /* Hands them off fast */
202 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 202 netif_keep_dst(dev);
203} 203}
204 204
205static int eql_open(struct net_device *dev) 205static int eql_open(struct net_device *dev)
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index d2d4a3d2237f..34f846b4bd05 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -185,7 +185,8 @@ static void ifb_setup(struct net_device *dev)
185 185
186 dev->flags |= IFF_NOARP; 186 dev->flags |= IFF_NOARP;
187 dev->flags &= ~IFF_MULTICAST; 187 dev->flags &= ~IFF_MULTICAST;
188 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); 188 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
189 netif_keep_dst(dev);
189 eth_hw_addr_random(dev); 190 eth_hw_addr_random(dev);
190} 191}
191 192
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 8f2262540561..c76283c2f84a 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -169,7 +169,7 @@ static void loopback_setup(struct net_device *dev)
169 dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ 169 dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
170 dev->flags = IFF_LOOPBACK; 170 dev->flags = IFF_LOOPBACK;
171 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 171 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
172 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 172 netif_keep_dst(dev);
173 dev->hw_features = NETIF_F_ALL_TSO | NETIF_F_UFO; 173 dev->hw_features = NETIF_F_ALL_TSO | NETIF_F_UFO;
174 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST 174 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
175 | NETIF_F_ALL_TSO 175 | NETIF_F_ALL_TSO
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index e8a453f1b458..38b4fae61f04 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -1025,7 +1025,8 @@ void macvlan_common_setup(struct net_device *dev)
1025{ 1025{
1026 ether_setup(dev); 1026 ether_setup(dev);
1027 1027
1028 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); 1028 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
1029 netif_keep_dst(dev);
1029 dev->priv_flags |= IFF_UNICAST_FLT; 1030 dev->priv_flags |= IFF_UNICAST_FLT;
1030 dev->netdev_ops = &macvlan_netdev_ops; 1031 dev->netdev_ops = &macvlan_netdev_ops;
1031 dev->destructor = free_netdev; 1032 dev->destructor = free_netdev;
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index fa0d71727894..80e6f3430f65 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1103,7 +1103,7 @@ static void ppp_setup(struct net_device *dev)
1103 dev->type = ARPHRD_PPP; 1103 dev->type = ARPHRD_PPP;
1104 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; 1104 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
1105 dev->features |= NETIF_F_NETNS_LOCAL; 1105 dev->features |= NETIF_F_NETNS_LOCAL;
1106 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1106 netif_keep_dst(dev);
1107} 1107}
1108 1108
1109/* 1109/*
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 2277c3679a51..a94a9df3e6bd 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -970,7 +970,8 @@ static void __team_compute_features(struct team *team)
970 struct team_port *port; 970 struct team_port *port;
971 u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL; 971 u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
972 unsigned short max_hard_header_len = ETH_HLEN; 972 unsigned short max_hard_header_len = ETH_HLEN;
973 unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; 973 unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
974 IFF_XMIT_DST_RELEASE_PERM;
974 975
975 list_for_each_entry(port, &team->port_list, list) { 976 list_for_each_entry(port, &team->port_list, list) {
976 vlan_features = netdev_increment_features(vlan_features, 977 vlan_features = netdev_increment_features(vlan_features,
@@ -985,8 +986,9 @@ static void __team_compute_features(struct team *team)
985 team->dev->vlan_features = vlan_features; 986 team->dev->vlan_features = vlan_features;
986 team->dev->hard_header_len = max_hard_header_len; 987 team->dev->hard_header_len = max_hard_header_len;
987 988
988 flags = team->dev->priv_flags & ~IFF_XMIT_DST_RELEASE; 989 team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
989 team->dev->priv_flags = flags | dst_release_flag; 990 if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM))
991 team->dev->priv_flags |= IFF_XMIT_DST_RELEASE;
990 992
991 netdev_change_features(team->dev); 993 netdev_change_features(team->dev);
992} 994}
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 2af795d6ba05..2a51e6e48e1e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2193,7 +2193,7 @@ static void vxlan_setup(struct net_device *dev)
2193 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; 2193 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
2194 dev->hw_features |= NETIF_F_GSO_SOFTWARE; 2194 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
2195 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; 2195 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
2196 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 2196 netif_keep_dst(dev);
2197 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 2197 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
2198 2198
2199 INIT_LIST_HEAD(&vxlan->next); 2199 INIT_LIST_HEAD(&vxlan->next);
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index e5c7e6165a4b..3ebed1c40abb 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -1047,7 +1047,7 @@ static void pvc_setup(struct net_device *dev)
1047 dev->flags = IFF_POINTOPOINT; 1047 dev->flags = IFF_POINTOPOINT;
1048 dev->hard_header_len = 10; 1048 dev->hard_header_len = 10;
1049 dev->addr_len = 2; 1049 dev->addr_len = 2;
1050 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1050 netif_keep_dst(dev);
1051} 1051}
1052 1052
1053static const struct net_device_ops pvc_ops = { 1053static const struct net_device_ops pvc_ops = {
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index f8427a2c4840..afebb9709763 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -3306,7 +3306,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
3306 card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX | 3306 card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX |
3307 NETIF_F_HW_VLAN_CTAG_RX | 3307 NETIF_F_HW_VLAN_CTAG_RX |
3308 NETIF_F_HW_VLAN_CTAG_FILTER; 3308 NETIF_F_HW_VLAN_CTAG_FILTER;
3309 card->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 3309 netif_keep_dst(card->dev);
3310 card->dev->gso_max_size = 15 * PAGE_SIZE; 3310 card->dev->gso_max_size = 15 * PAGE_SIZE;
3311 3311
3312 SET_NETDEV_DEV(card->dev, &card->gdev->dev); 3312 SET_NETDEV_DEV(card->dev, &card->gdev->dev);