aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorFrank Blaschka <frank.blaschka@de.ibm.com>2011-05-12 14:45:01 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-13 14:55:20 -0400
commitc5e631a8d4e305a68465b7334efe9875be8b7033 (patch)
tree1fb2dbc1eda8201c78cd466f87ae50f6f2cef08c /drivers/s390
parent32f5469b5ed27b6403a91b6ca9bc64d144ae3a5d (diff)
qeth: convert to hw_features part 2
Set rx csum default to hw checksumming again. Remove sysfs interface for rx csum (checksumming) and TSO (large_send). With the new hw_features it does not work to keep the old sysfs interface in parallel. Convert options.checksum_type to new hw_features. Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/qeth_core.h1
-rw-r--r--drivers/s390/net/qeth_core_main.c1
-rw-r--r--drivers/s390/net/qeth_core_mpc.h8
-rw-r--r--drivers/s390/net/qeth_l2_main.c5
-rw-r--r--drivers/s390/net/qeth_l3.h2
-rw-r--r--drivers/s390/net/qeth_l3_main.c104
-rw-r--r--drivers/s390/net/qeth_l3_sys.c106
7 files changed, 49 insertions, 178 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 8d6146a107d..a2e67558a31 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -639,7 +639,6 @@ struct qeth_card_options {
639 struct qeth_ipa_info adp; /*Adapter parameters*/ 639 struct qeth_ipa_info adp; /*Adapter parameters*/
640 struct qeth_routing_info route6; 640 struct qeth_routing_info route6;
641 struct qeth_ipa_info ipa6; 641 struct qeth_ipa_info ipa6;
642 enum qeth_checksum_types checksum_type;
643 int broadcast_mode; 642 int broadcast_mode;
644 int macaddr_mode; 643 int macaddr_mode;
645 int fake_broadcast; 644 int fake_broadcast;
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 85cc53117ea..4dffdbe9a67 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -1039,7 +1039,6 @@ static void qeth_set_intial_options(struct qeth_card *card)
1039{ 1039{
1040 card->options.route4.type = NO_ROUTER; 1040 card->options.route4.type = NO_ROUTER;
1041 card->options.route6.type = NO_ROUTER; 1041 card->options.route6.type = NO_ROUTER;
1042 card->options.checksum_type = QETH_CHECKSUM_DEFAULT;
1043 card->options.broadcast_mode = QETH_TR_BROADCAST_ALLRINGS; 1042 card->options.broadcast_mode = QETH_TR_BROADCAST_ALLRINGS;
1044 card->options.macaddr_mode = QETH_TR_MACADDR_NONCANONICAL; 1043 card->options.macaddr_mode = QETH_TR_MACADDR_NONCANONICAL;
1045 card->options.fake_broadcast = 0; 1044 card->options.fake_broadcast = 0;
diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h
index 07d588867b5..d8988dca812 100644
--- a/drivers/s390/net/qeth_core_mpc.h
+++ b/drivers/s390/net/qeth_core_mpc.h
@@ -80,14 +80,6 @@ enum qeth_tr_broadcast_modes {
80 QETH_TR_BROADCAST_LOCAL = 1, 80 QETH_TR_BROADCAST_LOCAL = 1,
81}; 81};
82 82
83/* these values match CHECKSUM_* in include/linux/skbuff.h */
84enum qeth_checksum_types {
85 SW_CHECKSUMMING = 0, /* TODO: set to bit flag used in IPA Command */
86 HW_CHECKSUMMING = 1,
87 NO_CHECKSUMMING = 2,
88};
89#define QETH_CHECKSUM_DEFAULT SW_CHECKSUMMING
90
91/* 83/*
92 * Routing stuff 84 * Routing stuff
93 */ 85 */
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 6fbaacb2194..8ba4c7e1ee3 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -420,10 +420,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
420 case QETH_HEADER_TYPE_LAYER2: 420 case QETH_HEADER_TYPE_LAYER2:
421 skb->pkt_type = PACKET_HOST; 421 skb->pkt_type = PACKET_HOST;
422 skb->protocol = eth_type_trans(skb, skb->dev); 422 skb->protocol = eth_type_trans(skb, skb->dev);
423 if (card->options.checksum_type == NO_CHECKSUMMING) 423 skb->ip_summed = CHECKSUM_NONE;
424 skb->ip_summed = CHECKSUM_UNNECESSARY;
425 else
426 skb->ip_summed = CHECKSUM_NONE;
427 if (skb->protocol == htons(ETH_P_802_2)) 424 if (skb->protocol == htons(ETH_P_802_2))
428 *((__u32 *)skb->cb) = ++card->seqno.pkt_seqno; 425 *((__u32 *)skb->cb) = ++card->seqno.pkt_seqno;
429 len = skb->len; 426 len = skb->len;
diff --git a/drivers/s390/net/qeth_l3.h b/drivers/s390/net/qeth_l3.h
index e705b27ec7d..14a43aeb0c2 100644
--- a/drivers/s390/net/qeth_l3.h
+++ b/drivers/s390/net/qeth_l3.h
@@ -62,8 +62,6 @@ void qeth_l3_del_vipa(struct qeth_card *, enum qeth_prot_versions, const u8 *);
62int qeth_l3_add_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *); 62int qeth_l3_add_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *);
63void qeth_l3_del_rxip(struct qeth_card *card, enum qeth_prot_versions, 63void qeth_l3_del_rxip(struct qeth_card *card, enum qeth_prot_versions,
64 const u8 *); 64 const u8 *);
65int qeth_l3_set_large_send(struct qeth_card *, enum qeth_large_send_types);
66int qeth_l3_set_rx_csum(struct qeth_card *, enum qeth_checksum_types);
67int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *, struct qeth_ipaddr *); 65int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *, struct qeth_ipaddr *);
68 66
69#endif /* __QETH_L3_H__ */ 67#endif /* __QETH_L3_H__ */
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 1496661507e..18484b586a3 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1445,34 +1445,30 @@ static int qeth_l3_send_checksum_command(struct qeth_card *card)
1445 return 0; 1445 return 0;
1446} 1446}
1447 1447
1448int qeth_l3_set_rx_csum(struct qeth_card *card, 1448int qeth_l3_set_rx_csum(struct qeth_card *card, int on)
1449 enum qeth_checksum_types csum_type)
1450{ 1449{
1451 int rc = 0; 1450 int rc = 0;
1452 1451
1453 if (card->options.checksum_type == HW_CHECKSUMMING) { 1452 if (on) {
1454 if ((csum_type != HW_CHECKSUMMING) && 1453 if (card->state != CARD_STATE_DOWN) {
1455 (card->state != CARD_STATE_DOWN)) { 1454 if (!qeth_is_supported(card,
1456 rc = qeth_l3_send_simple_setassparms(card, 1455 IPA_INBOUND_CHECKSUM))
1457 IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0); 1456 return -EPERM;
1457 rc = qeth_l3_send_checksum_command(card);
1458 if (rc) 1458 if (rc)
1459 return -EIO; 1459 return -EIO;
1460 } 1460 }
1461 card->dev->features |= NETIF_F_RXCSUM; 1461 card->dev->features |= NETIF_F_RXCSUM;
1462 } else { 1462 } else {
1463 if (csum_type == HW_CHECKSUMMING) { 1463 if (card->state != CARD_STATE_DOWN) {
1464 if (card->state != CARD_STATE_DOWN) { 1464 rc = qeth_l3_send_simple_setassparms(card,
1465 if (!qeth_is_supported(card, 1465 IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0);
1466 IPA_INBOUND_CHECKSUM)) 1466 if (rc)
1467 return -EPERM; 1467 return -EIO;
1468 rc = qeth_l3_send_checksum_command(card);
1469 if (rc)
1470 return -EIO;
1471 }
1472 } 1468 }
1473 card->dev->features &= ~NETIF_F_RXCSUM; 1469 card->dev->features &= ~NETIF_F_RXCSUM;
1474 } 1470 }
1475 card->options.checksum_type = csum_type; 1471
1476 return rc; 1472 return rc;
1477} 1473}
1478 1474
@@ -1482,32 +1478,34 @@ static int qeth_l3_start_ipa_checksum(struct qeth_card *card)
1482 1478
1483 QETH_CARD_TEXT(card, 3, "strtcsum"); 1479 QETH_CARD_TEXT(card, 3, "strtcsum");
1484 1480
1485 if (card->options.checksum_type == NO_CHECKSUMMING) { 1481 if (card->dev->features & NETIF_F_RXCSUM) {
1486 dev_info(&card->gdev->dev, 1482 /* hw may have changed during offline or recovery */
1487 "Using no checksumming on %s.\n", 1483 if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) {
1488 QETH_CARD_IFNAME(card)); 1484 dev_info(&card->gdev->dev,
1489 return 0;
1490 }
1491 if (card->options.checksum_type == SW_CHECKSUMMING) {
1492 dev_info(&card->gdev->dev,
1493 "Using SW checksumming on %s.\n",
1494 QETH_CARD_IFNAME(card));
1495 return 0;
1496 }
1497 if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) {
1498 dev_info(&card->gdev->dev,
1499 "Inbound HW Checksumming not " 1485 "Inbound HW Checksumming not "
1500 "supported on %s,\ncontinuing " 1486 "supported on %s,\ncontinuing "
1501 "using Inbound SW Checksumming\n", 1487 "using Inbound SW Checksumming\n",
1502 QETH_CARD_IFNAME(card)); 1488 QETH_CARD_IFNAME(card));
1503 card->options.checksum_type = SW_CHECKSUMMING; 1489 goto update_feature;
1504 return 0; 1490 }
1505 } 1491
1506 rc = qeth_l3_send_checksum_command(card); 1492 rc = qeth_l3_send_checksum_command(card);
1507 if (!rc) 1493 if (!rc)
1508 dev_info(&card->gdev->dev, 1494 dev_info(&card->gdev->dev,
1509 "HW Checksumming (inbound) enabled\n"); 1495 "HW Checksumming (inbound) enabled\n");
1496 else
1497 goto update_feature;
1498 } else
1499 dev_info(&card->gdev->dev,
1500 "Using SW checksumming on %s.\n",
1501 QETH_CARD_IFNAME(card));
1502 return 0;
1510 1503
1504update_feature:
1505 rtnl_lock();
1506 card->dev->features &= ~NETIF_F_RXCSUM;
1507 netdev_update_features(card->dev);
1508 rtnl_unlock();
1511 return rc; 1509 return rc;
1512} 1510}
1513 1511
@@ -2037,14 +2035,7 @@ static inline int qeth_l3_rebuild_skb(struct qeth_card *card,
2037 is_vlan = 1; 2035 is_vlan = 1;
2038 } 2036 }
2039 2037
2040 switch (card->options.checksum_type) { 2038 if (card->dev->features & NETIF_F_RXCSUM) {
2041 case SW_CHECKSUMMING:
2042 skb->ip_summed = CHECKSUM_NONE;
2043 break;
2044 case NO_CHECKSUMMING:
2045 skb->ip_summed = CHECKSUM_UNNECESSARY;
2046 break;
2047 case HW_CHECKSUMMING:
2048 if ((hdr->hdr.l3.ext_flags & 2039 if ((hdr->hdr.l3.ext_flags &
2049 (QETH_HDR_EXT_CSUM_HDR_REQ | 2040 (QETH_HDR_EXT_CSUM_HDR_REQ |
2050 QETH_HDR_EXT_CSUM_TRANSP_REQ)) == 2041 QETH_HDR_EXT_CSUM_TRANSP_REQ)) ==
@@ -2053,7 +2044,8 @@ static inline int qeth_l3_rebuild_skb(struct qeth_card *card,
2053 skb->ip_summed = CHECKSUM_UNNECESSARY; 2044 skb->ip_summed = CHECKSUM_UNNECESSARY;
2054 else 2045 else
2055 skb->ip_summed = CHECKSUM_NONE; 2046 skb->ip_summed = CHECKSUM_NONE;
2056 } 2047 } else
2048 skb->ip_summed = CHECKSUM_NONE;
2057 2049
2058 return is_vlan; 2050 return is_vlan;
2059} 2051}
@@ -3235,20 +3227,19 @@ static u32 qeth_l3_fix_features(struct net_device *dev, u32 features)
3235 3227
3236static int qeth_l3_set_features(struct net_device *dev, u32 features) 3228static int qeth_l3_set_features(struct net_device *dev, u32 features)
3237{ 3229{
3238 enum qeth_checksum_types csum_type;
3239 struct qeth_card *card = dev->ml_priv; 3230 struct qeth_card *card = dev->ml_priv;
3240 u32 changed = dev->features ^ features; 3231 u32 changed = dev->features ^ features;
3232 int on;
3241 3233
3242 if (!(changed & NETIF_F_RXCSUM)) 3234 if (!(changed & NETIF_F_RXCSUM))
3243 return 0; 3235 return 0;
3244 3236
3245 if (features & NETIF_F_RXCSUM) 3237 if (features & NETIF_F_RXCSUM)
3246 csum_type = HW_CHECKSUMMING; 3238 on = 1;
3247 else 3239 else
3248 csum_type = SW_CHECKSUMMING; 3240 on = 0;
3249 3241
3250 dev->features = features ^ NETIF_F_RXCSUM; 3242 return qeth_l3_set_rx_csum(card, on);
3251 return qeth_l3_set_rx_csum(card, csum_type);
3252} 3243}
3253 3244
3254static const struct ethtool_ops qeth_l3_ethtool_ops = { 3245static const struct ethtool_ops qeth_l3_ethtool_ops = {
@@ -3342,6 +3333,12 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
3342 if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD)) 3333 if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD))
3343 card->dev->dev_id = card->info.unique_id & 3334 card->dev->dev_id = card->info.unique_id &
3344 0xffff; 3335 0xffff;
3336 if (!card->info.guestlan) {
3337 card->dev->hw_features = NETIF_F_SG |
3338 NETIF_F_RXCSUM | NETIF_F_IP_CSUM |
3339 NETIF_F_TSO;
3340 card->dev->features = NETIF_F_RXCSUM;
3341 }
3345 } 3342 }
3346 } else if (card->info.type == QETH_CARD_TYPE_IQD) { 3343 } else if (card->info.type == QETH_CARD_TYPE_IQD) {
3347 card->dev = alloc_netdev(0, "hsi%d", ether_setup); 3344 card->dev = alloc_netdev(0, "hsi%d", ether_setup);
@@ -3357,8 +3354,6 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
3357 card->dev->watchdog_timeo = QETH_TX_TIMEOUT; 3354 card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
3358 card->dev->mtu = card->info.initial_mtu; 3355 card->dev->mtu = card->info.initial_mtu;
3359 SET_ETHTOOL_OPS(card->dev, &qeth_l3_ethtool_ops); 3356 SET_ETHTOOL_OPS(card->dev, &qeth_l3_ethtool_ops);
3360 card->dev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
3361 NETIF_F_IP_CSUM | NETIF_F_TSO;
3362 card->dev->features |= NETIF_F_HW_VLAN_TX | 3357 card->dev->features |= NETIF_F_HW_VLAN_TX |
3363 NETIF_F_HW_VLAN_RX | 3358 NETIF_F_HW_VLAN_RX |
3364 NETIF_F_HW_VLAN_FILTER; 3359 NETIF_F_HW_VLAN_FILTER;
@@ -3382,9 +3377,6 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
3382 card->discipline.output_handler = (qdio_handler_t *) 3377 card->discipline.output_handler = (qdio_handler_t *)
3383 qeth_qdio_output_handler; 3378 qeth_qdio_output_handler;
3384 card->discipline.recover = qeth_l3_recover; 3379 card->discipline.recover = qeth_l3_recover;
3385 if ((card->info.type == QETH_CARD_TYPE_OSD) ||
3386 (card->info.type == QETH_CARD_TYPE_OSX))
3387 card->options.checksum_type = HW_CHECKSUMMING;
3388 return 0; 3380 return 0;
3389} 3381}
3390 3382
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index bf9f003e3a9..cd99210296e 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -15,16 +15,6 @@
15#define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \ 15#define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \
16struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store) 16struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store)
17 17
18static const char *qeth_l3_get_checksum_str(struct qeth_card *card)
19{
20 if (card->options.checksum_type == SW_CHECKSUMMING)
21 return "sw";
22 else if (card->options.checksum_type == HW_CHECKSUMMING)
23 return "hw";
24 else
25 return "no";
26}
27
28static ssize_t qeth_l3_dev_route_show(struct qeth_card *card, 18static ssize_t qeth_l3_dev_route_show(struct qeth_card *card,
29 struct qeth_routing_info *route, char *buf) 19 struct qeth_routing_info *route, char *buf)
30{ 20{
@@ -295,51 +285,6 @@ out:
295static DEVICE_ATTR(canonical_macaddr, 0644, qeth_l3_dev_canonical_macaddr_show, 285static DEVICE_ATTR(canonical_macaddr, 0644, qeth_l3_dev_canonical_macaddr_show,
296 qeth_l3_dev_canonical_macaddr_store); 286 qeth_l3_dev_canonical_macaddr_store);
297 287
298static ssize_t qeth_l3_dev_checksum_show(struct device *dev,
299 struct device_attribute *attr, char *buf)
300{
301 struct qeth_card *card = dev_get_drvdata(dev);
302
303 if (!card)
304 return -EINVAL;
305
306 return sprintf(buf, "%s checksumming\n",
307 qeth_l3_get_checksum_str(card));
308}
309
310static ssize_t qeth_l3_dev_checksum_store(struct device *dev,
311 struct device_attribute *attr, const char *buf, size_t count)
312{
313 struct qeth_card *card = dev_get_drvdata(dev);
314 enum qeth_checksum_types csum_type;
315 char *tmp;
316 int rc = 0;
317
318 if (!card)
319 return -EINVAL;
320
321 mutex_lock(&card->conf_mutex);
322 tmp = strsep((char **) &buf, "\n");
323 if (!strcmp(tmp, "sw_checksumming"))
324 csum_type = SW_CHECKSUMMING;
325 else if (!strcmp(tmp, "hw_checksumming"))
326 csum_type = HW_CHECKSUMMING;
327 else if (!strcmp(tmp, "no_checksumming"))
328 csum_type = NO_CHECKSUMMING;
329 else {
330 rc = -EINVAL;
331 goto out;
332 }
333
334 rc = qeth_l3_set_rx_csum(card, csum_type);
335out:
336 mutex_unlock(&card->conf_mutex);
337 return rc ? rc : count;
338}
339
340static DEVICE_ATTR(checksumming, 0644, qeth_l3_dev_checksum_show,
341 qeth_l3_dev_checksum_store);
342
343static ssize_t qeth_l3_dev_sniffer_show(struct device *dev, 288static ssize_t qeth_l3_dev_sniffer_show(struct device *dev,
344 struct device_attribute *attr, char *buf) 289 struct device_attribute *attr, char *buf)
345{ 290{
@@ -402,64 +347,13 @@ out:
402static DEVICE_ATTR(sniffer, 0644, qeth_l3_dev_sniffer_show, 347static DEVICE_ATTR(sniffer, 0644, qeth_l3_dev_sniffer_show,
403 qeth_l3_dev_sniffer_store); 348 qeth_l3_dev_sniffer_store);
404 349
405static ssize_t qeth_l3_dev_large_send_show(struct device *dev,
406 struct device_attribute *attr, char *buf)
407{
408 struct qeth_card *card = dev_get_drvdata(dev);
409
410 if (!card)
411 return -EINVAL;
412
413 if (!(card->dev->features & NETIF_F_TSO))
414 return sprintf(buf, "%s\n", "no");
415 else
416 return sprintf(buf, "%s\n", "TSO");
417}
418
419static ssize_t qeth_l3_dev_large_send_store(struct device *dev,
420 struct device_attribute *attr, const char *buf, size_t count)
421{
422 struct qeth_card *card;
423 char *tmp;
424 int enable;
425
426 if (!card)
427 return -EINVAL;
428 tmp = strsep((char **) &buf, "\n");
429 if (!strcmp(tmp, "no"))
430 enable = 0;
431 else if (!strcmp(tmp, "TSO"))
432 enable = 1;
433 else
434 return -EINVAL;
435
436 rtnl_lock();
437
438 card = dev_get_drvdata(dev);
439
440 if (enable)
441 card->dev->wanted_features |= NETIF_F_TSO;
442 else
443 card->dev->wanted_features &= ~NETIF_F_TSO;
444 netdev_update_features(card->dev);
445
446 rtnl_unlock();
447
448 return count;
449}
450
451static DEVICE_ATTR(large_send, 0644, qeth_l3_dev_large_send_show,
452 qeth_l3_dev_large_send_store);
453
454static struct attribute *qeth_l3_device_attrs[] = { 350static struct attribute *qeth_l3_device_attrs[] = {
455 &dev_attr_route4.attr, 351 &dev_attr_route4.attr,
456 &dev_attr_route6.attr, 352 &dev_attr_route6.attr,
457 &dev_attr_fake_broadcast.attr, 353 &dev_attr_fake_broadcast.attr,
458 &dev_attr_broadcast_mode.attr, 354 &dev_attr_broadcast_mode.attr,
459 &dev_attr_canonical_macaddr.attr, 355 &dev_attr_canonical_macaddr.attr,
460 &dev_attr_checksumming.attr,
461 &dev_attr_sniffer.attr, 356 &dev_attr_sniffer.attr,
462 &dev_attr_large_send.attr,
463 NULL, 357 NULL,
464}; 358};
465 359