diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2009-05-19 01:19:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-19 01:19:19 -0400 |
commit | 93f154b594fe47e4a7e5358b309add449a046cd3 (patch) | |
tree | 479d9f2db25922a2312547c97e73d5a11b68bb1c /drivers/net | |
parent | 496a60cdcd5d0d884dddf6c3b4ea912923a70f13 (diff) |
net: release dst entry in dev_hard_start_xmit()
One point of contention in high network loads is the dst_release() performed
when a transmited skb is freed. This is because NIC tx completion calls
dev_kree_skb() long after original call to dev_queue_xmit(skb).
CPU cache is cold and the atomic op in dst_release() stalls. On SMP, this is
quite visible if one CPU is 100% handling softirqs for a network device,
since dst_clone() is done by other cpus, involving cache line ping pongs.
It seems right place to release dst is in dev_hard_start_xmit(), for most
devices but ones that are virtual, and some exceptions.
David Miller suggested to define a new device flag, set in alloc_netdev_mq()
(so that most devices set it at init time), and carefuly unset in devices
which dont want a NULL skb->dst in their ndo_start_xmit().
List of devices that must clear this flag is :
- loopback device, because it calls netif_rx() and quoting Patrick :
"ip_route_input() doesn't accept loopback addresses, so loopback packets
already need to have a dst_entry attached."
- appletalk/ipddp.c : needs skb->dst in its xmit function
- And all devices that call again dev_queue_xmit() from their xmit function
(as some classifiers need skb->dst) : bonding, vlan, macvlan, eql, ifb, hdlc_fr
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/appletalk/ipddp.c | 1 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 1 | ||||
-rw-r--r-- | drivers/net/eql.c | 1 | ||||
-rw-r--r-- | drivers/net/ifb.c | 1 | ||||
-rw-r--r-- | drivers/net/loopback.c | 1 | ||||
-rw-r--r-- | drivers/net/macvlan.c | 1 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_fr.c | 1 |
7 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c index da64ba88d7f8..f939e92fcf8a 100644 --- a/drivers/net/appletalk/ipddp.c +++ b/drivers/net/appletalk/ipddp.c | |||
@@ -71,6 +71,7 @@ static struct net_device * __init ipddp_init(void) | |||
71 | if (!dev) | 71 | if (!dev) |
72 | return ERR_PTR(-ENOMEM); | 72 | return ERR_PTR(-ENOMEM); |
73 | 73 | ||
74 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | ||
74 | strcpy(dev->name, "ipddp%d"); | 75 | strcpy(dev->name, "ipddp%d"); |
75 | 76 | ||
76 | if (version_printed++ == 0) | 77 | if (version_printed++ == 0) |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 96d7689995cd..92a9d69c5650 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -5148,6 +5148,7 @@ int bond_create(char *name, struct bond_params *params) | |||
5148 | goto out_rtnl; | 5148 | goto out_rtnl; |
5149 | } | 5149 | } |
5150 | 5150 | ||
5151 | bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | ||
5151 | if (!name) { | 5152 | if (!name) { |
5152 | res = dev_alloc_name(bond_dev, "bond%d"); | 5153 | res = dev_alloc_name(bond_dev, "bond%d"); |
5153 | if (res < 0) | 5154 | if (res < 0) |
diff --git a/drivers/net/eql.c b/drivers/net/eql.c index 5210bb1027cc..19b7dd983944 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c | |||
@@ -194,6 +194,7 @@ static void __init eql_setup(struct net_device *dev) | |||
194 | 194 | ||
195 | dev->type = ARPHRD_SLIP; | 195 | dev->type = ARPHRD_SLIP; |
196 | dev->tx_queue_len = 5; /* Hands them off fast */ | 196 | dev->tx_queue_len = 5; /* Hands them off fast */ |
197 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | ||
197 | } | 198 | } |
198 | 199 | ||
199 | static int eql_open(struct net_device *dev) | 200 | static int eql_open(struct net_device *dev) |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 60a263001933..96713ef06298 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -156,6 +156,7 @@ static void ifb_setup(struct net_device *dev) | |||
156 | 156 | ||
157 | dev->flags |= IFF_NOARP; | 157 | dev->flags |= IFF_NOARP; |
158 | dev->flags &= ~IFF_MULTICAST; | 158 | dev->flags &= ~IFF_MULTICAST; |
159 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | ||
159 | random_ether_addr(dev->dev_addr); | 160 | random_ether_addr(dev->dev_addr); |
160 | } | 161 | } |
161 | 162 | ||
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 6f71157bea8e..da472c687481 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -170,6 +170,7 @@ static void loopback_setup(struct net_device *dev) | |||
170 | dev->tx_queue_len = 0; | 170 | dev->tx_queue_len = 0; |
171 | dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ | 171 | dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ |
172 | dev->flags = IFF_LOOPBACK; | 172 | dev->flags = IFF_LOOPBACK; |
173 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | ||
173 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | 174 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
174 | | NETIF_F_TSO | 175 | | NETIF_F_TSO |
175 | | NETIF_F_NO_CSUM | 176 | | NETIF_F_NO_CSUM |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 329cd50d0e29..d5334b41e4b4 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -414,6 +414,7 @@ static void macvlan_setup(struct net_device *dev) | |||
414 | { | 414 | { |
415 | ether_setup(dev); | 415 | ether_setup(dev); |
416 | 416 | ||
417 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | ||
417 | dev->netdev_ops = &macvlan_netdev_ops; | 418 | dev->netdev_ops = &macvlan_netdev_ops; |
418 | dev->destructor = free_netdev; | 419 | dev->destructor = free_netdev; |
419 | dev->header_ops = &macvlan_hard_header_ops, | 420 | dev->header_ops = &macvlan_hard_header_ops, |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 800530101093..bfa0161a02d3 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -1054,6 +1054,7 @@ static void pvc_setup(struct net_device *dev) | |||
1054 | dev->flags = IFF_POINTOPOINT; | 1054 | dev->flags = IFF_POINTOPOINT; |
1055 | dev->hard_header_len = 10; | 1055 | dev->hard_header_len = 10; |
1056 | dev->addr_len = 2; | 1056 | dev->addr_len = 2; |
1057 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | ||
1057 | } | 1058 | } |
1058 | 1059 | ||
1059 | static const struct net_device_ops pvc_ops = { | 1060 | static const struct net_device_ops pvc_ops = { |