Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 18830
b: refs/heads/master
c: 1c28f6b
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Jan 18, 2006
1 parent 122b5c7 commit cbd0915
Show file tree
Hide file tree
Showing 2 changed files with 31 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: e0c94455ce2a0e5734eeb236fb49a4613e20e7b0
refs/heads/master: 1c28f6ba600d05be2dc7ab0592e4d845f668a485
52 changes: 30 additions & 22 deletions trunk/drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,16 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)

}

static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, size_t len)
/* Assign Ram Buffer allocation.
* start and end are in units of 4k bytes
* ram registers are in units of 64bit words
*/
static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
{
u32 end;
u32 start, end;

start /= 8;
len /= 8;
end = start + len - 1;
start = startk * 4096/8;
end = (endk * 4096/8) - 1;

sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
sky2_write32(hw, RB_ADDR(q, RB_START), start);
Expand All @@ -640,14 +643,19 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, size_t len)
sky2_write32(hw, RB_ADDR(q, RB_RP), start);

if (q == Q_R1 || q == Q_R2) {
u32 rxup, rxlo;
u32 space = (endk - startk) * 4096/8;
u32 tp = space - space/4;

rxlo = len/2;
rxup = rxlo + len/4;
/* On receive queue's set the thresholds
* give receiver priority when > 3/4 full
* send pause when down to 2K
*/
sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp);
sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2);

/* Set thresholds on receive queue's */
sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), rxup);
sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), rxlo);
tp = space - 2048/8;
sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp);
sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4);
} else {
/* Enable store & forward on Tx queue's because
* Tx FIFO is only 1K on Yukon
Expand Down Expand Up @@ -1002,19 +1010,19 @@ static int sky2_up(struct net_device *dev)

sky2_mac_init(hw, port);

/* Configure RAM buffers */
if (hw->chip_id == CHIP_ID_YUKON_FE ||
(hw->chip_id == CHIP_ID_YUKON_EC && hw->chip_rev == 2))
ramsize = 4096;
else {
u8 e0 = sky2_read8(hw, B2_E_0);
ramsize = (e0 == 0) ? (128 * 1024) : (e0 * 4096);
}
/* Determine available ram buffer space (in 4K blocks).
* Note: not sure about the FE setting below yet
*/
if (hw->chip_id == CHIP_ID_YUKON_FE)
ramsize = 4;
else
ramsize = sky2_read8(hw, B2_E_0);

/* Give transmitter one third (rounded up) */
rxspace = ramsize - (ramsize + 2) / 3;

/* 2/3 for Rx */
rxspace = (2 * ramsize) / 3;
sky2_ramset(hw, rxqaddr[port], 0, rxspace);
sky2_ramset(hw, txqaddr[port], rxspace, ramsize - rxspace);
sky2_ramset(hw, txqaddr[port], rxspace, ramsize);

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

0 comments on commit cbd0915

Please sign in to comment.