~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to drivers/net/pch_gbe/pch_gbe_main.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-57i0gl3v99b3lkfg
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:
20
20
 
21
21
#include "pch_gbe.h"
22
22
#include "pch_gbe_api.h"
 
23
#include <linux/prefetch.h>
23
24
 
24
25
#define DRV_VERSION     "1.00"
25
26
const char pch_driver_version[] = DRV_VERSION;
659
660
 */
660
661
static void pch_gbe_setup_rctl(struct pch_gbe_adapter *adapter)
661
662
{
 
663
        struct net_device *netdev = adapter->netdev;
662
664
        struct pch_gbe_hw *hw = &adapter->hw;
663
665
        u32 rx_mode, tcpip;
664
666
 
669
671
 
670
672
        tcpip = ioread32(&hw->reg->TCPIP_ACC);
671
673
 
672
 
        if (adapter->rx_csum) {
 
674
        if (netdev->features & NETIF_F_RXCSUM) {
673
675
                tcpip &= ~PCH_GBE_RX_TCPIPACC_OFF;
674
676
                tcpip |= PCH_GBE_RX_TCPIPACC_EN;
675
677
        } else {
890
892
        struct pch_gbe_adapter *adapter = (struct pch_gbe_adapter *)data;
891
893
        struct net_device *netdev = adapter->netdev;
892
894
        struct pch_gbe_hw *hw = &adapter->hw;
893
 
        struct ethtool_cmd cmd;
894
895
 
895
896
        pr_debug("right now = %ld\n", jiffies);
896
897
 
897
898
        pch_gbe_update_stats(adapter);
898
899
        if ((mii_link_ok(&adapter->mii)) && (!netif_carrier_ok(netdev))) {
 
900
                struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
899
901
                netdev->tx_queue_len = adapter->tx_queue_len;
900
902
                /* mii library handles link maintenance tasks */
901
903
                if (mii_ethtool_gset(&adapter->mii, &cmd)) {
905
907
                                                PCH_GBE_WATCHDOG_PERIOD));
906
908
                        return;
907
909
                }
908
 
                hw->mac.link_speed = cmd.speed;
 
910
                hw->mac.link_speed = ethtool_cmd_speed(&cmd);
909
911
                hw->mac.link_duplex = cmd.duplex;
910
912
                /* Set the RGMII control. */
911
913
                pch_gbe_set_rgmii_ctrl(adapter, hw->mac.link_speed,
915
917
                                 hw->mac.link_duplex);
916
918
                netdev_dbg(netdev,
917
919
                           "Link is Up %d Mbps %s-Duplex\n",
918
 
                           cmd.speed,
 
920
                           hw->mac.link_speed,
919
921
                           cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
920
922
                netif_carrier_on(netdev);
921
923
                netif_wake_queue(netdev);
953
955
        frame_ctrl = 0;
954
956
        if (unlikely(skb->len < PCH_GBE_SHORT_PKT))
955
957
                frame_ctrl |= PCH_GBE_TXD_CTRL_APAD;
956
 
        if (unlikely(!adapter->tx_csum))
 
958
        if (skb->ip_summed == CHECKSUM_NONE)
957
959
                frame_ctrl |= PCH_GBE_TXD_CTRL_TCPIP_ACC_OFF;
958
960
 
959
961
        /* Performs checksum processing */
961
963
         * It is because the hardware accelerator does not support a checksum,
962
964
         * when the received data size is less than 64 bytes.
963
965
         */
964
 
        if ((skb->len < PCH_GBE_SHORT_PKT) && (adapter->tx_csum)) {
 
966
        if (skb->len < PCH_GBE_SHORT_PKT && skb->ip_summed != CHECKSUM_NONE) {
965
967
                frame_ctrl |= PCH_GBE_TXD_CTRL_APAD |
966
968
                              PCH_GBE_TXD_CTRL_TCPIP_ACC_OFF;
967
969
                if (skb->protocol == htons(ETH_P_IP)) {
1429
1431
                        length = (rx_desc->rx_words_eob) - 3;
1430
1432
 
1431
1433
                        /* Decide the data conversion method */
1432
 
                        if (!adapter->rx_csum) {
 
1434
                        if (!(netdev->features & NETIF_F_RXCSUM)) {
1433
1435
                                /* [Header:14][payload] */
1434
1436
                                if (NET_IP_ALIGN) {
1435
1437
                                        /* Because alignment differs,
2032
2034
}
2033
2035
 
2034
2036
/**
 
2037
 * pch_gbe_set_features - Reset device after features changed
 
2038
 * @netdev:   Network interface device structure
 
2039
 * @features:  New features
 
2040
 * Returns
 
2041
 *      0:              HW state updated successfully
 
2042
 */
 
2043
static int pch_gbe_set_features(struct net_device *netdev, u32 features)
 
2044
{
 
2045
        struct pch_gbe_adapter *adapter = netdev_priv(netdev);
 
2046
        u32 changed = features ^ netdev->features;
 
2047
 
 
2048
        if (!(changed & NETIF_F_RXCSUM))
 
2049
                return 0;
 
2050
 
 
2051
        if (netif_running(netdev))
 
2052
                pch_gbe_reinit_locked(adapter);
 
2053
        else
 
2054
                pch_gbe_reset(adapter);
 
2055
 
 
2056
        return 0;
 
2057
}
 
2058
 
 
2059
/**
2035
2060
 * pch_gbe_ioctl - Controls register through a MII interface
2036
2061
 * @netdev:   Network interface device structure
2037
2062
 * @ifr:      Pointer to ifr structure
2131
2156
        .ndo_set_mac_address = pch_gbe_set_mac,
2132
2157
        .ndo_tx_timeout = pch_gbe_tx_timeout,
2133
2158
        .ndo_change_mtu = pch_gbe_change_mtu,
 
2159
        .ndo_set_features = pch_gbe_set_features,
2134
2160
        .ndo_do_ioctl = pch_gbe_ioctl,
2135
2161
        .ndo_set_multicast_list = &pch_gbe_set_multi,
2136
2162
#ifdef CONFIG_NET_POLL_CONTROLLER
2336
2362
        netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD;
2337
2363
        netif_napi_add(netdev, &adapter->napi,
2338
2364
                       pch_gbe_napi_poll, PCH_GBE_RX_WEIGHT);
2339
 
        netdev->features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_GRO;
 
2365
        netdev->hw_features = NETIF_F_RXCSUM |
 
2366
                NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 
2367
        netdev->features = netdev->hw_features;
2340
2368
        pch_gbe_set_ethtool_ops(netdev);
2341
2369
 
2342
2370
        pch_gbe_mac_load_mac_addr(&adapter->hw);
2375
2403
 
2376
2404
        pch_gbe_check_options(adapter);
2377
2405
 
2378
 
        if (adapter->tx_csum)
2379
 
                netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
2380
 
        else
2381
 
                netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
2382
 
 
2383
2406
        /* initialize the wol settings based on the eeprom settings */
2384
2407
        adapter->wake_up_evt = PCH_GBE_WL_INIT_SETTING;
2385
2408
        dev_info(&pdev->dev, "MAC address : %pM\n", netdev->dev_addr);