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

« back to all changes in this revision

Viewing changes to drivers/net/vxge/vxge-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:
52
52
#include <linux/etherdevice.h>
53
53
#include <linux/firmware.h>
54
54
#include <linux/net_tstamp.h>
 
55
#include <linux/prefetch.h>
55
56
#include "vxge-main.h"
56
57
#include "vxge-reg.h"
57
58
 
304
305
                "%s: %s:%d  skb protocol = %d",
305
306
                ring->ndev->name, __func__, __LINE__, skb->protocol);
306
307
 
307
 
        if (ring->gro_enable) {
308
 
                if (ring->vlgrp && ext_info->vlan &&
309
 
                        (ring->vlan_tag_strip ==
310
 
                                VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE))
311
 
                        vlan_gro_receive(ring->napi_p, ring->vlgrp,
312
 
                                        ext_info->vlan, skb);
313
 
                else
314
 
                        napi_gro_receive(ring->napi_p, skb);
315
 
        } else {
316
 
                if (ring->vlgrp && vlan &&
317
 
                        (ring->vlan_tag_strip ==
318
 
                                VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE))
319
 
                        vlan_hwaccel_receive_skb(skb, ring->vlgrp, vlan);
320
 
                else
321
 
                        netif_receive_skb(skb);
322
 
        }
 
308
        if (ring->vlgrp && ext_info->vlan &&
 
309
                (ring->vlan_tag_strip ==
 
310
                        VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE))
 
311
                vlan_gro_receive(ring->napi_p, ring->vlgrp,
 
312
                                ext_info->vlan, skb);
 
313
        else
 
314
                napi_gro_receive(ring->napi_p, skb);
 
315
 
323
316
        vxge_debug_entryexit(VXGE_TRACE,
324
317
                "%s: %s:%d Exiting...", ring->ndev->name, __func__, __LINE__);
325
318
}
490
483
 
491
484
                if ((ext_info.proto & VXGE_HW_FRAME_PROTO_TCP_OR_UDP) &&
492
485
                    !(ext_info.proto & VXGE_HW_FRAME_PROTO_IP_FRAG) &&
493
 
                    ring->rx_csum && /* Offload Rx side CSUM */
 
486
                    (dev->features & NETIF_F_RXCSUM) && /* Offload Rx side CSUM */
494
487
                    ext_info.l3_cksum == VXGE_HW_L3_CKSUM_OK &&
495
488
                    ext_info.l4_cksum == VXGE_HW_L4_CKSUM_OK)
496
489
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
2094
2087
                                vdev->config.fifo_indicate_max_pkts;
2095
2088
                        vpath->fifo.tx_vector_no = 0;
2096
2089
                        vpath->ring.rx_vector_no = 0;
2097
 
                        vpath->ring.rx_csum = vdev->rx_csum;
2098
2090
                        vpath->ring.rx_hwts = vdev->rx_hwts;
2099
2091
                        vpath->is_open = 1;
2100
2092
                        vdev->vp_handles[i] = vpath->handle;
2101
 
                        vpath->ring.gro_enable = vdev->config.gro_enable;
2102
2093
                        vpath->ring.vlan_tag_strip = vdev->vlan_tag_strip;
2103
2094
                        vdev->stats.vpaths_open++;
2104
2095
                } else {
2670
2661
        mod_timer(&vdev->vp_lockup_timer, jiffies + HZ / 1000);
2671
2662
}
2672
2663
 
 
2664
static u32 vxge_fix_features(struct net_device *dev, u32 features)
 
2665
{
 
2666
        u32 changed = dev->features ^ features;
 
2667
 
 
2668
        /* Enabling RTH requires some of the logic in vxge_device_register and a
 
2669
         * vpath reset.  Due to these restrictions, only allow modification
 
2670
         * while the interface is down.
 
2671
         */
 
2672
        if ((changed & NETIF_F_RXHASH) && netif_running(dev))
 
2673
                features ^= NETIF_F_RXHASH;
 
2674
 
 
2675
        return features;
 
2676
}
 
2677
 
 
2678
static int vxge_set_features(struct net_device *dev, u32 features)
 
2679
{
 
2680
        struct vxgedev *vdev = netdev_priv(dev);
 
2681
        u32 changed = dev->features ^ features;
 
2682
 
 
2683
        if (!(changed & NETIF_F_RXHASH))
 
2684
                return 0;
 
2685
 
 
2686
        /* !netif_running() ensured by vxge_fix_features() */
 
2687
 
 
2688
        vdev->devh->config.rth_en = !!(features & NETIF_F_RXHASH);
 
2689
        if (vxge_reset_all_vpaths(vdev) != VXGE_HW_OK) {
 
2690
                dev->features = features ^ NETIF_F_RXHASH;
 
2691
                vdev->devh->config.rth_en = !!(dev->features & NETIF_F_RXHASH);
 
2692
                return -EIO;
 
2693
        }
 
2694
 
 
2695
        return 0;
 
2696
}
 
2697
 
2673
2698
/**
2674
2699
 * vxge_open
2675
2700
 * @dev: pointer to the device structure.
3112
3137
        return net_stats;
3113
3138
}
3114
3139
 
3115
 
static enum vxge_hw_status vxge_timestamp_config(struct vxgedev *vdev,
3116
 
                                                 int enable)
 
3140
static enum vxge_hw_status vxge_timestamp_config(struct __vxge_hw_device *devh)
3117
3141
{
3118
3142
        enum vxge_hw_status status;
3119
3143
        u64 val64;
3123
3147
         * required for the driver to load (due to a hardware bug),
3124
3148
         * there is no need to do anything special here.
3125
3149
         */
3126
 
        if (enable)
3127
 
                val64 = VXGE_HW_XMAC_TIMESTAMP_EN |
3128
 
                        VXGE_HW_XMAC_TIMESTAMP_USE_LINK_ID(0) |
3129
 
                        VXGE_HW_XMAC_TIMESTAMP_INTERVAL(0);
3130
 
        else
3131
 
                val64 = 0;
 
3150
        val64 = VXGE_HW_XMAC_TIMESTAMP_EN |
 
3151
                VXGE_HW_XMAC_TIMESTAMP_USE_LINK_ID(0) |
 
3152
                VXGE_HW_XMAC_TIMESTAMP_INTERVAL(0);
3132
3153
 
3133
 
        status = vxge_hw_mgmt_reg_write(vdev->devh,
 
3154
        status = vxge_hw_mgmt_reg_write(devh,
3134
3155
                                        vxge_hw_mgmt_reg_type_mrpcim,
3135
3156
                                        0,
3136
3157
                                        offsetof(struct vxge_hw_mrpcim_reg,
3137
3158
                                                 xmac_timestamp),
3138
3159
                                        val64);
3139
 
        vxge_hw_device_flush_io(vdev->devh);
 
3160
        vxge_hw_device_flush_io(devh);
 
3161
        devh->config.hwts_en = VXGE_HW_HWTS_ENABLE;
3140
3162
        return status;
3141
3163
}
3142
3164
 
3143
3165
static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
3144
3166
{
3145
3167
        struct hwtstamp_config config;
3146
 
        enum vxge_hw_status status;
3147
3168
        int i;
3148
3169
 
3149
3170
        if (copy_from_user(&config, data, sizeof(config)))
3164
3185
 
3165
3186
        switch (config.rx_filter) {
3166
3187
        case HWTSTAMP_FILTER_NONE:
3167
 
                status = vxge_timestamp_config(vdev, 0);
3168
 
                if (status != VXGE_HW_OK)
3169
 
                        return -EFAULT;
3170
 
 
3171
3188
                vdev->rx_hwts = 0;
3172
3189
                config.rx_filter = HWTSTAMP_FILTER_NONE;
3173
3190
                break;
3186
3203
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
3187
3204
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
3188
3205
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
3189
 
                status = vxge_timestamp_config(vdev, 1);
3190
 
                if (status != VXGE_HW_OK)
 
3206
                if (vdev->devh->config.hwts_en != VXGE_HW_HWTS_ENABLE)
3191
3207
                        return -EFAULT;
3192
3208
 
3193
3209
                vdev->rx_hwts = 1;
3378
3394
        .ndo_do_ioctl           = vxge_ioctl,
3379
3395
        .ndo_set_mac_address    = vxge_set_mac_addr,
3380
3396
        .ndo_change_mtu         = vxge_change_mtu,
 
3397
        .ndo_fix_features       = vxge_fix_features,
 
3398
        .ndo_set_features       = vxge_set_features,
3381
3399
        .ndo_vlan_rx_register   = vxge_vlan_rx_register,
3382
3400
        .ndo_vlan_rx_kill_vid   = vxge_vlan_rx_kill_vid,
3383
3401
        .ndo_vlan_rx_add_vid    = vxge_vlan_rx_add_vid,
3424
3442
        vdev->devh = hldev;
3425
3443
        vdev->pdev = hldev->pdev;
3426
3444
        memcpy(&vdev->config, config, sizeof(struct vxge_config));
3427
 
        vdev->rx_csum = 1;      /* Enable Rx CSUM by default. */
3428
3445
        vdev->rx_hwts = 0;
3429
3446
        vdev->titan1 = (vdev->pdev->revision == VXGE_HW_TITAN1_PCI_REVISION);
3430
3447
 
3431
3448
        SET_NETDEV_DEV(ndev, &vdev->pdev->dev);
3432
3449
 
3433
 
        ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
3434
 
                                NETIF_F_HW_VLAN_FILTER;
 
3450
        ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG |
 
3451
                NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 
3452
                NETIF_F_TSO | NETIF_F_TSO6 |
 
3453
                NETIF_F_HW_VLAN_TX;
 
3454
        if (vdev->config.rth_steering != NO_STEERING)
 
3455
                ndev->hw_features |= NETIF_F_RXHASH;
 
3456
 
 
3457
        ndev->features |= ndev->hw_features |
 
3458
                NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
 
3459
 
3435
3460
        /*  Driver entry points */
3436
3461
        ndev->irq = vdev->pdev->irq;
3437
3462
        ndev->base_addr = (unsigned long) hldev->bar0;
3443
3468
 
3444
3469
        vxge_initialize_ethtool_ops(ndev);
3445
3470
 
3446
 
        if (vdev->config.rth_steering != NO_STEERING) {
3447
 
                ndev->features |= NETIF_F_RXHASH;
3448
 
                hldev->config.rth_en = VXGE_HW_RTH_ENABLE;
3449
 
        }
3450
 
 
3451
3471
        /* Allocate memory for vpath */
3452
3472
        vdev->vpaths = kzalloc((sizeof(struct vxge_vpath)) *
3453
3473
                                no_of_vpath, GFP_KERNEL);
3459
3479
                goto _out1;
3460
3480
        }
3461
3481
 
3462
 
        ndev->features |= NETIF_F_SG;
3463
 
 
3464
 
        ndev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
3465
3482
        vxge_debug_init(vxge_hw_device_trace_level_get(hldev),
3466
3483
                "%s : checksuming enabled", __func__);
3467
3484
 
3471
3488
                        "%s : using High DMA", __func__);
3472
3489
        }
3473
3490
 
3474
 
        ndev->features |= NETIF_F_TSO | NETIF_F_TSO6;
3475
 
 
3476
 
        if (vdev->config.gro_enable)
3477
 
                ndev->features |= NETIF_F_GRO;
3478
 
 
3479
3491
        ret = register_netdev(ndev);
3480
3492
        if (ret) {
3481
3493
                vxge_debug_init(vxge_hw_device_trace_level_get(hldev),
4005
4017
                vdev->config.tx_steering_type = 0;
4006
4018
        }
4007
4019
 
4008
 
        if (vdev->config.gro_enable) {
4009
 
                vxge_debug_init(VXGE_ERR,
4010
 
                        "%s: Generic receive offload enabled",
4011
 
                        vdev->ndev->name);
4012
 
        } else
4013
 
                vxge_debug_init(VXGE_TRACE,
4014
 
                        "%s: Generic receive offload disabled",
4015
 
                        vdev->ndev->name);
4016
 
 
4017
4020
        if (vdev->config.addr_learn_en)
4018
4021
                vxge_debug_init(VXGE_TRACE,
4019
4022
                        "%s: MAC Address learning enabled", vdev->ndev->name);
4575
4578
                goto _exit4;
4576
4579
        }
4577
4580
 
 
4581
        /* Always enable HWTS.  This will always cause the FCS to be invalid,
 
4582
         * due to the fact that HWTS is using the FCS as the location of the
 
4583
         * timestamp.  The HW FCS checking will still correctly determine if
 
4584
         * there is a valid checksum, and the FCS is being removed by the driver
 
4585
         * anyway.  So no fucntionality is being lost.  Since it is always
 
4586
         * enabled, we now simply use the ioctl call to set whether or not the
 
4587
         * driver should be paying attention to the HWTS.
 
4588
         */
 
4589
        if (is_privileged == VXGE_HW_OK) {
 
4590
                status = vxge_timestamp_config(hldev);
 
4591
                if (status != VXGE_HW_OK) {
 
4592
                        vxge_debug_init(VXGE_ERR, "%s: HWTS enable failed",
 
4593
                                        VXGE_DRIVER_NAME);
 
4594
                        ret = -EFAULT;
 
4595
                        goto _exit4;
 
4596
                }
 
4597
        }
 
4598
 
4578
4599
        vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL);
4579
4600
 
4580
4601
        /* set private device info */
4581
4602
        pci_set_drvdata(pdev, hldev);
4582
4603
 
4583
 
        ll_config->gro_enable = VXGE_GRO_ALWAYS_AGGREGATE;
4584
4604
        ll_config->fifo_indicate_max_pkts = VXGE_FIFO_INDICATE_MAX_PKTS;
4585
4605
        ll_config->addr_learn_en = addr_learn_en;
4586
4606
        ll_config->rth_algorithm = RTH_ALG_JENKINS;