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

« back to all changes in this revision

Viewing changes to drivers/net/vxge/vxge-ethtool.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:
33
33
{
34
34
        /* We currently only support 10Gb/FULL */
35
35
        if ((info->autoneg == AUTONEG_ENABLE) ||
36
 
            (info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL))
 
36
            (ethtool_cmd_speed(info) != SPEED_10000) ||
 
37
            (info->duplex != DUPLEX_FULL))
37
38
                return -EINVAL;
38
39
 
39
40
        return 0;
58
59
        info->transceiver = XCVR_EXTERNAL;
59
60
 
60
61
        if (netif_carrier_ok(dev)) {
61
 
                info->speed = SPEED_10000;
 
62
                ethtool_cmd_speed_set(info, SPEED_10000);
62
63
                info->duplex = DUPLEX_FULL;
63
64
        } else {
64
 
                info->speed = -1;
 
65
                ethtool_cmd_speed_set(info, -1);
65
66
                info->duplex = -1;
66
67
        }
67
68
 
134
135
/**
135
136
 * vxge_ethtool_idnic - To physically identify the nic on the system.
136
137
 * @dev : device pointer.
137
 
 * @id : pointer to the structure with identification parameters given by
138
 
 * ethtool.
 
138
 * @state : requested LED state
139
139
 *
140
140
 * Used to physically identify the NIC on the system.
141
 
 * The Link LED will blink for a time specified by the user.
142
 
 * Return value:
143
141
 * 0 on success
144
142
 */
145
 
static int vxge_ethtool_idnic(struct net_device *dev, u32 data)
 
143
static int vxge_ethtool_idnic(struct net_device *dev,
 
144
                              enum ethtool_phys_id_state state)
146
145
{
147
146
        struct vxgedev *vdev = netdev_priv(dev);
148
147
        struct __vxge_hw_device *hldev = vdev->devh;
149
148
 
150
 
        vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_ON);
151
 
        msleep_interruptible(data ? (data * HZ) : VXGE_MAX_FLICKER_TIME);
152
 
        vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_OFF);
 
149
        switch (state) {
 
150
        case ETHTOOL_ID_ACTIVE:
 
151
                vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_ON);
 
152
                break;
 
153
 
 
154
        case ETHTOOL_ID_INACTIVE:
 
155
                vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_OFF);
 
156
                break;
 
157
 
 
158
        default:
 
159
                return -EINVAL;
 
160
        }
153
161
 
154
162
        return 0;
155
163
}
1064
1072
        return sizeof(struct vxge_hw_vpath_reg) * vdev->no_of_vpath;
1065
1073
}
1066
1074
 
1067
 
static u32 vxge_get_rx_csum(struct net_device *dev)
1068
 
{
1069
 
        struct vxgedev *vdev = netdev_priv(dev);
1070
 
 
1071
 
        return vdev->rx_csum;
1072
 
}
1073
 
 
1074
 
static int vxge_set_rx_csum(struct net_device *dev, u32 data)
1075
 
{
1076
 
        struct vxgedev *vdev = netdev_priv(dev);
1077
 
 
1078
 
        if (data)
1079
 
                vdev->rx_csum = 1;
1080
 
        else
1081
 
                vdev->rx_csum = 0;
1082
 
 
1083
 
        return 0;
1084
 
}
1085
 
 
1086
 
static int vxge_ethtool_op_set_tso(struct net_device *dev, u32 data)
1087
 
{
1088
 
        if (data)
1089
 
                dev->features |= (NETIF_F_TSO | NETIF_F_TSO6);
1090
 
        else
1091
 
                dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
1092
 
 
1093
 
        return 0;
1094
 
}
1095
 
 
1096
1075
static int vxge_ethtool_get_sset_count(struct net_device *dev, int sset)
1097
1076
{
1098
1077
        struct vxgedev *vdev = netdev_priv(dev);
1112
1091
        }
1113
1092
}
1114
1093
 
1115
 
static int vxge_set_flags(struct net_device *dev, u32 data)
1116
 
{
1117
 
        struct vxgedev *vdev = netdev_priv(dev);
1118
 
        enum vxge_hw_status status;
1119
 
 
1120
 
        if (ethtool_invalid_flags(dev, data, ETH_FLAG_RXHASH))
1121
 
                return -EINVAL;
1122
 
 
1123
 
        if (!!(data & ETH_FLAG_RXHASH) == vdev->devh->config.rth_en)
1124
 
                return 0;
1125
 
 
1126
 
        if (netif_running(dev) || (vdev->config.rth_steering == NO_STEERING))
1127
 
                return -EINVAL;
1128
 
 
1129
 
        vdev->devh->config.rth_en = !!(data & ETH_FLAG_RXHASH);
1130
 
 
1131
 
        /* Enabling RTH requires some of the logic in vxge_device_register and a
1132
 
         * vpath reset.  Due to these restrictions, only allow modification
1133
 
         * while the interface is down.
1134
 
         */
1135
 
        status = vxge_reset_all_vpaths(vdev);
1136
 
        if (status != VXGE_HW_OK) {
1137
 
                vdev->devh->config.rth_en = !vdev->devh->config.rth_en;
1138
 
                return -EFAULT;
1139
 
        }
1140
 
 
1141
 
        if (vdev->devh->config.rth_en)
1142
 
                dev->features |= NETIF_F_RXHASH;
1143
 
        else
1144
 
                dev->features &= ~NETIF_F_RXHASH;
1145
 
 
1146
 
        return 0;
1147
 
}
1148
 
 
1149
1094
static int vxge_fw_flash(struct net_device *dev, struct ethtool_flash *parms)
1150
1095
{
1151
1096
        struct vxgedev *vdev = netdev_priv(dev);
1174
1119
        .get_link               = ethtool_op_get_link,
1175
1120
        .get_pauseparam         = vxge_ethtool_getpause_data,
1176
1121
        .set_pauseparam         = vxge_ethtool_setpause_data,
1177
 
        .get_rx_csum            = vxge_get_rx_csum,
1178
 
        .set_rx_csum            = vxge_set_rx_csum,
1179
 
        .get_tx_csum            = ethtool_op_get_tx_csum,
1180
 
        .set_tx_csum            = ethtool_op_set_tx_ipv6_csum,
1181
 
        .get_sg                 = ethtool_op_get_sg,
1182
 
        .set_sg                 = ethtool_op_set_sg,
1183
 
        .get_tso                = ethtool_op_get_tso,
1184
 
        .set_tso                = vxge_ethtool_op_set_tso,
1185
1122
        .get_strings            = vxge_ethtool_get_strings,
1186
 
        .phys_id                = vxge_ethtool_idnic,
 
1123
        .set_phys_id            = vxge_ethtool_idnic,
1187
1124
        .get_sset_count         = vxge_ethtool_get_sset_count,
1188
1125
        .get_ethtool_stats      = vxge_get_ethtool_stats,
1189
 
        .set_flags              = vxge_set_flags,
1190
1126
        .flash_device           = vxge_fw_flash,
1191
1127
};
1192
1128