#include <linux/string.h>
#include <linux/errno.h>
#include <linux/unistd.h>
-#include <linux/slab.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/etherdevice.h>
const char *buf, size_t count)
{
struct gfar_private *priv = netdev_priv(to_net_dev(dev));
- struct gfar_priv_rx_q *rx_queue = NULL;
+ struct gfar __iomem *regs = priv->gfargrp[0].regs;
int new_setting = 0;
u32 temp;
unsigned long flags;
if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BD_STASHING))
return count;
- rx_queue = priv->rx_queue;
/* Find out the new setting */
if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1))
new_setting = 1;
- else if (!strncmp("off", buf, count - 1)
- || !strncmp("0", buf, count - 1))
+ else if (!strncmp("off", buf, count - 1) ||
+ !strncmp("0", buf, count - 1))
new_setting = 0;
else
return count;
- spin_lock_irqsave(&rx_queue->rxlock, flags);
+
+ local_irq_save(flags);
+ lock_rx_qs(priv);
/* Set the new stashing value */
priv->bd_stash_en = new_setting;
- temp = gfar_read(&priv->regs->attr);
+ temp = gfar_read(®s->attr);
if (new_setting)
temp |= ATTR_BDSTASH;
else
temp &= ~(ATTR_BDSTASH);
- gfar_write(&priv->regs->attr, temp);
+ gfar_write(®s->attr, temp);
- spin_unlock_irqrestore(&rx_queue->rxlock, flags);
+ unlock_rx_qs(priv);
+ local_irq_restore(flags);
return count;
}
const char *buf, size_t count)
{
struct gfar_private *priv = netdev_priv(to_net_dev(dev));
- struct gfar_priv_rx_q *rx_queue = NULL;
+ struct gfar __iomem *regs = priv->gfargrp[0].regs;
unsigned int length = simple_strtoul(buf, NULL, 0);
u32 temp;
unsigned long flags;
if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
return count;
- rx_queue = priv->rx_queue;
+ local_irq_save(flags);
+ lock_rx_qs(priv);
- spin_lock_irqsave(&rx_queue->rxlock, flags);
if (length > priv->rx_buffer_size)
goto out;
priv->rx_stash_size = length;
- temp = gfar_read(&priv->regs->attreli);
+ temp = gfar_read(®s->attreli);
temp &= ~ATTRELI_EL_MASK;
temp |= ATTRELI_EL(length);
- gfar_write(&priv->regs->attreli, temp);
+ gfar_write(®s->attreli, temp);
/* Turn stashing on/off as appropriate */
- temp = gfar_read(&priv->regs->attr);
+ temp = gfar_read(®s->attr);
if (length)
temp |= ATTR_BUFSTASH;
else
temp &= ~(ATTR_BUFSTASH);
- gfar_write(&priv->regs->attr, temp);
+ gfar_write(®s->attr, temp);
out:
- spin_unlock_irqrestore(&rx_queue->rxlock, flags);
+ unlock_rx_qs(priv);
+ local_irq_restore(flags);
return count;
}
const char *buf, size_t count)
{
struct gfar_private *priv = netdev_priv(to_net_dev(dev));
- struct gfar_priv_rx_q *rx_queue = NULL;
+ struct gfar __iomem *regs = priv->gfargrp[0].regs;
unsigned short index = simple_strtoul(buf, NULL, 0);
u32 temp;
unsigned long flags;
if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
return count;
- rx_queue = priv->rx_queue;
+ local_irq_save(flags);
+ lock_rx_qs(priv);
- spin_lock_irqsave(&rx_queue->rxlock, flags);
if (index > priv->rx_stash_size)
goto out;
priv->rx_stash_index = index;
- temp = gfar_read(&priv->regs->attreli);
+ temp = gfar_read(®s->attreli);
temp &= ~ATTRELI_EI_MASK;
temp |= ATTRELI_EI(index);
- gfar_write(&priv->regs->attreli, flags);
+ gfar_write(®s->attreli, temp);
out:
- spin_unlock_irqrestore(&rx_queue->rxlock, flags);
+ unlock_rx_qs(priv);
+ local_irq_restore(flags);
return count;
}
const char *buf, size_t count)
{
struct gfar_private *priv = netdev_priv(to_net_dev(dev));
- struct gfar_priv_tx_q *tx_queue = NULL;
+ struct gfar __iomem *regs = priv->gfargrp[0].regs;
unsigned int length = simple_strtoul(buf, NULL, 0);
u32 temp;
unsigned long flags;
if (length > GFAR_MAX_FIFO_THRESHOLD)
return count;
- tx_queue = priv->tx_queue;
-
- spin_lock_irqsave(&tx_queue->txlock, flags);
+ local_irq_save(flags);
+ lock_tx_qs(priv);
priv->fifo_threshold = length;
- temp = gfar_read(&priv->regs->fifo_tx_thr);
+ temp = gfar_read(®s->fifo_tx_thr);
temp &= ~FIFO_TX_THR_MASK;
temp |= length;
- gfar_write(&priv->regs->fifo_tx_thr, temp);
+ gfar_write(®s->fifo_tx_thr, temp);
- spin_unlock_irqrestore(&tx_queue->txlock, flags);
+ unlock_tx_qs(priv);
+ local_irq_restore(flags);
return count;
}
const char *buf, size_t count)
{
struct gfar_private *priv = netdev_priv(to_net_dev(dev));
- struct gfar_priv_tx_q *tx_queue = NULL;
+ struct gfar __iomem *regs = priv->gfargrp[0].regs;
unsigned int num = simple_strtoul(buf, NULL, 0);
u32 temp;
unsigned long flags;
if (num > GFAR_MAX_FIFO_STARVE)
return count;
- tx_queue = priv->tx_queue;
- spin_lock_irqsave(&tx_queue->txlock, flags);
+ local_irq_save(flags);
+ lock_tx_qs(priv);
priv->fifo_starve = num;
- temp = gfar_read(&priv->regs->fifo_tx_starve);
+ temp = gfar_read(®s->fifo_tx_starve);
temp &= ~FIFO_TX_STARVE_MASK;
temp |= num;
- gfar_write(&priv->regs->fifo_tx_starve, temp);
+ gfar_write(®s->fifo_tx_starve, temp);
- spin_unlock_irqrestore(&tx_queue->txlock, flags);
+ unlock_tx_qs(priv);
+ local_irq_restore(flags);
return count;
}
const char *buf, size_t count)
{
struct gfar_private *priv = netdev_priv(to_net_dev(dev));
- struct gfar_priv_tx_q *tx_queue = NULL;
+ struct gfar __iomem *regs = priv->gfargrp[0].regs;
unsigned int num = simple_strtoul(buf, NULL, 0);
u32 temp;
unsigned long flags;
if (num > GFAR_MAX_FIFO_STARVE_OFF)
return count;
- tx_queue = priv->tx_queue;
- spin_lock_irqsave(&tx_queue->txlock, flags);
+ local_irq_save(flags);
+ lock_tx_qs(priv);
priv->fifo_starve_off = num;
- temp = gfar_read(&priv->regs->fifo_tx_starve_shutoff);
+ temp = gfar_read(®s->fifo_tx_starve_shutoff);
temp &= ~FIFO_TX_STARVE_OFF_MASK;
temp |= num;
- gfar_write(&priv->regs->fifo_tx_starve_shutoff, temp);
+ gfar_write(®s->fifo_tx_starve_shutoff, temp);
- spin_unlock_irqrestore(&tx_queue->txlock, flags);
+ unlock_tx_qs(priv);
+ local_irq_restore(flags);
return count;
}