Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134294
b: refs/heads/master
c: 4d7902f
h: refs/heads/master
v: v3
  • Loading branch information
Andy Fleming authored and David S. Miller committed Feb 5, 2009
1 parent d5b9169 commit 7605dbd
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 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: 0fd56bb5be6455d0d42241e65aed057244665e5e
refs/heads/master: 4d7902f22b0804730b80f7a4147f676430248a3a
6 changes: 6 additions & 0 deletions trunk/Documentation/powerpc/dts-bindings/fsl/tsec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ Properties:
hardware.
- fsl,magic-packet : If present, indicates that the hardware supports
waking up via magic packet.
- bd-stash : If present, indicates that the hardware supports stashing
buffer descriptors in the L2.
- rx-stash-len : Denotes the number of bytes of a received buffer to stash
in the L2.
- rx-stash-idx : Denotes the index of the first byte from the received
buffer to stash in the L2.

Example:
ethernet@24000 {
Expand Down
23 changes: 23 additions & 0 deletions trunk/drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ static int gfar_of_init(struct net_device *dev)
struct gfar_private *priv = netdev_priv(dev);
struct device_node *np = priv->node;
char bus_name[MII_BUS_ID_SIZE];
const u32 *stash;
const u32 *stash_len;
const u32 *stash_idx;

if (!np || !of_device_is_available(np))
return -ENODEV;
Expand Down Expand Up @@ -193,6 +196,26 @@ static int gfar_of_init(struct net_device *dev)
}
}

stash = of_get_property(np, "bd-stash", NULL);

if(stash) {
priv->device_flags |= FSL_GIANFAR_DEV_HAS_BD_STASHING;
priv->bd_stash_en = 1;
}

stash_len = of_get_property(np, "rx-stash-len", NULL);

if (stash_len)
priv->rx_stash_size = *stash_len;

stash_idx = of_get_property(np, "rx-stash-idx", NULL);

if (stash_idx)
priv->rx_stash_index = *stash_idx;

if (stash_len || stash_idx)
priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;

mac_addr = of_get_mac_address(np);
if (mac_addr)
memcpy(dev->dev_addr, mac_addr, MAC_ADDR_LEN);
Expand Down
12 changes: 9 additions & 3 deletions trunk/drivers/net/gianfar_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ static ssize_t gfar_set_bd_stash(struct device *dev,
u32 temp;
unsigned long flags;

if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BD_STASHING))
return count;

/* Find out the new setting */
if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1))
new_setting = 1;
Expand Down Expand Up @@ -100,6 +103,9 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev,
u32 temp;
unsigned long flags;

if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
return count;

spin_lock_irqsave(&priv->rxlock, flags);
if (length > priv->rx_buffer_size)
goto out;
Expand Down Expand Up @@ -152,6 +158,9 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev,
u32 temp;
unsigned long flags;

if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
return count;

spin_lock_irqsave(&priv->rxlock, flags);
if (index > priv->rx_stash_size)
goto out;
Expand Down Expand Up @@ -294,12 +303,9 @@ void gfar_init_sysfs(struct net_device *dev)
int rc;

/* Initialize the default values */
priv->rx_stash_size = DEFAULT_STASH_LENGTH;
priv->rx_stash_index = DEFAULT_STASH_INDEX;
priv->fifo_threshold = DEFAULT_FIFO_TX_THR;
priv->fifo_starve = DEFAULT_FIFO_TX_STARVE;
priv->fifo_starve_off = DEFAULT_FIFO_TX_STARVE_OFF;
priv->bd_stash_en = DEFAULT_BD_STASH;

/* Create our sysfs files */
rc = device_create_file(&dev->dev, &dev_attr_bd_stash);
Expand Down

0 comments on commit 7605dbd

Please sign in to comment.