Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43219
b: refs/heads/master
c: 6771290
h: refs/heads/master
i:
  43217: ce2b5fa
  43215: da0b405
v: v3
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Dec 7, 2006
1 parent dba34d0 commit 34490ce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 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: e5b74c7ddd46d1779bea21d7c8efb39bbcc3df21
refs/heads/master: 6771290102c4703dae56bc3e121deb63530e206c
41 changes: 25 additions & 16 deletions trunk/drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,15 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)

}

/* Assign Ram Buffer allocation in units of 64bit (8 bytes) */
static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end)
/* Assign Ram Buffer allocation to queue */
static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space)
{
pr_debug(PFX "q %d %#x %#x\n", q, start, end);
u32 end;

/* convert from K bytes to qwords used for hw register */
start *= 1024/8;
space *= 1024/8;
end = start + space - 1;

sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
sky2_write32(hw, RB_ADDR(q, RB_START), start);
Expand All @@ -708,7 +713,6 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end)
sky2_write32(hw, RB_ADDR(q, RB_RP), start);

if (q == Q_R1 || q == Q_R2) {
u32 space = end - start + 1;
u32 tp = space - space/4;

/* On receive queue's set the thresholds
Expand Down Expand Up @@ -1138,7 +1142,7 @@ static int sky2_up(struct net_device *dev)
struct sky2_port *sky2 = netdev_priv(dev);
struct sky2_hw *hw = sky2->hw;
unsigned port = sky2->port;
u32 ramsize, rxspace, imask;
u32 ramsize, imask;
int cap, err = -ENOMEM;
struct net_device *otherdev = hw->dev[sky2->port^1];

Expand Down Expand Up @@ -1191,20 +1195,25 @@ static int sky2_up(struct net_device *dev)

sky2_mac_init(hw, port);

/* Determine available ram buffer space in qwords. */
ramsize = sky2_read8(hw, B2_E_0) * 4096/8;
/* Register is number of 4K blocks on internal RAM buffer. */
ramsize = sky2_read8(hw, B2_E_0) * 4;
printk(KERN_INFO PFX "%s: ram buffer %dK\n", dev->name, ramsize);

if (ramsize > 6*1024/8)
rxspace = ramsize - (ramsize + 2) / 3;
else
rxspace = ramsize / 2;
if (ramsize > 0) {
u32 rxspace;

sky2_ramset(hw, rxqaddr[port], 0, rxspace-1);
sky2_ramset(hw, txqaddr[port], rxspace, ramsize-1);
if (ramsize < 16)
rxspace = ramsize / 2;
else
rxspace = 8 + (2*(ramsize - 16))/3;

/* Make sure SyncQ is disabled */
sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),
RB_RST_SET);
sky2_ramset(hw, rxqaddr[port], 0, rxspace);
sky2_ramset(hw, txqaddr[port], rxspace, ramsize - rxspace);

/* Make sure SyncQ is disabled */
sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),
RB_RST_SET);
}

sky2_qset(hw, txqaddr[port]);

Expand Down

0 comments on commit 34490ce

Please sign in to comment.