Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78420
b: refs/heads/master
c: 84eaa18
h: refs/heads/master
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Jan 28, 2008
1 parent 2c287d7 commit 8bcb940
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 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: 1db82f2aec0766edd4a4f8d86283e91559350de7
refs/heads/master: 84eaa1877137def7fe01340f2abbad510aa890f5
21 changes: 19 additions & 2 deletions trunk/drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4493,15 +4493,32 @@ static u32 bnx2_find_max_ring(u32 ring_size, u32 max_size)
static void
bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size)
{
u32 rx_size;
u32 rx_size, rx_space, jumbo_size;

/* 8 for CRC and VLAN */
rx_size = bp->dev->mtu + ETH_HLEN + bp->rx_offset + 8;

rx_space = SKB_DATA_ALIGN(rx_size + BNX2_RX_ALIGN) + NET_SKB_PAD +
sizeof(struct skb_shared_info);

bp->rx_copy_thresh = RX_COPY_THRESH;
bp->rx_pg_ring_size = 0;
bp->rx_max_pg_ring = 0;
bp->rx_max_pg_ring_idx = 0;
if (rx_space > PAGE_SIZE) {
int pages = PAGE_ALIGN(bp->dev->mtu - 40) >> PAGE_SHIFT;

jumbo_size = size * pages;
if (jumbo_size > MAX_TOTAL_RX_PG_DESC_CNT)
jumbo_size = MAX_TOTAL_RX_PG_DESC_CNT;

bp->rx_pg_ring_size = jumbo_size;
bp->rx_max_pg_ring = bnx2_find_max_ring(jumbo_size,
MAX_RX_PG_RINGS);
bp->rx_max_pg_ring_idx = (bp->rx_max_pg_ring * RX_DESC_CNT) - 1;
rx_size = RX_COPY_THRESH + bp->rx_offset;
bp->rx_copy_thresh = 0;
}

bp->rx_buf_use_size = rx_size;
/* hw alignment */
Expand Down Expand Up @@ -4881,7 +4898,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
else
return -EINVAL;

pkt_size = 1514;
pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_jumbo_thresh - 4);
skb = netdev_alloc_skb(bp->dev, pkt_size);
if (!skb)
return -ENOMEM;
Expand Down

0 comments on commit 8bcb940

Please sign in to comment.