Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20993
b: refs/heads/master
c: 70f1be4
h: refs/heads/master
i:
  20991: d2687a6
v: v3
  • Loading branch information
Stephen Hemminger authored and Francois Romieu committed Mar 9, 2006
1 parent ca7fff8 commit ca8b9d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 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: b19666d92009ad2aa8e12d25f2cab59fb32421eb
refs/heads/master: 70f1be4812a833ac856818c3149e432ff6a84c2e
16 changes: 11 additions & 5 deletions trunk/drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)

/* Configure Rx MAC FIFO */
sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR);
sky2_write16(hw, SK_REG(port, RX_GMF_CTRL_T),
GMF_RX_CTRL_DEF);
sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
GMF_OPER_ON | GMF_RX_F_FL_ON);

/* Flush Rx MAC FIFO on any flow control or error */
sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
Expand Down Expand Up @@ -995,6 +995,10 @@ static int sky2_rx_start(struct sky2_port *sky2)
sky2_rx_add(sky2, re->mapaddr);
}

/* Truncate oversize frames */
sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), sky2->rx_bufsize - 8);
sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON);

/* Tell chip about available buffers */
sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put);
sky2->rx_last_put = sky2_read16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX));
Expand Down Expand Up @@ -1712,10 +1716,12 @@ static void sky2_tx_timeout(struct net_device *dev)


#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
/* Want receive buffer size to be multiple of 64 bits, and incl room for vlan */
/* Want receive buffer size to be multiple of 64 bits
* and incl room for vlan and truncation
*/
static inline unsigned sky2_buf_size(int mtu)
{
return roundup(mtu + ETH_HLEN + 4, 8);
return roundup(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8;
}

static int sky2_change_mtu(struct net_device *dev, int new_mtu)
Expand Down Expand Up @@ -1798,7 +1804,7 @@ static struct sk_buff *sky2_receive(struct sky2_port *sky2,
if (!(status & GMR_FS_RX_OK))
goto resubmit;

if ((status >> 16) != length || length > sky2->rx_bufsize)
if (length > sky2->netdev->mtu + ETH_HLEN)
goto oversize;

if (length < copybreak) {
Expand Down

0 comments on commit ca8b9d9

Please sign in to comment.