Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171565
b: refs/heads/master
c: afc081f
h: refs/heads/master
i:
  171563: 2a915cc
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Nov 16, 2009
1 parent 1551f5b commit 50ed927
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 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: 78f90dcf184b8225a24217605c4289f1986451a3
refs/heads/master: afc081f83c59a7cf2c025a3ed89d011b5db556eb
22 changes: 9 additions & 13 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -4409,7 +4409,7 @@ static void tg3_tx(struct tg3_napi *tnapi)
* (to fetch the error flags, vlan tag, checksum, and opaque cookie).
*/
static int tg3_alloc_rx_skb(struct tg3_napi *tnapi, u32 opaque_key,
int src_idx, u32 dest_idx_unmasked)
u32 dest_idx_unmasked)
{
struct tg3 *tp = tnapi->tp;
struct tg3_rx_buffer_desc *desc;
Expand All @@ -4425,17 +4425,13 @@ static int tg3_alloc_rx_skb(struct tg3_napi *tnapi, u32 opaque_key,
dest_idx = dest_idx_unmasked % TG3_RX_RING_SIZE;
desc = &tpr->rx_std[dest_idx];
map = &tpr->rx_std_buffers[dest_idx];
if (src_idx >= 0)
src_map = &tpr->rx_std_buffers[src_idx];
skb_size = tp->rx_pkt_map_sz;
break;

case RXD_OPAQUE_RING_JUMBO:
dest_idx = dest_idx_unmasked % TG3_RX_JUMBO_RING_SIZE;
desc = &tpr->rx_jmb[dest_idx].std;
map = &tpr->rx_jmb_buffers[dest_idx];
if (src_idx >= 0)
src_map = &tpr->rx_jmb_buffers[src_idx];
skb_size = TG3_RX_JMB_MAP_SZ;
break;

Expand Down Expand Up @@ -4465,9 +4461,6 @@ static int tg3_alloc_rx_skb(struct tg3_napi *tnapi, u32 opaque_key,
map->skb = skb;
pci_unmap_addr_set(map, mapping, mapping);

if (src_map != NULL)
src_map->skb = NULL;

desc->addr_hi = ((u64)mapping >> 32);
desc->addr_lo = ((u64)mapping & 0xffffffff);

Expand Down Expand Up @@ -4559,6 +4552,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
work_mask = 0;
received = 0;
while (sw_idx != hw_idx && budget > 0) {
struct ring_info *ri;
struct tg3_rx_buffer_desc *desc = &tnapi->rx_rcb[sw_idx];
unsigned int len;
struct sk_buff *skb;
Expand All @@ -4568,13 +4562,13 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK;
opaque_key = desc->opaque & RXD_OPAQUE_RING_MASK;
if (opaque_key == RXD_OPAQUE_RING_STD) {
struct ring_info *ri = &tpr->rx_std_buffers[desc_idx];
ri = &tpr->rx_std_buffers[desc_idx];
dma_addr = pci_unmap_addr(ri, mapping);
skb = ri->skb;
post_ptr = &tpr->rx_std_ptr;
rx_std_posted++;
} else if (opaque_key == RXD_OPAQUE_RING_JUMBO) {
struct ring_info *ri = &tpr->rx_jmb_buffers[desc_idx];
ri = &tpr->rx_jmb_buffers[desc_idx];
dma_addr = pci_unmap_addr(ri, mapping);
skb = ri->skb;
post_ptr = &tpr->rx_jmb_ptr;
Expand Down Expand Up @@ -4607,10 +4601,12 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
int skb_size;

skb_size = tg3_alloc_rx_skb(tnapi, opaque_key,
desc_idx, *post_ptr);
*post_ptr);
if (skb_size < 0)
goto drop_it;

ri->skb = NULL;

pci_unmap_single(tp->pdev, dma_addr, skb_size,
PCI_DMA_FROMDEVICE);

Expand Down Expand Up @@ -5774,7 +5770,7 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,

/* Now allocate fresh SKBs for each rx ring. */
for (i = 0; i < tp->rx_pending; i++) {
if (tg3_alloc_rx_skb(tnapi, RXD_OPAQUE_RING_STD, -1, i) < 0) {
if (tg3_alloc_rx_skb(tnapi, RXD_OPAQUE_RING_STD, i) < 0) {
printk(KERN_WARNING PFX
"%s: Using a smaller RX standard ring, "
"only %d out of %d buffers were allocated "
Expand Down Expand Up @@ -5806,7 +5802,7 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,

for (i = 0; i < tp->rx_jumbo_pending; i++) {
if (tg3_alloc_rx_skb(tnapi, RXD_OPAQUE_RING_JUMBO,
-1, i) < 0) {
i) < 0) {
printk(KERN_WARNING PFX
"%s: Using a smaller RX jumbo ring, "
"only %d out of %d buffers were "
Expand Down

0 comments on commit 50ed927

Please sign in to comment.