Simplify the VIA Velocity changes. The last round of fixes introduced some bugs.
This commit is contained in:
parent
705539efb5
commit
35cc504508
|
@ -48,7 +48,7 @@ Summary: The Linux kernel
|
|||
# reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec).
|
||||
# scripts/rebase.sh should be made to do that for you, actually.
|
||||
#
|
||||
%global baserelease 16
|
||||
%global baserelease 17
|
||||
%global fedora_build %{baserelease}
|
||||
|
||||
# base_sublevel is the kernel version we're starting with and patching
|
||||
|
@ -1896,6 +1896,10 @@ fi
|
|||
# and build.
|
||||
|
||||
%changelog
|
||||
* Thu Sep 02 2010 Dave Jones <davej@redhat.com> 2.6.35.4-17
|
||||
- Simplify the VIA Velocity changes. The last round of
|
||||
fixes introduced some bugs.
|
||||
|
||||
* Wed Sep 01 2010 Dave Jones <davej@redhat.com> 2.6.35.4-16
|
||||
- Another VIA Velocity fix. This time in ifdown path.
|
||||
|
||||
|
|
|
@ -33,91 +33,91 @@ Reported-by: Dave Jones <davej@redhat.com>
|
|||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
|
||||
index fd69095..258c368 100644
|
||||
index fd69095..a4e2164 100644
|
||||
--- a/drivers/net/via-velocity.c
|
||||
+++ b/drivers/net/via-velocity.c
|
||||
@@ -1705,28 +1705,24 @@ err_free_dma_rings_0:
|
||||
* recycle it, if not then unmap the buffer.
|
||||
*/
|
||||
static void velocity_free_tx_buf(struct velocity_info *vptr,
|
||||
- struct velocity_td_info *tdinfo, struct tx_desc *td)
|
||||
+ struct velocity_td_info *tdinfo)
|
||||
{
|
||||
struct sk_buff *skb = tdinfo->skb;
|
||||
+ int i;
|
||||
@@ -1716,15 +1716,15 @@ static void velocity_free_tx_buf(struct velocity_info *vptr,
|
||||
int i;
|
||||
|
||||
- /*
|
||||
- * Don't unmap the pre-allocated tx_bufs
|
||||
- */
|
||||
- if (tdinfo->skb_dma) {
|
||||
- int i;
|
||||
+ if (unlikely(!tdinfo->skb))
|
||||
+ return;
|
||||
|
||||
- for (i = 0; i < tdinfo->nskb_dma; i++) {
|
||||
for (i = 0; i < tdinfo->nskb_dma; i++) {
|
||||
- size_t pktlen = max_t(size_t, skb->len, ETH_ZLEN);
|
||||
+ pci_unmap_single(vptr->pdev, tdinfo->skb_dma[0],
|
||||
+ skb_headlen(skb), PCI_DMA_TODEVICE);
|
||||
+ if (i > 0) {
|
||||
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1];
|
||||
|
||||
- /* For scatter-gather */
|
||||
- if (skb_shinfo(skb)->nr_frags > 0)
|
||||
- pktlen = max_t(size_t, pktlen,
|
||||
- td->td_buf[i].size & ~TD_QUEUE);
|
||||
+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
|
||||
|
||||
-
|
||||
- pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i],
|
||||
- le16_to_cpu(pktlen), PCI_DMA_TODEVICE);
|
||||
- }
|
||||
+ pci_unmap_page(vptr->pdev, tdinfo->skb_dma[i + 1],
|
||||
+ frag->size, PCI_DMA_TODEVICE);
|
||||
+ pci_unmap_page(vptr->pdev, tdinfo->skb_dma[i],
|
||||
+ frag->size, PCI_DMA_TODEVICE);
|
||||
+ } else {
|
||||
+ pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i],
|
||||
+ skb_headlen(skb), PCI_DMA_TODEVICE);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+
|
||||
dev_kfree_skb_irq(skb);
|
||||
tdinfo->skb = NULL;
|
||||
}
|
||||
@@ -1739,22 +1735,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr,
|
||||
int q, int n)
|
||||
{
|
||||
struct velocity_td_info *td_info = &(vptr->tx.infos[q][n]);
|
||||
- int i;
|
||||
-
|
||||
- if (td_info == NULL)
|
||||
- return;
|
||||
@@ -1745,14 +1745,20 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr,
|
||||
return;
|
||||
|
||||
- if (td_info->skb) {
|
||||
- for (i = 0; i < td_info->nskb_dma; i++) {
|
||||
if (td_info->skb) {
|
||||
+ struct sk_buff *skb = td_info->skb;
|
||||
+
|
||||
for (i = 0; i < td_info->nskb_dma; i++) {
|
||||
- if (td_info->skb_dma[i]) {
|
||||
- pci_unmap_single(vptr->pdev, td_info->skb_dma[i],
|
||||
+ if (i > 0) {
|
||||
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1];
|
||||
+
|
||||
+ pci_unmap_page(vptr->pdev, td_info->skb_dma[i],
|
||||
+ frag->size, PCI_DMA_TODEVICE);
|
||||
+ } else {
|
||||
pci_unmap_single(vptr->pdev, td_info->skb_dma[i],
|
||||
- td_info->skb->len, PCI_DMA_TODEVICE);
|
||||
- td_info->skb_dma[i] = 0;
|
||||
- }
|
||||
- }
|
||||
- dev_kfree_skb(td_info->skb);
|
||||
- td_info->skb = NULL;
|
||||
- }
|
||||
+ velocity_free_tx_buf(vptr, td_info);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1925,7 +1907,7 @@ static int velocity_tx_srv(struct velocity_info *vptr)
|
||||
stats->tx_packets++;
|
||||
stats->tx_bytes += tdinfo->skb->len;
|
||||
+ skb_headlen(skb), PCI_DMA_TODEVICE);
|
||||
}
|
||||
- velocity_free_tx_buf(vptr, tdinfo, td);
|
||||
+ velocity_free_tx_buf(vptr, tdinfo);
|
||||
vptr->tx.used[qnum]--;
|
||||
}
|
||||
vptr->tx.tail[qnum] = idx;
|
||||
@@ -2534,9 +2516,7 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb,
|
||||
- dev_kfree_skb(td_info->skb);
|
||||
+ dev_kfree_skb(skb);
|
||||
td_info->skb = NULL;
|
||||
}
|
||||
}
|
||||
@@ -2520,7 +2526,6 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb,
|
||||
struct tx_desc *td_ptr;
|
||||
struct velocity_td_info *tdinfo;
|
||||
unsigned long flags;
|
||||
- int pktlen;
|
||||
int index, prev;
|
||||
int i = 0;
|
||||
|
||||
@@ -2534,10 +2539,6 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb,
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
- pktlen = skb_shinfo(skb)->nr_frags == 0 ?
|
||||
- max_t(unsigned int, skb->len, ETH_ZLEN) :
|
||||
- skb_headlen(skb);
|
||||
+ pktlen = skb_headlen(skb);
|
||||
|
||||
-
|
||||
spin_lock_irqsave(&vptr->lock, flags);
|
||||
|
||||
index = vptr->tx.curr[qnum];
|
||||
@@ -2552,11 +2553,12 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb,
|
||||
* add it to the transmit ring.
|
||||
*/
|
||||
tdinfo->skb = skb;
|
||||
- tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE);
|
||||
- td_ptr->tdesc0.len = cpu_to_le16(pktlen);
|
||||
+ tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data,
|
||||
+ skb_headlen(skb), PCI_DMA_TODEVICE);
|
||||
+ td_ptr->tdesc0.len = cpu_to_le16(skb->len);
|
||||
td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
|
||||
td_ptr->td_buf[0].pa_high = 0;
|
||||
- td_ptr->td_buf[0].size = cpu_to_le16(pktlen);
|
||||
+ td_ptr->td_buf[0].size = cpu_to_le16(skb_headlen(skb));
|
||||
|
||||
/* Handle fragments */
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue