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

« back to all changes in this revision

Viewing changes to drivers/net/typhoon.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
#include <linux/in6.h>
124
124
#include <linux/dma-mapping.h>
125
125
#include <linux/firmware.h>
126
 
#include <generated/utsrelease.h>
127
126
 
128
127
#include "typhoon.h"
129
128
 
130
129
MODULE_AUTHOR("David Dillow <dave@thedillows.org>");
131
 
MODULE_VERSION(UTS_RELEASE);
 
130
MODULE_VERSION("1.0");
132
131
MODULE_LICENSE("GPL");
133
132
MODULE_FIRMWARE(FIRMWARE_NAME);
134
133
MODULE_DESCRIPTION("3Com Typhoon Family (3C990, 3CR990, and variants)");
847
846
        if(typhoon_num_free_tx(txRing) < (numDesc + 2)) {
848
847
                netif_stop_queue(dev);
849
848
 
850
 
                /* A Tx complete IRQ could have gotten inbetween, making
 
849
                /* A Tx complete IRQ could have gotten between, making
851
850
                 * the ring free again. Only need to recheck here, since
852
851
                 * Tx is serialized.
853
852
                 */
1051
1050
 
1052
1051
        /* need to get stats to make these link speed/duplex valid */
1053
1052
        typhoon_do_get_stats(tp);
1054
 
        cmd->speed = tp->speed;
 
1053
        ethtool_cmd_speed_set(cmd, tp->speed);
1055
1054
        cmd->duplex = tp->duplex;
1056
1055
        cmd->phy_address = 0;
1057
1056
        cmd->transceiver = XCVR_INTERNAL;
1069
1068
typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1070
1069
{
1071
1070
        struct typhoon *tp = netdev_priv(dev);
 
1071
        u32 speed = ethtool_cmd_speed(cmd);
1072
1072
        struct cmd_desc xp_cmd;
1073
1073
        __le16 xcvr;
1074
1074
        int err;
1075
1075
 
1076
1076
        err = -EINVAL;
1077
 
        if(cmd->autoneg == AUTONEG_ENABLE) {
 
1077
        if (cmd->autoneg == AUTONEG_ENABLE) {
1078
1078
                xcvr = TYPHOON_XCVR_AUTONEG;
1079
1079
        } else {
1080
 
                if(cmd->duplex == DUPLEX_HALF) {
1081
 
                        if(cmd->speed == SPEED_10)
 
1080
                if (cmd->duplex == DUPLEX_HALF) {
 
1081
                        if (speed == SPEED_10)
1082
1082
                                xcvr = TYPHOON_XCVR_10HALF;
1083
 
                        else if(cmd->speed == SPEED_100)
 
1083
                        else if (speed == SPEED_100)
1084
1084
                                xcvr = TYPHOON_XCVR_100HALF;
1085
1085
                        else
1086
1086
                                goto out;
1087
 
                } else if(cmd->duplex == DUPLEX_FULL) {
1088
 
                        if(cmd->speed == SPEED_10)
 
1087
                } else if (cmd->duplex == DUPLEX_FULL) {
 
1088
                        if (speed == SPEED_10)
1089
1089
                                xcvr = TYPHOON_XCVR_10FULL;
1090
 
                        else if(cmd->speed == SPEED_100)
 
1090
                        else if (speed == SPEED_100)
1091
1091
                                xcvr = TYPHOON_XCVR_100FULL;
1092
1092
                        else
1093
1093
                                goto out;
1106
1106
                tp->speed = 0xff;       /* invalid */
1107
1107
                tp->duplex = 0xff;      /* invalid */
1108
1108
        } else {
1109
 
                tp->speed = cmd->speed;
 
1109
                tp->speed = speed;
1110
1110
                tp->duplex = cmd->duplex;
1111
1111
        }
1112
1112
 
1145
1145
        return 0;
1146
1146
}
1147
1147
 
1148
 
static u32
1149
 
typhoon_get_rx_csum(struct net_device *dev)
1150
 
{
1151
 
        /* For now, we don't allow turning off RX checksums.
1152
 
         */
1153
 
        return 1;
1154
 
}
1155
 
 
1156
 
static int
1157
 
typhoon_set_flags(struct net_device *dev, u32 data)
1158
 
{
1159
 
        /* There's no way to turn off the RX VLAN offloading and stripping
1160
 
         * on the current 3XP firmware -- it does not respect the offload
1161
 
         * settings -- so we only allow the user to toggle the TX processing.
1162
 
         */
1163
 
        if (!(data & ETH_FLAG_RXVLAN))
1164
 
                return -EINVAL;
1165
 
 
1166
 
        return ethtool_op_set_flags(dev, data,
1167
 
                                    ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN);
1168
 
}
1169
 
 
1170
1148
static void
1171
1149
typhoon_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
1172
1150
{
1188
1166
        .get_wol                = typhoon_get_wol,
1189
1167
        .set_wol                = typhoon_set_wol,
1190
1168
        .get_link               = ethtool_op_get_link,
1191
 
        .get_rx_csum            = typhoon_get_rx_csum,
1192
 
        .set_tx_csum            = ethtool_op_set_tx_csum,
1193
 
        .set_sg                 = ethtool_op_set_sg,
1194
 
        .set_tso                = ethtool_op_set_tso,
1195
1169
        .get_ringparam          = typhoon_get_ringparam,
1196
 
        .set_flags              = typhoon_set_flags,
1197
 
        .get_flags              = ethtool_op_get_flags,
1198
1170
};
1199
1171
 
1200
1172
static int
2483
2455
 
2484
2456
        /* We can handle scatter gather, up to 16 entries, and
2485
2457
         * we can do IP checksumming (only version 4, doh...)
 
2458
         *
 
2459
         * There's no way to turn off the RX VLAN offloading and stripping
 
2460
         * on the current 3XP firmware -- it does not respect the offload
 
2461
         * settings -- so we only allow the user to toggle the TX processing.
2486
2462
         */
2487
 
        dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
2488
 
        dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
2489
 
        dev->features |= NETIF_F_TSO;
 
2463
        dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
 
2464
                NETIF_F_HW_VLAN_TX;
 
2465
        dev->features = dev->hw_features |
 
2466
                NETIF_F_HW_VLAN_RX | NETIF_F_RXCSUM;
2490
2467
 
2491
2468
        if(register_netdev(dev) < 0) {
2492
2469
                err_msg = "unable to register netdev";