: Push TX lock down into drivers
Subsystems (30)
David Miller
maintainerPATCH 1/1 : Push TX lock down into drivers
Here is the patch I've been crunching on the past few days.
The idea is that, for all non-LLTX drivers, we move the locking down into the driver so that we can get rid of the generic netdev TX lock entirely. This will facilitate per-TX-queue locking in the drivers, or even more sophisticated lockless schemes.
The transformation is pretty straightforward:
1) Add tx_lock to driver private struct.
2) Initialize tx_lock when device private is allocated.
3) Grab tx_lock around entirety of ->hard_start_xmit() method. The most non-error-prone method to do this is:
a) Rename x_start_xmit --> __x_start_xmit b) Add new x_start_xmit which does: struct x_priv *p = netdev_priv(dev); int ret; spin_lock(&p->tx_lock); ret = __x_start_xmit(skb, dev); spin_unlock(&p->tx_lock); return ret;
It can be proven that this transformation will allow existing locking semantics to be maintained when netdev->_xmit_lock is removed.
Of course we have extra locking now in these drivers, but this is an intermediate step and in the end we'll have the same amount or less locking than we have now. And what's more, we'll have tons of flexibility which currently is not available.
This is a whopper at over 300K, so I'll likely commit this in groups of drivers. I really just wanted to have something for people to look at after putting so much time into the diff.
As mentioned, none of the LLTX drivers were touched. When we delete the ->_xmit_lock, the default semantics will be what they want. And we therefore will be able to get rid of the LLTX flag and all of that stuff.
Of the rest of the drivers, here are the ones I did not modify in this patch and why:
--------------------drivers/infiniband/hw/amso1100:drivers/isdn/hysdn:drivers/net/8139cp.c:drivers/net/amd8111e.c:drivers/net/b44.c:drivers/net/cassini.c:drivers/net/eepro100.c:drivers/net/eexpress.c:drivers/net/eql.c:drivers/net/fealnx.c:drivers/net/fec.c:drivers/net/fec_8xx/fec_main.c:drivers/net/fs_enet/fs_enet-main.c:drivers/net/hamradio/6pack.c:drivers/net/ioc3-eth.c:drivers/net/korina.c:drivers/net/lance.c:drivers/net/macb.c:drivers/net/meth.c:drivers/net/mv643xx_eth.c:drivers/net/netx-eth.c:drivers/net/pcmcia/3c574_cs.c:drivers/net/pcmcia/3c589_cs.c:drivers/net/pcnet32.c:drivers/net/ps3_gelic_net.c:drivers/net/ps3_gelic_wireless.c:drivers/net/rrunner.c:drivers/net/sb1250-mac.c:drivers/net/sc92031.c:drivers/net/sis900.c:drivers/net/sunbmac.c:drivers/net/sunhme.c:drivers/net/sunlance.c:drivers/net/sunqe.c:drivers/net/sunvnet.c:drivers/net/tc35815.c:drivers/net/tokenring/3c359.c:drivers/net/tokenring/lanstreamer.c:drivers/net/tokenring/olympic.c:drivers/net/tulip/de2104x.c:drivers/net/tulip/tulip_core.c:drivers/net/tulip/xircom_cb.c:drivers/net/ucc_geth.c:drivers/net/usb/kaweth.c:drivers/net/via-velocity.c:drivers/net/wan/lmc/lmc_main.c:drivers/net/wireless/ipw2100.c:drivers/net/wireless/ipw2200.c:drivers/net/wireless/prism54/islpci_dev.c:drivers/net/wireless/wl3501_cs.c:drivers/net/xen-netfront.c:
Holds own ->tx_lock with IRQs disabled over entire xmit handler. Could safely enable LLTX.
drivers/media/dvb/dvb-core/dvb_net.c:drivers/net/sb1000.c:drivers/net/wireless/mac80211_hwsim.c:
Has NOP TX handler, just does dev_kfree_skb(skb)
net/atm/mpc.c:
Terminally broken, both before and after the TX lock goes away. MPC lists et al. have absolutely no locking whatsoever.
--------------------
I have this "git grep -e "->hard_start_xmit" output that I audit over to make sure I hit every driver necessary. I used that to work on this patch and to form the above list.
Patch is against net-tx-2.6, and at least survives allmodconfig on sparc64 and x86 for me.
arch/ia64/hp/sim/simeth.c +16 -1
@@ -41,6 +41,7 @@#define NETWORK_INTR 8struct simeth_local { +spinlock_t tx_lock;struct net_device_stats stats;int simfd;/* descriptor in the simulator */ };
@@ -209,6 +210,8 @@ simeth_probe1(void) local = dev->priv; local->simfd = fd;/* keep track of underlying file descriptor */ +spin_lock_init (&local->tx_lock); + dev->open = simeth_open; dev->stop = simeth_close; dev->hard_start_xmit = simeth_tx;
@@ -378,7 +381,7 @@ frame_print(unsigned char *from, unsigned char *frame, int len)* going to the simulator. */ static int -simeth_tx (struct sk_buff *skb,struct net_device *dev) +__simeth_tx (struct sk_buff *skb,struct net_device *dev) {struct simeth_local *local = dev->priv;
@@ -410,6 +413,18 @@ simeth_tx(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int +simeth_tx (struct sk_buff *skb,struct net_device *dev) +{ +struct simeth_local *local = dev->priv; + +spin_lock (&local->tx_lock); + ret =__simeth_tx (skb, dev); +spin_unlock (&local->tx_lock); + +return ret; +} +static inline struct sk_buff *make_new_skb (struct net_device *dev) {
arch/ppc/8260_io/enet.c +15 -2
@@ -116,6 +116,7 @@ struct scc_enet_private {struct net_device_stats stats;uint tx_full;spinlock_t lock; +spinlock_t tx_lock; };static int scc_enet_open (struct net_device *dev);
@@ -163,8 +164,7 @@ scc_enet_open(struct net_device *dev)return 0 ;/* Always succeed */ } -static int -scc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __scc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;volatile cbd_t *bdp;
@@ -234,6 +234,18 @@ scc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int scc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv; +int ret; + +spin_lock (&cap->tx_lock); + ret =__scc_enet_start_xmit (skb, dev); +spin_unlock (&cap->tx_lock); + +return ret; +} +static void scc_enet_timeout (struct net_device *dev) {
@@ -637,6 +649,7 @@ static int __init scc_enet_init(void) cep = dev->priv;spin_lock_init (&cep->lock); +spin_lock_init (&cep->tx_lock);/* Get pointer to SCC area in parameter RAM. */
arch/ppc/8260_io/fcc_enet.c +14 -2
@@ -365,6 +365,7 @@ struct fcc_enet_private {struct net_device_stats stats;uint tx_free;spinlock_t lock; +spinlock_t tx_lock;#ifdef CONFIG_USE_MDIO uint phy_id;
@@ -409,8 +410,7 @@ static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c);#endif /* CONFIG_USE_MDIO */ -static int -fcc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __fcc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv;volatile cbd_t *bdp;
@@ -476,6 +476,17 @@ fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int fcc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv; +int ret; + +spin_lock (&cep->tx_lock); + ret =__fcc_enet_start_xmit (skb, dev); +spin_unlock (&cep->tx_lock); + +return ret; +}static void fcc_enet_timeout (struct net_device *dev)
@@ -1709,6 +1720,7 @@ static int __init fec_enet_init(void) cep = dev->priv;spin_lock_init (&cep->lock); +spin_lock_init (&cep->tx_lock); cep->fip = fip;init_fcc_shutdown (fip, cep, immap);
arch/ppc/8xx_io/enet.c +15 -2
@@ -144,6 +144,7 @@ struct scc_enet_private {struct net_device_stats stats;uint tx_full;spinlock_t lock; +spinlock_t tx_lock; };static int scc_enet_open (struct net_device *dev);
@@ -193,8 +194,7 @@ scc_enet_open(struct net_device *dev)return 0 ;/* Always succeed */ } -static int -scc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __scc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;volatile cbd_t *bdp;
@@ -269,6 +269,18 @@ scc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int scc_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv; +int ret; + +spin_lock (&cep->tx_lock); + ret =__scc_enet_start_xmit (skb, dev); +spin_unlock (&cep->tx_lock); + +return ret; +} +static void scc_enet_timeout (struct net_device *dev) {
@@ -665,6 +677,7 @@ static int __init scc_enet_init(void) cep = dev->priv;spin_lock_init (&cep->lock); +spin_lock_init (&cep->tx_lock);/* Get pointer to SCC area in parameter RAM. */
arch/ppc/8xx_io/fec.c +17 -2
@@ -165,6 +165,7 @@ struct fec_enet_private {struct net_device_stats stats;uint tx_full;spinlock_t lock; +spinlock_t tx_lock;#ifdef CONFIG_USE_MDIO uint phy_id;
@@ -338,8 +339,7 @@ EXPORT_SYMBOL(fec_unregister_ph);#endif /* CONFIG_FEC_PACKETHOOK */ -static int -fec_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __fec_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct fec_enet_private *fep;volatile fec_t *fecp;
@@ -423,6 +423,18 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int fec_enet_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct fec_enet_private *fep = dev->priv; +int ret; + +spin_lock (&fep->tx_lock); + ret =__fec_enet_start_xmit (skb, dev); +spin_unlock (&fep->tx_lock); + +return ret; +} +static void fec_timeout (struct net_device *dev) {
@@ -1601,6 +1613,9 @@ static int __init fec_enet_init(void) fep = dev->priv; +spin_lock_init (&fep->lock); +spin_lock_init (&fep->tx_lock); + fecp = &(immap->im_cpm.cp_fec);/* Whack a reset. We should wait for this.
arch/um/drivers/net_kern.c +14 -1
@@ -211,7 +211,7 @@ static int uml_net_close(struct net_device *dev)return 0 ; } -static int uml_net_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __uml_net_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct uml_net_private *lp = dev->priv;unsigned long flags;
@@ -248,6 +248,18 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int uml_net_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct uml_net_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__uml_net_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +static struct net_device_stats *uml_net_get_stats (struct net_device *dev) {struct uml_net_private *lp = dev->priv;
@@ -469,6 +481,7 @@ static void eth_configure(int n, void *init, char *mac,init_timer (&lp->tl);spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); lp->tl.function = uml_net_user_timer_expire;memcpy (lp->mac, device->mac,sizeof (lp->mac));
arch/um/include/net_kern.h +1 -0
@@ -24,6 +24,7 @@ struct uml_net {struct uml_net_private {struct list_head list;spinlock_t lock; +spinlock_t tx_lock;struct net_device *dev;struct timer_list tl;struct net_device_stats stats;
arch/xtensa/platforms/iss/network.c +15 -2
@@ -72,6 +72,7 @@ struct iss_net_private {struct list_head opened_list;spinlock_t lock; +spinlock_t tx_lock;struct net_device *dev;struct platform_device pdev;struct timer_list tl;
@@ -513,7 +514,7 @@ printk("iss_net_close!\n");return 0 ; } -static int iss_net_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __iss_net_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct iss_net_private *lp = dev->priv;unsigned long flags;
@@ -548,6 +549,17 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int iss_net_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct iss_net_private *lp = dev->priv; +int ret; + +spin_lock (&lp->tx_lock); + ret =__iss_net_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}static struct net_device_stats *iss_net_get_stats (struct net_device *dev) {
@@ -640,7 +652,6 @@ static int iss_net_configure(int index, char *init) *lp = ((struct iss_net_private) { .device_list = LIST_HEAD_INIT(lp->device_list), .opened_list = LIST_HEAD_INIT(lp->opened_list), - .lock = SPIN_LOCK_UNLOCKED, .dev = dev, .index = index, //.fd = -1,
@@ -648,6 +659,8 @@ static int iss_net_configure(int index, char *init) .have_mac = 0, }); +spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);/* * Try all transport protocols. * Note: more protocols can be added by adding '&& !X_init(lp, eth)'.
drivers/ieee1394/eth1394.c +14 -1
@@ -609,6 +609,7 @@ static void ether1394_add_host(struct hpsb_host *host) priv =netdev_priv (dev);INIT_LIST_HEAD (&priv->ip_node_list);spin_lock_init (&priv->lock); +spin_lock_init (&priv->tx_lock); priv->host = host; priv->local_fifo = fifo_addr;INIT_WORK (&priv->wake, ether1394_wake_queue);
@@ -1560,7 +1561,7 @@ static void ether1394_complete_cb(void *__ptask) }/* Transmit a packet (called by kernel) */ -static int ether1394_tx (struct sk_buff *skb,struct net_device *dev) +static int __ether1394_tx (struct sk_buff *skb,struct net_device *dev) {struct eth1394hdr hdr_buf;struct eth1394_priv *priv =netdev_priv (dev);
@@ -1711,6 +1712,18 @@ fail:return NETDEV_TX_OK ; } +static int ether1394_tx (struct sk_buff *skb,struct net_device *dev) +{ +struct eth1394_priv *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__ether1394_tx (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +static void ether1394_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info) {
drivers/ieee1394/eth1394.h +1 -0
@@ -60,6 +60,7 @@ struct eth1394_priv {u8 bc_sspd;/* Max broadcast speed */ u64 local_fifo;/* Local FIFO Address */ spinlock_t lock;/* Private lock */ +spinlock_t tx_lock;int broadcast_channel;/* Async stream Broadcast Channel */ enum eth1394_bc_states bc_state;/* broadcast channel state */ struct hpsb_iso *iso;/* Async stream recv handle */
drivers/isdn/i4l/isdn_net.c +15 -2
@@ -1164,8 +1164,8 @@ static void isdn_net_tx_timeout(struct net_device * ndev)* If this interface isn't connected to a ISDN-Channel, find a free channel, * and start dialing. */ -static int -isdn_net_start_xmit (struct sk_buff *skb,struct net_device *ndev) +static int __isdn_net_start_xmit (struct sk_buff *skb, +struct net_device *ndev) {isdn_net_local *lp = (isdn_net_local *) ndev->priv;#ifdef CONFIG_ISDN_X25
@@ -1307,6 +1307,18 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)return 1 ; } +static int isdn_net_start_xmit (struct sk_buff *skb,struct net_device *ndev) +{ +isdn_net_local *lp = (isdn_net_local *) ndev->priv; +int ret; + +spin_lock (&lp->tx_lock); + ret =__isdn_net_start_xmit (skb, ndev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* * Shutdown a net-interface. */
@@ -2608,6 +2620,7 @@ isdn_net_new(char *name, struct net_device *master)INIT_WORK (&netdev->local->tqueue, isdn_net_softint);spin_lock_init (&netdev->local->xmit_lock); +spin_lock_init (&netdev->local->tx_lock);/* Put into to netdev-chain */ netdev->next = (void *) dev->netdev;
drivers/message/fusion/mptlan.c +15 -2
@@ -99,6 +99,7 @@ struct mpt_lan_priv {int *mpt_txfidx;/* Free Tx Context list */ int mpt_txfidx_tail;spinlock_t txfidx_lock; +spinlock_t tx_lock;int *mpt_rxfidx;/* Free Rx Context list */ int mpt_rxfidx_tail;
@@ -699,8 +700,7 @@ out: }/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -static int -mpt_lan_sdu_send (struct sk_buff *skb,struct net_device *dev) +static int __mpt_lan_sdu_send (struct sk_buff *skb,struct net_device *dev) {struct mpt_lan_priv *priv =netdev_priv (dev);MPT_ADAPTER *mpt_dev = priv->mpt_dev;
@@ -843,6 +843,18 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int mpt_lan_sdu_send (struct sk_buff *skb,struct net_device *dev) +{ +struct mpt_lan_priv *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__mpt_lan_sdu_send (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static void mpt_lan_wake_post_buckets_task (struct net_device *dev,int priority)
@@ -1385,6 +1397,7 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) priv->bucketthresh = priv->max_buckets_out *2 /3 ;spin_lock_init (&priv->txfidx_lock); +spin_lock_init (&priv->tx_lock);spin_lock_init (&priv->rxfidx_lock);/* Grab pre-fetched LANPage1 stuff. :-) */
drivers/misc/sgi-xp/xpnet.c +19 -1
@@ -112,6 +112,7 @@ struct xpnet_pending_msg {/* driver specific structure pointed to by the device structure */ struct xpnet_dev_private { +spinlock_t tx_lock;struct net_device_stats stats; };
@@ -436,7 +437,7 @@ xpnet_send_completed(enum xp_retval reason, short partid, int channel,* is 0xff, this packet is to broadcast to all partitions. */ static int -xpnet_dev_hard_start_xmit (struct sk_buff *skb,struct net_device *dev) +__xpnet_dev_hard_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct xpnet_pending_msg *queued_msg;enum xp_retval ret;
@@ -577,6 +578,19 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int +xpnet_dev_hard_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct xpnet_dev_private *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__xpnet_dev_hard_start_xmit (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +/* * Deal with transmit timeouts coming from the network layer. */
@@ -594,6 +608,7 @@ xpnet_dev_tx_timeout(struct net_device *dev)static int __init xpnet_init (void ) { +struct xpnet_dev_private *priv;int i;u32 license_num;int result = -ENOMEM ;
@@ -614,6 +629,9 @@ xpnet_init(void)netif_carrier_off (xpnet_device); + priv =netdev_priv (dev); +spin_lock_init (&priv->tx_lock); + xpnet_device->mtu =XPNET_DEF_MTU ; xpnet_device->change_mtu = xpnet_dev_change_mtu; xpnet_device->open = xpnet_dev_open;
drivers/net/3c501.c +14 -1
@@ -300,6 +300,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)memset (dev->priv,0 ,sizeof (struct net_local )); lp =netdev_priv (dev);spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);/* * The EL1-specific entries in the device structure.
@@ -402,7 +403,7 @@ static void el_timeout(struct net_device *dev)* no real choice. */ -static int el_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __el_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct net_local *lp =netdev_priv (dev);int ioaddr = dev->base_addr;
@@ -488,6 +489,18 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) }while (1 ); } +static int el_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct net_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__el_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/** * el_interrupt: * @irq: Interrupt number
drivers/net/3c501.h +1 -0
@@ -33,6 +33,7 @@ struct net_localint loading;/* Spot buffer load collisions */ int txing;/* True if card is in TX mode */ spinlock_t lock;/* Serializing lock */ +spinlock_t tx_lock; };
drivers/net/3c505.c +14 -1
@@ -875,6 +875,7 @@ static int elp_open(struct net_device *dev) adapter->rx_backlog.out =0 ;spin_lock_init (&adapter->lock); +spin_lock_init (&adapter->tx_lock);/* * install our interrupt service routine
@@ -1059,7 +1060,7 @@ static void elp_timeout(struct net_device *dev)* ******************************************************/ -static int elp_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __elp_start_xmit (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;elp_device *adapter = dev->priv;
@@ -1096,6 +1097,18 @@ static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int elp_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +elp_device *adapter = dev->priv; +int ret; + +spin_lock (&adapter->tx_lock); + ret =__elp_start_xmit (skb, dev); +spin_unlock (&adapter->tx_lock); + +return ret; +} +/****************************************************** * * return statistics on the board
drivers/net/3c505.h +1 -0
@@ -289,4 +289,5 @@ typedef struct {unsigned int rx_active;/* number of receive PCBs */ volatile unsigned char hcr_val;/* what we think the HCR contains */ spinlock_t lock;/* Interrupt v tx lock */ +spinlock_t tx_lock; } elp_device;
drivers/net/3c507.c +15 -1
@@ -126,6 +126,7 @@ struct net_local {ushort tx_reap;ushort tx_pkts_in_ring;spinlock_t lock; +spinlock_t tx_lock;void __iomem *base; };
@@ -443,6 +444,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr) lp =netdev_priv (dev);memset (lp,0 ,sizeof (*lp));spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); lp->base =ioremap (dev->mem_start,RX_BUF_END );if (!lp->base) {printk (KERN_ERR "3c507: unable to remap memory\n" );
@@ -505,7 +507,7 @@ static void el16_tx_timeout (struct net_device *dev) } -static int el16_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __el16_send_packet (struct sk_buff *skb,struct net_device *dev) {struct net_local *lp =netdev_priv (dev);int ioaddr = dev->base_addr;
@@ -536,6 +538,18 @@ static int el16_send_packet (struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int el16_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct net_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__el16_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* The typical workload of the driver: Handle the network interface interrupts. */ static irqreturn_t el16_interrupt (int irq,void *dev_id)
drivers/net/3c509.c +15 -1
@@ -168,6 +168,7 @@ enum el3_cardtype { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA };struct el3_private {spinlock_t lock; +spinlock_t tx_lock;/* skb send-queue */ int head, size;struct sk_buff *queue[SKB_QUEUE_SIZE ];
@@ -545,6 +546,7 @@ static int __init el3_common_init(struct net_device *dev)const char *if_names[] = {"10baseT" ,"AUI" ,"undefined" ,"BNC" };spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);if (dev->mem_start &0x05 ) {/* xcvr codes 1/3/4/12 */ dev->if_port = (dev->mem_start &0x0f );
@@ -809,7 +811,7 @@ el3_tx_timeout (struct net_device *dev)static int -el3_start_xmit (struct sk_buff *skb,struct net_device *dev) +__el3_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct el3_private *lp =netdev_priv (dev);int ioaddr = dev->base_addr;
@@ -887,6 +889,18 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int el3_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct el3_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__el3_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* The EL3 interrupt handler. */ static irqreturn_t el3_interrupt (int irq,void *dev_id)
drivers/net/3c515.c +17 -2
@@ -322,6 +322,7 @@ struct corkscrew_private { full_bus_master_tx:1, full_bus_master_rx:1, /* Boomerang */ tx_full:1;spinlock_t lock; +spinlock_t tx_lock;struct device *dev; };
@@ -615,6 +616,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,printk (KERN_INFO "%s: 3Com %s at %#3x," , dev->name, vp->product_name, ioaddr);spin_lock_init (&vp->lock); +spin_lock_init (&vp->tx_lock);/* Read the station address from the EEPROM. */ EL3WINDOW (0 );
@@ -991,8 +993,8 @@ static void corkscrew_timeout(struct net_device *dev)netif_wake_queue (dev); } -static int corkscrew_start_xmit (struct sk_buff *skb, -struct net_device *dev) +static int __corkscrew_start_xmit (struct sk_buff *skb, +struct net_device *dev) {struct corkscrew_private *vp =netdev_priv (dev);int ioaddr = dev->base_addr;
@@ -1115,6 +1117,19 @@ static int corkscrew_start_xmit(struct sk_buff *skb,return 0 ; } +static int corkscrew_start_xmit (struct sk_buff *skb, +struct net_device *dev) +{ +struct corkscrew_private *vp =netdev_priv (dev); +int ret; + +spin_lock (&vp->tx_lock); + ret =__corkscrew_start_xmit (skb, dev); +spin_unlock (&vp->tx_lock); + +return ret; +} +/* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */
drivers/net/3c523.c +15 -1
@@ -202,6 +202,7 @@ static void elmc_xmt_int(struct net_device *dev);static void elmc_rnr_int (struct net_device *dev);struct priv { +spinlock_t tx_lock;unsigned long base;char *memtop;unsigned long mapped_start;/* Start of ioremap */
@@ -493,6 +494,7 @@ static int __init do_elmc_probe(struct net_device *dev) }memset (pr,0 ,sizeof (struct priv )); +spin_lock_init (&pr->tx_lock); pr->slot = slot; printk(KERN_INFO "%s: 3Com 3c523 Rev 0x%x at %#lx\n", dev->name, (int) revision,
@@ -1124,7 +1126,7 @@ static void elmc_timeout(struct net_device *dev)* send frame */ -static int elmc_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __elmc_send_packet (struct sk_buff *skb,struct net_device *dev) {int len;int i;
@@ -1196,6 +1198,18 @@ static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int elmc_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct priv *p = (struct priv *) dev->priv; +int ret; + +spin_lock (&p->tx_lock); + ret =__elmc_send_packet (skb, dev); +spin_unlock (&p->tx_lock); + +return ret; +} +/******************************************* * Someone wanna have the statistics */
drivers/net/3c527.c +14 -1
@@ -155,6 +155,7 @@ struct mc32_ring_desc/* Information that needs to be kept for each board. */ struct mc32_local { +spinlock_t tx_lock;int slot;u32 base;
@@ -441,6 +442,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot) }memset (lp,0 ,sizeof (struct mc32_local )); +spin_lock_init (&lp->tx_lock); lp->slot = slot; i=0 ;
@@ -1016,7 +1018,7 @@ static void mc32_timeout(struct net_device *dev)* */ -static int mc32_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __mc32_send_packet (struct sk_buff *skb,struct net_device *dev) {struct mc32_local *lp =netdev_priv (dev);u32 head =atomic_read (&lp->tx_ring_head);
@@ -1065,6 +1067,17 @@ static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int mc32_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct mc32_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__mc32_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}/** * mc32_update_stats - pull off the on board statistics
drivers/net/3c59x.c +30 -2
@@ -601,6 +601,7 @@ struct vortex_private {unsigned int cur_rx, cur_tx;/* The next free ring entry */ unsigned int dirty_rx, dirty_tx;/* The ring entries to be free()ed. */ struct vortex_extra_stats xstats;/* NIC-specific extra stats */ +spinlock_t tx_lock;struct sk_buff *tx_skb;/* Packet being eaten by bus master ctrl. */ dma_addr_t tx_skb_dma;/* Allocated DMA address for bus master ctrl DMA. */
@@ -1118,6 +1119,7 @@ static int __devinit vortex_probe1(struct device *gendev, }spin_lock_init (&vp->lock); +spin_lock_init (&vp->tx_lock); vp->gendev = gendev; vp->mii.dev = dev; vp->mii.mdio_read = mdio_read;
@@ -2009,7 +2011,7 @@ vortex_error(struct net_device *dev, int status) }static int -vortex_start_xmit (struct sk_buff *skb,struct net_device *dev) +__vortex_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct vortex_private *vp =netdev_priv (dev);void __iomem *ioaddr = vp->ioaddr;
@@ -2064,7 +2066,20 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev) }static int -boomerang_start_xmit (struct sk_buff *skb,struct net_device *dev) +vortex_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct vortex_private *vp =netdev_priv (dev); +int ret; + +spin_lock (&vp->tx_lock); + ret =__vortex_start_xmit (skb, dev); +spin_unlock (&vp->tx_lock); + +return ret; +} + +static int +__boomerang_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct vortex_private *vp =netdev_priv (dev);void __iomem *ioaddr = vp->ioaddr;
@@ -2153,6 +2168,19 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int +boomerang_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct vortex_private *vp =netdev_priv (dev); +int ret; + +spin_lock (&vp->tx_lock); + ret =__boomerang_start_xmit (skb, dev); +spin_unlock (&vp->tx_lock); + +return ret; +} +/* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */
drivers/net/7990.c +14 -1
@@ -502,6 +502,7 @@ int lance_open (struct net_device *dev) res =lance_reset (dev);spin_lock_init (&lp->devlock); +spin_lock_init (&lp->tx_lock);netif_start_queue (dev);return res;
@@ -533,7 +534,7 @@ void lance_tx_timeout(struct net_device *dev) }EXPORT_SYMBOL_GPL (lance_tx_timeout); -int lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __lance_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct lance_private *lp =netdev_priv (dev);volatile struct lance_init_block *ib = lp->init_block;
@@ -588,6 +589,18 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)return 0 ; } + +int lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct lance_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__lance_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}EXPORT_SYMBOL_GPL (lance_start_xmit);/* taken from the depca driver via a2065.c */
drivers/net/7990.h +1 -0
@@ -125,6 +125,7 @@ struct lance_privatevoid (*writerdp)(void *,unsigned short );unsigned short (*readrdp)(void *);spinlock_t devlock; +spinlock_t tx_lock;char tx_full; };
drivers/net/8139too.c +14 -1
@@ -597,6 +597,7 @@ struct rtl8139_private {spinlock_t lock;spinlock_t rx_lock; +spinlock_t tx_lock;chip_t chipset;u32 rx_config;
@@ -1002,6 +1003,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, (debug <0 ?RTL8139_DEF_MSG_ENABLE : ((1 << debug) -1 ));spin_lock_init (&tp->lock);spin_lock_init (&tp->rx_lock); +spin_lock_init (&tp->tx_lock);INIT_DELAYED_WORK (&tp->thread, rtl8139_thread); tp->mii.dev = dev; tp->mii.mdio_read = mdio_read;
@@ -1691,7 +1693,7 @@ static void rtl8139_tx_timeout (struct net_device *dev) } } -static int rtl8139_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __rtl8139_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct rtl8139_private *tp =netdev_priv (dev);void __iomem *ioaddr = tp->mmio_addr;
@@ -1734,6 +1736,17 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int rtl8139_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct rtl8139_private *tp =netdev_priv (dev); +int ret; + +spin_lock (&tp->tx_lock); + ret =__rtl8139_start_xmit (skb, dev); +spin_unlock (&tp->tx_lock); + +return ret; +} static void rtl8139_tx_interrupt (struct net_device *dev, struct rtl8139_private *tp,
drivers/net/82596.c +15 -1
@@ -332,6 +332,7 @@ struct i596_private {struct i596_tbd tbds[TX_RING_SIZE ];int next_tx_cmd;spinlock_t lock; +spinlock_t tx_lock; }; static char init_setup[] =
@@ -1056,7 +1057,7 @@ static void i596_tx_timeout (struct net_device *dev) } -static int i596_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __i596_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct i596_private *lp = dev->priv;struct tx_cmd *tx_cmd;
@@ -1114,6 +1115,18 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int i596_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct i596_private *lp = dev->priv; +int ret; + +spin_lock (&lp->tx_lock); + ret =__i596_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +static void print_eth (unsigned char *add,char *str) {DECLARE_MAC_BUF (mac);
@@ -1262,6 +1275,7 @@ found: lp->scb.cmd =I596_NULL ; lp->scb.rfd =I596_NULL ;spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); err =register_netdev (dev);if (err)
drivers/net/8390.h +1 -0
@@ -71,6 +71,7 @@ struct ei_device {unsigned char saved_irq;/* Original dev->irq value. */ u32 *reg_offset;/* Register mapping table */ spinlock_t page_lock;/* Page register locks */ +spinlock_t tx_lock;unsigned long priv;/* Private field to store bus IDs etc. */ #ifdef AX88796_PLATFORM unsigned char rxcr_base;/* default value for RXCR */
drivers/net/a2065.c +16 -1
@@ -113,6 +113,7 @@ struct lance_private {volatile struct lance_init_block *init_block;/* Hosts view */ volatile struct lance_init_block *lance_init_block;/* Lance view */ +spinlock_t tx_lock;int rx_new, tx_new;int rx_old, tx_old;
@@ -548,7 +549,7 @@ static void lance_tx_timeout(struct net_device *dev)netif_wake_queue (dev); } -static int lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __lance_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct lance_private *lp =netdev_priv (dev);volatile struct lance_regs *ll = lp->ll;
@@ -614,6 +615,18 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)return status; } +static int lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct lance_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__lance_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* taken from the depca driver */ static void lance_load_multicast (struct net_device *dev) {
@@ -735,6 +748,8 @@ static int __devinit a2065_init_one(struct zorro_dev *z, priv =netdev_priv (dev); +spin_lock_init (&priv->tx_lock); + r1->name = dev->name; r2->name = dev->name;
drivers/net/acenic.c +13 -1
@@ -468,6 +468,7 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev,SET_NETDEV_DEV (dev, &pdev->dev); ap = dev->priv; +spin_lock_init (&ap->tx_lock); ap->pdev = pdev; ap->name =pci_name (pdev);
@@ -2458,7 +2459,7 @@ ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr, } -static int ace_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __ace_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct ace_private *ap =netdev_priv (dev);struct ace_regs __iomem *regs = ap->regs;
@@ -2598,6 +2599,17 @@ overflow:return NETDEV_TX_BUSY ; } +static int ace_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct ace_private *ap =netdev_priv (dev); +int ret; + +spin_lock (&ap->tx_lock); + ret =__ace_start_xmit (skb, dev); +spin_unlock (&ap->tx_lock); + +return ret; +}static int ace_change_mtu (struct net_device *dev,int new_mtu) {
drivers/net/acenic.h +1 -0
@@ -642,6 +642,7 @@ struct ace_private/* * TX elements */ +spinlock_t tx_lock;struct tx_desc *tx_ring;u32 tx_prd;volatile u32 tx_ret_csm;
drivers/net/appletalk/cops.c +15 -1
@@ -177,6 +177,7 @@ struct cops_localunsigned char node_acquire;/* Node ID when acquired. */ struct atalk_addr node_addr;/* Full node address */ spinlock_t lock;/* RX/TX lock */ +spinlock_t tx_lock; };/* Index to functions, as function prototypes. */
@@ -329,6 +330,7 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) lp =netdev_priv (dev);spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);/* Copy local board variable to lp struct. */ lp->board = board;
@@ -876,7 +878,7 @@ static void cops_timeout(struct net_device *dev)* Make the card transmit a LocalTalk packet. */ -static int cops_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __cops_send_packet (struct sk_buff *skb,struct net_device *dev) {struct cops_local *lp =netdev_priv (dev);int ioaddr = dev->base_addr;
@@ -924,6 +926,18 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int cops_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct cops_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__cops_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* * Dummy function to keep the Appletalk layer happy. */
drivers/net/appletalk/ipddp.c +14 -1
@@ -111,10 +111,12 @@ static struct net_device_stats *ipddp_get_stats(struct net_device *dev)return dev->priv; } +static DEFINE_SPINLOCK (ipddp_tx_lock); +/* * Transmit LLAP/ELAP frame using aarp_send_ddp. */ -static int ipddp_xmit (struct sk_buff *skb,struct net_device *dev) +static int __ipddp_xmit (struct sk_buff *skb,struct net_device *dev) {__be32 paddr = ((struct rtable *)skb->dst)->rt_gateway;struct ddpehdr *ddp;
@@ -179,6 +181,17 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int ipddp_xmit (struct sk_buff *skb,struct net_device *dev) +{ +int ret; + +spin_lock (&ipddp_tx_lock); + ret =__ipddp_xmit (skb, dev); +spin_unlock (&ipddp_tx_lock); + +return ret; +} +/* * Create a routing entry. We first verify that the * record does not already exist. If it does we return -EEXIST
drivers/net/appletalk/ltpc.c +18 -1
@@ -263,6 +263,7 @@ struct ltpc_private {struct net_device_stats stats;struct atalk_addr my_addr; +spinlock_t tx_lock; };/* transmit queue element struct */
@@ -898,7 +899,7 @@ static void ltpc_poll(unsigned long l)/* DDP to LLAP translation */ -static int ltpc_xmit (struct sk_buff *skb,struct net_device *dev) +static int __ltpc_xmit (struct sk_buff *skb,struct net_device *dev) {/* in kernel 1.3.xx, on entry skb->data points to ddp header, * and skb->len is the length of the ddp data + ddp header
@@ -941,6 +942,18 @@ static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int ltpc_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct ltpc_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__ltpc_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +static struct net_device_stats *ltpc_get_stats (struct net_device *dev) {struct net_device_stats *stats = &((struct ltpc_private *) dev->priv)->stats;
@@ -1026,6 +1039,7 @@ static int __init ltpc_probe_dma(int base, int dma)struct net_device *__init ltpc_probe (void ) { +struct ltpc_private *lp;struct net_device *dev;int err = -ENOMEM ;int x=0 ,y=0 ;
@@ -1037,6 +1051,9 @@ struct net_device * __init ltpc_probe(void)if (!dev) goto out; + lp =netdev_priv (dev); +spin_lock_init (&lp->tx_lock); +/* probe for the I/O port address */ if (io !=0x240 &&request_region (0x220 ,8 ,"ltpc" )) {
drivers/net/arcnet/arcnet.c +13 -1
@@ -359,6 +359,7 @@ struct net_device *alloc_arcdev(char *name)if (dev) {struct arcnet_local *lp = (struct arcnet_local *) dev->priv;spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); }return dev;
@@ -601,7 +602,7 @@ static int arcnet_rebuild_header(struct sk_buff *skb)/* Called by the kernel in order to transmit a packet. */ -static int arcnet_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __arcnet_send_packet (struct sk_buff *skb,struct net_device *dev) {struct arcnet_local *lp = dev->priv;struct archdr *pkt;
@@ -686,6 +687,17 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)return retval;/* no need to try again */ } +static int arcnet_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct arcnet_local *lp = dev->priv; +int ret; + +spin_lock (&lp->tx_lock); + ret =__arcnet_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}/* * Actually start transmitting a packet that was loaded into a buffer
drivers/net/ariadne.c +15 -1
@@ -96,6 +96,7 @@ struct ariadne_private {volatile struct RDRE *rx_ring[RX_RING_SIZE ];volatile u_short *tx_buff[TX_RING_SIZE ];volatile u_short *rx_buff[RX_RING_SIZE ]; +spinlock_t tx_lock;int cur_tx, cur_rx;/* The next free ring entry */ int dirty_tx;/* The ring entries to be free()ed. */ struct net_device_stats stats;
@@ -186,6 +187,8 @@ static int __devinit ariadne_init_one(struct zorro_dev *z, priv =netdev_priv (dev); +spin_lock_init (&priv->tx_lock); + r1->name = dev->name; r2->name = dev->name;
@@ -586,7 +589,7 @@ static void ariadne_tx_timeout(struct net_device *dev) } -static int ariadne_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __ariadne_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct ariadne_private *priv =netdev_priv (dev);volatile struct Am79C960 *lance = (struct Am79C960 *)dev->base_addr;
@@ -689,6 +692,17 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int ariadne_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct ariadne_private *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__ariadne_start_xmit (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +}static int ariadne_rx (struct net_device *dev) {
drivers/net/arm/am79c961a.c +14 -2
@@ -447,8 +447,7 @@ static void am79c961_timeout(struct net_device *dev)/* * Transmit a packet */ -static int -am79c961_sendpacket (struct sk_buff *skb,struct net_device *dev) +static int __am79c961_sendpacket (struct sk_buff *skb,struct net_device *dev) {struct dev_priv *priv =netdev_priv (dev);unsigned int hdraddr, bufaddr;
@@ -485,6 +484,18 @@ am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int am79c961_sendpacket (struct sk_buff *skb,struct net_device *dev) +{ +struct dev_priv *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__am79c961_sendpacket (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +/* * If we have a good packet(s), get it/them out of the buffers. */
@@ -726,6 +737,7 @@ static int __init am79c961_probe(struct platform_device *pdev)am79c961_banner ();spin_lock_init (&priv->chip_lock); +spin_lock_init (&priv->tx_lock);init_timer (&priv->timer); priv->timer.data = (unsigned long )dev; priv->timer.function = am79c961_timer;
drivers/net/arm/am79c961a.h +1 -0
@@ -140,6 +140,7 @@ struct dev_priv {unsigned long rxhdr;unsigned long txhdr;spinlock_t chip_lock; +spinlock_t tx_lock;struct timer_list timer; };
drivers/net/arm/at91_ether.c +14 -1
@@ -809,7 +809,7 @@ static int at91ether_close(struct net_device *dev)/* * Transmit packet. */ -static int at91ether_tx (struct sk_buff *skb,struct net_device *dev) +static int __at91ether_tx (struct sk_buff *skb,struct net_device *dev) {struct at91_private *lp =netdev_priv (dev);
@@ -838,6 +838,18 @@ static int at91ether_tx(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int at91ether_tx (struct sk_buff *skb,struct net_device *dev) +{ +struct at91_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__at91ether_tx (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* * Update the current statistics from the internal statistics registers. */
@@ -1007,6 +1019,7 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_addplatform_set_drvdata (pdev, dev);spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);ether_setup (dev); dev->open = at91ether_open;
drivers/net/arm/at91_ether.h +1 -0
@@ -92,6 +92,7 @@ struct at91_private/* PHY */ unsigned long phy_type;/* type of PHY (PHY_ID) */ spinlock_t lock;/* lock for MDI interface */ +spinlock_t tx_lock;short phy_media;/* media interface type */ unsigned short phy_address;/* 5-bit MDI address of PHY (0..31) */ struct timer_list check_timer;/* Poll link status */
drivers/net/arm/ep93xx_eth.c +15 -1
@@ -166,6 +166,7 @@ struct ep93xx_privunsigned int rx_pointer;unsigned int tx_clean_pointer;unsigned int tx_pointer; +spinlock_t tx_lock;spinlock_t tx_pending_lock;unsigned int tx_pending;
@@ -316,7 +317,7 @@ poll_some_more:return rx; } -static int ep93xx_xmit (struct sk_buff *skb,struct net_device *dev) +static int __ep93xx_xmit (struct sk_buff *skb,struct net_device *dev) {struct ep93xx_priv *ep =netdev_priv (dev);int entry;
@@ -350,6 +351,18 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } +static int ep93xx_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct ep93xx_priv *ep =netdev_priv (dev); +int ret; + +spin_lock (&ep->tx_lock); + ret =__ep93xx_xmit (skb, dev); +spin_unlock (&ep->tx_lock); + +return ret; +} +static void ep93xx_tx_complete (struct net_device *dev) {struct ep93xx_priv *ep =netdev_priv (dev);
@@ -651,6 +664,7 @@ static int ep93xx_open(struct net_device *dev) ep->rx_pointer =0 ; ep->tx_clean_pointer =0 ; ep->tx_pointer =0 ; +spin_lock_init (&ep->tx_lock);spin_lock_init (&ep->tx_pending_lock); ep->tx_pending =0 ;
drivers/net/arm/ether1.c +14 -2
@@ -677,8 +677,7 @@ ether1_timeout(struct net_device *dev)netif_wake_queue (dev); } -static int -ether1_sendpacket (struct sk_buff *skb,struct net_device *dev) +static int __ether1_sendpacket (struct sk_buff *skb,struct net_device *dev) {int tmp, tst, nopaddr, txaddr, tbdaddr, dataddr;unsigned long flags;
@@ -751,6 +750,17 @@ ether1_sendpacket (struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int ether1_sendpacket (struct sk_buff *skb,struct net_device *dev) +{ +int ret; + +spin_lock (&priv (dev)->tx_lock); + ret =__ether1_sendpacket (skb, dev); +spin_unlock (&priv (dev)->tx_lock); + +return ret; +} +static void ether1_xmit_done (struct net_device *dev) {
@@ -1010,6 +1020,8 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id) goto release; } +spin_lock_init (&priv (dev)->tx_lock); +SET_NETDEV_DEV (dev, &ec->dev); dev->irq = ec->irq;
drivers/net/arm/ether1.h +1 -0
@@ -39,6 +39,7 @@struct ether1_priv {void __iomem *base;struct net_device_stats stats; +spinlock_t tx_lock;unsigned int tx_link;unsigned int tx_head;volatile unsigned int tx_tail;
drivers/net/arm/ether3.c +14 -2
@@ -500,8 +500,7 @@ static void ether3_timeout(struct net_device *dev)/* * Transmit a packet */ -static int -ether3_sendpacket (struct sk_buff *skb,struct net_device *dev) +static int __ether3_sendpacket (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;unsigned int length =ETH_ZLEN < skb->len ? skb->len :ETH_ZLEN ;
@@ -565,6 +564,17 @@ ether3_sendpacket(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int ether3_sendpacket (struct sk_buff *skb,struct net_device *dev) +{ +int ret; + +spin_lock (&priv (dev)->tx_lock); + ret =__ether3_sendpacket (skb, dev); +spin_unlock (&priv (dev)->tx_lock); + +return ret; +} +static irqreturn_t ether3_interrupt (int irq,void *dev_id) {
@@ -790,6 +800,8 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id) goto release; } +spin_lock_init (&priv (dev)->tx_lock); +SET_NETDEV_DEV (dev, &ec->dev);priv (dev)->base =ecardm_iomap (ec,ECARD_RES_MEMC ,0 ,0 );
drivers/net/arm/ether3.h +1 -0
@@ -161,6 +161,7 @@ struct dev_priv {unsigned int config1;unsigned int config2; } regs; +spinlock_t tx_lock;unsigned char tx_head;/* buffer nr to insert next packet */ unsigned char tx_tail;/* buffer nr of transmitting packet */ unsigned int rx_head;/* address to fetch next packet from */
drivers/net/arm/ixp4xx_eth.c +14 -1
@@ -168,6 +168,7 @@ struct port {struct mii_if_info mii;struct delayed_work mdio_thread;struct eth_plat_info *plat; +spinlock_t tx_lock;buffer_t *rx_buff_tab[RX_DESCS ], *tx_buff_tab[TX_DESCS ];struct desc *desc_tab;/* coherent */ u32 desc_tab_phys;
@@ -660,7 +661,7 @@ static void eth_txdone_irq(void *unused) } } -static int eth_xmit (struct sk_buff *skb,struct net_device *dev) +static int __eth_xmit (struct sk_buff *skb,struct net_device *dev) {struct port *port =netdev_priv (dev);unsigned int txreadyq = port->plat->txreadyq;
@@ -747,6 +748,17 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } +static int eth_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct port *port =netdev_priv (dev); +int ret; + +spin_lock (&port->tx_lock); + ret =__eth_xmit (skb, dev); +spin_unlock (&port->tx_lock); + +return ret; +}static struct net_device_stats *eth_stats (struct net_device *dev) {
@@ -1133,6 +1145,7 @@ static int __devinit eth_init_one(struct platform_device *pdev)SET_NETDEV_DEV (dev, &pdev->dev); port =netdev_priv (dev); +spin_lock_init (&port->tx_lock); port->netdev = dev; port->id = pdev->id;
drivers/net/at1700.c +15 -1
@@ -110,6 +110,7 @@ typedef unsigned char uchar;/* Information that need to be kept for each board. */ struct net_local {spinlock_t lock; +spinlock_t tx_lock;unsigned char mc_filter[8 ];uint jumpered:1 ;/* Set iff the board has jumper config. */ uint tx_started:1 ;/* Packets are on the Tx queue. */
@@ -459,6 +460,7 @@ found: dev->watchdog_timeo =TX_TIMEOUT ;spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); lp->jumpered = is_fmv18x; lp->mca_slot = slot;
@@ -591,7 +593,7 @@ static void net_tx_timeout (struct net_device *dev) } -static int net_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __net_send_packet (struct sk_buff *skb,struct net_device *dev) {struct net_local *lp =netdev_priv (dev);int ioaddr = dev->base_addr;
@@ -642,6 +644,18 @@ static int net_send_packet (struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int net_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct net_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__net_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* The typical workload of the driver: Handle the network interface interrupts. */ static irqreturn_t net_interrupt (int irq,void *dev_id)
drivers/net/atarilance.c +17 -3
@@ -227,6 +227,7 @@ struct lance_private {/* This must be long for set_bit() */ long tx_full;spinlock_t devlock; +spinlock_t tx_lock; };/* I/O register access macros */
@@ -603,6 +604,7 @@ static unsigned long __init lance_probe1( struct net_device *dev, }spin_lock_init (&lp->devlock); +spin_lock_init (&lp->tx_lock);MEM ->init.mode =0x0000 ;/* Disable Rx and Tx. */ for ( i =0 ; i <6 ; i++ )
@@ -771,9 +773,9 @@ static void lance_tx_timeout (struct net_device *dev)/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -static int lance_start_xmit (struct sk_buff *skb,struct net_device *dev ) - -{struct lance_private *lp = (struct lance_private *)dev->priv; +static int __lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct lance_private *lp = (struct lance_private *)dev->priv;struct lance_ioreg *IO = lp->iobase;int entry, len;struct lance_tx_head *head;
@@ -850,6 +852,18 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )return 0 ; } +static int lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct lance_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__lance_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* The LANCE interrupt handler. */ static irqreturn_t lance_interrupt (int irq,void *dev_id )
drivers/net/atp.c +14 -1
@@ -170,6 +170,7 @@ static char mux_8012[] = { 0xff, 0xf7, 0xff, 0xfb, 0xf3, 0xfb, 0xff, 0xf7,};struct net_local {spinlock_t lock; +spinlock_t tx_lock;struct net_device *next_module;struct timer_list timer;/* Media selection timer. */ long last_rx_time;/* Last Rx, in jiffies, to handle Rx hang. */
@@ -334,6 +335,7 @@ static int __init atp_probe1(long ioaddr) lp->chip_type =RTL8002 ; lp->addr_mode = CMR2h_Normal;spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);/* For the ATP adapter the "if_port" is really the data transfer mode. */ if (xcvr[0 ])
@@ -548,7 +550,7 @@ static void tx_timeout(struct net_device *dev) dev->stats.tx_errors++; } -static int atp_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __atp_send_packet (struct sk_buff *skb,struct net_device *dev) {struct net_local *lp =netdev_priv (dev);long ioaddr = dev->base_addr;
@@ -586,6 +588,17 @@ static int atp_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int atp_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct net_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__atp_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}/* The typical workload of the driver: Handle the network interface interrupts. */
drivers/net/au1000_eth.c +14 -1
@@ -754,6 +754,7 @@ static struct net_device * au1000_probe(int port_num) }spin_lock_init (&aup->lock); +spin_lock_init (&aup->tx_lock); dev->base_addr = base; dev->irq = irq; dev->open = au1000_open;
@@ -1077,7 +1078,7 @@ static void au1000_tx_ack(struct net_device *dev)/* * Au1000 transmit routine. */ -static int au1000_tx (struct sk_buff *skb,struct net_device *dev) +static int __au1000_tx (struct sk_buff *skb,struct net_device *dev) {struct au1000_private *aup = (struct au1000_private *) dev->priv;struct net_device_stats *ps = &dev->stats;
@@ -1131,6 +1132,18 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int au1000_tx (struct sk_buff *skb,struct net_device *dev) +{ +struct au1000_private *aup = (struct au1000_private *) dev->priv; +int ret; + +spin_lock (&aup->tx_lock); + ret =__au1000_tx (skb, dev); +spin_unlock (&aup->tx_lock); + +return ret; +} +static inline void update_rx_stats (struct net_device *dev,u32 status) {struct au1000_private *aup = (struct au1000_private *) dev->priv;
drivers/net/au1000_eth.h +1 -0
@@ -116,4 +116,5 @@ struct au1000_private {dma_addr_t dma_addr;/* dma address of rx/tx buffers */ spinlock_t lock;/* Serialise access to device */ +spinlock_t tx_lock; };
drivers/net/bfin_mac.c +16 -2
@@ -603,8 +603,8 @@ adjust_head: } -static int bfin_mac_hard_start_xmit (struct sk_buff *skb, -struct net_device *dev) +static int __bfin_mac_hard_start_xmit (struct sk_buff *skb, +struct net_device *dev) {unsigned int data;
@@ -661,6 +661,19 @@ out:return 0 ; } +static int bfin_mac_hard_start_xmit (struct sk_buff *skb, +struct net_device *dev) +{ +struct bfin_mac_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__bfin_mac_hard_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +static void bfin_mac_rx (struct net_device *dev) {struct sk_buff *skb, *new_skb;
@@ -1045,6 +1058,7 @@ static int __init bfin_mac_probe(struct platform_device *pdev) ndev->ethtool_ops = &bfin_mac_ethtool_ops;spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);/* now, enable interrupts */ /* register irq handler */
drivers/net/bfin_mac.h +1 -0
@@ -59,6 +59,7 @@ struct bfin_mac_local {unsigned char Mac[6 ];/* MAC address of the board */ spinlock_t lock; +spinlock_t tx_lock;/* MII and PHY stuffs */ int old_link;/* used by bf537_adjust_link */
drivers/net/bmac.c +4 -0
@@ -82,6 +82,7 @@ struct bmac_data {unsigned short hash_use_count[64 ];unsigned short hash_table_mask[4 ];spinlock_t lock; +spinlock_t tx_lock; };#if 0 /* Move that to ethtool */
@@ -1288,6 +1289,7 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i bp->mdev = mdev;spin_lock_init (&bp->lock); +spin_lock_init (&bp->tx_lock);if (macio_request_resources (mdev,"bmac" )) {printk (KERN_ERR "BMAC: can't request IO resource !\n" );
@@ -1484,8 +1486,10 @@ static int bmac_output(struct sk_buff *skb, struct net_device *dev) { struct bmac_data *bp = netdev_priv(dev); +spin_lock (&bp->tx_lock);skb_queue_tail (bp->queue, skb);bmac_start (dev); +spin_unlock (&bp->tx_lock);return 0 ; }
drivers/net/bnx2.c +17 -5
@@ -5880,18 +5880,15 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)* bnx2_tx_int() runs without netif_tx_lock unless it needs to call * netif_wake_queue(). */ -static int -bnx2_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __bnx2_start_xmit (struct sk_buff *skb,struct net_device *dev, +struct bnx2 *bp,struct bnx2_tx_ring_info *txr) { -struct bnx2 *bp =netdev_priv (dev);dma_addr_t mapping;struct tx_bd *txbd;struct sw_bd *tx_buf;u32 len, vlan_tag_flags, last_frag, mss;u16 prod, ring_prod;int i; -struct bnx2_napi *bnapi = &bp->bnx2_napi[0 ]; -struct bnx2_tx_ring_info *txr = &bnapi->tx_ring;if (unlikely (bnx2_tx_avail (bp, txr) < (skb_shinfo (skb)->nr_frags +1 ))) {
@@ -6018,6 +6015,20 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } +static int bnx2_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct bnx2 *bp =netdev_priv (dev); +struct bnx2_napi *bnapi = &bp->bnx2_napi[0 ]; +struct bnx2_tx_ring_info *txr = &bnapi->tx_ring; +int ret; + +spin_lock (&txr->tx_lock); + ret =__bnx2_start_xmit (skb, dev, bp, txr); +spin_unlock (&txr->tx_lock); + +return ret; +} +/* Called with rtnl_lock */ static int bnx2_close (struct net_device *dev)
@@ -7582,6 +7593,7 @@ bnx2_init_napi(struct bnx2 *bp)netif_napi_add (bp->dev, &bp->bnx2_napi[i].napi, poll,64 ); bnapi->bp = bp; +spin_lock_init (&bnapi->tx_ring.tx_lock); } }
drivers/net/bnx2.h +1 -0
@@ -6595,6 +6595,7 @@ struct bnx2_irq { };struct bnx2_tx_ring_info { +spinlock_t tx_lock;u32 tx_prod_bseq;u16 tx_prod;u32 tx_bidx_addr;
drivers/net/bnx2x.h +1 -0
@@ -729,6 +729,7 @@ struct bnx2x {atomic_t intr_sem;struct msix_entry msix_table[MAX_CONTEXT +1 ]; +spinlock_t tx_lock;int tx_ring_size;#ifdef BCM_VLAN
drivers/net/bnx2x_main.c +15 -1
@@ -9304,7 +9304,7 @@ exit_lbl:* bnx2x_tx_int() runs without netif_tx_lock unless it needs to call * netif_wake_queue() */ -static int bnx2x_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __bnx2x_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct bnx2x *bp =netdev_priv (dev);struct bnx2x_fastpath *fp;
@@ -9562,6 +9562,18 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } +static int bnx2x_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct bnx2x *bp =netdev_priv (dev); +int ret; + +spin_lock (&bp->tx_lock); + ret =__bnx2x_start_xmit (skb, dev); +spin_unlock (&bp->tx_lock); + +return ret; +} +/* called with rtnl_lock */ static int bnx2x_open (struct net_device *dev) {
@@ -9849,6 +9861,8 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,SET_NETDEV_DEV (dev, &pdev->dev); bp =netdev_priv (dev); +spin_lock_init (&bp->tx_lock); + bp->dev = dev; bp->pdev = pdev; bp->flags =0 ;
drivers/net/can/vcan.c +21 -1
@@ -67,6 +67,9 @@ static int echo; /* echo testing. Default: 0 (Off) */module_param (echo, bool,S_IRUGO );MODULE_PARM_DESC (echo,"Echo sent frames (for testing). Default: 0 (Off)" ); +struct vcan_priv { +spinlock_t tx_lock; +};static void vcan_rx (struct sk_buff *skb,struct net_device *dev) {
@@ -83,7 +86,7 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)netif_rx (skb); } -static int vcan_tx (struct sk_buff *skb,struct net_device *dev) +static int __vcan_tx (struct sk_buff *skb,struct net_device *dev) {struct net_device_stats *stats = &dev->stats;int loop;
@@ -128,8 +131,24 @@ static int vcan_tx(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } +static int vcan_tx (struct sk_buff *skb,struct net_device *dev) +{ +struct vcan_priv *vp =netdev_priv (dev); +int ret; + +spin_lock (&vp->tx_lock); + ret =__vcan_tx (skb, dev); +spin_unlock (&vp->tx_lock); + +return ret; +} +static void vcan_setup (struct net_device *dev) { +struct vcan_priv *vp =netdev_priv (dev); + +spin_lock_init (&vp->tx_lock); + dev->type =ARPHRD_CAN ; dev->mtu =sizeof (struct can_frame ); dev->hard_header_len =0 ;
@@ -147,6 +166,7 @@ static void vcan_setup(struct net_device *dev)static struct rtnl_link_ops vcan_link_ops__read_mostly = { .kind ="vcan" , + .priv_size =sizeof (struct vcan_priv ), .setup = vcan_setup, };
drivers/net/cpmac.c +15 -1
@@ -196,6 +196,7 @@ struct cpmac_desc {struct cpmac_priv {spinlock_t lock;spinlock_t rx_lock; +spinlock_t tx_lock;struct cpmac_desc *rx_head;int ring_size;struct cpmac_desc *desc_ring;
@@ -555,7 +556,7 @@ fatal_error: } -static int cpmac_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __cpmac_start_xmit (struct sk_buff *skb,struct net_device *dev) {int queue, len;struct cpmac_desc *desc;
@@ -605,6 +606,18 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } +static int cpmac_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct cpmac_priv *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__cpmac_start_xmit (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +static void cpmac_end_xmit (struct net_device *dev,int queue) {struct cpmac_desc *desc;
@@ -1185,6 +1198,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)spin_lock_init (&priv->lock);spin_lock_init (&priv->rx_lock); +spin_lock_init (&priv->tx_lock); priv->dev = dev; priv->ring_size =64 ; priv->msg_enable =netif_msg_init (debug_level,0xff );
drivers/net/cs89x0.c +16 -1
@@ -234,6 +234,7 @@ struct net_local {int send_underrun;/* keep track of how many underruns in a row we get */ int force;/* force various values; see FORCE* above. */ spinlock_t lock; +spinlock_t tx_lock;#if ALLOW_DMA int use_dma;/* Flag: we're using dma */ int dma;/* DMA channel */
@@ -522,6 +523,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)if (!modular) {memset (lp,0 ,sizeof (*lp));spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); #ifndef MODULE #if ALLOW_DMA if (g_cs89x0_dma) {
@@ -1516,7 +1518,7 @@ static void net_timeout(struct net_device *dev)netif_wake_queue (dev); } -static int net_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __net_send_packet (struct sk_buff *skb,struct net_device *dev) {struct net_local *lp =netdev_priv (dev);
@@ -1569,6 +1571,18 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int net_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct net_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__net_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* The typical workload of the driver: Handle the network interface interrupts. */
@@ -1928,6 +1942,7 @@ int __init init_module(void)#endif spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);/* boy, they'd better get these right */ if (!strcmp (media,"rj45" ))
drivers/net/de600.c +13 -1
@@ -93,6 +93,7 @@ static volatile int tx_fifo_out;static volatile int free_tx_pages =TX_PAGES ;static int was_down;static DEFINE_SPINLOCK (de600_lock); +static DEFINE_SPINLOCK (de600_tx_lock);static inline u8 de600_read_status (struct net_device *dev) {
@@ -168,7 +169,7 @@ static inline void trigger_interrupt(struct net_device *dev)* Start sending. */ -static int de600_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __de600_start_xmit (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;int transmit_from;
@@ -241,6 +242,17 @@ static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int de600_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +int ret; + +spin_lock (&de600_tx_lock); + ret =__de600_start_xmit (skb, dev); +spin_unlock (&de600_tx_lock); + +return ret; +} +/* * The typical workload of the driver: * Handle the network interface interrupts.
drivers/net/de620.c +14 -4
@@ -188,7 +188,8 @@ static int clone = DE620_CLONE;static unsigned int de620_debug =DE620_DEBUG ; -static spinlock_t de620_lock; +static DEFINE_SPINLOCK (de620_lock); +static DEFINE_SPINLOCK (de620_tx_lock);module_param (bnc, int,0 );module_param (utp, int,0 );
@@ -521,7 +522,7 @@ static void de620_timeout(struct net_device *dev)* Copy a buffer to the adapter transmit page memory. * Start sending. */ -static int de620_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __de620_start_xmit (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;int len;
@@ -574,6 +575,17 @@ static int de620_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int de620_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +int ret; + +spin_lock (&de620_tx_lock); + ret =__de620_start_xmit (skb, dev); +spin_unlock (&de620_tx_lock); + +return ret; +} +/***************************************************** * * Handle the network interface interrupts.
@@ -813,8 +825,6 @@ struct net_device * __init de620_probe(int unit)if (!dev) goto out; -spin_lock_init (&de620_lock); -/* * This is where the base_addr and irq gets set. * Tunable at compile-time and insmod-time
drivers/net/declance.c +15 -1
@@ -254,6 +254,7 @@ struct lance_private {volatile struct lance_regs *ll;spinlock_t lock; +spinlock_t tx_lock;int rx_new, tx_new;int rx_old, tx_old;
@@ -891,7 +892,7 @@ static void lance_tx_timeout(struct net_device *dev)netif_wake_queue (dev); } -static int lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __lance_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct lance_private *lp =netdev_priv (dev);volatile struct lance_regs *ll = lp->ll;
@@ -932,6 +933,18 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int lance_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct lance_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__lance_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +static void lance_load_multicast (struct net_device *dev) {struct lance_private *lp =netdev_priv (dev);
@@ -1055,6 +1068,7 @@ static int __init dec_lance_probe(struct device *bdev, const int type)*/ lp =netdev_priv (dev);spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); lp->type = type;switch (type) {
drivers/net/defxx.c +15 -7
@@ -1420,6 +1420,7 @@ static int dfx_open(struct net_device *dev) bp->group_prom =PI_FSTATE_K_BLOCK ;spin_lock_init (&bp->lock); +spin_lock_init (&bp->tx_lock);/* Reset and initialize adapter */
@@ -3186,12 +3187,8 @@ static void dfx_rcv_queue_process(* None */ -static int dfx_xmt_queue_pkt ( -struct sk_buff *skb, -struct net_device *dev - ) - - { +static int __dfx_xmt_queue_pkt (struct sk_buff *skb,struct net_device *dev) +{DFX_board_t *bp =netdev_priv (dev);u8 prod;/* local transmit producer index */ PI_XMT_DESCR *p_xmt_descr;/* ptr to transmit descriptor block entry */
@@ -3344,8 +3341,19 @@ static int dfx_xmt_queue_pkt(spin_unlock_irqrestore (&bp->lock, flags);netif_wake_queue (dev);return (0 );/* packet queued to adapter */ - } +} +static int dfx_xmt_queue_pkt (struct sk_buff *skb,struct net_device *dev) +{ +DFX_board_t *bp =netdev_priv (dev); +int ret; + +spin_lock (&bp->tx_lock); + ret =__dfx_xmt_queue_pkt (skb, dev); +spin_unlock (&bp->tx_lock); + +return ret; +}/* * ================
drivers/net/defxx.h +1 -0
@@ -1765,6 +1765,7 @@ typedef struct DFX_board_tag/* Transmit spinlocks */ spinlock_t lock; +spinlock_t tx_lock;/* Store device, bus-specific, and parameter information for this adapter */
drivers/net/depca.c +15 -1
@@ -486,6 +486,7 @@ struct depca_private {int rx_new, tx_new;/* The next free ring entry */ int rx_old, tx_old;/* The ring entries to be free()ed. */ spinlock_t lock; +spinlock_t tx_lock;struct {/* Private stats counters */ u32 bins[DEPCA_PKT_STAT_SZ ];u32 unicast;
@@ -669,6 +670,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) }spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);sprintf (lp->adapter_name,"%s (%s)" , depca_signature[lp->adapter], device->bus_id); status = -EBUSY ;
@@ -922,7 +924,7 @@ static void depca_tx_timeout(struct net_device *dev)/* ** Writes a socket buffer to TX descriptor ring and starts transmission */ -static int depca_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __depca_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct depca_private *lp = (struct depca_private *) dev->priv;u_long ioaddr = dev->base_addr;
@@ -957,6 +959,18 @@ static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev)return status; } +static int depca_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct depca_private *lp = (struct depca_private *) dev->priv; +int ret; + +spin_lock (&lp->tx_lock); + ret =__depca_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* ** The DEPCA interrupt handler. */
drivers/net/dl2k.c +14 -2
@@ -594,8 +594,7 @@ alloc_list (struct net_device *dev)return ; } -static int -start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __start_xmit (struct sk_buff *skb,struct net_device *dev) {struct netdev_private *np =netdev_priv (dev);struct netdev_desc *txdesc;
@@ -665,6 +664,19 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct netdev_private *np =netdev_priv (dev); +unsigned long flags; +int ret; + +spin_lock_irqsave (&np->tx_lock, flags); + ret =__start_xmit (skb, dev); +spin_unlock_irqrestore (&np->tx_lock, flags); + +return ret; +} +static irqreturn_t rio_interrupt (int irq,void *dev_instance) {
drivers/net/dm9000.c +15 -2
@@ -121,6 +121,7 @@ typedef struct board_info {struct net_device *ndev;spinlock_t lock; +spinlock_t tx_lock;struct mii_if_info mii;u32 msg_enable;
@@ -553,6 +554,7 @@ dm9000_probe(struct platform_device *pdev) db->ndev = ndev;spin_lock_init (&db->lock); +spin_lock_init (&db->tx_lock);mutex_init (&db->addr_lock);INIT_DELAYED_WORK (&db->phy_poll, dm9000_poll_work);
@@ -835,8 +837,7 @@ dm9000_init_dm9000(struct net_device *dev)* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int -dm9000_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __dm9000_start_xmit (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;board_info_t *db = (board_info_t *) dev->priv;
@@ -879,6 +880,18 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int dm9000_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +board_info_t *db =netdev_priv (dev); +int ret; + +spin_lock (&db->tx_lock); + ret =__dm9000_start_xmit (skb, dev); +spin_unlock (&db->tx_lock); + +return ret; +} +static void dm9000_shutdown (struct net_device *dev) {
drivers/net/dummy.c +5 -0
@@ -35,10 +35,13 @@#include <linux/init.h> #include <linux/moduleparam.h> #include <linux/rtnetlink.h> +#include <linux/spinlock.h> #include <net/rtnetlink.h> static int numdummies =1 ; +static DEFINE_SPINLOCK (dummy_tx_lock); +static int dummy_xmit (struct sk_buff *skb,struct net_device *dev);static int dummy_set_address (struct net_device *dev,void *p)
@@ -76,10 +79,12 @@ static void dummy_setup(struct net_device *dev)static int dummy_xmit (struct sk_buff *skb,struct net_device *dev) { +spin_lock (&dummy_tx_lock); dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len;dev_kfree_skb (skb); +spin_unlock (&dummy_tx_lock);return 0 ; }
drivers/net/e100.c +15 -1
@@ -542,6 +542,7 @@ struct nic {struct rfd blank_rfd;enum ru_state ru_running; +spinlock_t tx_lock;spinlock_t cb_lock____cacheline_aligned ;spinlock_t cmd_lock;struct csr __iomem *csr;
@@ -1633,7 +1634,7 @@ static void e100_xmit_prepare(struct nic *nic, struct cb *cb, cb->u.tcb.tbd.size =cpu_to_le16 (skb->len); } -static int e100_xmit_frame (struct sk_buff *skb,struct net_device *netdev) +static int __e100_xmit_frame (struct sk_buff *skb,struct net_device *netdev) {struct nic *nic =netdev_priv (netdev);int err;
@@ -1666,6 +1667,18 @@ static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev)return 0 ; } +static int e100_xmit_frame (struct sk_buff *skb,struct net_device *netdev) +{ +struct nic *nic =netdev_priv (netdev); +int ret; + +spin_lock (&nic->tx_lock); + ret =__e100_xmit_frame (skb, netdev); +spin_unlock (&nic->tx_lock); + +return ret; +} +static int e100_tx_clean (struct nic *nic) {struct net_device *dev = nic->netdev;
@@ -2686,6 +2699,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,e100_get_defaults (nic);/* locks must be initialized before calling hw_reset */ +spin_lock_init (&nic->tx_lock);spin_lock_init (&nic->cb_lock);spin_lock_init (&nic->cmd_lock);spin_lock_init (&nic->mdio_lock);
drivers/net/eepro.c +14 -1
@@ -205,6 +205,7 @@ struct eepro_local {int stepping;spinlock_t lock;/* Serializing lock */ +spinlock_t tx_lock;unsigned rcv_ram;/* pre-calculated space for rx */ unsigned xmt_ram;/* pre-calculated space for tx */
@@ -784,6 +785,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) lp->xmt_upper_limit_reg =XMT_UPPER_LIMIT_REG_PRO ; lp->eeprom_reg =EEPROM_REG_PRO ;spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);/* Now, get the ethernet hardware address from the EEPROM */
@@ -1127,7 +1129,7 @@ static void eepro_tx_timeout (struct net_device *dev) } -static int eepro_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __eepro_send_packet (struct sk_buff *skb,struct net_device *dev) {struct eepro_local *lp =netdev_priv (dev);unsigned long flags;
@@ -1175,6 +1177,17 @@ static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int eepro_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct eepro_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__eepro_send_packet (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}/* The typical workload of the driver: Handle the network interface interrupts. */
drivers/net/enc28j60.c +15 -1
@@ -60,6 +60,7 @@ struct enc28j60_net {struct net_device *netdev;struct spi_device *spi;struct mutex lock; +spinlock_t tx_lock;struct sk_buff *tx_skb;struct work_struct tx_work;struct work_struct irq_work;
@@ -1249,7 +1250,7 @@ static void enc28j60_hw_tx(struct enc28j60_net *priv)locked_reg_bfset (priv,ECON1 ,ECON1_TXRTS ); } -static int enc28j60_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __enc28j60_send_packet (struct sk_buff *skb,struct net_device *dev) {struct enc28j60_net *priv =netdev_priv (dev);
@@ -1275,6 +1276,18 @@ static int enc28j60_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int enc28j60_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct enc28j60_net *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__enc28j60_send_packet (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +static void enc28j60_tx_work_handler (struct work_struct *work) { struct enc28j60_net *priv =
@@ -1526,6 +1539,7 @@ static int __devinit enc28j60_probe(struct spi_device *spi) } priv =netdev_priv (dev); +spin_lock_init (&priv->tx_lock); priv->netdev = dev;/* priv to netdev reference */ priv->spi = spi;/* priv to spi reference */ priv->msg_enable = netif_msg_init(debug.msg_enable,
drivers/net/epic100.c +15 -1
@@ -266,6 +266,7 @@ struct epic_private {/* Ring pointers. */ spinlock_t lock;/* Group with Tx control cache line. */ +spinlock_t tx_lock;spinlock_t napi_lock;struct napi_struct napi;unsigned int reschedule_in_poll;
@@ -405,6 +406,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, dev->irq = irq;spin_lock_init (&ep->lock); +spin_lock_init (&ep->tx_lock);spin_lock_init (&ep->napi_lock); ep->reschedule_in_poll =0 ;
@@ -958,7 +960,7 @@ static void epic_init_ring(struct net_device *dev)return ; } -static int epic_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __epic_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct epic_private *ep = dev->priv;int entry, free_count;
@@ -1013,6 +1015,18 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int epic_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct epic_private *ep = dev->priv; +int ret; + +spin_lock (&ep->tx_lock); + ret =__epic_start_xmit (skb, dev); +spin_unlock (&ep->tx_lock); + +return ret; +} +static void epic_tx_error (struct net_device *dev,struct epic_private *ep,int status) {
drivers/net/eth16i.c +15 -1
@@ -389,6 +389,7 @@ struct eth16i_local {unsigned long tx_buffered_bytes;unsigned long col_16;spinlock_t lock; +spinlock_t tx_lock; };/* Function prototypes */
@@ -557,6 +558,7 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr) dev->tx_timeout = eth16i_timeout; dev->watchdog_timeo =TX_TIMEOUT ;spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock); retval =register_netdev (dev);if (retval)
@@ -1047,7 +1049,7 @@ static void eth16i_timeout(struct net_device *dev)netif_wake_queue (dev); } -static int eth16i_tx (struct sk_buff *skb,struct net_device *dev) +static int __eth16i_tx (struct sk_buff *skb,struct net_device *dev) {struct eth16i_local *lp =netdev_priv (dev);int ioaddr = dev->base_addr;
@@ -1123,6 +1125,18 @@ static int eth16i_tx(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int eth16i_tx (struct sk_buff *skb,struct net_device *dev) +{ +struct eth16i_local *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__eth16i_tx (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +static void eth16i_rx (struct net_device *dev) {int ioaddr = dev->base_addr;
drivers/net/ewrk3.c +15 -1
@@ -284,6 +284,7 @@ struct ewrk3_private {void __iomem *mctbl;/* Pointer to the multicast table */ u_char led_mask;/* Used to reserve LED access for ethtool */ spinlock_t hw_lock; +spinlock_t tx_lock; };/*
@@ -538,6 +539,7 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase) lp->hard_strapped = hard_strapped; lp->led_mask =CR_LED ;spin_lock_init (&lp->hw_lock); +spin_lock_init (&lp->tx_lock); lp->mPage =64 ;if (cmr &CMR_DRAM )
@@ -760,7 +762,7 @@ static void ewrk3_timeout(struct net_device *dev)/* ** Writes a socket buffer to the free page queue */ -static int ewrk3_queue_pkt (struct sk_buff *skb,struct net_device *dev) +static int __ewrk3_queue_pkt (struct sk_buff *skb,struct net_device *dev) {struct ewrk3_private *lp =netdev_priv (dev);u_long iobase = dev->base_addr;
@@ -872,6 +874,18 @@ err_out:return 1 ; } +static int ewrk3_queue_pkt (struct sk_buff *skb,struct net_device *dev) +{ +struct ewrk3_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__ewrk3_queue_pkt (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +} +/* ** The EWRK3 interrupt handler. */
drivers/net/fec_mpc52xx.c +17 -1
@@ -56,6 +56,7 @@ struct mpc52xx_fec_priv {struct bcom_task *rx_dmatsk;struct bcom_task *tx_dmatsk;spinlock_t lock; +spinlock_t tx_lock;int msg_enable;/* MDIO link details */
@@ -375,7 +376,8 @@ static int mpc52xx_fec_close(struct net_device *dev)* invariant will hold if you make sure that the netif_*_queue() * calls are done at the proper times. */ -static int mpc52xx_fec_hard_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __mpc52xx_fec_hard_start_xmit (struct sk_buff *skb, +struct net_device *dev) {struct mpc52xx_fec_priv *priv =netdev_priv (dev);struct bcom_fec_bd *bd;
@@ -406,6 +408,19 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *dreturn 0 ; } +static int mpc52xx_fec_hard_start_xmit (struct sk_buff *skb, +struct net_device *dev) +{ +struct mpc52xx_fec_priv *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__mpc52xx_fec_hard_start_xmit (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +/* This handles BestComm transmit task interrupts */ static irqreturn_t mpc52xx_fec_tx_interrupt (int irq,void *dev_id)
@@ -935,6 +950,7 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) priv->t_irq = priv->r_irq = ndev->irq =NO_IRQ ;/* IRQ are free for now */ spin_lock_init (&priv->lock); +spin_lock_init (&priv->tx_lock);/* ioremap the zones */ priv->fec =ioremap (mem.start,sizeof (struct mpc52xx_fec ));
drivers/net/forcedeth.c +30 -2
@@ -700,6 +700,7 @@ struct nv_skb_map {/* in dev: base, irq */ struct fe_priv {spinlock_t lock; +spinlock_t tx_lock;struct net_device *dev;struct napi_struct napi;
@@ -1995,7 +1996,7 @@ static void nv_gear_backoff_reseed(struct net_device *dev)* nv_start_xmit: dev->hard_start_xmit function * Called with netif_tx_lock held. */ -static int nv_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __nv_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct fe_priv *np =netdev_priv (dev);u32 tx_flags =0 ;
@@ -2112,7 +2113,20 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } -static int nv_start_xmit_optimized (struct sk_buff *skb,struct net_device *dev) +static int nv_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct fe_priv *np =netdev_priv (dev); +int ret; + +spin_lock (&np->tx_lock); + ret =__nv_start_xmit (skb, dev); +spin_unlock (&np->tx_lock); + +return ret; +} + +static int __nv_start_xmit_optimized (struct sk_buff *skb, +struct net_device *dev) {struct fe_priv *np =netdev_priv (dev);u32 tx_flags =0 ;
@@ -2263,6 +2277,19 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } +static int nv_start_xmit_optimized (struct sk_buff *skb, +struct net_device *dev) +{ +struct fe_priv *np =netdev_priv (dev); +int ret; + +spin_lock (&np->tx_lock); + ret =__nv_start_xmit_optimized (skb, dev); +spin_unlock (&np->tx_lock); + +return ret; +} +static inline void nv_tx_flip_ownership (struct net_device *dev) {struct fe_priv *np =netdev_priv (dev);
@@ -5343,6 +5370,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i np->dev = dev; np->pci_dev = pci_dev;spin_lock_init (&np->lock); +spin_lock_init (&np->tx_lock);SET_NETDEV_DEV (dev, &pci_dev->dev);init_timer (&np->oom_kick);
drivers/net/gianfar.c +14 -1
@@ -215,6 +215,7 @@ static int gfar_probe(struct platform_device *pdev) }spin_lock_init (&priv->txlock); +spin_lock_init (&priv->tx_lock);spin_lock_init (&priv->rxlock);platform_set_drvdata (pdev, dev);
@@ -1026,7 +1027,7 @@ void inline gfar_tx_vlan(struct sk_buff *skb, struct txfcb *fcb)/* This is called by the kernel when a frame is ready for transmission. */ /* It is pointed to by the dev->hard_start_xmit function pointer */ -static int gfar_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __gfar_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct gfar_private *priv =netdev_priv (dev);struct txfcb *fcb =NULL ;
@@ -1123,6 +1124,18 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int gfar_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct gfar_private *priv =netdev_priv (dev); +int ret; + +spin_lock (&priv->tx_lock); + ret =__gfar_start_xmit (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +} +/* Stops the kernel queue, and halts the controller */ static int gfar_close (struct net_device *dev) {
drivers/net/gianfar.h +1 -0
@@ -676,6 +676,7 @@ struct gfar {struct gfar_private {/* Fields controlled by TX lock */ spinlock_t txlock; +spinlock_t tx_lock;/* Pointer to the array of skbuffs */ struct sk_buff ** tx_skbuff;
drivers/net/hamachi.c +15 -1
@@ -497,6 +497,7 @@ struct hamachi_private {struct timer_list timer;/* Media selection timer. */ /* Frequently used and paired value: keep adjacent for cache effect. */ spinlock_t lock; +spinlock_t tx_lock;int chip_id;unsigned int cur_rx, dirty_rx;/* Producer/consumer ring indices */ unsigned int cur_tx, dirty_tx;
@@ -636,6 +637,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, hmp =netdev_priv (dev);spin_lock_init (&hmp->lock); +spin_lock_init (&hmp->tx_lock); hmp->mii_if.dev = dev; hmp->mii_if.mdio_read = mdio_read;
@@ -1253,7 +1255,7 @@ do { \ } while (0)#endif -static int hamachi_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __hamachi_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct hamachi_private *hmp =netdev_priv (dev);unsigned entry;
@@ -1366,6 +1368,18 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int hamachi_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct hamachi_private *hmp =netdev_priv (dev); +int ret; + +spin_lock (&hmp->tx_lock); + ret =__hamachi_start_xmit (skb, dev); +spin_unlock (&hmp->tx_lock); + +return ret; +} +/* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ static irqreturn_t hamachi_interrupt (int irq,void *dev_instance)
drivers/net/hamradio/baycom_epp.c +15 -1
@@ -193,6 +193,7 @@ struct baycom_state {unsigned char buf[TXBUFFER_SIZE ]; } hdlcrx; +spinlock_t tx_lock;struct {int calibrate;int slotcnt;
@@ -769,7 +770,7 @@ static void epp_bh(struct work_struct *work)* ===================== network driver interface ========================= */ -static int baycom_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __baycom_send_packet (struct sk_buff *skb,struct net_device *dev) {struct baycom_state *bc =netdev_priv (dev);
@@ -790,6 +791,18 @@ static int baycom_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int baycom_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct baycom_state *bc =netdev_priv (dev); +int ret; + +spin_lock (&bc->tx_lock); + ret =__baycom_send_packet (skb, dev); +spin_unlock (&bc->tx_lock); + +return ret; +} +/* --------------------------------------------------------------------- */ static int baycom_set_mac_address (struct net_device *dev,void *addr)
@@ -1135,6 +1148,7 @@ static void baycom_probe(struct net_device *dev)* not a real probe! only initialize data structures */ bc =netdev_priv (dev); +spin_lock_init (&bc->tx_lock);/* * initialize the baycom_state struct */
drivers/net/hamradio/bpqether.c +15 -1
@@ -107,6 +107,7 @@ static struct notifier_block bpq_dev_notifier = {struct bpqdev { +spinlock_t tx_lock;struct list_head bpq_list;/* list of bpq devices chain */ struct net_device *ethdev;/* link to ethernet device */ struct net_device *axdev;/* bpq device (bpq#) */
@@ -234,7 +235,7 @@ drop:/* * Send an AX.25 frame via an ethernet interface */ -static int bpq_xmit (struct sk_buff *skb,struct net_device *dev) +static int __bpq_xmit (struct sk_buff *skb,struct net_device *dev) {struct sk_buff *newskb;unsigned char *ptr;
@@ -295,6 +296,18 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int bpq_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct bpqdev *bpq =netdev_priv (dev); +int ret; + +spin_lock (&bpq->tx_lock); + ret =__bpq_xmit (skb, dev); +spin_unlock (&bpq->tx_lock); + +return ret; +} +/* * Statistics */
@@ -509,6 +522,7 @@ static int bpq_new_device(struct net_device *edev) bpq =netdev_priv (ndev); +spin_lock_init (&bpq->tx_lock);dev_hold (edev); bpq->ethdev = edev; bpq->axdev = ndev;
drivers/net/hamradio/dmascc.c +14 -1
@@ -215,6 +215,7 @@ struct scc_priv {int rr0;spinlock_t *register_lock;/* Per scc_info */ spinlock_t ring_lock; +spinlock_t tx_lock; };struct scc_info {
@@ -559,6 +560,7 @@ static int __init setup_adapter(int card_base, int type, int n) priv->info = info; priv->channel = i;spin_lock_init (&priv->ring_lock); +spin_lock_init (&priv->tx_lock); priv->register_lock = &info->register_lock; priv->card_base = card_base; priv->scc_cmd = scc_base + (i ?SCCB_CMD :SCCA_CMD );
@@ -916,7 +918,7 @@ static int scc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) } -static int scc_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __scc_send_packet (struct sk_buff *skb,struct net_device *dev) {struct scc_priv *priv = dev->priv;unsigned long flags;
@@ -960,6 +962,17 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int scc_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct scc_priv *priv = dev->priv; +int ret; + +spin_lock (&priv->tx_lock); + ret =__scc_send_packet (skb, dev); +spin_unlock (&priv->tx_lock); + +return ret; +}static struct net_device_stats *scc_get_stats (struct net_device *dev) {
drivers/net/hamradio/hdlcdrv.c +14 -1
@@ -399,7 +399,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)* ===================== network driver interface ========================= */ -static int hdlcdrv_send_packet (struct sk_buff *skb,struct net_device *dev) +static int __hdlcdrv_send_packet (struct sk_buff *skb,struct net_device *dev) {struct hdlcdrv_state *sm =netdev_priv (dev);
@@ -415,6 +415,18 @@ static int hdlcdrv_send_packet(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int hdlcdrv_send_packet (struct sk_buff *skb,struct net_device *dev) +{ +struct hdlcdrv_state *sm =netdev_priv (dev); +int ret; + +spin_lock (&sm->tx_lock); + ret =__hdlcdrv_send_packet (skb, dev); +spin_unlock (&sm->tx_lock); + +return ret; +} +/* --------------------------------------------------------------------- */ static int hdlcdrv_set_mac_address (struct net_device *dev,void *addr)
@@ -717,6 +729,7 @@ struct net_device *hdlcdrv_register(const struct hdlcdrv_ops *ops,* initialize part of the hdlcdrv_state struct */ s =netdev_priv (dev); +spin_lock_init (&s->tx_lock); s->magic =HDLCDRV_MAGIC ; s->ops = ops; dev->base_addr = baseaddr;
drivers/net/hamradio/mkiss.c +15 -1
@@ -50,6 +50,7 @@struct mkiss {struct tty_struct *tty;/* ptr to TTY structure */ struct net_device *dev;/* easy for intr handling */ +spinlock_t tx_lock;/* These are pointers to the malloc()ed frame buffers. */ spinlock_t buflock;/* lock for rbuf and xbuf */
@@ -528,7 +529,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) }/* Encapsulate an AX.25 packet and kick it into a TTY queue. */ -static int ax_xmit (struct sk_buff *skb,struct net_device *dev) +static int __ax_xmit (struct sk_buff *skb,struct net_device *dev) {struct mkiss *ax =netdev_priv (dev);
@@ -566,6 +567,18 @@ static int ax_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int ax_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct mkiss *ax =netdev_priv (dev); +int ret; + +spin_lock (&ax->tx_lock); + ret =__ax_xmit (skb, dev); +spin_unlock (&ax->tx_lock); + +return ret; +} +static int ax_open_dev (struct net_device *dev) {struct mkiss *ax =netdev_priv (dev);
@@ -641,6 +654,7 @@ static int ax_open(struct net_device *dev) ax->flags &= (1 <<AXF_INUSE );/* Clear ESCAPE & ERROR flags */ spin_lock_init (&ax->buflock); +spin_lock_init (&ax->tx_lock);return 0 ;
drivers/net/hamradio/scc.c +14 -1
@@ -1521,6 +1521,7 @@ static int scc_net_alloc(const char *name, struct scc_channel *scc) dev->priv = scc; scc->dev = dev;spin_lock_init (&scc->lock); +spin_lock_init (&scc->tx_lock);init_timer (&scc->tx_t);init_timer (&scc->tx_wdog);
@@ -1633,7 +1634,7 @@ static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb)/* ----> transmit frame <---- */ -static int scc_net_tx (struct sk_buff *skb,struct net_device *dev) +static int __scc_net_tx (struct sk_buff *skb,struct net_device *dev) {struct scc_channel *scc = (struct scc_channel *) dev->priv;unsigned long flags;
@@ -1686,6 +1687,18 @@ static int scc_net_tx(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int scc_net_tx (struct sk_buff *skb,struct net_device *dev) +{ +struct scc_channel *scc = (struct scc_channel *) dev->priv; +int ret; + +spin_lock (&scc->tx_lock); + ret =__scc_net_tx (skb, dev); +spin_unlock (&scc->tx_lock); + +return ret; +} +/* ----> ioctl functions <---- */ /*
drivers/net/hamradio/yam.c +4 -0
@@ -132,6 +132,7 @@ struct yam_port {/* Tx section */ +spinlock_t tx_lock;int tx_state;int tx_count;int slotcnt;
@@ -553,8 +554,10 @@ static int yam_send_packet(struct sk_buff *skb, struct net_device *dev) {struct yam_port *yp =netdev_priv (dev); +spin_lock (&yp->tx_lock);skb_queue_tail (&yp->send_queue, skb); dev->trans_start = jiffies; +spin_unlock (&yp->tx_lock);return 0 ; }
@@ -1073,6 +1076,7 @@ static void yam_setup(struct net_device *dev) {struct yam_port *yp =netdev_priv (dev); +spin_lock_init (&yp->tx_lock); yp->magic =YAM_MAGIC ; yp->bitrate =DEFAULT_BITRATE ; yp->baudrate =DEFAULT_BITRATE *2 ;
drivers/net/hp100.c +26 -2
@@ -150,6 +150,7 @@struct hp100_private {spinlock_t lock; +spinlock_t tx_lock;char id[HP100_SIG_LEN ];u_short chip;u_short soft_model;
@@ -636,6 +637,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, lp =netdev_priv (dev);spin_lock_init (&lp->lock); +spin_lock_init (&lp->tx_lock);strlcpy (lp->id, eid,HP100_SIG_LEN ); lp->chip = chip; lp->mode = local_mode;
@@ -1467,7 +1469,7 @@ static int hp100_check_lan(struct net_device *dev)*/ /* tx function for busmaster mode */ -static int hp100_start_xmit_bm (struct sk_buff *skb,struct net_device *dev) +static int __hp100_start_xmit_bm (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;int i, ok_flag;
@@ -1577,6 +1579,17 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int hp100_start_xmit_bm (struct sk_buff *skb,struct net_device *dev) +{ +struct hp100_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__hp100_start_xmit_bm (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}/* clean_txring checks if packets have been sent by the card by reading * the TX_PDL register from the performance page and comparing it to the
@@ -1620,7 +1633,7 @@ static void hp100_clean_txring(struct net_device *dev) }/* tx function for slave modes */ -static int hp100_start_xmit (struct sk_buff *skb,struct net_device *dev) +static int __hp100_start_xmit (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;int i, ok_flag;
@@ -1745,6 +1758,17 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } +static int hp100_start_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct hp100_private *lp =netdev_priv (dev); +int ret; + +spin_lock (&lp->tx_lock); + ret =__hp100_start_xmit (skb, dev); +spin_unlock (&lp->tx_lock); + +return ret; +}/* * Receive Function (Non-Busmaster mode)
drivers/net/ibm_newemac/core.c +27 -2
@@ -1315,7 +1315,7 @@ static inline int emac_xmit_finish(struct emac_instance *dev, int len) }/* Tx lock BH */ -static int emac_start_xmit (struct sk_buff *skb,struct net_device *ndev) +static int __emac_start_xmit (struct sk_buff *skb,struct net_device *ndev) {struct emac_instance *dev =netdev_priv (ndev);unsigned int len = skb->len;
@@ -1343,6 +1343,18 @@ static int emac_start_xmit(struct sk_buff *skb, struct net_device *ndev)return emac_xmit_finish (dev, len); } +static int emac_start_xmit (struct sk_buff *skb,struct net_device *ndev) +{ +struct emac_instance *dev =netdev_priv (ndev); +int ret; + +spin_lock (&dev->tx_lock); + ret =__emac_start_xmit (skb, ndev); +spin_unlock (&dev->tx_lock); + +return ret; +} +static inline int emac_xmit_split (struct emac_instance *dev,int slot,u32 pd,int len,int last,u16 base_ctrl) {
@@ -1373,7 +1385,7 @@ static inline int emac_xmit_split(struct emac_instance *dev, int slot, }/* Tx lock BH disabled (SG version for TAH equipped EMACs) */ -static int emac_start_xmit_sg (struct sk_buff *skb,struct net_device *ndev) +static int __emac_start_xmit_sg (struct sk_buff *skb,struct net_device *ndev) {struct emac_instance *dev =netdev_priv (ndev);int nr_frags =skb_shinfo (skb)->nr_frags;
@@ -1456,6 +1468,18 @@ static int emac_start_xmit_sg(struct sk_buff *skb, struct net_device *ndev)return 1 ; } +static int emac_start_xmit_sg (struct sk_buff *skb,struct net_device *ndev) +{ +struct emac_instance *dev =netdev_priv (ndev); +int ret; + +spin_lock (&dev->tx_lock); + ret =__emac_start_xmit_sg (skb, ndev); +spin_unlock (&dev->tx_lock); + +return ret; +} +/* Tx lock BHs */ static void emac_parse_tx_error (struct emac_instance *dev,u16 ctrl) {
@@ -2653,6 +2677,7 @@ static int __devinit emac_probe(struct of_device *ofdev,mutex_init (&dev->mdio_lock);mutex_init (&dev->link_lock);spin_lock_init (&dev->lock); +spin_lock_init (&dev->tx_lock);INIT_WORK (&dev->reset_work, emac_reset_work);/* Init various config data based on device-tree */
drivers/net/ibm_newemac/core.h +1 -0
@@ -266,6 +266,7 @@ struct emac_instance {int opened;struct work_struct reset_work;spinlock_t lock; +spinlock_t tx_lock; };/*
drivers/net/ibmlana.c +14 -1
@@ -813,7 +813,7 @@ static int ibmlana_close(struct net_device *dev)/* transmit a block. */ -static int ibmlana_tx (struct sk_buff *skb,struct net_device *dev)
Lines of this file are not shown. View the raw message.
drivers/net/wireless/airo.c +44 -3
47 lines not on this page · raw message
drivers/net/wireless/hostap/hostap_80211_tx.c +39 -3
42 lines not on this page · raw message
drivers/net/wireless/hostap/hostap_main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/hostap/hostap_wlan.h +1 -0
Lines of this file are not shown. View the raw message.
net/mac80211/tx.c +44 -6
50 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Wed, 25 Jun 2008 01:33:55 -0700 (PDT)
Quoted 1 line
Here is the patch I've been crunching on the past few days.
So after spending all of that time hand-editing 350+ drivers I realize that my approach is all wrong :-) I've also written up a blog entry about netdev TX locking at the usual spot:
http://vger.kernel.org/~davem/cgi-bin/blog.cgi/index.html
I tried today to take the next step and actually remove the netdev->_xmit_lock and the problems became clear.
My new plan is to move the qdisc state down into the drivers too. And also perhaps provide a better transition path.
There is, of course, the question of semantics.
Currently I think we should:
1) By default do pure replication. If qdisc X is configured for device Y, then X is configured for each of device Y'd transmit queues.
2) A "TX queue index" attribute is added for qdisc netlink config messages. If present, the request applies only to the qdisc of a specific transmit queue of the device. Otherwise we replicate the request onto all transmit queues.
This would mean that old tools work and do something mostly sane on multiqueue devices.
Maybe in the end this is nicer. All the qdisc management can move under the driver's ->tx_lock. Or even, the qdisc can be the locked element. The idea being we stick a lock in there and that's what the driver holds across ->hard_start_xmit().
Qdisc running will thus be naturally batched, rather than the ad-hoc scheme we have now where we set some "running the queue" state bit since we can't hold the qdisc lock and the TX lock at the same time.
In this manner the qdisc object works sort of like a NAPI context. It provides the synchronization and packet processing locking semantics.
The only part I haven't figured out is how to glue the scheduler API bits down into the per-queue qdiscs.
Another thing I noticed in all of this is that we perhaps want to replicate the ingress qdisc bits when there are multiple receive queues.
One thing I want to avoid, for the TX qdiscs, is having some array of pointers and a TX queue count stored in the netdev struct.
Anyways, I'll see if this works out.
David Miller wrote, On 06/26/2008 11:35 AM:
...
Quoted 4 lines
I've also written up a blog
entry about netdev TX locking at the usual spot:
...So, why exactly this nice lady didn't like new TX locking?
Regards,
Jarek P.
David Miller
maintainerFrom: Jarek Poplawski <[email protected]>
Date: Fri, 27 Jun 2008 13:06:31 +0200
Quoted 9 lines
David Miller wrote, On 06/26/2008 11:35 AM:
...Quoted 4 lines
I've also written up a blog
entry about netdev TX locking at the usual spot:...So, why exactly this nice lady didn't like new TX locking?
Actually that photo is from a trip to cut down a Christmas tree at a local tree farm up in the Cascade mountains 2 years ago :-)
And this lady would have good reason to not like the new TX locking I had proposed, it was completely the wrong approach.
I have a new set of patches which already seems a lot saner and should be in a state I can publish in a few days.
The new idea is to replicate the qdisc state and the TX lock into an array of per-queue state blobs. So we now have:
--------------------
enum netdev_tx_state_t
{
__LINK_TX_STATE_XOFF=0,
__LINK_TX_STATE_QDISC_RUNNING,
};struct netdev_tx_queue {
spinlock_t lock;
unsigned long state;
spinlock_t _xmit_lock;
struct Qdisc *qdisc;
struct netdev_tx_queue *next_sched;
struct net_device *dev;
struct Qdisc *qdisc_sleeping;
struct list_head qdisc_list;
};--------------------
And struct net_device gets:
____________________
struct netdev_tx_queue *_tx ____cacheline_aligned_in_smp; unsigned short num_tx_queues; unsigned short real_num_tx_queues; unsigned int tx_queue_len;
--------------------
It's done in such a way that non-multiqueue drivers simply keep on working out of the box. For example, all the existing non-multiqueue-aware interfaces simply operate on queue 0.
The part I haven't coded up yet is the qdisc replication bits. But once that's done all I really need to do is grind through the patch set with allmodconfig/allyesconfig test builds before posting a first draft.
Not having to touch 400 drivers this time around is a good initial sign :)