~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/net/jme.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
753
753
        struct jme_ring *rxring = &(jme->rxring[0]);
754
754
        struct jme_buffer_info *rxbi = rxring->bufinf + i;
755
755
        struct sk_buff *skb;
 
756
        dma_addr_t mapping;
756
757
 
757
758
        skb = netdev_alloc_skb(jme->dev,
758
759
                jme->dev->mtu + RX_EXTRA_LEN);
759
760
        if (unlikely(!skb))
760
761
                return -ENOMEM;
761
762
 
 
763
        mapping = pci_map_page(jme->pdev, virt_to_page(skb->data),
 
764
                               offset_in_page(skb->data), skb_tailroom(skb),
 
765
                               PCI_DMA_FROMDEVICE);
 
766
        if (unlikely(pci_dma_mapping_error(jme->pdev, mapping))) {
 
767
                dev_kfree_skb(skb);
 
768
                return -ENOMEM;
 
769
        }
 
770
 
 
771
        if (likely(rxbi->mapping))
 
772
                pci_unmap_page(jme->pdev, rxbi->mapping,
 
773
                               rxbi->len, PCI_DMA_FROMDEVICE);
 
774
 
762
775
        rxbi->skb = skb;
763
776
        rxbi->len = skb_tailroom(skb);
764
 
        rxbi->mapping = pci_map_page(jme->pdev,
765
 
                                        virt_to_page(skb->data),
766
 
                                        offset_in_page(skb->data),
767
 
                                        rxbi->len,
768
 
                                        PCI_DMA_FROMDEVICE);
769
 
 
 
777
        rxbi->mapping = mapping;
770
778
        return 0;
771
779
}
772
780
 
2230
2238
                jme_restart_rx_engine(jme);
2231
2239
        }
2232
2240
 
2233
 
        if (new_mtu > 1900) {
2234
 
                netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2235
 
                                NETIF_F_TSO | NETIF_F_TSO6);
2236
 
        } else {
2237
 
                if (test_bit(JME_FLAG_TXCSUM, &jme->flags))
2238
 
                        netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
2239
 
                if (test_bit(JME_FLAG_TSO, &jme->flags))
2240
 
                        netdev->features |= NETIF_F_TSO | NETIF_F_TSO6;
2241
 
        }
2242
 
 
2243
2241
        netdev->mtu = new_mtu;
 
2242
        netdev_update_features(netdev);
 
2243
 
2244
2244
        jme_reset_link(jme);
2245
2245
 
2246
2246
        return 0;
2563
2563
        struct jme_adapter *jme = netdev_priv(netdev);
2564
2564
        int rc, fdc = 0;
2565
2565
 
2566
 
        if (ecmd->speed == SPEED_1000 && ecmd->autoneg != AUTONEG_ENABLE)
 
2566
        if (ethtool_cmd_speed(ecmd) == SPEED_1000
 
2567
            && ecmd->autoneg != AUTONEG_ENABLE)
2567
2568
                return -EINVAL;
2568
2569
 
2569
2570
        /*
2640
2641
}
2641
2642
 
2642
2643
static u32
2643
 
jme_get_rx_csum(struct net_device *netdev)
 
2644
jme_fix_features(struct net_device *netdev, u32 features)
2644
2645
{
2645
 
        struct jme_adapter *jme = netdev_priv(netdev);
2646
 
        return jme->reg_rxmcs & RXMCS_CHECKSUM;
 
2646
        if (netdev->mtu > 1900)
 
2647
                features &= ~(NETIF_F_ALL_TSO | NETIF_F_ALL_CSUM);
 
2648
        return features;
2647
2649
}
2648
2650
 
2649
2651
static int
2650
 
jme_set_rx_csum(struct net_device *netdev, u32 on)
 
2652
jme_set_features(struct net_device *netdev, u32 features)
2651
2653
{
2652
2654
        struct jme_adapter *jme = netdev_priv(netdev);
2653
2655
 
2654
2656
        spin_lock_bh(&jme->rxmcs_lock);
2655
 
        if (on)
 
2657
        if (features & NETIF_F_RXCSUM)
2656
2658
                jme->reg_rxmcs |= RXMCS_CHECKSUM;
2657
2659
        else
2658
2660
                jme->reg_rxmcs &= ~RXMCS_CHECKSUM;
2663
2665
}
2664
2666
 
2665
2667
static int
2666
 
jme_set_tx_csum(struct net_device *netdev, u32 on)
2667
 
{
2668
 
        struct jme_adapter *jme = netdev_priv(netdev);
2669
 
 
2670
 
        if (on) {
2671
 
                set_bit(JME_FLAG_TXCSUM, &jme->flags);
2672
 
                if (netdev->mtu <= 1900)
2673
 
                        netdev->features |=
2674
 
                                NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
2675
 
        } else {
2676
 
                clear_bit(JME_FLAG_TXCSUM, &jme->flags);
2677
 
                netdev->features &=
2678
 
                                ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
2679
 
        }
2680
 
 
2681
 
        return 0;
2682
 
}
2683
 
 
2684
 
static int
2685
 
jme_set_tso(struct net_device *netdev, u32 on)
2686
 
{
2687
 
        struct jme_adapter *jme = netdev_priv(netdev);
2688
 
 
2689
 
        if (on) {
2690
 
                set_bit(JME_FLAG_TSO, &jme->flags);
2691
 
                if (netdev->mtu <= 1900)
2692
 
                        netdev->features |= NETIF_F_TSO | NETIF_F_TSO6;
2693
 
        } else {
2694
 
                clear_bit(JME_FLAG_TSO, &jme->flags);
2695
 
                netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
2696
 
        }
2697
 
 
2698
 
        return 0;
2699
 
}
2700
 
 
2701
 
static int
2702
2668
jme_nway_reset(struct net_device *netdev)
2703
2669
{
2704
2670
        struct jme_adapter *jme = netdev_priv(netdev);
2839
2805
        .get_link               = jme_get_link,
2840
2806
        .get_msglevel           = jme_get_msglevel,
2841
2807
        .set_msglevel           = jme_set_msglevel,
2842
 
        .get_rx_csum            = jme_get_rx_csum,
2843
 
        .set_rx_csum            = jme_set_rx_csum,
2844
 
        .set_tx_csum            = jme_set_tx_csum,
2845
 
        .set_tso                = jme_set_tso,
2846
 
        .set_sg                 = ethtool_op_set_sg,
2847
2808
        .nway_reset             = jme_nway_reset,
2848
2809
        .get_eeprom_len         = jme_get_eeprom_len,
2849
2810
        .get_eeprom             = jme_get_eeprom,
2903
2864
        .ndo_change_mtu         = jme_change_mtu,
2904
2865
        .ndo_tx_timeout         = jme_tx_timeout,
2905
2866
        .ndo_vlan_rx_register   = jme_vlan_rx_register,
 
2867
        .ndo_fix_features       = jme_fix_features,
 
2868
        .ndo_set_features       = jme_set_features,
2906
2869
};
2907
2870
 
2908
2871
static int __devinit
2957
2920
        netdev->netdev_ops = &jme_netdev_ops;
2958
2921
        netdev->ethtool_ops             = &jme_ethtool_ops;
2959
2922
        netdev->watchdog_timeo          = TX_TIMEOUT;
 
2923
        netdev->hw_features             =       NETIF_F_IP_CSUM |
 
2924
                                                NETIF_F_IPV6_CSUM |
 
2925
                                                NETIF_F_SG |
 
2926
                                                NETIF_F_TSO |
 
2927
                                                NETIF_F_TSO6 |
 
2928
                                                NETIF_F_RXCSUM;
2960
2929
        netdev->features                =       NETIF_F_IP_CSUM |
2961
2930
                                                NETIF_F_IPV6_CSUM |
2962
2931
                                                NETIF_F_SG |
3040
3009
        jme->reg_txpfc = 0;
3041
3010
        jme->reg_pmcs = PMCS_MFEN;
3042
3011
        jme->reg_gpreg1 = GPREG1_DEFAULT;
3043
 
        set_bit(JME_FLAG_TXCSUM, &jme->flags);
3044
 
        set_bit(JME_FLAG_TSO, &jme->flags);
 
3012
 
 
3013
        if (jme->reg_rxmcs & RXMCS_CHECKSUM)
 
3014
                netdev->features |= NETIF_F_RXCSUM;
3045
3015
 
3046
3016
        /*
3047
3017
         * Get Max Read Req Size from PCI Config Space