~ubuntu-branches/ubuntu/wily/linux-ti-omap4/wily

« back to all changes in this revision

Viewing changes to drivers/net/ethernet/realtek/r8169.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2013-07-11 18:35:20 UTC
  • Revision ID: package-import@ubuntu.com-20130711183520-htnf1x4y5r11hndr
Tags: 3.5.0-229.42
* Release Tracking Bug
  - LP: #1199276

[ Paolo Pisati ]

* [Config] CONFIG_ATH9K_LEGACY_RATE_CONTROL is not set

Show diffs side-by-side

added added

removed removed

Lines of Context:
5497
5497
        return -EIO;
5498
5498
}
5499
5499
 
5500
 
static inline void rtl8169_tso_csum(struct rtl8169_private *tp,
 
5500
static bool rtl_skb_pad(struct sk_buff *skb)
 
5501
{
 
5502
        if (skb_padto(skb, ETH_ZLEN))
 
5503
                return false;
 
5504
        skb_put(skb, ETH_ZLEN - skb->len);
 
5505
        return true;
 
5506
}
 
5507
 
 
5508
static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb)
 
5509
{
 
5510
        return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34;
 
5511
}
 
5512
 
 
5513
static inline bool rtl8169_tso_csum(struct rtl8169_private *tp,
5501
5514
                                    struct sk_buff *skb, u32 *opts)
5502
5515
{
5503
5516
        const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version;
5510
5523
        } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
5511
5524
                const struct iphdr *ip = ip_hdr(skb);
5512
5525
 
 
5526
                if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
 
5527
                        return skb_checksum_help(skb) == 0 && rtl_skb_pad(skb);
 
5528
 
5513
5529
                if (ip->protocol == IPPROTO_TCP)
5514
5530
                        opts[offset] |= info->checksum.tcp;
5515
5531
                else if (ip->protocol == IPPROTO_UDP)
5516
5532
                        opts[offset] |= info->checksum.udp;
5517
5533
                else
5518
5534
                        WARN_ON_ONCE(1);
 
5535
        } else {
 
5536
                if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
 
5537
                        return rtl_skb_pad(skb);
5519
5538
        }
 
5539
        return true;
5520
5540
}
5521
5541
 
5522
5542
static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5540
5560
        if (unlikely(le32_to_cpu(txd->opts1) & DescOwn))
5541
5561
                goto err_stop_0;
5542
5562
 
 
5563
        opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(tp, skb));
 
5564
        opts[0] = DescOwn;
 
5565
 
 
5566
        if (!rtl8169_tso_csum(tp, skb, opts))
 
5567
                goto err_update_stats;
 
5568
 
5543
5569
        len = skb_headlen(skb);
5544
5570
        mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE);
5545
5571
        if (unlikely(dma_mapping_error(d, mapping))) {
5551
5577
        tp->tx_skb[entry].len = len;
5552
5578
        txd->addr = cpu_to_le64(mapping);
5553
5579
 
5554
 
        opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(tp, skb));
5555
 
        opts[0] = DescOwn;
5556
 
 
5557
 
        rtl8169_tso_csum(tp, skb, opts);
5558
 
 
5559
5580
        frags = rtl8169_xmit_frags(tp, skb, opts);
5560
5581
        if (frags < 0)
5561
5582
                goto err_dma_1;
5608
5629
        rtl8169_unmap_tx_skb(d, tp->tx_skb + entry, txd);
5609
5630
err_dma_0:
5610
5631
        dev_kfree_skb(skb);
 
5632
err_update_stats:
5611
5633
        dev->stats.tx_dropped++;
5612
5634
        return NETDEV_TX_OK;
5613
5635