Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 168953
b: refs/heads/master
c: 73cfe26
h: refs/heads/master
i:
  168951: cec74d7
v: v3
  • Loading branch information
Giuseppe CAVALLARO authored and David S. Miller committed Nov 23, 2009
1 parent 55dfa0c commit 4278c3f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e6e3625f3b95145bfcf421285f8f7f452a5adf7e
refs/heads/master: 73cfe264c27fb50d4592ef1580486bea319443ac
50 changes: 28 additions & 22 deletions trunk/drivers/net/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,8 @@ static void init_dma_desc_rings(struct net_device *dev)
unsigned int txsize = priv->dma_tx_size;
unsigned int rxsize = priv->dma_rx_size;
unsigned int bfsize = priv->dma_buf_sz;
int buff2_needed = 0;
int dis_ic = 0;
int buff2_needed = 0, dis_ic = 0;

#ifdef CONFIG_STMMAC_TIMER
/* Using Timers disable interrupts on completion for the reception */
dis_ic = 1;
#endif
/* Set the Buffer size according to the MTU;
* indeed, in case of jumbo we need to bump-up the buffer sizes.
*/
Expand All @@ -437,6 +432,11 @@ static void init_dma_desc_rings(struct net_device *dev)
else
bfsize = DMA_BUFFER_SIZE;

#ifdef CONFIG_STMMAC_TIMER
/* Disable interrupts on completion for the reception if timer is on */
if (likely(priv->tm->enable))
dis_ic = 1;
#endif
/* If the MTU exceeds 8k so use the second buffer in the chain */
if (bfsize >= BUF_SIZE_8KiB)
buff2_needed = 1;
Expand Down Expand Up @@ -809,20 +809,22 @@ static void stmmac_tx(struct stmmac_priv *priv)

static inline void stmmac_enable_irq(struct stmmac_priv *priv)
{
#ifndef CONFIG_STMMAC_TIMER
writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA);
#else
priv->tm->timer_start(tmrate);
#ifdef CONFIG_STMMAC_TIMER
if (likely(priv->tm->enable))
priv->tm->timer_start(tmrate);
else
#endif
writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA);
}

static inline void stmmac_disable_irq(struct stmmac_priv *priv)
{
#ifndef CONFIG_STMMAC_TIMER
writel(0, priv->dev->base_addr + DMA_INTR_ENA);
#else
priv->tm->timer_stop();
#ifdef CONFIG_STMMAC_TIMER
if (likely(priv->tm->enable))
priv->tm->timer_stop();
else
#endif
writel(0, priv->dev->base_addr + DMA_INTR_ENA);
}

static int stmmac_has_work(struct stmmac_priv *priv)
Expand Down Expand Up @@ -1031,22 +1033,23 @@ static int stmmac_open(struct net_device *dev)
}

#ifdef CONFIG_STMMAC_TIMER
priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
if (unlikely(priv->tm == NULL)) {
pr_err("%s: ERROR: timer memory alloc failed \n", __func__);
return -ENOMEM;
}
priv->tm->freq = tmrate;

/* Test if the HW timer can be actually used.
* In case of failure continue with no timer. */
/* Test if the external timer can be actually used.
* In case of failure continue without timer. */
if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) {
pr_warning("stmmaceth: cannot attach the HW timer\n");
pr_warning("stmmaceth: cannot attach the external timer.\n");
tmrate = 0;
priv->tm->freq = 0;
priv->tm->timer_start = stmmac_no_timer_started;
priv->tm->timer_stop = stmmac_no_timer_stopped;
}
} else
priv->tm->enable = 1;
#endif

/* Create and initialize the TX/RX descriptors chains. */
Expand Down Expand Up @@ -1322,9 +1325,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)

/* Interrupt on completition only for the latest segment */
priv->mac_type->ops->close_tx_desc(desc);

#ifdef CONFIG_STMMAC_TIMER
/* Clean IC while using timers */
priv->mac_type->ops->clear_tx_ic(desc);
/* Clean IC while using timer */
if (likely(priv->tm->enable))
priv->mac_type->ops->clear_tx_ic(desc);
#endif
/* To avoid raise condition */
priv->mac_type->ops->set_tx_owner(first);
Expand Down Expand Up @@ -2028,7 +2033,8 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state)

#ifdef CONFIG_STMMAC_TIMER
priv->tm->timer_stop();
dis_ic = 1;
if (likely(priv->tm->enable))
dis_ic = 1;
#endif
napi_disable(&priv->napi);

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/stmmac/stmmac_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct stmmac_timer {
void (*timer_start) (unsigned int new_freq);
void (*timer_stop) (void);
unsigned int freq;
unsigned int enable;
};

/* Open the HW timer device and return 0 in case of success */
Expand Down

0 comments on commit 4278c3f

Please sign in to comment.