Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 279170
b: refs/heads/master
c: 86d8c07
h: refs/heads/master
v: v3
  • Loading branch information
Sascha Hauer authored and David S. Miller committed Jan 3, 2012
1 parent 1ffc641 commit a2aaeef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa0f5aa74316c636427ac92dad0bc5714c34ca17
refs/heads/master: 86d8c07ff2448eb4e860e50f34ef6ee78e45c40c
8 changes: 8 additions & 0 deletions trunk/drivers/net/ethernet/ti/davinci_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";
#define EMAC_DEF_TX_CH (0) /* Default 0th channel */
#define EMAC_DEF_RX_CH (0) /* Default 0th channel */
#define EMAC_DEF_RX_NUM_DESC (128)
#define EMAC_DEF_TX_NUM_DESC (128)
#define EMAC_DEF_MAX_TX_CH (1) /* Max TX channels configured */
#define EMAC_DEF_MAX_RX_CH (1) /* Max RX channels configured */
#define EMAC_POLL_WEIGHT (64) /* Default NAPI poll weight */
Expand Down Expand Up @@ -336,6 +337,7 @@ struct emac_priv {
u32 mac_hash2;
u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS];
u32 rx_addr_type;
atomic_t cur_tx;
const char *phy_id;
struct phy_device *phydev;
spinlock_t lock;
Expand Down Expand Up @@ -1044,6 +1046,9 @@ static void emac_tx_handler(void *token, int len, int status)
{
struct sk_buff *skb = token;
struct net_device *ndev = skb->dev;
struct emac_priv *priv = netdev_priv(ndev);

atomic_dec(&priv->cur_tx);

if (unlikely(netif_queue_stopped(ndev)))
netif_start_queue(ndev);
Expand Down Expand Up @@ -1092,6 +1097,9 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
goto fail_tx;
}

if (atomic_inc_return(&priv->cur_tx) >= EMAC_DEF_TX_NUM_DESC)
netif_stop_queue(ndev);

return NETDEV_TX_OK;

fail_tx:
Expand Down

0 comments on commit a2aaeef

Please sign in to comment.