+static ssize_t
+qeth_dev_layer2_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ if (!card)
+ return -EINVAL;
+
+ return sprintf(buf, "%i\n", card->options.layer2 ? 1:0);
+}
+
+static ssize_t
+qeth_dev_layer2_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct qeth_card *card = dev->driver_data;
+ char *tmp;
+ int i;
+
+ if (!card)
+ return -EINVAL;
+ if (card->info.type == QETH_CARD_TYPE_IQD) {
+ PRINT_WARN("Layer2 on Hipersockets is not supported! \n");
+ return -EPERM;
+ }
+
+ if (((card->state != CARD_STATE_DOWN) &&
+ (card->state != CARD_STATE_RECOVER)))
+ return -EPERM;
+
+ i = simple_strtoul(buf, &tmp, 16);
+ if ((i == 0) || (i == 1))
+ card->options.layer2 = i;
+ else {
+ PRINT_WARN("layer2: write 0 or 1 to this file!\n");
+ return -EINVAL;
+ }
+ return count;
+}
+
+static DEVICE_ATTR(layer2, 0644, qeth_dev_layer2_show,
+ qeth_dev_layer2_store);
+
+static ssize_t
+qeth_dev_performance_stats_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ if (!card)
+ return -EINVAL;
+
+ return sprintf(buf, "%i\n", card->options.performance_stats ? 1:0);
+}
+
+static ssize_t
+qeth_dev_performance_stats_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct qeth_card *card = dev->driver_data;
+ char *tmp;
+ int i;
+
+ if (!card)
+ return -EINVAL;
+
+ i = simple_strtoul(buf, &tmp, 16);
+ if ((i == 0) || (i == 1)) {
+ if (i == card->options.performance_stats)
+ return count;
+ card->options.performance_stats = i;
+ if (i == 0)
+ memset(&card->perf_stats, 0,
+ sizeof(struct qeth_perf_stats));
+ card->perf_stats.initial_rx_packets = card->stats.rx_packets;
+ card->perf_stats.initial_tx_packets = card->stats.tx_packets;
+ } else {
+ PRINT_WARN("performance_stats: write 0 or 1 to this file!\n");
+ return -EINVAL;
+ }
+ return count;
+}
+
+static DEVICE_ATTR(performance_stats, 0644, qeth_dev_performance_stats_show,
+ qeth_dev_performance_stats_store);
+
+static ssize_t
+qeth_dev_large_send_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ if (!card)
+ return -EINVAL;
+
+ switch (card->options.large_send) {
+ case QETH_LARGE_SEND_NO:
+ return sprintf(buf, "%s\n", "no");
+ case QETH_LARGE_SEND_EDDP:
+ return sprintf(buf, "%s\n", "EDDP");
+ case QETH_LARGE_SEND_TSO:
+ return sprintf(buf, "%s\n", "TSO");
+ default:
+ return sprintf(buf, "%s\n", "N/A");
+ }
+}
+
+static ssize_t
+qeth_dev_large_send_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct qeth_card *card = dev->driver_data;
+ enum qeth_large_send_types type;
+ int rc = 0;
+ char *tmp;
+
+ if (!card)
+ return -EINVAL;
+ tmp = strsep((char **) &buf, "\n");
+ if (!strcmp(tmp, "no")){
+ type = QETH_LARGE_SEND_NO;
+ } else if (!strcmp(tmp, "EDDP")) {
+ type = QETH_LARGE_SEND_EDDP;
+ } else if (!strcmp(tmp, "TSO")) {
+ type = QETH_LARGE_SEND_TSO;
+ } else {
+ PRINT_WARN("large_send: invalid mode %s!\n", tmp);
+ return -EINVAL;
+ }
+ if (card->options.large_send == type)
+ return count;
+ if ((rc = qeth_set_large_send(card, type)))
+ return rc;
+ return count;
+}
+
+static DEVICE_ATTR(large_send, 0644, qeth_dev_large_send_show,
+ qeth_dev_large_send_store);
+
+static ssize_t
+qeth_dev_blkt_show(char *buf, struct qeth_card *card, int value )
+{
+
+ if (!card)
+ return -EINVAL;
+
+ return sprintf(buf, "%i\n", value);
+}
+
+static ssize_t
+qeth_dev_blkt_store(struct qeth_card *card, const char *buf, size_t count,
+ int *value, int max_value)
+{
+ char *tmp;
+ int i;
+
+ if (!card)
+ return -EINVAL;
+
+ if ((card->state != CARD_STATE_DOWN) &&
+ (card->state != CARD_STATE_RECOVER))
+ return -EPERM;
+
+ i = simple_strtoul(buf, &tmp, 10);
+ if (i <= max_value) {
+ *value = i;
+ } else {
+ PRINT_WARN("blkt total time: write values between"
+ " 0 and %d to this file!\n", max_value);
+ return -EINVAL;
+ }
+ return count;
+}
+
+static ssize_t
+qeth_dev_blkt_total_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ return qeth_dev_blkt_show(buf, card, card->info.blkt.time_total);
+}
+
+
+static ssize_t
+qeth_dev_blkt_total_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ return qeth_dev_blkt_store(card, buf, count,
+ &card->info.blkt.time_total,1000);
+}
+
+
+
+static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show,
+ qeth_dev_blkt_total_store);
+
+static ssize_t
+qeth_dev_blkt_inter_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ return qeth_dev_blkt_show(buf, card, card->info.blkt.inter_packet);
+}
+
+
+static ssize_t
+qeth_dev_blkt_inter_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ return qeth_dev_blkt_store(card, buf, count,
+ &card->info.blkt.inter_packet,100);
+}
+
+static DEVICE_ATTR(inter, 0644, qeth_dev_blkt_inter_show,
+ qeth_dev_blkt_inter_store);
+
+static ssize_t
+qeth_dev_blkt_inter_jumbo_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ return qeth_dev_blkt_show(buf, card,
+ card->info.blkt.inter_packet_jumbo);
+}
+
+
+static ssize_t
+qeth_dev_blkt_inter_jumbo_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct qeth_card *card = dev->driver_data;
+
+ return qeth_dev_blkt_store(card, buf, count,
+ &card->info.blkt.inter_packet_jumbo,100);
+}
+
+static DEVICE_ATTR(inter_jumbo, 0644, qeth_dev_blkt_inter_jumbo_show,
+ qeth_dev_blkt_inter_jumbo_store);
+
+static struct device_attribute * qeth_blkt_device_attrs[] = {
+ &dev_attr_total,
+ &dev_attr_inter,
+ &dev_attr_inter_jumbo,
+ NULL,
+};
+
+static struct attribute_group qeth_device_blkt_group = {
+ .name = "blkt",
+ .attrs = (struct attribute **)qeth_blkt_device_attrs,
+};
+