Commit 4709aa59 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Francois Romieu

sis190: use the allocated buffer as a status code in sis190_alloc_rx_skb

The local status code does not carry mory information.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
parent f946dffe
...@@ -480,30 +480,22 @@ static inline void sis190_make_unusable_by_asic(struct RxDesc *desc) ...@@ -480,30 +480,22 @@ static inline void sis190_make_unusable_by_asic(struct RxDesc *desc)
desc->status = 0x0; desc->status = 0x0;
} }
static int sis190_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, static struct sk_buff *sis190_alloc_rx_skb(struct pci_dev *pdev,
struct RxDesc *desc, u32 rx_buf_sz) struct RxDesc *desc, u32 rx_buf_sz)
{ {
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t mapping;
int ret = 0;
skb = dev_alloc_skb(rx_buf_sz); skb = dev_alloc_skb(rx_buf_sz);
if (!skb) if (likely(skb)) {
goto err_out; dma_addr_t mapping;
*sk_buff = skb;
mapping = pci_map_single(pdev, skb->data, rx_buf_sz, mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
sis190_map_to_asic(desc, mapping, rx_buf_sz); sis190_map_to_asic(desc, mapping, rx_buf_sz);
out: } else
return ret;
err_out:
ret = -ENOMEM;
sis190_make_unusable_by_asic(desc); sis190_make_unusable_by_asic(desc);
goto out;
return skb;
} }
static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev,
...@@ -512,14 +504,15 @@ static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, ...@@ -512,14 +504,15 @@ static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev,
u32 cur; u32 cur;
for (cur = start; cur < end; cur++) { for (cur = start; cur < end; cur++) {
int ret, i = cur % NUM_RX_DESC; unsigned int i = cur % NUM_RX_DESC;
if (tp->Rx_skbuff[i]) if (tp->Rx_skbuff[i])
continue; continue;
ret = sis190_alloc_rx_skb(tp->pci_dev, tp->Rx_skbuff + i, tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp->pci_dev,
tp->RxDescRing + i, tp->rx_buf_sz); tp->RxDescRing + i,
if (ret < 0) tp->rx_buf_sz);
if (!tp->Rx_skbuff[i])
break; break;
} }
return cur - start; return cur - start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment